Move local IDs to map.json
This commit is contained in:
+3
-2
@@ -27,6 +27,7 @@
|
||||
#include "battle_transition.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "constants/battle_setup.h"
|
||||
#include "constants/event_objects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/maps.h"
|
||||
#include "constants/songs.h"
|
||||
@@ -709,7 +710,7 @@ static void InitTrainerBattleVariables(void)
|
||||
{
|
||||
sTrainerBattleMode = 0;
|
||||
gTrainerBattleOpponent_A = 0;
|
||||
sTrainerObjectEventLocalId = 0;
|
||||
sTrainerObjectEventLocalId = LOCALID_NONE;
|
||||
sTrainerAIntroSpeech = NULL;
|
||||
sTrainerADefeatSpeech = NULL;
|
||||
sTrainerVictorySpeech = NULL;
|
||||
@@ -776,7 +777,7 @@ static void TrainerBattleLoadArgs(const struct TrainerBattleParameter *specs, co
|
||||
|
||||
static void SetMapVarsToTrainer(void)
|
||||
{
|
||||
if (sTrainerObjectEventLocalId != 0)
|
||||
if (sTrainerObjectEventLocalId != LOCALID_NONE)
|
||||
{
|
||||
gSpecialVar_LastTalked = sTrainerObjectEventLocalId;
|
||||
gSelectedObjectEvent = GetObjectEventIdByLocalIdAndMap(sTrainerObjectEventLocalId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
|
||||
|
||||
@@ -1206,7 +1206,7 @@ static const u8 sPlayerDirectionToCopyDirection[][4] = {
|
||||
static void ClearObjectEvent(struct ObjectEvent *objectEvent)
|
||||
{
|
||||
*objectEvent = (struct ObjectEvent){};
|
||||
objectEvent->localId = 0xFF;
|
||||
objectEvent->localId = LOCALID_PLAYER;
|
||||
objectEvent->mapNum = MAP_NUM(MAP_UNDEFINED);
|
||||
objectEvent->mapGroup = MAP_GROUP(MAP_UNDEFINED);
|
||||
objectEvent->movementActionId = MOVEMENT_ACTION_NONE;
|
||||
@@ -1317,7 +1317,7 @@ static u8 InitObjectEventStateFromTemplate(const struct ObjectEventTemplate *tem
|
||||
s16 x;
|
||||
s16 y;
|
||||
bool8 isClone = FALSE;
|
||||
u8 localId = 0;
|
||||
u8 localId = LOCALID_NONE;
|
||||
s16 x2 = 0;
|
||||
s16 y2 = 0;
|
||||
s16 x3 = 0;
|
||||
@@ -7977,7 +7977,7 @@ static void CalcWhetherObjectIsOffscreen(struct ObjectEvent *objectEvent, struct
|
||||
u16 x, y;
|
||||
u16 x2, y2;
|
||||
const struct ObjectEventGraphicsInfo *graphicsInfo;
|
||||
s16 var;
|
||||
s16 minX;
|
||||
|
||||
objectEvent->offScreen = FALSE;
|
||||
graphicsInfo = GetObjectEventGraphicsInfo(objectEvent->graphicsId);
|
||||
@@ -7995,20 +7995,20 @@ static void CalcWhetherObjectIsOffscreen(struct ObjectEvent *objectEvent, struct
|
||||
y2 = graphicsInfo->height + (s16)y;
|
||||
|
||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(MAP_SSANNE_EXTERIOR)
|
||||
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(MAP_SSANNE_EXTERIOR)
|
||||
&& objectEvent->localId == 1)
|
||||
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(MAP_SSANNE_EXTERIOR)
|
||||
&& objectEvent->localId == LOCALID_SS_ANNE)
|
||||
{
|
||||
var = -32;
|
||||
minX = -32;
|
||||
}
|
||||
else
|
||||
{
|
||||
var = -16;
|
||||
minX = -16;
|
||||
}
|
||||
if ((s16)x >= 256 || (s16)x2 < var)
|
||||
if ((s16)x >= (DISPLAY_WIDTH + 16) || (s16)x2 < minX)
|
||||
{
|
||||
objectEvent->offScreen = TRUE;
|
||||
}
|
||||
if ((s16)y >= 176 || (s16)y2 < -16)
|
||||
if ((s16)y >= (DISPLAY_HEIGHT + 16) || (s16)y2 < -16)
|
||||
{
|
||||
objectEvent->offScreen = TRUE;
|
||||
}
|
||||
|
||||
@@ -2407,15 +2407,15 @@ static void MoveDeoxysObject(u8 num)
|
||||
u8 mapObjId;
|
||||
LoadPalette(sDeoxysObjectPals[num], OBJ_PLTT_ID(10), PLTT_SIZEOF(4));
|
||||
ApplyGlobalFieldPaletteTint(10);
|
||||
TryGetObjectEventIdByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &mapObjId);
|
||||
TryGetObjectEventIdByLocalIdAndMap(LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &mapObjId);
|
||||
if (num == 0)
|
||||
PlaySE(SE_M_CONFUSE_RAY);
|
||||
else
|
||||
PlaySE(SE_DEOXYS_MOVE);
|
||||
CreateTask(Task_WaitDeoxysFieldEffect, 8);
|
||||
gFieldEffectArguments[0] = 1;
|
||||
gFieldEffectArguments[1] = 56;
|
||||
gFieldEffectArguments[2] = 2;
|
||||
gFieldEffectArguments[0] = LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK;
|
||||
gFieldEffectArguments[1] = MAP_NUM(MAP_BIRTH_ISLAND_EXTERIOR);
|
||||
gFieldEffectArguments[2] = MAP_GROUP(MAP_BIRTH_ISLAND_EXTERIOR);
|
||||
gFieldEffectArguments[3] = sDeoxysCoords[num][0];
|
||||
gFieldEffectArguments[4] = sDeoxysCoords[num][1];
|
||||
if (num == 0)
|
||||
@@ -2423,7 +2423,7 @@ static void MoveDeoxysObject(u8 num)
|
||||
else
|
||||
gFieldEffectArguments[5] = 5;
|
||||
FieldEffectStart(FLDEFF_MOVE_DEOXYS_ROCK);
|
||||
SetObjEventTemplateCoords(1, sDeoxysCoords[num][0], sDeoxysCoords[num][1]);
|
||||
SetObjEventTemplateCoords(LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK, sDeoxysCoords[num][0], sDeoxysCoords[num][1]);
|
||||
}
|
||||
|
||||
static void Task_WaitDeoxysFieldEffect(u8 taskId)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "heal_location.h"
|
||||
#include "event_data.h"
|
||||
#include "constants/maps.h"
|
||||
#include "constants/map_event_ids.h"
|
||||
#include "constants/heal_locations.h"
|
||||
|
||||
static void SetWhiteoutRespawnHealerNpcAsLastTalked(u32 healLocationIdx);
|
||||
|
||||
+2
-2
@@ -1010,7 +1010,7 @@ bool8 ScrCmd_waitmovement(struct ScriptContext * ctx)
|
||||
{
|
||||
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
if (localId != 0)
|
||||
if (localId != LOCALID_NONE)
|
||||
sMovingNpcId = localId;
|
||||
sMovingNpcMapGroup = gSaveBlock1Ptr->location.mapGroup;
|
||||
sMovingNpcMapNum = gSaveBlock1Ptr->location.mapNum;
|
||||
@@ -1024,7 +1024,7 @@ bool8 ScrCmd_waitmovementat(struct ScriptContext * ctx)
|
||||
u8 mapBank;
|
||||
u8 mapId;
|
||||
|
||||
if (localId != 0)
|
||||
if (localId != LOCALID_NONE)
|
||||
sMovingNpcId = localId;
|
||||
mapBank = ScriptReadByte(ctx);
|
||||
mapId = ScriptReadByte(ctx);
|
||||
|
||||
+9
-7
@@ -33,6 +33,8 @@
|
||||
#define MAX_REMATCH_PARTIES 6
|
||||
#define SKIP 0xFFFF
|
||||
|
||||
#define NO_REMATCH_LOCALID LOCALID_PLAYER
|
||||
|
||||
enum
|
||||
{
|
||||
VSSEEKER_NOT_CHARGED,
|
||||
@@ -823,12 +825,12 @@ static void GatherNearbyTrainerInfo(void)
|
||||
vsSeekerObjectIdx++;
|
||||
}
|
||||
}
|
||||
sVsSeeker->trainerInfo[vsSeekerObjectIdx].localId = 0xFF;
|
||||
sVsSeeker->trainerInfo[vsSeekerObjectIdx].localId = NO_REMATCH_LOCALID;
|
||||
}
|
||||
|
||||
static void Task_VsSeeker_3(u8 taskId)
|
||||
{
|
||||
if (ScriptMovement_IsObjectMovementFinished(0xFF, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup))
|
||||
if (ScriptMovement_IsObjectMovementFinished(NO_REMATCH_LOCALID, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup))
|
||||
{
|
||||
if (sVsSeeker->responseCode == VSSEEKER_RESPONSE_NO_RESPONSE)
|
||||
{
|
||||
@@ -852,7 +854,7 @@ static u8 CanUseVsSeeker(void)
|
||||
u8 vsSeekerChargeSteps = gSaveBlock1Ptr->trainerRematchStepCounter;
|
||||
if (vsSeekerChargeSteps == 100)
|
||||
{
|
||||
if (GetRematchableTrainerLocalId() == 0xFF)
|
||||
if (GetRematchableTrainerLocalId() == NO_REMATCH_LOCALID)
|
||||
return VSSEEKER_NO_ONE_IN_RANGE;
|
||||
else
|
||||
return VSSEEKER_CAN_USE;
|
||||
@@ -873,7 +875,7 @@ static u8 GetVsSeekerResponseInArea(const struct RematchData * vsSeekerData)
|
||||
u8 response = 0;
|
||||
s32 vsSeekerIdx = 0;
|
||||
|
||||
while (sVsSeeker->trainerInfo[vsSeekerIdx].localId != 0xFF)
|
||||
while (sVsSeeker->trainerInfo[vsSeekerIdx].localId != NO_REMATCH_LOCALID)
|
||||
{
|
||||
if (IsTrainerVisibleOnScreen(&sVsSeeker->trainerInfo[vsSeekerIdx]) == TRUE)
|
||||
{
|
||||
@@ -1258,7 +1260,7 @@ static u8 GetRematchableTrainerLocalId(void)
|
||||
u8 idx;
|
||||
u8 i;
|
||||
|
||||
for (i = 0; sVsSeeker->trainerInfo[i].localId != 0xFF; i++)
|
||||
for (i = 0; sVsSeeker->trainerInfo[i].localId != NO_REMATCH_LOCALID; i++)
|
||||
{
|
||||
if (IsTrainerVisibleOnScreen(&sVsSeeker->trainerInfo[i]) == 1)
|
||||
{
|
||||
@@ -1267,7 +1269,7 @@ static u8 GetRematchableTrainerLocalId(void)
|
||||
}
|
||||
}
|
||||
|
||||
return 0xFF;
|
||||
return NO_REMATCH_LOCALID;
|
||||
}
|
||||
|
||||
static void StartTrainerObjectMovementScript(struct VsSeekerTrainerInfo * trainerInfo, const u8 * script)
|
||||
@@ -1304,7 +1306,7 @@ static void StartAllRespondantIdleMovements(void)
|
||||
|
||||
for (i = 0; i < sVsSeeker->numRematchableTrainers; i++)
|
||||
{
|
||||
for (j = 0; sVsSeeker->trainerInfo[j].localId != 0xFF; j++)
|
||||
for (j = 0; sVsSeeker->trainerInfo[j].localId != NO_REMATCH_LOCALID; j++)
|
||||
{
|
||||
if (sVsSeeker->trainerInfo[j].trainerIdx == sVsSeeker->trainerIdxArray[i])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user