From 9d1c33cc1ba7041bb4e110e899ed2f35b99735dd Mon Sep 17 00:00:00 2001 From: Kuruyia Date: Tue, 27 Jan 2026 00:12:25 +0100 Subject: [PATCH] Document distortion world map object events This continues documentation of the distortion world overlay by documenting the map object event system. In distortion world maps, all map object events are hard-coded (with the notable exception of the portal in 1F). This documents all static data that defines the objects present on each map. The standard object event structure is used and augmented to allow for conditional spawning of objects (using flag conditions), and object sprite rotation (only used for that one Cynthia trying out a 90deg platform). This also documents functions related to map object management. Signed-off-by: Kuruyia --- asm/macros/scrcmd.inc | 8 +- include/overlay009/ov9_02249960.h | 4 +- .../scripts/scripts_distortion_world_1f.s | 4 +- .../scripts/scripts_distortion_world_b1f.s | 6 +- .../scripts/scripts_distortion_world_b3f.s | 4 +- .../scripts/scripts_distortion_world_b6f.s | 6 +- .../scripts/scripts_distortion_world_b7f.s | 2 +- .../scripts_distortion_world_giratina_room.s | 14 +- src/overlay009/ov9_02249960.c | 2437 ++++++++--------- src/scrcmd.c | 20 +- 10 files changed, 1240 insertions(+), 1265 deletions(-) diff --git a/asm/macros/scrcmd.inc b/asm/macros/scrcmd.inc index 065afd4922..ec9b1c2bf2 100644 --- a/asm/macros/scrcmd.inc +++ b/asm/macros/scrcmd.inc @@ -4660,14 +4660,14 @@ .short 784 .endm - .macro ScrCmd_311 arg0 + .macro AddDistortionWorldMapObject mapObjLocalID .short 785 - .short \arg0 + .short \mapObjLocalID .endm - .macro ScrCmd_312 arg0 + .macro DeleteDistortionWorldMapObject mapObjLocalID .short 786 - .short \arg0 + .short \mapObjLocalID .endm .macro CheckHeapMemory assertUnchangedFreeMemory diff --git a/include/overlay009/ov9_02249960.h b/include/overlay009/ov9_02249960.h index 4a544b8b86..1c8da9be1e 100644 --- a/include/overlay009/ov9_02249960.h +++ b/include/overlay009/ov9_02249960.h @@ -59,8 +59,8 @@ void ov9_0224CA50(FieldSystem *fieldSystem); void ov9_0224CA5C(FieldSystem *fieldSystem); void DistWorld_StartGiratinaShadowEvent(FieldSystem *fieldSystem, u16 eventIndex); void DistWorld_FinishGiratinaShadowEvent(FieldSystem *fieldSystem); -void ov9_0224F158(FieldSystem *fieldSystem, u16 param1); -void ov9_0224F16C(FieldSystem *fieldSystem, u16 param1); +void DistWorld_AddMapObjectWithLocalID(FieldSystem *fieldSystem, u16 mapObjLocalID); +void DistWorld_DeleteMapObjectWithLocalID(FieldSystem *fieldSystem, u16 mapObjLocalID); BOOL ov9_0224F240(const MapObject *param0, int param1); BOOL ov9_0224F2B0(const MapObject *param0); UnkStruct_ov9_0224F6EC *ov9_0224F2BC(FieldSystem *fieldSystem, FieldTask *param1, MapObject *param2); diff --git a/res/field/scripts/scripts_distortion_world_1f.s b/res/field/scripts/scripts_distortion_world_1f.s index 31651cb14e..b53b4fc6ce 100644 --- a/res/field/scripts/scripts_distortion_world_1f.s +++ b/res/field/scripts/scripts_distortion_world_1f.s @@ -42,7 +42,7 @@ _0070: WaitMovement ApplyMovement LOCALID_PLAYER, _014C WaitMovement - ScrCmd_311 128 + AddDistortionWorldMapObject 128 ApplyMovement 128, _017C WaitMovement Message 0 @@ -74,7 +74,7 @@ _0070: CloseMessage ApplyMovement 128, _01CC WaitMovement - ScrCmd_312 128 + DeleteDistortionWorldMapObject 128 SetVar VAR_DISTORTION_WORLD_PROGRESS, 1 ReleaseAll End diff --git a/res/field/scripts/scripts_distortion_world_b1f.s b/res/field/scripts/scripts_distortion_world_b1f.s index 1bf14d9d06..d259a19d44 100644 --- a/res/field/scripts/scripts_distortion_world_b1f.s +++ b/res/field/scripts/scripts_distortion_world_b1f.s @@ -21,7 +21,7 @@ _0012: ApplyMovement 128, _00B4 ApplyMovement LOCALID_PLAYER, _0080 WaitMovement - ScrCmd_312 128 + DeleteDistortionWorldMapObject 128 SetVar VAR_DISTORTION_WORLD_PROGRESS, 3 ReleaseAll End @@ -32,11 +32,11 @@ _004B: Message 1 CloseMessage WaitCry - ScrCmd_311 129 + AddDistortionWorldMapObject 129 ApplyMovement LOCALID_PLAYER, _0090 ApplyMovement 129, _00D8 WaitMovement - ScrCmd_312 129 + DeleteDistortionWorldMapObject 129 ReleaseAll End diff --git a/res/field/scripts/scripts_distortion_world_b3f.s b/res/field/scripts/scripts_distortion_world_b3f.s index fa35fa7c48..e8b73ddbb6 100644 --- a/res/field/scripts/scripts_distortion_world_b3f.s +++ b/res/field/scripts/scripts_distortion_world_b3f.s @@ -12,7 +12,7 @@ _000A: _000E: LockAll - ScrCmd_311 128 + AddDistortionWorldMapObject 128 ApplyMovement 128, _0060 WaitMovement Message 0 @@ -29,7 +29,7 @@ _003E: CloseMessage ApplyMovement 128, _0068 WaitMovement - ScrCmd_312 128 + DeleteDistortionWorldMapObject 128 SetVar VAR_DISTORTION_WORLD_PROGRESS, 6 ReleaseAll End diff --git a/res/field/scripts/scripts_distortion_world_b6f.s b/res/field/scripts/scripts_distortion_world_b6f.s index b3f2d2fd9a..5f55b16be7 100644 --- a/res/field/scripts/scripts_distortion_world_b6f.s +++ b/res/field/scripts/scripts_distortion_world_b6f.s @@ -49,7 +49,7 @@ _0093: WaitCry ApplyMovement 131, _0130 WaitMovement - ScrCmd_312 131 + DeleteDistortionWorldMapObject 131 ReleaseAll End @@ -61,7 +61,7 @@ _00B4: WaitCry ApplyMovement 132, _0130 WaitMovement - ScrCmd_312 132 + DeleteDistortionWorldMapObject 132 ReleaseAll End @@ -73,7 +73,7 @@ _00D5: WaitCry ApplyMovement 133, _0130 WaitMovement - ScrCmd_312 133 + DeleteDistortionWorldMapObject 133 ReleaseAll End diff --git a/res/field/scripts/scripts_distortion_world_b7f.s b/res/field/scripts/scripts_distortion_world_b7f.s index 467b330f72..32529519c4 100644 --- a/res/field/scripts/scripts_distortion_world_b7f.s +++ b/res/field/scripts/scripts_distortion_world_b7f.s @@ -71,7 +71,7 @@ _00EE: ApplyMovement 129, _0314 ApplyMovement 128, _02DC WaitMovement - ScrCmd_312 129 + DeleteDistortionWorldMapObject 129 ApplyMovement 128, _02BC WaitMovement GetPlayerMapPos VAR_0x8004, VAR_0x8005 diff --git a/res/field/scripts/scripts_distortion_world_giratina_room.s b/res/field/scripts/scripts_distortion_world_giratina_room.s index 601795678e..75dffcd02b 100644 --- a/res/field/scripts/scripts_distortion_world_giratina_room.s +++ b/res/field/scripts/scripts_distortion_world_giratina_room.s @@ -76,8 +76,8 @@ _00C4: GoToIfEq VAR_RESULT, BATTLE_RESULT_PLAYER_FLED, _014E GoToIfEq VAR_RESULT, BATTLE_RESULT_ENEMY_FLED, _014E GoToIfEq VAR_RESULT, BATTLE_RESULT_CAPTURED_MON, _016E - ScrCmd_311 130 - ScrCmd_311 129 + AddDistortionWorldMapObject 130 + AddDistortionWorldMapObject 129 ApplyMovement 129, _0250 WaitMovement Message 3 @@ -86,8 +86,8 @@ _00C4: GoTo _0194 _014E: - ScrCmd_311 130 - ScrCmd_311 129 + AddDistortionWorldMapObject 130 + AddDistortionWorldMapObject 129 ApplyMovement 129, _0250 WaitMovement Message 3 @@ -99,8 +99,8 @@ _016E: SetFlag FLAG_CAUGHT_GIRATINA SetFlag FLAG_HIDE_TURNBACK_CAVE_GIRATINA_ROOM_GIRATINA ClearFlag FLAG_UNK_0x0278 - ScrCmd_311 130 - ScrCmd_311 129 + AddDistortionWorldMapObject 130 + AddDistortionWorldMapObject 129 ApplyMovement 129, _0250 WaitMovement Message 3 @@ -122,7 +122,7 @@ _0194: CloseMessage ApplyMovement 130, _0274 WaitMovement - ScrCmd_312 130 + DeleteDistortionWorldMapObject 130 ApplyFreeCameraMovement _0288 WaitMovement RestoreCamera diff --git a/src/overlay009/ov9_02249960.c b/src/overlay009/ov9_02249960.c index df898c534e..90fa711c97 100644 --- a/src/overlay009/ov9_02249960.c +++ b/src/overlay009/ov9_02249960.c @@ -11,6 +11,7 @@ #include "constants/types.h" #include "generated/map_headers.h" #include "generated/movement_actions.h" +#include "generated/movement_types.h" #include "generated/sdat.h" #include "struct_decls/struct_0205E884_decl.h" @@ -114,6 +115,9 @@ #define RUNNING_EVENT_DATA_BUFFER_SIZE 160 +#define MAP_OBJECT_MANAGER_OBJECT_COUNT 19 +#define MAP_OBJECT_BASE_LOCAL_ID 128 + enum FloatingPlatformKind { FLOATING_PLATFORM_KIND_FLOOR = 0, FLOATING_PLATFORM_KIND_WEST_WALL, @@ -198,7 +202,8 @@ enum FlagCondition { FLAG_COND_WORLD_PROGRESS_EQ, FLAG_COND_WORLD_PROGRESS_LEQ, FLAG_COND_WORLD_PROGRESS_GEQ, - FLAG_COND_GIRATINA_SHADOW = 7, + FLAG_COND_MANUAL_ADD_ONLY, + FLAG_COND_GIRATINA_SHADOW, FLAG_COND_CYRUS_APPEARANCE, }; @@ -261,6 +266,82 @@ enum EventCmdHandlerResult { EVENT_CMD_HANDLER_RES_FINISH, }; +enum MapObjectEvent1FLocalID { + MAP_OBJECT_1F_CYNTHIA_PORTAL = MAP_OBJECT_BASE_LOCAL_ID, + MAP_OBJECT_1F_CYNTHIA_ELEVATOR, +}; + +enum MapObjectEventB1FLocalID { + MAP_OBJECT_B1F_CYNTHIA_ELEVATOR = MAP_OBJECT_BASE_LOCAL_ID, + MAP_OBJECT_B1F_MESPRIT, +}; + +enum MapObjectEventB2FLocalID { + MAP_OBJECT_B2F_CYNTHIA_1 = MAP_OBJECT_BASE_LOCAL_ID, + MAP_OBJECT_B2F_CYNTHIA_2 = MAP_OBJECT_B2F_CYNTHIA_1, +}; + +enum MapObjectEventB3FLocalID { + MAP_OBJECT_B3F_CYRUS = MAP_OBJECT_BASE_LOCAL_ID, +}; + +enum MapObjectEventB4FLocalID { + MAP_OBJECT_B4F_CYRUS = MAP_OBJECT_BASE_LOCAL_ID + 6, +}; + +enum MapObjectEventB5FLocalID { + MAP_OBJECT_B5F_MESPRIT_BOULDER = MAP_OBJECT_BASE_LOCAL_ID, + MAP_OBJECT_B5F_AZELF_BOULDER, + MAP_OBJECT_B5F_UXIE_BOULDER, + MAP_OBJECT_B5F_UXIE, + MAP_OBJECT_B5F_AZELF, + MAP_OBJECT_B5F_MESPRIT, +}; + +enum MapObjectEventB6FLocalID { + MAP_OBJECT_B6F_MESPRIT_BOULDER_OUTSIDE = MAP_OBJECT_BASE_LOCAL_ID, + MAP_OBJECT_B6F_AZELF_BOULDER_OUTSIDE, + MAP_OBJECT_B6F_UXIE_BOULDER_OUTSIDE, + MAP_OBJECT_B6F_MESPRIT, + MAP_OBJECT_B6F_UXIE, + MAP_OBJECT_B6F_AZELF, + MAP_OBJECT_B6F_CYNTHIA, + MAP_OBJECT_B6F_CYNTHIA_ELEVATOR = MAP_OBJECT_B6F_CYNTHIA, + MAP_OBJECT_B6F_MESPRIT_BOULDER_PIT_TEXT_1, + MAP_OBJECT_B6F_MESPRIT_BOULDER_PIT_TEXT_2, + MAP_OBJECT_B6F_MESPRIT_BOULDER_PIT_TEXT_3, + MAP_OBJECT_B6F_UXIE_BOULDER_PIT_TEXT_1, + MAP_OBJECT_B6F_UXIE_BOULDER_PIT_TEXT_2, + MAP_OBJECT_B6F_UXIE_BOULDER_PIT_TEXT_3, + MAP_OBJECT_B6F_AZELF_BOULDER_PIT_TEXT_1, + MAP_OBJECT_B6F_AZELF_BOULDER_PIT_TEXT_2, + MAP_OBJECT_B6F_AZELF_BOULDER_PIT_TEXT_3, + MAP_OBJECT_B6F_MESPRIT_BOULDER_IN_PIT, + MAP_OBJECT_B6F_AZELF_BOULDER_IN_PIT, + MAP_OBJECT_B6F_UXIE_BOULDER_IN_PIT, +}; + +enum MapObjectEventB7FLocalID { + MAP_OBJECT_B7F_CYNTHIA_INITIAL = MAP_OBJECT_BASE_LOCAL_ID, + MAP_OBJECT_B7F_CYNTHIA_TALKING = MAP_OBJECT_B7F_CYNTHIA_INITIAL, + MAP_OBJECT_B7F_CYNTHIA_POST_BATTLE = MAP_OBJECT_B7F_CYNTHIA_INITIAL, + MAP_OBJECT_B7F_CYRUS_INITIAL, + MAP_OBJECT_B7F_CYRUS_TALKING = MAP_OBJECT_B7F_CYRUS_INITIAL, +}; + +enum MapObjectEventGiratinaRoomLocalID { + MAP_OBJECT_GIRATINA_ROOM_GIRATINA = MAP_OBJECT_BASE_LOCAL_ID, + MAP_OBJECT_GIRATINA_ROOM_CYNTHIA, + MAP_OBJECT_GIRATINA_ROOM_CYRUS, + MAP_OBJECT_GIRATINA_ROOM_PORTAL, + MAP_OBJECT_GIRATINA_ROOM_CYNTHIA_TEXT, +}; + +enum MapObjectEventTurnbackCaveLocalID { + MAP_OBJECT_TURNBACK_CAVE_PORTAL = MAP_OBJECT_BASE_LOCAL_ID, + MAP_OBJECT_TURNBACK_CAVE_GRISEOUS_ORB_ITEM, +}; + typedef struct DistWorldSystem DistWorldSystem; typedef struct DistWorldBounds { @@ -677,22 +758,22 @@ typedef struct DistWorldSimplePropUserData { const DistWorldSimplePropAnimator *animator; } DistWorldSimplePropUserData; -typedef struct { - u16 unk_00; - u16 unk_02; - u16 unk_04; - u16 unk_06; - ObjectEvent unk_08; -} UnkStruct_ov9_0224EF30; +typedef struct DistWorldObjectEvent { + u16 flagCond; + u16 flagCondVal; + u16 rotated; + u16 rotationAngle; + ObjectEvent objEvent; +} DistWorldObjectEvent; -typedef struct { - u32 unk_00; - const UnkStruct_ov9_0224EF30 **unk_04; -} UnkStruct_ov9_02252EB4; +typedef struct DistWorldMapObjectEvents { + u32 mapHeaderID; + const DistWorldObjectEvent **objEvents; +} DistWorldMapObjectEvents; -typedef struct { - MapObject *unk_00[19]; -} UnkStruct_ov9_0224EE40; +typedef struct DistWorldMapObjectManager { + MapObject *mapObjs[MAP_OBJECT_MANAGER_OBJECT_COUNT]; +} DistWorldMapObjectManager; typedef struct { u16 unk_00; @@ -798,7 +879,7 @@ struct DistWorldSystem { DistWorldGhostPropManager inactiveGhostPropMan; DistWorldMovingPlatformPropManager movingPlatformPropMan; DistWorldSimplePropManager simplePropMan; - UnkStruct_ov9_0224EE40 unk_1C64; + DistWorldMapObjectManager mapObjMan; UnkStruct_ov9_0224CA5C unk_1CB0; UnkStruct_ov9_0224CBD8 unk_1CD0; UnkStruct_ov9_0224ADC0 unk_1D00; @@ -1307,17 +1388,17 @@ static void FinishSimplePropAnimatorForMap(DistWorldSystem *system, u32 mapHeade static BOOL HasActiveSimpleProp(DistWorldSystem *system, int propKind); static BOOL HasActiveSimpleProp2(DistWorldSystem *system, u32 propKind); static BOOL HasActiveSimplePropAnim(DistWorldSystem *system, u32 animKind); -static void ov9_0224EE40(DistWorldSystem *param0); -static void ov9_0224EE6C(DistWorldSystem *param0); -static void ov9_0224EE70(DistWorldSystem *param0, MapObject *param1); -static MapObject **ov9_0224EEA0(DistWorldSystem *param0); -static BOOL ov9_0224EF30(DistWorldSystem *param0, const UnkStruct_ov9_0224EF30 *param1, u16 param2); -static BOOL ov9_0224EF64(DistWorldSystem *param0, MapObject **param1, const UnkStruct_ov9_0224EF30 *param2, u32 param3, u16 param4); -static BOOL ov9_0224F048(DistWorldSystem *param0, const UnkStruct_ov9_0224EF30 **param1, u32 param2); -static void ov9_0224F078(DistWorldSystem *param0, u32 param1); -static void ov9_0224F0A4(DistWorldSystem *param0, u32 param1); -static MapObject *ov9_0224F0D4(DistWorldSystem *param0, u32 param1, u16 param2); -static BOOL ov9_0224F1CC(DistWorldSystem *param0, MapObject *param1); +static void AddMapObjectsForCurrentAndNextMap(DistWorldSystem *system); +static void Dummy0224EE6C(DistWorldSystem *system); +static void DeleteMapObject(DistWorldSystem *system, MapObject *mapObj); +static MapObject **FindFreeMapObjectSlot(DistWorldSystem *system); +static BOOL CheckFlagConditionForObjectEvent(DistWorldSystem *system, const DistWorldObjectEvent *objEvent, BOOL isManual); +static BOOL AddMapObjectFromEvent(DistWorldSystem *system, MapObject **mapObj, const DistWorldObjectEvent *objEvent, u32 mapHeaderID, u16 isManual); +static BOOL AddMapObjectsFromIter(DistWorldSystem *system, const DistWorldObjectEvent **objEventsIter, u32 mapHeaderID); +static void AddMapObjectsForMap(DistWorldSystem *system, u32 mapHeaderID); +static void DeleteMapObjectsForMap(DistWorldSystem *system, u32 mapHeaderID); +static MapObject *AddMapObjectWithLocalID(DistWorldSystem *system, u32 mapHeaderID, u16 mapObjLocalID); +static BOOL IsMapObjectManaged(DistWorldSystem *system, MapObject *mapObj); static void ov9_0224F724(DistWorldSystem *param0); static void ov9_0224F760(DistWorldSystem *param0); static void ov9_0224F764(DistWorldSystem *param0); @@ -1363,7 +1444,7 @@ static const DistWorldMapEvents sMapEvents[]; const DistWorldEventCmd Unk_ov9_02251438[]; const DistWorldEventCmd Unk_ov9_022513D8[]; static const DistWorldSimplePropMapTemplates sSimplePropsMapTemplates[]; -const UnkStruct_ov9_02252EB4 Unk_ov9_02252EB4[]; +static const DistWorldMapObjectEvents sMapObjectEvents[]; void DistWorld_DynamicMapFeaturesInit(FieldSystem *fieldSystem) { @@ -1396,7 +1477,7 @@ void DistWorld_DynamicMapFeaturesInit(FieldSystem *fieldSystem) CameraInit(dwSystem); FieldTaskContextNoOp1(dwSystem); ov9_0224A8C0(dwSystem); - ov9_0224EE40(dwSystem); + AddMapObjectsForCurrentAndNextMap(dwSystem); InitSimplePropsForCurrentAndNextMaps(dwSystem); InitAllGhostPropManagers(dwSystem); ResetMovingPlatformManager(dwSystem); @@ -1426,7 +1507,7 @@ void DistWorld_DynamicMapFeaturesFree(FieldSystem *fieldSystem) FinishAllMovingPlatformPropAnimators(v0); FinishAllGhostPropManagers(v0); FinishAllSimplePropAnimators(v0); - ov9_0224EE6C(v0); + Dummy0224EE6C(v0); ov9_0224A9E8(v0); FieldTaskContextNoOp2(v0); CameraFree(v0); @@ -1455,13 +1536,13 @@ static void ov9_02249B04(DistWorldSystem *param0) SetPersistedHiddenGhostPropGroups(param0, 0); FinishSimplePropAnimatorForMap(param0, v1->prevID); FinishMovingPlatformPropAnimatorForMap(param0, v1->prevID); - ov9_0224F0A4(param0, v1->prevID); + DeleteMapObjectsForMap(param0, v1->prevID); ov9_0224BF18(param0, v1->nextID); FreeUnusedPropRenderers(param0); InitInactiveGhostPropManager(param0); InitSimplePropsForMap(param0, v1->nextID); InitMovingPlatformPropsForMap(param0, v1->nextID); - ov9_0224F078(param0, v1->nextID); + AddMapObjectsForMap(param0, v1->nextID); } static void ov9_02249B68(DistWorldSystem *param0) @@ -1475,13 +1556,13 @@ static void ov9_02249B68(DistWorldSystem *param0) SetPersistedHiddenGhostPropGroups(param0, 0); FinishSimplePropAnimatorForMap(param0, v1->nextID); FinishMovingPlatformPropAnimatorForMap(param0, v1->nextID); - ov9_0224F0A4(param0, v1->nextID); + DeleteMapObjectsForMap(param0, v1->nextID); ov9_0224BEB4(param0, v0); FreeUnusedPropRenderers(param0); InitActiveGhostPropManager(param0, TRUE); InitSimplePropsForMap(param0, v0); InitMovingPlatformPropsForMap(param0, v0); - ov9_0224F078(param0, v0); + AddMapObjectsForMap(param0, v0); } static void ov9_02249BD4(DistWorldSystem *param0, u32 param1) @@ -1490,7 +1571,7 @@ static void ov9_02249BD4(DistWorldSystem *param0, u32 param1) SetPersistedHiddenGhostPropGroups(param0, 0); FinishSimplePropAnimatorForMap(param0, param1); FinishMovingPlatformPropAnimatorForMap(param0, param1); - ov9_0224F0A4(param0, param1); + DeleteMapObjectsForMap(param0, param1); FreeUnusedPropRenderers(param0); } @@ -1499,7 +1580,7 @@ static void ov9_02249C08(DistWorldSystem *param0, u32 param1) InitInactiveGhostPropManager(param0); InitSimplePropsForMap(param0, param1); InitMovingPlatformPropsForMap(param0, param1); - ov9_0224F078(param0, param1); + AddMapObjectsForMap(param0, param1); } static void ov9_02249C2C(DistWorldSystem *param0, u32 param1) @@ -1508,7 +1589,7 @@ static void ov9_02249C2C(DistWorldSystem *param0, u32 param1) SetPersistedHiddenGhostPropGroups(param0, 0); FinishSimplePropAnimatorForMap(param0, param1); FinishMovingPlatformPropAnimatorForMap(param0, param1); - ov9_0224F0A4(param0, param1); + DeleteMapObjectsForMap(param0, param1); FreeUnusedPropRenderers(param0); } @@ -1517,7 +1598,7 @@ static void ov9_02249C60(DistWorldSystem *param0, u32 param1) InitActiveGhostPropManager(param0, TRUE); InitSimplePropsForMap(param0, param1); InitMovingPlatformPropsForMap(param0, param1); - ov9_0224F078(param0, param1); + AddMapObjectsForMap(param0, param1); } static void OpenArchives(DistWorldSystem *system) @@ -2035,15 +2116,15 @@ static void ov9_0224A374(UnkStruct_ov9_0224A294 *param0, MapObject *param1, int } } -static void ov9_0224A390(DistWorldSystem *param0, MapObject *param1, int param2) +static void ov9_0224A390(DistWorldSystem *system, MapObject *mapObj, int param2) { int v0 = 0; - UnkStruct_ov9_0224A228 *v1 = ¶m0->unk_188; + UnkStruct_ov9_0224A228 *v1 = &system->unk_188; UnkStruct_ov9_0224A294 *v2 = v1->unk_04; while (v0 < v1->unk_00) { - if ((v2->unk_18 == NULL) && (v2->unk_1C == NULL)) { - ov9_0224A374(v2, param1, param2); + if (v2->unk_18 == NULL && v2->unk_1C == NULL) { + ov9_0224A374(v2, mapObj, param2); return; } @@ -5016,10 +5097,10 @@ static int DistWorldElevatorPlatform_BeginMovement(DistWorldSystem *system, Dist u16 distWorldProgress = SystemVars_GetDistortionWorldProgress(varsFlags); if (mapHeaderID == MAP_HEADER_DISTORTION_WORLD_1F && distWorldProgress == 2) { - elevatorPlatform->passengerMapObj = MapObjMan_LocalMapObjByIndex(system->fieldSystem->mapObjMan, 0x80 + 1); + elevatorPlatform->passengerMapObj = MapObjMan_LocalMapObjByIndex(system->fieldSystem->mapObjMan, MAP_OBJECT_1F_CYNTHIA_ELEVATOR); GF_ASSERT(elevatorPlatform->passengerMapObj != NULL); } else if (mapHeaderID == MAP_HEADER_DISTORTION_WORLD_B6F && distWorldProgress == 7) { - elevatorPlatform->passengerMapObj = MapObjMan_LocalMapObjByIndex(system->fieldSystem->mapObjMan, 0x80 + 6); + elevatorPlatform->passengerMapObj = MapObjMan_LocalMapObjByIndex(system->fieldSystem->mapObjMan, MAP_OBJECT_B6F_CYNTHIA_ELEVATOR); GF_ASSERT(elevatorPlatform->passengerMapObj != NULL); } } else { @@ -5217,9 +5298,9 @@ static int DistWorldElevatorPlatform_ChangeMaps(DistWorldSystem *system, DistWor if (elevatorPlatform->passengerMapObj != NULL) { if (elevatorPlatform->destMapHeaderID == MAP_HEADER_DISTORTION_WORLD_B1F) { - MapObject_SetLocalID(elevatorPlatform->passengerMapObj, 0x80 + 0); + MapObject_SetLocalID(elevatorPlatform->passengerMapObj, MAP_OBJECT_B1F_CYNTHIA_ELEVATOR); } else { - MapObject_SetLocalID(elevatorPlatform->passengerMapObj, 0x80 + 0); + MapObject_SetLocalID(elevatorPlatform->passengerMapObj, MAP_OBJECT_B7F_CYNTHIA_INITIAL); MapObject_SetScript(elevatorPlatform->passengerMapObj, 6); } @@ -5369,7 +5450,7 @@ static int DistWorldElevatorPlatform_CyrusB4FStartAnimation(DistWorldSystem *sys { int cyrusTileX; - MapObject *cyrusMapObj = MapObjMan_LocalMapObjByIndex(system->fieldSystem->mapObjMan, 0x80 + 6); + MapObject *cyrusMapObj = MapObjMan_LocalMapObjByIndex(system->fieldSystem->mapObjMan, MAP_OBJECT_B4F_CYRUS); GF_ASSERT(cyrusMapObj != NULL); cyrusTileX = MapObject_GetX(cyrusMapObj); @@ -5386,9 +5467,9 @@ static int DistWorldElevatorPlatform_CyrusB4FEndAnimation(DistWorldSystem *syste { if (MapObject_HasAnimationEnded(elevatorPlatform->passengerAnimTask) == TRUE) { MapObject_FinishAnimation(elevatorPlatform->passengerAnimTask); - MapObject *cyrusMapObj = MapObjMan_LocalMapObjByIndex(system->fieldSystem->mapObjMan, 0x80 + 6); + MapObject *cyrusMapObj = MapObjMan_LocalMapObjByIndex(system->fieldSystem->mapObjMan, MAP_OBJECT_B4F_CYRUS); - ov9_0224EE70(system, cyrusMapObj); + DeleteMapObject(system, cyrusMapObj); VarsFlags *varsFlags = SaveData_GetVarsFlags(system->fieldSystem->saveData); SystemVars_SetDistortionWorldCyrusApperanceState(varsFlags, 1); @@ -6484,7 +6565,7 @@ static int ov9_0224E860(DistWorldSystem *param0, FieldTask *param1, u16 *param2, { const UnkStruct_ov9_0224E860 *v0 = param3; - ov9_0224F0D4(param0, v0->unk_00, v0->unk_02); + AddMapObjectWithLocalID(param0, v0->unk_00, v0->unk_02); return 2; } @@ -6496,7 +6577,7 @@ static int ov9_0224E870(DistWorldSystem *param0, FieldTask *param1, u16 *param2, { const UnkStruct_ov9_0224E870 *v0 = param3; - ov9_0224F16C(param0->fieldSystem, v0->unk_00); + DistWorld_DeleteMapObjectWithLocalID(param0->fieldSystem, v0->unk_00); return 2; } @@ -6972,266 +7053,250 @@ static const OverworldAnimManagerFuncs sSimplePropAnimFuncs = { DistWorldSimpleProp_AnimRender }; -static void ov9_0224EE40(DistWorldSystem *param0) +static void AddMapObjectsForCurrentAndNextMap(DistWorldSystem *system) { - UnkStruct_ov9_0224EE40 *v0 = ¶m0->unk_1C64; - u32 v1 = DistWorldSystem_GetMapHeaderID(param0); - const DistWorldMapConnections *v2 = GetConnectionsForMap(v1); + DistWorldMapObjectManager *dwMapObjMan = &system->mapObjMan; + u32 mapHeaderID = DistWorldSystem_GetMapHeaderID(system); + const DistWorldMapConnections *mapConnections = GetConnectionsForMap(mapHeaderID); - ov9_0224F078(param0, v1); + AddMapObjectsForMap(system, mapHeaderID); - if (v2->nextID != MAP_HEADER_INVALID) { - ov9_0224F078(param0, v2->nextID); + if (mapConnections->nextID != MAP_HEADER_INVALID) { + AddMapObjectsForMap(system, mapConnections->nextID); } } -static void ov9_0224EE6C(DistWorldSystem *param0) +static void Dummy0224EE6C(DistWorldSystem *system) { return; } -static void ov9_0224EE70(DistWorldSystem *param0, MapObject *param1) +static void DeleteMapObject(DistWorldSystem *system, MapObject *mapObj) { - int v0 = 0; - UnkStruct_ov9_0224EE40 *v1 = ¶m0->unk_1C64; - MapObject **v2 = v1->unk_00; + DistWorldMapObjectManager *dwMapObjMan = &system->mapObjMan; + MapObject **iter = dwMapObjMan->mapObjs; - for (v0 = 0; v0 < 19; v0++, v2++) { - if ((*v2 != NULL) && (*v2 == param1)) { - MapObject_Delete(*v2); - *v2 = NULL; + for (int i = 0; i < MAP_OBJECT_MANAGER_OBJECT_COUNT; i++, iter++) { + if (*iter != NULL && *iter == mapObj) { + MapObject_Delete(*iter); + *iter = NULL; return; } } - GF_ASSERT(0); + GF_ASSERT(FALSE); } -static MapObject **ov9_0224EEA0(DistWorldSystem *param0) +static MapObject **FindFreeMapObjectSlot(DistWorldSystem *system) { - int v0; - UnkStruct_ov9_0224EE40 *v1 = ¶m0->unk_1C64; + int i; + DistWorldMapObjectManager *dwMapObjMan = &system->mapObjMan; - for (v0 = 0; v0 < 19; v0++) { - if (v1->unk_00[v0] == NULL) { - return &v1->unk_00[v0]; + for (i = 0; i < MAP_OBJECT_MANAGER_OBJECT_COUNT; i++) { + if (dwMapObjMan->mapObjs[i] == NULL) { + return &dwMapObjMan->mapObjs[i]; } } - GF_ASSERT(0); + GF_ASSERT(FALSE); return NULL; } -static MapObject *ov9_0224EECC(DistWorldSystem *param0, const ObjectEvent *param1, u32 param2) +static MapObject *FindExistingMapObjectByEvent(DistWorldSystem *system, const ObjectEvent *objEvent, u32 mapHeaderID) { - int v0 = 0; - MapObject *v1; - const MapObjectManager *v2 = param0->fieldSystem->mapObjMan; + int startIdx = 0; + MapObject *mapObj; + const MapObjectManager *mapObjMan = system->fieldSystem->mapObjMan; - while (MapObjectMan_FindObjectWithStatus(v2, &v1, &v0, (1 << 0))) { - if (MapObject_GetMapID(v1) == param2) { - if (MapObject_GetLocalID(v1) == param1->localID) { - GF_ASSERT(param1->graphicsID == MapObject_GetGraphicsID(v1)); - return v1; - } + while (MapObjectMan_FindObjectWithStatus(mapObjMan, &mapObj, &startIdx, MAP_OBJ_STATUS_0)) { + if (MapObject_GetMapID(mapObj) == mapHeaderID && MapObject_GetLocalID(mapObj) == objEvent->localID) { + GF_ASSERT(objEvent->graphicsID == MapObject_GetGraphicsID(mapObj)); + return mapObj; } } return NULL; } -static BOOL ov9_0224EF30(DistWorldSystem *param0, const UnkStruct_ov9_0224EF30 *param1, u16 param2) +static BOOL CheckFlagConditionForObjectEvent(DistWorldSystem *system, const DistWorldObjectEvent *objEvent, BOOL isManual) { - u16 v0 = param1->unk_00; - u16 v1 = param1->unk_02; - VarsFlags *v2 = SaveData_GetVarsFlags(param0->fieldSystem->saveData); + u16 flagCond = objEvent->flagCond; + u16 flagCondVal = objEvent->flagCondVal; + VarsFlags *varsFlags = SaveData_GetVarsFlags(system->fieldSystem->saveData); - if (v0 == 6) { - if (param2 == 0) { - return 0; + if (flagCond == FLAG_COND_MANUAL_ADD_ONLY) { + if (!isManual) { + return FALSE; } - } else if (CheckFlagCondition(param0, v0, v1) == 0) { - return 0; + } else if (!CheckFlagCondition(system, flagCond, flagCondVal)) { + return FALSE; } - return 1; + return TRUE; } -static BOOL ov9_0224EF64(DistWorldSystem *param0, MapObject **param1, const UnkStruct_ov9_0224EF30 *param2, u32 param3, u16 param4) +static BOOL AddMapObjectFromEvent(DistWorldSystem *system, MapObject **mapObj, const DistWorldObjectEvent *objEvent, u32 mapHeaderID, u16 isManual) { - MapObject *v0 = ov9_0224EECC(param0, ¶m2->unk_08, param3); + MapObject *existingMapObj = FindExistingMapObjectByEvent(system, &objEvent->objEvent, mapHeaderID); - if (v0 != NULL) { - if (ov9_0224F1CC(param0, v0) == 1) { - return 0; + if (existingMapObj != NULL) { + if (IsMapObjectManaged(system, existingMapObj) == TRUE) { + return FALSE; } - *param1 = v0; + *mapObj = existingMapObj; } else { - if ((ov9_0224EF30(param0, param2, param4) == 0) || (FieldSystem_CheckFlag(param0->fieldSystem, param2->unk_08.hiddenFlag) != 0)) { - return 0; + if (!CheckFlagConditionForObjectEvent(system, objEvent, isManual) || FieldSystem_CheckFlag(system->fieldSystem, objEvent->objEvent.hiddenFlag)) { + return FALSE; } - *param1 = MapObjectMan_AddMapObjectFromHeader(param0->fieldSystem->mapObjMan, ¶m2->unk_08, param3); - GF_ASSERT((*param1) != NULL); + *mapObj = MapObjectMan_AddMapObjectFromHeader(system->fieldSystem->mapObjMan, &objEvent->objEvent, mapHeaderID); + GF_ASSERT(*mapObj != NULL); } - MapObject_SetHidden(*param1, 1); + MapObject_SetHidden(*mapObj, TRUE); - if (param2->unk_04 == 1) { - ov9_0224A390(param0, *param1, param2->unk_06); + if (objEvent->rotated == TRUE) { + ov9_0224A390(system, *mapObj, objEvent->rotationAngle); } - sub_02062FC4(*param1, 1); - MapObject_SetFlagIsPersistent(*param1, 1); - MapObject_SetHeightCalculationDisabled(*param1, TRUE); - MapObject_SetStatusFlagOn(*param1, MAP_OBJ_STATUS_13); + sub_02062FC4(*mapObj, TRUE); + MapObject_SetFlagIsPersistent(*mapObj, TRUE); + MapObject_SetHeightCalculationDisabled(*mapObj, TRUE); + MapObject_SetStatusFlagOn(*mapObj, MAP_OBJ_STATUS_13); - if (v0 == NULL) { - Billboard *v1; + if (existingMapObj == NULL) { + MapObject_SetPosDirFromCoords(*mapObj, objEvent->objEvent.x, (objEvent->objEvent.y >> 3) / FX32_ONE, objEvent->objEvent.z, objEvent->objEvent.dir); + Billboard *billboard = ov5_021EB1A0(*mapObj); - MapObject_SetPosDirFromCoords(*param1, param2->unk_08.x, (((param2->unk_08.y) >> 3) / FX32_ONE), param2->unk_08.z, param2->unk_08.dir); - - v1 = ov5_021EB1A0(*param1); - - if (v1 != NULL) { - ov5_021EDEB4(*param1, v1); + if (billboard != NULL) { + ov5_021EDEB4(*mapObj, billboard); } - } else { - (void)0; } - MapObject_SetHidden(*param1, 0); - - return 1; + MapObject_SetHidden(*mapObj, FALSE); + return TRUE; } -static BOOL ov9_0224F048(DistWorldSystem *param0, const UnkStruct_ov9_0224EF30 **param1, u32 param2) +static BOOL AddMapObjectsFromIter(DistWorldSystem *system, const DistWorldObjectEvent **objEventsIter, u32 mapHeaderID) { - MapObject **v0; - - while ((*param1) != NULL) { - v0 = ov9_0224EEA0(param0); - ov9_0224EF64(param0, v0, *param1, param2, 0); - param1++; + while (*objEventsIter != NULL) { + MapObject **mapObj = FindFreeMapObjectSlot(system); + AddMapObjectFromEvent(system, mapObj, *objEventsIter, mapHeaderID, FALSE); + objEventsIter++; } - return 0; + return FALSE; } -static void ov9_0224F078(DistWorldSystem *param0, u32 param1) +static void AddMapObjectsForMap(DistWorldSystem *system, u32 mapHeaderID) { - const UnkStruct_ov9_02252EB4 *v0 = Unk_ov9_02252EB4; + const DistWorldMapObjectEvents *iter = sMapObjectEvents; - while (v0->unk_00 != 593) { - if (v0->unk_00 == param1) { - ov9_0224F048(param0, v0->unk_04, param1); + while (iter->mapHeaderID != MAP_HEADER_INVALID) { + if (iter->mapHeaderID == mapHeaderID) { + AddMapObjectsFromIter(system, iter->objEvents, mapHeaderID); return; } - v0++; + iter++; } } -static void ov9_0224F0A4(DistWorldSystem *param0, u32 param1) +static void DeleteMapObjectsForMap(DistWorldSystem *system, u32 mapHeaderID) { - int v0 = 0; - UnkStruct_ov9_0224EE40 *v1 = ¶m0->unk_1C64; - MapObject **v2 = v1->unk_00; + int i; + DistWorldMapObjectManager *dwMapObjMan = &system->mapObjMan; + MapObject **iter = dwMapObjMan->mapObjs; - for (v0 = 0; v0 < 19; v0++, v2++) { - if ((*v2) != NULL) { - if (MapObject_GetMapID(*v2) == param1) { - MapObject_Delete(*v2); - *v2 = NULL; + for (i = 0; i < MAP_OBJECT_MANAGER_OBJECT_COUNT; i++, iter++) { + if (*iter != NULL) { + if (MapObject_GetMapID(*iter) == mapHeaderID) { + MapObject_Delete(*iter); + *iter = NULL; } } } } -static MapObject *ov9_0224F0D4(DistWorldSystem *param0, u32 param1, u16 param2) +static MapObject *AddMapObjectWithLocalID(DistWorldSystem *system, u32 mapHeaderID, u16 mapObjLocalID) { - MapObject **v0 = NULL; - const UnkStruct_ov9_02252EB4 *v1 = Unk_ov9_02252EB4; + MapObject **mapObj = NULL; + const DistWorldMapObjectEvents *mapObjEventsIter = sMapObjectEvents; - while (v1->unk_00 != 593) { - if (v1->unk_00 == param1) { - const UnkStruct_ov9_0224EF30 **v2 = v1->unk_04; + while (mapObjEventsIter->mapHeaderID != MAP_HEADER_INVALID) { + if (mapObjEventsIter->mapHeaderID == mapHeaderID) { + const DistWorldObjectEvent **objEventIter = mapObjEventsIter->objEvents; - while ((*v2) != NULL) { - if ((*v2)->unk_08.localID == param2) { - v0 = ov9_0224EEA0(param0); - ov9_0224EF64(param0, v0, *v2, param1, 1); + while (*objEventIter != NULL) { + if ((*objEventIter)->objEvent.localID == mapObjLocalID) { + mapObj = FindFreeMapObjectSlot(system); + AddMapObjectFromEvent(system, mapObj, *objEventIter, mapHeaderID, TRUE); - if (param1 == 580) { - if ((param2 >= (0x80 + 7)) && (param2 <= (0x80 + 15))) { - sub_02062D80( - *v0, 0); - } + if (mapHeaderID == MAP_HEADER_DISTORTION_WORLD_B6F && mapObjLocalID >= MAP_OBJECT_B6F_MESPRIT_BOULDER_PIT_TEXT_1 && mapObjLocalID <= MAP_OBJECT_B6F_AZELF_BOULDER_PIT_TEXT_3) { + sub_02062D80(*mapObj, FALSE); } - return *v0; + return *mapObj; } - v2++; + objEventIter++; } - GF_ASSERT(0); + GF_ASSERT(FALSE); } - v1++; + mapObjEventsIter++; } - GF_ASSERT(0); + GF_ASSERT(FALSE); return NULL; } -void ov9_0224F158(FieldSystem *fieldSystem, u16 param1) +void DistWorld_AddMapObjectWithLocalID(FieldSystem *fieldSystem, u16 mapObjLocalID) { - u32 v0 = fieldSystem->location->mapId; - DistWorldSystem *v1 = fieldSystem->unk_04->dynamicMapFeaturesData; + u32 mapHeaderID = fieldSystem->location->mapId; + DistWorldSystem *dwSystem = fieldSystem->unk_04->dynamicMapFeaturesData; - ov9_0224F0D4(v1, v0, param1); + AddMapObjectWithLocalID(dwSystem, mapHeaderID, mapObjLocalID); } -void ov9_0224F16C(FieldSystem *fieldSystem, u16 param1) +void DistWorld_DeleteMapObjectWithLocalID(FieldSystem *fieldSystem, u16 mapObjLocalID) { - int v0 = 0; - MapObject *v1; - u32 v2 = fieldSystem->location->mapId; - MapObjectManager *v3 = fieldSystem->mapObjMan; - DistWorldSystem *v4 = fieldSystem->unk_04->dynamicMapFeaturesData; + int startIdx = 0; + MapObject *mapObj; + u32 mapHeaderID = fieldSystem->location->mapId; + MapObjectManager *mapObjMan = fieldSystem->mapObjMan; + DistWorldSystem *dwSystem = fieldSystem->unk_04->dynamicMapFeaturesData; - while (MapObjectMan_FindObjectWithStatus( - v3, &v1, &v0, (1 << 0)) - == 1) { - if ((MapObject_GetLocalID(v1) == param1) && (MapObject_GetMapID(v1) == v2)) { - ov9_0224EE70(v4, v1); + while (MapObjectMan_FindObjectWithStatus(mapObjMan, &mapObj, &startIdx, MAP_OBJ_STATUS_0) == TRUE) { + if (MapObject_GetLocalID(mapObj) == mapObjLocalID && MapObject_GetMapID(mapObj) == mapHeaderID) { + DeleteMapObject(dwSystem, mapObj); return; } } - GF_ASSERT(0); + GF_ASSERT(FALSE); } -static BOOL ov9_0224F1CC(DistWorldSystem *param0, MapObject *param1) +static BOOL IsMapObjectManaged(DistWorldSystem *system, MapObject *mapObj) { - int v0 = 0; - UnkStruct_ov9_0224EE40 *v1 = ¶m0->unk_1C64; - MapObject **v2 = v1->unk_00; + int i = 0; + DistWorldMapObjectManager *dwMapObjMan = &system->mapObjMan; + MapObject **iter = dwMapObjMan->mapObjs; - GF_ASSERT(param1 != NULL); + GF_ASSERT(mapObj != NULL); do { - if ((*v2) == param1) { - return 1; + if (*iter == mapObj) { + return TRUE; } - v2++; - v0++; - } while (v0 < 19); + iter++; + i++; + } while (i < MAP_OBJECT_MANAGER_OBJECT_COUNT); - return 0; + return FALSE; } static const UnkStruct_ov9_0225311C Unk_ov9_0225311C[] = { @@ -7355,15 +7420,15 @@ static BOOL ov9_0224F324(UnkStruct_ov9_0224F6EC *param0) u32 v3, v4; switch (MapObject_GetLocalID(v2)) { - case (0x80 + 0): + case MAP_OBJECT_B6F_MESPRIT_BOULDER_OUTSIDE: v3 = 3; v4 = 0; break; - case (0x80 + 1): + case MAP_OBJECT_B6F_AZELF_BOULDER_OUTSIDE: v3 = 4; v4 = 1; break; - case (0x80 + 2): + case MAP_OBJECT_B6F_UXIE_BOULDER_OUTSIDE: v3 = 5; v4 = 2; break; @@ -7422,16 +7487,16 @@ static BOOL ov9_0224F3BC(UnkStruct_ov9_0224F6EC *param0) ov9_02249DC8(param0->unk_00, param0->unk_14); switch (MapObject_GetLocalID(v6)) { - case (0x80 + 0): - v4 = (0x80 + 16); + case MAP_OBJECT_B6F_MESPRIT_BOULDER_OUTSIDE: + v4 = MAP_OBJECT_B6F_MESPRIT_BOULDER_IN_PIT; v5 = 3; break; - case (0x80 + 1): - v4 = (0x80 + 17); + case MAP_OBJECT_B6F_AZELF_BOULDER_OUTSIDE: + v4 = MAP_OBJECT_B6F_AZELF_BOULDER_IN_PIT; v5 = 4; break; - case (0x80 + 2): - v4 = (0x80 + 18); + case MAP_OBJECT_B6F_UXIE_BOULDER_OUTSIDE: + v4 = MAP_OBJECT_B6F_UXIE_BOULDER_IN_PIT; v5 = 5; break; default: @@ -7601,15 +7666,15 @@ static BOOL ov9_0224F5D8(UnkStruct_ov9_0224F6EC *param0) MapObject *v10 = param0->unk_0C; switch (MapObject_GetLocalID(v10)) { - case (0x80 + 0): + case MAP_OBJECT_B6F_MESPRIT_BOULDER_OUTSIDE: v6 = 0; v7 = 3; break; - case (0x80 + 1): + case MAP_OBJECT_B6F_AZELF_BOULDER_OUTSIDE: v6 = 1; v7 = 4; break; - case (0x80 + 2): + case MAP_OBJECT_B6F_UXIE_BOULDER_OUTSIDE: v6 = 2; v7 = 5; break; @@ -7619,7 +7684,7 @@ static BOOL ov9_0224F5D8(UnkStruct_ov9_0224F6EC *param0) ov9_02249DC8(param0->unk_00, v6); ov9_02249DE4(param0->unk_00, v7); - ov9_0224EE70(param0->unk_00, param0->unk_0C); + DeleteMapObject(param0->unk_00, param0->unk_0C); return 1; } @@ -8690,7 +8755,7 @@ void ov9_02250780(FieldSystem *fieldSystem) static int ov9_022507C4(DistWorldSystem *param0, FieldTask *param1, u16 *param2, const void *param3) { UnkStruct_ov9_0225074C *v0 = ResetLoadedEventDataBuffer(param0, sizeof(UnkStruct_ov9_0225074C)); - v0->unk_18 = ov9_0224F0D4(param0, 582, (0x80 + 0)); + v0->unk_18 = AddMapObjectWithLocalID(param0, 582, MAP_OBJECT_GIRATINA_ROOM_GIRATINA); v0->unk_08.y = ((10 << 4) * FX32_ONE); MapObject_SetSpritePosOffset(v0->unk_18, &v0->unk_08); @@ -8790,7 +8855,7 @@ static const DistWorldEventCmdHandler Unk_ov9_02251490[5] = { static int ov9_02250918(DistWorldSystem *param0, FieldTask *param1, u16 *param2, const void *param3) { UnkStruct_ov9_02250918 *v0 = ResetLoadedEventDataBuffer(param0, sizeof(UnkStruct_ov9_02250918)); - v0->unk_20 = ov9_0224F0D4(param0, 579, (0x80 + 3)); + v0->unk_20 = AddMapObjectWithLocalID(param0, 579, MAP_OBJECT_B5F_UXIE); Sound_PlayPokemonCry(SPECIES_UXIE, 0); @@ -8887,10 +8952,10 @@ static int ov9_02250A90(DistWorldSystem *param0, FieldTask *param1, u16 *param2, MapObject_SetSpritePosOffset(v0->unk_20, &v0->unk_14); if ((((v0->unk_14.y) >> 4) / FX32_ONE) <= 0) { - ov9_0224EE70(param0, v0->unk_20); + DeleteMapObject(param0, v0->unk_20); ov9_02249DC8(param0, 10); ov9_02249DC8(param0, 13); - v0->unk_20 = ov9_0224F0D4(param0, 580, (0x80 + 4)); + v0->unk_20 = AddMapObjectWithLocalID(param0, 580, MAP_OBJECT_B6F_UXIE); return 2; } @@ -8919,7 +8984,7 @@ static const MapObjectAnimCmd Unk_ov9_02251E74[] = { static int ov9_02250AFC(DistWorldSystem *param0, FieldTask *param1, u16 *param2, const void *param3) { UnkStruct_ov9_02250AFC *v0 = ResetLoadedEventDataBuffer(param0, sizeof(UnkStruct_ov9_02250AFC)); - v0->unk_14 = ov9_0224F0D4(param0, 579, (0x80 + 4)); + v0->unk_14 = AddMapObjectWithLocalID(param0, 579, MAP_OBJECT_B5F_AZELF); Sound_PlayPokemonCry(SPECIES_AZELF, 0); @@ -8975,10 +9040,10 @@ static int ov9_02250BAC(DistWorldSystem *param0, FieldTask *param1, u16 *param2, MapObject_SetSpritePosOffset(v0->unk_14, &v0->unk_04); if ((((v0->unk_04.y) >> 4) / FX32_ONE) <= 0) { - ov9_0224EE70(param0, v0->unk_14); + DeleteMapObject(param0, v0->unk_14); ov9_02249DC8(param0, 11); ov9_02249DC8(param0, 14); - v0->unk_14 = ov9_0224F0D4(param0, 580, (0x80 + 5)); + v0->unk_14 = AddMapObjectWithLocalID(param0, 580, MAP_OBJECT_B6F_AZELF); return 2; } @@ -9084,7 +9149,7 @@ static const MapObjectAnimCmd Unk_ov9_02252E64[] = { static int ov9_02250C14(DistWorldSystem *param0, FieldTask *param1, u16 *param2, const void *param3) { UnkStruct_ov9_02250C14 *v0 = ResetLoadedEventDataBuffer(param0, sizeof(UnkStruct_ov9_02250AFC)); - v0->unk_18 = ov9_0224F0D4(param0, 579, (0x80 + 5)); + v0->unk_18 = AddMapObjectWithLocalID(param0, 579, MAP_OBJECT_B5F_MESPRIT); Sound_PlayPokemonCry(SPECIES_MESPRIT, 0); *param2 = 1; @@ -9153,11 +9218,11 @@ static int ov9_02250D10(DistWorldSystem *param0, FieldTask *param1, u16 *param2, MapObject_SetSpritePosOffset(v0->unk_18, &v0->unk_04); if ((((v0->unk_04.y) >> 4) / FX32_ONE) <= 0) { - ov9_0224EE70(param0, v0->unk_18); + DeleteMapObject(param0, v0->unk_18); ov9_02249DC8(param0, 12); ov9_02249DC8(param0, 15); - v0->unk_18 = ov9_0224F0D4( - param0, 580, (0x80 + 3)); + v0->unk_18 = AddMapObjectWithLocalID( + param0, 580, MAP_OBJECT_B6F_MESPRIT); return 2; } @@ -12610,1181 +12675,1091 @@ static const DistWorldSimplePropMapTemplates sSimplePropsMapTemplates[] = { { MAP_HEADER_INVALID, NULL } }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252598 = { - 0x6, - 0x0, - 0x0, - 0x0, - { - 0x80, - 0x8A, - 0x0, - 0x0, - 0x0, - 0x0, - 0x1, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x37, - 0x28, - ((289 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEvent1F_CynthiaPortal = { + .flagCond = FLAG_COND_MANUAL_ADD_ONLY, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_1F_CYNTHIA_PORTAL, + .graphicsID = 0x8A, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_DOWN, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x37, + .z = 0x28, + .y = (289 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022525E8 = { - 0x4, - 0x2, - 0x0, - 0x0, - { - 0x81, - 0x8A, - 0x0, - 0x0, - 0x0, - 0x5, - 0x3, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x27, - 0x34, - ((289 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEvent1F_CynthiaElevator = { + .flagCond = FLAG_COND_WORLD_PROGRESS_LEQ, + .flagCondVal = 0x2, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_1F_CYNTHIA_ELEVATOR, + .graphicsID = 0x8A, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x5, + .dir = FACE_RIGHT, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x27, + .z = 0x34, + .y = (289 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 *Unk_ov9_02253B34[] = { - &Unk_ov9_02252598, - &Unk_ov9_022525E8, +static const DistWorldObjectEvent *sMapObjectEvents1F[] = { + &sMapObjectEvent1F_CynthiaPortal, + &sMapObjectEvent1F_CynthiaElevator, NULL }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252638 = { - 0x6, - 0x0, - 0x0, - 0x0, - { - 0x81, - 0x108, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0xC, - 0x39, - ((257 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB1F_Mesprit = { + .flagCond = FLAG_COND_MANUAL_ADD_ONLY, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B1F_MESPRIT, + .graphicsID = 0x108, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0xC, + .z = 0x39, + .y = (257 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 *Unk_ov9_02253B08[] = { - &Unk_ov9_02252638, +static const DistWorldObjectEvent *sMapObjectEventsB1F[] = { + &sMapObjectEventB1F_Mesprit, NULL }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022526D8 = { - 0x3, - 0x4, - 0x1, - 0x5A, - { - 0x80, - 0x8A, - 0x0, - 0x0, - 0x0, - 0x2, - 0x1, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x1E, - 0x14, - ((233 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB2F_Cynthia1 = { + .flagCond = FLAG_COND_WORLD_PROGRESS_EQ, + .flagCondVal = 0x4, + .rotated = TRUE, + .rotationAngle = 0x5A, + .objEvent = { + .localID = MAP_OBJECT_B2F_CYNTHIA_1, + .graphicsID = 0x8A, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x2, + .dir = FACE_DOWN, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x1E, + .z = 0x14, + .y = (233 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252728 = { - 0x3, - 0x5, - 0x1, - 0x5A, - { - 0x80, - 0x8A, - 0x0, - 0x0, - 0x0, - 0x2, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x1E, - 0x14, - ((232 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB2F_Cynthia2 = { + .flagCond = FLAG_COND_WORLD_PROGRESS_EQ, + .flagCondVal = 0x5, + .rotated = TRUE, + .rotationAngle = 0x5A, + .objEvent = { + .localID = MAP_OBJECT_B2F_CYNTHIA_2, + .graphicsID = 0x8A, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x2, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x1E, + .z = 0x14, + .y = (232 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 *Unk_ov9_02253B58[] = { - &Unk_ov9_022526D8, - &Unk_ov9_02252728, +static const DistWorldObjectEvent *sMapObjectEventsB2F[] = { + &sMapObjectEventB2F_Cynthia1, + &sMapObjectEventB2F_Cynthia2, NULL }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022527A0 = { - 0x6, - 0x0, - 0x0, - 0x0, - { - 0x80, - 0x78, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x41, - 0x31, - ((193 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB3F_Cyrus = { + .flagCond = FLAG_COND_MANUAL_ADD_ONLY, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B3F_CYRUS, + .graphicsID = 0x78, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x41, + .z = 0x31, + .y = (193 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 *Unk_ov9_02253B20[] = { - &Unk_ov9_022527A0, +static const DistWorldObjectEvent *sMapObjectEventsB3F[] = { + &sMapObjectEventB3F_Cyrus, NULL }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022527F0 = { - 0x8, - 0x0, - 0x0, - 0x0, - { - 0x86, - 0x78, - 0x43, - 0x0, - 0x0, - 0x0, - 0x2, - 0x0, - 0x0, - 0x0, - 0x1, - 0x0, - 0x59, - 0x40, - ((161 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB4F_Cyrus = { + .flagCond = FLAG_COND_CYRUS_APPEARANCE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B4F_CYRUS, + .graphicsID = 0x78, + .movementType = MOVEMENT_TYPE_067, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_LEFT, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x1, + .movementRangeZ = 0x0, + .x = 0x59, + .z = 0x40, + .y = (161 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 *Unk_ov9_02253B18[] = { - &Unk_ov9_022527F0, +static const DistWorldObjectEvent *sMapObjectEventsB4F[] = { + &sMapObjectEventB4F_Cyrus, NULL }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252840 = { - 0x2, - 0x0, - 0x0, - 0x0, - { - 0x80, - 0x54, - 0x0, - 0x0, - 0x0, - 0x2712, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x4B, - 0x44, - ((129 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB5F_MespritBoulder = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B5F_MESPRIT_BOULDER, + .graphicsID = 0x54, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x2712, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x4B, + .z = 0x44, + .y = (129 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252890 = { - 0x2, - 0x1, - 0x0, - 0x0, - { - 0x81, - 0x54, - 0x0, - 0x0, - 0x0, - 0x2712, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x62, - 0x43, - ((129 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB5F_AzelfBoulder = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0x1, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B5F_AZELF_BOULDER, + .graphicsID = 0x54, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x2712, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x62, + .z = 0x43, + .y = (129 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022528B8 = { - 0x2, - 0x2, - 0x0, - 0x0, - { - 0x82, - 0x54, - 0x0, - 0x0, - 0x0, - 0x2712, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x56, - 0x38, - ((129 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB5F_UxieBoulder = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0x2, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B5F_UXIE_BOULDER, + .graphicsID = 0x54, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x2712, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x56, + .z = 0x38, + .y = (129 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252908 = { - 0x6, - 0x0, - 0x0, - 0x0, - { - 0x83, - 0x97, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x56, - 0x3A, - (((129 - 16) << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB5F_Uxie = { + .flagCond = FLAG_COND_MANUAL_ADD_ONLY, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B5F_UXIE, + .graphicsID = 0x97, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x56, + .z = 0x3A, + .y = (113 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252958 = { - 0x6, - 0x0, - 0x0, - 0x0, - { - 0x84, - 0x99, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x60, - 0x43, - (((129 - 12) << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB5F_Azelf = { + .flagCond = FLAG_COND_MANUAL_ADD_ONLY, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B5F_AZELF, + .graphicsID = 0x99, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x60, + .z = 0x43, + .y = (117 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022529A8 = { - 0x6, - 0x0, - 0x0, - 0x0, - { - 0x85, - 0x98, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x4D, - 0x44, - (((129 - 8) << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB5F_Mesprit = { + .flagCond = FLAG_COND_MANUAL_ADD_ONLY, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B5F_MESPRIT, + .graphicsID = 0x98, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x4D, + .z = 0x44, + .y = (121 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 *Unk_ov9_02253BC8[] = { - &Unk_ov9_02252840, - &Unk_ov9_02252890, - &Unk_ov9_022528B8, - &Unk_ov9_02252908, - &Unk_ov9_02252958, - &Unk_ov9_022529A8, +static const DistWorldObjectEvent *sMapObjectEventsB5F[] = { + &sMapObjectEventB5F_MespritBoulder, + &sMapObjectEventB5F_AzelfBoulder, + &sMapObjectEventB5F_UxieBoulder, + &sMapObjectEventB5F_Uxie, + &sMapObjectEventB5F_Azelf, + &sMapObjectEventB5F_Mesprit, NULL }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252A20 = { - 0x2, - 0x3, - 0x0, - 0x0, - { - 0x80, - 0x54, - 0x0, - 0x0, - 0x0, - 0x2712, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x4B, - 0x44, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_MespritBoulderOutside = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0x3, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_MESPRIT_BOULDER_OUTSIDE, + .graphicsID = 0x54, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x2712, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x4B, + .z = 0x44, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252A70 = { - 0x2, - 0x4, - 0x0, - 0x0, - { - 0x81, - 0x54, - 0x0, - 0x0, - 0x0, - 0x2712, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x62, - 0x43, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_AzelfBoulderOutside = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0x4, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_AZELF_BOULDER_OUTSIDE, + .graphicsID = 0x54, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x2712, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x62, + .z = 0x43, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252AC0 = { - 0x2, - 0x5, - 0x0, - 0x0, - { - 0x82, - 0x54, - 0x0, - 0x0, - 0x0, - 0x2712, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x56, - 0x38, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_UxieBoulderOutside = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0x5, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_UXIE_BOULDER_OUTSIDE, + .graphicsID = 0x54, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x2712, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x56, + .z = 0x38, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252AE8 = { - 0x2, - 0xF, - 0x0, - 0x0, - { - 0x83, - 0x10A, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x44, - 0x40, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_Mesprit = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0xF, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_MESPRIT, + .graphicsID = 0x10A, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x44, + .z = 0x40, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252B10 = { - 0x2, - 0xD, - 0x0, - 0x0, - { - 0x84, - 0x109, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x52, - 0x3C, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_Uxie = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0xD, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_UXIE, + .graphicsID = 0x109, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x52, + .z = 0x3C, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252B38 = { - 0x2, - 0xE, - 0x0, - 0x0, - { - 0x85, - 0x10B, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x60, - 0x47, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_Azelf = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0xE, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_AZELF, + .graphicsID = 0x10B, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x60, + .z = 0x47, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252480 = { - 0x3, - 0x6, - 0x0, - 0x0, - { - 0x86, - 0x8A, - 0x0, - 0x0, - 0x0, - 0x2, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x55, - 0x50, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_Cynthia = { + .flagCond = FLAG_COND_WORLD_PROGRESS_EQ, + .flagCondVal = 0x6, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_CYNTHIA, + .graphicsID = 0x8A, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x2, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x55, + .z = 0x50, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022524F8 = { - 0x3, - 0x7, - 0x0, - 0x0, - { - 0x86, - 0x8A, - 0x0, - 0x0, - 0x0, - 0x2, - 0x3, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x54, - 0x54, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_CynthiaElevator = { + .flagCond = FLAG_COND_WORLD_PROGRESS_EQ, + .flagCondVal = 0x7, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_CYNTHIA_ELEVATOR, + .graphicsID = 0x8A, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x2, + .dir = FACE_RIGHT, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x54, + .z = 0x54, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252520 = { - 0x0, - 0x0, - 0x0, - 0x0, - { - 0x87, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x8, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x44, - 0x43, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_MespritBoulderPitText1 = { + .flagCond = FLAG_COND_NONE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_MESPRIT_BOULDER_PIT_TEXT_1, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x8, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x44, + .z = 0x43, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252570 = { - 0x0, - 0x0, - 0x0, - 0x0, - { - 0x88, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x8, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x4B, - 0x43, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_MespritBoulderPitText2 = { + .flagCond = FLAG_COND_NONE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_MESPRIT_BOULDER_PIT_TEXT_2, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x8, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x4B, + .z = 0x43, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252610 = { - 0x0, - 0x0, - 0x0, - 0x0, - { - 0x89, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x8, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x4F, - 0x43, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_MespritBoulderPitText3 = { + .flagCond = FLAG_COND_NONE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_MESPRIT_BOULDER_PIT_TEXT_3, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x8, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x4F, + .z = 0x43, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252660 = { - 0x0, - 0x0, - 0x0, - 0x0, - { - 0x8A, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x8, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x55, - 0x34, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_UxieBoulderPitText1 = { + .flagCond = FLAG_COND_NONE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_UXIE_BOULDER_PIT_TEXT_1, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x8, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x55, + .z = 0x34, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252750 = { - 0x0, - 0x0, - 0x0, - 0x0, - { - 0x8B, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x8, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x55, - 0x38, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_UxieBoulderPitText2 = { + .flagCond = FLAG_COND_NONE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_UXIE_BOULDER_PIT_TEXT_2, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x8, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x55, + .z = 0x38, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022527C8 = { - 0x0, - 0x0, - 0x0, - 0x0, - { - 0x8C, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x8, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x55, - 0x3C, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_UxieBoulderPitText3 = { + .flagCond = FLAG_COND_NONE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_UXIE_BOULDER_PIT_TEXT_3, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x8, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x55, + .z = 0x3C, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252818 = { - 0x0, - 0x0, - 0x0, - 0x0, - { - 0x8D, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x8, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x60, - 0x44, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_AzelfBoulderPitText1 = { + .flagCond = FLAG_COND_NONE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_AZELF_BOULDER_PIT_TEXT_1, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x8, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x60, + .z = 0x44, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252868 = { - 0x0, - 0x0, - 0x0, - 0x0, - { - 0x8E, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x8, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x64, - 0x44, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_AzelfBoulderPitText2 = { + .flagCond = FLAG_COND_NONE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_AZELF_BOULDER_PIT_TEXT_2, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x8, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x64, + .z = 0x44, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022528E0 = { - 0x0, - 0x0, - 0x0, - 0x0, - { - 0x8F, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x8, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x69, - 0x44, - ((115 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_AzelfBoulderPitText3 = { + .flagCond = FLAG_COND_NONE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_AZELF_BOULDER_PIT_TEXT_3, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x8, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x69, + .z = 0x44, + .y = (115 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252930 = { - 0x2, - 0x6, - 0x0, - 0x0, - { - 0x90, - 0x54, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x44, - 0x42, - ((113 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_MespritBoulderInPit = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0x6, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_MESPRIT_BOULDER_IN_PIT, + .graphicsID = 0x54, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x44, + .z = 0x42, + .y = (113 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022529D0 = { - 0x2, - 0x7, - 0x0, - 0x0, - { - 0x91, - 0x54, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x60, - 0x45, - ((113 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_AzelfBoulderInPit = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0x7, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_AZELF_BOULDER_IN_PIT, + .graphicsID = 0x54, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x60, + .z = 0x45, + .y = (113 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252A48 = { - 0x2, - 0x8, - 0x0, - 0x0, - { - 0x92, - 0x54, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x54, - 0x3C, - ((113 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB6F_UxieBoulderInPit = { + .flagCond = FLAG_COND_2, + .flagCondVal = 0x8, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B6F_UXIE_BOULDER_IN_PIT, + .graphicsID = 0x54, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x54, + .z = 0x3C, + .y = (113 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 *Unk_ov9_02253C78[] = { - &Unk_ov9_02252A20, - &Unk_ov9_02252A70, - &Unk_ov9_02252AC0, - &Unk_ov9_02252AE8, - &Unk_ov9_02252B10, - &Unk_ov9_02252B38, - &Unk_ov9_02252480, - &Unk_ov9_022524F8, - &Unk_ov9_02252520, - &Unk_ov9_02252570, - &Unk_ov9_02252610, - &Unk_ov9_02252660, - &Unk_ov9_02252750, - &Unk_ov9_022527C8, - &Unk_ov9_02252818, - &Unk_ov9_02252868, - &Unk_ov9_022528E0, - &Unk_ov9_02252930, - &Unk_ov9_022529D0, - &Unk_ov9_02252A48, +static const DistWorldObjectEvent *sMapObjectEventsB6F[] = { + &sMapObjectEventB6F_MespritBoulderOutside, + &sMapObjectEventB6F_AzelfBoulderOutside, + &sMapObjectEventB6F_UxieBoulderOutside, + &sMapObjectEventB6F_Mesprit, + &sMapObjectEventB6F_Uxie, + &sMapObjectEventB6F_Azelf, + &sMapObjectEventB6F_Cynthia, + &sMapObjectEventB6F_CynthiaElevator, + &sMapObjectEventB6F_MespritBoulderPitText1, + &sMapObjectEventB6F_MespritBoulderPitText2, + &sMapObjectEventB6F_MespritBoulderPitText3, + &sMapObjectEventB6F_UxieBoulderPitText1, + &sMapObjectEventB6F_UxieBoulderPitText2, + &sMapObjectEventB6F_UxieBoulderPitText3, + &sMapObjectEventB6F_AzelfBoulderPitText1, + &sMapObjectEventB6F_AzelfBoulderPitText2, + &sMapObjectEventB6F_AzelfBoulderPitText3, + &sMapObjectEventB6F_MespritBoulderInPit, + &sMapObjectEventB6F_AzelfBoulderInPit, + &sMapObjectEventB6F_UxieBoulderInPit, NULL }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252B88 = { - 0x3, - 0x8, - 0x0, - 0x0, - { - 0x80, - 0x8A, - 0x0, - 0x0, - 0x0, - 0x6, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x55, - 0x4A, - ((65 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB7F_CynthiaInitial = { + .flagCond = FLAG_COND_WORLD_PROGRESS_EQ, + .flagCondVal = 0x8, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B7F_CYNTHIA_INITIAL, + .graphicsID = 0x8A, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x6, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x55, + .z = 0x4A, + .y = (65 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022524A8 = { - 0x3, - 0x9, - 0x0, - 0x0, - { - 0x80, - 0x8A, - 0x0, - 0x0, - 0x0, - 0x6, - 0x3, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x54, - 0x4A, - ((65 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB7F_CynthiaTalking = { + .flagCond = FLAG_COND_WORLD_PROGRESS_EQ, + .flagCondVal = 0x9, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B7F_CYNTHIA_TALKING, + .graphicsID = 0x8A, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x6, + .dir = FACE_RIGHT, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x54, + .z = 0x4A, + .y = (65 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022525C0 = { - 0x5, - 0xA, - 0x0, - 0x0, - { - 0x80, - 0x8A, - 0x0, - 0x0, - 0x0, - 0x6, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x59, - 0x45, - ((65 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB7F_CynthiaPostBattle = { + .flagCond = FLAG_COND_WORLD_PROGRESS_GEQ, + .flagCondVal = 0xA, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B7F_CYNTHIA_POST_BATTLE, + .graphicsID = 0x8A, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x6, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x59, + .z = 0x45, + .y = (65 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252688 = { - 0x4, - 0x8, - 0x0, - 0x0, - { - 0x81, - 0x78, - 0x0, - 0x0, - 0x0, - 0x5, - 0x1, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x55, - 0x46, - ((65 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB7F_CyrusInitial = { + .flagCond = FLAG_COND_WORLD_PROGRESS_LEQ, + .flagCondVal = 0x8, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B7F_CYRUS_INITIAL, + .graphicsID = 0x78, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x5, + .dir = FACE_DOWN, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x55, + .z = 0x46, + .y = (65 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252700 = { - 0x3, - 0x9, - 0x0, - 0x0, - { - 0x81, - 0x78, - 0x0, - 0x0, - 0x0, - 0x5, - 0x2, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x55, - 0x4A, - ((65 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventB7F_CyrusTalking = { + .flagCond = FLAG_COND_WORLD_PROGRESS_EQ, + .flagCondVal = 0x9, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_B7F_CYRUS_TALKING, + .graphicsID = 0x78, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x5, + .dir = FACE_LEFT, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x55, + .z = 0x4A, + .y = (65 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 *Unk_ov9_02253B98[] = { - &Unk_ov9_02252B88, - &Unk_ov9_022524A8, - &Unk_ov9_022525C0, - &Unk_ov9_02252688, - &Unk_ov9_02252700, +static const DistWorldObjectEvent *sMapObjectEventsB7F[] = { + &sMapObjectEventB7F_CynthiaInitial, + &sMapObjectEventB7F_CynthiaTalking, + &sMapObjectEventB7F_CynthiaPostBattle, + &sMapObjectEventB7F_CyrusInitial, + &sMapObjectEventB7F_CyrusTalking, NULL }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252980 = { - 0x3, - 0xD, - 0x0, - 0x0, - { - 0x80, - 0xE6, - 0x0, - 0x0, - 0x0, - 0x5, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0xF, - 0xD, - ((1 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventGiratinaRoom_Giratina = { + .flagCond = FLAG_COND_WORLD_PROGRESS_EQ, + .flagCondVal = 0xD, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_GIRATINA_ROOM_GIRATINA, + .graphicsID = 0xE6, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x5, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0xF, + .z = 0xD, + .y = (1 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252A98 = { - 0x6, - 0x0, - 0x0, - 0x0, - { - 0x81, - 0x8A, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0xF, - 0x17, - ((1 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventGiratinaRoom_Cynthia = { + .flagCond = FLAG_COND_MANUAL_ADD_ONLY, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_GIRATINA_ROOM_CYNTHIA, + .graphicsID = 0x8A, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0xF, + .z = 0x17, + .y = (1 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252B60 = { - 0x6, - 0x0, - 0x0, - 0x0, - { - 0x82, - 0x78, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0xF, - 0x17, - ((1 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventGiratinaRoom_Cyrus = { + .flagCond = FLAG_COND_MANUAL_ADD_ONLY, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_GIRATINA_ROOM_CYRUS, + .graphicsID = 0x78, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x0, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0xF, + .z = 0x17, + .y = (1 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022524D0 = { - 0x3, - 0xE, - 0x0, - 0x0, - { - 0x83, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x3, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0xF, - 0xD, - ((1 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventGiratinaRoom_Portal = { + .flagCond = FLAG_COND_WORLD_PROGRESS_EQ, + .flagCondVal = 0xE, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_GIRATINA_ROOM_PORTAL, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x3, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0xF, + .z = 0xD, + .y = (1 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_022526B0 = { - 0x3, - 0xE, - 0x0, - 0x0, - { - 0x84, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x6, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0xF, - 0xF, - ((1 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventGiratinaRoom_CynthiaText = { + .flagCond = FLAG_COND_WORLD_PROGRESS_EQ, + .flagCondVal = 0xE, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_GIRATINA_ROOM_CYNTHIA_TEXT, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x6, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0xF, + .z = 0xF, + .y = (1 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 *Unk_ov9_02253BB0[] = { - &Unk_ov9_02252980, - &Unk_ov9_02252A98, - &Unk_ov9_02252B60, - &Unk_ov9_022524D0, - &Unk_ov9_022526B0, +static const DistWorldObjectEvent *sMapObjectEventsGiratinaRoom[] = { + &sMapObjectEventGiratinaRoom_Giratina, + &sMapObjectEventGiratinaRoom_Cynthia, + &sMapObjectEventGiratinaRoom_Cyrus, + &sMapObjectEventGiratinaRoom_Portal, + &sMapObjectEventGiratinaRoom_CynthiaText, NULL }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252BB0 = { - 0x0, - 0x0, - 0x0, - 0x0, - { - 0x80, - 0x2000, - 0x0, - 0x0, - 0x0, - 0x2, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x74, - 0x4A, - ((65 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventTurnbackCaveRoom_Portal = { + .flagCond = FLAG_COND_NONE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_TURNBACK_CAVE_PORTAL, + .graphicsID = 0x2000, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x0, + .script = 0x2, + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x74, + .z = 0x4A, + .y = (65 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 Unk_ov9_02252778 = { - 0x0, - 0x0, - 0x0, - 0x0, - { - 0x81, - 0x57, - 0x0, - 0x0, - 0x538, - 0x1C99, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x59, - 0x37, - ((65 << 4) * FX32_ONE), +static const DistWorldObjectEvent sMapObjectEventTurnbackCaveRoom_GriseousOrbItem = { + .flagCond = FLAG_COND_NONE, + .flagCondVal = 0x0, + .rotated = FALSE, + .rotationAngle = 0x0, + .objEvent = { + .localID = MAP_OBJECT_TURNBACK_CAVE_GRISEOUS_ORB_ITEM, + .graphicsID = 0x57, + .movementType = MOVEMENT_TYPE_NONE, + .trainerType = 0x0, + .hiddenFlag = 0x538, + .script = SCRIPT_ID(VISIBLE_ITEMS, 321), + .dir = FACE_UP, + .data = { 0x0, 0x0, 0x0 }, + .movementRangeX = 0x0, + .movementRangeZ = 0x0, + .x = 0x59, + .z = 0x37, + .y = (65 << 4) * FX32_ONE, }, }; -static const UnkStruct_ov9_0224EF30 *Unk_ov9_02253B40[] = { - &Unk_ov9_02252BB0, - &Unk_ov9_02252778, +static const DistWorldObjectEvent *sMapObjectEventsTurnbackCaveRoom[] = { + &sMapObjectEventTurnbackCaveRoom_Portal, + &sMapObjectEventTurnbackCaveRoom_GriseousOrbItem, NULL }; -static const UnkStruct_ov9_02252EB4 Unk_ov9_02252EB4[] = { - { 0x23D, Unk_ov9_02253B34 }, - { 0x23E, Unk_ov9_02253B08 }, - { 0x23F, Unk_ov9_02253B58 }, - { 0x240, Unk_ov9_02253B20 }, - { 0x241, Unk_ov9_02253B18 }, - { 0x243, Unk_ov9_02253BC8 }, - { 0x244, Unk_ov9_02253C78 }, - { 0x245, Unk_ov9_02253B98 }, - { 0x246, Unk_ov9_02253BB0 }, - { 0x247, Unk_ov9_02253B40 }, - { 0x251, NULL } +static const DistWorldMapObjectEvents sMapObjectEvents[] = { + { MAP_HEADER_DISTORTION_WORLD_1F, sMapObjectEvents1F }, + { MAP_HEADER_DISTORTION_WORLD_B1F, sMapObjectEventsB1F }, + { MAP_HEADER_DISTORTION_WORLD_B2F, sMapObjectEventsB2F }, + { MAP_HEADER_DISTORTION_WORLD_B3F, sMapObjectEventsB3F }, + { MAP_HEADER_DISTORTION_WORLD_B4F, sMapObjectEventsB4F }, + { MAP_HEADER_DISTORTION_WORLD_B5F, sMapObjectEventsB5F }, + { MAP_HEADER_DISTORTION_WORLD_B6F, sMapObjectEventsB6F }, + { MAP_HEADER_DISTORTION_WORLD_B7F, sMapObjectEventsB7F }, + { MAP_HEADER_DISTORTION_WORLD_GIRATINA_ROOM, sMapObjectEventsGiratinaRoom }, + { MAP_HEADER_DISTORTION_WORLD_TURNBACK_CAVE_ROOM, sMapObjectEventsTurnbackCaveRoom }, + { MAP_HEADER_INVALID, NULL } }; diff --git a/src/scrcmd.c b/src/scrcmd.c index f282bddd60..ecb0ca0738 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -727,8 +727,8 @@ static BOOL ScrCmd_2FB(ScriptContext *ctx); static BOOL ScrCmd_2FC(ScriptContext *ctx); static BOOL ScrCmd_GetRotomFormsInSave(ScriptContext *ctx); static BOOL ScrCmd_IncrementTrainerScore(ScriptContext *ctx); -static BOOL ScrCmd_311(ScriptContext *ctx); -static BOOL ScrCmd_312(ScriptContext *ctx); +static BOOL ScrCmd_AddDistortionWorldMapObject(ScriptContext *ctx); +static BOOL ScrCmd_DeleteDistortionWorldMapObject(ScriptContext *ctx); static BOOL ScrCmd_ResetDistortionWorldPersistedCameraAngles(ScriptContext *ctx); static BOOL ScrCmd_CheckHeapMemory(ScriptContext *ctx); static BOOL ScrCmd_StartGiratinaOriginBattle(ScriptContext *ctx); @@ -1550,8 +1550,8 @@ const ScrCmdFunc Unk_020EAC58[] = { ScrCmd_30E, ScrCmd_30F, ScrCmd_310, - ScrCmd_311, - ScrCmd_312, + ScrCmd_AddDistortionWorldMapObject, + ScrCmd_DeleteDistortionWorldMapObject, ScrCmd_CheckHeapMemory, ScrCmd_GetBattleResult, ScrCmd_315, @@ -7841,21 +7841,21 @@ static BOOL ScrCmd_IncrementTrainerScore(ScriptContext *ctx) return FALSE; } -static BOOL ScrCmd_311(ScriptContext *ctx) +static BOOL ScrCmd_AddDistortionWorldMapObject(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 v1 = ScriptContext_GetVar(ctx); + u16 mapObjLocalID = ScriptContext_GetVar(ctx); - ov9_0224F158(fieldSystem, v1); + DistWorld_AddMapObjectWithLocalID(fieldSystem, mapObjLocalID); return FALSE; } -static BOOL ScrCmd_312(ScriptContext *ctx) +static BOOL ScrCmd_DeleteDistortionWorldMapObject(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 v1 = ScriptContext_GetVar(ctx); + u16 mapObjLocalID = ScriptContext_GetVar(ctx); - ov9_0224F16C(fieldSystem, v1); + DistWorld_DeleteMapObjectWithLocalID(fieldSystem, mapObjLocalID); return FALSE; }