ingame_menu.h (6594B)
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 // They didn't change it everywhere in iQue 31 #ifdef VERSION_CN 32 #define HUD_LUT_DIFF2 HUD_LUT_JPMENU 33 #else 34 #define HUD_LUT_DIFF2 HUD_LUT_DIFF 35 #endif 36 37 enum MenuMode { 38 MENU_MODE_NONE = -1, 39 MENU_MODE_UNUSED_0, 40 MENU_MODE_RENDER_PAUSE_SCREEN, 41 MENU_MODE_RENDER_COURSE_COMPLETE_SCREEN, 42 MENU_MODE_UNUSED_3 43 }; 44 45 extern s8 gDialogCourseActNum; 46 extern s8 gHudFlash; 47 48 struct DialogEntry { 49 /*0x00*/ u32 unused; 50 /*0x04*/ s8 linesPerBox; 51 /*0x06*/ s16 leftOffset; 52 /*0x08*/ s16 width; 53 /*0x0C*/ const u8 *str; 54 }; 55 56 // EU only 57 enum HudSpecialCharsEU { 58 HUD_CHAR_A_UMLAUT = 0x3A, 59 HUD_CHAR_O_UMLAUT = 0x3B, 60 HUD_CHAR_U_UMLAUT = 0x3C 61 }; 62 63 enum SpecialFontChars { 64 GLOBAL_CHAR_SPACE = 0x9E, 65 #ifdef VERSION_CN 66 GLOBAL_CHAR_NEWLINE = 0xFE, 67 #endif 68 GLOBAL_CHAR_TERMINATOR = 0xFF 69 }; 70 71 enum DialogMark { 72 DIALOG_MARK_NONE, 73 DIALOG_MARK_DAKUTEN, 74 DIALOG_MARK_HANDAKUTEN 75 }; 76 77 // definitions for some of the special characters defined in charmap.txt 78 enum DialogSpecialChars { 79 #ifdef VERSION_EU 80 DIALOG_CHAR_LOWER_A_GRAVE = 0x60, // 'a' grave 81 DIALOG_CHAR_LOWER_A_CIRCUMFLEX = 0x61, // 'a' circumflex 82 DIALOG_CHAR_LOWER_A_UMLAUT = 0x62, // 'a' umlaut 83 DIALOG_CHAR_UPPER_A_GRAVE = 0x64, // 'A' grave 84 DIALOG_CHAR_UPPER_A_CIRCUMFLEX = 0x65, // 'A' circumflex 85 DIALOG_CHAR_UPPER_A_UMLAUT = 0x66, // 'A' umlaut 86 DIALOG_CHAR_LOWER_E_GRAVE = 0x70, // 'e' grave 87 DIALOG_CHAR_LOWER_E_CIRCUMFLEX = 0x71, // 'e' circumflex 88 DIALOG_CHAR_LOWER_E_UMLAUT = 0x72, // 'e' umlaut 89 DIALOG_CHAR_LOWER_E_ACUTE = 0x73, // 'e' acute 90 DIALOG_CHAR_UPPER_E_GRAVE = 0x74, // 'E' grave 91 DIALOG_CHAR_UPPER_E_CIRCUMFLEX = 0x75, // 'E' circumflex 92 DIALOG_CHAR_UPPER_E_UMLAUT = 0x76, // 'E' umlaut 93 DIALOG_CHAR_UPPER_E_ACUTE = 0x77, // 'E' acute 94 DIALOG_CHAR_LOWER_U_GRAVE = 0x80, // 'u' grave 95 DIALOG_CHAR_LOWER_U_CIRCUMFLEX = 0x81, // 'u' circumflex 96 DIALOG_CHAR_LOWER_U_UMLAUT = 0x82, // 'u' umlaut 97 DIALOG_CHAR_UPPER_U_GRAVE = 0x84, // 'U' grave 98 DIALOG_CHAR_UPPER_U_CIRCUMFLEX = 0x85, // 'U' circumflex 99 DIALOG_CHAR_UPPER_U_UMLAUT = 0x86, // 'U' umlaut 100 DIALOG_CHAR_LOWER_O_CIRCUMFLEX = 0x91, // 'o' circumflex 101 DIALOG_CHAR_LOWER_O_UMLAUT = 0x92, // 'o' umlaut 102 DIALOG_CHAR_UPPER_O_CIRCUMFLEX = 0x95, // 'O' circumflex 103 DIALOG_CHAR_UPPER_O_UMLAUT = 0x96, // 'O' umlaut 104 DIALOG_CHAR_LOWER_I_CIRCUMFLEX = 0xA1, // 'i' circumflex 105 DIALOG_CHAR_LOWER_I_UMLAUT = 0xA2, // 'i' umlaut 106 DIALOG_CHAR_I_NO_DIA = 0xEB, // 'i' without diacritic 107 DIALOG_CHAR_DOUBLE_LOW_QUOTE = 0xF0, // German opening quotation mark 108 #endif 109 #if defined(VERSION_US) || defined(VERSION_EU) || defined(VERSION_CN) 110 DIALOG_CHAR_SLASH = 0xD0, 111 DIALOG_CHAR_MULTI_THE = 0xD1, // 'the' 112 DIALOG_CHAR_MULTI_YOU = 0xD2, // 'you' 113 #endif 114 DIALOG_CHAR_PERIOD = 0x6E, 115 DIALOG_CHAR_COMMA = 0x6F, 116 DIALOG_CHAR_SPACE = 0x9E, 117 DIALOG_CHAR_STAR_COUNT = 0xE0, // number of stars 118 DIALOG_CHAR_UMLAUT = 0xE9, 119 DIALOG_CHAR_MARK_START = 0xEF, 120 DIALOG_CHAR_DAKUTEN = DIALOG_CHAR_MARK_START + DIALOG_MARK_DAKUTEN, 121 DIALOG_CHAR_PERIOD_OR_HANDAKUTEN = DIALOG_CHAR_MARK_START + DIALOG_MARK_HANDAKUTEN, 122 DIALOG_CHAR_STAR_FILLED = 0xFA, 123 DIALOG_CHAR_STAR_OPEN = 0xFD, 124 DIALOG_CHAR_NEWLINE = 0xFE, 125 DIALOG_CHAR_TERMINATOR = 0xFF 126 }; 127 128 #ifdef VERSION_CN 129 #define DIALOG_CHAR_SPECIAL_MODIFIER 0xFF 130 #define SPECIAL_CHAR(x) (DIALOG_CHAR_SPECIAL_MODIFIER << 8 | (x)) 131 #else 132 #define SPECIAL_CHAR(x) (x) 133 #endif 134 135 // gDialogResponse 136 enum DialogResponseDefines { 137 DIALOG_RESPONSE_NONE, 138 DIALOG_RESPONSE_YES, 139 DIALOG_RESPONSE_NO, 140 DIALOG_RESPONSE_NOT_DEFINED 141 }; 142 143 extern s32 gDialogResponse; 144 extern u16 gMenuTextColorTransTimer; 145 extern s8 gLastDialogLineNum; 146 extern s32 gDialogVariable; 147 extern u16 gMenuTextAlpha; 148 extern s16 gCutsceneMsgXOffset; 149 extern s16 gCutsceneMsgYOffset; 150 extern s8 gRedCoinsCollected; 151 152 void create_dl_identity_matrix(void); 153 void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z); 154 void create_dl_ortho_matrix(void); 155 156 void print_generic_string(s16 x, s16 y, const u8 *str); 157 void print_hud_lut_string(s8 hudLUT, s16 x, s16 y, const u8 *str); 158 void print_menu_generic_string(s16 x, s16 y, const u8 *str); 159 160 void handle_menu_scrolling(s8 scrollDirection, s8 *currentIndex, s8 minIndex, s8 maxIndex); 161 #if defined(VERSION_US) || defined(VERSION_EU) || defined(VERSION_CN) 162 s16 get_str_x_pos_from_center(s16 centerPos, u8 *str, f32 scale); 163 #endif 164 #if defined(VERSION_JP) || defined(VERSION_SH) 165 #define get_str_x_pos_from_center get_str_x_pos_from_center_scale 166 #endif 167 #if defined(VERSION_JP) || defined(VERSION_EU) || defined(VERSION_SH) 168 s16 get_str_x_pos_from_center_scale(s16 centerPos, u8 *str, f32 scale); 169 #endif 170 void print_hud_my_score_coins(s32 useCourseCoinScore, s8 fileIndex, s8 courseIndex, s16 x, s16 y); 171 172 void int_to_str(s32 num, u8 *dst); 173 174 #ifdef VERSION_CN 175 void int_to_str_2(s32 num, u8 *dst); 176 #endif 177 178 #ifdef VERSION_CN 179 #define INT_TO_STR_DIFF int_to_str_2 180 #else 181 #define INT_TO_STR_DIFF int_to_str 182 #endif 183 184 s16 get_dialog_id(void); 185 void create_dialog_box(s16 dialog); 186 void create_dialog_box_with_var(s16 dialog, s32 dialogVar); 187 void create_dialog_inverted_box(s16 dialog); 188 void create_dialog_box_with_response(s16 dialog); 189 void reset_dialog_render_state(void); 190 void set_menu_mode(s16 mode); 191 void reset_cutscene_msg_fade(void); 192 void dl_rgba16_begin_cutscene_msg_fade(void); 193 void dl_rgba16_stop_cutscene_msg_fade(void); 194 void print_credits_str_ascii(s16 x, s16 y, const char *str); 195 void set_cutscene_message(s16 xOffset, s16 yOffset, s16 msgIndex, s16 msgDuration); 196 void do_cutscene_handler(void); 197 void render_hud_cannon_reticle(void); 198 void reset_red_coins_collected(void); 199 s16 render_menus_and_dialogs(void); 200 201 #endif // INGAME_MENU_H