Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Blastmask from Majora's Mask #7

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions soh/soh/Enhancements/custom-message/CustomMessageTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ typedef enum {
TEXT_WARP_RANDOM_REPLACED_TEXT = 0x9200,
TEXT_LAKE_HYLIA_WATER_SWITCH_SIGN = 0x346, // 0x3yy for cuttable sign range
TEXT_LAKE_HYLIA_WATER_SWITCH_NAVI = 0x1B3, // 0x1yy for Navi msg range
TEXT_BLAST_MASK = 0x1B4,
} TextIDs;

#ifdef __cplusplus
Expand Down
20 changes: 20 additions & 0 deletions soh/soh/Enhancements/mods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,25 @@ void RegisterRandomizedEnemySizes() {
});
}

void RegisterBlastMask() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerUpdate>([]() {
if (!CVarGetInteger("gBlastmask", 0)) {
return;
}
Player* player = GET_PLAYER(gPlayState);
u8 currentMask = Player_GetMask(gPlayState);
Input* input = &gPlayState->state.input[0];
if (currentMask == PLAYER_MASK_SPOOKY) {
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
GameInteractor::RawAction::SpawnActor(ACTOR_EN_BOM, 1);
}
gPlayState->interfaceCtx.restrictions.bButton = 1;
} else {
gPlayState->interfaceCtx.restrictions.bButton = 0;
}
});
}

void InitMods() {
RegisterTTS();
RegisterInfiniteMoney();
Expand Down Expand Up @@ -1101,4 +1120,5 @@ void InitMods() {
RegisterRandomizerSheikSpawn();
RegisterRandomizedEnemySizes();
NameTag_RegisterHooks();
RegisterBlastMask();
}
3 changes: 3 additions & 0 deletions soh/soh/OTRGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2463,6 +2463,9 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
if (textId == TEXT_MARKET_GUARD_NIGHT && CVarGetInteger("gMarketSneak", 0) && play->sceneNum == SCENE_MARKET_ENTRANCE_NIGHT) {
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_MARKET_GUARD_NIGHT);
}
if (textId == TEXT_BLAST_MASK && CVarGetInteger("gBlastmask", 0)) {
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_BLAST_MASK);
}
font->charTexBuf[0] = (messageEntry.GetTextBoxType() << 4) | messageEntry.GetTextBoxPosition();
switch (gSaveContext.language) {
case LANGUAGE_FRA:
Expand Down
2 changes: 2 additions & 0 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,8 @@ void DrawEnhancementsMenu() {
"Wearing the Bunny Hood grants a speed increase like in Majora's Mask. The longer jump option is not accounted for in randomizer logic.\n\n"
"Also disables NPC's reactions to wearing the Bunny Hood."
);
UIWidgets::PaddedEnhancementCheckbox("Enable Blastmask", "gBlastmask", true, false);
UIWidgets::Tooltip("Press B to explode!");
UIWidgets::PaddedEnhancementCheckbox("Bunny Hood Equippable as Adult", "gAdultBunnyHood", true, false, (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) == BUNNY_HOOD_VANILLA), "Only available with increased bunny hood speed", UIWidgets::CheckboxGraphics::Cross, false);
UIWidgets::Tooltip("Allows the bunny hood to be equipped normally from the pause menu as adult.");
UIWidgets::PaddedEnhancementCheckbox("Mask Select in Inventory", "gMaskSelect", true, false);
Expand Down
3 changes: 3 additions & 0 deletions soh/soh/z_message_OTR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,7 @@ extern "C" void OTRMessage_Init()
CustomMessage("You look bored. Wanna go out for a&walk?\x1B&%gYes&No%w",
"Du siehst gelangweilt aus.&Willst du einen Spaziergang machen?\x1B&%gJa&Nein%w",
"Tu as l'air de t'ennuyer. Tu veux&aller faire un tour?\x1B&%gOui&Non%w"));
CustomMessageManager::Instance->CreateMessage(
customMessageTableID, TEXT_BLAST_MASK,
CustomMessage("Have you tried pressing B?", "Have you tried pressing B?", "Have you tried pressing B?"));
}
5 changes: 4 additions & 1 deletion soh/src/code/z_face_reaction.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "global.h"
#include "soh/Enhancements/enhancementTypes.h"
#include "soh/Enhancements/custom-message/CustomMessageTypes.h"

u16 sReactionTextIds[][PLAYER_MASK_MAX] = {
{ 0x0000, 0x7124, 0x7127, 0x7126, 0x7125, 0x7127, 0x7124, 0x7125, 0x7127 },
Expand Down Expand Up @@ -66,7 +67,9 @@ u16 sReactionTextIds[][PLAYER_MASK_MAX] = {

u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) {
u8 currentMask = Player_GetMask(play);

if (CVarGetInteger("gBlastmask", 0) && Player_GetMask(gPlayState) == PLAYER_MASK_SPOOKY) {
return TEXT_BLAST_MASK;
}
if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && currentMask == PLAYER_MASK_BUNNY) {
return 0;
} else {
Expand Down
Loading