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

Go to the source code of this file.

Macros

#define DELETE_FILE_DELETE_X   10
 
#define DELETE_FILE_FILE_X   60
 
#define DELETE_FILE_NUMBER_X   98
 
#define DELETE_FILE_QMARK_X   99
 
#define COPY_FILE_NUMBER_X   48
 
#define START_GAME_START_WITH_X   10
 
#define START_GAME_FILE_X   127
 
#define START_GAME_NUMBER_X   165
 
#define START_GAME_QMARK_X   162
 
#define NUMBER_OFFSET_Y   0
 

Functions

void filemenu_yesno_draw_options_contents (MenuPanel *menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)
 
void filemenu_yesno_draw_prompt_contents (MenuPanel *menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)
 
void filemenu_yesno_init (MenuPanel *tab)
 
void filemenu_yesno_handle_input (MenuPanel *menu)
 
void filemenu_yesno_update (MenuPanel *menu)
 
void filemenu_yesno_cleanup (MenuPanel *menu)
 

Variables

u8 filemenu_yesno_gridData []
 
MenuWindowBP filemenu_yesno_windowBPs []
 
MenuPanel filemenu_yesno_menuBP
 

Macro Definition Documentation

◆ DELETE_FILE_DELETE_X

#define DELETE_FILE_DELETE_X   10

Definition at line 20 of file filemenu_yesno.c.

Referenced by filemenu_yesno_draw_prompt_contents().

◆ DELETE_FILE_FILE_X

#define DELETE_FILE_FILE_X   60

Definition at line 21 of file filemenu_yesno.c.

Referenced by filemenu_yesno_draw_prompt_contents().

◆ DELETE_FILE_NUMBER_X

#define DELETE_FILE_NUMBER_X   98

Definition at line 22 of file filemenu_yesno.c.

Referenced by filemenu_yesno_draw_prompt_contents().

◆ DELETE_FILE_QMARK_X

#define DELETE_FILE_QMARK_X   99

Definition at line 23 of file filemenu_yesno.c.

Referenced by filemenu_yesno_draw_prompt_contents().

◆ COPY_FILE_NUMBER_X

#define COPY_FILE_NUMBER_X   48

Definition at line 24 of file filemenu_yesno.c.

Referenced by filemenu_yesno_draw_prompt_contents().

◆ START_GAME_START_WITH_X

#define START_GAME_START_WITH_X   10

Definition at line 25 of file filemenu_yesno.c.

Referenced by filemenu_yesno_draw_prompt_contents().

◆ START_GAME_FILE_X

#define START_GAME_FILE_X   127

Definition at line 26 of file filemenu_yesno.c.

Referenced by filemenu_yesno_draw_prompt_contents().

◆ START_GAME_NUMBER_X

#define START_GAME_NUMBER_X   165

Definition at line 27 of file filemenu_yesno.c.

Referenced by filemenu_yesno_draw_prompt_contents().

◆ START_GAME_QMARK_X

#define START_GAME_QMARK_X   162

Definition at line 28 of file filemenu_yesno.c.

Referenced by filemenu_yesno_draw_prompt_contents().

◆ NUMBER_OFFSET_Y

#define NUMBER_OFFSET_Y   0

Definition at line 29 of file filemenu_yesno.c.

Referenced by filemenu_yesno_draw_prompt_contents().

Function Documentation

◆ filemenu_yesno_draw_options_contents()

void filemenu_yesno_draw_options_contents ( MenuPanel * menu,
s32 baseX,
s32 baseY,
s32 width,
s32 height,
s32 opacity,
s32 darkening )

Definition at line 86 of file filemenu_yesno.c.

