Add temp flag aliases

This commit is contained in:
GriffinR 2023-08-03 15:45:53 -04:00
parent da238562f0
commit 6d4dadd7b5
8 changed files with 35 additions and 27 deletions

View File

@ -51,10 +51,10 @@ IslandCave_EventScript_OpenRegiEntrance::
IslandCave_EventScript_CaveEntranceMiddle:: IslandCave_EventScript_CaveEntranceMiddle::
lockall lockall
call_if_set FLAG_TEMP_3, IslandCave_EventScript_ClearSteps call_if_set FLAG_TEMP_REGICE_PUZZLE_FAILED, IslandCave_EventScript_ClearSteps
goto_if_set FLAG_SYS_BRAILLE_REGICE_COMPLETED, IslandCave_EventScript_BigHoleInWall goto_if_set FLAG_SYS_BRAILLE_REGICE_COMPLETED, IslandCave_EventScript_BigHoleInWall
braillemessage IslandCave_Braille_RunLapAroundWall braillemessage IslandCave_Braille_RunLapAroundWall
setflag FLAG_TEMP_2 setflag FLAG_TEMP_REGICE_PUZZLE_STARTED
special ShouldDoBrailleRegicePuzzle special ShouldDoBrailleRegicePuzzle
goto IslandCave_EventScript_CloseBrailleMsg goto IslandCave_EventScript_CloseBrailleMsg
end end
@ -66,10 +66,10 @@ IslandCave_EventScript_BigHoleInWall::
IslandCave_EventScript_CaveEntranceSide:: IslandCave_EventScript_CaveEntranceSide::
lockall lockall
call_if_set FLAG_TEMP_3, IslandCave_EventScript_ClearSteps call_if_set FLAG_TEMP_REGICE_PUZZLE_FAILED, IslandCave_EventScript_ClearSteps
braillemessage IslandCave_Braille_RunLapAroundWall braillemessage IslandCave_Braille_RunLapAroundWall
goto_if_set FLAG_SYS_BRAILLE_REGICE_COMPLETED, IslandCave_EventScript_CloseBrailleMsg goto_if_set FLAG_SYS_BRAILLE_REGICE_COMPLETED, IslandCave_EventScript_CloseBrailleMsg
setflag FLAG_TEMP_2 setflag FLAG_TEMP_REGICE_PUZZLE_STARTED
special ShouldDoBrailleRegicePuzzle special ShouldDoBrailleRegicePuzzle
goto IslandCave_EventScript_CloseBrailleMsg goto IslandCave_EventScript_CloseBrailleMsg
end end
@ -84,7 +84,7 @@ IslandCave_EventScript_ClearSteps::
setvar VAR_REGICE_STEPS_1, 0 setvar VAR_REGICE_STEPS_1, 0
setvar VAR_REGICE_STEPS_2, 0 setvar VAR_REGICE_STEPS_2, 0
setvar VAR_REGICE_STEPS_3, 0 setvar VAR_REGICE_STEPS_3, 0
clearflag FLAG_TEMP_3 clearflag FLAG_TEMP_REGICE_PUZZLE_FAILED
return return
IslandCave_EventScript_Regice:: IslandCave_EventScript_Regice::

View File

