Paper Mario DX
Paper Mario (N64) modding
Loading...
Searching...
No Matches
filemenu_info.c
Go to the documentation of this file.
1
#include "common.h"
2
#include "
filemenu.h
"
3
#include "
hud_element.h
"
4
5
#if VERSION_PAL
6
extern
u8 D_filemenu_802508FC[];
7
extern
u8 D_filemenu_80250934[];
8
extern
u8 D_filemenu_80250948[];
9
extern
u8 D_filemenu_8025094C[];
10
extern
s8 D_filemenu_80250950[];
11
extern
u8 D_filemenu_80250968[];
12
#endif
13
14
#if VERSION_IQUE
15
#define CREATE_SUCCESS_NUMBER_X 49
16
#define NUMBER_OFFSET_Y 1
17
#else
18
#define NUMBER_OFFSET_Y 0
19
#define CREATE_SUCCESS_NUMBER_X 48
20
#endif
21
22
u8
filemenu_info_gridData
[] = {
23
0, 0, 0, 0
24
};
25
26
MenuWindowBP
filemenu_info_windowBPs
[] = {
27
{
28
.
windowID
=
WIN_FILES_MESSAGE
,
29
.unk_01 = 0,
30
.pos = { .x = 0, .y = 0 },
31
.width = 0,
32
.height = 0,
33
.priority =
WINDOW_PRIORITY_64
,
34
.fpDrawContents = &
filemenu_info_draw_message_contents
,
35
.tab = NULL,
36
.parentID = -1,
37
.fpUpdate = {
WINDOW_UPDATE_HIDE
},
38
.extraFlags = 0,
39
.style = { .customStyle = &
filemenu_windowStyles
[20] }
40
},
41
};
42
43
MenuPanel
filemenu_info_menuBP
= {
44
.
initialized
= FALSE,
45
.col = 0,
46
.row = 0,
47
.selected = 0,
48
.state = 0,
49
.numCols = 1,
50
.numRows = 1,
51
.numPages = 0,
52
.gridData =
filemenu_info_gridData
,
53
.fpInit = &
filemenu_info_init
,
54
.fpHandleInput = &
filemenu_info_handle_input
,
55
.fpUpdate = &
filemenu_info_update
,
56
.fpCleanup = &
filemenu_info_cleanup
57
};
58
59
void
filemenu_info_draw_message_contents
(
60
MenuPanel
* menu,
61
s32 baseX, s32 baseY,
62
s32 width, s32 height,
63
s32 opacity, s32 darkening
64
) {
65
#if VERSION_PAL
66
s32 xOffset;
67
68
switch
(menu->page) {
69
case
FM_MESSAGE_DELETED
:
70
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_28
), baseX + 10, baseY + 4, 255, 0, 0);
71
xOffset = D_filemenu_80250934[
gCurrentLanguage
] + 10;
72
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_FILE_26
), baseX + xOffset, baseY + 4, 255, 0, 0);
73
xOffset += D_filemenu_802508FC[
gCurrentLanguage
];
74
draw_number
(
filemenu_menus
[
FILE_MENU_MAIN
]->selected + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3);
75
xOffset++;
76
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_HAS_BEEN_DELETED
), baseX + xOffset, baseY + 4, 255, 0, 0);
77
break
;
78
case
FM_MESSAGE_COPIED
:
79
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_COPY_FROM
), baseX + 10, baseY + 4, 255, 0, 0);
80
xOffset = D_filemenu_80250948[
gCurrentLanguage
] + 10;
81
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_FILE_26
), baseX + xOffset, baseY + 4, 255, 0, 0);
82
xOffset += D_filemenu_802508FC[
gCurrentLanguage
];
83
draw_number
(
filemenu_CopyFromFileIdx
+ 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3);
84
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_TO
), baseX + 10, baseY + 18, 255, 0, 0);
85
xOffset = D_filemenu_8025094C[
gCurrentLanguage
] + 10;
86
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_FILE_26
), baseX + xOffset, baseY + 18, 255, 0, 0);
87
xOffset += D_filemenu_802508FC[
gCurrentLanguage
];
88
draw_number
(
filemenu_CopyToFileIdx
+ 1, baseX + xOffset, baseY + 0x14, 0, 0, 255, 3);
89
xOffset += D_filemenu_80250950[
gCurrentLanguage
];
90
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_HAS_BEEN_CREATED
), baseX + xOffset, baseY + 18, 255, 0, 0);
91
break
;
92
case
FM_MESSAGE_CREATED
:
93
filemenu_draw_message
(
filemenu_get_menu_message
(0x20), baseX + 10, baseY + 4, 255, 0, 0);
94
xOffset = D_filemenu_80250968[
gCurrentLanguage
] + 10;
95
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_FILE_26
), baseX + xOffset, baseY + 4, 255, 0, 0);
96
xOffset += D_filemenu_802508FC[
gCurrentLanguage
];
97
draw_number
(
filemenu_menus
[
FILE_MENU_MAIN
]->selected + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3);
98
xOffset++;
99
filemenu_draw_message
(
filemenu_get_menu_message
(0x1F), baseX + xOffset, baseY + 4, 255, 0, 0);
100
break
;
101
}
102
#else
103
switch
(menu->
state
) {
104
case
FM_MESSAGE_DELETED
:
105
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_FILE_26
), baseX + 10, baseY + 4, 255, 0, 0);
106
draw_number
(
filemenu_menus
[
FILE_MENU_MAIN
]->selected + 1, baseX + 48, baseY + 6 +
NUMBER_OFFSET_Y
,
DRAW_NUMBER_CHARSET_NORMAL
,
MSG_PAL_WHITE
, 255,
DRAW_NUMBER_STYLE_MONOSPACE
|
DRAW_NUMBER_STYLE_ALIGN_RIGHT
);
107
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_HAS_BEEN_DELETED
), baseX + 49, baseY + 4, 255, 0, 0);
108
break
;
109
case
FM_MESSAGE_COPIED
:
110
#if VERSION_IQUE
111
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_COPY_FROM
), baseX + 10, baseY + 7, 255, 0, 0);
112
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_FILE_26
), baseX + 42, baseY + 7, 255, 0, 0);
113
draw_number
(
filemenu_CopyFromFileIdx
+ 1, baseX + 84, baseY + 10,
DRAW_NUMBER_CHARSET_NORMAL
,
MSG_PAL_WHITE
, 255,
DRAW_NUMBER_STYLE_MONOSPACE
|
DRAW_NUMBER_STYLE_ALIGN_RIGHT
);
114
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_TO
), baseX + 84, baseY + 7, 255, 0, 0);
115
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_FILE_26
), baseX + 100, baseY + 7, 255, 0, 0);
116
draw_number
(
filemenu_CopyToFileIdx
+ 1, baseX + 140, baseY + 10,
DRAW_NUMBER_CHARSET_NORMAL
,
MSG_PAL_WHITE
, 255,
DRAW_NUMBER_STYLE_MONOSPACE
|
DRAW_NUMBER_STYLE_ALIGN_RIGHT
);
117
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_PERIOD_34
), baseX + 140, baseY + 7, 255, 0, 0);
118
#else
119
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_COPY_FROM
), baseX + 10, baseY + 4, 255, 0, 0);
120
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_FILE_26
), baseX + 84, baseY + 4, 255, 0, 0);
121
draw_number
(
filemenu_CopyFromFileIdx
+ 1, baseX + 122, baseY + 6,
DRAW_NUMBER_CHARSET_NORMAL
,
MSG_PAL_WHITE
, 255,
DRAW_NUMBER_STYLE_MONOSPACE
|
DRAW_NUMBER_STYLE_ALIGN_RIGHT
);
122
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_TO
), baseX + 10, baseY + 18, 255, 0, 0);
123
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_FILE_26
), baseX + 30, baseY + 18, 255, 0, 0);
124
draw_number
(
filemenu_CopyToFileIdx
+ 1, baseX + 68, baseY + 20,
DRAW_NUMBER_CHARSET_NORMAL
,
MSG_PAL_WHITE
, 255,
DRAW_NUMBER_STYLE_MONOSPACE
|
DRAW_NUMBER_STYLE_ALIGN_RIGHT
);
125
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_PERIOD_34
), baseX + 65, baseY + 18, 255, 0, 0);
126
#endif
127
break
;
128
case
FM_MESSAGE_CREATED
:
129
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_FILE_26
), baseX + 10, baseY + 4, 255, 0, 0);
130
draw_number
(
filemenu_menus
[
FILE_MENU_MAIN
]->selected + 1, baseX +
CREATE_SUCCESS_NUMBER_X
, baseY + 6 +
NUMBER_OFFSET_Y
,
DRAW_NUMBER_CHARSET_NORMAL
,
MSG_PAL_WHITE
, 255,
DRAW_NUMBER_STYLE_MONOSPACE
|
DRAW_NUMBER_STYLE_ALIGN_RIGHT
);
131
filemenu_draw_message
(
filemenu_get_menu_message
(
FILE_MESSAGE_HAS_BEEN_CREATED
), baseX + 49, baseY + 4, 255, 0, 0);
132
break
;
133
}
134
#endif
135
filemenu_set_cursor_alpha
(0);
136
}
137
138
void
filemenu_info_init
(
MenuPanel
* tab) {
139
s32 i;
140
141
for
(i = 0; i <
ARRAY_COUNT
(
filemenu_info_windowBPs
); i++) {
142
filemenu_info_windowBPs
[i].
tab
= tab;
143
}
144
145
setup_pause_menu_tab
(
filemenu_info_windowBPs
,
ARRAY_COUNT
(
filemenu_info_windowBPs
));
146
tab->
initialized
= TRUE;
147
}
148
149
void
filemenu_info_handle_input
(
MenuPanel
* menu) {
150
if
(
filemenu_pressedButtons
& (
BUTTON_A
|
BUTTON_B
)) {
151
MenuPanel
* menu =
filemenu_menus
[
FILE_MENU_MAIN
];
152
153
filemenu_currentMenu
=
FILE_MENU_MAIN
;
154
155
switch
(menu->
state
) {
156
case
FILE_MENU_CONFIRM
:
157
menu->
state
=
FILE_MENU_MAIN
;
158
set_window_update
(
WIN_FILES_STEREO
, (s32)
filemenu_update_show_options_left
);
159
set_window_update
(
WIN_FILES_MONO
, (s32)
filemenu_update_show_options_right
);
160
set_window_update
(
WIN_FILES_OPTION_LEFT
, (s32)
filemenu_update_show_options_bottom
);
161
set_window_update
(
WIN_FILES_OPTION_RIGHT
, (s32)
filemenu_update_show_options_bottom
);
162
filemenu_set_selected
(menu, 0, 2);
163
break
;
164
case
FILE_MENU_MESSAGE
:
165
menu->
state
=
FILE_MENU_MESSAGE
;
166
filemenu_set_selected
(menu, 1, 2);
167
break
;
168
}
169
set_window_update
(
WIN_FILES_MESSAGE
,
WINDOW_UPDATE_HIDE
);
170
}
171
}
172
173
void
filemenu_info_update
(
MenuPanel
* menu) {
174
}
175
176
void
filemenu_info_cleanup
(
MenuPanel
* menu) {
177
}
178
DRAW_NUMBER_STYLE_ALIGN_RIGHT
@ DRAW_NUMBER_STYLE_ALIGN_RIGHT
drawn to the left of posX
Definition
enums.h:5393
DRAW_NUMBER_STYLE_MONOSPACE
@ DRAW_NUMBER_STYLE_MONOSPACE
Definition
enums.h:5394
BUTTON_A
@ BUTTON_A
Definition
enums.h:2790
BUTTON_B
@ BUTTON_B
Definition
enums.h:2789
WINDOW_PRIORITY_64
@ WINDOW_PRIORITY_64
Definition
enums.h:3188
MSG_PAL_WHITE
@ MSG_PAL_WHITE
Definition
enums.h:5405
WINDOW_UPDATE_HIDE
@ WINDOW_UPDATE_HIDE
Definition
enums.h:5312
DRAW_NUMBER_CHARSET_NORMAL
@ DRAW_NUMBER_CHARSET_NORMAL
Definition
enums.h:5400
FILE_MESSAGE_28
@ FILE_MESSAGE_28
Definition
enums.h:5366
FILE_MESSAGE_FILE_26
@ FILE_MESSAGE_FILE_26
Definition
enums.h:5364
FILE_MESSAGE_PERIOD_34
@ FILE_MESSAGE_PERIOD_34
Definition
enums.h:5377
FILE_MESSAGE_COPY_FROM
@ FILE_MESSAGE_COPY_FROM
Definition
enums.h:5367
FILE_MESSAGE_HAS_BEEN_DELETED
@ FILE_MESSAGE_HAS_BEEN_DELETED
Definition
enums.h:5365
FILE_MESSAGE_TO
@ FILE_MESSAGE_TO
Definition
enums.h:5368
FILE_MESSAGE_HAS_BEEN_CREATED
@ FILE_MESSAGE_HAS_BEEN_CREATED
Definition
enums.h:5369
WIN_FILES_MESSAGE
@ WIN_FILES_MESSAGE
Definition
enums.h:5291
WIN_FILES_OPTION_RIGHT
@ WIN_FILES_OPTION_RIGHT
Definition
enums.h:5299
WIN_FILES_STEREO
@ WIN_FILES_STEREO
Definition
enums.h:5295
WIN_FILES_OPTION_LEFT
@ WIN_FILES_OPTION_LEFT
Definition
enums.h:5297
WIN_FILES_MONO
@ WIN_FILES_MONO
Definition
enums.h:5296
filemenu.h
filemenu_windowStyles
WindowStyleCustom filemenu_windowStyles[]
Definition
filemenu_styles.c:6
FM_MESSAGE_COPIED
@ FM_MESSAGE_COPIED
Definition
filemenu.h:35
FM_MESSAGE_CREATED
@ FM_MESSAGE_CREATED
Definition
filemenu.h:36
FM_MESSAGE_DELETED
@ FM_MESSAGE_DELETED
Definition
filemenu.h:34
filemenu_currentMenu
s8 filemenu_currentMenu
Definition
filemenu_common.c:124
filemenu_draw_message
void filemenu_draw_message(u8 *, s32, s32, s32, s32, u32)
Definition
filemenu_msg.c:617
filemenu_menus
MenuPanel * filemenu_menus[]
Definition
filemenu_common.c:19
filemenu_CopyFromFileIdx
s32 filemenu_CopyFromFileIdx
Definition
filemenu_common.c:123
filemenu_update_show_options_left
void filemenu_update_show_options_left(s32 windowIdx, s32 *flags, s32 *posX, s32 *posY, s32 *posZ, f32 *scaleX, f32 *scaleY, f32 *rotX, f32 *rotY, f32 *rotZ, s32 *darkening, s32 *opacity)
Definition
filemenu_common.c:353
filemenu_update_show_options_right
void filemenu_update_show_options_right(s32 windowIdx, s32 *flags, s32 *posX, s32 *posY, s32 *posZ, f32 *scaleX, f32 *scaleY, f32 *rotX, f32 *rotY, f32 *rotZ, s32 *darkening, s32 *opacity)
Definition
filemenu_common.c:377
filemenu_CopyToFileIdx
s32 filemenu_CopyToFileIdx
Definition
filemenu_common.c:118
FILE_MENU_CONFIRM
@ FILE_MENU_CONFIRM
Definition
filemenu.h:18
FILE_MENU_MESSAGE
@ FILE_MENU_MESSAGE
Definition
filemenu.h:19
FILE_MENU_MAIN
@ FILE_MENU_MAIN
Definition
filemenu.h:17
filemenu_update_show_options_bottom
void filemenu_update_show_options_bottom(s32 windowIdx, s32 *flags, s32 *posX, s32 *posY, s32 *posZ, f32 *scaleX, f32 *scaleY, f32 *rotX, f32 *rotY, f32 *rotZ, s32 *darkening, s32 *opacity)
Definition
filemenu_common.c:401
filemenu_pressedButtons
s32 filemenu_pressedButtons
Definition
filemenu_common.c:119
filemenu_info_gridData
u8 filemenu_info_gridData[]
Definition
filemenu_info.c:22
filemenu_info_handle_input
void filemenu_info_handle_input(MenuPanel *menu)
Definition
filemenu_info.c:149
filemenu_info_draw_message_contents
void filemenu_info_draw_message_contents(MenuPanel *menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)
Definition
filemenu_info.c:59
NUMBER_OFFSET_Y
#define NUMBER_OFFSET_Y
Definition
filemenu_info.c:18
filemenu_info_cleanup
void filemenu_info_cleanup(MenuPanel *menu)
Definition
filemenu_info.c:176
CREATE_SUCCESS_NUMBER_X
#define CREATE_SUCCESS_NUMBER_X
Definition
filemenu_info.c:19
filemenu_info_windowBPs
MenuWindowBP filemenu_info_windowBPs[]
Definition
filemenu_info.c:26
filemenu_info_update
void filemenu_info_update(MenuPanel *menu)
Definition
filemenu_info.c:173
filemenu_info_menuBP
MenuPanel filemenu_info_menuBP
Definition
filemenu_info.c:43
filemenu_info_init
void filemenu_info_init(MenuPanel *tab)
Definition
filemenu_info.c:138
set_window_update
void set_window_update(s32 panelID, s32)
Definition
windows.c:434
setup_pause_menu_tab
void setup_pause_menu_tab(MenuWindowBP *bpArray, s32 arraySize)
Definition
windows.c:461
filemenu_set_cursor_alpha
void filemenu_set_cursor_alpha(s32 arg0)
Definition
filemenu_common.c:158
filemenu_get_menu_message
u8 * filemenu_get_menu_message(s32 idx)
Definition
filemenu_msg.c:664
filemenu_set_selected
void filemenu_set_selected(MenuPanel *menu, s32 col, s32 row)
Definition
filemenu_common.c:151
draw_number
void draw_number(s32 value, s32 x, s32 y, s32 variableWidthChars, s32 palette, s32 opacity, u16 style)
Definition
msg.c:2223
hud_element.h
ARRAY_COUNT
#define ARRAY_COUNT(arr)
Definition
macros.h:40
MenuPanel
Definition
common_structs.h:2081
MenuPanel::state
s8 state
Definition
common_structs.h:2086
MenuPanel::initialized
b8 initialized
Definition
common_structs.h:2082
MenuWindowBP
Definition
common_structs.h:2139
MenuWindowBP::windowID
s8 windowID
Definition
common_structs.h:2140
MenuWindowBP::tab
MenuPanel * tab
Definition
common_structs.h:2148
gCurrentLanguage
#define gCurrentLanguage
Definition
variables.h:115
src
filemenu
filemenu_info.c
Generated by
1.10.0