graph TD
Scene[Scene]
Scene --> Room[Room]
Room --> Actors[Actors]
Room --> Objects[Objects]
Scene --> Cutscene[Cutscene]
Actors --> Enemies[Enemies]
Actors --> Plants[Plants]
Last active
January 21, 2025 04:38
-
-
Save benvillalobos/df2c45cce3604d629098de6ec696ffc1 to your computer and use it in GitHub Desktop.
oot-docs
sequenceDiagram
participant Main as main.c
participant Graph as graph.c
participant ZLib as z_game_dlftbls.c
Main ->> Graph: start thread: Graph_ThreadEntry
Graph ->> ZLib: get GAMESTATE_SETUP overlay
Note over ZLib: The overlay table is defined in gamestate_table.h
ZLib ->> Graph: returns GameStateOverlay w/ Setup_Init/Destroy methods
Graph ->> Graph: Overlay_LoadGameState(setupOverlay)
Graph ->> Graph: GameState_Init(Setup_Init)
loop Main Game Loop
Graph ->> Graph: Graph_Update(SetupGameState)
end
Question: How do we get into the opening cutscene?
- Main is (effectively) the entry point.
- Main starts the graphics thread
- From there, Graph_ThreadEntry starts.
- From the overlay table, we grab the GAMESTATE_SETUP overlay.
- GameState_Init is called, it calls the init function (Setup_Init) that was passed.
- Setup_Init initializes a save context, sets running to false, and sets the next gamestate to ConsoleLogo.
- The inner game loop does not run on the first iteration (Setup_Init set running to false).
- The next loaded overlay is ConsoleLogo.
- ConsoleLogo_Init sets ConsoleLogo_Main.
- The inner game loop, Graph_Update is called with the ConsoleLogo game state.
- Graph_Update calls the gamestate's main function, which is ConsoleLogo_Main.
- Once ConsoleLogo_Main is ready to exit, the next gamestate is set to TITLE_SETUP
Old
sequenceDiagram
participant Main as main.c
participant Graph as graph.c
participant ZLib as z_game_dlftbls.c
participant ZGame as game.c
participant ZTitle as title_setup.c
Main ->> Graph: start thread: Graph_ThreadEntry
Graph ->> ZLib: get GAMESTATE_SETUP overlay
Note over ZLib: The overlay table is defined in gamestate_table.h
ZLib ->> Graph: GAMESTATE_SETUP overlay
Graph ->> ZGame: GameState_Init(Setup_Init)
Note over ZTitle: Setup_Init()'s job is to initialize a save<br/>and set next gamestate to ConsoleLogo.
ZGame ->> ZTitle: Setup_Init()
Note over Graph: This loop is skipped the first time due to<br/>Setup_Init setting state->running to false.<br/> The first time we enter this loop is in the ConsoleLogo state
loop While running == true
Graph ->> Graph: Graph_Update(ConsoleLogoState)
end
- z_en_mag.c listens for cutscene flags 3 and 4, which begin fade in / fade out.
- These flags are fired by the intro cutscene
- If the player presses A, B, or Start while en_mag is displayed, it sets the gameMode to file select and starts a transition.
- In z_play.c, if the playState's transitionTrigger is not OFF, set transitionMode to setup., transitionType is also FADE_BLACK
- When the transition mode is SETUP, the SETUP case falls through to INSTANCE_INIT
- Note: The comment next to GAMEMODE_FILE_SELECT suggests that "instance type transitions" are specific to file select.
- At the end of the INSTANCE_INIT case, transitionMode is set to INSTANCE_RUNNING
- state.running is set to false when the transition completes, and the transitionTrigger is not TRIGGER_END
- When the gameMode is not FILE_SELECT, the next gamestate is set to file select.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I take you investigated The Legend of Zelda: Ocarina of Time.