mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Add temp flag aliases
This commit is contained in:
parent
da238562f0
commit
6d4dadd7b5
@ -51,10 +51,10 @@ IslandCave_EventScript_OpenRegiEntrance::
|
||||
|
||||
IslandCave_EventScript_CaveEntranceMiddle::
|
||||
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
|
||||
braillemessage IslandCave_Braille_RunLapAroundWall
|
||||
setflag FLAG_TEMP_2
|
||||
setflag FLAG_TEMP_REGICE_PUZZLE_STARTED
|
||||
special ShouldDoBrailleRegicePuzzle
|
||||
goto IslandCave_EventScript_CloseBrailleMsg
|
||||
end
|
||||
@ -66,10 +66,10 @@ IslandCave_EventScript_BigHoleInWall::
|
||||
|
||||
IslandCave_EventScript_CaveEntranceSide::
|
||||
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
|
||||
goto_if_set FLAG_SYS_BRAILLE_REGICE_COMPLETED, IslandCave_EventScript_CloseBrailleMsg
|
||||
setflag FLAG_TEMP_2
|
||||
setflag FLAG_TEMP_REGICE_PUZZLE_STARTED
|
||||
special ShouldDoBrailleRegicePuzzle
|
||||
goto IslandCave_EventScript_CloseBrailleMsg
|
||||
end
|
||||
@ -84,7 +84,7 @@ IslandCave_EventScript_ClearSteps::
|
||||
setvar VAR_REGICE_STEPS_1, 0
|
||||
setvar VAR_REGICE_STEPS_2, 0
|
||||
setvar VAR_REGICE_STEPS_3, 0
|
||||
clearflag FLAG_TEMP_3
|
||||
clearflag FLAG_TEMP_REGICE_PUZZLE_FAILED
|
||||
return
|
||||
|
||||
IslandCave_EventScript_Regice::
|
||||
|
@ -62,7 +62,7 @@
|
||||
"trainer_type": "TRAINER_TYPE_NONE",
|
||||
"trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_130_LIECHI",
|
||||
"script": "BerryTreeScript",
|
||||
"flag": "FLAG_TEMP_11"
|
||||
"flag": "FLAG_TEMP_HIDE_MIRAGE_ISLAND_BERRY_TREE"
|
||||
},
|
||||
{
|
||||
"graphics_id": "OBJ_EVENT_GFX_SWIMMER_M",
|
||||
|
@ -6,7 +6,8 @@ Route130_OnTransition:
|
||||
call_if_ge VAR_SOOTOPOLIS_CITY_STATE, 4, Route130_EventScript_CheckSetAbnormalWeather
|
||||
specialvar VAR_RESULT, IsMirageIslandPresent
|
||||
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_13
|
||||
setflag FLAG_TEMP_14
|
||||
|
@ -33,9 +33,9 @@ ShoalCave_LowTideEntranceRoom_EventScript_ShellBellExpert::
|
||||
removeitem ITEM_SHOAL_SALT, 4
|
||||
removeitem ITEM_SHOAL_SHELL, 4
|
||||
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
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -202,7 +202,7 @@ GabbyAndTy_EventScript_FirstInterview::
|
||||
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_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
|
||||
goto GabbyAndTy_EventScript_Interview
|
||||
end
|
||||
@ -230,7 +230,7 @@ GabbyAndTy_EventScript_RequestInterview::
|
||||
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_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
|
||||
goto_if_eq VAR_RESULT, 0, GabbyAndTy_EventScript_DidntInterviewLastTime
|
||||
msgbox GabbyAndTy_Text_QuoteFromLastInterview, MSGBOX_DEFAULT
|
||||
@ -295,13 +295,13 @@ GabbyAndTy_EventScript_Interview::
|
||||
goto_if_eq VAR_RESULT, 0, GabbyAndTy_EventScript_DontGiveUpKeepingEyeOut
|
||||
msgbox GabbyAndTy_Text_PerfectWellBeSeeingYou, MSGBOX_DEFAULT
|
||||
special GabbyAndTyAfterInterview
|
||||
setflag FLAG_TEMP_1
|
||||
setflag FLAG_TEMP_SKIP_GABBY_INTERVIEW
|
||||
release
|
||||
end
|
||||
|
||||
GabbyAndTy_EventScript_DontGiveUpKeepingEyeOut::
|
||||
msgbox GabbyAndTy_Text_DontGiveUpKeepingEyeOut, MSGBOX_DEFAULT
|
||||
setflag FLAG_TEMP_1
|
||||
setflag FLAG_TEMP_SKIP_GABBY_INTERVIEW
|
||||
release
|
||||
end
|
||||
|
||||
|
@ -1644,4 +1644,10 @@
|
||||
// FLAG_SPECIAL_FLAG_0x4005 - 0x407F also exist and are unused
|
||||
#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
|
||||
|
@ -278,6 +278,8 @@ bool8 FldEff_UsePuzzleEffect(void)
|
||||
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)
|
||||
{
|
||||
u8 i;
|
||||
@ -287,9 +289,11 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
|
||||
{
|
||||
if (FlagGet(FLAG_SYS_BRAILLE_REGICE_COMPLETED))
|
||||
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;
|
||||
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;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sRegicePathCoords); i++)
|
||||
@ -298,8 +302,7 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
|
||||
u8 yPos = sRegicePathCoords[i][1];
|
||||
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)
|
||||
{
|
||||
u16 val = VarGet(VAR_REGICE_STEPS_1);
|
||||
@ -319,11 +322,11 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
|
||||
VarSet(VAR_REGICE_STEPS_3, val);
|
||||
}
|
||||
|
||||
varValue = VarGet(VAR_REGICE_STEPS_1);
|
||||
if (varValue != 0xFFFF || VarGet(VAR_REGICE_STEPS_2) != 0xFFFF || VarGet(VAR_REGICE_STEPS_3) != 0xF)
|
||||
// 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 (VarGet(VAR_REGICE_STEPS_1) != 0xFFFF || VarGet(VAR_REGICE_STEPS_2) != 0xFFFF || VarGet(VAR_REGICE_STEPS_3) != 0xF)
|
||||
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)
|
||||
return TRUE;
|
||||
else
|
||||
@ -331,8 +334,9 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
|
||||
}
|
||||
}
|
||||
|
||||
FlagSet(FLAG_TEMP_3);
|
||||
FlagClear(FLAG_TEMP_2);
|
||||
// Player stepped on an incorrect space, puzzle failed.
|
||||
FlagSet(FLAG_TEMP_REGICE_PUZZLE_FAILED);
|
||||
FlagClear(FLAG_TEMP_REGICE_PUZZLE_STARTED);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
7
src/tv.c
7
src/tv.c
@ -941,9 +941,8 @@ void GabbyAndTyBeforeInterview(void)
|
||||
gSaveBlock1Ptr->gabbyAndTyData.mon2 = gBattleResults.playerMon2Species;
|
||||
gSaveBlock1Ptr->gabbyAndTyData.lastMove = gBattleResults.lastUsedMovePlayer;
|
||||
if (gSaveBlock1Ptr->gabbyAndTyData.battleNum != 0xFF)
|
||||
{
|
||||
gSaveBlock1Ptr->gabbyAndTyData.battleNum++;
|
||||
}
|
||||
|
||||
gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn = gBattleResults.playerMonWasDamaged;
|
||||
|
||||
if (gBattleResults.playerFaintCounter != 0)
|
||||
@ -975,9 +974,7 @@ void GabbyAndTyBeforeInterview(void)
|
||||
|
||||
TakeGabbyAndTyOffTheAir();
|
||||
if (gSaveBlock1Ptr->gabbyAndTyData.lastMove == MOVE_NONE)
|
||||
{
|
||||
FlagSet(FLAG_TEMP_1);
|
||||
}
|
||||
FlagSet(FLAG_TEMP_SKIP_GABBY_INTERVIEW);
|
||||
}
|
||||
|
||||
void GabbyAndTyAfterInterview(void)
|
||||
|
Loading…
Reference in New Issue
Block a user