From 32614659cdc89bfb4b63a21eb17c115e1e4d3c92 Mon Sep 17 00:00:00 2001 From: VicSevenT Date: Sun, 12 Apr 2026 13:55:03 -0500 Subject: [PATCH] Document Lake Guardian Containment Units (#1078) --- asm/macros/scrcmd.inc | 8 +- include/data/scripts/scrcmd.h | 4 +- .../lake_guardian_containment_units.h | 9 +++ include/overlay006/ov6_02247F5C.h | 9 --- platinum.us/main.lsf | 2 +- .../props/model_sets/prop_model_set_054.json | 2 +- .../props/model_sets/prop_model_set_064.json | 2 +- ...d => lake_guardian_containment_unit.nsbmd} | Bin res/field/props/models/map_prop_models.order | 2 +- res/field/props/models/meson.build | 2 +- .../scripts_galactic_hq_control_room.s | 4 +- src/meson.build | 2 +- .../lake_guardian_containment_units.c | 69 +++++++++++++++++ src/overlay006/ov6_02247F5C.c | 70 ------------------ src/scrcmd.c | 14 ++-- 15 files changed, 99 insertions(+), 100 deletions(-) create mode 100644 include/overlay006/lake_guardian_containment_units.h delete mode 100644 include/overlay006/ov6_02247F5C.h rename res/field/props/models/{prop_model_496.nsbmd => lake_guardian_containment_unit.nsbmd} (100%) create mode 100644 src/overlay006/lake_guardian_containment_units.c delete mode 100644 src/overlay006/ov6_02247F5C.c diff --git a/asm/macros/scrcmd.inc b/asm/macros/scrcmd.inc index b6189b81ad..8c44d627df 100644 --- a/asm/macros/scrcmd.inc +++ b/asm/macros/scrcmd.inc @@ -3629,12 +3629,12 @@ .short \destVarID .endm - .macro ScrCmd_25E - .short SCRCMD_25E + .macro InitLakeGuardianContainmentUnits + .short SCRCMD_INITLAKEGUARDIANCONTAINMENTUNITS .endm - .macro ScrCmd_25F - .short SCRCMD_25F + .macro DeactivateLakeGuardianContainmentUnits + .short SCRCMD_DEACTIVATELAKEGUARDIANCONTAINMENTUNITS .endm .macro IncrementTrainerScore2 scoreID diff --git a/include/data/scripts/scrcmd.h b/include/data/scripts/scrcmd.h index 9f878136ba..f3f6e3950e 100644 --- a/include/data/scripts/scrcmd.h +++ b/include/data/scripts/scrcmd.h @@ -611,8 +611,8 @@ ScriptCommand(SCRCMD_PLAYHALLOFFAMEHEALINGANIMATION, ScrCm ScriptCommand(SCRCMD_INITPERSISTEDMAPFEATURESFORPLATFORMLIFT, ScrCmd_InitPersistedMapFeaturesForPlatformLift) ScriptCommand(SCRCMD_TRIGGERPLATFORMLIFT, ScrCmd_TriggerPlatformLift) ScriptCommand(SCRCMD_CHECKPLATFORMLIFTNOTUSEDWHENENTEREDMAP, ScrCmd_CheckPlatformLiftNotUsedWhenEnteredMap) -ScriptCommand(SCRCMD_25E, ScrCmd_25E) -ScriptCommand(SCRCMD_25F, ScrCmd_25F) +ScriptCommand(SCRCMD_INITLAKEGUARDIANCONTAINMENTUNITS, ScrCmd_InitLakeGuardianContainmentUnits) +ScriptCommand(SCRCMD_DEACTIVATELAKEGUARDIANCONTAINMENTUNITS, ScrCmd_DeactivateLakeGuardianContainmentUnits) ScriptCommand(SCRCMD_INCREMENTTRAINERSCORE2, ScrCmd_IncrementTrainerScore2) ScriptCommand(SCRCMD_BUFFERACCESSORYNAME, ScrCmd_BufferAccessoryName) ScriptCommand(SCRCMD_CHECKPARTYHASSPECIES2, ScrCmd_CheckPartyHasSpecies2) diff --git a/include/overlay006/lake_guardian_containment_units.h b/include/overlay006/lake_guardian_containment_units.h new file mode 100644 index 0000000000..025c0d3ac4 --- /dev/null +++ b/include/overlay006/lake_guardian_containment_units.h @@ -0,0 +1,9 @@ +#ifndef POKEPLATINUM_LAKE_GUARDIAN_CONTAINMENT_UNITS_H +#define POKEPLATINUM_LAKE_GUARDIAN_CONTAINMENT_UNITS_H + +#include "field/field_system_decl.h" + +void LakeGuardianContainmentUnit_InitAnimations(FieldSystem *fieldSystem); +void LakeGuardianContainmentUnit_Deactivate(FieldSystem *fieldSystem); + +#endif // POKEPLATINUM_LAKE_GUARDIAN_CONTAINMENT_UNITS_H diff --git a/include/overlay006/ov6_02247F5C.h b/include/overlay006/ov6_02247F5C.h deleted file mode 100644 index dad6898a7d..0000000000 --- a/include/overlay006/ov6_02247F5C.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef POKEPLATINUM_OV6_02247F5C_H -#define POKEPLATINUM_OV6_02247F5C_H - -#include "field/field_system_decl.h" - -void ov6_02247F5C(FieldSystem *fieldSystem); -void ov6_02247FBC(FieldSystem *fieldSystem); - -#endif // POKEPLATINUM_OV6_02247F5C_H diff --git a/platinum.us/main.lsf b/platinum.us/main.lsf index 5d06c52302..04a331d1c0 100644 --- a/platinum.us/main.lsf +++ b/platinum.us/main.lsf @@ -586,7 +586,7 @@ Overlay overlay6 Object main.nef.p/src_overlay006_ov6_02247830.c.o Object main.nef.p/src_overlay006_link_contest_record_display.c.o Object main.nef.p/src_overlay006_healing_machine_animation_hall_of_fame.c.o - Object main.nef.p/src_overlay006_ov6_02247F5C.c.o + Object main.nef.p/src_overlay006_lake_guardian_containment_units.c.o Object main.nef.p/src_overlay006_ov6_02248050.c.o Object main.nef.p/src_overlay006_ov6_02248948.c.o Object main.nef.p/src_overlay006_ov6_022489E4.c.o diff --git a/res/field/props/model_sets/prop_model_set_054.json b/res/field/props/model_sets/prop_model_set_054.json index bb217b036c..44fe78f90b 100644 --- a/res/field/props/model_sets/prop_model_set_054.json +++ b/res/field/props/model_sets/prop_model_set_054.json @@ -100,7 +100,7 @@ "prop_model_250_nsbmd", "prop_model_135_nsbmd", "prop_model_495_nsbmd", - "prop_model_496_nsbmd", + "lake_guardian_containment_unit_nsbmd", "prop_model_497_nsbmd", "prop_model_314_nsbmd", "prop_model_073_nsbmd", diff --git a/res/field/props/model_sets/prop_model_set_064.json b/res/field/props/model_sets/prop_model_set_064.json index 2fb15ba16c..e90c74218f 100644 --- a/res/field/props/model_sets/prop_model_set_064.json +++ b/res/field/props/model_sets/prop_model_set_064.json @@ -100,7 +100,7 @@ "prop_model_250_nsbmd", "prop_model_135_nsbmd", "prop_model_495_nsbmd", - "prop_model_496_nsbmd", + "lake_guardian_containment_unit_nsbmd", "prop_model_497_nsbmd", "prop_model_314_nsbmd", "prop_model_073_nsbmd" diff --git a/res/field/props/models/prop_model_496.nsbmd b/res/field/props/models/lake_guardian_containment_unit.nsbmd similarity index 100% rename from res/field/props/models/prop_model_496.nsbmd rename to res/field/props/models/lake_guardian_containment_unit.nsbmd diff --git a/res/field/props/models/map_prop_models.order b/res/field/props/models/map_prop_models.order index 369704dcc1..a28eba6a5e 100644 --- a/res/field/props/models/map_prop_models.order +++ b/res/field/props/models/map_prop_models.order @@ -494,7 +494,7 @@ prop_model_492.nsbmd prop_model_493.nsbmd prop_model_494.nsbmd prop_model_495.nsbmd -prop_model_496.nsbmd +lake_guardian_containment_unit.nsbmd prop_model_497.nsbmd elevator_lights.nsbmd prop_model_499.nsbmd diff --git a/res/field/props/models/meson.build b/res/field/props/models/meson.build index 7950c5c2cd..e77a5e2a3d 100644 --- a/res/field/props/models/meson.build +++ b/res/field/props/models/meson.build @@ -495,7 +495,7 @@ map_prop_model_files = copy_gen.process(files( 'prop_model_493.nsbmd', 'prop_model_494.nsbmd', 'prop_model_495.nsbmd', - 'prop_model_496.nsbmd', + 'lake_guardian_containment_unit.nsbmd', 'prop_model_497.nsbmd', 'elevator_lights.nsbmd', 'prop_model_499.nsbmd', diff --git a/res/field/scripts/scripts_galactic_hq_control_room.s b/res/field/scripts/scripts_galactic_hq_control_room.s index cb245bf42d..973de7b7db 100644 --- a/res/field/scripts/scripts_galactic_hq_control_room.s +++ b/res/field/scripts/scripts_galactic_hq_control_room.s @@ -29,7 +29,7 @@ GalacticHQControlRoom_SetSaturnPositionEastOfButton: End GalacticHQControlRoom_OnResume: - ScrCmd_25E + InitLakeGuardianContainmentUnits End GalacticHQControlRoom_Saturn: @@ -188,7 +188,7 @@ GalacticHQControlRoom_FreePokemon: CloseMessage ClearFlag FLAG_HIDE_MT_CORONET_1F_NORTH_ROOM_1_GRUNT_F SetFlag FLAG_FREED_GALACTIC_HQ_POKEMON - ScrCmd_25F + DeactivateLakeGuardianContainmentUnits WaitTime 30, VAR_RESULT ApplyMovement LOCALID_MESPRIT, GalacticHQControlRoom_Movement_MespritMoveSouth ApplyMovement LOCALID_AZELF, GalacticHQControlRoom_Movement_AzelfMoveSouth diff --git a/src/meson.build b/src/meson.build index 0b74a4dc7a..3320e48010 100644 --- a/src/meson.build +++ b/src/meson.build @@ -474,7 +474,7 @@ pokeplatinum_c = files( 'overlay006/ov6_02247830.c', 'overlay006/link_contest_record_display.c', 'overlay006/healing_machine_animation/hall_of_fame.c', - 'overlay006/ov6_02247F5C.c', + 'overlay006/lake_guardian_containment_units.c', 'overlay006/ov6_02248050.c', 'overlay006/ov6_02248948.c', 'overlay006/ov6_022489E4.c', diff --git a/src/overlay006/lake_guardian_containment_units.c b/src/overlay006/lake_guardian_containment_units.c new file mode 100644 index 0000000000..5638ee31e2 --- /dev/null +++ b/src/overlay006/lake_guardian_containment_units.c @@ -0,0 +1,69 @@ +#include "overlay006/lake_guardian_containment_units.h" + +#include + +#include "field/field_system.h" +#include "overlay005/map_prop_animation.h" + +#include "field_task.h" +#include "system_flags.h" +#include "vars_flags.h" + +#include "res/field/props/models/prop_models.naix" + +static BOOL Task_DeactivateContainmentUnits(FieldTask *task); + +void LakeGuardianContainmentUnit_InitAnimations(FieldSystem *fieldSystem) +{ + MapPropAnimation *propAnim; + if (!SystemFlag_CheckFreedGalacticHQPokemon(SaveData_GetVarsFlags(fieldSystem->saveData))) { + propAnim = MapPropAnimationManager_GetAnimation(lake_guardian_containment_unit_nsbmd, 1, fieldSystem->mapPropAnimMan); + MapPropAnimation_SetLoopCount(propAnim, 1); + MapPropAnimation_SetAnimationPaused(propAnim, TRUE); + } else { + propAnim = MapPropAnimationManager_GetAnimation(lake_guardian_containment_unit_nsbmd, 0, fieldSystem->mapPropAnimMan); + MapPropAnimation_SetAnimationPaused(propAnim, TRUE); + + propAnim = MapPropAnimationManager_GetAnimation(lake_guardian_containment_unit_nsbmd, 1, fieldSystem->mapPropAnimMan); + MapPropAnimation_GoToLastFrame(propAnim); + MapPropAnimation_SetAnimationPaused(propAnim, TRUE); + } +} + +void LakeGuardianContainmentUnit_Deactivate(FieldSystem *fieldSystem) +{ + FieldTask_InitCall(fieldSystem->task, Task_DeactivateContainmentUnits, NULL); +} + +static BOOL Task_DeactivateContainmentUnits(FieldTask *task) +{ + MapPropAnimation *propAnim; + FieldSystem *fieldSystem = FieldTask_GetFieldSystem(task); + + int *state = FieldTask_GetState(task); + + switch (*state) { + case 0: + propAnim = MapPropAnimationManager_GetAnimation(lake_guardian_containment_unit_nsbmd, 0, fieldSystem->mapPropAnimMan); + + if (MapPropAnimation_IsOnLastFrame(propAnim)) { + MapPropAnimation_SetAnimationPaused(propAnim, TRUE); + (*state)++; + } + break; + case 1: + propAnim = MapPropAnimationManager_GetAnimation(lake_guardian_containment_unit_nsbmd, 1, fieldSystem->mapPropAnimMan); + MapPropAnimation_SetAnimationPaused(propAnim, FALSE); + (*state)++; + break; + case 2: + propAnim = MapPropAnimationManager_GetAnimation(lake_guardian_containment_unit_nsbmd, 1, fieldSystem->mapPropAnimMan); + + if (MapPropAnimation_IsLoopFinished(propAnim)) { + return TRUE; + } + break; + } + + return FALSE; +} diff --git a/src/overlay006/ov6_02247F5C.c b/src/overlay006/ov6_02247F5C.c deleted file mode 100644 index daf02a2d12..0000000000 --- a/src/overlay006/ov6_02247F5C.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "overlay006/ov6_02247F5C.h" - -#include -#include - -#include "field/field_system.h" -#include "overlay005/map_prop_animation.h" - -#include "field_task.h" -#include "system_flags.h" -#include "vars_flags.h" - -static BOOL ov6_02247FD0(FieldTask *param0); - -void ov6_02247F5C(FieldSystem *fieldSystem) -{ - MapPropAnimation *v0; - - if (!SystemFlag_CheckFreedGalacticHQPokemon(SaveData_GetVarsFlags(fieldSystem->saveData))) { - v0 = MapPropAnimationManager_GetAnimation(496, 1, fieldSystem->mapPropAnimMan); - MapPropAnimation_SetLoopCount(v0, 1); - MapPropAnimation_SetAnimationPaused(v0, 1); - } else { - v0 = MapPropAnimationManager_GetAnimation(496, 0, fieldSystem->mapPropAnimMan); - MapPropAnimation_SetAnimationPaused(v0, 1); - - v0 = MapPropAnimationManager_GetAnimation(496, 1, fieldSystem->mapPropAnimMan); - MapPropAnimation_GoToLastFrame(v0); - MapPropAnimation_SetAnimationPaused(v0, 1); - } -} - -void ov6_02247FBC(FieldSystem *fieldSystem) -{ - FieldTask_InitCall(fieldSystem->task, ov6_02247FD0, NULL); -} - -static BOOL ov6_02247FD0(FieldTask *param0) -{ - int *v0; - MapPropAnimation *v1; - FieldSystem *fieldSystem = FieldTask_GetFieldSystem(param0); - - v0 = FieldTask_GetState(param0); - - switch (*v0) { - case 0: - v1 = MapPropAnimationManager_GetAnimation(496, 0, fieldSystem->mapPropAnimMan); - - if (MapPropAnimation_IsOnLastFrame(v1)) { - MapPropAnimation_SetAnimationPaused(v1, 1); - (*v0)++; - } - break; - case 1: - v1 = MapPropAnimationManager_GetAnimation(496, 1, fieldSystem->mapPropAnimMan); - MapPropAnimation_SetAnimationPaused(v1, 0); - (*v0)++; - break; - case 2: - v1 = MapPropAnimationManager_GetAnimation(496, 1, fieldSystem->mapPropAnimMan); - - if (MapPropAnimation_IsLoopFinished(v1)) { - return 1; - } - break; - } - - return 0; -} diff --git a/src/scrcmd.c b/src/scrcmd.c index 9fccc949a4..9cc3c8ce7e 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -71,11 +71,11 @@ #include "overlay006/great_marsh_tram.h" #include "overlay006/healing_machine_animation.h" #include "overlay006/hm_cut_in.h" +#include "overlay006/lake_guardian_containment_units.h" #include "overlay006/npc_trade.h" #include "overlay006/ov6_0223E140.h" #include "overlay006/ov6_02243004.h" #include "overlay006/ov6_02247830.h" -#include "overlay006/ov6_02247F5C.h" #include "overlay006/ov6_02248948.h" #include "overlay006/pc_animation.h" #include "overlay006/swarm.h" @@ -631,8 +631,8 @@ static BOOL ScrCmd_PlayHallOfFameHealingAnimation(ScriptContext *ctx); static BOOL ScrCmd_InitPersistedMapFeaturesForPlatformLift(ScriptContext *ctx); static BOOL ScrCmd_TriggerPlatformLift(ScriptContext *ctx); static BOOL ScrCmd_CheckPlatformLiftNotUsedWhenEnteredMap(ScriptContext *ctx); -static BOOL ScrCmd_25E(ScriptContext *ctx); -static BOOL ScrCmd_25F(ScriptContext *ctx); +static BOOL ScrCmd_InitLakeGuardianContainmentUnits(ScriptContext *ctx); +static BOOL ScrCmd_DeactivateLakeGuardianContainmentUnits(ScriptContext *ctx); static BOOL ScrCmd_IncrementTrainerScore2(ScriptContext *ctx); static BOOL ScrCmd_CheckPartyHasSpecies2(ScriptContext *ctx); static BOOL ScrCmd_ChangeDeoxysForm(ScriptContext *ctx); @@ -5723,15 +5723,15 @@ static BOOL ScrCmd_CheckPlatformLiftNotUsedWhenEnteredMap(ScriptContext *ctx) return FALSE; } -static BOOL ScrCmd_25E(ScriptContext *ctx) +static BOOL ScrCmd_InitLakeGuardianContainmentUnits(ScriptContext *ctx) { - ov6_02247F5C(ctx->fieldSystem); + LakeGuardianContainmentUnit_InitAnimations(ctx->fieldSystem); return FALSE; } -static BOOL ScrCmd_25F(ScriptContext *ctx) +static BOOL ScrCmd_DeactivateLakeGuardianContainmentUnits(ScriptContext *ctx) { - ov6_02247FBC(ctx->fieldSystem); + LakeGuardianContainmentUnit_Deactivate(ctx->fieldSystem); return TRUE; }