summaryrefslogtreecommitdiff
path: root/src/scrcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/scrcmd.c')
-rw-r--r--src/scrcmd.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/src/scrcmd.c b/src/scrcmd.c
index e699bfeab..837259a7f 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -49,12 +49,12 @@
#include "trainer_see.h"
#include "tv.h"
#include "window.h"
+#include "constants/event_objects.h"
typedef u16 (*SpecialFunc)(void);
typedef void (*NativeFunc)(void);
-extern const u8 *gUnknown_020375C0;
-
+EWRAM_DATA const u8 *gUnknown_020375C0 = NULL;
static EWRAM_DATA u32 gUnknown_020375C4 = 0;
static EWRAM_DATA u16 sPauseCounter = 0;
static EWRAM_DATA u16 sMovingNpcId = 0;
@@ -735,7 +735,7 @@ bool8 ScrCmd_setmaplayoutindex(struct ScriptContext *ctx)
{
u16 value = VarGet(ScriptReadHalfword(ctx));
- sub_8085524(value);
+ SetCurrentMapLayout(value);
return FALSE;
}
@@ -747,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;
}
@@ -761,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;
}
@@ -775,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;
}
@@ -790,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;
}
@@ -806,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;
@@ -820,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;
@@ -834,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;
}
@@ -846,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;
}
@@ -882,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;
}
@@ -1239,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;
@@ -1251,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;
@@ -1485,7 +1485,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
StringExpandPlaceholders(gStringVar4, ptr + 6);
- width = GetStringWidth(6, gStringVar4, -1) / 8;
+ width = GetStringWidth(6, gStringVar4, -1) / 8u;
if (width > 0x1C)
width = 0x1C;
@@ -1713,8 +1713,7 @@ bool8 ScrCmd_checkpartymove(struct ScriptContext *ctx)
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL);
if (!species)
break;
- // UB: GetMonData() arguments don't match function definition
- if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && pokemon_has_move(&gPlayerParty[i], moveId) == TRUE)
+ if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && MonKnowsMove(&gPlayerParty[i], moveId) == TRUE)
{
gSpecialVar_Result = i;
gSpecialVar_0x8004 = species;
@@ -1999,7 +1998,7 @@ bool8 ScrCmd_setrespawn(struct ScriptContext *ctx)
{
u16 healLocationId = VarGet(ScriptReadHalfword(ctx));
- Overworld_SetHealLocationWarp(healLocationId);
+ SetLastHealLocationWarp(healLocationId);
return FALSE;
}
@@ -2236,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();
@@ -2290,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;