Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
game_modes.c File Reference

Go to the source code of this file.

Data Structures

struct  GameModeData
 

Enumerations

enum  GameModeFlags { MODE_FLAG_NONE = 0 , MODE_FLAG_INITIALIZED = (1 << 0) , MODE_FLAG_NEEDS_STEP = (1 << 1) , MODE_FLAG_HAS_FRONT_UI = (1 << 2) }
 

Functions

void game_mode_nop (void)
 
s32 get_game_mode (void)
 
void set_game_mode (s32 modeID)
 
void clear_game_mode (void)
 
void set_game_mode_render_frontUI (void(*fn)(void))
 
void step_game_mode (void)
 
void render_game_mode_backUI (void)
 
void render_game_mode_frontUI (void)
 

Variables

const GameModeData GameModeTemplates []
 
BSS s32 CurGameModeID
 
BSS GameModeData CurGameMode
 

Enumeration Type Documentation

◆ GameModeFlags

Enumerator
MODE_FLAG_NONE 
MODE_FLAG_INITIALIZED 
MODE_FLAG_NEEDS_STEP 
MODE_FLAG_HAS_FRONT_UI 

Definition at line 3 of file game_modes.c.

3 {
5 MODE_FLAG_INITIALIZED = (1 << 0), // Set when the mode is initialized
6 MODE_FLAG_NEEDS_STEP = (1 << 1), // Turned off after the first step is done
7 MODE_FLAG_HAS_FRONT_UI = (1 << 2), // renderFrontUI function has been assigned
8};
@ MODE_FLAG_NEEDS_STEP
Definition game_modes.c:6
@ MODE_FLAG_NONE
Definition game_modes.c:4
@ MODE_FLAG_INITIALIZED
Definition game_modes.c:5
@ MODE_FLAG_HAS_FRONT_UI
Definition game_modes.c:7

Function Documentation

◆ game_mode_nop()

void game_mode_nop ( void )

Definition at line 120 of file game_modes.c.

120 {
121}

Referenced by set_game_mode(), and set_game_mode_render_frontUI().

◆ get_game_mode()

s32 get_game_mode ( void )

Definition at line 123 of file game_modes.c.

123 {
124 return CurGameModeID;
125}
BSS s32 CurGameModeID
Definition game_modes.c:117

Referenced by filemenu_set_cursor_goal_pos(), pause_set_cursor_pos(), pause_set_cursor_pos_immediate(), and render_curtains().

◆ set_game_mode()

void set_game_mode ( s32 modeID)

Definition at line 127 of file game_modes.c.

127 {
128 GameModeData const* template = &GameModeTemplates[modeID];
129 CurGameModeID = modeID;
130
132 CurGameMode.init = template->init;
133 CurGameMode.step = template->step;
134 CurGameMode.renderBackUI = template->renderBackUI;
135
136 if (CurGameMode.init == NULL) {
138 }
139 if (CurGameMode.step == NULL) {
141 }
142 if (CurGameMode.renderBackUI == NULL) {
144 }
145
148}
void game_mode_nop(void)
Definition game_modes.c:120
BSS GameModeData CurGameMode
Definition game_modes.c:118
const GameModeData GameModeTemplates[]
Definition game_modes.c:18
void(* renderFrontUI)(void)
Definition game_modes.c:15
void(* init)(void)
Definition game_modes.c:12
void(* renderBackUI)(void)
Definition game_modes.c:14
void(* step)(void)
Definition game_modes.c:13

Referenced by btl_state_update_end_battle(), btl_state_update_end_demo_battle(), check_input_open_menus(), filemenu_main_handle_input(), filemenu_yesno_handle_input(), goto_map(), load_battle(), load_engine_data(), pause_handle_input(), state_step_change_map(), state_step_demo(), state_step_end_battle(), state_step_enter_world(), state_step_exit_file_select(), state_step_game_over(), state_step_intro(), state_step_logos(), state_step_startup(), state_step_title_screen(), state_step_unpause(), and step_game_loop().

◆ clear_game_mode()

void clear_game_mode ( void )

Definition at line 150 of file game_modes.c.

150 {
152}

Referenced by load_engine_data().

◆ set_game_mode_render_frontUI()

void set_game_mode_render_frontUI ( void(*)(void) fn)

Definition at line 154 of file game_modes.c.

154 {
157
158 if (fn == NULL) {
160 }
161}

Referenced by state_init_title_screen(), and state_init_world().

◆ step_game_mode()

void step_game_mode ( void )

Definition at line 163 of file game_modes.c.

163 {
165 return;
166 }
167
168 CurGameMode.flags &= ~MODE_FLAG_NEEDS_STEP;
170}

Referenced by step_game_loop().

◆ render_game_mode_backUI()

void render_game_mode_backUI ( void )

Definition at line 172 of file game_modes.c.

172 {
174 return;
175 }
176
178}

Referenced by gfx_draw_frame().

◆ render_game_mode_frontUI()

void render_game_mode_frontUI ( void )

Definition at line 180 of file game_modes.c.

180 {
182 return;
183 }
184
186 return;
187 }
188
191 }
192}

Referenced by gfx_draw_frame().

Variable Documentation

◆ GameModeTemplates

const GameModeData GameModeTemplates[]

Definition at line 18 of file game_modes.c.

