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 <github@kuruyia.net>
This commit is contained in:
Kuruyia 2026-01-27 00:12:25 +01:00
parent 3d24f842f1
commit 9d1c33cc1b
10 changed files with 1240 additions and 1265 deletions

View File

@ -4660,14 +4660,14 @@
.short 784 .short 784
.endm .endm
.macro ScrCmd_311 arg0 .macro AddDistortionWorldMapObject mapObjLocalID
.short 785 .short 785
.short \arg0 .short \mapObjLocalID
.endm .endm
.macro ScrCmd_312 arg0 .macro DeleteDistortionWorldMapObject mapObjLocalID
.short 786 .short 786
.short \arg0 .short \mapObjLocalID
.endm .endm
.macro CheckHeapMemory assertUnchangedFreeMemory .macro CheckHeapMemory assertUnchangedFreeMemory

View File

@ -59,8 +59,8 @@ void ov9_0224CA50(FieldSystem *fieldSystem);
void ov9_0224CA5C(FieldSystem *fieldSystem); void ov9_0224CA5C(FieldSystem *fieldSystem);
void DistWorld_StartGiratinaShadowEvent(FieldSystem *fieldSystem, u16 eventIndex); void DistWorld_StartGiratinaShadowEvent(FieldSystem *fieldSystem, u16 eventIndex);
void DistWorld_FinishGiratinaShadowEvent(FieldSystem *fieldSystem); void DistWorld_FinishGiratinaShadowEvent(FieldSystem *fieldSystem);
void ov9_0224F158(FieldSystem *fieldSystem, u16 param1); void DistWorld_AddMapObjectWithLocalID(FieldSystem *fieldSystem, u16 mapObjLocalID);
void ov9_0224F16C(FieldSystem *fieldSystem, u16 param1); void DistWorld_DeleteMapObjectWithLocalID(FieldSystem *fieldSystem, u16 mapObjLocalID);
BOOL ov9_0224F240(const MapObject *param0, int param1); BOOL ov9_0224F240(const MapObject *param0, int param1);
BOOL ov9_0224F2B0(const MapObject *param0); BOOL ov9_0224F2B0(const MapObject *param0);
UnkStruct_ov9_0224F6EC *ov9_0224F2BC(FieldSystem *fieldSystem, FieldTask *param1, MapObject *param2); UnkStruct_ov9_0224F6EC *ov9_0224F2BC(FieldSystem *fieldSystem, FieldTask *param1, MapObject *param2);

View File

@ -42,7 +42,7 @@ _0070:
WaitMovement WaitMovement
ApplyMovement LOCALID_PLAYER, _014C ApplyMovement LOCALID_PLAYER, _014C
WaitMovement WaitMovement
ScrCmd_311 128 AddDistortionWorldMapObject 128
ApplyMovement 128, _017C ApplyMovement 128, _017C
WaitMovement WaitMovement
Message 0 Message 0
@ -74,7 +74,7 @@ _0070:
CloseMessage CloseMessage
ApplyMovement 128, _01CC ApplyMovement 128, _01CC
WaitMovement WaitMovement
ScrCmd_312 128 DeleteDistortionWorldMapObject 128
SetVar VAR_DISTORTION_WORLD_PROGRESS, 1 SetVar VAR_DISTORTION_WORLD_PROGRESS, 1
ReleaseAll ReleaseAll
End End

View File

@ -21,7 +21,7 @@ _0012:
ApplyMovement 128, _00B4 ApplyMovement 128, _00B4
ApplyMovement LOCALID_PLAYER, _0080 ApplyMovement LOCALID_PLAYER, _0080
WaitMovement WaitMovement
ScrCmd_312 128 DeleteDistortionWorldMapObject 128
SetVar VAR_DISTORTION_WORLD_PROGRESS, 3 SetVar VAR_DISTORTION_WORLD_PROGRESS, 3
ReleaseAll ReleaseAll
End End
@ -32,11 +32,11 @@ _004B:
Message 1 Message 1
CloseMessage CloseMessage
WaitCry WaitCry
ScrCmd_311 129 AddDistortionWorldMapObject 129
ApplyMovement LOCALID_PLAYER, _0090 ApplyMovement LOCALID_PLAYER, _0090
ApplyMovement 129, _00D8 ApplyMovement 129, _00D8
WaitMovement WaitMovement
ScrCmd_312 129 DeleteDistortionWorldMapObject 129
ReleaseAll ReleaseAll
End End

