Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion include/tables/scene_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
* - Argument 4: Scene draw config index
* - Argument 5: ? (Unknown)
* - Argument 6: ? (Unknown)
*
* DEFINE_SCENE_TABLE_END auto-generates the SCENE_TABLE_MAX value
* DEFINE_SCENE_ENUM should only be defined when creating the `SceneId` enum.
* It creates an enum value for scenes that are referenced but no longer exist
*/
/* 0x00 */ DEFINE_SCENE(ydan_scene, g_pn_06, SCENE_DEKU_TREE, SDC_DEKU_TREE, 1, 2)
/* 0x01 */ DEFINE_SCENE(ddan_scene, g_pn_08, SCENE_DODONGOS_CAVERN, SDC_DODONGOS_CAVERN, 1, 3)
Expand Down Expand Up @@ -110,7 +114,12 @@
/* 0x62 */ DEFINE_SCENE(spot18_scene, g_pn_41, SCENE_GORON_CITY, SDC_GORON_CITY, 0, 0)
/* 0x63 */ DEFINE_SCENE(spot20_scene, g_pn_42, SCENE_LON_LON_RANCH, SDC_LON_LON_RANCH, 0, 0)
/* 0x64 */ DEFINE_SCENE(ganon_tou_scene, g_pn_43, SCENE_OUTSIDE_GANONS_CASTLE, SDC_OUTSIDE_GANONS_CASTLE, 0, 0)
#if DEBUG_ASSETS

#if !DEBUG_ASSETS && defined(DEFINE_SCENE_ENUM)
DEFINE_SCENE_TABLE_END()
#endif

#if DEBUG_ASSETS || defined(DEFINE_SCENE_ENUM)
Comment on lines +118 to +122
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This #if logic makes the table unnecessarily hard to read, I'd prefer if we just had DEFINE_SCENE_DEBUG and DEFINE_SCENE_DELETED and defined them at all include sites to keep the table itself easier to read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how you would implement DEFINE_SCENE_DEBUG in a sane way. The debug scenes are not dummied into the scene table in release builds, so a custom mod that mixed DEFINE_SCENE and DEFINE_SCENE_DEBUG declarations could desync the enumeration.

/* 0x65 */ DEFINE_SCENE(test01_scene, none, SCENE_TEST01, SDC_CALM_WATER, 0, 0)
/* 0x66 */ DEFINE_SCENE(besitu_scene, none, SCENE_BESITU, SDC_BESITU, 0, 0)
/* 0x67 */ DEFINE_SCENE(depth_test_scene, none, SCENE_DEPTH_TEST, SDC_DEFAULT, 0, 0)
Expand All @@ -121,3 +130,13 @@
/* 0x6C */ DEFINE_SCENE(sasatest_scene, none, SCENE_SASATEST, SDC_DEFAULT, 0, 0)
/* 0x6D */ DEFINE_SCENE(testroom_scene, none, SCENE_TESTROOM, SDC_DEFAULT, 0, 0)
#endif

#if DEBUG_ASSETS && defined(DEFINE_SCENE_ENUM)
DEFINE_SCENE_TABLE_END()
#endif

#if defined(DEFINE_SCENE_ENUM)
/* 0x6E */ DEFINE_SCENE_ENUM(SCENE_UNUSED_6E)
/* 0x6F */ DEFINE_SCENE_ENUM(SCENE_UNUSED_6F)
/* 0x70 */ DEFINE_SCENE_ENUM(SCENE_UNUSED_70)
#endif
26 changes: 8 additions & 18 deletions include/z64scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,29 +257,19 @@ typedef union SceneCmd {
typedef BAD_RETURN(s32) (*SceneCmdHandlerFunc)(struct PlayState*, SceneCmd*);

#define DEFINE_SCENE(_0, _1, enum, _3, _4, _5) enum,
#define DEFINE_SCENE_ENUM(enum) enum,
#define DEFINE_SCENE_TABLE_END() \
SCENE_TABLE_MAX, \
SCENE_TABLE__ = SCENE_TABLE_MAX - 1,

typedef enum SceneID {
#include "tables/scene_table.h"
/* 0x6E */ SCENE_ID_MAX
SCENE_ID_MAX
} SceneID;

#undef DEFINE_SCENE

// Fake enum values for scenes that are still referenced in the entrance table
#if !DEBUG_ASSETS
// Debug-only scenes
#define SCENE_TEST01 0x65
#define SCENE_BESITU 0x66
#define SCENE_DEPTH_TEST 0x67
#define SCENE_SYOTES 0x68
#define SCENE_SYOTES2 0x69
#define SCENE_SUTARU 0x6A
#define SCENE_HAIRAL_NIWA2 0x6B
#define SCENE_SASATEST 0x6C
#define SCENE_TESTROOM 0x6D
#endif
// Deleted scene
#define SCENE_UNUSED_6E 0x6E
#undef DEFINE_SCENE_ENUM
#undef DEFINE_SCENE_TABLE_END

// Macros for `EntranceInfo.field`
#define ENTRANCE_INFO_CONTINUE_BGM_FLAG (1 << 15)
Expand Down Expand Up @@ -514,6 +504,6 @@ void Scene_SetTransitionForNextEntrance(struct PlayState* play);
void Scene_Draw(struct PlayState* play);

extern EntranceInfo gEntranceTable[ENTR_MAX];
extern SceneTableEntry gSceneTable[SCENE_ID_MAX];
extern SceneTableEntry gSceneTable[SCENE_TABLE_MAX];

#endif
2 changes: 1 addition & 1 deletion src/code/z_actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -3900,7 +3900,7 @@ void Actor_SetTextWithPrefix(PlayState* play, Actor* actor, s16 baseTextId) {
case SCENE_KOKIRI_FOREST:
case SCENE_SACRED_FOREST_MEADOW:
case SCENE_LOST_WOODS:
case 112:
case SCENE_UNUSED_70:
prefix = 0x1000;
break;
case SCENE_STABLE:
Expand Down