SSBM Decomp
Loading...
Searching...
No Matches
gm_1A3F.c File Reference
#include "gm_1A3F.h"
#include "gm_1A36.h"
#include "gmmain_lib.h"
#include "gmscdata.h"
#include "gmscene.h"
#include "types.h"
#include <dolphin/vi.h>
#include <melee/db/db.h>
#include <melee/lb/lb_00B0.h>
#include <melee/lb/lbaudio_ax.h>
#include <melee/lb/lbcardgame.h>
#include <melee/lb/lbcardnew.h>
#include <melee/lb/lbdvd.h>
#include <melee/lb/lbheap.h>
#include <melee/lb/lbmthp.h>
#include <melee/lb/lbsnap.h>
#include <melee/lb/types.h>
#include <melee/ty/toy.h>
#include <melee/ty/tydisplay.h>
#include <sysdolphin/baselib/controller.h>
#include <sysdolphin/baselib/devcom.h>
#include <sysdolphin/baselib/sislib.h>
#include <sysdolphin/baselib/video.h>

Data Structures

struct  routingInfo
struct  stateMachine

Functions

 ASSERT_SIZE (struct routingInfo, 0x6)
 ASSERT_SIZE (struct stateMachine, 0x14)
static void preloadState (GameModeState *)
static void gm_801A4014 (GameMode *)
 Runs one game-mode scene transition and invokes the run loop for a given scene.
static u8 runGameMode (u8 mode)
 Loads a game mode, runs it to completion, then unloads it.
static u8 firstState (GameModeState *state, u8 next_id)
static u8 nextState (GameModeState *states)
static GameModeStatefindState (GameModeState *state)
void * gm_GetGameModeStateEnterData (GameModeState *scene)
void * gm_GetGameModeStateExitData (GameModeState *state)
void gm_SetGameModeStateId (u8 id)
 Sets the scene index for both the current and previous scene.
void gm_SetNextGameModeStateId (u8 curr_id)
 Sets the scene index for the pending scene.
u8 gm_GetPreviousSceneIndex (void)
u8 gm_GetCurrentSceneIndex (void)
void gm_SetNewGameModePending (void)
 Sets state_machine's #GameState::pending value to true (1).
void gm_SetPendingGameMode (u8 pending_mode)
 Sets #GameRouting::pending_mode on state_machine to pending_mode for use after the current mode exits.
void gm_ChangeGameModeAfterCurrentScene (int pending_mode)
 Sets #GameRouting::pending_mode and #GameState::pending on state_machine to pending_mode and true (1) for use after the current scene exits,.
u8 gm_GetCurrentGameMode (void)
u8 gm_GetPreviousGameMode (void)
void gm_SetGameModeOverride (u8(*mode)(void))
bool gm_Is1PMode (u8 mode)
static GameModefindMode (u8 kind)
void gm_801A4510 (void)
 UnclePunch: Scene_Main.

Variables

static struct stateMachine state_machine

Function Documentation

◆ ASSERT_SIZE() [1/2]

ASSERT_SIZE ( struct routingInfo ,
0x6  )

◆ ASSERT_SIZE() [2/2]

ASSERT_SIZE ( struct stateMachine ,
0x14  )

◆ preloadState()

void preloadState ( GameModeState * state)
static

◆ gm_801A4014()

void gm_801A4014 ( GameMode * mode)
static

Runs one game-mode scene transition and invokes the run loop for a given scene.

Finds the current GameModeState in mode, runs its Prep handler, loads the scene via gm_FindGameSceneHandler / gm_801A4D34, then advances #GameRouting::curr_scene_idx when the scene loop exits.

<

Todo
regswap hack

◆ runGameMode()

u8 runGameMode ( u8 mode)
static

Loads a game mode, runs it to completion, then unloads it.