@ -62,7 +62,7 @@
"trainer_type": "TRAINER_TYPE_NONE", "trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_130_LIECHI", "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_130_LIECHI",
"script": "BerryTreeScript", "script": "BerryTreeScript",
"flag": "FLAG_TEMP_11" "flag": "FLAG_TEMP_HIDE_MIRAGE_ISLAND_BERRY_TREE"
}, },
{ {
"graphics_id": "OBJ_EVENT_GFX_SWIMMER_M", "graphics_id": "OBJ_EVENT_GFX_SWIMMER_M",

View File

@ -6,7 +6,8 @@ Route130_OnTransition:
call_if_ge VAR_SOOTOPOLIS_CITY_STATE, 4, Route130_EventScript_CheckSetAbnormalWeather call_if_ge VAR_SOOTOPOLIS_CITY_STATE, 4, Route130_EventScript_CheckSetAbnormalWeather
specialvar VAR_RESULT, IsMirageIslandPresent specialvar VAR_RESULT, IsMirageIslandPresent
goto_if_eq VAR_RESULT, TRUE, Route130_EventScript_SetMirageIslandLayout goto_if_eq VAR_RESULT, TRUE, Route130_EventScript_SetMirageIslandLayout
setflag FLAG_TEMP_11 @ Mirage Island isn't currently visible, hide any objects on the island. Only the first flag is actually associated with anything.
setflag FLAG_TEMP_HIDE_MIRAGE_ISLAND_BERRY_TREE
setflag FLAG_TEMP_12 setflag FLAG_TEMP_12
setflag FLAG_TEMP_13 setflag FLAG_TEMP_13
setflag FLAG_TEMP_14 setflag FLAG_TEMP_14

View File

@ -33,9 +33,9 @@ ShoalCave_LowTideEntranceRoom_EventScript_ShellBellExpert::
removeitem ITEM_SHOAL_SALT, 4 removeitem ITEM_SHOAL_SALT, 4
removeitem ITEM_SHOAL_SHELL, 4 removeitem ITEM_SHOAL_SHELL, 4
giveitem ITEM_SHELL_BELL giveitem ITEM_SHELL_BELL
goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull @ Never FALSE, we already made sure there will be room in the bag.
msgbox ShoalCave_LowTideEntranceRoom_Text_ExplainShellBell, MSGBOX_DEFAULT msgbox ShoalCave_LowTideEntranceRoom_Text_ExplainShellBell, MSGBOX_DEFAULT
setflag FLAG_TEMP_2 setflag FLAG_TEMP_2 @ Not read. Perhaps meant to stop him from re-explaining the Shell Bell if multiple are received in one sitting.
release release
end end

View File

@ -202,7 +202,7 @@ GabbyAndTy_EventScript_FirstInterview::
call_if_eq VAR_FACING, DIR_NORTH, GabbyAndTy_EventScript_FacePlayerNorth call_if_eq VAR_FACING, DIR_NORTH, GabbyAndTy_EventScript_FacePlayerNorth
call_if_eq VAR_FACING, DIR_SOUTH, GabbyAndTy_EventScript_FacePlayerSouth call_if_eq VAR_FACING, DIR_SOUTH, GabbyAndTy_EventScript_FacePlayerSouth
call_if_eq VAR_FACING, DIR_EAST, GabbyAndTy_EventScript_FacePlayerEast call_if_eq VAR_FACING, DIR_EAST, GabbyAndTy_EventScript_FacePlayerEast
goto_if_set FLAG_TEMP_1, GabbyAndTy_EventScript_KeepingAnEyeOutForYou goto_if_set FLAG_TEMP_SKIP_GABBY_INTERVIEW, GabbyAndTy_EventScript_KeepingAnEyeOutForYou
msgbox GabbyAndTy_Text_WhoAreYouInterview, MSGBOX_YESNO msgbox GabbyAndTy_Text_WhoAreYouInterview, MSGBOX_YESNO
goto GabbyAndTy_EventScript_Interview goto GabbyAndTy_EventScript_Interview
end end
@ -230,7 +230,7 @@ GabbyAndTy_EventScript_RequestInterview::
call_if_eq VAR_FACING, DIR_NORTH, GabbyAndTy_EventScript_FacePlayerNorth call_if_eq VAR_FACING, DIR_NORTH, GabbyAndTy_EventScript_FacePlayerNorth
call_if_eq VAR_FACING, DIR_SOUTH, GabbyAndTy_EventScript_FacePlayerSouth call_if_eq VAR_FACING, DIR_SOUTH, GabbyAndTy_EventScript_FacePlayerSouth
call_if_eq VAR_FACING, DIR_EAST, GabbyAndTy_EventScript_FacePlayerEast call_if_eq VAR_FACING, DIR_EAST, GabbyAndTy_EventScript_FacePlayerEast
goto_if_set FLAG_TEMP_1, GabbyAndTy_EventScript_KeepingAnEyeOutForYou goto_if_set FLAG_TEMP_SKIP_GABBY_INTERVIEW, GabbyAndTy_EventScript_KeepingAnEyeOutForYou
specialvar VAR_RESULT, GabbyAndTyGetLastQuote specialvar VAR_RESULT, GabbyAndTyGetLastQuote
goto_if_eq VAR_RESULT, 0, GabbyAndTy_EventScript_DidntInterviewLastTime goto_if_eq VAR_RESULT, 0, GabbyAndTy_EventScript_DidntInterviewLastTime
msgbox GabbyAndTy_Text_QuoteFromLastInterview, MSGBOX_DEFAULT msgbox GabbyAndTy_Text_QuoteFromLastInterview, MSGBOX_DEFAULT
@ -295,13 +295,13 @@ GabbyAndTy_EventScript_Interview::
goto_if_eq VAR_RESULT, 0, GabbyAndTy_EventScript_DontGiveUpKeepingEyeOut goto_if_eq VAR_RESULT, 0, GabbyAndTy_EventScript_DontGiveUpKeepingEyeOut
msgbox GabbyAndTy_Text_PerfectWellBeSeeingYou, MSGBOX_DEFAULT msgbox GabbyAndTy_Text_PerfectWellBeSeeingYou, MSGBOX_DEFAULT
special GabbyAndTyAfterInterview special GabbyAndTyAfterInterview
setflag FLAG_TEMP_1 setflag FLAG_TEMP_SKIP_GABBY_INTERVIEW
release release
end end
GabbyAndTy_EventScript_DontGiveUpKeepingEyeOut:: GabbyAndTy_EventScript_DontGiveUpKeepingEyeOut::
msgbox GabbyAndTy_Text_DontGiveUpKeepingEyeOut, MSGBOX_DEFAULT msgbox GabbyAndTy_Text_DontGiveUpKeepingEyeOut, MSGBOX_DEFAULT
setflag FLAG_TEMP_1 setflag FLAG_TEMP_SKIP_GABBY_INTERVIEW
release release
end end

View File

@ -1644,4 +1644,10 @@
// FLAG_SPECIAL_FLAG_0x4005 - 0x407F also exist and are unused // FLAG_SPECIAL_FLAG_0x4005 - 0x407F also exist and are unused
#define SPECIAL_FLAGS_END (SPECIAL_FLAGS_START + 0x7F) #define SPECIAL_FLAGS_END (SPECIAL_FLAGS_START + 0x7F)
// Temp flag aliases
#define FLAG_TEMP_SKIP_GABBY_INTERVIEW FLAG_TEMP_1
#define FLAG_TEMP_REGICE_PUZZLE_STARTED FLAG_TEMP_2
#define FLAG_TEMP_REGICE_PUZZLE_FAILED FLAG_TEMP_3
#define FLAG_TEMP_HIDE_MIRAGE_ISLAND_BERRY_TREE FLAG_TEMP_11
#endif // GUARD_CONSTANTS_FLAGS_H #endif // GUARD_CONSTANTS_FLAGS_H

View File

@ -278,6 +278,8 @@ bool8 FldEff_UsePuzzleEffect(void)
return FALSE; return FALSE;
} }
// The puzzle to unlock Regice's cave requires the player to interact with the braille message on the back wall,
// step on every space on the perimeter of the cave (and only those spaces) then return to the back wall.
bool8 ShouldDoBrailleRegicePuzzle(void) bool8 ShouldDoBrailleRegicePuzzle(void)
{ {
u8 i; u8 i;
@ -287,9 +289,11 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
{ {
if (FlagGet(FLAG_SYS_BRAILLE_REGICE_COMPLETED)) if (FlagGet(FLAG_SYS_BRAILLE_REGICE_COMPLETED))
return FALSE; return FALSE;
if (FlagGet(FLAG_TEMP_2) == FALSE) // Set when the player interacts with the braille message
if (FlagGet(FLAG_TEMP_REGICE_PUZZLE_STARTED) == FALSE)
return FALSE; return FALSE;
if (FlagGet(FLAG_TEMP_3) == TRUE) // Cleared when the player interacts with the braille message
if (FlagGet(FLAG_TEMP_REGICE_PUZZLE_FAILED) == TRUE)
return FALSE; return FALSE;
for (i = 0; i < ARRAY_COUNT(sRegicePathCoords); i++) for (i = 0; i < ARRAY_COUNT(sRegicePathCoords); i++)
@ -298,8 +302,7 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
u8 yPos = sRegicePathCoords[i][1]; u8 yPos = sRegicePathCoords[i][1];
if (gSaveBlock1Ptr->pos.x == xPos && gSaveBlock1Ptr->pos.y == yPos) if (gSaveBlock1Ptr->pos.x == xPos && gSaveBlock1Ptr->pos.y == yPos)
{ {
u16 varValue; // Player is standing on a correct space, set the corresponding bit
if (i < 16) if (i < 16)
{ {
u16 val = VarGet(VAR_REGICE_STEPS_1); u16 val = VarGet(VAR_REGICE_STEPS_1);
@ -319,11 +322,11 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
VarSet(VAR_REGICE_STEPS_3, val); VarSet(VAR_REGICE_STEPS_3, val);
} }
varValue = VarGet(VAR_REGICE_STEPS_1); // Make sure a full lap has been completed. There are 36 steps in a lap, so 16+16+4 bits to check across the 3 vars.
if (varValue != 0xFFFF || VarGet(VAR_REGICE_STEPS_2) != 0xFFFF || VarGet(VAR_REGICE_STEPS_3) != 0xF) if (VarGet(VAR_REGICE_STEPS_1) != 0xFFFF || VarGet(VAR_REGICE_STEPS_2) != 0xFFFF || VarGet(VAR_REGICE_STEPS_3) != 0xF)
return FALSE; return FALSE;
// This final check is redundant. // A lap has been completed, the puzzle is complete when the player returns to the braille message.
if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 21) if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 21)
return TRUE; return TRUE;
else else
@ -331,8 +334,9 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
} }
} }
FlagSet(FLAG_TEMP_3); // Player stepped on an incorrect space, puzzle failed.
FlagClear(FLAG_TEMP_2); FlagSet(FLAG_TEMP_REGICE_PUZZLE_FAILED);
FlagClear(FLAG_TEMP_REGICE_PUZZLE_STARTED);
} }
return FALSE; return FALSE;