View File

@ -12,7 +12,7 @@ _000A:
_000E: _000E:
LockAll LockAll
ScrCmd_311 128 AddDistortionWorldMapObject 128
ApplyMovement 128, _0060 ApplyMovement 128, _0060
WaitMovement WaitMovement
Message 0 Message 0
@ -29,7 +29,7 @@ _003E:
CloseMessage CloseMessage
ApplyMovement 128, _0068 ApplyMovement 128, _0068
WaitMovement WaitMovement
ScrCmd_312 128 DeleteDistortionWorldMapObject 128
SetVar VAR_DISTORTION_WORLD_PROGRESS, 6 SetVar VAR_DISTORTION_WORLD_PROGRESS, 6
ReleaseAll ReleaseAll
End End

View File

@ -49,7 +49,7 @@ _0093:
WaitCry WaitCry
ApplyMovement 131, _0130 ApplyMovement 131, _0130
WaitMovement WaitMovement
ScrCmd_312 131 DeleteDistortionWorldMapObject 131
ReleaseAll ReleaseAll
End End
@ -61,7 +61,7 @@ _00B4:
WaitCry WaitCry
ApplyMovement 132, _0130 ApplyMovement 132, _0130
WaitMovement WaitMovement
ScrCmd_312 132 DeleteDistortionWorldMapObject 132
ReleaseAll ReleaseAll
End End
@ -73,7 +73,7 @@ _00D5:
WaitCry WaitCry
ApplyMovement 133, _0130 ApplyMovement 133, _0130
WaitMovement WaitMovement
ScrCmd_312 133 DeleteDistortionWorldMapObject 133
ReleaseAll ReleaseAll
End End

View File

@ -71,7 +71,7 @@ _00EE:
ApplyMovement 129, _0314 ApplyMovement 129, _0314
ApplyMovement 128, _02DC ApplyMovement 128, _02DC
WaitMovement WaitMovement
ScrCmd_312 129 DeleteDistortionWorldMapObject 129
ApplyMovement 128, _02BC ApplyMovement 128, _02BC
WaitMovement WaitMovement
GetPlayerMapPos VAR_0x8004, VAR_0x8005 GetPlayerMapPos VAR_0x8004, VAR_0x8005

View File

@ -76,8 +76,8 @@ _00C4:
GoToIfEq VAR_RESULT, BATTLE_RESULT_PLAYER_FLED, _014E GoToIfEq VAR_RESULT, BATTLE_RESULT_PLAYER_FLED, _014E
GoToIfEq VAR_RESULT, BATTLE_RESULT_ENEMY_FLED, _014E GoToIfEq VAR_RESULT, BATTLE_RESULT_ENEMY_FLED, _014E
GoToIfEq VAR_RESULT, BATTLE_RESULT_CAPTURED_MON, _016E GoToIfEq VAR_RESULT, BATTLE_RESULT_CAPTURED_MON, _016E
ScrCmd_311 130 AddDistortionWorldMapObject 130
ScrCmd_311 129 AddDistortionWorldMapObject 129
ApplyMovement 129, _0250 ApplyMovement 129, _0250
WaitMovement WaitMovement
Message 3 Message 3
@ -86,8 +86,8 @@ _00C4:
GoTo _0194 GoTo _0194
_014E: _014E:
ScrCmd_311 130 AddDistortionWorldMapObject 130
ScrCmd_311 129 AddDistortionWorldMapObject 129
ApplyMovement 129, _0250 ApplyMovement 129, _0250
WaitMovement WaitMovement
Message 3 Message 3
@ -99,8 +99,8 @@ _016E:
SetFlag FLAG_CAUGHT_GIRATINA SetFlag FLAG_CAUGHT_GIRATINA
SetFlag FLAG_HIDE_TURNBACK_CAVE_GIRATINA_ROOM_GIRATINA SetFlag FLAG_HIDE_TURNBACK_CAVE_GIRATINA_ROOM_GIRATINA
ClearFlag FLAG_UNK_0x0278 ClearFlag FLAG_UNK_0x0278
ScrCmd_311 130 AddDistortionWorldMapObject 130
ScrCmd_311 129 AddDistortionWorldMapObject 129
ApplyMovement 129, _0250 ApplyMovement 129, _0250
WaitMovement WaitMovement
Message 3 Message 3
@ -122,7 +122,7 @@ _0194:
CloseMessage CloseMessage
ApplyMovement 130, _0274 ApplyMovement 130, _0274
WaitMovement WaitMovement
ScrCmd_312 130 DeleteDistortionWorldMapObject 130
ApplyFreeCameraMovement _0288 ApplyFreeCameraMovement _0288
WaitMovement WaitMovement
RestoreCamera RestoreCamera

