diff options
author | YamaArashi <shadow962@live.com> | 2016-09-30 09:54:35 -0700 |
---|---|---|
committer | YamaArashi <shadow962@live.com> | 2016-09-30 09:54:35 -0700 |
commit | 302e43fd9124a85d65a91e9a1a32635d87941036 (patch) | |
tree | 4be102b74ad54ddeaa83f1eb0f9a07c06a704277 /src | |
parent | 4de46005c370a8fac7137645ffd6f0db42b30d4c (diff) |
menu.h
Diffstat (limited to 'src')
-rw-r--r-- | src/main_menu.c | 49 | ||||
-rw-r--r-- | src/menu.c | 100 | ||||
-rw-r--r-- | src/string_util.c | 24 | ||||
-rw-r--r-- | src/text.c | 44 |
4 files changed, 72 insertions, 145 deletions
diff --git a/src/main_menu.c b/src/main_menu.c index 7d74faa55..55e3baa00 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -9,42 +9,33 @@ #include "string_util.h" #include "species.h" #include "pokemon.h" +#include "menu.h" + +#define BirchSpeechUpdateWindowText() ((u8)MenuUpdateWindowText_OverrideLineLength(24)) -extern u8 MenuUpdateWindowText(void); -extern void MenuPrint(u8 *, u8, u8); extern void CB2_ContinueSavedGame(void); extern void CB2_InitMysteryEventMenu(void); extern void CB2_InitOptionMenu(void); extern void CB2_InitTitleScreen(void); extern void FormatPlayTime(u8 *str, u16 hours, u16 minutes, bool16 colon); -extern u8 *sub_8072C74(u8 *, u8 *, u8, u8); extern u16 GetPokedexSeenCount(void); -extern u8 *sub_8072C14(u8 *, s32, u8, u8); -extern u8 sub_80729D8(u8 *, u8, u16, u8); extern u8 GetBadgeCount(void); extern void Task_Birch1(u8); -void MenuPrintMessage(const u8 *string, u8 a, u8 b); -u8 MenuUpdateWindowText_OverrideLineLength(u8 a); -void sub_8072DEC(void); u8 sub_8075374(void); -void MenuSetText(u32); void cry_related(u16, u8); void audio_play(u8 a); -void MenuZeroFillWindowRect(u8 a, u8 b, u8 c, u8 d); u8 GetMenuCursorPos(void); void DoNamingScreen(u8 r0, struct SaveBlock2 *r1, u16 r2, u16 r3, u8 s0, MainCallback s4); void DisplayYesNoMenu(u8 r0, u8 r1, u32 r2); s8 ProcessMenuInputNoWrap_(void); void CB2_NewGame(void); void LZ77UnCompVram(const void *src, void *dest); -void InitMenuWindow(const struct WindowConfig *); void CB2_MainMenu(void); void VBlankCB_MainMenu(void); void DecompressPicFromTable_2(const struct SpriteSheet *, u8, u8, void *, void *, u32); void LoadCompressedObjectPalette(const struct SpritePalette *); u8 AddNewGameBirchObject(u8, u8, u8); u8 sub_80859BC(u8, u16, u16, u8, void *); -void MenuDrawTextWindow(u8 a, u8 b, u8 c, u8 d); extern struct PaletteFadeControl gPaletteFade; extern u8 gSaveFileDeletedMessage[]; @@ -140,7 +131,7 @@ u32 InitMainMenu(u8 a1) ResetSpriteData(); FreeAllSpritePalettes(); SetUpWindowConfig(&gWindowConfig_81E6C3C); - InitMenuWindow(&gWindowConfig_81E6CE4); + InitMenuWindow((struct WindowConfig *)&gWindowConfig_81E6CE4); if (a1) BeginNormalPaletteFade(-1, 0, 0x10, 0, 0x0000); // fade to black @@ -722,7 +713,7 @@ void set_default_player_name(u8 a); void Task_Birch1(u8 taskId) { SetUpWindowConfig(&gWindowConfig_81E6C3C); - InitMenuWindow(&gWindowConfig_81E6CE4); + InitMenuWindow((struct WindowConfig *)&gWindowConfig_81E6CE4); REG_WIN0H = 0; REG_WIN0V = 0; REG_WININ = 0; @@ -791,7 +782,7 @@ void task_new_game_prof_birch_speech_3(u8 taskId) void task_new_game_prof_birch_speech_4(u8 taskId) { - if (!gPaletteFade.active && MenuUpdateWindowText_OverrideLineLength(24)) + if (!gPaletteFade.active && BirchSpeechUpdateWindowText()) { gTasks[taskId].func = task_new_game_prof_birch_speech_5; MenuPrintMessage(gBirchSpeech_ThisIsPokemon, 3, 14); @@ -800,7 +791,7 @@ void task_new_game_prof_birch_speech_4(u8 taskId) void task_new_game_prof_birch_speech_5(u8 taskId) { - if (MenuUpdateWindowText_OverrideLineLength(24)) + if (BirchSpeechUpdateWindowText()) gTasks[taskId].func = task_new_game_prof_birch_speech_6; } @@ -823,7 +814,7 @@ void task_new_game_prof_birch_speech_7(u8 taskId) { if (gTasks[taskId].data[7] > 95) { - MenuSetText((u32)&gSystemText_NewPara); + MenuSetText(gSystemText_NewPara); gTasks[taskId].func = task_new_game_prof_birch_speech_8; } } @@ -840,7 +831,7 @@ void task_new_game_prof_birch_speech_7(u8 taskId) void task_new_game_prof_birch_speech_8(u8 taskId) { - if (MenuUpdateWindowText_OverrideLineLength(24)) + if (BirchSpeechUpdateWindowText()) { MenuPrintMessage(gBirchSpeech_WorldInhabitedByPokemon, 3, 14); gTasks[taskId].func = task_new_game_prof_birch_speech_9; @@ -849,7 +840,7 @@ void task_new_game_prof_birch_speech_8(u8 taskId) void task_new_game_prof_birch_speech_9(u8 taskId) { - if (MenuUpdateWindowText_OverrideLineLength(24)) + if (BirchSpeechUpdateWindowText()) { MenuDrawTextWindow(2, 13, 27, 18); MenuPrintMessage(gBirchSpeech_AndYouAre, 3, 14); @@ -859,7 +850,7 @@ void task_new_game_prof_birch_speech_9(u8 taskId) void task_new_game_prof_birch_speech_10(u8 taskId) { - if (MenuUpdateWindowText_OverrideLineLength(24)) + if (BirchSpeechUpdateWindowText()) { gSprites[gTasks[taskId].data[8]].oam.objMode = ST_OAM_OBJ_BLEND; gSprites[gTasks[taskId].data[9]].oam.objMode = ST_OAM_OBJ_BLEND; @@ -930,7 +921,7 @@ void task_new_game_prof_birch_speech_14(u8 taskId) void task_new_game_prof_birch_speech_15(u8 taskId) { - if (MenuUpdateWindowText_OverrideLineLength(24)) + if (BirchSpeechUpdateWindowText()) { CreateGenderMenu(2, 4); gTasks[taskId].func = task_new_game_prof_birch_speech_16; @@ -1028,7 +1019,7 @@ void sub_800A974(u8 taskId) void Task_800A9B4(u8 taskId) { - if (MenuUpdateWindowText_OverrideLineLength(24)) + if (BirchSpeechUpdateWindowText()) { CreateNameMenu(2, 1); gTasks[taskId].func = sub_800A9EC; @@ -1084,7 +1075,7 @@ void task_new_game_prof_birch_speech_part2_1(u8 taskId) void sub_800AB38(u8 taskId) { - if (MenuUpdateWindowText_OverrideLineLength(24)) + if (BirchSpeechUpdateWindowText()) { DisplayYesNoMenu(2, 1, 1); gTasks[taskId].func = task_new_game_prof_birch_speech_part2_4; @@ -1170,7 +1161,7 @@ void task_new_game_prof_birch_speech_part2_7(u8 taskId) spriteId = gTasks[taskId].data[9]; gSprites[spriteId].oam.objMode = ST_OAM_OBJ_NORMAL; - if (MenuUpdateWindowText_OverrideLineLength(24)) + if (BirchSpeechUpdateWindowText()) { spriteId = gTasks[taskId].data[8]; gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND; @@ -1235,7 +1226,7 @@ void task_new_game_prof_birch_speech_part2_9(u8 taskId) spriteId = gTasks[taskId].data[2]; gSprites[spriteId].oam.objMode = ST_OAM_OBJ_NORMAL; - if (MenuUpdateWindowText_OverrideLineLength(24)) + if (BirchSpeechUpdateWindowText()) { u8 spriteId; @@ -1324,7 +1315,7 @@ void new_game_prof_birch_speech_part2_start() AddBirchSpeechObjects(taskId); SetUpWindowConfig(&gWindowConfig_81E6C3C); - InitMenuWindow(&gWindowConfig_81E6CE4); + InitMenuWindow((struct WindowConfig *)&gWindowConfig_81E6CE4); if (gSaveBlock2.playerGender != MALE) { @@ -1591,14 +1582,14 @@ void CreateNameMenu(u8 left, u8 top) if (gSaveBlock2.playerGender == MALE) { - PrintMenuItems((u8)(left + 1), (u8)(top + 1), 5, gUnknown_081E79C0); + PrintMenuItems(left + 1, top + 1, 5, gUnknown_081E79C0); } else { - PrintMenuItems((u8)(left + 1), (u8)(top + 1), 5, gUnknown_081E79E8); + PrintMenuItems(left + 1, top + 1, 5, gUnknown_081E79E8); } - InitMenu(0, (u8)(left + 1), (u8)(top + 1), 5, 0, 9); + InitMenu(0, left + 1, top + 1, 5, 0, 9); } s8 NameMenuProcessInput(void) diff --git a/src/menu.c b/src/menu.c index 8bd6f3e90..ab7aae955 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,4 +1,5 @@ #include "global.h" +#include "menu.h" #include "main.h" #include "text.h" #include "songs.h" @@ -17,72 +18,13 @@ struct Menu u8 columnXCoords[8]; }; -void InitMenuWindow(struct WindowConfig *); -void MultistepInitMenuWindowBegin(struct WindowConfig *); -void MultistepInitMenuWindowInternal(struct WindowConfig *, u16); -bool32 MultistepInitMenuWindowContinue(void); -void InitMenuWindowInternal(struct WindowConfig *, u16); -void unref_sub_8071DA4(struct WindowConfig *, u16); -void MenuLoadTextWindowGraphics_OverrideFrameType(u8); -void MenuLoadTextWindowGraphics(void); -void BasicInitMenuWindow(struct WindowConfig *); -void MenuPrint(u8 *, u8, u8); -void MenuZeroFillWindowRect(u8, u8, u8, u8); -void MenuFillWindowRectWithBlankTile(u8, u8, u8, u8); -void MenuZeroFillScreen(void); -void MenuDrawTextWindow(u8, u8, u8, u8); -void sub_8071F40(u8 *); -void sub_8071F60(u8, u8, u8, u8); -u16 unref_sub_8071F98(u8, u8); -void unref_sub_8071FBC(u16, u8, u8, u8, u8); -void MenuDisplayMessageBox(void); -void MenuPrintMessage(u8 *, u8, u8); -void sub_8072044(u8 *); -void MenuSetText(u8 *); -u8 MenuUpdateWindowText(void); -u8 unref_sub_8072098(void); -void sub_80720B0(void); -u8 MoveMenuCursor(s8); -u8 MoveMenuCursorNoWrap(s8); -u8 GetMenuCursorPos(void); -s8 ProcessMenuInput(void); -s8 ProcessMenuInputNoWrap(void); -u8 MoveMenuCursor3(s8); -u8 MoveMenuCursor4(s8); -bool8 sub_80723D4(void); -u8 sub_8072484(u8, u8, u8, u8, u8, u8, u32); -u8 sub_80724F4(u8, u8, u8, u8*[][2], u8); -void sub_8072620(u8, u8, u8, u8*[][2], u8); -void sub_807274C(u8, u8, u8, u8, u8*[][2], u8, u32); -s8 sub_80727CC(void); -u8 sub_807288C(u8); -void PrintMenuItems(u8, u8, u8, u8*[][2]); -void PrintMenuItemsReordered(u8, u8, u8, u8*[][2], u8*); -void InitYesNoMenu(u8, u8, u8); -void DisplayYesNoMenu(u8, u8, u32); -s8 ProcessMenuInputNoWrap_(void); -u8 sub_80729D8(u8 *, u8, u16, u8); -u8 sub_8072A18(u8 *, u8, u16, u8, u32); -u8 unref_sub_8072A5C(u8 *, u8 *, u8, u16, u8, u32); -int sub_8072AB0(u8 *, u8, u16, u8, u8, u32); -void sub_8072B4C(u8 *, u8, u8); -void sub_8072B80(u8 *, u8, u8, u8 *); -void sub_8072BD8(u8 *, u8, u8, u16); -u8 *sub_8072C14(u8 *, s32, u8, u8); -u8 *sub_8072C44(u8 *, s32, u8, u8); -u8 *sub_8072C74(u8 *, u8 *, u8, u8); -u8 sub_8072CA4(u8 *s); -u8 sub_8072CBC(void); -void sub_8072CD4(u8 *, u8 *, u8 *); -u32 MenuUpdateWindowText_OverrideLineLength(u8); -struct Window * unref_sub_8072D0C(void); -void sub_8072D18(u8, u8); -u8 InitMenu(u8, u8, u8, u8, u8, u8); -void RedrawMenuCursor(u8, u8); -void unref_sub_8072DC0(void); -void sub_8072DCC(u8); -void sub_8072DDC(u8); -void sub_8072DEC(void); +static void MultistepInitMenuWindowInternal(struct WindowConfig *, u16); +static void InitMenuWindowInternal(struct WindowConfig *, u16); +static bool8 sub_80723D4(void); +static u8 sub_8072484(u8, u8, u8, u8, u8, u8, u32); +static u8 sub_80724F4(u8, u8, u8, u8 * const [][2], u8); +static void sub_8072620(u8, u8, u8, u8 * const [][2], u8); +static void sub_8072D18(u8, u8); extern void sub_814A5C0(u8, u16, u8, u16, u8); extern void sub_814A880(u8, u8); @@ -113,7 +55,7 @@ void MultistepInitMenuWindowBegin(struct WindowConfig *winConfig) MultistepInitMenuWindowInternal(winConfig, 1); } -void MultistepInitMenuWindowInternal(struct WindowConfig *winConfig, u16 tileOffset) +static void MultistepInitMenuWindowInternal(struct WindowConfig *winConfig, u16 tileOffset) { gMenuMultistepInitState = 0; gMenuTextTileOffset = tileOffset; @@ -150,7 +92,7 @@ bool32 MultistepInitMenuWindowContinue(void) } } -void InitMenuWindowInternal(struct WindowConfig *winConfig, u16 tileOffset) +static void InitMenuWindowInternal(struct WindowConfig *winConfig, u16 tileOffset) { gMenuWindowPtr = &gMenuWindow; InitWindowFromConfig(&gMenuWindow, winConfig); @@ -239,17 +181,17 @@ void MenuDisplayMessageBox(void) DisplayMessageBox(gMenuWindowPtr); } -void MenuPrintMessage(u8 *str, u8 left, u8 top) +void MenuPrintMessage(const u8 *str, u8 left, u8 top) { sub_8002EB0(gMenuWindowPtr, str, gMenuTextTileOffset, left, top); } -void sub_8072044(u8 *str) +void sub_8072044(const u8 *str) { sub_8002EB0(gMenuWindowPtr, str, gMenuTextTileOffset, 2, 15); } -void MenuSetText(u8 *str) +void MenuSetText(const u8 *str) { sub_8002E90(gMenuWindowPtr, str); } @@ -418,7 +360,7 @@ u8 MoveMenuCursor4(s8 delta) return gMenu.cursorPos; } -bool8 sub_80723D4(void) +static bool8 sub_80723D4(void) { if ((gMain.newKeys & DPAD_UP) && gMenu.cursorPos < gMenu.width) return TRUE; @@ -438,7 +380,7 @@ bool8 sub_80723D4(void) return FALSE; } -u8 sub_8072484(u8 a1, u8 a2, u8 menuItemCount, u8 a4, u8 width, u8 a6, u32 a7) +static u8 sub_8072484(u8 a1, u8 a2, u8 menuItemCount, u8 a4, u8 width, u8 a6, u32 a7) { u8 v7; @@ -452,7 +394,7 @@ u8 sub_8072484(u8 a1, u8 a2, u8 menuItemCount, u8 a4, u8 width, u8 a6, u32 a7) return a4; } -u8 sub_80724F4(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2], u8 columnCount) +static u8 sub_80724F4(u8 left, u8 top, u8 menuItemCount, u8 * const menuItems[][2], u8 columnCount) { u8 i; u8 maxWidth; @@ -510,7 +452,7 @@ u8 sub_80724F4(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2], u8 columnC return maxWidth; } -void sub_8072620(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2], u8 columnCount) +static void sub_8072620(u8 left, u8 top, u8 menuItemCount, u8 * const menuItems[][2], u8 columnCount) { u8 i; u8 maxWidth; @@ -544,7 +486,7 @@ void sub_8072620(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2], u8 colum } } -void sub_807274C(u8 left, u8 top, u8 menuItemCount, u8 a4, u8 *menuItems[][2], u8 columnCount, u32 a7) +void sub_807274C(u8 left, u8 top, u8 menuItemCount, u8 a4, u8 * const menuItems[][2], u8 columnCount, u32 a7) { u8 maxWidth = sub_80724F4(left, top, menuItemCount, menuItems, columnCount); @@ -602,7 +544,7 @@ u8 sub_807288C(u8 column) return gMenu.columnXCoords[column]; } -void PrintMenuItems(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2]) +void PrintMenuItems(u8 left, u8 top, u8 menuItemCount, u8 * const menuItems[][2]) { u8 i; @@ -610,7 +552,7 @@ void PrintMenuItems(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2]) MenuPrint(menuItems[i][0], left, top + 2 * i); } -void PrintMenuItemsReordered(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2], u8 *order) +void PrintMenuItemsReordered(u8 left, u8 top, u8 menuItemCount, u8 * const menuItems[][2], u8 *order) { u8 i; @@ -722,7 +664,7 @@ struct Window *unref_sub_8072D0C(void) return gMenuWindowPtr; } -void sub_8072D18(u8 a1, u8 a2) +static void sub_8072D18(u8 a1, u8 a2) { sub_814A5C0(a1, 0xFFFF, 12, 11679, 8 * a2); } diff --git a/src/string_util.c b/src/string_util.c index 9f939014a..a7f9c3d1f 100644 --- a/src/string_util.c +++ b/src/string_util.c @@ -77,7 +77,7 @@ extern u8 gExpandedPlaceholder_Groudon[]; extern u8 gExpandedPlaceholder_Brendan[]; extern u8 gExpandedPlaceholder_May[]; -u8 *StringCopy10(u8 *dest, u8 *src) +u8 *StringCopy10(u8 *dest, const u8 *src) { u8 i; u32 limit = 10; @@ -107,7 +107,7 @@ u8 *StringGetEnd10(u8 *str) return &str[i]; } -u8 *StringCopy8(u8 *dest, u8 *src) +u8 *StringCopy8(u8 *dest, const u8 *src) { s32 i; @@ -123,7 +123,7 @@ u8 *StringCopy8(u8 *dest, u8 *src) return &dest[i]; } -u8 *StringCopy(u8 *dest, u8 *src) +u8 *StringCopy(u8 *dest, const u8 *src) { while (*src != EOS) { @@ -136,7 +136,7 @@ u8 *StringCopy(u8 *dest, u8 *src) return dest; } -u8 *StringAppend(u8 *dest, u8 *src) +u8 *StringAppend(u8 *dest, const u8 *src) { while (*dest != EOS) dest++; @@ -144,7 +144,7 @@ u8 *StringAppend(u8 *dest, u8 *src) return StringCopy(dest, src); } -u8 *StringCopyN(u8 *dest, u8 *src, u8 n) +u8 *StringCopyN(u8 *dest, const u8 *src, u8 n) { u16 i; @@ -154,7 +154,7 @@ u8 *StringCopyN(u8 *dest, u8 *src, u8 n) return &dest[n]; } -u8 *StringAppendN(u8 *dest, u8 *src, u8 n) +u8 *StringAppendN(u8 *dest, const u8 *src, u8 n) { while (*dest != EOS) dest++; @@ -162,7 +162,7 @@ u8 *StringAppendN(u8 *dest, u8 *src, u8 n) return StringCopyN(dest, src, n); } -u16 StringLength(u8 *str) +u16 StringLength(const u8 *str) { u16 length = 0; @@ -177,7 +177,7 @@ u16 StringLength(u8 *str) return length; } -s32 StringCompare(u8 *str1, u8 *str2) +s32 StringCompare(const u8 *str1, const u8 *str2) { while (*str1 == *str2) { @@ -190,7 +190,7 @@ s32 StringCompare(u8 *str1, u8 *str2) return *str1 - *str2; } -s32 StringCompareN(u8 *str1, u8 *str2, u32 n) +s32 StringCompareN(const u8 *str1, const u8 *str2, u32 n) { while (*str1 == *str2) { @@ -408,7 +408,7 @@ u8 *ConvertIntToDecimalString(u8 *dest, s32 value) return dest; } -u8 *StringExpandPlaceholders(u8 *dest, u8 *src) +u8 *StringExpandPlaceholders(u8 *dest, const u8 *src) { for (;;) { @@ -443,7 +443,7 @@ u8 *StringExpandPlaceholders(u8 *dest, u8 *src) } } -u8 *StringBraille(u8 *dest, u8 *src) +u8 *StringBraille(u8 *dest, const u8 *src) { u8 setBrailleFont[4]; u8 gotoLine2[5]; @@ -554,7 +554,7 @@ u8 *StringFill(u8 *dest, u8 c, u16 n) return dest; } -u8 *StringCopyPadded(u8 *dest, u8 *src, u8 c, u16 n) +u8 *StringCopyPadded(u8 *dest, const u8 *src, u8 c, u16 n) { while (*src != EOS) { diff --git a/src/text.c b/src/text.c index 25c7a9d79..6ed91fc2e 100644 --- a/src/text.c +++ b/src/text.c @@ -73,7 +73,7 @@ static u16 LoadFixedWidthFont_Font1Latin(struct Window *, u16); static u16 LoadFixedWidthFont_Font4Latin(struct Window *, u16); static u16 LoadFixedWidthFont_Braille(struct Window *, u16); static void MultistepLoadFont_LoadGlyph(struct Window *, u16, u8); -static u8 sub_8002FA0(struct Window *, u8 *); +static u8 sub_8002FA0(struct Window *, const u8 *); static u8 InterpretText(struct Window *); static u8 HandleExtCtrlCode(struct Window *); static u8 UpdateWindowText(struct Window *); @@ -111,17 +111,11 @@ static u16 GetBlankTileNum(struct Window *); static u8 WaitWithDownArrow(struct Window *); static void DrawInitialDownArrow(struct Window *); static void DrawMovingDownArrow(struct Window *); -u8 *AlignInt2(struct Window *, u8 *, s32, u8, u8); -u8 *AlignString(struct Window *, u8 *, u8 *, u8, u8); -void sub_8004E3C(struct WindowConfig *, u8 *, u8 *); -u8 GetStringWidthGivenWindowConfig(struct WindowConfig *, u8 *); static u16 GetCursorTileNum(struct Window *, u32, u32); static s32 DrawGlyphTiles(struct Window *, u32, u32); static void UpdateTilemap(struct Window *, u32); static u8 GetGlyphWidth(struct Window *, u32); static s32 DrawGlyphTile_ShadowedFont(struct GlyphTileInfo *); -u8 GetStringWidth(struct Window *, u8 *); -void SkipExtCtrlCodes(u8 *); static void PrintGlyph_TextMode0(struct Window *, u32); static void PrintGlyph_TextMode1(struct Window *, u32); @@ -1954,7 +1948,7 @@ void InitWindowFromConfig(struct Window *win, struct WindowConfig *winConfig) SetForegroundColor(win, winConfig->foregroundColor); } -void InitWindow(struct Window *win, u8 *text, u16 tileDataStartOffset, u8 left, u8 top) +void InitWindow(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top) { struct WindowConfig *winConfig = win->config; win->textMode = winConfig->textMode; @@ -1988,7 +1982,7 @@ void InitWindow(struct Window *win, u8 *text, u16 tileDataStartOffset, u8 left, SetForegroundColor(win, winConfig->foregroundColor); } -void sub_8002E4C(struct Window *win, u8 *text, u16 tileDataStartOffset, u8 left, u16 top, u32 a6) +void sub_8002E4C(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u16 top, u32 a6) { u8 val; @@ -2003,7 +1997,7 @@ void sub_8002E4C(struct Window *win, u8 *text, u16 tileDataStartOffset, u8 left, ClipLeft(win); } -void sub_8002E90(struct Window *win, u8 *text) +void sub_8002E90(struct Window *win, const u8 *text) { win->state = WIN_STATE_NORMAL; win->text = text; @@ -2014,7 +2008,7 @@ void sub_8002E90(struct Window *win, u8 *text) win->delayCounter = 0; } -void sub_8002EB0(struct Window *win, u8 *text, u16 tileDataStartOffset, u8 left, u8 top) +void sub_8002EB0(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top) { gMain.watchedKeysMask = A_BUTTON | B_BUTTON; gMain.watchedKeysPressed = 0; @@ -2054,11 +2048,11 @@ u8 sub_8002F44(struct Window *win) return 1; } -static u8 sub_8002FA0(struct Window *win, u8 *text) +static u8 sub_8002FA0(struct Window *win, const u8 *text) { u8 retVal; u8 savedCharset = win->charset; - u8 *savedText = win->text; + const u8 *savedText = win->text; u16 savedTextIndex = win->textIndex; win->text = text; win->textIndex = 0; @@ -2335,7 +2329,7 @@ u8 sub_8003418(struct Window *win) return retVal; } -u8 sub_8003460(struct Window *win, u8 *text, u16 tileDataStartOffset, u8 left, u8 top) +u8 sub_8003460(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top) { InitWindow(win, text, tileDataStartOffset, left, top); return sub_8002F44(win); @@ -2370,7 +2364,7 @@ u8 *sub_8003504(u8 *dest, s32 value, u8 alignAmount, u8 alignType) return AlignInt2(&sTempWindow, dest, value, alignAmount, alignType); } -u8 *sub_8003558(u8 *dest, u8 *src, u8 alignAmount, u8 alignType) +u8 *sub_8003558(u8 *dest, const u8 *src, u8 alignAmount, u8 alignType) { sTempWindow.config = (struct WindowConfig *)&gWindowConfig_81E6C74; InitWindow(&sTempWindow, src, 0, 0, 0); @@ -3500,7 +3494,7 @@ u8 *AlignInt2(struct Window *win, u8 *dest, s32 value, u8 alignAmount, u8 alignT return dest; } -u8 *AlignString(struct Window *win, u8 *dest, u8 *src, u8 alignAmount, u8 alignType) +u8 *AlignString(struct Window *win, u8 *dest, const u8 *src, u8 alignAmount, u8 alignType) { u8 width; switch (alignType) @@ -3547,7 +3541,7 @@ u8 *AlignString(struct Window *win, u8 *dest, u8 *src, u8 alignAmount, u8 alignT return dest; } -u8 GetStringWidth(struct Window *win, u8 *s) +u8 GetStringWidth(struct Window *win, const u8 *s) { u8 width = 0; u8 savedFontNum = win->fontNum; @@ -3614,13 +3608,13 @@ u8 GetStringWidth(struct Window *win, u8 *s) return width; } -u8 sub_8004D04(struct Window *win, u8 *text, u16 tileDataStartOffset, u8 left, u16 top, u32 a6) +u8 sub_8004D04(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u16 top, u32 a6) { sub_8002E4C(win, text, tileDataStartOffset, left, top, a6); return sub_8002F44(win); } -u8 sub_8004D38(struct Window *win, u8 *text, u16 tileDataStartOffset, u8 left, u8 top) +u8 sub_8004D38(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top) { u8 width = GetStringWidth(win, text); InitWindow(win, text, tileDataStartOffset, left - ((u32)(width + 7) >> 3), top); @@ -3632,7 +3626,7 @@ u8 sub_8004D38(struct Window *win, u8 *text, u16 tileDataStartOffset, u8 left, u return sub_8002F44(win); } -u8 sub_8004DB0(struct Window *win, u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 a6) +u8 sub_8004DB0(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 a6) { register u32 val asm("r5") = (u8)((a6 >> 1) - (GetStringWidth(win, text) >> 1)); left += (val >> 3); @@ -3654,7 +3648,7 @@ void sub_8004E28(struct Window *win, u8 *foreground, u8 *background, u8 *shadow) *shadow = win->shadowColor; } -void sub_8004E3C(struct WindowConfig *winConfig, u8 *tileData, u8 *text) +void sub_8004E3C(struct WindowConfig *winConfig, u8 *tileData, const u8 *text) { sTempWindow.config = winConfig; InitWindow(&sTempWindow, text, 0, 0, 0); @@ -3662,7 +3656,7 @@ void sub_8004E3C(struct WindowConfig *winConfig, u8 *tileData, u8 *text) sub_8002F44(&sTempWindow); } -u8 GetStringWidthGivenWindowConfig(struct WindowConfig *winConfig, u8 *s) +u8 GetStringWidthGivenWindowConfig(struct WindowConfig *winConfig, const u8 *s) { sTempWindow.config = winConfig; InitWindow(&sTempWindow, s, 0, 0, 0); @@ -3714,7 +3708,7 @@ void SkipExtCtrlCodes(u8 *str) str[destIndex] = 0xFF; } -static u8 *SkipExtCtrlCode(u8 *s) +static const u8 *SkipExtCtrlCode(const u8 *s) { while (*s == 0xFC) { @@ -3725,7 +3719,7 @@ static u8 *SkipExtCtrlCode(u8 *s) return s; } -s32 StringCompareWithoutExtCtrlCodes(u8 *str1, u8 *str2) +s32 StringCompareWithoutExtCtrlCodes(const u8 *str1, const u8 *str2) { s32 retVal = 0; @@ -3759,7 +3753,7 @@ s32 StringCompareWithoutExtCtrlCodes(u8 *str1, u8 *str2) return retVal; } -u8 sub_8004FD0(struct Window *win, u8 *dest, u8 *src, u16 tileDataStartOffset, u8 left, u16 top, u8 width, u32 a8) +u8 sub_8004FD0(struct Window *win, u8 *dest, const u8 *src, u16 tileDataStartOffset, u8 left, u16 top, u8 width, u32 a8) { u8 newlineCount = 0; u8 extCtrlCodeLength; |