18 {
20 .init = state_init_startup,
21 .step = state_step_startup,
22 .renderBackUI = state_drawUI_startup,
23 .renderFrontUI = NULL,
24 },
26 .init = state_init_logos,
27 .step = state_step_logos,
28 .renderBackUI = state_drawUI_logos,
29 .renderFrontUI = NULL,
30 },
34 .renderBackUI = state_drawUI_title_screen,
35 .renderFrontUI = NULL,
36 },
40 .renderBackUI = state_drawUI_enter_world,
41 .renderFrontUI = NULL,
42 },
46 .renderBackUI = state_drawUI_enter_world,
47 .renderFrontUI = NULL,
48 },
50 .init = state_init_world,
51 .step = state_step_world,
52 .renderBackUI = state_drawUI_world,
53 .renderFrontUI = NULL,
54 },
58 .renderBackUI = state_drawUI_change_map,
59 .renderFrontUI = NULL,
60 },
64 .renderBackUI = state_drawUI_game_over,
65 .renderFrontUI = NULL,
66 },
68 .init = state_init_battle,
69 .step = state_step_battle,
70 .renderBackUI = state_drawUI_battle,
71 .renderFrontUI = NULL,
72 },
76 .renderBackUI = state_drawUI_end_battle,
77 .renderFrontUI = NULL,
78 },
80 .init = state_init_pause,
81 .step = state_step_pause,
82 .renderBackUI = state_drawUI_pause,
83 .renderFrontUI = NULL,
84 },
86 .init = state_init_unpause,
87 .step = state_step_unpause,
88 .renderBackUI = state_drawUI_unpause,
89 .renderFrontUI = NULL,
90 },
94 .renderBackUI = state_drawUI_file_select,
95 .renderFrontUI = NULL,
96 },
100 .renderBackUI = state_drawUI_exit_file_select,
101 .renderFrontUI = NULL,
102 },
104 .init = state_init_intro,
105 .step = state_step_intro,
106 .renderBackUI = state_drawUI_intro,
107 .renderFrontUI = NULL,
108 },
110 .init = state_init_demo,
111 .step = state_step_demo,
112 .renderBackUI = state_drawUI_demo,
113 .renderFrontUI = NULL,
114 },
115};
void state_init_startup(void)
void state_init_file_select(void)
void state_step_end_battle(void)
void state_step_exit_file_select(void)
void state_drawUI_enter_world(void)
void state_init_change_map(void)
void state_drawUI_unpause(void)
void state_step_unpause(void)
void state_step_logos(void)
void state_init_pause(void)
Definition state_pause.c:51
void state_init_enter_demo(void)
void state_step_change_map(void)
void state_step_file_select(void)
void state_step_world(void)
Definition state_world.c:20
void state_step_pause(void)
Definition state_pause.c:61
void state_drawUI_exit_file_select(void)
void state_drawUI_title_screen(void)
void state_step_title_screen(void)
void state_init_intro(void)
Definition state_intro.c:26
void state_init_battle(void)
void state_step_startup(void)
void state_init_unpause(void)
void state_init_logos(void)
Definition state_logos.c:66
void state_step_enter_world(void)
void state_drawUI_end_battle(void)
void state_drawUI_startup(void)
void state_step_intro(void)
Definition state_intro.c:92
void state_step_demo(void)
Definition state_demo.c:161
void state_init_game_over(void)
void state_drawUI_change_map(void)
void state_step_game_over(void)
void state_init_exit_file_select(void)
void state_drawUI_game_over(void)
void state_drawUI_world(void)
Definition state_world.c:35
void state_drawUI_demo(void)
Definition state_demo.c:274
void state_drawUI_battle(void)
void state_init_demo(void)
Definition state_demo.c:144
void state_init_title_screen(void)
void state_init_enter_world(void)
void state_init_end_battle(void)
void state_drawUI_logos(void)
void state_init_world(void)
Definition state_world.c:10
void state_drawUI_pause(void)
void state_step_battle(void)
void state_drawUI_file_select(void)
void state_drawUI_intro(void)
@ GAME_MODE_PAUSE
Definition game_modes.h:17
@ GAME_MODE_END_BATTLE
Definition game_modes.h:16
@ GAME_MODE_LOGOS
Definition game_modes.h:8
@ GAME_MODE_UNPAUSE
Definition game_modes.h:18
@ GAME_MODE_DEMO
Definition game_modes.h:22
@ GAME_MODE_ENTER_WORLD
Definition game_modes.h:11
@ GAME_MODE_GAME_OVER
Definition game_modes.h:14
@ GAME_MODE_BATTLE
Definition game_modes.h:15
@ GAME_MODE_WORLD
Definition game_modes.h:12
@ GAME_MODE_END_FILE_SELECT
Definition game_modes.h:20
@ GAME_MODE_FILE_SELECT
Definition game_modes.h:19
@ GAME_MODE_ENTER_DEMO_WORLD
Definition game_modes.h:10
@ GAME_MODE_CHANGE_MAP
Definition game_modes.h:13
@ GAME_MODE_TITLE_SCREEN
Definition game_modes.h:9
@ GAME_MODE_INTRO
Definition game_modes.h:21
@ GAME_MODE_STARTUP
Definition game_modes.h:7

Referenced by set_game_mode().

◆ CurGameModeID

BSS s32 CurGameModeID

Definition at line 117 of file game_modes.c.

Referenced by get_game_mode(), and set_game_mode().

◆ CurGameMode