|
1 | 1 | #pragma once
|
2 | 2 |
|
| 3 | +#include "commonfunctions.h" |
| 4 | + |
3 | 5 | #include <gc/OSAlloc.h>
|
4 | 6 | #include <gc/pad.h>
|
5 | 7 | #include <gc/DEMOPad.h>
|
6 | 8 | #include <ttyd/item_data.h>
|
7 | 9 | #include <ttyd/mapdata.h>
|
| 10 | +#include <ttyd/msgdrv.h> |
8 | 11 |
|
9 | 12 | #include <cstdint>
|
| 13 | +#include <cstring> |
10 | 14 |
|
11 | 15 | namespace mod {
|
12 | 16 |
|
@@ -240,6 +244,7 @@ enum CHEATS_CLEAR_AREA_FLAGS_AREAS
|
240 | 244 | #define ADDING_BY_ICON 0x2108
|
241 | 245 | #define SPAWN_ITEM_MENU_VALUE 0x3000
|
242 | 246 | #define STATS_PARTNER_DISPLAY_YOSHI_COLORS 100
|
| 247 | +#define STATS_PARTNER_DISPLAY_YOSHI_NAME 101 |
243 | 248 |
|
244 | 249 | enum STATS_MARIO_SELECTION_OPTIONS
|
245 | 250 | {
|
@@ -268,6 +273,8 @@ enum STATS_PARTNER_SELECTION_OPTIONS
|
268 | 273 | PARTNER_MAX_HP,
|
269 | 274 | PARTNER_RANK,
|
270 | 275 | TOGGLE,
|
| 276 | + CHANGE_YOSHI_COLOR, |
| 277 | + CHANGE_YOSHI_NAME, |
271 | 278 | };
|
272 | 279 |
|
273 | 280 | enum STATS_FOLLOWER_SELECTION_OPTIONS
|
@@ -595,8 +602,8 @@ struct MenuVars
|
595 | 602 |
|
596 | 603 | MenuVars()
|
597 | 604 | {
|
598 |
| - ForcedNPCItemDrop = ttyd::item_data::Item::SleepySheep; |
599 | 605 | LagSpikeDuration = 468;
|
| 606 | + ForcedNPCItemDrop = ttyd::item_data::Item::SleepySheep; |
600 | 607 | }
|
601 | 608 | };
|
602 | 609 |
|
@@ -1103,6 +1110,69 @@ struct UnusedMapStruct
|
1103 | 1110 | }
|
1104 | 1111 | };
|
1105 | 1112 |
|
| 1113 | +struct SetCustomText |
| 1114 | +{ |
| 1115 | + #define CUSTOM_TEXT_BUFFER_SIZE 32 |
| 1116 | + #define CUSTOM_TEXT_TOTAL_CHARS_ROWS 5 |
| 1117 | + #define CUSTOM_TEXT_CANCEL 0x1100 |
| 1118 | + #define CUSTOM_TEXT_DONE 0x1200 |
| 1119 | + |
| 1120 | + char *Buffer; |
| 1121 | + const char *CharsToChooseFrom; |
| 1122 | + uint8_t CharsLength; |
| 1123 | + uint8_t CurrentIndex; |
| 1124 | + uint8_t CharsPerRow; |
| 1125 | + |
| 1126 | + SetCustomText() |
| 1127 | + { |
| 1128 | + Buffer = new char[CUSTOM_TEXT_BUFFER_SIZE]; |
| 1129 | + CharsToChooseFrom = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890/. "; |
| 1130 | + CharsLength = static_cast<uint8_t>(strlen(CharsToChooseFrom)); |
| 1131 | + CharsPerRow = 1 + ((CharsLength - 1) / CUSTOM_TEXT_TOTAL_CHARS_ROWS); // Round up |
| 1132 | + } |
| 1133 | + |
| 1134 | + void customTextInit(const char *initialText, uint32_t maxTextSize) |
| 1135 | + { |
| 1136 | + char *tempBuffer = reinterpret_cast<char *>( |
| 1137 | + clearMemory(Buffer, CUSTOM_TEXT_BUFFER_SIZE)); |
| 1138 | + |
| 1139 | + if (initialText) |
| 1140 | + { |
| 1141 | +#ifdef TTYD_JP |
| 1142 | + // Custom text doesn't currently support Japanese characters |
| 1143 | + if (ttyd::msgdrv::_ismbblead(initialText[0])) |
| 1144 | + { |
| 1145 | + // Text starts with a Japanese character |
| 1146 | + CurrentIndex = 0; |
| 1147 | + } |
| 1148 | + else |
| 1149 | + { |
| 1150 | +#endif |
| 1151 | + uint32_t MaxIndex = maxTextSize - 1; |
| 1152 | + if (MaxIndex > (CUSTOM_TEXT_BUFFER_SIZE - 1)) |
| 1153 | + { |
| 1154 | + MaxIndex = (CUSTOM_TEXT_BUFFER_SIZE - 1); |
| 1155 | + } |
| 1156 | + |
| 1157 | + uint32_t Length = strlen(initialText); |
| 1158 | + if (Length > MaxIndex) |
| 1159 | + { |
| 1160 | + Length = MaxIndex; |
| 1161 | + } |
| 1162 | + |
| 1163 | + CurrentIndex = static_cast<uint8_t>(Length); |
| 1164 | + strncpy(tempBuffer, initialText, Length); |
| 1165 | +#ifdef TTYD_JP |
| 1166 | + } |
| 1167 | +#endif |
| 1168 | + } |
| 1169 | + else |
| 1170 | + { |
| 1171 | + CurrentIndex = 0; |
| 1172 | + } |
| 1173 | + } |
| 1174 | +}; |
| 1175 | + |
1106 | 1176 | extern MenuVars MenuVar;
|
1107 | 1177 | extern Menus Menu[38];
|
1108 | 1178 | extern Cheats Cheat[28];
|
@@ -1141,6 +1211,7 @@ extern NpcNameToPtrErrorStruct NpcNameToPtrError;
|
1141 | 1211 | extern EnemyEncounterNotifierStruct EnemyEncounterNotifier;
|
1142 | 1212 | extern FrameAdvanceStruct FrameAdvance;
|
1143 | 1213 | extern UnusedMapStruct UnusedMap;
|
| 1214 | +extern SetCustomText CustomText; |
1144 | 1215 |
|
1145 | 1216 | extern uint8_t CheatsOrder[];
|
1146 | 1217 | extern uint16_t StatsMarioIcons[];
|
|
0 commit comments