From c78e72d9ae5e8ebfb13e6c2ad25f2d6753e7594c Mon Sep 17 00:00:00 2001 From: metallicity Date: Thu, 28 Aug 2025 15:31:13 -0700 Subject: [PATCH] Document elevator scripts and animation (#717) --- asm/macros/scrcmd.inc | 25 +- generated/vars_flags.txt | 2 +- include/constants/elevator_dirs.h | 7 + include/overlay006/elevator_animation.h | 8 + include/overlay006/ov6_02246F00.h | 8 - include/unk_020474B8.h | 2 +- platinum.us/main.lsf | 2 +- .../scripts/scripts_battle_tower_elevator.s | 70 ++--- ..._hearthome_city_northeast_house_elevator.s | 36 +-- ..._hearthome_city_southeast_house_elevator.s | 36 +-- .../scripts/scripts_jubilife_tv_elevator.s | 177 +++++------ ...cripts_pastoria_city_observatory_gate_1f.s | 2 +- ...ts_resort_area_ribbon_syndicate_elevator.s | 111 +++---- .../scripts_veilstone_store_elevator.s | 287 +++++++++--------- .../scripts_vista_lighthouse_elevator.s | 36 +-- res/text/jubilife_tv_elevator.json | 12 +- res/text/menu_entries.json | 16 +- ...resort_area_ribbon_syndicate_elevator.json | 10 +- res/text/veilstone_store_elevator.json | 22 +- src/meson.build | 2 +- src/overlay006/elevator_animation.c | 114 +++++++ src/overlay006/ov6_02246F00.c | 105 ------- src/scrcmd.c | 24 +- src/string_template.c | 6 +- src/unk_020474B8.c | 14 +- 25 files changed, 577 insertions(+), 557 deletions(-) create mode 100644 include/constants/elevator_dirs.h create mode 100644 include/overlay006/elevator_animation.h delete mode 100644 include/overlay006/ov6_02246F00.h create mode 100644 src/overlay006/elevator_animation.c delete mode 100644 src/overlay006/ov6_02246F00.c diff --git a/asm/macros/scrcmd.inc b/asm/macros/scrcmd.inc index c4fe3082ac..40239e821c 100644 --- a/asm/macros/scrcmd.inc +++ b/asm/macros/scrcmd.inc @@ -27,6 +27,7 @@ #include "generated/trainers.h" #include "constants/boat_cutscene.h" #include "constants/colors.h" +#include "constants/elevator_dirs.h" #include "constants/fade_screen.h" #include "constants/forms.h" #include "constants/honey_tree.h" @@ -1650,13 +1651,13 @@ .short \arg1 .endm - .macro ScrCmd_11B arg0, arg1, arg2, arg3, arg4 + .macro SetSpecialLocation mapId, warpId, x, z, dir .short 283 - .short \arg0 - .short \arg1 - .short \arg2 - .short \arg3 - .short \arg4 + .short \mapId + .short \warpId + .short \x + .short \z + .short \dir .endm /* @@ -3222,10 +3223,10 @@ .short \arg0 .endm - .macro ScrCmd_23C arg0, arg1 + .macro PlayElevatorAnimation elevatorDir, loopCount .short 572 - .short \arg0 - .short \arg1 + .short \elevatorDir + .short \loopCount .endm .macro PlayBoatCutscene travelDir, exitDir, mapID, x, z @@ -4811,10 +4812,10 @@ .byte \arg0 .endm - .macro ScrCmd_347 arg0, arg1 + .macro BufferFloorNumber templateArg, floor .short 839 - .byte \arg0 - .byte \arg1 + .byte \templateArg + .byte \floor .endm diff --git a/generated/vars_flags.txt b/generated/vars_flags.txt index caf50614ec..299d52f591 100644 --- a/generated/vars_flags.txt +++ b/generated/vars_flags.txt @@ -4304,7 +4304,7 @@ VAR_FOLLOWER_RIVAL_TIMES_TALKED VAR_UNK_0x40CB VAR_UNK_0x40CC VAR_UNK_0x40CD -VAR_UNK_0x40CE +VAR_ELEVATOR_FLOORS_ABOVE VAR_UNK_0x40CF VAR_UNK_0x40D0 VAR_UNK_0x40D1 diff --git a/include/constants/elevator_dirs.h b/include/constants/elevator_dirs.h new file mode 100644 index 0000000000..b5ff1d1477 --- /dev/null +++ b/include/constants/elevator_dirs.h @@ -0,0 +1,7 @@ +#ifndef POKEPLATINUM_CONSTANTS_ELEVATOR_DIRS_H +#define POKEPLATINUM_CONSTANTS_ELEVATOR_DIRS_H + +#define ELEVATOR_DIR_UP 0 +#define ELEVATOR_DIR_DOWN 1 + +#endif // POKEPLATINUM_CONSTANTS_ELEVATOR_DIRS_H diff --git a/include/overlay006/elevator_animation.h b/include/overlay006/elevator_animation.h new file mode 100644 index 0000000000..a83d488397 --- /dev/null +++ b/include/overlay006/elevator_animation.h @@ -0,0 +1,8 @@ +#ifndef POKEPLATINUM_ELEVATOR_ANIMATION_H +#define POKEPLATINUM_ELEVATOR_ANIMATION_H + +#include "field/field_system_decl.h" + +void FieldSystem_PlayElevatorAnimation(FieldSystem *fieldSystem, const u8 elevatorDir, const u8 animationLoopCount); + +#endif // POKEPLATINUM_ELEVATOR_ANIMATION_H diff --git a/include/overlay006/ov6_02246F00.h b/include/overlay006/ov6_02246F00.h deleted file mode 100644 index a1ef0baada..0000000000 --- a/include/overlay006/ov6_02246F00.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef POKEPLATINUM_OV6_02246F00_H -#define POKEPLATINUM_OV6_02246F00_H - -#include "field/field_system_decl.h" - -void ov6_02246F00(FieldSystem *fieldSystem, const u8 param1, const u8 param2); - -#endif // POKEPLATINUM_OV6_02246F00_H diff --git a/include/unk_020474B8.h b/include/unk_020474B8.h index 17b649256f..e5b2bbb6d5 100644 --- a/include/unk_020474B8.h +++ b/include/unk_020474B8.h @@ -48,6 +48,6 @@ BOOL ScrCmd_343(ScriptContext *param0); BOOL ScrCmd_344(ScriptContext *param0); BOOL ScrCmd_345(ScriptContext *param0); BOOL ScrCmd_346(ScriptContext *param0); -BOOL ScrCmd_347(ScriptContext *param0); +BOOL ScrCmd_BufferFloorNumber(ScriptContext *param0); #endif // POKEPLATINUM_UNK_020474B8_H diff --git a/platinum.us/main.lsf b/platinum.us/main.lsf index 804026fd53..7deb760b3e 100644 --- a/platinum.us/main.lsf +++ b/platinum.us/main.lsf @@ -581,7 +581,7 @@ Overlay overlay6 Object main.nef.p/src_overlay006_special_dates.c.o Object main.nef.p/src_overlay006_repel_step_update.c.o Object main.nef.p/src_overlay006_ov6_02246C24.c.o - Object main.nef.p/src_overlay006_ov6_02246F00.c.o + Object main.nef.p/src_overlay006_elevator_animation.c.o Object main.nef.p/src_overlay006_ov6_02247078.c.o Object main.nef.p/src_overlay006_ov6_02247100.c.o Object main.nef.p/src_overlay006_trophy_garden_daily_encounters.c.o diff --git a/res/field/scripts/scripts_battle_tower_elevator.s b/res/field/scripts/scripts_battle_tower_elevator.s index 82222da81b..44d4ec4a1e 100644 --- a/res/field/scripts/scripts_battle_tower_elevator.s +++ b/res/field/scripts/scripts_battle_tower_elevator.s @@ -1,13 +1,13 @@ #include "macros/scrcmd.inc" - ScriptEntry _0012 - ScriptEntry _0146 - ScriptEntry _015C - ScriptEntry _0172 + ScriptEntry BattleTowerElevator_Init + ScriptEntry BattleTowerElevator_EnterBattleRoom + ScriptEntry BattleTowerElevator_EnterMultiBattleRoom + ScriptEntry BattleTowerElevator_EnterBattleSalon ScriptEntryEnd -_0012: +BattleTowerElevator_Init: CallIfNe VAR_UNK_0x40DB, 0, _008A ScrCmd_1DD 43, 0, VAR_MAP_LOCAL_A Call _008E @@ -36,19 +36,19 @@ _009E: SetVar VAR_OBJ_GFX_ID_A, 232 Return -_00A6: +BattleTowerElevator_BattleRoomCheckWiFi: FadeScreenOut WaitFadeScreen ScrCmd_1DD 43, 0, VAR_RESULT - GoToIfEq VAR_RESULT, 4, _01F8 - GoToIfEq VAR_RESULT, 5, _01F8 + GoToIfEq VAR_RESULT, 4, BattleTowerElevator_WiFiBattleRoom + GoToIfEq VAR_RESULT, 5, BattleTowerElevator_WiFiBattleRoom ScrCmd_1F8 ScrCmd_2C4 5 ReturnToField Warp MAP_HEADER_BATTLE_TOWER, 0, 15, 6, 0 End -_00E9: +BattleTowerElevator_MultiBattleRoom: FadeScreenOut WaitFadeScreen ScrCmd_1F8 @@ -57,7 +57,7 @@ _00E9: Warp MAP_HEADER_BATTLE_TOWER, 0, 11, 6, 0 End -_010A: +BattleTowerElevator_BattleSalon: FadeScreenOut WaitFadeScreen Warp MAP_HEADER_BATTLE_TOWER_BATTLE_SALON, 0, 8, 2, 1 @@ -66,41 +66,41 @@ _010A: ReleaseAll End -_0132: - Call _0188 - ScrCmd_23C VAR_MAP_LOCAL_0, 3 - Call _0194 +BattleTowerElevator_ElevatorAnimation: + Call BattleTowerElevator_PlayerEnter + PlayElevatorAnimation VAR_MAP_LOCAL_0, 3 + Call BattleTowerElevator_Exit Return -_0146: +BattleTowerElevator_EnterBattleRoom: LockAll - SetVar VAR_MAP_LOCAL_0, 0 - Call _0132 - GoTo _00A6 + SetVar VAR_MAP_LOCAL_0, ELEVATOR_DIR_UP + Call BattleTowerElevator_ElevatorAnimation + GoTo BattleTowerElevator_BattleRoomCheckWiFi End -_015C: +BattleTowerElevator_EnterMultiBattleRoom: LockAll - SetVar VAR_MAP_LOCAL_0, 0 - Call _0132 - GoTo _00E9 + SetVar VAR_MAP_LOCAL_0, ELEVATOR_DIR_UP + Call BattleTowerElevator_ElevatorAnimation + GoTo BattleTowerElevator_MultiBattleRoom End -_0172: +BattleTowerElevator_EnterBattleSalon: LockAll - SetVar VAR_MAP_LOCAL_0, 1 - Call _0132 - GoTo _010A + SetVar VAR_MAP_LOCAL_0, ELEVATOR_DIR_DOWN + Call BattleTowerElevator_ElevatorAnimation + GoTo BattleTowerElevator_BattleSalon End -_0188: - ApplyMovement LOCALID_PLAYER, _01BC +BattleTowerElevator_PlayerEnter: + ApplyMovement LOCALID_PLAYER, BattleTowerElevator_PlayerEnterMovement WaitMovement Return -_0194: - ApplyMovement 0, _01C8 - ApplyMovement LOCALID_PLAYER, _01E4 +BattleTowerElevator_Exit: + ApplyMovement 0, BattleTowerElevator_GuideExitMovement + ApplyMovement LOCALID_PLAYER, BattleTowerElevator_PlayerExitMovement WaitMovement Return @@ -112,13 +112,13 @@ BattleTowerElevator_UnusedMovement: EndMovement .balign 4, 0 -_01BC: +BattleTowerElevator_PlayerEnterMovement: WalkNormalNorth 2 FaceSouth EndMovement .balign 4, 0 -_01C8: +BattleTowerElevator_GuideExitMovement: WalkNormalSouth FaceWest WalkNormalWest @@ -128,14 +128,14 @@ _01C8: EndMovement .balign 4, 0 -_01E4: +BattleTowerElevator_PlayerExitMovement: Delay8 2 Delay2 WalkNormalSouth 2 SetInvisible EndMovement -_01F8: +BattleTowerElevator_WiFiBattleRoom: ScrCmd_1F8 ScrCmd_2C4 5 ReturnToField diff --git a/res/field/scripts/scripts_hearthome_city_northeast_house_elevator.s b/res/field/scripts/scripts_hearthome_city_northeast_house_elevator.s index 17b930db5b..dc2e00d3e7 100644 --- a/res/field/scripts/scripts_hearthome_city_northeast_house_elevator.s +++ b/res/field/scripts/scripts_hearthome_city_northeast_house_elevator.s @@ -1,22 +1,22 @@ #include "macros/scrcmd.inc" - ScriptEntry _0006 + ScriptEntry HearthomeCityNortheastHouseElevator_Init ScriptEntryEnd -_0006: +HearthomeCityNortheastHouseElevator_Init: LockAll - ApplyMovement LOCALID_PLAYER, _00B8 + ApplyMovement LOCALID_PLAYER, HearthomeCityNortheastHouseElevator_WalkIn WaitMovement - GetFloorsAbove VAR_UNK_0x40CE - SetVar VAR_0x8008, VAR_UNK_0x40CE - GoToIfEq VAR_0x8008, 1, _0038 - GoToIfEq VAR_0x8008, 0, _006A + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetVar VAR_0x8008, VAR_ELEVATOR_FLOORS_ABOVE + GoToIfEq VAR_0x8008, 1, HearthomeCityNortheastHouseElevator_ElevatorUp + GoToIfEq VAR_0x8008, 0, HearthomeCityNortheastHouseElevator_ElevatorDown End -_0038: - SetVar VAR_0x8004, 0 - Call _009C +HearthomeCityNortheastHouseElevator_ElevatorUp: + SetVar VAR_0x8004, ELEVATOR_DIR_UP + Call HearthomeCityNortheastHouseElevator_ElevatorAnimation FadeScreenOut WaitFadeScreen Warp MAP_HEADER_HEARTHOME_CITY_NORTHEAST_HOUSE_2F, 0, 18, 3, 1 @@ -24,9 +24,9 @@ _0038: WaitFadeScreen End -_006A: - SetVar VAR_0x8004, 1 - Call _009C +HearthomeCityNortheastHouseElevator_ElevatorDown: + SetVar VAR_0x8004, ELEVATOR_DIR_DOWN + Call HearthomeCityNortheastHouseElevator_ElevatorAnimation FadeScreenOut WaitFadeScreen Warp MAP_HEADER_HEARTHOME_CITY_NORTHEAST_HOUSE_1F, 0, 18, 3, 1 @@ -34,22 +34,22 @@ _006A: WaitFadeScreen End -_009C: +HearthomeCityNortheastHouseElevator_ElevatorAnimation: WaitFanfare SEQ_SE_CONFIRM - ScrCmd_23C VAR_0x8004, 4 - ApplyMovement LOCALID_PLAYER, _00C4 + PlayElevatorAnimation VAR_0x8004, 4 + ApplyMovement LOCALID_PLAYER, HearthomeCityNortheastHouseElevator_WalkOut WaitMovement PlayFanfare SEQ_SE_DP_KAIDAN2 Return .balign 4, 0 -_00B8: +HearthomeCityNortheastHouseElevator_WalkIn: WalkNormalNorth 2 WalkOnSpotNormalSouth EndMovement .balign 4, 0 -_00C4: +HearthomeCityNortheastHouseElevator_WalkOut: WalkNormalSouth 2 WalkOnSpotNormalSouth EndMovement diff --git a/res/field/scripts/scripts_hearthome_city_southeast_house_elevator.s b/res/field/scripts/scripts_hearthome_city_southeast_house_elevator.s index 9d9e65a733..2760a87b4f 100644 --- a/res/field/scripts/scripts_hearthome_city_southeast_house_elevator.s +++ b/res/field/scripts/scripts_hearthome_city_southeast_house_elevator.s @@ -1,22 +1,22 @@ #include "macros/scrcmd.inc" - ScriptEntry _0006 + ScriptEntry HearthomeCitySoutheastHouseElevator_Init ScriptEntryEnd -_0006: +HearthomeCitySoutheastHouseElevator_Init: LockAll - ApplyMovement LOCALID_PLAYER, _00B8 + ApplyMovement LOCALID_PLAYER, HearthomeCitySoutheastHouseElevator_WalkIn WaitMovement - GetFloorsAbove VAR_UNK_0x40CE - SetVar VAR_0x8008, VAR_UNK_0x40CE - GoToIfEq VAR_0x8008, 1, _0038 - GoToIfEq VAR_0x8008, 0, _006A + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetVar VAR_0x8008, VAR_ELEVATOR_FLOORS_ABOVE + GoToIfEq VAR_0x8008, 1, HearthomeCitySoutheastHouseElevator_ElevatorUp + GoToIfEq VAR_0x8008, 0, HearthomeCitySoutheastHouseElevator_ElevatorDown End -_0038: - SetVar VAR_0x8004, 0 - Call _009C +HearthomeCitySoutheastHouseElevator_ElevatorUp: + SetVar VAR_0x8004, ELEVATOR_DIR_UP + Call HearthomeCitySoutheastHouseElevator_ElevatorAnimation FadeScreenOut WaitFadeScreen Warp MAP_HEADER_HEARTHOME_CITY_SOUTHEAST_HOUSE_2F, 0, 18, 3, 1 @@ -24,9 +24,9 @@ _0038: WaitFadeScreen End -_006A: - SetVar VAR_0x8004, 1 - Call _009C +HearthomeCitySoutheastHouseElevator_ElevatorDown: + SetVar VAR_0x8004, ELEVATOR_DIR_DOWN + Call HearthomeCitySoutheastHouseElevator_ElevatorAnimation FadeScreenOut WaitFadeScreen Warp MAP_HEADER_HEARTHOME_CITY_SOUTHEAST_HOUSE_1F, 0, 18, 3, 1 @@ -34,22 +34,22 @@ _006A: WaitFadeScreen End -_009C: +HearthomeCitySoutheastHouseElevator_ElevatorAnimation: WaitFanfare SEQ_SE_CONFIRM - ScrCmd_23C VAR_0x8004, 4 - ApplyMovement LOCALID_PLAYER, _00C4 + PlayElevatorAnimation VAR_0x8004, 4 + ApplyMovement LOCALID_PLAYER, HearthomeCitySoutheastHouseElevator_WalkOut WaitMovement PlayFanfare SEQ_SE_DP_KAIDAN2 Return .balign 4, 0 -_00B8: +HearthomeCitySoutheastHouseElevator_WalkIn: WalkNormalNorth 2 WalkOnSpotNormalSouth EndMovement .balign 4, 0 -_00C4: +HearthomeCitySoutheastHouseElevator_WalkOut: WalkNormalSouth 2 WalkOnSpotNormalSouth EndMovement diff --git a/res/field/scripts/scripts_jubilife_tv_elevator.s b/res/field/scripts/scripts_jubilife_tv_elevator.s index 156afc8754..136fcfc200 100644 --- a/res/field/scripts/scripts_jubilife_tv_elevator.s +++ b/res/field/scripts/scripts_jubilife_tv_elevator.s @@ -1,153 +1,154 @@ #include "macros/scrcmd.inc" #include "res/text/bank/jubilife_tv_elevator.h" +#include "res/text/bank/menu_entries.h" - ScriptEntry _0006 + ScriptEntry JubilifeTVElevator_TalkElevatorOperator ScriptEntryEnd -_0006: +JubilifeTVElevator_TalkElevatorOperator: PlayFanfare SEQ_SE_CONFIRM LockAll FacePlayer - GetFloorsAbove VAR_UNK_0x40CE - SetVar VAR_0x8008, VAR_UNK_0x40CE - GoToIfEq VAR_0x8008, 0, _004E - GoToIfEq VAR_0x8008, 1, _005A - GoToIfEq VAR_0x8008, 2, _0066 - GoToIfEq VAR_0x8008, 3, _0072 + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetVar VAR_0x8008, VAR_ELEVATOR_FLOORS_ABOVE + GoToIfEq VAR_0x8008, 0, JubilifeTVElevator_CurrentFloor4 + GoToIfEq VAR_0x8008, 1, JubilifeTVElevator_CurrentFloor3 + GoToIfEq VAR_0x8008, 2, JubilifeTVElevator_CurrentFloor2 + GoToIfEq VAR_0x8008, 3, JubilifeTVElevator_CurrentFloor1 End -_004E: - ScrCmd_347 0, 4 - GoTo _007E +JubilifeTVElevator_CurrentFloor4: + BufferFloorNumber 0, 4 + GoTo JubilifeTVElevator_SelectFloor End -_005A: - ScrCmd_347 0, 3 - GoTo _007E +JubilifeTVElevator_CurrentFloor3: + BufferFloorNumber 0, 3 + GoTo JubilifeTVElevator_SelectFloor End -_0066: - ScrCmd_347 0, 2 - GoTo _007E +JubilifeTVElevator_CurrentFloor2: + BufferFloorNumber 0, 2 + GoTo JubilifeTVElevator_SelectFloor End -_0072: - ScrCmd_347 0, 1 - GoTo _007E +JubilifeTVElevator_CurrentFloor1: + BufferFloorNumber 0, 1 + GoTo JubilifeTVElevator_SelectFloor End -_007E: - ShowCurrentFloor 20, 1, VAR_UNK_0x40CE - Message 0 +JubilifeTVElevator_SelectFloor: + ShowCurrentFloor 20, 1, VAR_ELEVATOR_FLOORS_ABOVE + Message JubilifeTVElevator_Text_Hello InitGlobalTextMenu 1, 1, 0, VAR_RESULT - AddMenuEntryImm 119, 0 - AddMenuEntryImm 118, 1 - AddMenuEntryImm 117, 2 - AddMenuEntryImm 116, 3 - AddMenuEntryImm 124, 4 + AddMenuEntryImm MenuEntries_Text_4F, 0 + AddMenuEntryImm MenuEntries_Text_3F, 1 + AddMenuEntryImm MenuEntries_Text_2F, 2 + AddMenuEntryImm MenuEntries_Text_1F, 3 + AddMenuEntryImm MenuEntries_Text_ElevatorExit, 4 ShowMenu SetVar VAR_0x8008, VAR_RESULT - GoToIfEq VAR_0x8008, 0, _01DC - GoToIfEq VAR_0x8008, 1, _018B - GoToIfEq VAR_0x8008, 2, _013A - GoToIfEq VAR_0x8008, 3, _00E9 - GoTo _0283 + GoToIfEq VAR_0x8008, 0, JubilifeTVElevator_SelectFloor4 + GoToIfEq VAR_0x8008, 1, JubilifeTVElevator_SelectFloor3 + GoToIfEq VAR_0x8008, 2, JubilifeTVElevator_SelectFloor2 + GoToIfEq VAR_0x8008, 3, JubilifeTVElevator_SelectFloor1 + GoTo JubilifeTVElevator_SelectNoFloor End -_00E9: +JubilifeTVElevator_SelectFloor1: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 11, 2, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 3, _026C - CallIfGt VAR_UNK_0x40CE, 3, _022D - CallIfLt VAR_UNK_0x40CE, 3, _0238 - Call _0243 - SetVar VAR_UNK_0x40CE, 3 - GoTo _0261 + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_JUBILIFE_TV_1F, 2, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 3, JubilifeTVElevator_SameFloorMessage + CallIfGt VAR_ELEVATOR_FLOORS_ABOVE, 3, JubilifeTVElevator_GoingUpMessage + CallIfLt VAR_ELEVATOR_FLOORS_ABOVE, 3, JubilifeTVElevator_GoingDownMessage + Call JubilifeTVElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 3 + GoTo JubilifeTVElevator_HereWeAreMessage End -_013A: +JubilifeTVElevator_SelectFloor2: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 12, 3, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 2, _026C - CallIfGt VAR_UNK_0x40CE, 2, _022D - CallIfLt VAR_UNK_0x40CE, 2, _0238 - Call _0243 - SetVar VAR_UNK_0x40CE, 2 - GoTo _0261 + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_JUBILIFE_TV_2F, 3, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 2, JubilifeTVElevator_SameFloorMessage + CallIfGt VAR_ELEVATOR_FLOORS_ABOVE, 2, JubilifeTVElevator_GoingUpMessage + CallIfLt VAR_ELEVATOR_FLOORS_ABOVE, 2, JubilifeTVElevator_GoingDownMessage + Call JubilifeTVElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 2 + GoTo JubilifeTVElevator_HereWeAreMessage End -_018B: +JubilifeTVElevator_SelectFloor3: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 13, 4, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 1, _026C - CallIfGt VAR_UNK_0x40CE, 1, _022D - CallIfLt VAR_UNK_0x40CE, 1, _0238 - Call _0243 - SetVar VAR_UNK_0x40CE, 1 - GoTo _0261 + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_JUBILIFE_TV_3F, 4, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 1, JubilifeTVElevator_SameFloorMessage + CallIfGt VAR_ELEVATOR_FLOORS_ABOVE, 1, JubilifeTVElevator_GoingUpMessage + CallIfLt VAR_ELEVATOR_FLOORS_ABOVE, 1, JubilifeTVElevator_GoingDownMessage + Call JubilifeTVElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 1 + GoTo JubilifeTVElevator_HereWeAreMessage End -_01DC: +JubilifeTVElevator_SelectFloor4: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 14, 1, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 0, _026C - CallIfGt VAR_UNK_0x40CE, 0, _022D - CallIfLt VAR_UNK_0x40CE, 0, _0238 - Call _0243 - SetVar VAR_UNK_0x40CE, 0 - GoTo _0261 + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_JUBILIFE_TV_4F, 1, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 0, JubilifeTVElevator_SameFloorMessage + CallIfGt VAR_ELEVATOR_FLOORS_ABOVE, 0, JubilifeTVElevator_GoingUpMessage + CallIfLt VAR_ELEVATOR_FLOORS_ABOVE, 0, JubilifeTVElevator_GoingDownMessage + Call JubilifeTVElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 0 + GoTo JubilifeTVElevator_HereWeAreMessage End -_022D: - Message 2 - SetVar VAR_0x8004, 0 +JubilifeTVElevator_GoingUpMessage: + Message JubilifeTVElevator_Text_GoingUp + SetVar VAR_0x8004, ELEVATOR_DIR_UP Return -_0238: - Message 3 - SetVar VAR_0x8004, 1 +JubilifeTVElevator_GoingDownMessage: + Message JubilifeTVElevator_Text_GoingDown + SetVar VAR_0x8004, ELEVATOR_DIR_DOWN Return -_0243: - SetVar VAR_UNK_0x40CE, -1 +JubilifeTVElevator_ElevatorAnimation: + SetVar VAR_ELEVATOR_FLOORS_ABOVE, -1 CloseMessage - ApplyMovement 0, _029C + ApplyMovement 0, JubilifeTVElevator_LookDown WaitMovement WaitFanfare SEQ_SE_CONFIRM - ScrCmd_23C VAR_0x8004, 4 + PlayElevatorAnimation VAR_0x8004, 4 Return -_0261: - Message 5 +JubilifeTVElevator_HereWeAreMessage: + Message JubilifeTVElevator_Text_HereWeAre WaitABXPadPress CloseMessage ReleaseAll End -_026C: - SetVar VAR_UNK_0x40CE, -1 +JubilifeTVElevator_SameFloorMessage: + SetVar VAR_ELEVATOR_FLOORS_ABOVE, -1 WaitTime 1, VAR_RESULT - Message 4 + Message JubilifeTVElevator_Text_SameFloor WaitABXPadPress CloseMessage ReleaseAll End -_0283: - SetVar VAR_UNK_0x40CE, -1 +JubilifeTVElevator_SelectNoFloor: + SetVar VAR_ELEVATOR_FLOORS_ABOVE, -1 WaitTime 1, VAR_RESULT - Message 1 + Message JubilifeTVElevator_Text_LookForward WaitABXPadPress CloseMessage ReleaseAll End .balign 4, 0 -_029C: +JubilifeTVElevator_LookDown: WalkOnSpotNormalSouth EndMovement diff --git a/res/field/scripts/scripts_pastoria_city_observatory_gate_1f.s b/res/field/scripts/scripts_pastoria_city_observatory_gate_1f.s index 86fb702f5a..f197c5360a 100644 --- a/res/field/scripts/scripts_pastoria_city_observatory_gate_1f.s +++ b/res/field/scripts/scripts_pastoria_city_observatory_gate_1f.s @@ -65,7 +65,7 @@ _00F2: _0102: SetVar VAR_UNK_0x40DA, 1 ScrCmd_202 0 - ScrCmd_11B 125, 2, 5, 2, 1 + SetSpecialLocation MAP_HEADER_PASTORIA_CITY_OBSERVATORY_GATE_1F, 2, 5, 2, DIR_SOUTH PlayFanfare SEQ_SE_DP_KAIDAN2 FadeScreenOut WaitFadeScreen diff --git a/res/field/scripts/scripts_resort_area_ribbon_syndicate_elevator.s b/res/field/scripts/scripts_resort_area_ribbon_syndicate_elevator.s index 7f495e4daf..f90b804d37 100644 --- a/res/field/scripts/scripts_resort_area_ribbon_syndicate_elevator.s +++ b/res/field/scripts/scripts_resort_area_ribbon_syndicate_elevator.s @@ -1,104 +1,105 @@ #include "macros/scrcmd.inc" #include "res/text/bank/resort_area_ribbon_syndicate_elevator.h" +#include "res/text/bank/menu_entries.h" - ScriptEntry _0006 + ScriptEntry ResortAreaRibbonSyndicateElevator_TalkElevatorOperator ScriptEntryEnd -_0006: +ResortAreaRibbonSyndicateElevator_TalkElevatorOperator: PlayFanfare SEQ_SE_CONFIRM LockAll FacePlayer - GetFloorsAbove VAR_UNK_0x40CE - SetVar VAR_0x8008, VAR_UNK_0x40CE - GoToIfEq VAR_0x8008, 0, _0034 - GoToIfEq VAR_0x8008, 1, _003E + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetVar VAR_0x8008, VAR_ELEVATOR_FLOORS_ABOVE + GoToIfEq VAR_0x8008, 0, ResortAreaRibbonSyndicateElevator_CurrentFloor2 + GoToIfEq VAR_0x8008, 1, ResortAreaRibbonSyndicateElevator_CurrentFloor1 End -_0034: - ScrCmd_347 0, 2 - GoTo _0048 +ResortAreaRibbonSyndicateElevator_CurrentFloor2: + BufferFloorNumber 0, 2 + GoTo ResortAreaRibbonSyndicateElevator_SelectFloor -_003E: - ScrCmd_347 0, 1 - GoTo _0048 +ResortAreaRibbonSyndicateElevator_CurrentFloor1: + BufferFloorNumber 0, 1 + GoTo ResortAreaRibbonSyndicateElevator_SelectFloor -_0048: - ShowCurrentFloor 20, 1, VAR_UNK_0x40CE - Message 0 +ResortAreaRibbonSyndicateElevator_SelectFloor: + ShowCurrentFloor 20, 1, VAR_ELEVATOR_FLOORS_ABOVE + Message ResortAreaRibbonSyndicateElevator_Text_Hello InitGlobalTextMenu 1, 1, 0, VAR_RESULT - AddMenuEntryImm 117, 0 - AddMenuEntryImm 116, 1 - AddMenuEntryImm 124, 2 + AddMenuEntryImm MenuEntries_Text_2F, 0 + AddMenuEntryImm MenuEntries_Text_1F, 1 + AddMenuEntryImm MenuEntries_Text_ElevatorExit, 2 ShowMenu SetVar VAR_0x8008, VAR_RESULT - GoToIfEq VAR_0x8008, 0, _008F - GoToIfEq VAR_0x8008, 1, _00CA - GoTo _0152 + GoToIfEq VAR_0x8008, 0, ResortAreaRibbonSyndicateElevator_SelectFloor2 + GoToIfEq VAR_0x8008, 1, ResortAreaRibbonSyndicateElevator_SelectFloor1 + GoTo ResortAreaRibbonSyndicateElevator_SameFloorMessage -_008F: +ResortAreaRibbonSyndicateElevator_SelectFloor2: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 0x1CE, 0, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 0, _0164 - SetVar VAR_0x8004, 0 - Call _0105 - SetVar VAR_UNK_0x40CE, 0 - GoTo _0147 + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_RESORT_AREA_RIBBON_SYNDICATE_2F, 0, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 0, ResortAreaRibbonSyndicateElevator_SelectCurrentFloor + SetVar VAR_0x8004, ELEVATOR_DIR_UP + Call ResortAreaRibbonSyndicateElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 0 + GoTo ResortAreaRibbonSyndicateElevator_HereWeAreMessage -_00CA: +ResortAreaRibbonSyndicateElevator_SelectFloor1: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 0x1CD, 1, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 1, _0164 - SetVar VAR_0x8004, 1 - Call _0105 - SetVar VAR_UNK_0x40CE, 1 - GoTo _0147 + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_RESORT_AREA_RIBBON_SYNDICATE_1F, 1, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 1, ResortAreaRibbonSyndicateElevator_SelectCurrentFloor + SetVar VAR_0x8004, ELEVATOR_DIR_DOWN + Call ResortAreaRibbonSyndicateElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 1 + GoTo ResortAreaRibbonSyndicateElevator_HereWeAreMessage -_0105: - SetVar VAR_UNK_0x40CE, -1 - CallIfEq VAR_0x8004, 1, _013D - CallIfEq VAR_0x8004, 0, _0142 +ResortAreaRibbonSyndicateElevator_ElevatorAnimation: + SetVar VAR_ELEVATOR_FLOORS_ABOVE, -1 + CallIfEq VAR_0x8004, ELEVATOR_DIR_DOWN, ResortAreaRibbonSyndicateElevator_GoingDownMessage + CallIfEq VAR_0x8004, ELEVATOR_DIR_UP, ResortAreaRibbonSyndicateElevator_GoingUpMessage CloseMessage - ApplyMovement 0, _017C + ApplyMovement 0, ResortAreaRibbonSyndicateElevator_LookDown WaitMovement WaitFanfare SEQ_SE_CONFIRM - ScrCmd_23C VAR_0x8004, 4 + PlayElevatorAnimation VAR_0x8004, 4 Return -_013D: - Message 2 +ResortAreaRibbonSyndicateElevator_GoingDownMessage: + Message ResortAreaRibbonSyndicateElevator_Text_GoingDown Return -_0142: - Message 1 +ResortAreaRibbonSyndicateElevator_GoingUpMessage: + Message ResortAreaRibbonSyndicateElevator_Text_GoingUp Return -_0147: - Message 4 +ResortAreaRibbonSyndicateElevator_HereWeAreMessage: + Message ResortAreaRibbonSyndicateElevator_Text_HereWeAre WaitABXPadPress CloseMessage ReleaseAll End -_0152: - SetVar VAR_UNK_0x40CE, -1 +ResortAreaRibbonSyndicateElevator_SameFloorMessage: + SetVar VAR_ELEVATOR_FLOORS_ABOVE, -1 WaitTime 1, VAR_RESULT CloseMessage ReleaseAll End -_0164: - SetVar VAR_UNK_0x40CE, -1 +ResortAreaRibbonSyndicateElevator_SelectCurrentFloor: + SetVar VAR_ELEVATOR_FLOORS_ABOVE, -1 WaitTime 1, VAR_RESULT - Message 3 + Message ResortAreaRibbonSyndicateElevator_Text_SameFloor WaitABXPadPress CloseMessage ReleaseAll End .balign 4, 0 -_017C: +ResortAreaRibbonSyndicateElevator_LookDown: WalkOnSpotNormalSouth EndMovement diff --git a/res/field/scripts/scripts_veilstone_store_elevator.s b/res/field/scripts/scripts_veilstone_store_elevator.s index 393cfd0184..ff4bbd54cc 100644 --- a/res/field/scripts/scripts_veilstone_store_elevator.s +++ b/res/field/scripts/scripts_veilstone_store_elevator.s @@ -1,220 +1,221 @@ #include "macros/scrcmd.inc" #include "res/text/bank/veilstone_store_elevator.h" +#include "res/text/bank/menu_entries.h" - ScriptEntry _0006 + ScriptEntry VeilstoneStoreElevator_TalkElevatorOperator ScriptEntryEnd -_0006: +VeilstoneStoreElevator_TalkElevatorOperator: PlayFanfare SEQ_SE_CONFIRM LockAll FacePlayer - GetFloorsAbove VAR_UNK_0x40CE - SetVar VAR_0x8008, VAR_UNK_0x40CE - GoToIfEq VAR_0x8008, 0, _0068 - GoToIfEq VAR_0x8008, 1, _0072 - GoToIfEq VAR_0x8008, 2, _007C - GoToIfEq VAR_0x8008, 3, _0086 - GoToIfEq VAR_0x8008, 4, _0090 - GoToIfEq VAR_0x8008, 5, _009A + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetVar VAR_0x8008, VAR_ELEVATOR_FLOORS_ABOVE + GoToIfEq VAR_0x8008, 0, VeilstoneStoreElevator_CurrentFloor5 + GoToIfEq VAR_0x8008, 1, VeilstoneStoreElevator_CurrentFloor4 + GoToIfEq VAR_0x8008, 2, VeilstoneStoreElevator_CurrentFloor3 + GoToIfEq VAR_0x8008, 3, VeilstoneStoreElevator_CurrentFloor2 + GoToIfEq VAR_0x8008, 4, VeilstoneStoreElevator_CurrentFloor1 + GoToIfEq VAR_0x8008, 5, VeilstoneStoreElevator_CurrentFloorB1 End -_0068: - ScrCmd_347 0, 5 - GoTo _00A6 +VeilstoneStoreElevator_CurrentFloor5: + BufferFloorNumber 0, 5 + GoTo VeilstoneStoreElevator_SelectFloor -_0072: - ScrCmd_347 0, 4 - GoTo _00A6 +VeilstoneStoreElevator_CurrentFloor4: + BufferFloorNumber 0, 4 + GoTo VeilstoneStoreElevator_SelectFloor -_007C: - ScrCmd_347 0, 3 - GoTo _00A6 +VeilstoneStoreElevator_CurrentFloor3: + BufferFloorNumber 0, 3 + GoTo VeilstoneStoreElevator_SelectFloor -_0086: - ScrCmd_347 0, 2 - GoTo _00A6 +VeilstoneStoreElevator_CurrentFloor2: + BufferFloorNumber 0, 2 + GoTo VeilstoneStoreElevator_SelectFloor -_0090: - ScrCmd_347 0, 1 - GoTo _00A6 +VeilstoneStoreElevator_CurrentFloor1: + BufferFloorNumber 0, 1 + GoTo VeilstoneStoreElevator_SelectFloor -_009A: - ScrCmd_347 0, 0 - GoTo _00A6 +VeilstoneStoreElevator_CurrentFloorB1: + BufferFloorNumber 0, 0 + GoTo VeilstoneStoreElevator_SelectFloor End -_00A6: - ShowCurrentFloor 20, 1, VAR_UNK_0x40CE - Message 0 +VeilstoneStoreElevator_SelectFloor: + ShowCurrentFloor 20, 1, VAR_ELEVATOR_FLOORS_ABOVE + Message VeilstoneStoreElevator_Text_Hello InitGlobalTextMenu 1, 1, 0, VAR_RESULT - AddMenuEntryImm 120, 0 - AddMenuEntryImm 119, 1 - AddMenuEntryImm 118, 2 - AddMenuEntryImm 117, 3 - AddMenuEntryImm 116, 4 - AddMenuEntryImm 121, 5 - AddMenuEntryImm 124, 6 + AddMenuEntryImm MenuEntries_Text_5F, 0 + AddMenuEntryImm MenuEntries_Text_4F, 1 + AddMenuEntryImm MenuEntries_Text_3F, 2 + AddMenuEntryImm MenuEntries_Text_2F, 3 + AddMenuEntryImm MenuEntries_Text_1F, 4 + AddMenuEntryImm MenuEntries_Text_B1F, 5 + AddMenuEntryImm MenuEntries_Text_ElevatorExit, 6 ShowMenu SetVar VAR_0x8008, VAR_RESULT - GoToIfEq VAR_0x8008, 0, _02BC - GoToIfEq VAR_0x8008, 1, _026D - GoToIfEq VAR_0x8008, 2, _021E - GoToIfEq VAR_0x8008, 3, _01CF - GoToIfEq VAR_0x8008, 4, _0180 - GoToIfEq VAR_0x8008, 5, _0131 - GoTo _03F6 + GoToIfEq VAR_0x8008, 0, VeilstoneStoreElevator_SelectFloor5 + GoToIfEq VAR_0x8008, 1, VeilstoneStoreElevator_SelectFloor4 + GoToIfEq VAR_0x8008, 2, VeilstoneStoreElevator_SelectFloor3 + GoToIfEq VAR_0x8008, 3, VeilstoneStoreElevator_SelectFloor2 + GoToIfEq VAR_0x8008, 4, VeilstoneStoreElevator_SelectFloor1 + GoToIfEq VAR_0x8008, 5, VeilstoneStoreElevator_SelectFloorB1 + GoTo VeilstoneStoreElevator_SelectNoFloor -_0131: +VeilstoneStoreElevator_SelectFloorB1: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 0x236, 1, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 5, _03DF - CallIfGt VAR_UNK_0x40CE, 5, _030B - CallIfLt VAR_UNK_0x40CE, 5, _0316 - Call _0321 - SetVar VAR_UNK_0x40CE, 5 - GoTo _033F + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_VEILSTONE_STORE_B1F, 1, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 5, VeilstoneStoreElevator_SelectCurrentFloor + CallIfGt VAR_ELEVATOR_FLOORS_ABOVE, 5, VeilstoneStoreElevator_GoingUpMessage + CallIfLt VAR_ELEVATOR_FLOORS_ABOVE, 5, VeilstoneStoreElevator_GoingDownMessage + Call VeilstoneStoreElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 5 + GoTo VeilstoneStoreElevator_ElevatorArrived -_0180: +VeilstoneStoreElevator_SelectFloor1: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 137, 2, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 4, _03DF - CallIfGt VAR_UNK_0x40CE, 4, _030B - CallIfLt VAR_UNK_0x40CE, 4, _0316 - Call _0321 - SetVar VAR_UNK_0x40CE, 4 - GoTo _033F + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_VEILSTONE_STORE_1F, 2, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 4, VeilstoneStoreElevator_SelectCurrentFloor + CallIfGt VAR_ELEVATOR_FLOORS_ABOVE, 4, VeilstoneStoreElevator_GoingUpMessage + CallIfLt VAR_ELEVATOR_FLOORS_ABOVE, 4, VeilstoneStoreElevator_GoingDownMessage + Call VeilstoneStoreElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 4 + GoTo VeilstoneStoreElevator_ElevatorArrived -_01CF: +VeilstoneStoreElevator_SelectFloor2: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 138, 2, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 3, _03DF - CallIfGt VAR_UNK_0x40CE, 3, _030B - CallIfLt VAR_UNK_0x40CE, 3, _0316 - Call _0321 - SetVar VAR_UNK_0x40CE, 3 - GoTo _033F + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_VEILSTONE_STORE_2F, 2, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 3, VeilstoneStoreElevator_SelectCurrentFloor + CallIfGt VAR_ELEVATOR_FLOORS_ABOVE, 3, VeilstoneStoreElevator_GoingUpMessage + CallIfLt VAR_ELEVATOR_FLOORS_ABOVE, 3, VeilstoneStoreElevator_GoingDownMessage + Call VeilstoneStoreElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 3 + GoTo VeilstoneStoreElevator_ElevatorArrived -_021E: +VeilstoneStoreElevator_SelectFloor3: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 139, 2, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 2, _03DF - CallIfGt VAR_UNK_0x40CE, 2, _030B - CallIfLt VAR_UNK_0x40CE, 2, _0316 - Call _0321 - SetVar VAR_UNK_0x40CE, 2 - GoTo _033F + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_VEILSTONE_STORE_3F, 2, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 2, VeilstoneStoreElevator_SelectCurrentFloor + CallIfGt VAR_ELEVATOR_FLOORS_ABOVE, 2, VeilstoneStoreElevator_GoingUpMessage + CallIfLt VAR_ELEVATOR_FLOORS_ABOVE, 2, VeilstoneStoreElevator_GoingDownMessage + Call VeilstoneStoreElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 2 + GoTo VeilstoneStoreElevator_ElevatorArrived -_026D: +VeilstoneStoreElevator_SelectFloor4: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 140, 2, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 1, _03DF - CallIfGt VAR_UNK_0x40CE, 1, _030B - CallIfLt VAR_UNK_0x40CE, 1, _0316 - Call _0321 - SetVar VAR_UNK_0x40CE, 1 - GoTo _033F + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_VEILSTONE_STORE_4F, 2, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 1, VeilstoneStoreElevator_SelectCurrentFloor + CallIfGt VAR_ELEVATOR_FLOORS_ABOVE, 1, VeilstoneStoreElevator_GoingUpMessage + CallIfLt VAR_ELEVATOR_FLOORS_ABOVE, 1, VeilstoneStoreElevator_GoingDownMessage + Call VeilstoneStoreElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 1 + GoTo VeilstoneStoreElevator_ElevatorArrived -_02BC: +VeilstoneStoreElevator_SelectFloor5: WaitTime 1, VAR_RESULT - GetFloorsAbove VAR_UNK_0x40CE - ScrCmd_11B 141, 1, 18, 2, 1 - GoToIfEq VAR_UNK_0x40CE, 0, _03DF - CallIfGt VAR_UNK_0x40CE, 0, _030B - CallIfLt VAR_UNK_0x40CE, 0, _0316 - Call _0321 - SetVar VAR_UNK_0x40CE, 0 - GoTo _033F + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetSpecialLocation MAP_HEADER_VEILSTONE_STORE_5F, 1, 18, 2, DIR_SOUTH + GoToIfEq VAR_ELEVATOR_FLOORS_ABOVE, 0, VeilstoneStoreElevator_SelectCurrentFloor + CallIfGt VAR_ELEVATOR_FLOORS_ABOVE, 0, VeilstoneStoreElevator_GoingUpMessage + CallIfLt VAR_ELEVATOR_FLOORS_ABOVE, 0, VeilstoneStoreElevator_GoingDownMessage + Call VeilstoneStoreElevator_ElevatorAnimation + SetVar VAR_ELEVATOR_FLOORS_ABOVE, 0 + GoTo VeilstoneStoreElevator_ElevatorArrived -_030B: - Message 2 - SetVar VAR_0x8004, 0 +VeilstoneStoreElevator_GoingUpMessage: + Message VeilstoneStoreElevator_Text_GoingUp + SetVar VAR_0x8004, ELEVATOR_DIR_UP Return -_0316: - Message 3 - SetVar VAR_0x8004, 1 +VeilstoneStoreElevator_GoingDownMessage: + Message VeilstoneStoreElevator_Text_GoingDown + SetVar VAR_0x8004, ELEVATOR_DIR_DOWN Return -_0321: - SetVar VAR_UNK_0x40CE, -1 +VeilstoneStoreElevator_ElevatorAnimation: + SetVar VAR_ELEVATOR_FLOORS_ABOVE, -1 CloseMessage - ApplyMovement 0, _0410 + ApplyMovement 0, VeilstoneStoreElevator_LookDown WaitMovement WaitFanfare SEQ_SE_CONFIRM - ScrCmd_23C VAR_0x8004, 4 + PlayElevatorAnimation VAR_0x8004, 4 Return -_033F: - SetVar VAR_0x8008, VAR_UNK_0x40CE - GoToIfEq VAR_0x8008, 0, _0395 - GoToIfEq VAR_0x8008, 1, _03A0 - GoToIfEq VAR_0x8008, 2, _03AB - GoToIfEq VAR_0x8008, 3, _03B6 - GoToIfEq VAR_0x8008, 4, _03C1 - GoToIfEq VAR_0x8008, 5, _03CC +VeilstoneStoreElevator_ElevatorArrived: + SetVar VAR_0x8008, VAR_ELEVATOR_FLOORS_ABOVE + GoToIfEq VAR_0x8008, 0, VeilstoneStoreElevator_ArrivedFloor5 + GoToIfEq VAR_0x8008, 1, VeilstoneStoreElevator_ArrivedFloor4 + GoToIfEq VAR_0x8008, 2, VeilstoneStoreElevator_ArrivedFloor3 + GoToIfEq VAR_0x8008, 3, VeilstoneStoreElevator_ArrivedFloor2 + GoToIfEq VAR_0x8008, 4, VeilstoneStoreElevator_ArrivedFloor1 + GoToIfEq VAR_0x8008, 5, VeilstoneStoreElevator_ArrivedFloorB1 End -_0395: - Message 9 - GoTo _03D7 +VeilstoneStoreElevator_ArrivedFloor5: + Message VeilstoneStoreElevator_Text_Floor5 + GoTo VeilstoneStoreElevator_ElevatorDone End -_03A0: - Message 8 - GoTo _03D7 +VeilstoneStoreElevator_ArrivedFloor4: + Message VeilstoneStoreElevator_Text_Floor4 + GoTo VeilstoneStoreElevator_ElevatorDone End -_03AB: - Message 7 - GoTo _03D7 +VeilstoneStoreElevator_ArrivedFloor3: + Message VeilstoneStoreElevator_Text_Floor3 + GoTo VeilstoneStoreElevator_ElevatorDone End -_03B6: - Message 6 - GoTo _03D7 +VeilstoneStoreElevator_ArrivedFloor2: + Message VeilstoneStoreElevator_Text_Floor2 + GoTo VeilstoneStoreElevator_ElevatorDone End -_03C1: - Message 5 - GoTo _03D7 +VeilstoneStoreElevator_ArrivedFloor1: + Message VeilstoneStoreElevator_Text_Floor1 + GoTo VeilstoneStoreElevator_ElevatorDone End -_03CC: - Message 10 - GoTo _03D7 +VeilstoneStoreElevator_ArrivedFloorB1: + Message VeilstoneStoreElevator_Text_FloorB1 + GoTo VeilstoneStoreElevator_ElevatorDone End -_03D7: +VeilstoneStoreElevator_ElevatorDone: WaitABXPadPress CloseMessage ReleaseAll End -_03DF: - SetVar VAR_UNK_0x40CE, -1 +VeilstoneStoreElevator_SelectCurrentFloor: + SetVar VAR_ELEVATOR_FLOORS_ABOVE, -1 WaitTime 1, VAR_RESULT - Message 4 + Message VeilstoneStoreElevator_Text_SameFloor WaitABXPadPress CloseMessage ReleaseAll End -_03F6: - SetVar VAR_UNK_0x40CE, -1 +VeilstoneStoreElevator_SelectNoFloor: + SetVar VAR_ELEVATOR_FLOORS_ABOVE, -1 WaitTime 1, VAR_RESULT - Message 1 + Message VeilstoneStoreElevator_Text_LookForward WaitABXPadPress CloseMessage ReleaseAll End .balign 4, 0 -_0410: +VeilstoneStoreElevator_LookDown: WalkOnSpotNormalSouth EndMovement diff --git a/res/field/scripts/scripts_vista_lighthouse_elevator.s b/res/field/scripts/scripts_vista_lighthouse_elevator.s index 208cdbf676..4bf668e442 100644 --- a/res/field/scripts/scripts_vista_lighthouse_elevator.s +++ b/res/field/scripts/scripts_vista_lighthouse_elevator.s @@ -1,22 +1,22 @@ #include "macros/scrcmd.inc" - ScriptEntry _0006 + ScriptEntry VistaLighthouseElevator_Init ScriptEntryEnd -_0006: +VistaLighthouseElevator_Init: LockAll - ApplyMovement LOCALID_PLAYER, _00B8 + ApplyMovement LOCALID_PLAYER, VistaLighthouseElevator_WalkIn WaitMovement - GetFloorsAbove VAR_UNK_0x40CE - SetVar VAR_0x8008, VAR_UNK_0x40CE - GoToIfEq VAR_0x8008, 1, _0038 - GoToIfEq VAR_0x8008, 0, _006A + GetFloorsAbove VAR_ELEVATOR_FLOORS_ABOVE + SetVar VAR_0x8008, VAR_ELEVATOR_FLOORS_ABOVE + GoToIfEq VAR_0x8008, 1, VistaLighthouseElevator_ElevatorUp + GoToIfEq VAR_0x8008, 0, VistaLighthouseElevator_ElevatorDown End -_0038: - SetVar VAR_0x8004, 0 - Call _009C +VistaLighthouseElevator_ElevatorUp: + SetVar VAR_0x8004, ELEVATOR_DIR_UP + Call VistaLighthouseElevator_ElevatorAnimation FadeScreenOut WaitFadeScreen Warp MAP_HEADER_VISTA_LIGHTHOUSE, 0, 6, 10, 1 @@ -24,9 +24,9 @@ _0038: WaitFadeScreen End -_006A: - SetVar VAR_0x8004, 1 - Call _009C +VistaLighthouseElevator_ElevatorDown: + SetVar VAR_0x8004, ELEVATOR_DIR_DOWN + Call VistaLighthouseElevator_ElevatorAnimation FadeScreenOut WaitFadeScreen Warp MAP_HEADER_SUNYSHORE_CITY, 0, 0x376, 0x317, 1 @@ -34,22 +34,22 @@ _006A: WaitFadeScreen End -_009C: +VistaLighthouseElevator_ElevatorAnimation: WaitFanfare SEQ_SE_CONFIRM - ScrCmd_23C VAR_0x8004, 4 - ApplyMovement LOCALID_PLAYER, _00C4 + PlayElevatorAnimation VAR_0x8004, 4 + ApplyMovement LOCALID_PLAYER, VistaLighthouseElevator_WalkOut WaitMovement PlayFanfare SEQ_SE_DP_KAIDAN2 Return .balign 4, 0 -_00B8: +VistaLighthouseElevator_WalkIn: WalkNormalNorth 2 WalkOnSpotNormalSouth EndMovement .balign 4, 0 -_00C4: +VistaLighthouseElevator_WalkOut: WalkNormalSouth 2 WalkOnSpotNormalSouth EndMovement diff --git a/res/text/jubilife_tv_elevator.json b/res/text/jubilife_tv_elevator.json index 652d49a8be..1e421f6386 100644 --- a/res/text/jubilife_tv_elevator.json +++ b/res/text/jubilife_tv_elevator.json @@ -2,7 +2,7 @@ "key": 17471, "messages": [ { - "id": "pl_msg_00000037_00000", + "id": "JubilifeTVElevator_Text_Hello", "en_US": [ "Hello, thank you for taking the time\n", "out of your busy day to visit us.\r", @@ -10,29 +10,29 @@ ] }, { - "id": "pl_msg_00000037_00001", + "id": "JubilifeTVElevator_Text_LookForward", "en_US": "I look forward to serving you again." }, { - "id": "pl_msg_00000037_00002", + "id": "JubilifeTVElevator_Text_GoingUp", "en_US": [ "Certainly.\n", "Elevator going up.\r" ] }, { - "id": "pl_msg_00000037_00003", + "id": "JubilifeTVElevator_Text_GoingDown", "en_US": [ "Certainly.\n", "Elevator going down.\r" ] }, { - "id": "pl_msg_00000037_00004", + "id": "JubilifeTVElevator_Text_SameFloor", "en_US": "Sorry, we are already on that floor." }, { - "id": "pl_msg_00000037_00005", + "id": "JubilifeTVElevator_Text_HereWeAre", "en_US": "Here we are!" } ] diff --git a/res/text/menu_entries.json b/res/text/menu_entries.json index 60378b10e9..5afb65cc4b 100644 --- a/res/text/menu_entries.json +++ b/res/text/menu_entries.json @@ -490,31 +490,31 @@ "en_US": "EXIT" }, { - "id": "pl_msg_00000361_00116", + "id": "MenuEntries_Text_1F", "en_US": "1F" }, { - "id": "pl_msg_00000361_00117", + "id": "MenuEntries_Text_2F", "en_US": "2F" }, { - "id": "pl_msg_00000361_00118", + "id": "MenuEntries_Text_3F", "en_US": "3F" }, { - "id": "pl_msg_00000361_00119", + "id": "MenuEntries_Text_4F", "en_US": "4F" }, { - "id": "pl_msg_00000361_00120", + "id": "MenuEntries_Text_5F", "en_US": "5F" }, { - "id": "pl_msg_00000361_00121", + "id": "MenuEntries_Text_B1F", "en_US": "B1F" }, { - "id": "pl_msg_00000361_00122", + "id": "MenuEntries_Text_B2F", "en_US": "B2F" }, { @@ -522,7 +522,7 @@ "en_US": "LOOKOUT" }, { - "id": "pl_msg_00000361_00124", + "id": "MenuEntries_Text_ElevatorExit", "en_US": "EXIT" }, { diff --git a/res/text/resort_area_ribbon_syndicate_elevator.json b/res/text/resort_area_ribbon_syndicate_elevator.json index efd2104715..ca2ab58bf8 100644 --- a/res/text/resort_area_ribbon_syndicate_elevator.json +++ b/res/text/resort_area_ribbon_syndicate_elevator.json @@ -2,7 +2,7 @@ "key": 17422, "messages": [ { - "id": "pl_msg_00000601_00000", + "id": "ResortAreaRibbonSyndicateElevator_Text_Hello", "en_US": [ "Hello, thank you for visiting us\n", "today.\r", @@ -10,25 +10,25 @@ ] }, { - "id": "pl_msg_00000601_00001", + "id": "ResortAreaRibbonSyndicateElevator_Text_GoingUp", "en_US": [ "Certainly.\n", "Elevator going up.\r" ] }, { - "id": "pl_msg_00000601_00002", + "id": "ResortAreaRibbonSyndicateElevator_Text_GoingDown", "en_US": [ "Certainly.\n", "Elevator going down.\r" ] }, { - "id": "pl_msg_00000601_00003", + "id": "ResortAreaRibbonSyndicateElevator_Text_SameFloor", "en_US": "Uh... We are already on that floor?" }, { - "id": "pl_msg_00000601_00004", + "id": "ResortAreaRibbonSyndicateElevator_Text_HereWeAre", "en_US": "Here we are!" } ] diff --git a/res/text/veilstone_store_elevator.json b/res/text/veilstone_store_elevator.json index d7d72c157d..5e1209de89 100644 --- a/res/text/veilstone_store_elevator.json +++ b/res/text/veilstone_store_elevator.json @@ -2,7 +2,7 @@ "key": 9223, "messages": [ { - "id": "pl_msg_00000153_00000", + "id": "VeilstoneStoreElevator_Text_Hello", "en_US": [ "Hello, thank you for shopping\n", "with us today.\r", @@ -10,64 +10,64 @@ ] }, { - "id": "pl_msg_00000153_00001", + "id": "VeilstoneStoreElevator_Text_LookForward", "en_US": "I look forward to serving you again." }, { - "id": "pl_msg_00000153_00002", + "id": "VeilstoneStoreElevator_Text_GoingUp", "en_US": [ "Certainly.\n", "Elevator going up.\r" ] }, { - "id": "pl_msg_00000153_00003", + "id": "VeilstoneStoreElevator_Text_GoingDown", "en_US": [ "Certainly.\n", "Elevator going down.\r" ] }, { - "id": "pl_msg_00000153_00004", + "id": "VeilstoneStoreElevator_Text_SameFloor", "en_US": "We are already on that floor?!" }, { - "id": "pl_msg_00000153_00005", + "id": "VeilstoneStoreElevator_Text_Floor1", "en_US": [ "Ground floor: Medicine and items for\n", "all your adventure needs." ] }, { - "id": "pl_msg_00000153_00006", + "id": "VeilstoneStoreElevator_Text_Floor2", "en_US": [ "Second floor: Useful items for all\n", "Pokémon battles." ] }, { - "id": "pl_msg_00000153_00007", + "id": "VeilstoneStoreElevator_Text_Floor3", "en_US": [ "Third floor: Technical Machines for\n", "powering up Pokémon." ] }, { - "id": "pl_msg_00000153_00008", + "id": "VeilstoneStoreElevator_Text_Floor4", "en_US": [ "Fourth floor: Desirable decoration\n", "goods and Pokémon Dolls." ] }, { - "id": "pl_msg_00000153_00009", + "id": "VeilstoneStoreElevator_Text_Floor5", "en_US": [ "Fifth floor: The Rooftop Square for\n", "a refreshing break from shopping." ] }, { - "id": "pl_msg_00000153_00010", + "id": "VeilstoneStoreElevator_Text_FloorB1", "en_US": [ "Basement floor: Food and produce, with\n", "many exclusives for you to enjoy.\n" diff --git a/src/meson.build b/src/meson.build index fbfa3c3cb4..69abcd73f3 100644 --- a/src/meson.build +++ b/src/meson.build @@ -469,7 +469,7 @@ pokeplatinum_c = files( 'overlay006/special_dates.c', 'overlay006/repel_step_update.c', 'overlay006/ov6_02246C24.c', - 'overlay006/ov6_02246F00.c', + 'overlay006/elevator_animation.c', 'overlay006/ov6_02247078.c', 'overlay006/ov6_02247100.c', 'overlay006/trophy_garden_daily_encounters.c', diff --git a/src/overlay006/elevator_animation.c b/src/overlay006/elevator_animation.c new file mode 100644 index 0000000000..628bcde3ee --- /dev/null +++ b/src/overlay006/elevator_animation.c @@ -0,0 +1,114 @@ +#include "overlay006/elevator_animation.h" + +#include +#include + +#include "constants/elevator_dirs.h" +#include "constants/field/map_prop.h" + +#include "field/field_system.h" +#include "overlay005/area_data.h" +#include "overlay005/map_prop.h" +#include "overlay005/map_prop_animation.h" + +#include "field_task.h" +#include "heap.h" +#include "sound_playback.h" +#include "terrain_collision_manager.h" + +#define ELEVATOR_ANIMATION_TAG 0x1 + +#define ELEVATOR_ANIMATION_STATE_LOAD 0 +#define ELEVATOR_ANIMATION_STATE_PLAY_WITH_SOUND 1 +#define ELEVATOR_ANIMATION_STATE_WAIT_FOR_ANIMATION 2 +#define ELEVATOR_ANIMATION_STATE_WAIT_FOR_END_SOUND 3 +#define ELEVATOR_ANIMATION_STATE_CLEAN_UP 4 + +typedef struct ElevatorAnimation { + u8 loopCount; + u8 direction; + u8 state; + u8 unused; +} ElevatorAnimation; + +static BOOL FieldTask_PlayElevatorAnimation(FieldTask *fieldSystem); + +void FieldSystem_PlayElevatorAnimation(FieldSystem *fieldSystem, const u8 elevatorDir, const u8 animationLoopCount) +{ + BOOL mapPropLoaded = FieldSystem_FindLoadedMapPropByModelID(fieldSystem, MAP_PROP_MODEL_ELEVATOR_LIGHTS, NULL, NULL); + + if (mapPropLoaded) { + ElevatorAnimation *animation = Heap_AllocAtEnd(HEAP_ID_FIELD1, sizeof(ElevatorAnimation)); + + animation->loopCount = animationLoopCount; + animation->direction = elevatorDir; + animation->state = 0; + + FieldTask_InitCall(fieldSystem->task, FieldTask_PlayElevatorAnimation, animation); + } else { + GF_ASSERT(FALSE); + } +} + +static BOOL FieldTask_PlayElevatorAnimation(FieldTask *fieldTask) +{ + FieldSystem *fieldSystem = FieldTask_GetFieldSystem(fieldTask); + ElevatorAnimation *animation = (ElevatorAnimation *)FieldTask_GetEnv(fieldTask); + + switch (animation->state) { + case ELEVATOR_ANIMATION_STATE_LOAD: { + NNSG3dResMdl *model; + NNSG3dResFileHeader **modelFile; + MapProp *mapProp; + NNSG3dRenderObj *renderObj; + BOOL mapPropLoaded; + + modelFile = AreaDataManager_GetMapPropModelFile(MAP_PROP_MODEL_ELEVATOR_LIGHTS, fieldSystem->areaDataManager); + model = NNS_G3dGetMdlByIdx(NNS_G3dGetMdlSet(*modelFile), 0); + + mapPropLoaded = FieldSystem_FindLoadedMapPropByModelID(fieldSystem, MAP_PROP_MODEL_ELEVATOR_LIGHTS, &mapProp, NULL); + GF_ASSERT(mapPropLoaded); + renderObj = MapProp_GetRenderObj(mapProp); + + MapPropOneShotAnimationManager_LoadPropAnimations(fieldSystem->mapPropAnimMan, fieldSystem->mapPropOneShotAnimMan, ELEVATOR_ANIMATION_TAG, MAP_PROP_MODEL_ELEVATOR_LIGHTS, renderObj, model, AreaDataManager_GetMapPropTexture(fieldSystem->areaDataManager), 2, animation->loopCount, 0); + } + (animation->state)++; + break; + case ELEVATOR_ANIMATION_STATE_PLAY_WITH_SOUND: + GF_ASSERT((animation->direction == ELEVATOR_DIR_UP) || (animation->direction == ELEVATOR_DIR_DOWN)); + + MapPropOneShotAnimationManager_PlayAnimation(fieldSystem->mapPropOneShotAnimMan, ELEVATOR_ANIMATION_TAG, animation->direction); + + if (animation->direction == ELEVATOR_DIR_UP) { + Sound_PlayEffect(SEQ_SE_DP_ELEBETA2); + } else { + Sound_PlayEffect(SEQ_SE_DP_ELEBETA2); + } + + (animation->state)++; + break; + case ELEVATOR_ANIMATION_STATE_WAIT_FOR_ANIMATION: + if (MapPropOneShotAnimationManager_IsAnimationLoopFinished(fieldSystem->mapPropOneShotAnimMan, ELEVATOR_ANIMATION_TAG)) { + if (animation->direction == ELEVATOR_DIR_UP) { + Sound_StopEffect(SEQ_SE_DP_ELEBETA2, 0); + } else { + Sound_StopEffect(SEQ_SE_DP_ELEBETA2, 0); + } + + Sound_PlayEffect(SEQ_SE_DP_PINPON); + MapPropOneShotAnimationManager_UnloadAnimation(fieldSystem->mapPropAnimMan, fieldSystem->mapPropOneShotAnimMan, ELEVATOR_ANIMATION_TAG); + (animation->state)++; + } + break; + case ELEVATOR_ANIMATION_STATE_WAIT_FOR_END_SOUND: + if (!Sound_IsEffectPlaying(SEQ_SE_DP_PINPON)) { + (animation->state)++; + } + break; + case ELEVATOR_ANIMATION_STATE_CLEAN_UP: + Heap_Free(animation); + return TRUE; + } + + return FALSE; +} diff --git a/src/overlay006/ov6_02246F00.c b/src/overlay006/ov6_02246F00.c deleted file mode 100644 index 7ef940005b..0000000000 --- a/src/overlay006/ov6_02246F00.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "overlay006/ov6_02246F00.h" - -#include -#include - -#include "constants/field/map_prop.h" - -#include "field/field_system.h" -#include "overlay005/area_data.h" -#include "overlay005/map_prop.h" -#include "overlay005/map_prop_animation.h" - -#include "field_task.h" -#include "heap.h" -#include "sound_playback.h" -#include "terrain_collision_manager.h" - -typedef struct { - u8 unk_00; - u8 unk_01; - u8 unk_02; - u8 unk_03; -} UnkStruct_ov6_02246F00; - -static BOOL ov6_02246F40(FieldTask *param0); - -void ov6_02246F00(FieldSystem *fieldSystem, const u8 param1, const u8 param2) -{ - BOOL v0 = FieldSystem_FindLoadedMapPropByModelID(fieldSystem, MAP_PROP_MODEL_ELEVATOR_LIGHTS, NULL, NULL); - - if (v0) { - UnkStruct_ov6_02246F00 *v1 = Heap_AllocAtEnd(HEAP_ID_FIELD1, sizeof(UnkStruct_ov6_02246F00)); - - v1->unk_00 = param2; - v1->unk_01 = param1; - v1->unk_02 = 0; - - FieldTask_InitCall(fieldSystem->task, ov6_02246F40, v1); - } else { - GF_ASSERT(FALSE); - } -} - -static BOOL ov6_02246F40(FieldTask *param0) -{ - FieldSystem *fieldSystem = FieldTask_GetFieldSystem(param0); - UnkStruct_ov6_02246F00 *v1 = (UnkStruct_ov6_02246F00 *)FieldTask_GetEnv(param0); - - switch (v1->unk_02) { - case 0: { - NNSG3dResMdl *v2; - NNSG3dResFileHeader **v3; - MapProp *v4; - NNSG3dRenderObj *v5; - BOOL v6; - - v3 = AreaDataManager_GetMapPropModelFile(MAP_PROP_MODEL_ELEVATOR_LIGHTS, fieldSystem->areaDataManager); - v2 = NNS_G3dGetMdlByIdx(NNS_G3dGetMdlSet(*v3), 0); - - v6 = FieldSystem_FindLoadedMapPropByModelID(fieldSystem, MAP_PROP_MODEL_ELEVATOR_LIGHTS, &v4, NULL); - GF_ASSERT(v6); - v5 = MapProp_GetRenderObj(v4); - - MapPropOneShotAnimationManager_LoadPropAnimations(fieldSystem->mapPropAnimMan, fieldSystem->mapPropOneShotAnimMan, 0x1, MAP_PROP_MODEL_ELEVATOR_LIGHTS, v5, v2, AreaDataManager_GetMapPropTexture(fieldSystem->areaDataManager), 2, v1->unk_00, 0); - } - (v1->unk_02)++; - break; - case 1: - GF_ASSERT((v1->unk_01 == 0) || (v1->unk_01 == 1)); - - MapPropOneShotAnimationManager_PlayAnimation(fieldSystem->mapPropOneShotAnimMan, 0x1, v1->unk_01); - - if (v1->unk_01 == 0) { - Sound_PlayEffect(SEQ_SE_DP_ELEBETA2); - } else { - Sound_PlayEffect(SEQ_SE_DP_ELEBETA2); - } - - (v1->unk_02)++; - break; - case 2: - if (MapPropOneShotAnimationManager_IsAnimationLoopFinished(fieldSystem->mapPropOneShotAnimMan, 0x1)) { - if (v1->unk_01 == 0) { - Sound_StopEffect(1554, 0); - } else { - Sound_StopEffect(1554, 0); - } - - Sound_PlayEffect(SEQ_SE_DP_PINPON); - MapPropOneShotAnimationManager_UnloadAnimation(fieldSystem->mapPropAnimMan, fieldSystem->mapPropOneShotAnimMan, 0x1); - (v1->unk_02)++; - } - break; - case 3: - if (!Sound_IsEffectPlaying(1521)) { - (v1->unk_02)++; - } - break; - case 4: - Heap_Free(v1); - return 1; - } - - return 0; -} diff --git a/src/scrcmd.c b/src/scrcmd.c index e0308c4b44..8e2d608f58 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -73,13 +73,13 @@ #include "overlay005/signpost.h" #include "overlay005/size_contest.h" #include "overlay005/vs_seeker.h" +#include "overlay006/elevator_animation.h" #include "overlay006/hm_cut_in.h" #include "overlay006/npc_trade.h" #include "overlay006/ov6_0223E140.h" #include "overlay006/ov6_02242AF0.h" #include "overlay006/ov6_02243004.h" #include "overlay006/ov6_02246C24.h" -#include "overlay006/ov6_02246F00.h" #include "overlay006/ov6_02247078.h" #include "overlay006/ov6_02247830.h" #include "overlay006/ov6_02247D30.h" @@ -437,7 +437,7 @@ static BOOL ScrCmd_Unused_0F4(ScriptContext *ctx); static BOOL ScrCmd_Unused_0F5(ScriptContext *ctx); static BOOL ScrCmd_StartLinkBattle(ScriptContext *ctx); static BOOL ScrCmd_Unused_0F7(ScriptContext *ctx); -static BOOL ScrCmd_11B(ScriptContext *ctx); +static BOOL ScrCmd_SetSpecialLocation(ScriptContext *ctx); static BOOL ScrCmd_GetFloorsAbove(ScriptContext *ctx); static BOOL ScrCmd_ShowCurrentFloor(ScriptContext *ctx); static BOOL ScrCmd_GetLocalDexSeenCount(ScriptContext *ctx); @@ -622,7 +622,7 @@ static BOOL ScrCmd_GetDayOfWeek(ScriptContext *ctx); static BOOL ScrCmd_239(ScriptContext *ctx); static BOOL ScrCmd_GetSpeciesFootprintType(ScriptContext *ctx); static BOOL ScrCmd_23B(ScriptContext *ctx); -static BOOL ScrCmd_23C(ScriptContext *ctx); +static BOOL ScrCmd_PlayElevatorAnimation(ScriptContext *ctx); static BOOL ScrCmd_PlayBoatCutscene(ScriptContext *ctx); static BOOL ScrCmd_243(ScriptContext *ctx); static BOOL ScrCmd_244(ScriptContext *ctx); @@ -1054,7 +1054,7 @@ const ScrCmdFunc Unk_020EAC58[] = { ScrCmd_118, ScrCmd_CheckPartyPokerus, ScrCmd_11A, - ScrCmd_11B, + ScrCmd_SetSpecialLocation, ScrCmd_GetFloorsAbove, ScrCmd_ShowCurrentFloor, ScrCmd_GetLocalDexSeenCount, @@ -1343,7 +1343,7 @@ const ScrCmdFunc Unk_020EAC58[] = { ScrCmd_239, ScrCmd_GetSpeciesFootprintType, ScrCmd_23B, - ScrCmd_23C, + ScrCmd_PlayElevatorAnimation, ScrCmd_PlayBoatCutscene, ScrCmd_MysteryGiftGive, ScrCmd_Dummy23F, @@ -1610,7 +1610,7 @@ const ScrCmdFunc Unk_020EAC58[] = { ScrCmd_344, ScrCmd_345, ScrCmd_346, - ScrCmd_347, + ScrCmd_BufferFloorNumber, }; const u32 Unk_020EAB80 = NELEMS(Unk_020EAC58); @@ -4747,7 +4747,7 @@ static BOOL ScrCmd_Unused_0F7(ScriptContext *ctx) return TRUE; } -static BOOL ScrCmd_11B(ScriptContext *ctx) +static BOOL ScrCmd_SetSpecialLocation(ScriptContext *ctx) { Location location; @@ -6395,12 +6395,12 @@ static BOOL ScrCmd_23B(ScriptContext *ctx) return TRUE; } -static BOOL ScrCmd_23C(ScriptContext *ctx) +static BOOL ScrCmd_PlayElevatorAnimation(ScriptContext *ctx) { - u16 v0 = ScriptContext_GetVar(ctx); - u16 v1 = ScriptContext_GetVar(ctx); + u16 elevatorDir = ScriptContext_GetVar(ctx); + u16 animationLoopCount = ScriptContext_GetVar(ctx); - ov6_02246F00(ctx->fieldSystem, (u8)v0, (u8)v1); + FieldSystem_PlayElevatorAnimation(ctx->fieldSystem, (u8)elevatorDir, (u8)animationLoopCount); return TRUE; } @@ -7431,7 +7431,7 @@ static BOOL ScrCmd_2C4(ScriptContext *ctx) *v0 = v2; - if ((v1 == ((((((0 + 1) + 1) + 1) + 1) + 1) + 0)) || (v1 == ((((((0 + 1) + 1) + 1) + 1) + 1) + 1))) { + if (v1 == 5 || v1 == 6) { v2->unk_00 = ctx->fieldSystem->unk_AC; } else { v2->unk_00 = NULL; diff --git a/src/string_template.c b/src/string_template.c index d643209930..c4de7ec0a0 100644 --- a/src/string_template.c +++ b/src/string_template.c @@ -616,10 +616,10 @@ void StringTemplate_SetDepartmentStoreFloor(StringTemplate *template, u32 idx, u GF_ASSERT(floor <= 5); if (loader) { - if (floor == pl_msg_00000361_00000) { - floor = pl_msg_00000361_00121; + if (floor == 0) { + floor = MenuEntries_Text_B1F; } else { - floor += pl_msg_00000361_00115; + floor += MenuEntries_Text_1F - 1; } MessageLoader_GetStrbuf(loader, floor, template->templateBuf); diff --git a/src/unk_020474B8.c b/src/unk_020474B8.c index 2dd458ea02..a302c23506 100644 --- a/src/unk_020474B8.c +++ b/src/unk_020474B8.c @@ -592,13 +592,13 @@ BOOL ScrCmd_346(ScriptContext *param0) return 0; } -BOOL ScrCmd_347(ScriptContext *param0) +BOOL ScrCmd_BufferFloorNumber(ScriptContext *ctx) { - FieldSystem *fieldSystem = param0->fieldSystem; - StringTemplate **v1 = FieldSystem_GetScriptMemberPtr(fieldSystem, SCRIPT_MANAGER_STR_TEMPLATE); - u8 v2 = ScriptContext_ReadByte(param0); - u8 v3 = ScriptContext_ReadByte(param0); + FieldSystem *fieldSystem = ctx->fieldSystem; + StringTemplate **stringTemplate = FieldSystem_GetScriptMemberPtr(fieldSystem, SCRIPT_MANAGER_STR_TEMPLATE); + u8 templateArg = ScriptContext_ReadByte(ctx); + u8 floor = ScriptContext_ReadByte(ctx); - StringTemplate_SetDepartmentStoreFloor(*v1, v2, v3); - return 0; + StringTemplate_SetDepartmentStoreFloor(*stringTemplate, templateArg, floor); + return FALSE; }