Add support for local IDs in map.json

This commit is contained in:
GriffinR
2024-10-14 22:44:16 -04:00
parent bb50006fc9
commit a2e408cf4e
5 changed files with 145 additions and 79 deletions
+15 -3
View File
@@ -1,6 +1,8 @@
#ifndef GUARD_CONSTANTS_EVENT_OBJECTS_H
#define GUARD_CONSTANTS_EVENT_OBJECTS_H
#include "constants/map_event_ids.h"
#define OBJ_EVENT_GFX_RED_NORMAL 0
#define OBJ_EVENT_GFX_RED_BIKE 1
#define OBJ_EVENT_GFX_RED_SURF 2
@@ -192,9 +194,19 @@
#define OBJ_KIND_NORMAL 0
#define OBJ_KIND_CLONE 255
// Special object event local ids
#define OBJ_EVENT_ID_PLAYER 0xFF
#define OBJ_EVENT_ID_CAMERA 0x7F
// Each object event template gets an ID that can be used to refer to it in scripts and elsewhere.
// This is referred to as the "local id" (and it's really just 1 + its index in the templates array).
// There are a few special IDs reserved for objects that don't have templates in the map data -- one for the player
// in regular offline play, five for linked players while playing Berry Blender, and one for an invisible object that
// can be spawned for the camera to track instead of the player. Additionally, the value 0 is reserved as an "empty" indicator.
#define LOCALID_NONE 0
#define LOCALID_CAMERA 127
#define LOCALID_BERRY_BLENDER_PLAYER_END 240 // This will use 5 (MAX_RFU_PLAYERS) IDs ending at 240, i.e. 236-240
#define LOCALID_PLAYER 255
// Aliases for old names. "object event id" normally refers to an index into gObjectEvents, which these are not.
#define OBJ_EVENT_ID_CAMERA LOCALID_CAMERA
#define OBJ_EVENT_ID_PLAYER LOCALID_PLAYER
// Object event local ids referenced in C files
#define LOCALID_UNION_ROOM_PLAYER_4 2