From 986940f67b8dafd21b623889f0ab662702e61fda Mon Sep 17 00:00:00 2001 From: Viperio <146665252+Viperio19@users.noreply.github.com> Date: Sun, 14 Jun 2026 03:35:43 +0200 Subject: [PATCH] Document field moves script (#1197) Co-authored-by: Rachel --- asm/macros/scrcmd.inc | 38 +-- include/constants/scrcmd.h | 4 + include/data/scripts/scrcmd.h | 10 +- include/scrcmd_system_flags.h | 6 +- res/field/scripts/scripts_field_moves.s | 246 +++++++++--------- res/field/scripts/scripts_oreburgh_mine_b2f.s | 2 +- src/scrcmd.c | 40 +-- src/scrcmd_system_flags.c | 25 +- 8 files changed, 188 insertions(+), 183 deletions(-) diff --git a/asm/macros/scrcmd.inc b/asm/macros/scrcmd.inc index 01678ce813..622cd90606 100644 --- a/asm/macros/scrcmd.inc +++ b/asm/macros/scrcmd.inc @@ -1246,9 +1246,9 @@ .short SCRCMD_0C4 .endm - .macro ScrCmd_0C5 arg0 - .short SCRCMD_0C5 - .short \arg0 + .macro PlayHMCutIn slot + .short SCRCMD_PLAYHMCUTIN + .short \slot .endm .macro ChangeIntoContestAttire @@ -2674,26 +2674,26 @@ .short SCRCMD_UNUSED_1CE .endm - .macro Strength mode, checkDestVarID=0 - .short SCRCMD_STRENGTH - .byte \mode - .if \mode == 2 + .macro DoStrengthFunc func, checkDestVarID=0 + .short SCRCMD_DOSTRENGTHFUNC + .byte \func + .if \func == FIELD_MOVE_FUNC_CHECK_ACTIVE .short \checkDestVarID .endif .endm - .macro Flash mode, checkDestVarID=0 - .short SCRCMD_FLASH - .byte \mode - .if \mode == 2 + .macro DoFlashFunc func, checkDestVarID=0 + .short SCRCMD_DOFLASHFUNC + .byte \func + .if \func == FIELD_MOVE_FUNC_CHECK_ACTIVE .short \checkDestVarID .endif .endm - .macro Defog mode, checkDestVarID=0 - .short SCRCMD_DEFOG - .byte \mode - .if \mode == 2 + .macro DoDefogFunc func, checkDestVarID=0 + .short SCRCMD_DODEFOGFUNC + .byte \func + .if \func == FIELD_MOVE_FUNC_CHECK_ACTIVE .short \checkDestVarID .endif .endm @@ -4005,10 +4005,10 @@ .short \entryIndex .endm - .macro ScrCmd_29E arg0, arg1 - .short SCRCMD_29E - .short \arg0 - .short \arg1 + .macro StartDestroyObstacleAnimation obstacle, destVar + .short SCRCMD_STARTDESTROYOBSTACLEANIMATION + .short \obstacle + .short \destVar .endm .macro ScrCmd_29F arg0 diff --git a/include/constants/scrcmd.h b/include/constants/scrcmd.h index ce42331aa2..ab2c5cf8e9 100644 --- a/include/constants/scrcmd.h +++ b/include/constants/scrcmd.h @@ -25,4 +25,8 @@ #define SAFARI_GAME_ACTIVE 0 #define SAFARI_GAME_INACTIVE 1 +#define FIELD_MOVE_FUNC_CLEAR_ACTIVE 0 +#define FIELD_MOVE_FUNC_SET_ACTIVE 1 +#define FIELD_MOVE_FUNC_CHECK_ACTIVE 2 + #endif // POKEPLATINUM_CONSTANTS_SCRCMD_H diff --git a/include/data/scripts/scrcmd.h b/include/data/scripts/scrcmd.h index c96d125c6e..134790a0b7 100644 --- a/include/data/scripts/scrcmd.h +++ b/include/data/scripts/scrcmd.h @@ -202,7 +202,7 @@ ScriptCommand(SCRCMD_USEWATERFALL, ScrCm ScriptCommand(SCRCMD_USEFLY, ScrCmd_UseFly) ScriptCommand(SCRCMD_0C3, ScrCmd_0C3) ScriptCommand(SCRCMD_0C4, ScrCmd_0C4) -ScriptCommand(SCRCMD_0C5, ScrCmd_0C5) +ScriptCommand(SCRCMD_PLAYHMCUTIN, ScrCmd_PlayHMCutIn) ScriptCommand(SCRCMD_CHANGEINTOCONTESTATTIRE, ScrCmd_ChangeIntoContestAttire) ScriptCommand(SCRCMD_CHECKPLAYERONBIKE, ScrCmd_CheckPlayerOnBike) ScriptCommand(SCRCMD_SETPLAYERBIKE, ScrCmd_SetPlayerBike) @@ -468,9 +468,9 @@ ScriptCommand(SCRCMD_BUFFERPARTYMOVENAME, ScrCm ScriptCommand(SCRCMD_GIVEJOURNAL, ScrCmd_GiveJournal) ScriptCommand(SCRCMD_CREATEJOURNALEVENT, ScrCmd_CreateJournalEvent) ScriptCommand(SCRCMD_UNUSED_1CE, ScrCmd_Unused_1CE) -ScriptCommand(SCRCMD_STRENGTH, ScrCmd_Strength) -ScriptCommand(SCRCMD_FLASH, ScrCmd_Flash) -ScriptCommand(SCRCMD_DEFOG, ScrCmd_Defog) +ScriptCommand(SCRCMD_DOSTRENGTHFUNC, ScrCmd_DoStrengthFunc) +ScriptCommand(SCRCMD_DOFLASHFUNC, ScrCmd_DoFlashFunc) +ScriptCommand(SCRCMD_DODEFOGFUNC, ScrCmd_DoDefogFunc) ScriptCommand(SCRCMD_ADDACCESSORY, ScrCmd_AddAccessory) ScriptCommand(SCRCMD_CANFITACCESSORY, ScrCmd_CanFitAccessory) ScriptCommand(SCRCMD_UNUSED_1D4, ScrCmd_Unused_1D4) @@ -675,7 +675,7 @@ ScriptCommand(SCRCMD_CHECKBATTLEPOINTS, ScrCm ScriptCommand(SCRCMD_GetExchangeServiceCornerItemAndCost, ScrCmd_GetExchangeServiceCornerItemAndCost) ScriptCommand(SCRCMD_CALCULATETRAINERINFOAPPEARANCE, ScrCmd_CalculateTrainerInfoAppearance) ScriptCommand(SCRCMD_ADDMENUENTRY, ScrCmd_AddMenuEntry) -ScriptCommand(SCRCMD_29E, ScrCmd_29E) +ScriptCommand(SCRCMD_STARTDESTROYOBSTACLEANIMATION, ScrCmd_StartDestroyObstacleAnimation) ScriptCommand(SCRCMD_29F, ScrCmd_29F) ScriptCommand(SCRCMD_STARTTAGBATTLE, ScrCmd_StartTagBattle) ScriptCommand(SCRCMD_UNUSED_2A1, ScrCmd_Unused_2A1) diff --git a/include/scrcmd_system_flags.h b/include/scrcmd_system_flags.h index 53d828e186..c75727f3e8 100644 --- a/include/scrcmd_system_flags.h +++ b/include/scrcmd_system_flags.h @@ -20,8 +20,8 @@ BOOL ScrCmd_SetStepFlag(ScriptContext *ctx); BOOL ScrCmd_ClearStepFlag(ScriptContext *ctx); BOOL ScrCmd_CheckGameCompleted(ScriptContext *ctx); BOOL ScrCmd_SetGameCompleted(ScriptContext *ctx); -BOOL ScrCmd_Strength(ScriptContext *ctx); -BOOL ScrCmd_Flash(ScriptContext *ctx); -BOOL ScrCmd_Defog(ScriptContext *ctx); +BOOL ScrCmd_DoStrengthFunc(ScriptContext *ctx); +BOOL ScrCmd_DoFlashFunc(ScriptContext *ctx); +BOOL ScrCmd_DoDefogFunc(ScriptContext *ctx); #endif // POKEPLATINUM_SCRCMD_SYSTEM_FLAGS_H diff --git a/res/field/scripts/scripts_field_moves.s b/res/field/scripts/scripts_field_moves.s index 0a577a3c06..8b66e89b7b 100644 --- a/res/field/scripts/scripts_field_moves.s +++ b/res/field/scripts/scripts_field_moves.s @@ -25,41 +25,41 @@ FieldMoves_CutTree: LockAll FacePlayer FindPartySlotWithMove VAR_RESULT, MOVE_CUT - GoToIfEq VAR_RESULT, 6, _008E + GoToIfEq VAR_RESULT, MAX_PARTY_SIZE, FieldMoves_CantUseCut CheckBadgeAcquired BADGE_ID_FOREST, VAR_RESULT - GoToIfEq VAR_RESULT, 0, _008E + GoToIfEq VAR_RESULT, FALSE, FieldMoves_CantUseCut Message FieldMoves_Text_WouldYouLikeToUseCut ShowYesNoMenu VAR_RESULT - GoToIfEq VAR_RESULT, MENU_YES, _00AE + GoToIfEq VAR_RESULT, MENU_YES, FieldMoves_UseCutFromField CloseMessage - GoTo _066D + GoTo FieldMoves_End End -_008E: +FieldMoves_CantUseCut: Message FieldMoves_Text_TreeLooksLikeCanBeCut GetCurrentMapID VAR_0x8004 - CallIfEq VAR_0x8004, 203, _014A + CallIfEq VAR_0x8004, MAP_HEADER_ETERNA_FOREST, FieldMoves_TryEnableCherylCutscene WaitButton CloseMessage - GoTo _066D + GoTo FieldMoves_End End -_00AE: +FieldMoves_UseCutFromField: FindPartySlotWithMove VAR_RESULT, MOVE_CUT SetVar VAR_0x8004, VAR_RESULT BufferPartyMonNickname 0, VAR_RESULT Message FieldMoves_Text_PokemonUsedCut CloseMessage - ScrCmd_0C5 VAR_0x8004 - ScrCmd_29E 0, VAR_0x8005 + PlayHMCutIn VAR_0x8004 + StartDestroyObstacleAnimation 0, VAR_0x8005 WaitTime 7, VAR_RESULT RemoveObject VAR_LAST_TALKED GetCurrentMapID VAR_0x8004 CreateJournalEvent LOCATION_EVENT_USED_CUT, VAR_0x8004, 0, 0, 0 -_00E8: +FieldMoves_WaitForCutAnimFromField: WaitTime 1, VAR_RESULT - GoToIfEq VAR_0x8005, 0, _00E8 - GoTo _066D + GoToIfEq VAR_0x8005, 0, FieldMoves_WaitForCutAnimFromField + GoTo FieldMoves_End End FieldMoves_UseCutFromMenu: @@ -67,61 +67,61 @@ FieldMoves_UseCutFromMenu: BufferPartyMonNickname 0, VAR_0x8000 Message FieldMoves_Text_PokemonUsedCut CloseMessage - ScrCmd_0C5 VAR_0x8000 - ScrCmd_29E 0, VAR_0x8005 + PlayHMCutIn VAR_0x8000 + StartDestroyObstacleAnimation 0, VAR_0x8005 WaitTime 7, VAR_RESULT RemoveObject VAR_LAST_TALKED GetCurrentMapID VAR_0x8004 CreateJournalEvent LOCATION_EVENT_USED_CUT, VAR_0x8004, 0, 0, 0 -_0133: +FieldMoves_WaitForCutAnimFromMenu: WaitTime 1, VAR_RESULT - GoToIfEq VAR_0x8005, 0, _0133 + GoToIfEq VAR_0x8005, 0, FieldMoves_WaitForCutAnimFromMenu ReleaseAll End -_014A: - GoToIfNe VAR_ETERNA_FOREST_CHERYL_OLD_CHATEAU_CUTSCENE_STATE, 0, _0221 - GoToIfNe VAR_ETERNA_FOREST_FOLLOWER_CHERYL_STATE, 1, _0221 - Call _017F - GoToIfEq VAR_RESULT, 0, _0221 +FieldMoves_TryEnableCherylCutscene: + GoToIfNe VAR_ETERNA_FOREST_CHERYL_OLD_CHATEAU_CUTSCENE_STATE, 0, FieldMoves_DontEnableCherylCutscene + GoToIfNe VAR_ETERNA_FOREST_FOLLOWER_CHERYL_STATE, 1, FieldMoves_DontEnableCherylCutscene + Call FieldMoves_CheckPositionForCherylCutscene + GoToIfEq VAR_RESULT, FALSE, FieldMoves_DontEnableCherylCutscene SetVar VAR_ETERNA_FOREST_CHERYL_OLD_CHATEAU_CUTSCENE_STATE, 1 Return -_017F: - SetVar VAR_RESULT, 0 +FieldMoves_CheckPositionForCherylCutscene: + SetVar VAR_RESULT, FALSE GetPlayerMapPos VAR_0x8004, VAR_0x8005 - GoToIfEq VAR_0x8004, 73, _01CE - GoToIfEq VAR_0x8004, 74, _01DD - GoToIfEq VAR_0x8004, 75, _01EC - GoToIfEq VAR_0x8004, 76, _01FB - GoToIfEq VAR_0x8004, 77, _020A + GoToIfEq VAR_0x8004, 73, FieldMoves_CheckPositionX73 + GoToIfEq VAR_0x8004, 74, FieldMoves_CheckPositionX74 + GoToIfEq VAR_0x8004, 75, FieldMoves_CheckPositionX75 + GoToIfEq VAR_0x8004, 76, FieldMoves_CheckPositionX76 + GoToIfEq VAR_0x8004, 77, FieldMoves_CheckPositionX77 Return -_01CE: - GoToIfEq VAR_0x8005, 33, _0219 +FieldMoves_CheckPositionX73: + GoToIfEq VAR_0x8005, 33, FieldMoves_CorrectPositionForCherylCutscene Return -_01DD: - GoToIfEq VAR_0x8005, 34, _0219 +FieldMoves_CheckPositionX74: + GoToIfEq VAR_0x8005, 34, FieldMoves_CorrectPositionForCherylCutscene Return -_01EC: - GoToIfEq VAR_0x8005, 34, _0219 +FieldMoves_CheckPositionX75: + GoToIfEq VAR_0x8005, 34, FieldMoves_CorrectPositionForCherylCutscene Return -_01FB: - GoToIfEq VAR_0x8005, 33, _0219 +FieldMoves_CheckPositionX76: + GoToIfEq VAR_0x8005, 33, FieldMoves_CorrectPositionForCherylCutscene Return -_020A: - GoToIfEq VAR_0x8005, 34, _0219 +FieldMoves_CheckPositionX77: + GoToIfEq VAR_0x8005, 34, FieldMoves_CorrectPositionForCherylCutscene Return -_0219: - SetVar VAR_RESULT, 1 +FieldMoves_CorrectPositionForCherylCutscene: + SetVar VAR_RESULT, TRUE Return -_0221: +FieldMoves_DontEnableCherylCutscene: Return FieldMoves_Rock: @@ -130,37 +130,37 @@ FieldMoves_Rock: FacePlayer FindPartySlotWithMove VAR_RESULT, MOVE_ROCK_SMASH SetVar VAR_0x8004, VAR_RESULT - GoToIfEq VAR_RESULT, 6, _0275 + GoToIfEq VAR_RESULT, MAX_PARTY_SIZE, FieldMoves_CantUseRockSmash CheckBadgeAcquired BADGE_ID_COAL, VAR_RESULT - GoToIfEq VAR_RESULT, 0, _0275 + GoToIfEq VAR_RESULT, FALSE, FieldMoves_CantUseRockSmash Message FieldMoves_Text_WouldYouLikeToUseRockSmash ShowYesNoMenu VAR_RESULT - GoToIfEq VAR_RESULT, MENU_YES, _0284 + GoToIfEq VAR_RESULT, MENU_YES, FieldMoves_UseRockSmashFromField CloseMessage - GoTo _066D + GoTo FieldMoves_End End -_0275: +FieldMoves_CantUseRockSmash: Message FieldMoves_Text_PokemonMayBeAbleToSmashRock WaitButton CloseMessage - GoTo _066D + GoTo FieldMoves_End End -_0284: +FieldMoves_UseRockSmashFromField: BufferPartyMonNickname 0, VAR_0x8004 Message FieldMoves_Text_PokemonUsedRockSmash CloseMessage - ScrCmd_0C5 VAR_0x8004 - ScrCmd_29E 1, VAR_0x8005 + PlayHMCutIn VAR_0x8004 + StartDestroyObstacleAnimation 1, VAR_0x8005 WaitTime 10, VAR_RESULT RemoveObject VAR_LAST_TALKED GetCurrentMapID VAR_0x8004 CreateJournalEvent LOCATION_EVENT_USED_ROCK_SMASH, VAR_0x8004, 0, 0, 0 -_02B2: +FieldMoves_WaitForRockSmashAnimFromField: WaitTime 1, VAR_RESULT - GoToIfEq VAR_0x8005, 0, _02B2 - GoTo _066D + GoToIfEq VAR_0x8005, 0, FieldMoves_WaitForRockSmashAnimFromField + GoTo FieldMoves_End End FieldMoves_UseRockSmashFromMenu: @@ -168,15 +168,15 @@ FieldMoves_UseRockSmashFromMenu: BufferPartyMonNickname 0, VAR_0x8000 Message FieldMoves_Text_PokemonUsedRockSmash CloseMessage - ScrCmd_0C5 VAR_0x8000 - ScrCmd_29E 1, VAR_0x8005 + PlayHMCutIn VAR_0x8000 + StartDestroyObstacleAnimation 1, VAR_0x8005 WaitTime 10, VAR_RESULT RemoveObject VAR_LAST_TALKED GetCurrentMapID VAR_0x8004 CreateJournalEvent LOCATION_EVENT_USED_ROCK_SMASH, VAR_0x8004, 0, 0, 0 -_02FD: +FieldMoves_WaitForRockSmashAnimFromMenu: WaitTime 1, VAR_RESULT - GoToIfEq VAR_0x8005, 0, _02FD + GoToIfEq VAR_0x8005, 0, FieldMoves_WaitForRockSmashAnimFromMenu ReleaseAll End @@ -184,96 +184,96 @@ FieldMoves_Boulder: PlaySE SEQ_SE_CONFIRM LockAll FacePlayer - Strength 2, VAR_RESULT - GoToIfEq VAR_RESULT, 1, _03BD + DoStrengthFunc FIELD_MOVE_FUNC_CHECK_ACTIVE, VAR_RESULT + GoToIfEq VAR_RESULT, TRUE, FieldMoves_StrenghtAlreadyActive FindPartySlotWithMove VAR_RESULT, MOVE_STRENGTH - GoToIfEq VAR_RESULT, 6, _0372 + GoToIfEq VAR_RESULT, MAX_PARTY_SIZE, FieldMoves_CantUseStrength CheckBadgeAcquired BADGE_ID_MINE, VAR_RESULT - GoToIfEq VAR_RESULT, 0, _0372 + GoToIfEq VAR_RESULT, FALSE, FieldMoves_CantUseStrength Message FieldMoves_Text_WouldYouLikeToUseStrength ShowYesNoMenu VAR_RESULT - GoToIfEq VAR_RESULT, MENU_YES, _0381 + GoToIfEq VAR_RESULT, MENU_YES, FieldMoves_UseStrengthFromField CloseMessage - GoTo _066D + GoTo FieldMoves_End End -_0372: +FieldMoves_CantUseStrength: Message FieldMoves_Text_BoulderMayBeAbleToPush WaitButton CloseMessage - GoTo _066D + GoTo FieldMoves_End End -_0381: - Strength 1 +FieldMoves_UseStrengthFromField: + DoStrengthFunc FIELD_MOVE_FUNC_SET_ACTIVE FindPartySlotWithMove VAR_RESULT, MOVE_STRENGTH SetVar VAR_0x8004, VAR_RESULT BufferPartyMonNickname 0, VAR_RESULT Message FieldMoves_Text_PokemonUsedStrength - ScrCmd_0C5 VAR_0x8004 + PlayHMCutIn VAR_0x8004 CloseMessage Message FieldMoves_Text_PokemonStrengthMadePossibleToMove WaitButton CloseMessage GetCurrentMapID VAR_0x8004 CreateJournalEvent LOCATION_EVENT_USED_STRENGTH, VAR_0x8004, 0, 0, 0 - GoTo _066D + GoTo FieldMoves_End End -_03BD: +FieldMoves_StrenghtAlreadyActive: Message FieldMoves_Text_StrengthMadePossibleToMove WaitButton CloseMessage - GoTo _066D + GoTo FieldMoves_End End FieldMoves_UseStrengthFromMenu: LockAll - Strength 2, VAR_RESULT - GoToIfEq VAR_RESULT, 1, _03BD - Strength 1 + DoStrengthFunc FIELD_MOVE_FUNC_CHECK_ACTIVE, VAR_RESULT + GoToIfEq VAR_RESULT, TRUE, FieldMoves_StrenghtAlreadyActive + DoStrengthFunc FIELD_MOVE_FUNC_SET_ACTIVE BufferPartyMonNickname 0, VAR_0x8000 Message FieldMoves_Text_PokemonUsedStrength CloseMessage - ScrCmd_0C5 VAR_0x8000 + PlayHMCutIn VAR_0x8000 Message FieldMoves_Text_PokemonStrengthMadePossibleToMove WaitButton CloseMessage GetCurrentMapID VAR_0x8004 CreateJournalEvent LOCATION_EVENT_USED_STRENGTH, VAR_0x8004, 0, 0, 0 - GoTo _0675 + GoTo FieldMoves_End3 FieldMoves_RockyWall: PlaySE SEQ_SE_CONFIRM LockAll FindPartySlotWithMove VAR_RESULT, MOVE_ROCK_CLIMB - GoToIfEq VAR_RESULT, 6, _0469 + GoToIfEq VAR_RESULT, MAX_PARTY_SIZE, FieldMoves_CantUseRockClimb CheckBadgeAcquired BADGE_ID_ICICLE, VAR_RESULT - GoToIfEq VAR_RESULT, 0, _0469 + GoToIfEq VAR_RESULT, FALSE, FieldMoves_CantUseRockClimb CheckHasPartner VAR_RESULT - GoToIfEq VAR_RESULT, 1, _0478 + GoToIfEq VAR_RESULT, TRUE, FieldMoves_NoRockClimbingWithPartner Message FieldMoves_Text_WouldYouLikeToUseRockClimb ShowYesNoMenu VAR_RESULT - GoToIfEq VAR_RESULT, MENU_YES, _0487 + GoToIfEq VAR_RESULT, MENU_YES, FieldMoves_UseRockClimbFromField CloseMessage - GoTo _0671 + GoTo FieldMoves_End2 End -_0469: +FieldMoves_CantUseRockClimb: Message FieldMoves_Text_RockyWallWillMoveScale WaitButton CloseMessage - GoTo _0671 + GoTo FieldMoves_End2 End -_0478: +FieldMoves_NoRockClimbingWithPartner: Message FieldMoves_Text_NoRockClimbingWithPartner WaitButton CloseMessage - GoTo _0671 + GoTo FieldMoves_End2 End -_0487: +FieldMoves_UseRockClimbFromField: FindPartySlotWithMove VAR_RESULT, MOVE_ROCK_CLIMB SetVar VAR_0x8004, VAR_RESULT BufferPartyMonNickname 0, VAR_RESULT @@ -282,7 +282,7 @@ _0487: UseRockClimb VAR_0x8004 GetCurrentMapID VAR_0x8004 CreateJournalEvent LOCATION_EVENT_USED_ROCK_CLIMB, VAR_0x8004, 0, 0, 0 - GoTo _0671 + GoTo FieldMoves_End2 End FieldMoves_UseRockClimbFromMenu: @@ -300,21 +300,21 @@ FieldMoves_Water: PlaySE SEQ_SE_CONFIRM LockAll CheckHasPartner VAR_RESULT - GoToIfEq VAR_RESULT, 1, _0512 + GoToIfEq VAR_RESULT, TRUE, FieldMoves_CantUseSurf Message FieldMoves_Text_WouldYouLikeToUseSurf ShowYesNoMenu VAR_RESULT - GoToIfEq VAR_RESULT, MENU_YES, _051F + GoToIfEq VAR_RESULT, MENU_YES, FieldMoves_UseSurfFromField CloseMessage - GoTo _0671 + GoTo FieldMoves_End2 End -_0512: +FieldMoves_CantUseSurf: Message FieldMoves_Text_NoSurfingWithPartner WaitButton CloseMessage - GoTo _0671 + GoTo FieldMoves_End2 -_051F: +FieldMoves_UseSurfFromField: FindPartySlotWithMove VAR_RESULT, MOVE_SURF SetVar VAR_0x8004, VAR_RESULT BufferPartyMonNickname 0, VAR_RESULT @@ -323,7 +323,7 @@ _051F: UseSurf VAR_0x8004 GetCurrentMapID VAR_0x8004 CreateJournalEvent LOCATION_EVENT_USED_SURF, VAR_0x8004, 0, 0, 0 - GoTo _0671 + GoTo FieldMoves_End2 End FieldMoves_UseSurfFromMenu: @@ -343,36 +343,36 @@ FieldMoves_Fog_Unused: PlaySE SEQ_SE_CONFIRM LockAll FindPartySlotWithMove VAR_RESULT, MOVE_DEFOG - GoToIfEq VAR_RESULT, 6, _05B4 + GoToIfEq VAR_RESULT, MAX_PARTY_SIZE, FieldMoves_CantUseDefog_Unused Message FieldMoves_Text_WouldYouLikeToUseDefog_Unused ShowYesNoMenu VAR_RESULT - GoToIfEq VAR_RESULT, MENU_YES, _05C3 + GoToIfEq VAR_RESULT, MENU_YES, FieldMoves_UseDefogFromField_Unused CloseMessage - GoTo _0671 + GoTo FieldMoves_End2 End -_05B4: +FieldMoves_CantUseDefog_Unused: Message FieldMoves_Text_DeepFogDrapesArea_Unused WaitButton CloseMessage - GoTo _0671 + GoTo FieldMoves_End2 End -_05C3: +FieldMoves_UseDefogFromField_Unused: FindPartySlotWithMove VAR_RESULT, MOVE_DEFOG SetVar VAR_0x8004, VAR_RESULT BufferPartyMonNickname 0, VAR_RESULT Message FieldMoves_Text_PokemonUsedDefog CloseMessage - ScrCmd_0C5 VAR_0x8004 + PlayHMCutIn VAR_0x8004 GetCurrentMapID VAR_0x8004 CreateJournalEvent LOCATION_EVENT_USED_DEFOG, VAR_0x8004, 0, 0, 0 GetCurrentMapID VAR_0x8004 - CallIfEq VAR_0x8004, MAP_HEADER_ROUTE_209_LOST_TOWER_5F, _0606 - GoTo _0671 + CallIfEq VAR_0x8004, MAP_HEADER_ROUTE_209_LOST_TOWER_5F, FieldMoves_SetFlagUsedDefog_Unused + GoTo FieldMoves_End2 End -_0606: +FieldMoves_SetFlagUsedDefog_Unused: SetFlag FLAG_USED_DEFOG_IN_ROUTE_209_LOST_TOWER_5F Return @@ -381,36 +381,36 @@ FieldMoves_UseDefogFromMenu: BufferPartyMonNickname 0, VAR_0x8000 Message FieldMoves_Text_PokemonUsedDefog CloseMessage - ScrCmd_0C5 VAR_0x8000 - Defog 1 + PlayHMCutIn VAR_0x8000 + DoDefogFunc FIELD_MOVE_FUNC_SET_ACTIVE PlaySE SEQ_SE_DP_FBRADE ScrCmd_0C4 GetCurrentMapID VAR_0x8004 CreateJournalEvent LOCATION_EVENT_USED_DEFOG, VAR_0x8004, 0, 0, 0 GetCurrentMapID VAR_0x8004 - CallIfEq VAR_0x8004, 0x169, _0606 - GoTo _0675 + CallIfEq VAR_0x8004, MAP_HEADER_ROUTE_209_LOST_TOWER_5F, FieldMoves_SetFlagUsedDefog_Unused + GoTo FieldMoves_End3 FieldMoves_UseFlashFromMenu: LockAll BufferPartyMonNickname 0, VAR_0x8000 Message FieldMoves_Text_PokemonUsedFlash CloseMessage - ScrCmd_0C5 VAR_0x8000 - Flash 1 + PlayHMCutIn VAR_0x8000 + DoFlashFunc FIELD_MOVE_FUNC_SET_ACTIVE ScrCmd_0C3 WaitTime 42, VAR_RESULT - GoTo _0675 + GoTo FieldMoves_End3 -_066D: +FieldMoves_End: ReleaseAll End -_0671: +FieldMoves_End2: ReleaseAll End -_0675: +FieldMoves_End3: ReleaseAll End @@ -418,24 +418,24 @@ FieldMoves_Waterfall: PlaySE SEQ_SE_CONFIRM LockAll FindPartySlotWithMove VAR_RESULT, MOVE_WATERFALL - GoToIfEq VAR_RESULT, 6, _06C3 + GoToIfEq VAR_RESULT, MAX_PARTY_SIZE, FieldMoves_CantUseWaterfall CheckBadgeAcquired BADGE_ID_BEACON, VAR_RESULT - GoToIfEq VAR_RESULT, 0, _06C3 + GoToIfEq VAR_RESULT, FALSE, FieldMoves_CantUseWaterfall Message FieldMoves_Text_WouldYouLikeToUseWaterfall ShowYesNoMenu VAR_RESULT - GoToIfEq VAR_RESULT, MENU_YES, _06D2 + GoToIfEq VAR_RESULT, MENU_YES, FieldMoves_UseWaterfallFromField CloseMessage - GoTo _0671 + GoTo FieldMoves_End2 End -_06C3: +FieldMoves_CantUseWaterfall: Message FieldMoves_Text_WallOfWater WaitButton CloseMessage - GoTo _0671 + GoTo FieldMoves_End2 End -_06D2: +FieldMoves_UseWaterfallFromField: FindPartySlotWithMove VAR_RESULT, MOVE_WATERFALL SetVar VAR_0x8004, VAR_RESULT BufferPartyMonNickname 0, VAR_RESULT @@ -444,7 +444,7 @@ _06D2: UseWaterfall VAR_0x8004 GetCurrentMapID VAR_0x8004 CreateJournalEvent LOCATION_EVENT_USED_WATERFALL, VAR_0x8004, 0, 0, 0 - GoTo _0671 + GoTo FieldMoves_End2 End FieldMoves_UseWaterfallFromMenu: diff --git a/res/field/scripts/scripts_oreburgh_mine_b2f.s b/res/field/scripts/scripts_oreburgh_mine_b2f.s index 5d134e8c0c..499366ec67 100644 --- a/res/field/scripts/scripts_oreburgh_mine_b2f.s +++ b/res/field/scripts/scripts_oreburgh_mine_b2f.s @@ -29,7 +29,7 @@ OreburghMineB2F_RoarkTurnBackEast: OreburghMineB2F_RoarkUseRockSmash: Message OreburghMineB2F_Text_OKStandBackAndWatchThis CloseMessage - ScrCmd_29E 2, VAR_0x8005 + StartDestroyObstacleAnimation 2, VAR_0x8005 WaitTime 10, VAR_RESULT RemoveObject LOCALID_ROCK_SMASH_1 OreburghMineB2F_WaitRockSmash: diff --git a/src/scrcmd.c b/src/scrcmd.c index 3b924002f7..fc71a70de9 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -408,8 +408,8 @@ static BOOL ScrCmd_UseWaterfall(ScriptContext *ctx); static BOOL ScrCmd_UseFly(ScriptContext *ctx); static BOOL ScrCmd_0C3(ScriptContext *ctx); static BOOL ScrCmd_0C4(ScriptContext *ctx); -static BOOL ScrCmd_0C5(ScriptContext *ctx); -static BOOL sub_02042C80(ScriptContext *ctx); +static BOOL ScrCmd_PlayHMCutIn(ScriptContext *ctx); +static BOOL ScriptContext_WaitForHMCutInFinished(ScriptContext *ctx); static BOOL ScrCmd_ChangeIntoContestAttire(ScriptContext *ctx); static BOOL ScrCmd_CheckPlayerOnBike(ScriptContext *ctx); static BOOL ScrCmd_SetPlayerBike(ScriptContext *ctx); @@ -674,7 +674,7 @@ static BOOL ScrCmd_GetLeagueVictories(ScriptContext *ctx); static BOOL ScrCmd_CheckShouldShowGhost(ScriptContext *ctx); static BOOL ScrCmd_OpenPartyMenuForDaycare(ScriptContext *ctx); static BOOL ScrCmd_GetDayCarePartyMenuResult(ScriptContext *ctx); -static BOOL ScrCmd_29E(ScriptContext *ctx); +static BOOL ScrCmd_StartDestroyObstacleAnimation(ScriptContext *ctx); static BOOL ScrCmd_GetUndergroundTalkCounter(ScriptContext *ctx); static BOOL ScrCmd_29F(ScriptContext *ctx); static BOOL ScrCmd_Unused_2A1(ScriptContext *ctx); @@ -3676,24 +3676,24 @@ static BOOL ScrCmd_0C4(ScriptContext *ctx) return TRUE; } -static BOOL ScrCmd_0C5(ScriptContext *ctx) +static BOOL ScrCmd_PlayHMCutIn(ScriptContext *ctx) { - void **v1 = FieldSystem_GetScriptMemberPtr(ctx->fieldSystem, SCRIPT_MANAGER_DATA_PTR); - u16 v2 = ScriptContext_GetVar(ctx); + void **dataPtr = FieldSystem_GetScriptMemberPtr(ctx->fieldSystem, SCRIPT_MANAGER_DATA_PTR); + u16 slot = ScriptContext_GetVar(ctx); - Pokemon *v0 = Party_GetPokemonBySlotIndex(SaveData_GetParty(ctx->fieldSystem->saveData), v2); - *v1 = HMCutIn_StartTask(ctx->fieldSystem, 0, v0, PlayerAvatar_GetGender(ctx->fieldSystem->playerAvatar)); + Pokemon *mon = Party_GetPokemonBySlotIndex(SaveData_GetParty(ctx->fieldSystem->saveData), slot); + *dataPtr = HMCutIn_StartTask(ctx->fieldSystem, FALSE, mon, PlayerAvatar_GetGender(ctx->fieldSystem->playerAvatar)); - ScriptContext_Pause(ctx, sub_02042C80); + ScriptContext_Pause(ctx, ScriptContext_WaitForHMCutInFinished); return TRUE; } -static BOOL sub_02042C80(ScriptContext *ctx) +static BOOL ScriptContext_WaitForHMCutInFinished(ScriptContext *ctx) { - void **v0 = FieldSystem_GetScriptMemberPtr(ctx->fieldSystem, SCRIPT_MANAGER_DATA_PTR); + void **dataPtr = FieldSystem_GetScriptMemberPtr(ctx->fieldSystem, SCRIPT_MANAGER_DATA_PTR); - if (HMCutIn_IsFinished(*v0) == TRUE) { - HMCutIn_EndTask(*v0); + if (HMCutIn_IsFinished(*dataPtr) == TRUE) { + HMCutIn_EndTask(*dataPtr); return TRUE; } @@ -6345,21 +6345,21 @@ static BOOL ScrCmd_CheckShouldShowGhost(ScriptContext *ctx) return FALSE; } -static BOOL ScrCmd_29E(ScriptContext *ctx) +static BOOL ScrCmd_StartDestroyObstacleAnimation(ScriptContext *ctx) { - u16 v0 = ScriptContext_GetVar(ctx); - u16 *v1 = ScriptContext_GetVarPointer(ctx); + u16 obstacle = ScriptContext_GetVar(ctx); + u16 *destVar = ScriptContext_GetVarPointer(ctx); FieldSystem *fieldSystem = ctx->fieldSystem; - switch (v0) { + switch (obstacle) { case 0: - ov6_0224899C(fieldSystem, v1, 0, HEAP_ID_FIELD3); + ov6_0224899C(fieldSystem, destVar, 0, HEAP_ID_FIELD3); break; case 1: - ov6_0224899C(fieldSystem, v1, 1, HEAP_ID_FIELD3); + ov6_0224899C(fieldSystem, destVar, 1, HEAP_ID_FIELD3); break; case 2: - ov6_0224899C(fieldSystem, v1, 2, HEAP_ID_FIELD3); + ov6_0224899C(fieldSystem, destVar, 2, HEAP_ID_FIELD3); break; default: GF_ASSERT(FALSE); diff --git a/src/scrcmd_system_flags.c b/src/scrcmd_system_flags.c index ebc368a805..ca70c51346 100644 --- a/src/scrcmd_system_flags.c +++ b/src/scrcmd_system_flags.c @@ -1,5 +1,6 @@ #include "scrcmd_system_flags.h" +#include "constants/scrcmd.h" #include "generated/badges.h" #include "struct_defs/player_data.h" @@ -157,21 +158,21 @@ BOOL ScrCmd_SetGameCompleted(ScriptContext *ctx) return FALSE; } -BOOL ScrCmd_Strength(ScriptContext *ctx) +BOOL ScrCmd_DoStrengthFunc(ScriptContext *ctx) { u16 *destVar; VarsFlags *varsFlags = SaveData_GetVarsFlags(ctx->fieldSystem->saveData); switch (ScriptContext_ReadByte(ctx)) { - case 1: + case FIELD_MOVE_FUNC_SET_ACTIVE: SystemFlag_HandleStrengthActive(varsFlags, HANDLE_FLAG_SET); break; - case 0: + case FIELD_MOVE_FUNC_CLEAR_ACTIVE: SystemFlag_HandleStrengthActive(varsFlags, HANDLE_FLAG_CLEAR); break; - case 2: + case FIELD_MOVE_FUNC_CHECK_ACTIVE: destVar = ScriptContext_GetVarPointer(ctx); *destVar = SystemFlag_HandleStrengthActive(varsFlags, HANDLE_FLAG_CHECK); break; @@ -183,21 +184,21 @@ BOOL ScrCmd_Strength(ScriptContext *ctx) return FALSE; } -BOOL ScrCmd_Flash(ScriptContext *ctx) +BOOL ScrCmd_DoFlashFunc(ScriptContext *ctx) { u16 *destVar; VarsFlags *varsFlags = SaveData_GetVarsFlags(ctx->fieldSystem->saveData); switch (ScriptContext_ReadByte(ctx)) { - case 1: + case FIELD_MOVE_FUNC_SET_ACTIVE: SystemFlag_SetFlashActive(varsFlags); break; - case 0: + case FIELD_MOVE_FUNC_CLEAR_ACTIVE: SystemFlag_ClearFlashActive(varsFlags); break; - case 2: + case FIELD_MOVE_FUNC_CHECK_ACTIVE: destVar = ScriptContext_GetVarPointer(ctx); *destVar = SystemFlag_CheckFlashActive(varsFlags); break; @@ -209,21 +210,21 @@ BOOL ScrCmd_Flash(ScriptContext *ctx) return FALSE; } -BOOL ScrCmd_Defog(ScriptContext *ctx) +BOOL ScrCmd_DoDefogFunc(ScriptContext *ctx) { u16 *destVar; VarsFlags *varsFlags = SaveData_GetVarsFlags(ctx->fieldSystem->saveData); switch (ScriptContext_ReadByte(ctx)) { - case 1: + case FIELD_MOVE_FUNC_SET_ACTIVE: SystemFlag_SetDefogActive(varsFlags); break; - case 0: + case FIELD_MOVE_FUNC_CLEAR_ACTIVE: SystemFlag_ClearDefogActive(varsFlags); break; - case 2: + case FIELD_MOVE_FUNC_CHECK_ACTIVE: destVar = ScriptContext_GetVarPointer(ctx); *destVar = SystemFlag_CheckDefogActive(varsFlags); break;