91 {
92 s32 xOffset1;
93 s32 yOffset1;
94 s32 xOffset2;
95 s32 yOffset2;
96 s32 cursorGoalXOffset;
97 s32 cursorGoalYOffset;
98
99 switch (menu->state) {
101 xOffset1 = 28;
102 yOffset1 = 4;
103 xOffset2 = 28;
104 yOffset2 = 21;
105 break;
107 xOffset1 = 28;
108 yOffset1 = 4;
109 xOffset2 = 28;
110 yOffset2 = 21;
111 break;
112 case FM_CONFIRM_COPY:
113 xOffset1 = 28;
114 yOffset1 = 4;
115 xOffset2 = 28;
116 yOffset2 = 21;
117 break;
118 case FM_CONFIRM_START:
119 xOffset1 = 28;
120 yOffset1 = 4;
121 xOffset2 = 28;
122 yOffset2 = 21;
123 break;
124 }
125
126 filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_YES), baseX + xOffset1, baseY + yOffset1, 255, MSG_PAL_WHITE, 0);
127 filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_NO), baseX + xOffset2, baseY + yOffset2, 255, MSG_PAL_WHITE, 0);
128
130 if (menu->selected == 0) {
131 cursorGoalXOffset = xOffset1 - 10;
132 cursorGoalYOffset = yOffset1 + 8;
133 } else {
134 cursorGoalXOffset = xOffset2 - 10;
135 cursorGoalYOffset = yOffset2 + 8;
136 }
137 filemenu_set_cursor_goal_pos(WIN_FILES_CONFIRM_OPTIONS, baseX + cursorGoalXOffset, baseY + cursorGoalYOffset);
138 }
139}
@ MSG_PAL_WHITE
Definition enums.h:5405
@ FILE_MESSAGE_NO
Definition enums.h:5353
@ FILE_MESSAGE_YES
Definition enums.h:5352
@ WIN_FILES_CONFIRM_OPTIONS
Definition enums.h:5294
@ FM_CONFIRM_START
Definition filemenu.h:32
@ FM_CONFIRM_COPY
Definition filemenu.h:31
@ FM_CONFIRM_CREATE
Definition filemenu.h:30
@ FM_CONFIRM_DELETE
Definition filemenu.h:29
s8 filemenu_currentMenu
void filemenu_draw_message(u8 *, s32, s32, s32, s32, u32)
@ FILE_MENU_CONFIRM
Definition filemenu.h:18
void filemenu_set_cursor_goal_pos(s32 windowIndex, s32 posX, s32 posY)
u8 * filemenu_get_menu_message(s32 idx)

◆ filemenu_yesno_draw_prompt_contents()

void filemenu_yesno_draw_prompt_contents ( MenuPanel * menu,
s32 baseX,
s32 baseY,
s32 width,
s32 height,
s32 opacity,
s32 darkening )

Definition at line 141 of file filemenu_yesno.c.

146 {
147 s32 selectedFile;
148 s32 msgColor;
149 s32 xOffset;
150 s32 i;
151
152 switch (menu->state) {
158 case FM_CONFIRM_COPY:
159 filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_22), baseX + 10, baseY + 4, 0xFF, 0, 0);
163 break;
166
167 for (i = ARRAY_COUNT(filemenu_filename) - 1; i >= 0; i--) {
169 break;
170 }
171 }
172
173 xOffset = (147 - (i * 11)) / 2;
174 filemenu_draw_file_name(filemenu_filename, i + 1, baseX + xOffset, baseY + 22, 0xFF, 0, 8, 0xB);
175 xOffset += (i + 1) * 11;
176 filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PERIOD_20), baseX + xOffset, baseY + 22, 0xFF, 0, 0);
177 filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OK), baseX + 70, baseY + 38, 0xFF, 0, 0);
178 break;
179 case FM_CONFIRM_START:
180 selectedFile = filemenu_menus[FILE_MENU_MAIN]->selected;
181 if (gSaveSlotMetadata[selectedFile].validData) {
182 msgColor = MSG_PAL_WHITE;
183 } else {
184 msgColor = MSG_PAL_RED;
185 }
190 break;
191 }
192}
@ DRAW_NUMBER_STYLE_ALIGN_RIGHT
drawn to the left of posX
Definition enums.h:5393
@ DRAW_NUMBER_STYLE_MONOSPACE
Definition enums.h:5394
@ MSG_PAL_RED
Definition enums.h:5412
@ DRAW_NUMBER_CHARSET_NORMAL
Definition enums.h:5400
@ FILE_MESSAGE_WILL_BE_DELETED
Definition enums.h:5361
@ FILE_MESSAGE_FILE_22
Definition enums.h:5360
@ FILE_MESSAGE_PERIOD_20
Definition enums.h:5358
@ FILE_MESSAGE_START_GAME_WITH
Definition enums.h:5363
@ FILE_MESSAGE_OK_TO_COPY_TO_THIS_FILE
Definition enums.h:5362
@ FILE_MESSAGE_DELETE
Definition enums.h:5354
@ FILE_MESSAGE_QUESTION
Definition enums.h:5376
@ FILE_MESSAGE_OK
Definition enums.h:5359
@ FILE_MESSAGE_FILE_NAME_IS
Definition enums.h:5357
@ MSG_CHAR_READ_SPACE
Definition enums.h:6050
void filemenu_draw_file_name(u8 *, s32, s32, s32, s32, s32, s32, s32)
MenuPanel * filemenu_menus[]
u8 filemenu_filename[8]
@ FILE_MENU_MAIN
Definition filemenu.h:17
#define DELETE_FILE_NUMBER_X
#define START_GAME_QMARK_X
#define NUMBER_OFFSET_Y
#define START_GAME_FILE_X
#define START_GAME_NUMBER_X
#define START_GAME_START_WITH_X
#define DELETE_FILE_QMARK_X
#define DELETE_FILE_DELETE_X
#define DELETE_FILE_FILE_X
#define COPY_FILE_NUMBER_X
SaveSlotMetadata gSaveSlotMetadata[4]
void draw_number(s32 value, s32 x, s32 y, s32 variableWidthChars, s32 palette, s32 opacity, u16 style)
Definition msg.c:2223
#define ARRAY_COUNT(arr)
Definition macros.h:40