File diff suppressed because it is too large Load Diff

View File

@ -727,8 +727,8 @@ static BOOL ScrCmd_2FB(ScriptContext *ctx);
static BOOL ScrCmd_2FC(ScriptContext *ctx); static BOOL ScrCmd_2FC(ScriptContext *ctx);
static BOOL ScrCmd_GetRotomFormsInSave(ScriptContext *ctx); static BOOL ScrCmd_GetRotomFormsInSave(ScriptContext *ctx);
static BOOL ScrCmd_IncrementTrainerScore(ScriptContext *ctx); static BOOL ScrCmd_IncrementTrainerScore(ScriptContext *ctx);
static BOOL ScrCmd_311(ScriptContext *ctx); static BOOL ScrCmd_AddDistortionWorldMapObject(ScriptContext *ctx);
static BOOL ScrCmd_312(ScriptContext *ctx); static BOOL ScrCmd_DeleteDistortionWorldMapObject(ScriptContext *ctx);
static BOOL ScrCmd_ResetDistortionWorldPersistedCameraAngles(ScriptContext *ctx); static BOOL ScrCmd_ResetDistortionWorldPersistedCameraAngles(ScriptContext *ctx);
static BOOL ScrCmd_CheckHeapMemory(ScriptContext *ctx); static BOOL ScrCmd_CheckHeapMemory(ScriptContext *ctx);
static BOOL ScrCmd_StartGiratinaOriginBattle(ScriptContext *ctx); static BOOL ScrCmd_StartGiratinaOriginBattle(ScriptContext *ctx);
@ -1550,8 +1550,8 @@ const ScrCmdFunc Unk_020EAC58[] = {
ScrCmd_30E, ScrCmd_30E,
ScrCmd_30F, ScrCmd_30F,
ScrCmd_310, ScrCmd_310,
ScrCmd_311, ScrCmd_AddDistortionWorldMapObject,
ScrCmd_312, ScrCmd_DeleteDistortionWorldMapObject,
ScrCmd_CheckHeapMemory, ScrCmd_CheckHeapMemory,
ScrCmd_GetBattleResult, ScrCmd_GetBattleResult,
ScrCmd_315, ScrCmd_315,
@ -7841,21 +7841,21 @@ static BOOL ScrCmd_IncrementTrainerScore(ScriptContext *ctx)
return FALSE; return FALSE;
} }
static BOOL ScrCmd_311(ScriptContext *ctx) static BOOL ScrCmd_AddDistortionWorldMapObject(ScriptContext *ctx)
{ {
FieldSystem *fieldSystem = ctx->fieldSystem; FieldSystem *fieldSystem = ctx->fieldSystem;
u16 v1 = ScriptContext_GetVar(ctx); u16 mapObjLocalID = ScriptContext_GetVar(ctx);
ov9_0224F158(fieldSystem, v1); DistWorld_AddMapObjectWithLocalID(fieldSystem, mapObjLocalID);
return FALSE; return FALSE;
} }
static BOOL ScrCmd_312(ScriptContext *ctx) static BOOL ScrCmd_DeleteDistortionWorldMapObject(ScriptContext *ctx)
{ {
FieldSystem *fieldSystem = ctx->fieldSystem; FieldSystem *fieldSystem = ctx->fieldSystem;
u16 v1 = ScriptContext_GetVar(ctx); u16 mapObjLocalID = ScriptContext_GetVar(ctx);
ov9_0224F16C(fieldSystem, v1); DistWorld_DeleteMapObjectWithLocalID(fieldSystem, mapObjLocalID);
return FALSE; return FALSE;
} }