Use MAP_OFFSET (#8328)

This commit is contained in:
Estellar 2025-11-22 23:56:27 -03:00 committed by GitHub
parent b84e26c553
commit 9b0a36e1d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 10 deletions

View File

@ -932,8 +932,8 @@ static void DexNavUpdateDirectionArrow(void)
{
u16 tileX = sDexNavSearchDataPtr->tileX;
u16 tileY = sDexNavSearchDataPtr->tileY;
u16 playerX = gSaveBlock1Ptr->pos.x + 7;
u16 playerY = gSaveBlock1Ptr->pos.y + 7;
u16 playerX = gSaveBlock1Ptr->pos.x + MAP_OFFSET;
u16 playerY = gSaveBlock1Ptr->pos.y + MAP_OFFSET;
u16 deltaX = abs(tileX - playerX);
u16 deltaY = abs(tileY - playerY);
const u8 *str;

View File

@ -4308,8 +4308,8 @@ void GetObjectPosition(u16* xPointer, u16* yPointer, u32 localId, u32 useTemplat
objectId = GetObjectEventIdByLocalId(localId);
objEvent = &gObjectEvents[objectId];
*xPointer = objEvent->currentCoords.x - 7;
*yPointer = objEvent->currentCoords.y - 7;
*xPointer = objEvent->currentCoords.x - MAP_OFFSET;
*yPointer = objEvent->currentCoords.y - MAP_OFFSET;
}
bool32 CheckObjectAtXY(u32 x, u32 y)

View File

@ -3085,8 +3085,8 @@ bool8 ScrCmd_getobjectxy(struct ScriptContext *ctx)
bool8 ScrCmd_checkobjectat(struct ScriptContext *ctx)
{
u32 x = VarGet(ScriptReadHalfword(ctx)) + 7;
u32 y = VarGet(ScriptReadHalfword(ctx)) + 7;
u32 x = VarGet(ScriptReadHalfword(ctx)) + MAP_OFFSET;
u32 y = VarGet(ScriptReadHalfword(ctx)) + MAP_OFFSET;
u32 varId = ScriptReadHalfword(ctx);
Script_RequestEffects(SCREFF_V1);

View File

@ -15,6 +15,7 @@
#include "battle_setup.h"
#include "random.h"
#include "field_player_avatar.h"
#include "fieldmap.h"
#include "vs_seeker.h"
#include "menu.h"
#include "string_util.h"
@ -390,8 +391,8 @@ static void GatherNearbyTrainerInfo(void)
sVsSeeker->trainerInfo[vsSeekerObjectIdx].localId = templates[objectEventIdx].localId;
TryGetObjectEventIdByLocalIdAndMap(templates[objectEventIdx].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectEventId);
sVsSeeker->trainerInfo[vsSeekerObjectIdx].objectEventId = objectEventId;
sVsSeeker->trainerInfo[vsSeekerObjectIdx].xCoord = gObjectEvents[objectEventId].currentCoords.x - 7;
sVsSeeker->trainerInfo[vsSeekerObjectIdx].yCoord = gObjectEvents[objectEventId].currentCoords.y - 7;
sVsSeeker->trainerInfo[vsSeekerObjectIdx].xCoord = gObjectEvents[objectEventId].currentCoords.x - MAP_OFFSET;
sVsSeeker->trainerInfo[vsSeekerObjectIdx].yCoord = gObjectEvents[objectEventId].currentCoords.y - MAP_OFFSET;
sVsSeeker->trainerInfo[vsSeekerObjectIdx].graphicsId = templates[objectEventIdx].graphicsId;
vsSeekerObjectIdx++;
}
@ -766,8 +767,8 @@ static bool8 IsTrainerVisibleOnScreen(struct VsSeekerTrainerInfo * trainerInfo)
s16 y;
PlayerGetDestCoords(&x, &y);
x -= 7;
y -= 7;
x -= MAP_OFFSET;
y -= MAP_OFFSET;
if ( x - 7 <= trainerInfo->xCoord
&& x + 7 >= trainerInfo->xCoord