◆ filemenu_yesno_init()

void filemenu_yesno_init ( MenuPanel * tab)

Definition at line 194 of file filemenu_yesno.c.

194 {
195 s32 i;
196
197 for (i = 0; i < ARRAY_COUNT(filemenu_yesno_windowBPs); i++) {
199 }
200
202 tab->initialized = TRUE;
203}
MenuWindowBP filemenu_yesno_windowBPs[]
void setup_pause_menu_tab(MenuWindowBP *bpArray, s32 arraySize)
Definition windows.c:461
MenuPanel * tab

◆ filemenu_yesno_handle_input()

void filemenu_yesno_handle_input ( MenuPanel * menu)

Definition at line 205 of file filemenu_yesno.c.

205 {
206 s32 oldSelected = menu->selected;
207 s32 selected;
208
210 menu->row--;
211 if (menu->row < 0) {
212 menu->row = 0;
213 }
214 }
215
217 menu->row++;
218 if (menu->row >= menu->numRows) {
219 menu->row = menu->numRows - 1;
220 }
221 }
222
224
225 if (oldSelected != menu->selected) {
227 }
228
230 filemenu_set_selected(menu, 0, 0);
232 }
233
235 s32 i;
236
238
239 switch (menu->selected) {
240 case 0: // YES
241 switch (menu->state) {
251
253 for (i = 0; i < ARRAY_COUNT(gSaveSlotSummary->filename); i++) {
255 }
256 gSaveSlotSummary[selected].level = 0;
257 gSaveSlotSummary[selected].timePlayed = 0;
258 gSaveSlotSummary[selected].spiritsRescued = 0;
259 fio_erase_game(selected);
260 gSaveSlotMetadata[selected].hasData = FALSE;
261 gSaveSlotMetadata[selected].validData = FALSE;
262 break;
263 case FM_CONFIRM_COPY:
276 break;
283
285 for (i = 0; i < ARRAY_COUNT(gSaveSlotSummary->filename); i++) {
287 }
288 fio_save_game(selected);
289 gSaveSlotMetadata[selected].hasData = TRUE;
290 gSaveSlotMetadata[selected].validData = TRUE;
291 strcpy(gSaveSlotMetadata[selected].modName, DX_MOD_NAME);
292
314 break;
315 case FM_CONFIRM_START:
318 selected != (u8)gSaveGlobals.lastFileSelected)
319 {
323 }
324 fio_load_game(selected);
326 break;
327 }
328 break;
329 case 1: // NO
330 switch (menu->state) {
332 case FM_CONFIRM_COPY:
335 break;
339 break;
340 case FM_CONFIRM_START:
356 break;
357 }
358 break;
359 }
360 }
361
364 filemenu_set_selected(menu, 0, 1);
365
366 switch (menu->state) {
368 case FM_CONFIRM_COPY:
371 break;
375 break;
376 case FM_CONFIRM_START:
392 break;
393 }
394 }
395}
#define NEW_GAME_STORY_PROGRESS
Story progress when starting a new game.
Definition config.h:38
#define NEW_GAME_MAP_ID
Map to load when starting a new game.
Definition config.h:32
#define DX_MOD_NAME
Creates the version string that appears on the file select menu.
Definition config.h:7
#define NEW_GAME_ENTRY_ID
Entry to use when starting a new game.
Definition config.h:35
@ BUTTON_A
Definition enums.h:2790
@ BUTTON_START
Definition enums.h:2787
@ BUTTON_STICK_UP
Definition enums.h:2791
@ BUTTON_STICK_DOWN
Definition enums.h:2792
@ BUTTON_B
Definition enums.h:2789
@ WINDOW_UPDATE_SHOW
Definition enums.h:5311
@ WINDOW_UPDATE_HIDE
Definition enums.h:5312
@ SOUND_MENU_BACK
Definition enums.h:701
@ SOUND_MENU_CHANGE_SELECTION
Definition enums.h:698
@ SOUND_MENU_NEXT
Definition enums.h:700
@ WIN_FILES_SLOT3_BODY
Definition enums.h:5302
@ WIN_FILES_MESSAGE
Definition enums.h:5291
@ WIN_FILES_TITLE
Definition enums.h:5289
@ WIN_FILES_OPTION_CENTER
Definition enums.h:5298
@ WIN_FILES_OPTION_RIGHT
Definition enums.h:5299
@ WIN_FILES_STEREO
Definition enums.h:5295
@ WIN_FILES_OPTION_LEFT
Definition enums.h:5297
@ WIN_FILES_INPUT_FIELD
Definition enums.h:5292
@ WIN_FILES_SLOT1_BODY
Definition enums.h:5300
@ WIN_FILES_SLOT2_BODY
Definition enums.h:5301
@ WIN_FILES_INPUT_KEYBOARD
Definition enums.h:5293
@ WIN_FILES_MONO
Definition enums.h:5296
@ WIN_FILES_SLOT4_BODY
Definition enums.h:5303
@ FM_MESSAGE_COPIED
Definition filemenu.h:35
@ FM_MESSAGE_CREATED
Definition filemenu.h:36
@ FM_MESSAGE_DELETED
Definition filemenu.h:34
void filemenu_update_deselect_file(s32 windowIdx, s32 *flags, s32 *posX, s32 *posY, s32 *posZ, f32 *scaleX, f32 *scaleY, f32 *rotX, f32 *rotY, f32 *rotZ, s32 *darkening, s32 *opacity)
void filemenu_update_hidden_name_confirm(s32 windowIdx, s32 *flags, s32 *posX, s32 *posY, s32 *posZ, f32 *scaleX, f32 *scaleY, f32 *rotX, f32 *rotY, f32 *rotZ, s32 *darkening, s32 *opacity)
s32 filemenu_heldButtons
#define CENTER_WINDOW_X(id)
Definition filemenu.h:6
s32 filemenu_CopyFromFileIdx
void filemenu_update_show_with_rotation(s32 windowIdx, s32 *flags, s32 *posX, s32 *posY, s32 *posZ, f32 *scaleX, f32 *scaleY, f32 *rotX, f32 *rotY, f32 *rotZ, s32 *darkening, s32 *opacity)
s32 filemenu_CopyToFileIdx
@ FILE_MENU_INPUT_NAME
Definition filemenu.h:20
@ FILE_MENU_MESSAGE
Definition filemenu.h:19
#define CENTER_WINDOW_Y(id)
Definition filemenu.h:11
void filemenu_update_hidden_name_input(s32 windowIdx, s32 *flags, s32 *posX, s32 *posY, s32 *posZ, f32 *scaleX, f32 *scaleY, f32 *rotX, f32 *rotY, f32 *rotZ, s32 *darkening, s32 *opacity)
s32 filemenu_pressedButtons
b32 fio_load_game(s32 saveSlot)
Definition fio.c:167
b32 fio_save_globals(void)
Definition fio.c:90
void fio_erase_game(s32 saveSlot)
Definition fio.c:220
SaveGlobals gSaveGlobals
Definition fio.c:20
void fio_save_game(s32 saveSlot)
Definition fio.c:184
SaveFileSummary gSaveSlotSummary[4]
void clear_saved_variables(void)
Definition vars_access.c:5
void get_map_IDs_by_name_checked(const char *mapName, s16 *areaID, s16 *mapID)
Same as get_map_IDs_by_name, but will panic if the map doesn't exist.
Definition world.c:247
void set_window_update(s32 panelID, s32)
Definition windows.c:434
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
Definition evt.c:1847
void clear_player_data(void)
Definition inventory.c:49
void filemenu_set_selected(MenuPanel *menu, s32 col, s32 row)
void set_game_mode(s32 modeID)
Definition game_modes.c:127
@ GAME_MODE_END_FILE_SELECT
Definition game_modes.h:20
void sfx_play_sound(s32 soundID)
Definition sfx.c:517
@ GB_StoryProgress
#define MENU_PANEL_SELECTED_GRID_DATA(panel)
Definition macros.h:76
GameStatus * gGameStatusPtr
Definition main_loop.c:32
Window gWindows[64]
Definition windows.c:23
s32 useMonoSound
Definition versioning.h:14
u32 lastFileSelected
Definition versioning.h:15

