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
.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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

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_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;
}