Loads the data associated with the given GameModeKind (asset preload and #GameMode::Load), then executes its scene graph via gm_801A4014 until #GameState::pending is set. When the loop finishes, unloads the mode (#GameMode::Unload) unless the game is resetting, then returns #GameRouting::pending_mode, the next pending GameModeKind.

If #GameState::game_mode_override is defined and returns a mode < GM_COUNT, a single scene from that game mode will be executed after the current scene exits, skipping typical game mode load/preload routines for the resulting gamemode. #GameState::pending takes precedence over the override behavior.

See also: gm_ChangeGameModeAfterCurrentScene, gm_SetPendingGameMode, gm_SetNewGameModePending

Returns
The next pending GameModeKind (#GameRouting::pending_mode).

◆ firstState()

u8 firstState ( GameModeState * state,
u8 next_id )
inlinestatic

◆ nextState()

u8 nextState ( GameModeState * states)
inlinestatic

◆ findState()

GameModeState * findState ( GameModeState * state)
inlinestatic

◆ gm_GetGameModeStateEnterData()

void * gm_GetGameModeStateEnterData ( GameModeState * scene)

◆ gm_GetGameModeStateExitData()

void * gm_GetGameModeStateExitData ( GameModeState * state)

◆ gm_SetGameModeStateId()

void gm_SetGameModeStateId ( u8 idx)

Sets the scene index for both the current and previous scene.

Sets #GameRouting::curr_scene_idx and #GameRouting::prev_scene_idx on state_machine.

See docs related to GameModeState.

Parameters
arg0The index of the scene to use. Not to be confused with the scene class_id, which is defined as a GameSceneKind.

◆ gm_SetNextGameModeStateId()

void gm_SetNextGameModeStateId ( u8 pending_scene)

Sets the scene index for the pending scene.

Note
Actually sets the next scene to the scene following the input

Sets #GameRouting::pending_scene_idx on state_machine to arg0 + 1

See docs related to GameModeState.

Parameters
arg0The scene index of the scene preceding the desired pending scene. The method adds +1 to the input. Not to be confused with the scene class_id, which is defined as a GameSceneKind.

◆ gm_GetPreviousSceneIndex()

u8 gm_GetPreviousSceneIndex ( void )

◆ gm_GetCurrentSceneIndex()

u8 gm_GetCurrentSceneIndex ( void )

◆ gm_SetNewGameModePending()

void gm_SetNewGameModePending ( void )

Sets state_machine's #GameState::pending value to true (1).

Signaling that the game mode should change after the current scene exits.

See also: gm_ChangeGameModeAfterCurrentScene, gm_SetPendingGameMode, runGameMode

◆ gm_SetPendingGameMode()

void gm_SetPendingGameMode ( u8 pending_mode)

Sets #GameRouting::pending_mode on state_machine to pending_mode for use after the current mode exits.

Sets the state_machine #GameRouting::pending_mode to the provided value. The pending_mode is read when runGameMode exits, ultimately passing the pending_mode on to the next invocation of runGameMode.

Note that subsequent calls to gm_SetPendingGameMode or gm_ChangeGameModeAfterCurrentScene will override the last one. When a game mode exits, the last call to gm_SetPendingGameMode or gm_ChangeGameModeAfterCurrentScene wins.

See also: gm_ChangeGameModeAfterCurrentScene, gm_SetNewGameModePending, runGameMode

Parameters
pending_modeThe next game mode to use

◆ gm_ChangeGameModeAfterCurrentScene()

void gm_ChangeGameModeAfterCurrentScene ( int pending_mode)

Sets #GameRouting::pending_mode and #GameState::pending on state_machine to pending_mode and true (1) for use after the current scene exits,.

Sets the state_machine #GameRouting::pending_mode to the provided value, setting #GameState::pending to true (1) in the process. The pending_mode is read when runGameMode exits, ultimately passing the pending_mode on to the next invocation of runGameMode.

Effectively equivelant to running gm_SetPendingGameMode and gm_SetNewGameModePending

Note that subsequent calls to gm_SetPendingGameMode or gm_ChangeGameModeAfterCurrentScene will override the last one. When a game mode exits, the last call to gm_SetPendingGameMode or gm_ChangeGameModeAfterCurrentScene wins.

See also: gm_SetPendingGameMode, gm_SetNewGameModePending, runGameMode

Parameters
pending_modeThe next game mode to use

◆ gm_GetCurrentGameMode()

u8 gm_GetCurrentGameMode ( void )

◆ gm_GetPreviousGameMode()

u8 gm_GetPreviousGameMode ( void )

◆ gm_SetGameModeOverride()

void gm_SetGameModeOverride ( u8(* mode )(void))

◆ gm_Is1PMode()

bool gm_Is1PMode ( u8 mode)

◆ findMode()

GameMode * findMode ( u8 kind)
inlinestatic

◆ gm_801A4510()

void gm_801A4510 ( void )

UnclePunch: Scene_Main.

Variable Documentation

◆ state_machine

struct stateMachine state_machine
static