◆ filemenu_yesno_update()

void filemenu_yesno_update ( MenuPanel * menu)

Definition at line 397 of file filemenu_yesno.c.

397 {
398}

◆ filemenu_yesno_cleanup()

void filemenu_yesno_cleanup ( MenuPanel * menu)

Definition at line 400 of file filemenu_yesno.c.

400 {
401}

Variable Documentation

◆ filemenu_yesno_gridData

u8 filemenu_yesno_gridData[]
Initial value:
= {
0, 1,
0, 1,
0, 1,
0, 1,
}

Definition at line 32 of file filemenu_yesno.c.

32 {
33 0, 1,
34 0, 1,
35 0, 1,
36 0, 1,
37};

◆ filemenu_yesno_windowBPs

MenuWindowBP filemenu_yesno_windowBPs[]
Initial value:
= {
{
.unk_01 = 0,
.pos = { .x = 0, .y = 0 },
.width = 0,
.height = 0,
.priority = WINDOW_PRIORITY_64,
.tab = NULL,
.parentID = -1,
.fpUpdate = { WINDOW_UPDATE_HIDE },
.extraFlags = 0,
.style = { .customStyle = &filemenu_windowStyles[19] }
},
{
.unk_01 = 0,
.pos = { .x = 0, .y = 0 },
.width = 0,
.height = 0,
.priority = WINDOW_PRIORITY_0,
.tab = NULL,
.fpUpdate = { WINDOW_UPDATE_SHOW },
.extraFlags = 0,
.style = { .customStyle = &filemenu_windowStyles[19] }
},
}
@ WINDOW_PRIORITY_64
Definition enums.h:3188
@ WINDOW_PRIORITY_0
Definition enums.h:3182
@ WIN_FILES_CONFIRM_PROMPT
Definition enums.h:5290
WindowStyleCustom filemenu_windowStyles[]
void filemenu_yesno_draw_prompt_contents(MenuPanel *menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)
void filemenu_yesno_draw_options_contents(MenuPanel *menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)