View File

@ -941,9 +941,8 @@ void GabbyAndTyBeforeInterview(void)
gSaveBlock1Ptr->gabbyAndTyData.mon2 = gBattleResults.playerMon2Species; gSaveBlock1Ptr->gabbyAndTyData.mon2 = gBattleResults.playerMon2Species;
gSaveBlock1Ptr->gabbyAndTyData.lastMove = gBattleResults.lastUsedMovePlayer; gSaveBlock1Ptr->gabbyAndTyData.lastMove = gBattleResults.lastUsedMovePlayer;
if (gSaveBlock1Ptr->gabbyAndTyData.battleNum != 0xFF) if (gSaveBlock1Ptr->gabbyAndTyData.battleNum != 0xFF)
{
gSaveBlock1Ptr->gabbyAndTyData.battleNum++; gSaveBlock1Ptr->gabbyAndTyData.battleNum++;
}
gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn = gBattleResults.playerMonWasDamaged; gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn = gBattleResults.playerMonWasDamaged;
if (gBattleResults.playerFaintCounter != 0) if (gBattleResults.playerFaintCounter != 0)
@ -975,9 +974,7 @@ void GabbyAndTyBeforeInterview(void)
TakeGabbyAndTyOffTheAir(); TakeGabbyAndTyOffTheAir();
if (gSaveBlock1Ptr->gabbyAndTyData.lastMove == MOVE_NONE) if (gSaveBlock1Ptr->gabbyAndTyData.lastMove == MOVE_NONE)
{ FlagSet(FLAG_TEMP_SKIP_GABBY_INTERVIEW);
FlagSet(FLAG_TEMP_1);
}
} }
void GabbyAndTyAfterInterview(void) void GabbyAndTyAfterInterview(void)