From 3de70980e550ead4eb5025b7eaa2c20335044ba4 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 5 Oct 2022 13:10:26 -0400 Subject: [PATCH] Document text window --- graphics/help_system/msg_window.png | Bin 0 -> 160 bytes .../std_menu.pal} | 0 .../{unk_841F1C8.png => menu_message.png} | Bin .../{unk_8471B6C.png => quest_log.png} | Bin .../{unk_8470B0C.png => signpost.png} | Bin .../text_window/{unk_8471A4C.png => std.png} | Bin .../{unk_8470D6C.png => type1.png} | Bin .../{unk_84717CC.png => type10.png} | Bin .../{unk_8470E8C.png => type2.png} | Bin .../{unk_8470FCC.png => type3.png} | Bin .../{unk_84710EC.png => type4.png} | Bin .../{unk_847120C.png => type5.png} | Bin .../{unk_847132C.png => type6.png} | Bin .../{unk_847144C.png => type7.png} | Bin .../{unk_847156C.png => type8.png} | Bin .../{unk_84716AC.png => type9.png} | Bin .../unused.png} | Bin graphics/unknown/unknown_84566a8.bin | Bin 640 -> 0 bytes graphics_file_rules.mk | 2 +- include/graphics.h | 2 +- include/help_message.h | 2 + include/new_menu_helpers.h | 4 +- include/quest_log.h | 1 - include/script.h | 8 +- include/text_window.h | 20 ++-- include/text_window_graphics.h | 10 +- src/bag.c | 6 +- src/battle_bg.c | 6 +- src/battle_records.c | 2 +- src/berry_crush.c | 4 +- src/berry_pouch.c | 8 +- src/berry_powder.c | 2 +- src/buy_menu_helpers.c | 6 +- src/clear_save_data_screen.c | 4 +- src/coins.c | 2 +- src/daycare.c | 2 +- src/dodrio_berry_picking.c | 14 +-- src/easy_chat_3.c | 2 +- src/evolution_scene.c | 2 +- src/fame_checker.c | 2 +- src/field_control_avatar.c | 14 +-- src/field_message_box.c | 6 +- src/field_specials.c | 2 +- src/hall_of_fame.c | 2 +- src/help_message.c | 12 +-- src/item_pc.c | 10 +- src/learn_move.c | 2 +- src/link.c | 2 +- src/list_menu.c | 2 +- src/mail.c | 2 +- src/main_menu.c | 6 +- src/map_name_popup.c | 6 +- src/menu.c | 2 +- src/mon_markings.c | 2 +- src/money.c | 2 +- src/mystery_gift_menu.c | 6 +- src/naming_screen.c | 2 +- src/new_menu_helpers.c | 62 ++++++------ src/oak_speech.c | 8 +- src/option_menu.c | 12 +-- src/party_menu.c | 14 +-- src/pokemon_jump.c | 6 +- src/pokemon_special_anim_scene.c | 2 +- src/pokemon_storage_system_misc.c | 4 +- src/pokemon_storage_system_tasks.c | 4 +- src/quest_log.c | 6 +- src/scrcmd.c | 4 +- src/script.c | 18 ++-- src/seagallop.c | 2 +- src/slot_machine.c | 6 +- src/start_menu.c | 4 +- src/text.c | 2 +- src/text_window.c | 95 ++++++++++-------- src/text_window_graphics.c | 85 ++++++++-------- src/tm_case.c | 10 +- src/trade.c | 8 +- src/union_room_battle.c | 2 +- src/union_room_chat_display.c | 6 +- 78 files changed, 288 insertions(+), 263 deletions(-) create mode 100644 graphics/help_system/msg_window.png rename graphics/{tm_case/unk_841F408.pal => interface/std_menu.pal} (100%) rename graphics/text_window/{unk_841F1C8.png => menu_message.png} (100%) rename graphics/text_window/{unk_8471B6C.png => quest_log.png} (100%) rename graphics/text_window/{unk_8470B0C.png => signpost.png} (100%) rename graphics/text_window/{unk_8471A4C.png => std.png} (100%) rename graphics/text_window/{unk_8470D6C.png => type1.png} (100%) rename graphics/text_window/{unk_84717CC.png => type10.png} (100%) rename graphics/text_window/{unk_8470E8C.png => type2.png} (100%) rename graphics/text_window/{unk_8470FCC.png => type3.png} (100%) rename graphics/text_window/{unk_84710EC.png => type4.png} (100%) rename graphics/text_window/{unk_847120C.png => type5.png} (100%) rename graphics/text_window/{unk_847132C.png => type6.png} (100%) rename graphics/text_window/{unk_847144C.png => type7.png} (100%) rename graphics/text_window/{unk_847156C.png => type8.png} (100%) rename graphics/text_window/{unk_84716AC.png => type9.png} (100%) rename graphics/{unknown/unk_841EF48.png => text_window/unused.png} (100%) delete mode 100644 graphics/unknown/unknown_84566a8.bin diff --git a/graphics/help_system/msg_window.png b/graphics/help_system/msg_window.png new file mode 100644 index 0000000000000000000000000000000000000000..b03b4096ad102b174480959724aa8fa83536a65c GIT binary patch literal 160 zcmeAS@N?(olHy`uVBq!ia0vp^0YEIk!VDyf)1Q6eaK) zI5__AEmoMrG3DD7!=STEj(!75d7XVHu;v~^P%%SsH$(N&6PMn#1NCZqx;TbtOibR< z&HCp!lSD^Y1snH)RRXggYzRBSz~mhG&{~IKwNp-Ki%KiQwYk3MFMkf`1ZrdOboFyt I=akR{0D?_F0ssI2 literal 0 HcmV?d00001 diff --git a/graphics/tm_case/unk_841F408.pal b/graphics/interface/std_menu.pal similarity index 100% rename from graphics/tm_case/unk_841F408.pal rename to graphics/interface/std_menu.pal diff --git a/graphics/text_window/unk_841F1C8.png b/graphics/text_window/menu_message.png similarity index 100% rename from graphics/text_window/unk_841F1C8.png rename to graphics/text_window/menu_message.png diff --git a/graphics/text_window/unk_8471B6C.png b/graphics/text_window/quest_log.png similarity index 100% rename from graphics/text_window/unk_8471B6C.png rename to graphics/text_window/quest_log.png diff --git a/graphics/text_window/unk_8470B0C.png b/graphics/text_window/signpost.png similarity index 100% rename from graphics/text_window/unk_8470B0C.png rename to graphics/text_window/signpost.png diff --git a/graphics/text_window/unk_8471A4C.png b/graphics/text_window/std.png similarity index 100% rename from graphics/text_window/unk_8471A4C.png rename to graphics/text_window/std.png diff --git a/graphics/text_window/unk_8470D6C.png b/graphics/text_window/type1.png similarity index 100% rename from graphics/text_window/unk_8470D6C.png rename to graphics/text_window/type1.png diff --git a/graphics/text_window/unk_84717CC.png b/graphics/text_window/type10.png similarity index 100% rename from graphics/text_window/unk_84717CC.png rename to graphics/text_window/type10.png diff --git a/graphics/text_window/unk_8470E8C.png b/graphics/text_window/type2.png similarity index 100% rename from graphics/text_window/unk_8470E8C.png rename to graphics/text_window/type2.png diff --git a/graphics/text_window/unk_8470FCC.png b/graphics/text_window/type3.png similarity index 100% rename from graphics/text_window/unk_8470FCC.png rename to graphics/text_window/type3.png diff --git a/graphics/text_window/unk_84710EC.png b/graphics/text_window/type4.png similarity index 100% rename from graphics/text_window/unk_84710EC.png rename to graphics/text_window/type4.png diff --git a/graphics/text_window/unk_847120C.png b/graphics/text_window/type5.png similarity index 100% rename from graphics/text_window/unk_847120C.png rename to graphics/text_window/type5.png diff --git a/graphics/text_window/unk_847132C.png b/graphics/text_window/type6.png similarity index 100% rename from graphics/text_window/unk_847132C.png rename to graphics/text_window/type6.png diff --git a/graphics/text_window/unk_847144C.png b/graphics/text_window/type7.png similarity index 100% rename from graphics/text_window/unk_847144C.png rename to graphics/text_window/type7.png diff --git a/graphics/text_window/unk_847156C.png b/graphics/text_window/type8.png similarity index 100% rename from graphics/text_window/unk_847156C.png rename to graphics/text_window/type8.png diff --git a/graphics/text_window/unk_84716AC.png b/graphics/text_window/type9.png similarity index 100% rename from graphics/text_window/unk_84716AC.png rename to graphics/text_window/type9.png diff --git a/graphics/unknown/unk_841EF48.png b/graphics/text_window/unused.png similarity index 100% rename from graphics/unknown/unk_841EF48.png rename to graphics/text_window/unused.png diff --git a/graphics/unknown/unknown_84566a8.bin b/graphics/unknown/unknown_84566a8.bin deleted file mode 100644 index 2fc4a648adea21c5ff1429ee9abe4792fc464705..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 640 pcmcb67Xr=z!GA0ODt&jLresultsWindowId, PIXEL_FILL(0)); break; case 2: - TextWindow_SetStdFrame0_WithPal(spriteManager->resultsWindowId, 0x21D, 0xD0); + LoadStdWindowGfx(spriteManager->resultsWindowId, 0x21D, 0xD0); DrawStdFrameWithCustomTileAndPalette(spriteManager->resultsWindowId, FALSE, 541, 13); break; case 3: @@ -3105,7 +3105,7 @@ static void Task_ShowBerryCrushRankings(u8 taskId) tWindowId = AddWindow(&sWindowTemplate_BerryCrushRankings); PutWindowTilemap(tWindowId); FillWindowPixelBuffer(tWindowId, PIXEL_FILL(0)); - TextWindow_SetStdFrame0_WithPal(tWindowId, 0x21D, 0xD0); + LoadStdWindowGfx(tWindowId, 0x21D, 0xD0); DrawStdFrameWithCustomTileAndPalette(tWindowId, 0, 0x21D, 0xD); break; case 1: diff --git a/src/berry_pouch.c b/src/berry_pouch.c index b18e0cd4a..e113fd2d9 100644 --- a/src/berry_pouch.c +++ b/src/berry_pouch.c @@ -1411,10 +1411,10 @@ static void BerryPouchInitWindows(void) u8 i; InitWindows(sWindowTemplates_Main); DeactivateAllTextPrinters(); - TextWindow_SetUserSelectedFrame(0, 0x001, 0xE0); - TextWindow_LoadResourcesStdFrame0(0, 0x013, 0xD0); - TextWindow_SetStdFrame0_WithPal(0, 0x00A, 0xC0); - LoadPalette(gTMCaseMainWindowPalette, 0xF0, 0x20); + LoadUserWindowGfx(0, 0x001, 0xE0); + LoadMenuMessageWindowGfx(0, 0x013, 0xD0); + LoadStdWindowGfx(0, 0x00A, 0xC0); + LoadPalette(gStandardMenuPalette, 0xF0, 0x20); for (i = 0; i < 3; i++) FillWindowPixelBuffer(i, PIXEL_FILL(0)); PutWindowTilemap(0); diff --git a/src/berry_powder.c b/src/berry_powder.c index fdb94feae..9482d1a57 100644 --- a/src/berry_powder.c +++ b/src/berry_powder.c @@ -119,7 +119,7 @@ void DisplayBerryPowderVendorMenu(void) sBerryPowderVendorWindowId = AddWindow(&template); FillWindowPixelBuffer(sBerryPowderVendorWindowId, 0); PutWindowTilemap(sBerryPowderVendorWindowId); - TextWindow_SetStdFrame0_WithPal(sBerryPowderVendorWindowId, 0x21D, 0xD0); + LoadStdWindowGfx(sBerryPowderVendorWindowId, 0x21D, 0xD0); DrawPlayerPowderAmount(sBerryPowderVendorWindowId, 0x21D, 0xD, GetBerryPowder()); } } diff --git a/src/buy_menu_helpers.c b/src/buy_menu_helpers.c index c0fef9fd8..ccf13ad45 100644 --- a/src/buy_menu_helpers.c +++ b/src/buy_menu_helpers.c @@ -162,9 +162,9 @@ void BuyMenuInitWindows(bool32 isSellingTM) else InitWindows(sShopBuyMenuWindowTemplatesTM); DeactivateAllTextPrinters(); - TextWindow_SetUserSelectedFrame(0, 0x1, 0xD0); - TextWindow_LoadResourcesStdFrame0(0, 0x13, 0xE0); - TextWindow_SetStdFrame0_WithPal(0, 0xA, 0xF0); + LoadUserWindowGfx(0, 0x1, 0xD0); + LoadMenuMessageWindowGfx(0, 0x13, 0xE0); + LoadStdWindowGfx(0, 0xA, 0xF0); PutWindowTilemap(0); PutWindowTilemap(4); PutWindowTilemap(5); diff --git a/src/clear_save_data_screen.c b/src/clear_save_data_screen.c index 460f9c4d6..4cddf5f03 100644 --- a/src/clear_save_data_screen.c +++ b/src/clear_save_data_screen.c @@ -101,8 +101,8 @@ static void Task_DrawClearSaveDataScreen(u8 taskId) SaveClearScreen_GpuInit(); break; case 3: - TextWindow_SetStdFrame0_WithPal(0, 0x001, 0xF0); - TextWindow_SetStdFrame0_WithPal(1, 0x001, 0xF0); + LoadStdWindowGfx(0, 0x001, 0xF0); + LoadStdWindowGfx(1, 0x001, 0xF0); break; case 4: DrawStdFrameWithCustomTileAndPalette(1, TRUE, 0x001, 0xF); diff --git a/src/coins.c b/src/coins.c index 3a8019b75..c4d0819a8 100644 --- a/src/coins.c +++ b/src/coins.c @@ -83,7 +83,7 @@ void ShowCoinsWindow(u32 coinAmount, u8 x, u8 y) sCoinsWindowId = AddWindow(&template); FillWindowPixelBuffer(sCoinsWindowId, 0); PutWindowTilemap(sCoinsWindowId); - TextWindow_SetStdFrame0_WithPal(sCoinsWindowId, 0x21D, 0xD0); + LoadStdWindowGfx(sCoinsWindowId, 0x21D, 0xD0); DrawStdFrameWithCustomTileAndPalette(sCoinsWindowId, FALSE, 0x21D, 0xD); AddTextPrinterParameterized(sCoinsWindowId, FONT_2, gText_Coins_2, 0, 0, 0xFF, 0); PrintCoinsString(coinAmount); diff --git a/src/daycare.c b/src/daycare.c index 45f29a641..d7d2a8caa 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1956,7 +1956,7 @@ static void CB2_EggHatch_1(void) case 9: if (!IsTextPrinterActive(sEggHatchData->windowId)) { - LoadUserWindowBorderGfx(sEggHatchData->windowId, 0x140, 0xE0); + LoadUserWindowGfx2(sEggHatchData->windowId, 0x140, 0xE0); CreateYesNoMenu(&sYesNoWinTemplate, FONT_3, 0, 2, 0x140, 0xE, 0); sEggHatchData->CB2_state++; } diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 69b42f24a..d339a2277 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -3002,7 +3002,7 @@ static void PrintRecordsText(u8 windowId) recordNums[1] = gSaveBlock2Ptr->berryPick.bestScore; recordNums[2] = gSaveBlock2Ptr->berryPick.berriesPickedInRow; - TextWindow_SetStdFrame0_WithPal(windowId, 0x21D, 0xD0); + LoadStdWindowGfx(windowId, 0x21D, 0xD0); DrawTextBorderOuter(windowId, 0x21D, 0xD); FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); AddTextPrinterParameterized(windowId, FONT_2, sRecordsTexts[0], 1, 1, TEXT_SKIP_DRAW, NULL); @@ -4160,13 +4160,13 @@ static void ResetBerryAndStatusBarSprites(void) static void LoadWindowFrameGfx(u8 frameId) { - LoadBgTiles(BG_INTERFACE, GetWindowFrameTilesPal(frameId)->tiles, 0x120, 1); - LoadPalette(GetWindowFrameTilesPal(frameId)->palette, 0xA0, 0x20); + LoadBgTiles(BG_INTERFACE, GetUserWindowGraphics(frameId)->tiles, 0x120, 1); + LoadPalette(GetUserWindowGraphics(frameId)->palette, 0xA0, 0x20); } -static void LoadUserWindowFrameGfx(void) +static void DBP_LoadStdWindowGfx(void) { - TextWindow_SetStdFrame0_WithPal(0, 0xA, 0xB0); + LoadStdWindowGfx(0, 0xA, 0xB0); } static void ResetGfxState(void) @@ -4341,7 +4341,7 @@ static void LoadGfx(void) break; case 4: LoadWindowFrameGfx(gSaveBlock2Ptr->optionsWindowFrameType); - LoadUserWindowFrameGfx(); + DBP_LoadStdWindowGfx(); sGfx->state++; break; default: @@ -4942,7 +4942,7 @@ static bool32 LoadBgGfx(void) return FALSE; break; case 5: - LoadPalette(stdpal_get(3), 0xD0, 0x20); + LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20); break; default: sGfx->loadState = 0; diff --git a/src/easy_chat_3.c b/src/easy_chat_3.c index 5cb4b741b..6b135cdf2 100644 --- a/src/easy_chat_3.c +++ b/src/easy_chat_3.c @@ -1347,7 +1347,7 @@ static void EC_AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *st static void PrintECInstructionsText(void) { FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17); - TextWindow_SetUserSelectedFrame(1, 1, 0xE0); + LoadUserWindowGfx(1, 1, 0xE0); DrawTextBorderOuter(1, 1, 14); PrintECInterfaceTextById(0); PutWindowTilemap(1); diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 4b2a0fc70..2531cfc31 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -1331,7 +1331,7 @@ static void Task_TradeEvolutionScene(u8 taskId) case T_MVSTATE_PRINT_YES_NO: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - LoadUserWindowBorderGfx(0, 0xA8, 0xE0); + LoadUserWindowGfx2(0, 0xA8, 0xE0); CreateYesNoMenu(&gTradeEvolutionSceneYesNoWindowTemplate, FONT_3, 0, 2, 0xA8, 0xE, 0); sEvoCursorPos = 0; gTasks[taskId].tLearnMoveState++; diff --git a/src/fame_checker.c b/src/fame_checker.c index 3d7b15f2d..36516b986 100644 --- a/src/fame_checker.c +++ b/src/fame_checker.c @@ -667,7 +667,7 @@ static void MainCB2_LoadFameChecker(void) LoadPalette(gFameCheckerBgPals + 0x10, 0x10, 0x20); CopyToBgTilemapBufferRect(2, gFameCheckerBg2Tilemap, 0, 0, 32, 32); CopyToBgTilemapBufferRect_ChangePalette(1, sFameCheckerTilemap, 30, 0, 32, 32, 0x11); - LoadPalette(stdpal_get(2), 0xF0, 0x20); + LoadPalette(GetTextWindowPalette(2), 0xF0, 0x20); gMain.state++; break; case 4: diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 7e00cc778..e820c992e 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -197,7 +197,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) u16 metatileBehavior; u32 metatileAttributes; - ResetFacingNpcOrSignPostVars(); + ResetFacingNpcOrSignpostVars(); playerDirection = GetPlayerFacingDirection(); GetPlayerPosition(&position); metatileAttributes = MapGridGetMetatileAttributeAt(position.x, position.y, METATILE_ATTRIBUTES_ALL); @@ -507,7 +507,7 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position } if (signpostType != SIGNPOST_NA) - MsgSetSignPost(); + MsgSetSignpost(); gSpecialVar_Facing = direction; return bgEvent->bgUnion.script; } @@ -577,22 +577,22 @@ static const u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 me return CableClub_EventScript_ShowBattleRecords; if (MetatileBehavior_IsIndigoPlateauSign1(metatileBehavior) == TRUE) { - MsgSetSignPost(); + MsgSetSignpost(); return EventScript_Indigo_UltimateGoal; } if (MetatileBehavior_IsIndigoPlateauSign2(metatileBehavior) == TRUE) { - MsgSetSignPost(); + MsgSetSignpost(); return EventScript_Indigo_HighestAuthority; } if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, direction) == TRUE) { - MsgSetSignPost(); + MsgSetSignpost(); return EventScript_PokemartSign; } if (MetatileBehavior_IsPlayerFacingPokemonCenterSign(metatileBehavior, direction) == TRUE) { - MsgSetSignPost(); + MsgSetSignpost(); return EventScript_PokecenterSign; } return NULL; @@ -809,7 +809,7 @@ static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection) gSpecialVar_Facing = playerDirection; ScriptContext_SetupScript(script); SetWalkingIntoSignVars(); - MsgSetSignPost(); + MsgSetSignpost(); } static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position) diff --git a/src/field_message_box.c b/src/field_message_box.c index 8f75ce78d..74f441c88 100644 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -28,12 +28,12 @@ static void Task_DrawFieldMessageBox(u8 taskId) if (gQuestLogState == QL_STATE_PLAYBACK) { gTextFlags.autoScroll = TRUE; - TextWindow_LoadTilesStdFrame1(0, 0x200); + LoadQuestLogWindowTiles(0, 0x200); } - else if (!IsMsgSignPost()) + else if (!IsMsgSignpost()) LoadStdWindowFrameGfx(); else - LoadSignPostWindowFrameGfx(); + LoadSignpostWindowFrameGfx(); task->data[0]++; break; case 1: diff --git a/src/field_specials.c b/src/field_specials.c index 1884507ad..cf500e59f 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1096,7 +1096,7 @@ void DrawElevatorCurrentFloorWindow(void) if (QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) != TRUE) { sElevatorCurrentFloorWindowId = AddWindow(&sElevatorCurrentFloorWindowTemplate); - TextWindow_SetStdFrame0_WithPal(sElevatorCurrentFloorWindowId, 0x21D, 0xD0); + LoadStdWindowGfx(sElevatorCurrentFloorWindowId, 0x21D, 0xD0); DrawStdFrameWithCustomTileAndPalette(sElevatorCurrentFloorWindowId, FALSE, 0x21D, 0xD); AddTextPrinterParameterized(sElevatorCurrentFloorWindowId, FONT_2, gText_NowOn, 0, 2, 0xFF, NULL); floorname = sFloorNamePointers[gSpecialVar_0x8005]; diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 7d5423e09..92248ac4c 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -620,7 +620,7 @@ static void Task_Hof_SpawnPlayerPic(u8 taskId) ShowBg(3); gTasks[taskId].data[4] = CreateTrainerPicSprite(PlayerGenderToFrontTrainerPicId_Debug(gSaveBlock2Ptr->playerGender, TRUE), TRUE, 0x78, 0x48, 6, 0xFFFF); AddWindow(&sWindowTemplate); - TextWindow_SetStdFrame0_WithPal(1, 0x21D, 0xD0); + LoadStdWindowGfx(1, 0x21D, 0xD0); gTasks[taskId].data[3] = 120; gTasks[taskId].func = Task_Hof_WaitAndPrintPlayerInfo; } diff --git a/src/help_message.c b/src/help_message.c index 5f3af1668..bb8975844 100644 --- a/src/help_message.c +++ b/src/help_message.c @@ -5,7 +5,7 @@ static EWRAM_DATA u8 sHelpMessageWindowId = 0; -const u8 gUnknown_84566A8[] = INCBIN_U8("graphics/unknown/unknown_84566a8.bin"); +const u8 gHelpMessageWindow_Gfx[] = INCBIN_U8("graphics/help_system/msg_window.4bpp"); static const struct WindowTemplate sHelpMessageWindowTemplate = { .bg = 0, @@ -19,12 +19,12 @@ static const struct WindowTemplate sHelpMessageWindowTemplate = { void MapNamePopupWindowIdSetDummy(void) { - sHelpMessageWindowId = 0xFF; + sHelpMessageWindowId = WINDOW_NONE; } u8 CreateHelpMessageWindow(void) { - if (sHelpMessageWindowId == 0xFF) + if (sHelpMessageWindowId == WINDOW_NONE) { sHelpMessageWindowId = AddWindow(&sHelpMessageWindowTemplate); PutWindowTilemap(sHelpMessageWindowId); @@ -34,7 +34,7 @@ u8 CreateHelpMessageWindow(void) void DestroyHelpMessageWindow(u8 a0) { - if (sHelpMessageWindowId != 0xFF) + if (sHelpMessageWindowId != WINDOW_NONE) { FillWindowPixelBuffer(sHelpMessageWindowId, PIXEL_FILL(0)); ClearWindowTilemap(sHelpMessageWindowId); @@ -43,13 +43,13 @@ void DestroyHelpMessageWindow(u8 a0) CopyWindowToVram(sHelpMessageWindowId, a0); RemoveWindow(sHelpMessageWindowId); - sHelpMessageWindowId = 0xFF; + sHelpMessageWindowId = WINDOW_NONE; } } void sub_8112F18(u8 windowId) { - const u8 *ptr = gUnknown_84566A8; + const u8 *ptr = gHelpMessageWindow_Gfx; u8 *buffer; u8 i, j; u8 width, height; diff --git a/src/item_pc.c b/src/item_pc.c index f40eb1758..22ba74f04 100644 --- a/src/item_pc.c +++ b/src/item_pc.c @@ -1069,11 +1069,11 @@ static void ItemPc_InitWindows(void) InitWindows(sWindowTemplates); DeactivateAllTextPrinters(); - TextWindow_SetUserSelectedFrame(0, 0x3C0, 0xE0); - TextWindow_SetStdFrame0_WithPal(0, 0x3A3, 0xC0); - TextWindow_LoadResourcesStdFrame0(0, 0x3AC, 0xB0); - LoadPalette(stdpal_get(2), 0xD0, 0x20); - LoadPalette(gTMCaseMainWindowPalette, 0xF0, 0x20); + LoadUserWindowGfx(0, 0x3C0, 0xE0); + LoadStdWindowGfx(0, 0x3A3, 0xC0); + LoadMenuMessageWindowGfx(0, 0x3AC, 0xB0); + LoadPalette(GetTextWindowPalette(2), 0xD0, 0x20); + LoadPalette(gStandardMenuPalette, 0xF0, 0x20); for (i = 0; i < 3; i++) { FillWindowPixelBuffer(i, 0x00); diff --git a/src/learn_move.c b/src/learn_move.c index 165b1adb4..7ebdcb27b 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -398,7 +398,7 @@ static void MoveRelearnerLoadBgGfx(void) FillWindowPixelBuffer(7, PIXEL_FILL(1)); FillBgTilemapBufferRect(0, 0x000, 0, 0, 30, 20, 0xF); SetBgTilemapBuffer(1, sMoveRelearner->bg1TilemapBuffer); - TextWindow_SetUserSelectedFrame(0, 1, 0xE0); + LoadUserWindowGfx(0, 1, 0xE0); ListMenuLoadStdPalAt(0xD0, 1); LoadPalette(gUnknown_8E97DDC, 0x00, 0x20); DecompressAndLoadBgGfxUsingHeap(1, gUnknown_8E97DFC, 0, 0, 0); diff --git a/src/link.c b/src/link.c index 21565811a..6473de242 100644 --- a/src/link.c +++ b/src/link.c @@ -1487,7 +1487,7 @@ void CB2_LinkError(void) SetGpuReg(REG_OFFSET_BG1HOFS, 0); SetGpuReg(REG_OFFSET_BG1VOFS, 0); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJWIN_ON); - LoadPalette(gTMCaseMainWindowPalette, 0xf0, 0x20); + LoadPalette(gStandardMenuPalette, 0xf0, 0x20); gSoftResetDisabled = FALSE; CreateTask(Task_DestroySelf, 0); StopMapMusic(); diff --git a/src/list_menu.c b/src/list_menu.c index a914f8bc9..b18fd5151 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -91,7 +91,7 @@ u32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const str switch (arg2) { case 2: - TextWindow_SetUserSelectedFrame(sMysteryGiftLinkMenu.windowId, tileNum, palNum); + LoadUserWindowGfx(sMysteryGiftLinkMenu.windowId, tileNum, palNum); case 1: DrawTextBorderOuter(sMysteryGiftLinkMenu.windowId, tileNum, palNum / 16); break; diff --git a/src/mail.c b/src/mail.c index ebe5e0312..121f5045b 100644 --- a/src/mail.c +++ b/src/mail.c @@ -560,7 +560,7 @@ static bool8 DoInitMailView(void) CopyBgTilemapBufferToVram(2); break; case 12: - LoadPalette(stdpal_get(0), 0xF0, 0x20); + LoadPalette(GetTextWindowPalette(0), 0xF0, 0x20); gPlttBufferUnfaded[15 * 16 + 10] = sGfxHeaders[sMailViewResources->mailType].textpals[0]; gPlttBufferFaded[15 * 16 + 10] = sGfxHeaders[sMailViewResources->mailType].textpals[0]; gPlttBufferUnfaded[15 * 16 + 11] = sGfxHeaders[sMailViewResources->mailType].textpals[1]; diff --git a/src/main_menu.c b/src/main_menu.c index bfec4a7ad..011bc2308 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -677,14 +677,14 @@ static void PrintBadgeCount(void) static void LoadUserFrameToBg(u8 bgId) { - LoadBgTiles(bgId, GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->tiles, 0x120, 0x1B1); - LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->palette, 0x20, 0x20); + LoadBgTiles(bgId, GetUserWindowGraphics(gSaveBlock2Ptr->optionsWindowFrameType)->tiles, 0x120, 0x1B1); + LoadPalette(GetUserWindowGraphics(gSaveBlock2Ptr->optionsWindowFrameType)->palette, 0x20, 0x20); MainMenu_EraseWindow(&sWindowTemplate[MAIN_MENU_WINDOW_ERROR]); } static void SetStdFrame0OnBg(u8 bgId) { - TextWindow_SetStdFrame0_WithPal(MAIN_MENU_WINDOW_NEWGAME_ONLY, 0x1B1, 0x20); + LoadStdWindowGfx(MAIN_MENU_WINDOW_NEWGAME_ONLY, 0x1B1, 0x20); MainMenu_EraseWindow(&sWindowTemplate[MAIN_MENU_WINDOW_ERROR]); } diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 8d6219858..97a98678b 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -172,13 +172,13 @@ static u16 MapNamePopupCreateWindow(bool32 palintoFadedBuffer) windowId = AddWindow(&windowTemplate); if (palintoFadedBuffer) { - LoadPalette(stdpal_get(3), 0xd0, 0x20); + LoadPalette(GetTextWindowPalette(3), 0xd0, 0x20); } else { - CpuCopy16(stdpal_get(3), &gPlttBufferUnfaded[0xd0], 0x20); + CpuCopy16(GetTextWindowPalette(3), &gPlttBufferUnfaded[0xd0], 0x20); } - sub_814FF6C(windowId, r6); + LoadStdWindowTiles(windowId, r6); DrawTextBorderOuter(windowId, r6, 0xD); PutWindowTilemap(windowId); MapNamePopupPrintMapNameOnWindow(windowId); diff --git a/src/menu.c b/src/menu.c index 23f047ea1..f09ef59df 100644 --- a/src/menu.c +++ b/src/menu.c @@ -180,7 +180,7 @@ u8 CreateTopBarWindowLoadPalette(u8 bg, u8 width, u8 yPos, u8 palette, u16 baseT palette = 15 * 16; else palette *= 16; - LoadPalette(stdpal_get(2), palette, 0x20); + LoadPalette(GetTextWindowPalette(2), palette, 0x20); return sTopBarWindowId; } diff --git a/src/mon_markings.c b/src/mon_markings.c index da633aacf..6be89222b 100644 --- a/src/mon_markings.c +++ b/src/mon_markings.c @@ -290,7 +290,7 @@ void InitMonMarkingsMenu(struct MonMarkingsMenu *ptr) static void BufferMenuWindowTiles(void) { - const struct TextWindowGraphics *frame = GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType); + const struct TextWindowGraphics *frame = GetUserWindowGraphics(gSaveBlock2Ptr->optionsWindowFrameType); sMenu->frameTiles = frame->tiles; sMenu->framePalette = frame->palette; sMenu->tileLoadState = 0; diff --git a/src/money.c b/src/money.c index cff3d8d46..7ba5b6375 100644 --- a/src/money.c +++ b/src/money.c @@ -124,7 +124,7 @@ void DrawMoneyBox(int amount, u8 x, u8 y) sMoneyBoxWindowId = AddWindow(&template); FillWindowPixelBuffer(sMoneyBoxWindowId, 0); PutWindowTilemap(sMoneyBoxWindowId); - TextWindow_SetStdFrame0_WithPal(sMoneyBoxWindowId, 0x21D, 0xD0); + LoadStdWindowGfx(sMoneyBoxWindowId, 0x21D, 0xD0); PrintMoneyAmountInMoneyBoxWithBorder(sMoneyBoxWindowId, 0x21D, 13, amount); } diff --git a/src/mystery_gift_menu.c b/src/mystery_gift_menu.c index 8ed6e80d4..e21cd6724 100644 --- a/src/mystery_gift_menu.c +++ b/src/mystery_gift_menu.c @@ -390,8 +390,8 @@ bool32 HandleMysteryGiftOrEReaderSetup(s32 mg_or_ereader) SetBgTilemapBuffer(1, Alloc(0x800)); SetBgTilemapBuffer(0, Alloc(0x800)); - LoadUserWindowBorderGfx(0, 10, 0xE0); - DrawWindowBorderWithStdpal3(0, 1, 0xF0); + LoadUserWindowGfx2(0, 10, 0xE0); + LoadStdWindowGfxOnBg(0, 1, 0xF0); DecompressAndLoadBgGfxUsingHeap(3, gUnkTextboxBorderGfx, 0x100, 0, 0); InitWindows(sMainWindows); DeactivateAllTextPrinters(); @@ -403,7 +403,7 @@ bool32 HandleMysteryGiftOrEReaderSetup(s32 mg_or_ereader) break; case 1: LoadPalette(gUnkTextboxBorderPal, 0, 0x20); - LoadPalette(stdpal_get(2), 0xd0, 0x20); + LoadPalette(GetTextWindowPalette(2), 0xd0, 0x20); FillBgTilemapBufferRect(0, 0x000, 0, 0, 32, 32, 0x11); FillBgTilemapBufferRect(1, 0x000, 0, 0, 32, 32, 0x11); FillBgTilemapBufferRect(2, 0x000, 0, 0, 32, 32, 0x11); diff --git a/src/naming_screen.c b/src/naming_screen.c index 57560c3d7..514629ae4 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -1874,7 +1874,7 @@ static void LoadPalettes(void) { LoadPalette(gNamingScreenMenu_Pal, 0, sizeof(gNamingScreenMenu_Pal)); LoadPalette(gNamingScreenKeyboard_Pal, 0xA0, 0x20); - LoadPalette(stdpal_get(2), 0xB0, 0x20); + LoadPalette(GetTextWindowPalette(2), 0xB0, 0x20); } static void DecompressToBgTilemapBuffer(u8 bg, const u32 *src) diff --git a/src/new_menu_helpers.c b/src/new_menu_helpers.c index 58952c3c0..8f60a8628 100644 --- a/src/new_menu_helpers.c +++ b/src/new_menu_helpers.c @@ -19,21 +19,26 @@ static EWRAM_DATA u16 sTempTileDataBufferCursor = {0}; static EWRAM_DATA void *sTempTileDataBuffers[0x20] = {NULL}; static EWRAM_DATA u8 sStartMenuWindowId = {0}; -static const u16 gUnknown_841EF48[] = INCBIN_U16("graphics/unknown/unk_841EF48.4bpp"); +static const u16 sUnusedWindow_Gfx[] = INCBIN_U16("graphics/text_window/unused.4bpp"); +const u16 gMenuMessageWindow_Gfx[] = INCBIN_U16("graphics/text_window/menu_message.4bpp"); -const u16 gUnknown_841F1C8[] = INCBIN_U16("graphics/text_window/unk_841F1C8.4bpp"); -const u16 gTMCaseMainWindowPalette[] = INCBIN_U16("graphics/tm_case/unk_841F408.gbapal"); +const u16 gStandardMenuPalette[] = INCBIN_U16("graphics/interface/std_menu.gbapal"); -static const u8 gUnknown_841F428[] = { 8, 4, 1 }; +static const u8 sTextSpeedFrameDelays[] = +{ + [OPTIONS_TEXT_SPEED_SLOW] = 8, + [OPTIONS_TEXT_SPEED_MID] = 4, + [OPTIONS_TEXT_SPEED_FAST] = 1 +}; static const struct WindowTemplate sStandardTextBox_WindowTemplates[] = { { .bg = 0, - .tilemapLeft = 0x2, - .tilemapTop = 0xF, - .width = 0x1A, - .height = 0x4, + .tilemapLeft = 2, + .tilemapTop = 15, + .width = 26, + .height = 4, .paletteNum = DLG_WINDOW_PALETTE_NUM, .baseBlock = 0x198, }, @@ -43,10 +48,10 @@ static const struct WindowTemplate sStandardTextBox_WindowTemplates[] = static const struct WindowTemplate sYesNo_WindowTemplate = { .bg = 0, - .tilemapLeft = 0x15, - .tilemapTop = 0x9, - .width = 0x6, - .height = 0x4, + .tilemapLeft = 21, + .tilemapTop = 9, + .width = 6, + .height = 4, .paletteNum = DLG_WINDOW_PALETTE_NUM, .baseBlock = 0x125, }; @@ -455,14 +460,14 @@ void LoadStdWindowFrameGfx(void) if (gQuestLogState == QL_STATE_PLAYBACK) { gTextFlags.autoScroll = 1; - TextWindow_LoadTilesStdFrame1(0, DLG_WINDOW_BASE_TILE_NUM); + LoadQuestLogWindowTiles(0, DLG_WINDOW_BASE_TILE_NUM); } else { Menu_LoadStdPal(); - TextWindow_LoadResourcesStdFrame0(0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10); + LoadMenuMessageWindowGfx(0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10); } - TextWindow_SetUserSelectedFrame(0, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM * 0x10); + LoadUserWindowGfx(0, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM * 0x10); } void DrawDialogueFrame(u8 windowId, bool8 copyToVram) @@ -522,7 +527,7 @@ static void WindowFunc_DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u static void WindowFunc_DrawDialogueFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { - if (!IsMsgSignPost() || gQuestLogState == QL_STATE_PLAYBACK) + if (!IsMsgSignpost() || gQuestLogState == QL_STATE_PLAYBACK) { FillBgTilemapBufferRect(bg, DLG_WINDOW_BASE_TILE_NUM + 0, tilemapLeft - 2, tilemapTop - 1, 1, 1, DLG_WINDOW_PALETTE_NUM); FillBgTilemapBufferRect(bg, DLG_WINDOW_BASE_TILE_NUM + 1, tilemapLeft - 1, tilemapTop - 1, 1, 1, DLG_WINDOW_PALETTE_NUM); @@ -609,35 +614,36 @@ void sub_80F7768(u8 windowId, bool8 copyToVram) if (gQuestLogState == QL_STATE_PLAYBACK) { gTextFlags.autoScroll = 1; - TextWindow_LoadTilesStdFrame1(0, DLG_WINDOW_BASE_TILE_NUM); + LoadQuestLogWindowTiles(0, DLG_WINDOW_BASE_TILE_NUM); } else { - TextWindow_LoadResourcesStdFrame0(windowId, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10); + LoadMenuMessageWindowGfx(windowId, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10); } DrawDialogFrameWithCustomTileAndPalette(windowId, copyToVram, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM); } void Menu_LoadStdPal(void) { - LoadPalette(gTMCaseMainWindowPalette, STD_WINDOW_PALETTE_NUM * 0x10, 0x14); + LoadPalette(gStandardMenuPalette, STD_WINDOW_PALETTE_NUM * 0x10, 0x14); } void Menu_LoadStdPalAt(u16 offset) { - LoadPalette(gTMCaseMainWindowPalette, offset, 0x14); + LoadPalette(gStandardMenuPalette, offset, 0x14); } -static const u16 *GetTmCaseMainWindowPalette(void) +// Unused +static const u16 *GetStdMenuPalette(void) { - return gTMCaseMainWindowPalette; + return gStandardMenuPalette; } static u16 GetStdPalColor(u8 colorNum) { if (colorNum > 0xF) colorNum = 0; - return gTMCaseMainWindowPalette[colorNum]; + return gStandardMenuPalette[colorNum]; } void DisplayItemMessageOnField(u8 taskId, u8 fontId, const u8 *string, TaskFunc callback) @@ -662,7 +668,7 @@ u8 GetTextSpeedSetting(void) u32 speed; if (gSaveBlock2Ptr->optionsTextSpeed > OPTIONS_TEXT_SPEED_FAST) gSaveBlock2Ptr->optionsTextSpeed = OPTIONS_TEXT_SPEED_MID; - return gUnknown_841F428[gSaveBlock2Ptr->optionsTextSpeed]; + return sTextSpeedFrameDelays[gSaveBlock2Ptr->optionsTextSpeed]; } u8 CreateStartMenuWindow(u8 height) @@ -702,7 +708,7 @@ u16 GetStdWindowBaseTileNum(void) void DrawHelpMessageWindowWithText(const u8 * text) { - sub_814FE6C(CreateHelpMessageWindow(), DLG_WINDOW_BASE_TILE_NUM, 0x10 * DLG_WINDOW_PALETTE_NUM); + LoadHelpMessageWindowGfx(CreateHelpMessageWindow(), DLG_WINDOW_BASE_TILE_NUM, 0x10 * DLG_WINDOW_PALETTE_NUM); PrintTextOnHelpMessageWindow(text, 2); } @@ -711,11 +717,11 @@ void DestroyHelpMessageWindow_(void) DestroyHelpMessageWindow(2); } -void LoadSignPostWindowFrameGfx(void) +void LoadSignpostWindowFrameGfx(void) { Menu_LoadStdPal(); - sub_814FEEC(0, DLG_WINDOW_BASE_TILE_NUM, 0x10 * DLG_WINDOW_PALETTE_NUM); - TextWindow_SetUserSelectedFrame(0, STD_WINDOW_BASE_TILE_NUM, 0x10 * STD_WINDOW_PALETTE_NUM); + LoadSignpostWindowGfx(0, DLG_WINDOW_BASE_TILE_NUM, 0x10 * DLG_WINDOW_PALETTE_NUM); + LoadUserWindowGfx(0, STD_WINDOW_BASE_TILE_NUM, 0x10 * STD_WINDOW_PALETTE_NUM); } void SetDefaultFontsPointer(void) diff --git a/src/oak_speech.c b/src/oak_speech.c index 9dd2d5175..7fb20aa4e 100644 --- a/src/oak_speech.c +++ b/src/oak_speech.c @@ -548,7 +548,7 @@ static void Task_OaksSpeech1(u8 taskId) InitTextBoxGfxAndPrinters(); Menu_LoadStdPalAt(0xD0); LoadPalette(sHelpDocsPalette, 0x000, 0x080); - LoadPalette(stdpal_get(2) + 15, 0x000, 0x002); + LoadPalette(GetTextWindowPalette(2) + 15, 0x000, 0x002); break; case 5: sOakSpeechResources->textSpeed = GetTextSpeedSetting(); @@ -629,7 +629,7 @@ static void Task_OakSpeech4(u8 taskId) } CopyBgTilemapBufferToVram(1); } - BeginNormalPaletteFade(0xFFFFDFFF, -1, 16, 0, stdpal_get(2)[15]); + BeginNormalPaletteFade(0xFFFFDFFF, -1, 16, 0, GetTextWindowPalette(2)[15]); gTasks[taskId].func = Task_OaksSpeech2; } @@ -642,7 +642,7 @@ static void Task_OaksSpeech2(u8 taskId) gTasks[taskId].data[15] = 1; if (sOakSpeechResources->unk_0012 < 2) { - BeginNormalPaletteFade(0xFFFFDFFF, -1, 0, 16, stdpal_get(2)[15]); + BeginNormalPaletteFade(0xFFFFDFFF, -1, 0, 16, GetTextWindowPalette(2)[15]); } } else @@ -650,7 +650,7 @@ static void Task_OaksSpeech2(u8 taskId) if (sOakSpeechResources->unk_0012 != 0) { gTasks[taskId].data[15] = -1; - BeginNormalPaletteFade(0xFFFFDFFF, -1, 0, 16, stdpal_get(2)[15]); + BeginNormalPaletteFade(0xFFFFDFFF, -1, 0, 16, GetTextWindowPalette(2)[15]); } else return; diff --git a/src/option_menu.c b/src/option_menu.c index 6cbf9e18a..49de39a62 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -337,17 +337,17 @@ static bool8 LoadOptionMenuPalette(void) switch (sOptionMenuPtr->loadPaletteState) { case 0: - LoadBgTiles(1, GetWindowFrameTilesPal(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->tiles, 0x120, 0x1AA); + LoadBgTiles(1, GetUserWindowGraphics(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->tiles, 0x120, 0x1AA); break; case 1: - LoadPalette(GetWindowFrameTilesPal(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->palette, 0x20, 0x20); + LoadPalette(GetUserWindowGraphics(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->palette, 0x20, 0x20); break; case 2: LoadPalette(sOptionMenuPalette, 0x10, 0x20); - LoadPalette(stdpal_get(2), 0xF0, 0x20); + LoadPalette(GetTextWindowPalette(2), 0xF0, 0x20); break; case 3: - DrawWindowBorderWithStdpal3(1, 0x1B3, 0x30); + LoadStdWindowGfxOnBg(1, 0x1B3, 0x30); break; default: return TRUE; @@ -381,8 +381,8 @@ static void Task_OptionMenu(u8 taskId) sOptionMenuPtr->loadState++; break; case 2: - LoadBgTiles(1, GetWindowFrameTilesPal(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->tiles, 0x120, 0x1AA); - LoadPalette(GetWindowFrameTilesPal(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->palette, 0x20, 0x20); + LoadBgTiles(1, GetUserWindowGraphics(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->tiles, 0x120, 0x1AA); + LoadPalette(GetUserWindowGraphics(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->palette, 0x20, 0x20); BufferOptionMenuString(sOptionMenuPtr->cursorPos); break; case 3: diff --git a/src/party_menu.c b/src/party_menu.c index 33293ed9c..400761801 100644 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -2006,8 +2006,8 @@ static void Task_FirstBattleEnterParty_WaitFadeNormal(u8 taskId) { if (!gPaletteFade.active) { - TextWindow_SetUserSelectedFrame(0, 0x4F, 0xD0); - TextWindow_SetStdFrame0_WithPal(0, 0x58, 0xF0); + LoadUserWindowGfx(0, 0x4F, 0xD0); + LoadStdWindowGfx(0, 0x58, 0xF0); if (gPartyMenu.action == PARTY_ACTION_USE_ITEM) DisplayPartyMenuStdMessage(PARTY_MSG_USE_ON_WHICH_MON); else @@ -2117,10 +2117,10 @@ static void InitPartyMenuWindows(u8 layout) DeactivateAllTextPrinters(); for (i = 0; i < PARTY_SIZE; ++i) FillWindowPixelBuffer(i, PIXEL_FILL(0)); - TextWindow_SetUserSelectedFrame(0, 0x4F, 0xD0); - TextWindow_SetStdFrame0_WithPal(0, 0x58, 0xF0); - LoadPalette(stdpal_get(2), 0xC0, 0x20); - LoadPalette(stdpal_get(0), 0xE0, 0x20); + LoadUserWindowGfx(0, 0x4F, 0xD0); + LoadStdWindowGfx(0, 0x58, 0xF0); + LoadPalette(GetTextWindowPalette(2), 0xC0, 0x20); + LoadPalette(GetTextWindowPalette(0), 0xE0, 0x20); } static void CreateCancelConfirmWindows(bool8 chooseMultiple) @@ -2603,7 +2603,7 @@ static bool8 FirstBattleEnterParty_CreateWindowAndMsg1Printer(void) { u8 windowId = AddWindow(&sWindowTemplate_FirstBattleOakVoiceover); - TextWindow_LoadResourcesStdFrame0(windowId, 0x4F, 0xE0); + LoadMenuMessageWindowGfx(windowId, 0x4F, 0xE0); DrawDialogFrameWithCustomTileAndPalette(windowId, 1, 0x4F, 0xE); PartyMenu_Oak_PrintText(windowId, gText_OakImportantToGetToKnowPokemonThroughly); return windowId; diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index b0d466704..39e13f786 100644 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -3053,8 +3053,8 @@ static void LoadPokeJumpGfx(void) FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 0x20, 0x20); PrintScoreSuffixes(); PrintScore(0); - DrawWindowBorderWithStdpal3(0, 1, 0xE0); - LoadUserWindowBorderGfx(0, 0x00A, 0xD0); + LoadStdWindowGfxOnBg(0, 1, 0xE0); + LoadUserWindowGfx2(0, 0x00A, 0xD0); CopyBgTilemapBufferToVram(BG_INTERFACE); CopyBgTilemapBufferToVram(BG_VENUSAUR); CopyBgTilemapBufferToVram(BG_BONUSES); @@ -4554,7 +4554,7 @@ static void PrintRecordsText(u16 windowId) recordNums[1] = records->bestJumpScore; recordNums[2] = records->excellentsInRow; - TextWindow_SetStdFrame0_WithPal(windowId, 0x21D, 0xD0); + LoadStdWindowGfx(windowId, 0x21D, 0xD0); DrawTextBorderOuter(windowId, 0x21D, 0xD); FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); AddTextPrinterParameterized5(windowId, FONT_2, gText_PkmnJumpRecords, 0, 0, TEXT_SKIP_DRAW, NULL, 1, 0); diff --git a/src/pokemon_special_anim_scene.c b/src/pokemon_special_anim_scene.c index ea853322a..2643dd01a 100644 --- a/src/pokemon_special_anim_scene.c +++ b/src/pokemon_special_anim_scene.c @@ -341,7 +341,7 @@ void InitPokemonSpecialAnimScene(struct PokemonSpecialAnimScene * buffer, u16 an FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 32, 32); LoadBgGfxByAnimType(animType); FillWindowPixelBuffer(0, PIXEL_FILL(0)); - TextWindow_SetUserSelectedFrame(0, 0x000, 0xe0); + LoadUserWindowGfx(0, 0x000, 0xe0); CopyWindowToVram(0, COPYWIN_FULL); ShowBg(0); ShowBg(3); diff --git a/src/pokemon_storage_system_misc.c b/src/pokemon_storage_system_misc.c index 2cfa98152..4bc94532f 100644 --- a/src/pokemon_storage_system_misc.c +++ b/src/pokemon_storage_system_misc.c @@ -167,7 +167,7 @@ static bool8 MultiMove_Function_Single(void) if (!IsDma3ManagerBusyWithBgCopy()) { SetCursorPriorityTo1(); - LoadPalette(stdpal_get(3), 0xD0, 0x20); + LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20); ShowBg(0); return FALSE; } @@ -273,7 +273,7 @@ static bool8 MultiMove_Function_PlaceMons(void) case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - LoadPalette(stdpal_get(3), 0xD0, 0x20); + LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20); SetCursorPriorityTo1(); ShowBg(0); return FALSE; diff --git a/src/pokemon_storage_system_tasks.c b/src/pokemon_storage_system_tasks.c index bad54118e..3911cf2c1 100644 --- a/src/pokemon_storage_system_tasks.c +++ b/src/pokemon_storage_system_tasks.c @@ -534,7 +534,7 @@ static void Task_InitPokeStorage(u8 taskId) PutWindowTilemap(0); ClearWindowTilemap(1); CpuFill32(0, (void *)VRAM, 0x200); - TextWindow_SetUserSelectedFrame(1, 0xB, 0xE0); + LoadUserWindowGfx(1, 0xB, 0xE0); break; case 3: ResetAllBgCoords(); @@ -2545,7 +2545,7 @@ static bool8 DoShowPartyMenu(void) static void InitPokeStorageBg0(void) { SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(29)); - TextWindow_SetStdFrame0_WithPal(1, 2, 0xD0); + LoadStdWindowGfx(1, 2, 0xD0); FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17); CopyBgTilemapBufferToVram(0); } diff --git a/src/quest_log.c b/src/quest_log.c index 35a3e43c8..e6e8336f4 100644 --- a/src/quest_log.c +++ b/src/quest_log.c @@ -459,7 +459,7 @@ void sub_8110FCC(void) static bool8 FieldCB2_QuestLogStartPlaybackWithWarpExit(void) { - LoadPalette(stdpal_get(4), 0xF0, 0x20); + LoadPalette(GetTextWindowPalette(4), 0xF0, 0x20); SetQuestLogState(QL_STATE_PLAYBACK); FieldCB_DefaultWarpExit(); sQuestLogCurrentScene = (struct UnkStruct_203AE94){}; @@ -469,7 +469,7 @@ static bool8 FieldCB2_QuestLogStartPlaybackWithWarpExit(void) static bool8 FieldCB2_QuestLogStartPlaybackStandingInPlace(void) { - LoadPalette(stdpal_get(4), 0xF0, 0x20); + LoadPalette(GetTextWindowPalette(4), 0xF0, 0x20); SetQuestLogState(QL_STATE_PLAYBACK); FieldCB_WarpExitFadeFromBlack(); sQuestLogCurrentScene = (struct UnkStruct_203AE94){}; @@ -1076,7 +1076,7 @@ void QuestLog_BackUpPalette(u16 offset, u16 size) static bool8 FieldCB2_FinalScene(void) { - LoadPalette(stdpal_get(4), 0xF0, 0x20); + LoadPalette(GetTextWindowPalette(4), 0xF0, 0x20); DrawPreviouslyOnQuestHeader(0); FieldCB_WarpExitFadeFromBlack(); CreateTask(Task_FinalScene_WaitFade, 0xFF); diff --git a/src/scrcmd.c b/src/scrcmd.c index 6e35e83ea..12d0a9588 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -2212,13 +2212,13 @@ bool8 ScrCmd_removecoins(struct ScriptContext * ctx) bool8 ScrCmd_signmsg(struct ScriptContext * ctx) { - MsgSetSignPost(); + MsgSetSignpost(); return FALSE; } bool8 ScrCmd_normalmsg(struct ScriptContext * ctx) { - MsgSetNotSignPost(); + MsgSetNotSignpost(); return FALSE; } diff --git a/src/script.c b/src/script.c index 0ae8d9a8f..641c63572 100644 --- a/src/script.c +++ b/src/script.c @@ -36,7 +36,7 @@ static u8 sMsgBoxWalkawayDisabled; static u8 sMsgBoxIsCancelable; static u8 sQuestLogInput; static u8 sQuestLogInputIsDpad; -static u8 sMsgIsSignPost; +static u8 sMsgIsSignpost; extern ScrCmdFunc gScriptCmdTable[]; extern ScrCmdFunc gScriptCmdTableEnd[]; @@ -276,28 +276,28 @@ bool8 CanWalkAwayToCancelMsgBox(void) return FALSE; } -void MsgSetSignPost(void) +void MsgSetSignpost(void) { - sMsgIsSignPost = TRUE; + sMsgIsSignpost = TRUE; } -void MsgSetNotSignPost(void) +void MsgSetNotSignpost(void) { - sMsgIsSignPost = FALSE; + sMsgIsSignpost = FALSE; } -bool8 IsMsgSignPost(void) +bool8 IsMsgSignpost(void) { - if(sMsgIsSignPost == TRUE) + if(sMsgIsSignpost == TRUE) return TRUE; else return FALSE; } -void ResetFacingNpcOrSignPostVars(void) +void ResetFacingNpcOrSignpostVars(void) { ResetContextNpcTextColor(); - MsgSetNotSignPost(); + MsgSetNotSignpost(); } // The ScriptContext_* functions work with the primary script context, diff --git a/src/seagallop.c b/src/seagallop.c index 0c8ab7500..73e580894 100644 --- a/src/seagallop.c +++ b/src/seagallop.c @@ -212,7 +212,7 @@ static void CB2_SetUpSeagallopScene(void) CopyToBgTilemapBufferRect(3, sWaterTilemap_WB, 0, 0, 32, 32); } LoadPalette(sWaterPal, 0x40, 0x20); - LoadPalette(stdpal_get(2), 0xF0, 0x20); + LoadPalette(GetTextWindowPalette(2), 0xF0, 0x20); gMain.state++; break; case 4: diff --git a/src/slot_machine.c b/src/slot_machine.c index 8ec307ea0..1e59680fc 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -1975,8 +1975,8 @@ static bool8 SlotsTask_GraphicsInit(u8 * state, struct SlotMachineSetupTaskData LoadPalette(sBgPal_50, 0x50, 0x20); LoadPalette(sBgPal_70, 0x70, 0x60); LoadColor(RGB(30, 30, 31), pal); - LoadUserWindowBorderGfx(0, 0x00A, 0xD0); - DrawWindowBorderWithStdpal3(0, 0x001, 0xF0); + LoadUserWindowGfx2(0, 0x00A, 0xD0); + LoadStdWindowGfxOnBg(0, 0x001, 0xF0); SetBgTilemapBuffer(0, ptr->bg0TilemapBuffer); FillBgTilemapBufferRect_Palette0(0, 0, 0, 2, 32, 30); @@ -1984,7 +1984,7 @@ static bool8 SlotsTask_GraphicsInit(u8 * state, struct SlotMachineSetupTaskData DecompressAndCopyTileDataToVram(1, sBg1Map, 0, 0, 1); CopyBgTilemapBufferToVram(1); - LoadPalette(stdpal_get(2), 0xE0, 0x20); + LoadPalette(GetTextWindowPalette(2), 0xE0, 0x20); FillWindowPixelBuffer(1, 0xFF); PutWindowTilemap(1); diff --git a/src/start_menu.c b/src/start_menu.c index 0dc1fce93..27eef2de5 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -870,7 +870,7 @@ bool32 DoSetUpSaveAfterLinkBattle(u8 *state) ResetBgsAndClearDma3BusyFlags(FALSE); InitBgsFromTemplates(0, sBGTemplates_AfterLinkSaveMessage, NELEMS(sBGTemplates_AfterLinkSaveMessage)); InitWindows(sWindowTemplates_AfterLinkSaveMessage); - TextWindow_SetStdFrame0_WithPal(0, 0x008, 0xF0); + LoadStdWindowGfx(0, 0x008, 0xF0); break; case 3: ShowBg(0); @@ -957,7 +957,7 @@ static void PrintSaveStats(void) u8 y; u8 x; sSaveStatsWindowId = AddWindow(&sSaveStatsWindowTemplate); - TextWindow_SetStdFrame0_WithPal(sSaveStatsWindowId, 0x21D, 0xD0); + LoadStdWindowGfx(sSaveStatsWindowId, 0x21D, 0xD0); DrawStdFrameWithCustomTileAndPalette(sSaveStatsWindowId, FALSE, 0x21D, 0x0D); SaveStatToString(SAVE_STAT_LOCATION, gStringVar4, 8); x = (u32)(112 - GetStringWidth(FONT_2, gStringVar4, -1)) / 2; diff --git a/src/text.c b/src/text.c index 15487a889..78521e4e6 100644 --- a/src/text.c +++ b/src/text.c @@ -42,7 +42,7 @@ static const struct SpriteSheet sUnknown_81EA68C[] = static const struct SpritePalette sUnknown_81EA6A4[] = { - {gTMCaseMainWindowPalette, 0x8000}, + {gStandardMenuPalette, 0x8000}, {NULL} }; diff --git a/src/text_window.c b/src/text_window.c index 9c5c7f2b3..ea2d61b86 100644 --- a/src/text_window.c +++ b/src/text_window.c @@ -2,95 +2,106 @@ #include "gflib.h" #include "text_window.h" #include "text_window_graphics.h" -#include "quest_log.h" +#include "help_message.h" +#include "new_menu_helpers.h" -extern const u16 gUnknown_841F1C8[]; +static void LoadUserWindowGfxByFrame(u8 windowId, u8 frameType, u16 destOffset, u8 palIdx); -void LoadWindowGfx(u8 windowId, u8 frameType, u16 destOffset, u8 palIdx); - -void sub_814FD04(u8 bgId, u16 destOffset, u8 palIdx) +// Unused +// Equivalent to LoadHelpMessageWindowGfx, but takes a bg id directly +static void LoadHelpMessageWindowGfxOnBg(u8 bgId, u16 destOffset, u8 palIdx) { - LoadBgTiles(bgId, gUnknown_84566A8, 0x280, destOffset); - LoadPalette(stdpal_get(2), palIdx, 32); + LoadBgTiles(bgId, gHelpMessageWindow_Gfx, 0x280, destOffset); + LoadPalette(GetTextWindowPalette(2), palIdx, 32); } -void sub_814FD38(u8 bgId, u16 destOffset, u8 palIdx) +// Unused +// Equivalent to LoadMenuMessageWindowGfx, but takes a bg id directly +static void LoadMenuMessageWindowGfxOnBg(u8 bgId, u16 destOffset, u8 palIdx) { - LoadBgTiles(bgId, gUnknown_841F1C8, 0x280, destOffset); - LoadPalette(stdpal_get(0), palIdx, 32); + LoadBgTiles(bgId, gMenuMessageWindow_Gfx, 0x280, destOffset); + LoadPalette(GetTextWindowPalette(0), palIdx, 32); } -void sub_814FD6C(u8 bgId, u16 destOffset, u8 palIdx) +// Unused +// Equivalent to LoadSignpostWindowGfx, but takes a bg id directly +static void LoadSignpostWindowGfxOnBg(u8 bgId, u16 destOffset, u8 palIdx) { - LoadBgTiles(bgId, gUnknown_8470B0C, 0x260, destOffset); - LoadPalette(stdpal_get(1), palIdx, 32); + LoadBgTiles(bgId, gSignpostWindow_Gfx, 0x260, destOffset); + LoadPalette(GetTextWindowPalette(1), palIdx, 32); } -void DrawWindowBorderWithStdpal3(u8 bgId, u16 destOffset, u8 palIdx) +// Equivalent to LoadStdWindowGfx, but takes a bg id directly +void LoadStdWindowGfxOnBg(u8 bgId, u16 destOffset, u8 palIdx) { - LoadBgTiles(bgId, gStdFrame0, 0x120, destOffset); - LoadPalette(stdpal_get(3), palIdx, 32); + LoadBgTiles(bgId, gStdTextWindow_Gfx, 0x120, destOffset); + LoadPalette(GetTextWindowPalette(3), palIdx, 32); } -void sub_814FDD4(u8 bgId, u16 destOffset) +// Unused +// Equivalent to LoadQuestLogWindowTiles, but takes a bg id directly +static void LoadQuestLogWindowTilesOnBg(u8 bgId, u16 destOffset) { - LoadBgTiles(bgId, gStdFrame1, 0x280, destOffset); + LoadBgTiles(bgId, gQuestLogWindow_Gfx, 0x280, destOffset); } -void sub_814FDF4(u8 bgId, u8 frameType, u16 destOffset, u8 palIdx) +// Unused +// Equivalent to LoadUserWindowGfxByFrame, but takes a bg id directly +static void LoadUserWindowGfxByFrameOnBg(u8 bgId, u8 frameType, u16 destOffset, u8 palIdx) { LoadBgTiles(bgId, gUserFrames[frameType].tiles, 0x120, destOffset); LoadPalette(gUserFrames[frameType].palette, palIdx, 32); } -void LoadUserWindowBorderGfx(u8 windowId, u16 destOffset, u8 palIdx) +// Identical to LoadUserWindowGfx +void LoadUserWindowGfx2(u8 windowId, u16 destOffset, u8 palIdx) { - LoadWindowGfx(windowId, gSaveBlock2Ptr->optionsWindowFrameType, destOffset, palIdx); + LoadUserWindowGfxByFrame(windowId, gSaveBlock2Ptr->optionsWindowFrameType, destOffset, palIdx); } -void sub_814FE6C(u8 windowId, u16 destOffset, u8 palIdx) +void LoadHelpMessageWindowGfx(u8 windowId, u16 destOffset, u8 palIdx) { - LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gUnknown_84566A8, 0x280, destOffset); - LoadPalette(stdpal_get(2), palIdx, 32); + LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gHelpMessageWindow_Gfx, 0x280, destOffset); + LoadPalette(GetTextWindowPalette(2), palIdx, 32); } -void TextWindow_LoadResourcesStdFrame0(u8 windowId, u16 destOffset, u8 palIdx) +void LoadMenuMessageWindowGfx(u8 windowId, u16 destOffset, u8 palIdx) { - LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gUnknown_841F1C8, 0x280, destOffset); - LoadPalette(stdpal_get(0), palIdx, 32); + LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gMenuMessageWindow_Gfx, 0x280, destOffset); + LoadPalette(GetTextWindowPalette(0), palIdx, 32); } -void sub_814FEEC(u8 windowId, u16 destOffset, u8 palIdx) +void LoadSignpostWindowGfx(u8 windowId, u16 destOffset, u8 palIdx) { - LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gUnknown_8470B0C, 0x260, destOffset); - LoadPalette(stdpal_get(1), palIdx, 32); + LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gSignpostWindow_Gfx, 0x260, destOffset); + LoadPalette(GetTextWindowPalette(1), palIdx, 32); } -void TextWindow_SetStdFrame0_WithPal(u8 windowId, u16 destOffset, u8 palIdx) +void LoadStdWindowGfx(u8 windowId, u16 destOffset, u8 palIdx) { - LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gStdFrame0, 0x120, destOffset); - LoadPalette(stdpal_get(3), palIdx, 32); + LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gStdTextWindow_Gfx, 0x120, destOffset); + LoadPalette(GetTextWindowPalette(3), palIdx, 32); } -void sub_814FF6C(u8 windowId, u16 destOffset) +void LoadStdWindowTiles(u8 windowId, u16 destOffset) { - LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gStdFrame0, 0x120, destOffset); + LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gStdTextWindow_Gfx, 0x120, destOffset); } -void TextWindow_LoadTilesStdFrame1(u8 windowId, u16 destOffset) +void LoadQuestLogWindowTiles(u8 windowId, u16 destOffset) { - LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gStdFrame1, 0x280, destOffset); + LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gQuestLogWindow_Gfx, 0x280, destOffset); } -void LoadWindowGfx(u8 windowId, u8 frameType, u16 destOffset, u8 palIdx) +static void LoadUserWindowGfxByFrame(u8 windowId, u8 frameType, u16 destOffset, u8 palIdx) { LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gUserFrames[frameType].tiles, 0x120, destOffset); LoadPalette(gUserFrames[frameType].palette, palIdx, 32); } -void TextWindow_SetUserSelectedFrame(u8 windowId, u16 destOffset, u8 palIdx) +void LoadUserWindowGfx(u8 windowId, u16 destOffset, u8 palIdx) { - LoadWindowGfx(windowId, gSaveBlock2Ptr->optionsWindowFrameType, destOffset, palIdx); + LoadUserWindowGfxByFrame(windowId, gSaveBlock2Ptr->optionsWindowFrameType, destOffset, palIdx); } void DrawTextBorderOuter(u8 windowId, u16 tileNum, u8 palNum) @@ -140,7 +151,7 @@ void rbox_fill_rectangle(u8 windowId) FillBgTilemapBufferRect(bgLayer, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, 0x11); } -const u16 *stdpal_get(u8 id) +const u16 *GetTextWindowPalette(u8 id) { switch (id) { @@ -162,5 +173,5 @@ const u16 *stdpal_get(u8 id) break; } - return (const u16 *)(gUnknown_8471DEC) + id; + return (const u16 *)(gTextWindowPalettes) + id; } diff --git a/src/text_window_graphics.c b/src/text_window_graphics.c index 554c9e37a..8f2250362 100644 --- a/src/text_window_graphics.c +++ b/src/text_window_graphics.c @@ -1,36 +1,37 @@ #include "global.h" #include "text_window_graphics.h" -const u16 gUnknown_8470B0C[] = INCBIN_U16("graphics/text_window/unk_8470B0C.4bpp"); +const u16 gSignpostWindow_Gfx[] = INCBIN_U16("graphics/text_window/signpost.4bpp"); -static const u16 gUnknown_8470D6C[] = INCBIN_U16("graphics/text_window/unk_8470D6C.4bpp"); -static const u16 gUnknown_8470E8C[] = INCBIN_U16("graphics/text_window/unk_8470E8C.4bpp"); -static const u16 gUnk_Empty_Space_8470FAC[16] = {0}; -static const u16 gUnknown_8470FCC[] = INCBIN_U16("graphics/text_window/unk_8470FCC.4bpp"); -static const u16 gUnknown_84710EC[] = INCBIN_U16("graphics/text_window/unk_84710EC.4bpp"); -static const u16 gUnknown_847120C[] = INCBIN_U16("graphics/text_window/unk_847120C.4bpp"); -static const u16 gUnknown_847132C[] = INCBIN_U16("graphics/text_window/unk_847132C.4bpp"); -static const u16 gUnknown_847144C[] = INCBIN_U16("graphics/text_window/unk_847144C.4bpp"); -static const u16 gUnknown_847156C[] = INCBIN_U16("graphics/text_window/unk_847156C.4bpp"); -static const u16 gUnk_Empty_Space_847168C[16] = {0}; -static const u16 gUnknown_84716AC[] = INCBIN_U16("graphics/text_window/unk_84716AC.4bpp"); -static const u16 gUnknown_84717CC[] = INCBIN_U16("graphics/text_window/unk_84717CC.4bpp"); -static const u16 gUnk_Empty_Space_84718EC[16] = {0}; -static const u16 gUnknown_847190C[] = INCBIN_U16("graphics/text_window/unk_8470D6C.gbapal"); -static const u16 gUnknown_847192C[] = INCBIN_U16("graphics/text_window/unk_8470E8C.gbapal"); -static const u16 gUnknown_847194C[] = INCBIN_U16("graphics/text_window/unk_8470FCC.gbapal"); -static const u16 gUnknown_847196C[] = INCBIN_U16("graphics/text_window/unk_84710EC.gbapal"); -static const u16 gUnknown_847198C[] = INCBIN_U16("graphics/text_window/unk_847120C.gbapal"); -static const u16 gUnknown_84719AC[] = INCBIN_U16("graphics/text_window/unk_847132C.gbapal"); -static const u16 gUnknown_84719CC[] = INCBIN_U16("graphics/text_window/unk_847144C.gbapal"); -static const u16 gUnknown_84719EC[] = INCBIN_U16("graphics/text_window/unk_847156C.gbapal"); -static const u16 gUnknown_8471A0C[] = INCBIN_U16("graphics/text_window/unk_84716AC.gbapal"); -static const u16 gUnknown_8471A2C[] = INCBIN_U16("graphics/text_window/unk_84717CC.gbapal"); +static const u16 sUserFrame_Type1_Gfx[] = INCBIN_U16("graphics/text_window/type1.4bpp"); +static const u16 sUserFrame_Type2_Gfx[] = INCBIN_U16("graphics/text_window/type2.4bpp"); +static const u16 sUserFrame_Empty1[16] = {0}; +static const u16 sUserFrame_Type3_Gfx[] = INCBIN_U16("graphics/text_window/type3.4bpp"); +static const u16 sUserFrame_Type4_Gfx[] = INCBIN_U16("graphics/text_window/type4.4bpp"); +static const u16 sUserFrame_Type5_Gfx[] = INCBIN_U16("graphics/text_window/type5.4bpp"); +static const u16 sUserFrame_Type6_Gfx[] = INCBIN_U16("graphics/text_window/type6.4bpp"); +static const u16 sUserFrame_Type7_Gfx[] = INCBIN_U16("graphics/text_window/type7.4bpp"); +static const u16 sUserFrame_Type8_Gfx[] = INCBIN_U16("graphics/text_window/type8.4bpp"); +static const u16 sUserFrame_Empty2[16] = {0}; +static const u16 sUserFrame_Type9_Gfx[] = INCBIN_U16("graphics/text_window/type9.4bpp"); +static const u16 sUserFrame_Type10_Gfx[] = INCBIN_U16("graphics/text_window/type10.4bpp"); +static const u16 sUserFrame_Empty3[16] = {0}; -const u16 gStdFrame0[] = INCBIN_U16("graphics/text_window/unk_8471A4C.4bpp"); -const u16 gStdFrame1[] = INCBIN_U16("graphics/text_window/unk_8471B6C.4bpp"); +static const u16 sUserFrame_Type1_Pal[] = INCBIN_U16("graphics/text_window/type1.gbapal"); +static const u16 sUserFrame_Type2_Pal[] = INCBIN_U16("graphics/text_window/type2.gbapal"); +static const u16 sUserFrame_Type3_Pal[] = INCBIN_U16("graphics/text_window/type3.gbapal"); +static const u16 sUserFrame_Type4_Pal[] = INCBIN_U16("graphics/text_window/type4.gbapal"); +static const u16 sUserFrame_Type5_Pal[] = INCBIN_U16("graphics/text_window/type5.gbapal"); +static const u16 sUserFrame_Type6_Pal[] = INCBIN_U16("graphics/text_window/type6.gbapal"); +static const u16 sUserFrame_Type7_Pal[] = INCBIN_U16("graphics/text_window/type7.gbapal"); +static const u16 sUserFrame_Type8_Pal[] = INCBIN_U16("graphics/text_window/type8.gbapal"); +static const u16 sUserFrame_Type9_Pal[] = INCBIN_U16("graphics/text_window/type9.gbapal"); +static const u16 sUserFrame_Type10_Pal[] = INCBIN_U16("graphics/text_window/type10.gbapal"); -const u16 gUnknown_8471DEC[][16] = { +const u16 gStdTextWindow_Gfx[] = INCBIN_U16("graphics/text_window/std.4bpp"); +const u16 gQuestLogWindow_Gfx[] = INCBIN_U16("graphics/text_window/quest_log.4bpp"); + +const u16 gTextWindowPalettes[][16] = { INCBIN_U16("graphics/text_window/stdpal_0.gbapal"), INCBIN_U16("graphics/text_window/stdpal_1.gbapal"), INCBIN_U16("graphics/text_window/stdpal_2.gbapal"), @@ -39,21 +40,25 @@ const u16 gUnknown_8471DEC[][16] = { }; const struct TextWindowGraphics gUserFrames[] = { - {gUnknown_8470D6C, gUnknown_847190C}, - {gUnknown_8470E8C, gUnknown_847192C}, - {gUnknown_8470FCC, gUnknown_847194C}, - {gUnknown_84710EC, gUnknown_847196C}, - {gUnknown_847120C, gUnknown_847198C}, - {gUnknown_847132C, gUnknown_84719AC}, - {gUnknown_847144C, gUnknown_84719CC}, - {gUnknown_847156C, gUnknown_84719EC}, - {gUnknown_84716AC, gUnknown_8471A0C}, - {gUnknown_84717CC, gUnknown_8471A2C} -}; // NELEMS = 10 + {sUserFrame_Type1_Gfx, sUserFrame_Type1_Pal}, + {sUserFrame_Type2_Gfx, sUserFrame_Type2_Pal}, + {sUserFrame_Type3_Gfx, sUserFrame_Type3_Pal}, + {sUserFrame_Type4_Gfx, sUserFrame_Type4_Pal}, + {sUserFrame_Type5_Gfx, sUserFrame_Type5_Pal}, + {sUserFrame_Type6_Gfx, sUserFrame_Type6_Pal}, + {sUserFrame_Type7_Gfx, sUserFrame_Type7_Pal}, + {sUserFrame_Type8_Gfx, sUserFrame_Type8_Pal}, + {sUserFrame_Type9_Gfx, sUserFrame_Type9_Pal}, + {sUserFrame_Type10_Gfx, sUserFrame_Type10_Pal}, +}; -const struct TextWindowGraphics *GetWindowFrameTilesPal(u8 idx) +const struct TextWindowGraphics *GetUserWindowGraphics(u8 idx) { - if (idx >= 20) // if (idx >= NELEMS(gUserFrames)) +#ifdef BUGFIX + if (idx >= ARRAY_COUNT(gUserFrames)) +#else + if (idx >= 20) // Using the RSE number of elements +#endif return &gUserFrames[0]; else return &gUserFrames[idx]; diff --git a/src/tm_case.c b/src/tm_case.c index 73807c670..18d1beafe 100644 --- a/src/tm_case.c +++ b/src/tm_case.c @@ -1290,11 +1290,11 @@ static void InitWindowTemplatesAndPals(void) InitWindows(sWindowTemplates); DeactivateAllTextPrinters(); - TextWindow_SetUserSelectedFrame(0, 0x5B, 0xE0); - TextWindow_LoadResourcesStdFrame0(0, 0x64, 0xB0); - TextWindow_SetStdFrame0_WithPal(0, 0x78, 0xD0); - LoadPalette(gTMCaseMainWindowPalette, 0xF0, 0x20); - LoadPalette(gTMCaseMainWindowPalette, 0xA0, 0x20); + LoadUserWindowGfx(0, 0x5B, 0xE0); + LoadMenuMessageWindowGfx(0, 0x64, 0xB0); + LoadStdWindowGfx(0, 0x78, 0xD0); + LoadPalette(gStandardMenuPalette, 0xF0, 0x20); + LoadPalette(gStandardMenuPalette, 0xA0, 0x20); LoadPalette(sPal3Override, 0xF6, 0x04); LoadPalette(sPal3Override, 0xD6, 0x04); ListMenuLoadStdPalAt(0xc0, 0x01); diff --git a/src/trade.c b/src/trade.c index c974ca9fc..0546f3cbd 100644 --- a/src/trade.c +++ b/src/trade.c @@ -682,8 +682,8 @@ static void InitTradeMenuResources(void) ResetPaletteFade(); gPaletteFade.bufferTransferDisabled = TRUE; SetVBlankCallback(VblankCB_Trade); - LoadPalette(gTMCaseMainWindowPalette, 0xF0, 0x14); - LoadPalette(gTMCaseMainWindowPalette, 0xD0, 0x14); + LoadPalette(gStandardMenuPalette, 0xF0, 0x14); + LoadPalette(gStandardMenuPalette, 0xD0, 0x14); ResetBgsAndClearDma3BusyFlags(FALSE); InitBgsFromTemplates(0, sBgTemplates, NELEMS(sBgTemplates)); SetBgTilemapBuffer(1, sTradeMenuResourcesPtr->tilemapBuffer); @@ -697,8 +697,8 @@ static void InitTradeMenuResources(void) FillWindowPixelBuffer(i, PIXEL_FILL(0)); } FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 0xF); - TextWindow_SetStdFrame0_WithPal(0, 0x014, 0xC0); - TextWindow_SetUserSelectedFrame(2, 0x001, 0xE0); + LoadStdWindowGfx(0, 0x014, 0xC0); + LoadUserWindowGfx(2, 0x001, 0xE0); LoadMonIconPalettes(); sTradeMenuResourcesPtr->state = 0; sTradeMenuResourcesPtr->tradeMenuCBnum = 0; diff --git a/src/union_room_battle.c b/src/union_room_battle.c index 907c9ef8d..18b0547fd 100644 --- a/src/union_room_battle.c +++ b/src/union_room_battle.c @@ -121,7 +121,7 @@ void CB2_UnionRoomBattle(void) FillWindowPixelBuffer(0, PIXEL_FILL(0)); FillWindowPixelBuffer(0, PIXEL_FILL(1)); FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 0xF); - TextWindow_SetStdFrame0_WithPal(0, 1, 0xD0); + LoadStdWindowGfx(0, 1, 0xD0); Menu_LoadStdPal(); SetVBlankCallback(VBlankCB_UnionRoomBattle); gMain.state++; diff --git a/src/union_room_chat_display.c b/src/union_room_chat_display.c index 0c9c56c41..a6a716365 100644 --- a/src/union_room_chat_display.c +++ b/src/union_room_chat_display.c @@ -1307,9 +1307,9 @@ static void LoadWin1(void) static void LoadWin3(void) { FillWindowPixelBuffer(3, PIXEL_FILL(1)); - TextWindow_SetUserSelectedFrame(3, 1, 0xD0); - TextWindow_SetStdFrame0_WithPal(3, 0xA, 0x20); - LoadPalette(gTMCaseMainWindowPalette, 0xE0, 0x20); + LoadUserWindowGfx(3, 1, 0xD0); + LoadStdWindowGfx(3, 0xA, 0x20); + LoadPalette(gStandardMenuPalette, 0xE0, 0x20); } static void InitScanlineEffect(void)