From 3daeaf2446c0c303fd3bab4498c8e4318e22e9f7 Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Wed, 20 Jan 2021 18:15:17 +0000 Subject: [PATCH] Reduce hardcoded sizes for a few data tables (#646) Co-authored-by: Thar0 --- include/variables.h | 8 ++++---- include/z64object.h | 3 ++- include/z64scene.h | 3 ++- src/code/z_scene.c | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/variables.h b/include/variables.h index 4731511e53..a94250a1fe 100644 --- a/include/variables.h +++ b/include/variables.h @@ -173,9 +173,9 @@ extern u8 D_80114930[]; //extern ? D_801159A8; //extern ? D_801159A9; //extern ? D_801159AA; -extern EffectSsOverlay gEffectSsOverlayTable[37]; +extern EffectSsOverlay gEffectSsOverlayTable[EFFECT_SS_TYPE_MAX]; extern Gfx D_80116280[]; -extern ActorOverlay gActorOverlayTable[471]; // original name: "actor_dlftbls" 801162A0 +extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX]; // original name: "actor_dlftbls" 801162A0 extern s32 gMaxActorId; // original name: "MaxProfile" //extern ? D_80119E2C; //extern ? D_80119E52; @@ -397,9 +397,9 @@ extern u8 gItemSlots[56]; extern void (*gSceneCmdHandlers[26])(GlobalContext*, SceneCmd*); extern s16 gLinkObjectIds[2]; extern u32 gObjectTableSize; -extern RomFile gObjectTable[402]; +extern RomFile gObjectTable[OBJECT_ID_MAX]; extern EntranceInfo gEntranceTable[1556]; -extern Scene gSceneTable[110]; +extern Scene gSceneTable[SCENE_ID_MAX]; //extern ? D_8012A4A0; extern u16 gSramSlotOffsets[2][3]; //extern ? D_8012A690; diff --git a/include/z64object.h b/include/z64object.h index 54271d82f4..7e36e5b13e 100644 --- a/include/z64object.h +++ b/include/z64object.h @@ -405,7 +405,8 @@ typedef enum { /* 0x018E */ OBJECT_DOOR_KILLER, /* 0x018F */ OBJECT_OUKE_HAKA, /* 0x0190 */ OBJECT_TIMEBLOCK, - /* 0x0191 */ OBJECT_ZL4 + /* 0x0191 */ OBJECT_ZL4, + /* 0x0192 */ OBJECT_ID_MAX } ObjectID; #endif diff --git a/include/z64scene.h b/include/z64scene.h index d15867a9a1..cdfa1f4870 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -413,7 +413,8 @@ typedef enum { /* 0x6A */ SCENE_SUTARU, /* 0x6B */ SCENE_HAIRAL_NIWA2, /* 0x6C */ SCENE_SASATEST, - /* 0x6D */ SCENE_TESTROOM + /* 0x6D */ SCENE_TESTROOM, + /* 0x6E */ SCENE_ID_MAX } SceneID; #endif diff --git a/src/code/z_scene.c b/src/code/z_scene.c index dce656a146..05070c2144 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -527,7 +527,7 @@ RomFile sNaviMsgFiles[] = { s16 gLinkObjectIds[] = { OBJECT_LINK_BOY, OBJECT_LINK_CHILD }; -u32 gObjectTableSize = 402; +u32 gObjectTableSize = ARRAY_COUNT(gObjectTable); RomFile gObjectTable[] = { ROM_FILE_UNSET,