From 451e855dbc91578ac4a6a06280c7c812a0c0007b Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 29 Oct 2022 23:25:28 +0200 Subject: [PATCH] Move object table from `z_scene.c` to new file `object_table.c` (#1416) * Move object table from z_scene to new file z_scene_dlftbls ("inspired by z_actor_dlftbls.c") * -> `object_table.c` --- spec | 1 + src/code/object_table.c | 29 +++++++++++++++++++++++++++++ src/code/z_scene.c | 29 ----------------------------- 3 files changed, 30 insertions(+), 29 deletions(-) create mode 100644 src/code/object_table.c diff --git a/spec b/spec index fdd90baba3..4fdacf2b8e 100644 --- a/spec +++ b/spec @@ -353,6 +353,7 @@ beginseg include "build/src/code/z_sample.o" include "build/src/code/code_80097A00.o" include "build/src/code/z_scene.o" + include "build/src/code/object_table.o" include "build/src/code/z_scene_table.o" include "build/src/code/z_skelanime.o" include "build/src/code/z_skin.o" diff --git a/src/code/object_table.c b/src/code/object_table.c new file mode 100644 index 0000000000..dc32b44359 --- /dev/null +++ b/src/code/object_table.c @@ -0,0 +1,29 @@ +#include "global.h" + +s16 gLinkObjectIds[] = { OBJECT_LINK_BOY, OBJECT_LINK_CHILD }; + +u32 gObjectTableSize = ARRAY_COUNT(gObjectTable); + +// Object linker symbol declarations (used in the table below) +#define DEFINE_OBJECT(name, _1) DECLARE_ROM_SEGMENT(name) +#define DEFINE_OBJECT_NULL(_0, _1) +#define DEFINE_OBJECT_UNSET(_0) + +#include "tables/object_table.h" + +#undef DEFINE_OBJECT +#undef DEFINE_OBJECT_NULL +#undef DEFINE_OBJECT_UNSET + +// Object Table definition +#define DEFINE_OBJECT(name, _1) ROM_FILE(name), +#define DEFINE_OBJECT_NULL(name, _1) ROM_FILE_EMPTY(name), +#define DEFINE_OBJECT_UNSET(_0) { 0 }, + +RomFile gObjectTable[] = { +#include "tables/object_table.h" +}; + +#undef DEFINE_OBJECT +#undef DEFINE_OBJECT_NULL +#undef DEFINE_OBJECT_UNSET diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 3f029ff667..31383bd9ac 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -500,33 +500,4 @@ void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*) = { RomFile sNaviQuestHintFiles[] = { ROM_FILE(elf_message_field), ROM_FILE(elf_message_ydan), - ROM_FILE_UNSET, }; - -s16 gLinkObjectIds[] = { OBJECT_LINK_BOY, OBJECT_LINK_CHILD }; - -u32 gObjectTableSize = ARRAY_COUNT(gObjectTable); - -// Object linker symbol declarations (used in the table below) -#define DEFINE_OBJECT(name, _1) DECLARE_ROM_SEGMENT(name) -#define DEFINE_OBJECT_NULL(_0, _1) -#define DEFINE_OBJECT_UNSET(_0) - -#include "tables/object_table.h" - -#undef DEFINE_OBJECT -#undef DEFINE_OBJECT_NULL -#undef DEFINE_OBJECT_UNSET - -// Object Table definition -#define DEFINE_OBJECT(name, _1) ROM_FILE(name), -#define DEFINE_OBJECT_NULL(name, _1) ROM_FILE_EMPTY(name), -#define DEFINE_OBJECT_UNSET(_0) { 0 }, - -RomFile gObjectTable[] = { -#include "tables/object_table.h" -}; - -#undef DEFINE_OBJECT -#undef DEFINE_OBJECT_NULL -#undef DEFINE_OBJECT_UNSET