Generate local IDs from map.json files
This commit is contained in:
@@ -30,6 +30,17 @@
|
||||
#include "constants/trainer_types.h"
|
||||
#include "constants/union_room.h"
|
||||
|
||||
#define SPECIAL_LOCALIDS_START (min(OBJ_EVENT_ID_CAMERA, \
|
||||
min(OBJ_EVENT_ID_PLAYER, \
|
||||
LOCALID_BERRY_BLENDER_PLAYER_END - MAX_RFU_PLAYERS + 1)))
|
||||
|
||||
// The object event templates on a map cannot use the special IDs listed above or they can behave unexpectedly.
|
||||
// For more details on these special IDs see their definitions in 'include/constants/event_objects.h'.
|
||||
// OBJECT_EVENT_TEMPLATES_COUNT should always be low enough that it doesn't overlap with these IDs.
|
||||
#if OBJECT_EVENT_TEMPLATES_COUNT >= SPECIAL_LOCALIDS_START
|
||||
#error "OBJECT_EVENT_TEMPLATES_COUNT is too large. Object event local IDs may overlap with reserved IDs."
|
||||
#endif
|
||||
|
||||
// this file was known as evobjmv.c in Game Freak's original source
|
||||
|
||||
enum {
|
||||
@@ -8814,7 +8825,7 @@ u8 MovementAction_LockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprite
|
||||
bool32 found = FALSE;
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||
{
|
||||
if (firstFreeSlot == OBJECT_EVENTS_COUNT && sLockedAnimObjectEvents->localIds[i] == 0)
|
||||
if (firstFreeSlot == OBJECT_EVENTS_COUNT && sLockedAnimObjectEvents->localIds[i] == LOCALID_NONE)
|
||||
firstFreeSlot = i;
|
||||
|
||||
if (sLockedAnimObjectEvents->localIds[i] == objectEvent->localId)
|
||||
@@ -8854,7 +8865,7 @@ u8 MovementAction_UnlockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprit
|
||||
index = FindLockedObjectEventIndex(objectEvent);
|
||||
if (index != OBJECT_EVENTS_COUNT)
|
||||
{
|
||||
sLockedAnimObjectEvents->localIds[index] = 0;
|
||||
sLockedAnimObjectEvents->localIds[index] = LOCALID_NONE;
|
||||
sLockedAnimObjectEvents->count--;
|
||||
ableToStore = TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user