Skip to content

Commit

Permalink
[Enhancement] Blast Mask with Powder Keg (HarbourMasters#642)
Browse files Browse the repository at this point in the history
* Blast Mask adds Powder Keg explosive property.

* Alphabetical Menu Listing + clang

* Apply suggestions from code review

---------

Co-authored-by: Garrett Cox <[email protected]>
  • Loading branch information
Caladius and garrettjoecox authored Jun 3, 2024
1 parent 5de6a9a commit 2d8bc17
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions mm/2s2h/BenGui/BenMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ void DrawEnhancementsMenu() {
}

if (UIWidgets::BeginMenu("Masks")) {
UIWidgets::CVarCheckbox("Blast Mask has Powder Keg Force", "gEnhancements.Masks.BlastMaskKeg");
UIWidgets::CVarCheckbox("Fast Transformation", "gEnhancements.Masks.FastTransformation");
UIWidgets::CVarCheckbox("Fierce Deity's Mask Anywhere", "gEnhancements.Masks.FierceDeitysAnywhere",
{ .tooltip = "Allow using Fierce Deity's mask outside of boss rooms." });
Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Enhancements/Enhancements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void InitEnhancements() {
// Masks
RegisterFastTransformation();
RegisterFierceDeityAnywhere();
RegisterBlastMaskKeg();
RegisterNoBlastMaskCooldown();

// Minigames
Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Enhancements/Enhancements.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "Cheats/UnrestrictedItems.h"
#include "Cycle/EndOfCycle.h"
#include "Equipment/SkipMagicArrowEquip.h"
#include "Masks/BlastMaskKeg.h"
#include "Masks/FierceDeityAnywhere.h"
#include "Masks/NoBlastMaskCooldown.h"
#include "Masks/FastTransformation.h"
Expand Down
31 changes: 31 additions & 0 deletions mm/2s2h/Enhancements/Masks/BlastMaskKeg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <libultraship/bridge.h>
#include "Enhancements/GameInteractor/GameInteractor.h"
#include "global.h"

static uint32_t bombType;

extern "C" {
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
EquipSlot func_8082FDC4(void);
}

void RegisterBlastMaskKeg() {
GameInteractor::Instance->RegisterGameHookForID<GameInteractor::ShouldActorInit>(
ACTOR_EN_BOM, [](Actor* actor, bool* should) {
Player* player = GET_PLAYER(gPlayState);
if (CVarGetInteger("gEnhancements.Masks.BlastMaskKeg", 0)) {
ItemId item;
EquipSlot i = func_8082FDC4();

i = ((i >= EQUIP_SLOT_A) && (player->transformation == PLAYER_FORM_FIERCE_DEITY) &&
(player->heldItemAction != PLAYER_IA_SWORD_TWO_HANDED))
? EQUIP_SLOT_B
: i;

item = Player_GetItemOnButton(gPlayState, player, i);
if (item == ITEM_F0) {
actor->shape.rot.x = BOMB_EXPLOSIVE_TYPE_POWDER_KEG;
}
}
});
}
6 changes: 6 additions & 0 deletions mm/2s2h/Enhancements/Masks/BlastMaskKeg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef EQUIPMENT_BLAST_MASK_KEG_H
#define EQUIPMENT_BLAST_MASK_KEG_H

void RegisterBlastMaskKeg();

#endif // EQUIPMENT_BLAST_MASK_KEG_H

0 comments on commit 2d8bc17

Please sign in to comment.