Add MAP_OFFSET
This commit is contained in:
@@ -316,7 +316,7 @@ static const u8 *GetInteractedObjectEventScript(struct MapPosition *position, u8
|
||||
|
||||
static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
|
||||
{
|
||||
struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
|
||||
struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->height);
|
||||
|
||||
if (bgEvent == NULL)
|
||||
return NULL;
|
||||
@@ -498,7 +498,7 @@ static bool8 TryStartStepBasedScript(struct MapPosition *position, u16 metatileB
|
||||
|
||||
static bool8 TryStartCoordEventScript(struct MapPosition *position)
|
||||
{
|
||||
u8 *script = GetCoordEventScriptAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
|
||||
u8 *script = GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->height);
|
||||
|
||||
if (script == NULL)
|
||||
return FALSE;
|
||||
@@ -785,7 +785,7 @@ static bool8 IsArrowWarpMetatileBehavior(u16 metatileBehavior, u8 direction)
|
||||
|
||||
static s8 GetWarpEventAtMapPosition(struct MapHeader *mapHeader, struct MapPosition *position)
|
||||
{
|
||||
return GetWarpEventAtPosition(mapHeader, position->x - 7, position->y - 7, position->height);
|
||||
return GetWarpEventAtPosition(mapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->height);
|
||||
}
|
||||
|
||||
static void SetupWarp(struct MapHeader *unused, s8 warpEventId, struct MapPosition *position)
|
||||
@@ -920,7 +920,7 @@ static u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16
|
||||
|
||||
u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position)
|
||||
{
|
||||
return GetCoordEventScriptAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
|
||||
return GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->height);
|
||||
}
|
||||
|
||||
static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
||||
@@ -944,7 +944,7 @@ bool8 TryDoDiveWarp(struct MapPosition *position, u16 metatileBehavior)
|
||||
{
|
||||
if (gMapHeader.mapType == MAP_TYPE_UNDERWATER && !MetatileBehavior_IsUnableToEmerge(metatileBehavior))
|
||||
{
|
||||
if (SetDiveWarpEmerge(position->x - 7, position->y - 7))
|
||||
if (SetDiveWarpEmerge(position->x - MAP_OFFSET, position->y - MAP_OFFSET))
|
||||
{
|
||||
StoreInitialPlayerAvatarState();
|
||||
DoDiveWarp();
|
||||
@@ -954,7 +954,7 @@ bool8 TryDoDiveWarp(struct MapPosition *position, u16 metatileBehavior)
|
||||
}
|
||||
else if (MetatileBehavior_IsDiveable(metatileBehavior) == TRUE)
|
||||
{
|
||||
if (SetDiveWarpDive(position->x - 7, position->y - 7))
|
||||
if (SetDiveWarpDive(position->x - MAP_OFFSET, position->y - MAP_OFFSET))
|
||||
{
|
||||
StoreInitialPlayerAvatarState();
|
||||
DoDiveWarp();
|
||||
@@ -974,12 +974,12 @@ u8 TrySetDiveWarp(void)
|
||||
metatileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
if (gMapHeader.mapType == MAP_TYPE_UNDERWATER && !MetatileBehavior_IsUnableToEmerge(metatileBehavior))
|
||||
{
|
||||
if (SetDiveWarpEmerge(x - 7, y - 7) == TRUE)
|
||||
if (SetDiveWarpEmerge(x - MAP_OFFSET, y - MAP_OFFSET) == TRUE)
|
||||
return 1;
|
||||
}
|
||||
else if (MetatileBehavior_IsDiveable(metatileBehavior) == TRUE)
|
||||
{
|
||||
if (SetDiveWarpDive(x - 7, y - 7) == TRUE)
|
||||
if (SetDiveWarpDive(x - MAP_OFFSET, y - MAP_OFFSET) == TRUE)
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user