mirror of
https://github.com/zeldaret/oot
synced 2026-08-06 01:48:49 -04:00
Generate gamestate overlay table with an include/tables/ header (#1504)
* Generate gamestate overlay table from an include/tables/ header * GameStateIndex -> GameStateId, move to z64.h, add GameStateId enum name field to the gamestate table, adjust and improve gamestate table comment * Shorten zeros in table definition * Generate linker symbols, other suggested changes * GAMESTATE_MAX -> GAMESTATE_ID_MAX like the others
This commit is contained in:
@@ -64,10 +64,6 @@ DECLARE_SEGMENT(code)
|
||||
DECLARE_ROM_SEGMENT(code)
|
||||
DECLARE_BSS_SEGMENT(code)
|
||||
|
||||
DECLARE_OVERLAY_SEGMENT(title)
|
||||
DECLARE_OVERLAY_SEGMENT(select)
|
||||
DECLARE_OVERLAY_SEGMENT(opening)
|
||||
DECLARE_OVERLAY_SEGMENT(file_choose)
|
||||
DECLARE_OVERLAY_SEGMENT(kaleido_scope)
|
||||
DECLARE_OVERLAY_SEGMENT(player_actor)
|
||||
DECLARE_OVERLAY_SEGMENT(map_mark_data)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Gamestate Table
|
||||
*
|
||||
* DEFINE_GAMESTATE should be used for gamestates with code loaded from an overlay
|
||||
* - Argument 1: Gamestate type name (without State suffix, also used for Init and Destroy function names)
|
||||
* - Argument 2: Gamestate id enum name
|
||||
* - Argument 3: Gamestate overlay spec segment name
|
||||
*
|
||||
* DEFINE_GAMESTATE_INTERNAL should be used for gamestates that aren't an overlay, the first two arguments are the same as for DEFINE_GAMESTATE
|
||||
*/
|
||||
/* 0x00 */ DEFINE_GAMESTATE_INTERNAL(Setup, GAMESTATE_SETUP)
|
||||
/* 0x01 */ DEFINE_GAMESTATE(MapSelect, GAMESTATE_MAP_SELECT, select)
|
||||
/* 0x02 */ DEFINE_GAMESTATE(ConsoleLogo, GAMESTATE_CONSOLE_LOGO, title)
|
||||
/* 0x03 */ DEFINE_GAMESTATE_INTERNAL(Play, GAMESTATE_PLAY)
|
||||
/* 0x04 */ DEFINE_GAMESTATE(TitleSetup, GAMESTATE_TITLE_SETUP, opening)
|
||||
/* 0x05 */ DEFINE_GAMESTATE(FileSelect, GAMESTATE_FILE_SELECT, file_choose)
|
||||
@@ -697,6 +697,16 @@ typedef struct {
|
||||
/* 0x10 */ GameAllocEntry* head;
|
||||
} GameAlloc; // size = 0x14
|
||||
|
||||
// Used in Graph_GetNextGameState in graph.c
|
||||
#define DEFINE_GAMESTATE_INTERNAL(typeName, enumName) enumName,
|
||||
#define DEFINE_GAMESTATE(typeName, enumName, name) DEFINE_GAMESTATE_INTERNAL(typeName, enumName)
|
||||
typedef enum {
|
||||
#include "tables/gamestate_table.h"
|
||||
GAMESTATE_ID_MAX
|
||||
} GameStateId;
|
||||
#undef DEFINE_GAMESTATE
|
||||
#undef DEFINE_GAMESTATE_INTERNAL
|
||||
|
||||
struct GameState;
|
||||
|
||||
typedef void (*GameStateFunc)(struct GameState* gameState);
|
||||
|
||||
Reference in New Issue
Block a user