Definition at line 39 of file filemenu_yesno.c.

39 {
40 {
41 .windowID = WIN_FILES_CONFIRM_OPTIONS,
42 .unk_01 = 0,
43 .pos = { .x = 0, .y = 0 },
44 .width = 0,
45 .height = 0,
46 .priority = WINDOW_PRIORITY_64,
47 .fpDrawContents = &filemenu_yesno_draw_options_contents,
48 .tab = NULL,
49 .parentID = -1,
50 .fpUpdate = { WINDOW_UPDATE_HIDE },
51 .extraFlags = 0,
52 .style = { .customStyle = &filemenu_windowStyles[19] }
53 },
54 {
55 .windowID = WIN_FILES_CONFIRM_PROMPT,
56 .unk_01 = 0,
57 .pos = { .x = 0, .y = 0 },
58 .width = 0,
59 .height = 0,
60 .priority = WINDOW_PRIORITY_0,
61 .fpDrawContents = &filemenu_yesno_draw_prompt_contents,
62 .tab = NULL,
63 .parentID = WIN_FILES_CONFIRM_OPTIONS,
64 .fpUpdate = { WINDOW_UPDATE_SHOW },
65 .extraFlags = 0,
66 .style = { .customStyle = &filemenu_windowStyles[19] }
67 },
68};

Referenced by filemenu_yesno_init().

◆ filemenu_yesno_menuBP

MenuPanel filemenu_yesno_menuBP
Initial value:
= {
.initialized = FALSE,
.col = 0,
.row = 0,
.selected = 0,
.state = 0,
.numCols = 1,
.numRows = 2,
.numPages = 0,
.fpInit = &filemenu_yesno_init,
.fpHandleInput = &filemenu_yesno_handle_input,
.fpUpdate = &filemenu_yesno_update,
.fpCleanup = &filemenu_yesno_cleanup
}
void filemenu_yesno_update(MenuPanel *menu)
u8 filemenu_yesno_gridData[]
void filemenu_yesno_handle_input(MenuPanel *menu)
void filemenu_yesno_cleanup(MenuPanel *menu)
void filemenu_yesno_init(MenuPanel *tab)

Definition at line 70 of file filemenu_yesno.c.

70 {
71 .initialized = FALSE,
72 .col = 0,
73 .row = 0,
74 .selected = 0,
75 .state = 0,
76 .numCols = 1,
77 .numRows = 2,
78 .numPages = 0,
79 .gridData = filemenu_yesno_gridData,
80 .fpInit = &filemenu_yesno_init,
81 .fpHandleInput = &filemenu_yesno_handle_input,
82 .fpUpdate = &filemenu_yesno_update,
83 .fpCleanup = &filemenu_yesno_cleanup
84};