diff options
Diffstat (limited to 'src/scrcmd.c')
-rw-r--r-- | src/scrcmd.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/src/scrcmd.c b/src/scrcmd.c index c00cc68d1..837259a7f 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -49,6 +49,7 @@ #include "trainer_see.h" #include "tv.h" #include "window.h" +#include "constants/event_objects.h" typedef u16 (*SpecialFunc)(void); typedef void (*NativeFunc)(void); @@ -734,7 +735,7 @@ bool8 ScrCmd_setmaplayoutindex(struct ScriptContext *ctx) { u16 value = VarGet(ScriptReadHalfword(ctx)); - sub_8085524(value); + SetCurrentMapLayout(value); return FALSE; } @@ -746,8 +747,8 @@ bool8 ScrCmd_warp(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); - sub_80AF734(); + SetWarpDestination(mapGroup, mapNum, warpId, x, y); + DoWarp(); ResetInitialPlayerAvatarState(); return TRUE; } @@ -760,8 +761,8 @@ bool8 ScrCmd_warpsilent(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); - sp13E_warp_to_last_warp(); + SetWarpDestination(mapGroup, mapNum, warpId, x, y); + DoDiveWarp(); ResetInitialPlayerAvatarState(); return TRUE; } @@ -774,8 +775,8 @@ bool8 ScrCmd_warpdoor(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); - sub_80AF7D0(); + SetWarpDestination(mapGroup, mapNum, warpId, x, y); + DoDoorWarp(); ResetInitialPlayerAvatarState(); return TRUE; } @@ -789,10 +790,10 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx) PlayerGetDestCoords(&x, &y); if (mapGroup == 0xFF && mapNum == 0xFF) - SetFixedHoleWarpAsDestination(x - 7, y - 7); + SetWarpDestinationToFixedHoleWarp(x - 7, y - 7); else - Overworld_SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7); - sp13F_fall_to_last_warp(); + SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7); + DoFallWarp(); ResetInitialPlayerAvatarState(); return TRUE; } @@ -805,7 +806,7 @@ bool8 ScrCmd_warpteleport(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); + SetWarpDestination(mapGroup, mapNum, warpId, x, y); sub_80AF848(); ResetInitialPlayerAvatarState(); return TRUE; @@ -819,7 +820,7 @@ bool8 ScrCmd_warpD7(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); + SetWarpDestination(mapGroup, mapNum, warpId, x, y); sub_80AF87C(); ResetInitialPlayerAvatarState(); return TRUE; @@ -833,7 +834,7 @@ bool8 ScrCmd_setwarp(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); + SetWarpDestination(mapGroup, mapNum, warpId, x, y); return FALSE; } @@ -845,7 +846,7 @@ bool8 ScrCmd_setdynamicwarp(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - saved_warp2_set_2(0, mapGroup, mapNum, warpId, x, y); + SetDynamicWarpWithCoords(0, mapGroup, mapNum, warpId, x, y); return FALSE; } @@ -881,7 +882,7 @@ bool8 ScrCmd_setescapewarp(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - sub_8084DD4(mapGroup, mapNum, warpId, x, y); + SetEscapeWarp(mapGroup, mapNum, warpId, x, y); return FALSE; } @@ -1238,11 +1239,11 @@ bool8 ScrCmd_lock(struct ScriptContext *ctx) bool8 ScrCmd_releaseall(struct ScriptContext *ctx) { - u8 objectId; + u8 playerObjectId; HideFieldMessageBox(); - objectId = GetEventObjectIdByLocalIdAndMap(0xFF, 0, 0); - EventObjectClearHeldMovementIfFinished(&gEventObjects[objectId]); + playerObjectId = GetEventObjectIdByLocalIdAndMap(EVENT_OBJ_ID_PLAYER, 0, 0); + EventObjectClearHeldMovementIfFinished(&gEventObjects[playerObjectId]); sub_80D338C(); UnfreezeEventObjects(); return FALSE; @@ -1250,13 +1251,13 @@ bool8 ScrCmd_releaseall(struct ScriptContext *ctx) bool8 ScrCmd_release(struct ScriptContext *ctx) { - u8 objectId; + u8 playerObjectId; HideFieldMessageBox(); if (gEventObjects[gSelectedEventObject].active) EventObjectClearHeldMovementIfFinished(&gEventObjects[gSelectedEventObject]); - objectId = GetEventObjectIdByLocalIdAndMap(0xFF, 0, 0); - EventObjectClearHeldMovementIfFinished(&gEventObjects[objectId]); + playerObjectId = GetEventObjectIdByLocalIdAndMap(EVENT_OBJ_ID_PLAYER, 0, 0); + EventObjectClearHeldMovementIfFinished(&gEventObjects[playerObjectId]); sub_80D338C(); UnfreezeEventObjects(); return FALSE; @@ -1997,7 +1998,7 @@ bool8 ScrCmd_setrespawn(struct ScriptContext *ctx) { u16 healLocationId = VarGet(ScriptReadHalfword(ctx)); - Overworld_SetHealLocationWarp(healLocationId); + SetLastHealLocationWarp(healLocationId); return FALSE; } @@ -2234,7 +2235,7 @@ bool8 ScrCmd_warpD1(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); + SetWarpDestination(mapGroup, mapNum, warpId, x, y); sub_808D074(GetPlayerFacingDirection()); sub_80B0244(); ResetInitialPlayerAvatarState(); @@ -2288,7 +2289,7 @@ bool8 ScrCmd_warpE0(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); + SetWarpDestination(mapGroup, mapNum, warpId, x, y); sub_80AF79C(); ResetInitialPlayerAvatarState(); return TRUE; |