Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/src/game/ingame_menu.h
7858 views
1
#ifndef INGAME_MENU_H
2
#define INGAME_MENU_H
3
4
#include <PR/ultratypes.h>
5
6
#define ASCII_TO_DIALOG(asc) \
7
(((asc) >= '0' && (asc) <= '9') ? ((asc) - '0') : \
8
((asc) >= 'A' && (asc) <= 'Z') ? ((asc) - 'A' + 0x0A) : \
9
((asc) >= 'a' && (asc) <= 'z') ? ((asc) - 'a' + 0x24) : 0x00)
10
11
12
#define MENU_MTX_PUSH 1
13
#define MENU_MTX_NOPUSH 2
14
15
#define MENU_SCROLL_VERTICAL 1
16
#define MENU_SCROLL_HORIZONTAL 2
17
18
// Japanese File Select uses an unique table
19
// to print specific Japanese HUD chars
20
#define HUD_LUT_JPMENU 1
21
#define HUD_LUT_GLOBAL 2
22
23
// For file select JP HUD difference
24
#if defined(VERSION_JP) || defined(VERSION_SH)
25
#define HUD_LUT_DIFF HUD_LUT_JPMENU
26
#else
27
#define HUD_LUT_DIFF HUD_LUT_GLOBAL
28
#endif
29
30
enum MenuMode {
31
MENU_MODE_NONE = -1,
32
MENU_MODE_UNUSED_0,
33
MENU_MODE_RENDER_PAUSE_SCREEN,
34
MENU_MODE_RENDER_COURSE_COMPLETE_SCREEN,
35
MENU_MODE_UNUSED_3
36
};
37
38
extern s8 gDialogCourseActNum;
39
extern s8 gHudFlash;
40
41
struct DialogEntry
42
{
43
/*0x00*/ u32 unused;
44
/*0x04*/ s8 linesPerBox;
45
/*0x06*/ s16 leftOffset;
46
/*0x08*/ s16 width;
47
/*0x0C*/ const u8 *str;
48
};
49
50
// EU only
51
enum HudSpecialHUDChars {
52
HUD_CHAR_A_UMLAUT = 0x3A,
53
HUD_CHAR_O_UMLAUT = 0x3B,
54
HUD_CHAR_U_UMLAUT = 0x3C
55
};
56
57
enum SpecialFontChars {
58
GLOBAL_CHAR_SPACE = 0x9E,
59
GLOBAR_CHAR_TERMINATOR = 0xFF
60
};
61
62
// definitions for some of the special characters defined in charmap.txt
63
enum DialogSpecialChars {
64
#ifdef VERSION_EU
65
DIALOG_CHAR_LOWER_A_GRAVE = 0x60, // 'a' grave
66
DIALOG_CHAR_LOWER_A_CIRCUMFLEX = 0x61, // 'a' circumflex
67
DIALOG_CHAR_LOWER_A_UMLAUT = 0x62, // 'a' umlaut
68
DIALOG_CHAR_UPPER_A_GRAVE = 0x64, // 'A' grave
69
DIALOG_CHAR_UPPER_A_CIRCUMFLEX = 0x65, // 'A' circumflex
70
DIALOG_CHAR_UPPER_A_UMLAUT = 0x66, // 'A' umlaut
71
DIALOG_CHAR_LOWER_E_GRAVE = 0x70, // 'e' grave
72
DIALOG_CHAR_LOWER_E_CIRCUMFLEX = 0x71, // 'e' circumflex
73
DIALOG_CHAR_LOWER_E_UMLAUT = 0x72, // 'e' umlaut
74
DIALOG_CHAR_LOWER_E_ACUTE = 0x73, // 'e' acute
75
DIALOG_CHAR_UPPER_E_GRAVE = 0x74, // 'E' grave
76
DIALOG_CHAR_UPPER_E_CIRCUMFLEX = 0x75, // 'E' circumflex
77
DIALOG_CHAR_UPPER_E_UMLAUT = 0x76, // 'E' umlaut
78
DIALOG_CHAR_UPPER_E_ACUTE = 0x77, // 'E' acute
79
DIALOG_CHAR_LOWER_U_GRAVE = 0x80, // 'u' grave
80
DIALOG_CHAR_LOWER_U_CIRCUMFLEX = 0x81, // 'u' circumflex
81
DIALOG_CHAR_LOWER_U_UMLAUT = 0x82, // 'u' umlaut
82
DIALOG_CHAR_UPPER_U_GRAVE = 0x84, // 'U' grave
83
DIALOG_CHAR_UPPER_U_CIRCUMFLEX = 0x85, // 'U' circumflex
84
DIALOG_CHAR_UPPER_U_UMLAUT = 0x86, // 'U' umlaut
85
DIALOG_CHAR_LOWER_O_CIRCUMFLEX = 0x91, // 'o' circumflex
86
DIALOG_CHAR_LOWER_O_UMLAUT = 0x92, // 'o' umlaut
87
DIALOG_CHAR_UPPER_O_CIRCUMFLEX = 0x95, // 'O' circumflex
88
DIALOG_CHAR_UPPER_O_UMLAUT = 0x96, // 'O' umlaut
89
DIALOG_CHAR_LOWER_I_CIRCUMFLEX = 0xA1, // 'i' circumflex
90
DIALOG_CHAR_LOWER_I_UMLAUT = 0xA2, // 'i' umlaut
91
DIALOG_CHAR_I_NO_DIA = 0xEB, // 'i' without diacritic
92
DIALOG_CHAR_DOUBLE_LOW_QUOTE = 0xF0, // German opening quotation mark
93
#endif
94
#if defined(VERSION_US) || defined(VERSION_EU)
95
DIALOG_CHAR_SLASH = 0xD0,
96
DIALOG_CHAR_MULTI_THE = 0xD1, // 'the'
97
DIALOG_CHAR_MULTI_YOU = 0xD2, // 'you'
98
#endif
99
DIALOG_CHAR_PERIOD = 0x6E,
100
DIALOG_CHAR_COMMA = 0x6F,
101
DIALOG_CHAR_SPACE = 0x9E,
102
DIALOG_CHAR_STAR_COUNT = 0xE0, // number of stars
103
DIALOG_CHAR_UMLAUT = 0xE9,
104
DIALOG_CHAR_DAKUTEN = 0xF0,
105
DIALOG_CHAR_PERIOD_OR_HANDAKUTEN = 0xF1,
106
DIALOG_CHAR_STAR_FILLED = 0xFA,
107
DIALOG_CHAR_STAR_OPEN = 0xFD,
108
DIALOG_CHAR_NEWLINE = 0xFE,
109
DIALOG_CHAR_TERMINATOR = 0xFF
110
};
111
112
// gDialogResponse
113
enum DialogResponseDefines {
114
DIALOG_RESPONSE_NONE,
115
DIALOG_RESPONSE_YES,
116
DIALOG_RESPONSE_NO,
117
DIALOG_RESPONSE_NOT_DEFINED
118
};
119
120
extern s32 gDialogResponse;
121
extern u16 gDialogColorFadeTimer;
122
extern s8 gLastDialogLineNum;
123
extern s32 gDialogVariable;
124
extern u16 gDialogTextAlpha;
125
extern s16 gCutsceneMsgXOffset;
126
extern s16 gCutsceneMsgYOffset;
127
extern s8 gRedCoinsCollected;
128
129
void create_dl_identity_matrix(void);
130
void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z);
131
void create_dl_ortho_matrix(void);
132
void print_generic_string(s16 x, s16 y, const u8 *str);
133
void print_hud_lut_string(s8 hudLUT, s16 x, s16 y, const u8 *str);
134
void print_hud_lut_string_to_displaylist(s8 hudLUT, s16 x, s16 y, const u8 *str, Gfx* displayList);
135
void print_menu_generic_string(s16 x, s16 y, const u8 *str);
136
void handle_menu_scrolling(s8 scrollDirection, s8 *currentIndex, s8 minIndex, s8 maxIndex);
137
#if defined(VERSION_US) || defined(VERSION_EU)
138
s16 get_str_x_pos_from_center(s16 centerPos, u8 *str, f32 scale);
139
#endif
140
#if defined(VERSION_JP) || defined(VERSION_SH)
141
#define get_str_x_pos_from_center get_str_x_pos_from_center_scale
142
#endif
143
#if defined(VERSION_JP) || defined(VERSION_EU) || defined(VERSION_SH)
144
s16 get_str_x_pos_from_center_scale(s16 centerPos, u8 *str, f32 scale);
145
#endif
146
void print_hud_my_score_coins(s32 useCourseCoinScore, s8 fileNum, s8 courseNum, s16 x, s16 y);
147
void int_to_str(s32 num, u8 *dst);
148
s16 get_dialog_id(void);
149
void create_dialog_box(s16 dialog);
150
void create_dialog_box_with_var(s16 dialog, s32 dialogVar);
151
void create_dialog_inverted_box(s16 dialog);
152
void create_dialog_box_with_response(s16 dialog);
153
void reset_dialog_render_state(void);
154
void set_menu_mode(s16 mode);
155
void reset_cutscene_msg_fade(void);
156
void dl_rgba16_begin_cutscene_msg_fade(void);
157
void dl_rgba16_stop_cutscene_msg_fade(void);
158
void print_credits_str_ascii(s16 x, s16 y, const char *str);
159
void set_cutscene_message(s16 xOffset, s16 yOffset, s16 msgIndex, s16 msgDuration);
160
void do_cutscene_handler(void);
161
void render_hud_cannon_reticle(void);
162
void reset_red_coins_collected(void);
163
s16 render_menus_and_dialogs(void);
164
165
#endif // INGAME_MENU_H
166
167