diff options
31 files changed, 381 insertions, 538 deletions
diff --git a/include/decompress.h b/include/decompress.h index 01f66971c..a97dd78f1 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -5,13 +5,13 @@ void LZDecompressWram(const void *src, void *dest); void LZDecompressVram(const void *src, void *dest); -void LoadCompressedObjectPic(const struct CompressedSpriteSheet *a); -void LoadCompressedObjectPicOverrideBuffer(const struct CompressedSpriteSheet *a, void *buffer); -void LoadCompressedObjectPalette(const struct CompressedSpritePalette *a); -void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer); -void DecompressPicFromTable_2(const struct CompressedSpriteSheet *a, u8 b, u8 c, void *d, void *e, s32 f); -void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *spriteSheet, u32 b, u32 c, u32 d, void *dest, s32 species, u32 pid); -void LoadSpecialPokePic(const struct CompressedSpriteSheet *spriteSheet, u32 b, u32 c, u32 d, void *dest, s32 species, u32 g, u32 h); +void LoadCompressedObjectPic(const struct CompressedSpriteSheet *src); +void LoadCompressedObjectPicOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer); +void LoadCompressedObjectPalette(const struct CompressedSpritePalette *src); +void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *src, void *buffer); +void DecompressPicFromTable_2(const struct CompressedSpriteSheet *a, u8 coords, u8 y_offset, void *d, void *dest, s32 species); +void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *spriteSheet, u32 coords, u32 y_offset, u32 d, void *dest, s32 species, u32 pid); +void LoadSpecialPokePic(const struct CompressedSpriteSheet *spriteSheet, u32 coords, u32 y_offset, u32 d, void *dest, s32 species, u32 pid, u32 frontOrBack); void Unused_LZDecompressWramIndirect(const void **src, void *dest); #endif // GUARD_DECOMPRESS_H diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index f15348689..15766a350 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -90,10 +90,10 @@ struct EventObjectTemplate struct WarpEvent { s16 x, y; - s8 warpId; - u8 mapGroup; + u8 elevation; + u8 warpId; u8 mapNum; - u8 unk7; + u8 mapGroup; }; struct CoordEvent diff --git a/include/macros/map.inc b/include/macros/map.inc index 80257fd23..bc54271d4 100644 --- a/include/macros/map.inc +++ b/include/macros/map.inc @@ -26,9 +26,9 @@ inc _num_npcs .endm - .macro warp_def x, y, byte, warp, map_id + .macro warp_def x, y, elevation, warp, map_id .2byte \x, \y - .byte \byte, \warp + .byte \elevation, \warp .byte \map_id & 0xFF @ map num .byte \map_id >> 8 @ map group inc _num_warps diff --git a/include/menu.h b/include/menu.h index 8741649c8..921a05eca 100644 --- a/include/menu.h +++ b/include/menu.h @@ -70,7 +70,7 @@ u8 unref_sub_8072A5C(u8 *, u8 *, u8, u16, u8, u32); int sub_8072AB0(const u8 *, u8, u16, u8, u8, u32); void MenuPrint_RightAligned(const u8 *, u8, u8); void sub_8072B80(const u8 *, u8, u8, const u8 *); -void sub_8072BD8(const u8 *, u8, u8, u16); +void MenuPrint_Centered(const u8 *, u8, u8, u16); u8 *AlignInt1InMenuWindow(u8 *, s32, u8, u8); u8 *AlignInt2InMenuWindow(u8 *, s32, u8, u8); u8 *AlignStringInMenuWindow(u8 *, const u8 *, u8, u8); diff --git a/include/money.h b/include/money.h index e3a3f898d..43579910c 100644 --- a/include/money.h +++ b/include/money.h @@ -6,7 +6,7 @@ void AddMoney(u32 *, u32); void RemoveMoney(u32 *, u32); void GetMoneyAmountText(u8 *buffer, u32 arg1, u8 arg2); void PrintMoneyAmount(u32 arg0, u8 arg1, u8 x, u8 y); -void sub_80B7AEC(u32, u8 left, u8 top); +void sub_80B7AEC(u32, u8 right, u8 top); void Draw10000Sprite(u8, u8, int); void UpdateMoneyWindow(u32, u8, u8); void OpenMoneyWindow(u32, u8, u8); diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index f1dbe0089..29bdd332e 100644 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -63,7 +63,6 @@ void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u8 sub_809FA30(void); u8 GetPrimaryStatus(u32); u8 GetMonStatusAndPokerus(); -u8 *sub_80A1E9C(u8 *dest, const u8 *src, u8); u8 *PokemonSummaryScreen_CopyPokemonLevel(u8 *dest, u8 level); u8 PokemonSummaryScreen_CheckOT(struct Pokemon *pokemon); bool8 CheckPartyPokerus(struct Pokemon *, u8); diff --git a/include/strings.h b/include/strings.h index 0232b03f4..2ce8ac977 100644 --- a/include/strings.h +++ b/include/strings.h @@ -171,7 +171,8 @@ extern const u8 gOtherText_OneDash[]; extern const u8 gOtherText_TwoDashes[]; extern const u8 gOtherText_ThreeDashes2[]; extern const u8 gOtherText_MaleSymbol2[]; -extern const u8 gOtherText_FemaleSymbolAndLv[]; +extern const u8 gOtherText_FemaleSymbol2[]; +extern const u8 gOtherText_Lv[]; extern const u8 gOtherText_TallPlusAndRightArrow[]; extern const u8 gMenuText_GoBackToPrev[]; extern const u8 gOtherText_WhatWillYouDo[]; diff --git a/include/text.h b/include/text.h index ce63a2542..8b5df9280 100644 --- a/include/text.h +++ b/include/text.h @@ -2,6 +2,7 @@ #define GUARD_TEXT_H #define CHAR_SPACE 0x00 +#define CHAR_LV 0x34 #define CHAR_SONG_WORD_SEPARATOR 0x37 // separates words in the bard song. Not sure if it's used for anything else #define CHAR_0 0xA1 #define CHAR_QUESTION_MARK 0xAC @@ -74,6 +75,27 @@ #define CHAR_NEWLINE 0xFE #define EOS 0xFF // end of string +#define EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW 4 +#define TEXT_COLOR_TRANSPARENT 0x00 +#define TEXT_COLOR_DARK_GREY 0x01 +#define TEXT_COLOR_RED 0x02 +#define TEXT_COLOR_GREEN 0x03 +#define TEXT_COLOR_BLUE 0x04 +#define TEXT_COLOR_YELLOW 0x05 +#define TEXT_COLOR_CYAN 0x06 +#define TEXT_COLOR_MAGENTA 0x07 +#define TEXT_COLOR_LIGHT_GREY 0x08 +#define TEXT_COLOR_BLACK 0x09 +#define TEXT_COLOR_BLACK2 0x0A +#define TEXT_COLOR_SILVER 0x0B +#define TEXT_COLOR_WHITE 0x0C +#define TEXT_COLOR_SKY_BLUE 0x0D +#define TEXT_COLOR_LIGHT_BLUE 0x0E +#define TEXT_COLOR_WHITE2 0x0F + +#define EXT_CTRL_CODE_CLEAR 17 + + struct WindowTemplate { u8 bgNum; @@ -242,8 +264,8 @@ u8 *AlignInt2(struct Window *win, u8 *dest, s32 value, u8 alignAmount, u8 alignT u8 *AlignString(struct Window *win, u8 *dest, const u8 *src, u8 alignAmount, u8 alignType); u8 GetStringWidth(struct Window *win, const u8 *s); u8 Text_InitWindow8004D04(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u16 top, u32 a6); -u8 Text_InitWindow8004D38(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top); -u8 Text_InitWindow8004DB0(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 a6); +u8 Text_InitWindow_RightAligned(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 right, u8 top); +u8 Text_InitWindow_Centered(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 a6); u8 Text_GetWindowPaletteNum(struct Window *win); void Text_GetTextColors(struct Window *win, u8 *foreground, u8 *background, u8 *shadow); void Text_InitWindow8004E3C(const struct WindowTemplate *winConfig, u8 *tileData, const u8 *text); diff --git a/src/battle/battle_records.c b/src/battle/battle_records.c index fed8d6575..d94d88032 100644 --- a/src/battle/battle_records.c +++ b/src/battle/battle_records.c @@ -290,7 +290,7 @@ void ShowLinkBattleRecords(void) { s32 i; Menu_DrawStdWindowFrame(1, 0, 28, 18); - sub_8072BD8(gOtherText_BattleResults, 0, 1, 240); + MenuPrint_Centered(gOtherText_BattleResults, 0, 1, 240); PrintLinkBattleWinsLossesDraws(gSaveBlock1.linkBattleRecords); #if ENGLISH @@ -368,7 +368,7 @@ void ShowBattleTowerRecords(void) { u16 i; Menu_DrawStdWindowFrame(3, 1, 27, 17); - sub_8072BD8(gOtherText_BattleTowerResults, 3, 2, 0xC8); + MenuPrint_Centered(gOtherText_BattleTowerResults, 3, 2, 0xC8); Menu_PrintText(gOtherText_Lv50, 5, 6); Menu_PrintText(gOtherText_Lv100, 5, 12); for (i = 5; i < 26; i++) diff --git a/src/battle/calculate_base_damage.c b/src/battle/calculate_base_damage.c index d983e47a4..0022cf9fe 100644 --- a/src/battle/calculate_base_damage.c +++ b/src/battle/calculate_base_damage.c @@ -23,13 +23,13 @@ extern u16 gBattleMovePower; extern u16 gTrainerBattleOpponent; // Masks for getting PP Up count, also PP Max values -const u8 gUnknown_08208238[] = {0x03, 0x0c, 0x30, 0xc0}; +const u8 gPPUpReadMasks[] = {0x03, 0x0c, 0x30, 0xc0}; // Masks for setting PP Up count -const u8 gUnknown_0820823C[] = {0xFC, 0xF3, 0xCF, 0x3F}; +const u8 gPPUpWriteMasks[] = {0xFC, 0xF3, 0xCF, 0x3F}; // Values added to PP Up count -const u8 gUnknown_08208240[] = {0x01, 0x04, 0x10, 0x40}; +const u8 gPPUpValues[] = {0x01, 0x04, 0x10, 0x40}; const u8 gStatStageRatios[][2] = { diff --git a/src/berry_blender.c b/src/berry_blender.c index 8bf669a92..85c992d8d 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1784,6 +1784,7 @@ static void sub_804FE70(void) { sub_804FC48(0x2345, var); sub_804FD30(0x2345); + // looks like a bug if (gBerryBlenderData->field_4.win_field_F > 1000) gBerryBlenderData->field_13E = 1000; if (gBerryBlenderData->scores[i][BLENDER_SCORE_MISS] < 999) @@ -2995,7 +2996,7 @@ bool8 Blender_PrintBlendingResults(void) u16 secondsPassed, minutes, seconds; Menu_DrawStdWindowFrame(4, 2, 25, 17); - sub_8072BD8(gOtherText_ResultsOfBlending, 5, 3, 160); + MenuPrint_Centered(gOtherText_ResultsOfBlending, 5, 3, 160); for (i = 0; i < gBerryBlenderData->playersNo; i++) { u8 place = gBerryBlenderData->playerPlaces[i]; @@ -3188,7 +3189,7 @@ static bool8 Blender_PrintBlendingRanking(void) break; case 3: Menu_DrawStdWindowFrame(4, 2, 25, 17); - sub_8072BD8(gOtherText_Ranking, 5, 3, 160); + MenuPrint_Centered(gOtherText_Ranking, 5, 3, 160); gBerryBlenderData->scoreIconIDs[BLENDER_SCORE_BEST] = CreateSprite(&sSpriteTemplate_821645C, 140, 52, 0); gSprites[gBerryBlenderData->scoreIconIDs[BLENDER_SCORE_BEST]].callback = SpriteCallbackDummy; diff --git a/src/cable_club.c b/src/cable_club.c index 1e1f0af07..39027fc08 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -172,7 +172,7 @@ static void sub_8082D18(u32 value) { ConvertIntToDecimalStringN(gStringVar1, value, STR_CONV_MODE_LEFT_ALIGN, 1); Menu_DrawStdWindowFrame(18, 10, 28, 13); - sub_8072BD8(gOtherText_PLink, 19, 11, 72); + MenuPrint_Centered(gOtherText_PLink, 19, 11, 72); } static void sub_8082D4C() diff --git a/src/credits.c b/src/credits.c index 1a810492b..c0c53505d 100644 --- a/src/credits.c +++ b/src/credits.c @@ -810,7 +810,7 @@ static void task_b_81441B8(u8 taskIdB) if (gTasks[taskIdB].data[TDB_CURRENT_PAGE] < PAGE_COUNT) { for (i = 0; i < 5; i++) - sub_8072BD8(gCreditsEntryPointerTable[gTasks[taskIdB].data[TDB_CURRENT_PAGE]][i]->text, 0, 9 + i * 2, 240); + MenuPrint_Centered(gCreditsEntryPointerTable[gTasks[taskIdB].data[TDB_CURRENT_PAGE]][i]->text, 0, 9 + i * 2, 240); gTasks[taskIdB].data[TDB_CURRENT_PAGE] += 1; gTasks[taskIdB].data[TDB_0] += 1; diff --git a/src/debug/nakamura_debug_menu.c b/src/debug/nakamura_debug_menu.c index 508dc048e..e6af3c58d 100644 --- a/src/debug/nakamura_debug_menu.c +++ b/src/debug/nakamura_debug_menu.c @@ -921,7 +921,7 @@ static void NakaGenderTest_PrintSpeciesGender(u8 i) if (gender == MON_MALE) Menu_PrintText(gOtherText_MaleSymbol2, 23, 2 * i + 1); else if (gender == MON_FEMALE) - Menu_PrintText(gOtherText_FemaleSymbolAndLv, 23, 2 * i + 1); + Menu_PrintText(gOtherText_FemaleSymbol2, 23, 2 * i + 1); else Menu_PrintText(sp0, 23, 2 * i + 1); } diff --git a/src/decompress.c b/src/decompress.c index 69edf01aa..d6c52439f 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -49,25 +49,25 @@ void LoadCompressedObjectPalette(const struct CompressedSpritePalette *src) LoadSpritePalette(&dest); } -void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer) +void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *src, void *buffer) { struct SpritePalette dest; - LZ77UnCompWram(a->data, buffer); + LZ77UnCompWram(src->data, buffer); dest.data = buffer; - dest.tag = a->tag; + dest.tag = src->tag; LoadSpritePalette(&dest); } -void DecompressPicFromTable_2(const struct CompressedSpriteSheet *src, u8 b, u8 c, void *d, void *buffer, s32 species) +void DecompressPicFromTable_2(const struct CompressedSpriteSheet *src, u8 coords, u8 y_offset, void *d, void *dest, s32 species) { if (species > SPECIES_EGG) - LZ77UnCompWram(gMonFrontPicTable[0].data, buffer); + LZ77UnCompWram(gMonFrontPicTable[0].data, dest); else - LZ77UnCompWram(src->data, buffer); + LZ77UnCompWram(src->data, dest); } -void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 b, u32 c, u32 d, void *dest, s32 species, u32 g) +void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 coords, u32 y_offset, u32 d, void *dest, s32 species, u32 pid) { u32 frontOrBack; @@ -77,16 +77,16 @@ void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 b, u3 else frontOrBack = 1; // frontPic - LoadSpecialPokePic(src, b, c, d, dest, species, g, frontOrBack); + LoadSpecialPokePic(src, coords, y_offset, d, dest, species, pid, frontOrBack); } -void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 b, u32 c, u32 d, void *dest, s32 species, u32 g, u32 frontOrBack) +void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 b, u32 c, u32 d, void *dest, s32 species, u32 pid, u32 frontOrBack) { u8 frontOrBack8 = frontOrBack; if (species == SPECIES_UNOWN) { - u16 i = (((g & 0x3000000) >> 18) | ((g & 0x30000) >> 12) | ((g & 0x300) >> 6) | (g & 3)) % 0x1C; + u16 i = (((pid & 0x3000000) >> 18) | ((pid & 0x30000) >> 12) | ((pid & 0x300) >> 6) | (pid & 3)) % 0x1C; // The other Unowns are separate from Unown A. if (i == 0) @@ -104,7 +104,7 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 b, u32 c, u else LZ77UnCompWram(src->data, dest); - DrawSpindaSpots(species, g, dest, frontOrBack8); + DrawSpindaSpots(species, pid, dest, frontOrBack8); } void Unused_LZDecompressWramIndirect(const void **src, void *dest) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index a973b80ca..ffdf926f5 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -100,12 +100,12 @@ static bool8 CheckStandardWildEncounter(u16); static bool8 mapheader_run_first_tag2_script_list_match_conditionally(struct MapPosition *, u16, u8); static bool8 IsWarpMetatileBehavior(u16); static bool8 IsArrowWarpMetatileBehavior(u16, u8); -static s8 FindWarpEventByPosition(struct MapHeader *, struct MapPosition *); +static s8 GetWarpEventAtMapPosition(struct MapHeader *, struct MapPosition *); static void sub_8068C30(struct MapHeader *, s8, struct MapPosition *); static bool8 map_warp_consider_2_to_inside(struct MapPosition *, u16, u8); -static s8 FindWarpEventByCoordsAndId(struct MapHeader *, u16, u16, u8); +static s8 GetWarpEventAtPosition(struct MapHeader *, u16, u16, u8); static u8 *GetCoordEventScriptAtPosition(struct MapHeader *, u16, u16, u8); -static struct BgEvent *FindBackgroundEventByPosition(struct MapHeader *, u16, u16, u8); +static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *, u16, u16, u8); static bool8 TryStartCoordEventScript(struct MapPosition *); static bool8 TryStartWarpEventScript(struct MapPosition *, u16); static bool8 TryStartCrackedFloorHoleScript(u16); @@ -400,7 +400,7 @@ static u8 *GetInteractedEventObjectScript(struct MapPosition *position, u8 metat static u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction) { - struct BgEvent *bgEvent = FindBackgroundEventByPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); + struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); if (bgEvent == NULL) return NULL; @@ -676,7 +676,7 @@ static bool8 CheckStandardWildEncounter(u16 metatileBehavior) static bool8 mapheader_run_first_tag2_script_list_match_conditionally(struct MapPosition *position, u16 metatileBehavior, u8 direction) { - s8 warpEventId = FindWarpEventByPosition(&gMapHeader, position); + s8 warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position); if (IsArrowWarpMetatileBehavior(metatileBehavior, direction) == TRUE && warpEventId != -1) { @@ -690,7 +690,7 @@ static bool8 mapheader_run_first_tag2_script_list_match_conditionally(struct Map bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileBehavior) { - s8 warpEventId = FindWarpEventByPosition(&gMapHeader, position); + s8 warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position); if (warpEventId != -1 && IsWarpMetatileBehavior(metatileBehavior) == TRUE) { @@ -757,9 +757,9 @@ static bool8 IsArrowWarpMetatileBehavior(u16 metatileBehavior, u8 direction) return FALSE; } -static s8 FindWarpEventByPosition(struct MapHeader *mapHeader, struct MapPosition *position) +static s8 GetWarpEventAtMapPosition(struct MapHeader *mapHeader, struct MapPosition *position) { - return FindWarpEventByCoordsAndId(mapHeader, position->x - 7, position->y - 7, position->height); + return GetWarpEventAtPosition(mapHeader, position->x - 7, position->y - 7, position->height); } static void sub_8068C30(struct MapHeader *unused, s8 warpEventId, struct MapPosition *position) @@ -768,17 +768,17 @@ static void sub_8068C30(struct MapHeader *unused, s8 warpEventId, struct MapPosi if (warpEvent->mapNum == 0x7F) { - copy_saved_warp2_bank_and_enter_x_to_warp1(warpEvent->mapGroup); + copy_saved_warp2_bank_and_enter_x_to_warp1(warpEvent->warpId); } else { struct MapHeader *mapHeader; - warp1_set_2(warpEvent->unk7, warpEvent->mapNum, warpEvent->mapGroup); + warp1_set_2(warpEvent->mapGroup, warpEvent->mapNum, warpEvent->warpId); sub_80535C4(position->x, position->y); - mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->unk7, warpEvent->mapNum); - if (mapHeader->events->warps[warpEvent->mapGroup].mapNum == 0x7F) - saved_warp2_set(mapHeader->events->warps[warpEventId].mapGroup, gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, warpEventId); + mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->mapGroup, warpEvent->mapNum); + if (mapHeader->events->warps[warpEvent->warpId].mapNum == 0x7F) + saved_warp2_set(mapHeader->events->warps[warpEventId].warpId, gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, warpEventId); } } @@ -795,7 +795,7 @@ static bool8 map_warp_consider_2_to_inside(struct MapPosition *position, u16 met } if (MetatileBehavior_IsWarpDoor(metatileBehavior) == TRUE) { - warpEventId = FindWarpEventByPosition(&gMapHeader, position); + warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position); if (warpEventId != -1 && IsWarpMetatileBehavior(metatileBehavior) == TRUE) { StoreInitialPlayerAvatarState(); @@ -808,7 +808,7 @@ static bool8 map_warp_consider_2_to_inside(struct MapPosition *position, u16 met return FALSE; } -static s8 FindWarpEventByCoordsAndId(struct MapHeader *mapHeader, u16 x, u16 y, u8 warpId) +static s8 GetWarpEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation) { s32 i; struct WarpEvent *warpEvent = mapHeader->events->warps; @@ -818,7 +818,7 @@ static s8 FindWarpEventByCoordsAndId(struct MapHeader *mapHeader, u16 x, u16 y, { if ((u16)warpEvent->x == x && (u16)warpEvent->y == y) { - if ((u8)warpEvent->warpId == warpId || (u8)warpEvent->warpId == 0) + if (warpEvent->elevation == elevation || warpEvent->elevation == 0) return i; } } @@ -871,7 +871,7 @@ u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position) return GetCoordEventScriptAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); } -static struct BgEvent *FindBackgroundEventByPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation) +static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation) { u8 i; struct BgEvent *bgEvents = mapHeader->events->bgEvents; @@ -950,6 +950,6 @@ int SetCableClubWarp(void) GetPlayerMovementDirection(); //unnecessary GetPlayerPosition(&position); MapGridGetMetatileBehaviorAt(position.x, position.y); //unnecessary - sub_8068C30(&gMapHeader, FindWarpEventByPosition(&gMapHeader, &position), &position); + sub_8068C30(&gMapHeader, GetWarpEventAtMapPosition(&gMapHeader, &position), &position); return 0; } diff --git a/src/field_region_map.c b/src/field_region_map.c index a90b8ed6a..10d5a4a5e 100644 --- a/src/field_region_map.c +++ b/src/field_region_map.c @@ -55,7 +55,7 @@ void CB2_FieldInitRegionMap(void) Menu_EraseScreen(); REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_TXT256x256; Menu_DrawStdWindowFrame(21, 0, 29, 3); - sub_8072BD8(gOtherText_Hoenn, 0x16, 1, 0x38); + MenuPrint_Centered(gOtherText_Hoenn, 0x16, 1, 0x38); Menu_DrawStdWindowFrame(16, 16, 29, 19); sub_813F0C8(); SetMainCallback2(CB2_FieldRegionMap); diff --git a/src/field_specials.c b/src/field_specials.c index f7b14dad8..e8c83b376 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1089,8 +1089,8 @@ static void sub_810E874(void) void DisplayCurrentElevatorFloor(void) { Menu_DrawStdWindowFrame(20, 0, 29, 5); - sub_8072BD8(gOtherText_NowOn, 21, 1, 64); - sub_8072BD8(gUnknown_083F8380[gSpecialVar_0x8005], 21, 3, 64); + MenuPrint_Centered(gOtherText_NowOn, 21, 1, 64); + MenuPrint_Centered(gUnknown_083F8380[gSpecialVar_0x8005], 21, 3, 64); } void sub_810E984(u8 taskId) diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 2536f4898..5ee025eeb 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -1047,7 +1047,7 @@ static void sub_814302C(u8 taskID) static void sub_8143068(u8 a0, u8 a1) { - sub_8072BD8(gMenuText_WelcomeToHOFAndDexRating, 0, a1 + 1, 0xF0); + MenuPrint_Centered(gMenuText_WelcomeToHOFAndDexRating, 0, a1 + 1, 0xF0); } static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 a1, u8 a2) diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 49a470cc1..102254f22 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -103,5 +103,5 @@ void DrawMapNamePopup(void) Menu_LoadStdFrameGraphicsOverrideStyle(0); GetMapSectionName(name, gMapHeader.regionMapSectionId, 0); Menu_DrawStdWindowFrame(0, 0, 13, 3); - sub_8072BD8(name, 1, 1, 0x60); + MenuPrint_Centered(name, 1, 1, 0x60); } diff --git a/src/menu.c b/src/menu.c index 891644750..d50fb4f22 100644 --- a/src/menu.c +++ b/src/menu.c @@ -728,22 +728,22 @@ _08072B3E:\n\ } #endif -void MenuPrint_RightAligned(const u8 *str, u8 left, u8 top) +void MenuPrint_RightAligned(const u8 *str, u8 right, u8 top) { - Text_InitWindow8004D38(gMenuWindowPtr, str, gMenuTextTileOffset, left, top); + Text_InitWindow_RightAligned(gMenuWindowPtr, str, gMenuTextTileOffset, right, top); } -void sub_8072B80(const u8 *src, u8 a2, u8 a3, const u8 *a4) +void sub_8072B80(const u8 *src, u8 a2, u8 a3, const u8 *text) { u8 buffer[64]; - u8 width = GetStringWidth(gMenuWindowPtr, a4); + u8 width = GetStringWidth(gMenuWindowPtr, text); AlignString(gMenuWindowPtr, buffer, src, width, 1); Text_InitWindowAndPrintText(gMenuWindowPtr, buffer, gMenuTextTileOffset, a2, a3); } -void sub_8072BD8(const u8 *a1, u8 a2, u8 a3, u16 a4) +void MenuPrint_Centered(const u8 *text, u8 left, u8 top, u16 width) { - Text_InitWindow8004DB0(gMenuWindowPtr, a1, gMenuTextTileOffset, a2, a3, a4); + Text_InitWindow_Centered(gMenuWindowPtr, text, gMenuTextTileOffset, left, top, width); } u8 *AlignInt1InMenuWindow(u8 *dest, s32 value, u8 alignAmount, u8 alignType) diff --git a/src/money.c b/src/money.c index 12a8b71ff..53800f854 100644 --- a/src/money.c +++ b/src/money.c @@ -154,7 +154,7 @@ void PrintMoneyAmount(u32 amount, u8 size, u8 x, u8 y) } } -void sub_80B7AEC(u32 arg0, u8 left, u8 top) +void sub_80B7AEC(u32 arg0, u8 right, u8 top) { u8 buffer[32]; u8 *ptr; @@ -166,7 +166,7 @@ void sub_80B7AEC(u32 arg0, u8 left, u8 top) ptr = ConvertIntToDecimalString(ptr, arg0); - MenuPrint_RightAligned(buffer, left, top); + MenuPrint_RightAligned(buffer, right, top); #ifdef ENGLISH ptr[0] = 0xFC; diff --git a/src/pokeblock.c b/src/pokeblock.c index a24cb32cf..03939556c 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -462,7 +462,7 @@ void debug_sub_8120F98(void) static void sub_810BB0C(void) { BasicInitMenuWindow(&gWindowTemplate_81E6E34); - sub_8072BD8(ItemId_GetName(ITEM_POKEBLOCK_CASE), 2, 1, 0x48); + MenuPrint_Centered(ItemId_GetName(ITEM_POKEBLOCK_CASE), 2, 1, 0x48); } static void sub_810BB30(void) diff --git a/src/pokedex.c b/src/pokedex.c index 729f72a7c..eb4d1d918 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -3367,7 +3367,7 @@ static void Task_InitSizeScreenMultistep(u8 taskId) string[0] = EOS; StringAppend(string, gDexText_SizeComparedTo); StringAppend(string, gSaveBlock2.playerName); - sub_8072BD8(string, 3, 15, 0xC0); + MenuPrint_Centered(string, 3, 15, 0xC0); gMain.state++; } break; @@ -3815,7 +3815,7 @@ static void sub_8090750(u8 taskId) gTasks[taskId].data[0]++; break; case 3: - sub_8072BD8(gDexText_RegisterComplete, 2, 0, 0xD0); + MenuPrint_Centered(gDexText_RegisterComplete, 2, 0, 0xD0); if (!IsNationalPokedexEnabled()) sub_8091154(NationalToHoennOrder(dexNum), 13, 3); else diff --git a/src/pokemon_2.c b/src/pokemon_2.c index 9c60ea108..1720159a2 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -44,8 +44,8 @@ extern const struct SpriteTemplate gSpriteTemplate_8208288[]; extern u8 gTrainerClassToPicIndex[]; extern u8 gTrainerClassToNameIndex[]; -extern const u8 gUnknown_08208238[]; -extern const u8 gUnknown_0820823C[]; +extern const u8 gPPUpReadMasks[]; +extern const u8 gPPUpWriteMasks[]; extern void sub_80105A0(struct Sprite *); extern void oac_poke_opponent(struct Sprite *); @@ -1169,19 +1169,19 @@ void GetSpeciesName(u8 *name, u16 species) u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex) { u8 basePP = gBattleMoves[move].pp; - return basePP + ((basePP * 20 * ((gUnknown_08208238[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100); + return basePP + ((basePP * 20 * ((gPPUpReadMasks[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100); } void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex) { u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL); - ppBonuses &= gUnknown_0820823C[moveIndex]; + ppBonuses &= gPPUpWriteMasks[moveIndex]; SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses); } void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex) { - mon->ppBonuses &= gUnknown_0820823C[moveIndex]; + mon->ppBonuses &= gPPUpWriteMasks[moveIndex]; } void CopyPlayerPartyMonToBattleData(u8 battleIndex, u8 partyIndex) diff --git a/src/pokemon_item_effect.c b/src/pokemon_item_effect.c index d26546f02..59b216af0 100644 --- a/src/pokemon_item_effect.c +++ b/src/pokemon_item_effect.c @@ -35,9 +35,9 @@ static const u8 sGetMonDataEVConstants[] = MON_DATA_SPATK_EV }; -extern u8 gUnknown_08208238[]; -extern u8 gUnknown_0820823C[]; -extern u8 gUnknown_08208240[]; +extern u8 gPPUpReadMasks[]; +extern u8 gPPUpWriteMasks[]; +extern u8 gPPUpValues[]; bool8 PokemonUseItemEffects(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 moveIndex, u8 e); @@ -221,11 +221,11 @@ bool8 PokemonUseItemEffects(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 mo if (r10 & 0x20) { r10 &= ~0x20; - data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gUnknown_08208238[moveIndex]) >> (moveIndex * 2); + data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gPPUpReadMasks[moveIndex]) >> (moveIndex * 2); sp28 = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL), moveIndex); - if (data <= 2 && sp28 > 4) + if (data < 3 && sp28 > 4) { - data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) + gUnknown_08208240[moveIndex]; + data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) + gPPUpValues[moveIndex]; SetMonData(pkmn, MON_DATA_PP_BONUSES, &data); data = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - sp28; @@ -450,13 +450,13 @@ bool8 PokemonUseItemEffects(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 mo } break; case 4: - data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gUnknown_08208238[moveIndex]) >> (moveIndex * 2); + data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gPPUpReadMasks[moveIndex]) >> (moveIndex * 2); if (data < 3) { r4 = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL), moveIndex); data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL); - data &= gUnknown_0820823C[moveIndex]; - data += gUnknown_08208240[moveIndex] * 3; + data &= gPPUpWriteMasks[moveIndex]; + data += gPPUpValues[moveIndex] * 3; SetMonData(pkmn, MON_DATA_PP_BONUSES, &data); data = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - r4; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 770b69813..971d7daf7 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -734,7 +734,7 @@ void sub_809665C(void) u8 *stringVar = gStringVar1; stringVar[0] = EXT_CTRL_CODE_BEGIN; - stringVar[1] = 0x04; // EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW + stringVar[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW; stringVar[2] = 0x0F; // TEXT_COLOR_WHITE2 stringVar[3] = 0x01; // TEXT_COLOR_DARK_GREY stringVar[4] = 0x0E; // TEXT_COLOR_LIGHT_BLUE @@ -744,7 +744,7 @@ void sub_809665C(void) stringVar[0] = CHAR_NEWLINE; stringVar[1] = EXT_CTRL_CODE_BEGIN; - stringVar[2] = 0x11; // EXT_CTRL_CODE_CLEAR + stringVar[2] = EXT_CTRL_CODE_CLEAR; if (nPokemonInBox < 10) stringVar[3] = 0x28; else diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index bef221451..2fd7cb1ca 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -33,8 +33,8 @@ #include "scanline_effect.h" #include "daycare.h" -static void sub_809FC0C(void); -static void sub_809FEB8(void); +static void SummaryScreen_PrintPokemonInfoLabels(void); +static void SummaryScreen_PrintPokemonSkillsLabels(void); static void sub_809F63C(struct Pokemon *); static void sub_809F650(struct Pokemon *); static void sub_809F664(struct Pokemon *); @@ -44,7 +44,7 @@ static void sub_80A015C(struct Pokemon *); static void sub_809DE44(void); static void sub_809EB40(u8); static void sub_809EBC4(void); -static void sub_809E044(void); +static void SummaryScreen_LoadPalettes(void); static void sub_80A1D84(struct Pokemon *); static void sub_80A18C4(void); static bool8 LoadPokemonSummaryScreenGraphics(void); @@ -54,29 +54,29 @@ static void sub_80A1DCC(struct Pokemon *); static void sub_809FE80(void); static void sub_80A00A4(void); static void sub_80A0390(void); -extern u8 sub_80A1808(struct Pokemon *); -static void sub_80A1F98(s32, u8, u8, u8, u8, u16, s32); +extern u8 SummaryScreen_CreatePokemonSprite(struct Pokemon *); +static void SummaryScreen_PrintColoredIntPixelCoords(s32, u8, u8, u8, u8, u16, s32); static void sub_80A0958(struct Pokemon *); static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *, u8, u8); static void PokemonSummaryScreen_PrintEggTrainerMemo(struct Pokemon *, u8, u8); -static void sub_80A1EF8(const u8 *, u8, u8, u16, s32); -static void sub_80A1F48(const u8 *, u8, u8, u8, u16); +static void SummaryScreen_PrintColoredTextPixelCoords(const u8 *, u8, u8, u16, s32); +static void SummaryScreen_PrintColoredTextCentered(const u8 *, u8, u8, u8, u16); static void PrintHeldItemName(u16, u8, u8); static void PrintNumRibbons(struct Pokemon *); static void DrawExperienceProgressBar(struct Pokemon *, u8, u8); -static void sub_809E13C(u8 taskId); +static void SummaryScreen_DestroyTask(u8 taskId); static void sub_80A1950(void); static void sub_809DE64(void); static void SummaryScreenHandleAButton(u8); static void SummaryScreenHandleUpDownInput(u8, s8); -static bool8 sub_809F7D0(u8); +static bool8 SummaryScreen_CanForgetSelectedMove(u8); static void sub_809F9D0(u8, u8); -static void sub_809EAC8(u8); +static void SummaryScreen_MoveSelect_Cancel(u8); static void sub_809E534(u8); static void sub_809E83C(u8, s8); static void sub_80A1B40(u8); static void sub_80A2078(int); -static void sub_809E3FC(u8); +static void SummaryScreen_MoveSelect_HandleInput(u8); static void SummaryScreenHandleKeyInput(u8); static void sub_80A1B1C(u8); static void sub_80A16CC(u8); @@ -92,7 +92,7 @@ extern s8 sub_809F284(s8); extern s8 sub_809F3CC(s8); static bool8 sub_809F5F8(void); static void sub_80A1DE8(struct Pokemon *); -static u8 sub_809F6B4(struct Pokemon *, u8 *); +static u8 SummaryScreen_LoadPokemonSprite(struct Pokemon *, u8 *); static void DrawPokerusSurvivorDot(struct Pokemon *); static void sub_80A12D0(s8); static void sub_809FAC8(struct Pokemon *); @@ -100,29 +100,30 @@ static void SummaryScreenHandleLeftRightInput(u8, s8); static void sub_809E8F0(); static void sub_80A1654(s8, u8); static void sub_80A1488(s8, u8); -static void sub_809FC34(struct Pokemon *); -static void sub_809FF64(struct Pokemon *); +static void SummaryScreen_PrintPokemonInfo(struct Pokemon *); +static void SummaryScreen_PrintPokemonSkills(struct Pokemon *); static void sub_80A1918(u8, u8); -static void sub_80A198C(u8, u8, u8, u8); +static void SummaryScreen_DrawTypeIcon(u8, u8, u8, u8); static u16 GetMonMove(struct Pokemon *, u8); static void sub_80A04CC(u16); static void sub_80A057C(u16); static void sub_80A0498(u16); static void sub_80A046C(u16); static void sub_80A20A8(u8); -static void sub_809F678(struct Pokemon *); +static void SummaryScreen_GetPokemon(struct Pokemon *); static void sub_80A1BC0(struct Sprite *sprite); -static void sub_80A1888(struct Sprite *); +static void SummaryScreen_SpritePlayCry(struct Sprite *); static void sub_80A0428(struct Pokemon *, u8 *); static void sub_80A18E4(u8); -static u8 *sub_80A1E58(u8 *, u8); +static u8 *SummaryScreen_SetTextColor(u8 *, u8); +static u8 *SummaryScreen_CopyColoredString(u8 *, const u8 *, u8); static void sub_80A0A2C(struct Pokemon *, u8, u8); -static void sub_80A1FF8(const u8 *, u8, u8, u8); +static void SummaryScreen_PrintColoredText(const u8 *, u8, u8, u8); extern u8 StorageSystemGetNextMonIndex(struct BoxPokemon *, u8, u8, u8); extern struct MusicPlayerInfo gMPlay_BGM; -extern u8 gUnknown_08208238[]; +extern u8 gPPUpReadMasks[]; extern TaskFunc gUnknown_03005CF0; extern struct SpriteTemplate gUnknown_02024E8C; @@ -196,120 +197,29 @@ static const struct OamData sOamData_83C109C = { .affineParam = 0, }; -static const union AnimCmd sSpriteAnim_83C10A4[] = { - ANIMCMD_FRAME(0, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10AC[] = { - ANIMCMD_FRAME(8, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10B4[] = { - ANIMCMD_FRAME(16, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10BC[] = { - ANIMCMD_FRAME(24, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10C4[] = { - ANIMCMD_FRAME(32, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10CC[] = { - ANIMCMD_FRAME(40, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10D4[] = { - ANIMCMD_FRAME(48, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10DC[] = { - ANIMCMD_FRAME(56, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10E4[] = { - ANIMCMD_FRAME(64, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10EC[] = { - ANIMCMD_FRAME(72, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10F4[] = { - ANIMCMD_FRAME(80, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10FC[] = { - ANIMCMD_FRAME(88, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1104[] = { - ANIMCMD_FRAME(96, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C110C[] = { - ANIMCMD_FRAME(104, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1114[] = { - ANIMCMD_FRAME(112, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C111C[] = { - ANIMCMD_FRAME(120, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1124[] = { - ANIMCMD_FRAME(128, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C112C[] = { - ANIMCMD_FRAME(136, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1134[] = { - ANIMCMD_FRAME(144, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C113C[] = { - ANIMCMD_FRAME(152, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1144[] = { - ANIMCMD_FRAME(160, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C114C[] = { - ANIMCMD_FRAME(168, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1154[] = { - ANIMCMD_FRAME(176, 0), - ANIMCMD_END, -}; +static const union AnimCmd sSpriteAnim_83C10A4[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10AC[] = { ANIMCMD_FRAME(8, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10B4[] = { ANIMCMD_FRAME(16, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10BC[] = { ANIMCMD_FRAME(24, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10C4[] = { ANIMCMD_FRAME(32, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10CC[] = { ANIMCMD_FRAME(40, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10D4[] = { ANIMCMD_FRAME(48, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10DC[] = { ANIMCMD_FRAME(56, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10E4[] = { ANIMCMD_FRAME(64, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10EC[] = { ANIMCMD_FRAME(72, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10F4[] = { ANIMCMD_FRAME(80, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10FC[] = { ANIMCMD_FRAME(88, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1104[] = { ANIMCMD_FRAME(96, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C110C[] = { ANIMCMD_FRAME(104, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1114[] = { ANIMCMD_FRAME(112, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C111C[] = { ANIMCMD_FRAME(120, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1124[] = { ANIMCMD_FRAME(128, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C112C[] = { ANIMCMD_FRAME(136, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1134[] = { ANIMCMD_FRAME(144, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C113C[] = { ANIMCMD_FRAME(152, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1144[] = { ANIMCMD_FRAME(160, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C114C[] = { ANIMCMD_FRAME(168, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1154[] = { ANIMCMD_FRAME(176, 0), ANIMCMD_END, }; static const union AnimCmd *const sSpriteAnimTable_83C115C[] = { sSpriteAnim_83C10A4, @@ -367,55 +277,16 @@ static const struct OamData sOamData_83C11F0 = { .affineParam = 0, }; -static const union AnimCmd sSpriteAnim_83C11F8[] = { - ANIMCMD_FRAME(0, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1200[] = { - ANIMCMD_FRAME(4, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1208[] = { - ANIMCMD_FRAME(8, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1210[] = { - ANIMCMD_FRAME(12, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1218[] = { - ANIMCMD_FRAME(16, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1220[] = { - ANIMCMD_FRAME(16, 0, .hFlip = TRUE), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1228[] = { - ANIMCMD_FRAME(20, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1230[] = { - ANIMCMD_FRAME(24, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1238[] = { - ANIMCMD_FRAME(24, 0, .hFlip = TRUE), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1240[] = { - ANIMCMD_FRAME(28, 0), - ANIMCMD_END, -}; +static const union AnimCmd sSpriteAnim_83C11F8[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1200[] = { ANIMCMD_FRAME(4, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1208[] = { ANIMCMD_FRAME(8, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1210[] = { ANIMCMD_FRAME(12, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1218[] = { ANIMCMD_FRAME(16, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1220[] = { ANIMCMD_FRAME(16, 0, .hFlip = TRUE), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1228[] = { ANIMCMD_FRAME(20, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1230[] = { ANIMCMD_FRAME(24, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1238[] = { ANIMCMD_FRAME(24, 0, .hFlip = TRUE), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1240[] = { ANIMCMD_FRAME(28, 0), ANIMCMD_END, }; static const union AnimCmd *const sSpriteAnimTable_83C1248[] = { sSpriteAnim_83C11F8, @@ -459,40 +330,13 @@ static const struct OamData sOamData_83C1298 = { .affineParam = 0, }; -static const union AnimCmd sSpriteAnim_83C12A0[] = { - ANIMCMD_FRAME(0, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12A8[] = { - ANIMCMD_FRAME(4, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12B0[] = { - ANIMCMD_FRAME(8, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12B8[] = { - ANIMCMD_FRAME(12, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12C0[] = { - ANIMCMD_FRAME(16, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12C8[] = { - ANIMCMD_FRAME(20, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12D0[] = { - ANIMCMD_FRAME(24, 0), - ANIMCMD_END, -}; +static const union AnimCmd sSpriteAnim_83C12A0[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12A8[] = { ANIMCMD_FRAME(4, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12B0[] = { ANIMCMD_FRAME(8, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12B8[] = { ANIMCMD_FRAME(12, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12C0[] = { ANIMCMD_FRAME(16, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12C8[] = { ANIMCMD_FRAME(20, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12D0[] = { ANIMCMD_FRAME(24, 0), ANIMCMD_END, }; static const union AnimCmd *const sSpriteAnimTable_83C12D8[] = { sSpriteAnim_83C12A0, @@ -531,8 +375,8 @@ static const u16 sUnknown_083C157C[] = { RGB(26, 26, 23) }; static const u16 sUnknown_083C157E[] = { RGB(30, 30, 27) }; static void (*const sUnknown_083C1580[])(void) = { - sub_809FC0C, - sub_809FEB8, + SummaryScreen_PrintPokemonInfoLabels, + SummaryScreen_PrintPokemonSkillsLabels, }; static void (*const sUnknown_083C1588[])(struct Pokemon *) = { @@ -554,16 +398,23 @@ static const u8 sDoubleBattlePartyOrder[] = { 0, 2, 3, 1, 4, 5 }; static const u8 sUnknown_083C15AE[] = _("{STR_VAR_1}{CLEAR_TO 64}"); static const u8 sUnknown_083C15B4[] = _("{STR_VAR_1}{CLEAR_TO 72}"); -asm(".align 2"); // TODO: this array is probably not correctly-typed -static const u8 sUnknown_083C15BC[] = { - 9, 1, 0, 2, - 10, 3, 0, 4, - 8, 5, 0, 6, - 11, 7, 0, 8, - 14, 9, 0, 10, - 12, 11, 0, 12, - 13, 13, 0, 14, - -1, 15, 0, 10, +struct TextColors { + u8 id; + u8 color; + u8 background; + u8 shadow; +}; + +// The TEXT_COLOR constants don't apply. Refer to the palette for this screen. +static const struct TextColors sSummaryScreenTextColors[] = { + { 9, 1, 0, 2 }, // blue + { 10, 3, 0, 4 }, // pink + { 8, 5, 0, 6 }, // yellow + { 11, 7, 0, 8 }, // blue2 + { 14, 9, 0, 10 }, // red + { 12, 11, 0, 12 }, // pink2 + { 13, 13, 0, 14 }, // white + { -1, 15, 0, 10 }, // black }; void sub_809D844(void) @@ -677,7 +528,7 @@ void sub_809DA1C(void) break; case PSS_MODE_MOVES_ONLY: case PSS_MODE_PC_MOVES_ONLY: - pssData.inputHandlingTaskId = CreateTask(sub_809E3FC, 0); + pssData.inputHandlingTaskId = CreateTask(SummaryScreen_MoveSelect_HandleInput, 0); break; } } @@ -741,7 +592,7 @@ bool8 sub_809DA84(void) gMain.state++; break; case 12: - sub_809F678(&pssData.loadedMon); + SummaryScreen_GetPokemon(&pssData.loadedMon); if (!GetMonStatusAndPokerus(&pssData.loadedMon)) sub_80A12D0(0); else @@ -760,14 +611,14 @@ bool8 sub_809DA84(void) gMain.state++; break; case 15: - if ((pssData.monSpriteId = sub_809F6B4(&pssData.loadedMon, &pssData.loadGfxState)) != 0xFF) + if ((pssData.monSpriteId = SummaryScreen_LoadPokemonSprite(&pssData.loadedMon, &pssData.loadGfxState)) != 0xFF) { pssData.loadGfxState = 0; gMain.state++; } break; case 16: - sub_809E044(); + SummaryScreen_LoadPalettes(); DrawSummaryScreenNavigationDots(); gMain.state++; break; @@ -908,7 +759,7 @@ static bool8 LoadPokemonSummaryScreenGraphics(void) return FALSE; } -static void sub_809E044(void) +static void SummaryScreen_LoadPalettes(void) { LoadPalette(gUnknownPalette_81E6692 + 14, 129, 2); LoadPalette(gUnknownPalette_81E6692 + 15, 136, 2); @@ -931,10 +782,10 @@ static void SummaryScreenExit(u8 taskId) { PlaySE(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); - gTasks[taskId].func = sub_809E13C; + gTasks[taskId].func = SummaryScreen_DestroyTask; } -static void sub_809E13C(u8 taskId) +static void SummaryScreen_DestroyTask(u8 taskId) { if (sub_8055870() != TRUE && !gPaletteFade.active) { @@ -1015,7 +866,7 @@ static void sub_809E260(u8 taskId) } else if (gMain.newKeys & A_BUTTON) { - if (sub_809F7D0(taskId) == TRUE || pssData.selectedMoveIndex == 4) + if (SummaryScreen_CanForgetSelectedMove(taskId) == TRUE || pssData.selectedMoveIndex == 4) { pssData.switchMoveIndex = pssData.selectedMoveIndex; gSpecialVar_0x8005 = pssData.switchMoveIndex; @@ -1030,12 +881,12 @@ static void sub_809E260(u8 taskId) else if (gMain.newKeys & B_BUTTON) { pssData.switchMoveIndex = 4; - gSpecialVar_0x8005 = 4; + gSpecialVar_0x8005 = pssData.switchMoveIndex; SummaryScreenExit(taskId); } } -static void sub_809E3FC(u8 taskId) +static void SummaryScreen_MoveSelect_HandleInput(u8 taskId) { if (gPaletteFade.active) return; @@ -1072,13 +923,13 @@ static void sub_809E3FC(u8 taskId) else { PlaySE(SE_SELECT); - sub_809EAC8(taskId); + SummaryScreen_MoveSelect_Cancel(taskId); } } else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); - sub_809EAC8(taskId); + SummaryScreen_MoveSelect_Cancel(taskId); } } @@ -1118,7 +969,7 @@ static void sub_809E534(u8 taskId) } } -static void sub_809E5C4(void) +static void SummaryScreen_SwapMoves_Party(void) { struct Pokemon *party = pssData.monList.partyMons; struct Pokemon *pkmn = &party[pssData.monIndex]; @@ -1131,10 +982,10 @@ static void sub_809E5C4(void) u8 move2pp = GetMonData(pkmn, MON_DATA_PP1 + moveIndex2); u8 ppBonuses = GetMonData(pkmn, MON_DATA_PP_BONUSES); - // Calculate PP bonuses - u8 r9 = gUnknown_08208238[moveIndex1]; + // Swap PP bonuses + u8 r9 = gPPUpReadMasks[moveIndex1]; u8 r2 = (ppBonuses & r9) >> (moveIndex1 * 2); - u8 r3 = gUnknown_08208238[moveIndex2]; + u8 r3 = gPPUpReadMasks[moveIndex2]; u8 r1 = (ppBonuses & r3) >> (moveIndex2 * 2); ppBonuses &= ~r9; ppBonuses &= ~r3; @@ -1148,7 +999,7 @@ static void sub_809E5C4(void) SetMonData(pkmn, MON_DATA_PP_BONUSES, &ppBonuses); } -static void sub_809E6D8(void) +static void SummaryScreen_SwapMoves_Box(void) { struct BoxPokemon *boxMons = pssData.monList.boxMons; struct BoxPokemon *pkmn = &boxMons[pssData.monIndex]; @@ -1161,10 +1012,10 @@ static void sub_809E6D8(void) u8 move2pp = GetBoxMonData(pkmn, MON_DATA_PP1 + moveIndex2); u8 ppBonuses = GetBoxMonData(pkmn, MON_DATA_PP_BONUSES); - // Calculate PP bonuses - u8 r9 = gUnknown_08208238[moveIndex1]; + // Swap PP bonuses + u8 r9 = gPPUpReadMasks[moveIndex1]; u8 r2 = (ppBonuses & r9) >> (moveIndex1 * 2); - u8 r3 = gUnknown_08208238[moveIndex2]; + u8 r3 = gPPUpReadMasks[moveIndex2]; u8 r1 = (ppBonuses & r3) >> (moveIndex2 * 2); ppBonuses &= ~r9; ppBonuses &= ~r3; @@ -1184,7 +1035,7 @@ void sub_809E7F0(u8 taskId) { pssData.loadGfxState = 0; sub_80A0428(&pssData.loadedMon, &pssData.selectedMoveIndex); - gTasks[taskId].func = sub_809E3FC; + gTasks[taskId].func = SummaryScreen_MoveSelect_HandleInput; sub_80A2078(taskId); } } @@ -1201,12 +1052,12 @@ static void sub_809E83C(u8 taskId, s8 b) if (pssData.selectedMoveIndex != pssData.switchMoveIndex) { if (pssData.usingPC == FALSE) - sub_809E5C4(); + SummaryScreen_SwapMoves_Party(); else - sub_809E6D8(); + SummaryScreen_SwapMoves_Box(); pssData.selectedMoveIndex = pssData.switchMoveIndex; - sub_809F678(&pssData.loadedMon); + SummaryScreen_GetPokemon(&pssData.loadedMon); pssData.loadGfxState = 1; gTasks[taskId].func = sub_809E7F0; @@ -1218,7 +1069,7 @@ static void sub_809E83C(u8 taskId, s8 b) sub_80A0428(&pssData.loadedMon, &pssData.selectedMoveIndex); } - gTasks[taskId].func = sub_809E3FC; + gTasks[taskId].func = SummaryScreen_MoveSelect_HandleInput; sub_80A2078(taskId); } @@ -1420,11 +1271,11 @@ static void SummaryScreenHandleAButton(u8 taskId) sub_80A029C(&pssData.loadedMon); sub_80A1A30(9); - gTasks[taskId].func = sub_809E3FC; + gTasks[taskId].func = SummaryScreen_MoveSelect_HandleInput; sub_80A2078(taskId); } -static void sub_809EAC8(u8 taskId) +static void SummaryScreen_MoveSelect_Cancel(u8 taskId) { if (pssData.selectedMoveIndex != 4) { @@ -2055,14 +1906,14 @@ void sub_809F43C(u8 taskId) gMain.state++; break; case 4: - sub_809F678(&pssData.loadedMon); + SummaryScreen_GetPokemon(&pssData.loadedMon); if (GetMonStatusAndPokerus(&pssData.loadedMon)) sub_80A12D0(2); DrawPokerusSurvivorDot(&pssData.loadedMon); gMain.state++; break; case 5: - if ((pssData.monSpriteId = sub_809F6B4(&pssData.loadedMon, &pssData.loadGfxState)) != 0xFF) + if ((pssData.monSpriteId = SummaryScreen_LoadPokemonSprite(&pssData.loadedMon, &pssData.loadGfxState)) != 0xFF) { pssData.loadGfxState = 0; if (GetMonData(&pssData.loadedMon, MON_DATA_IS_EGG)) @@ -2115,13 +1966,13 @@ static bool8 sub_809F5F8(void) static void sub_809F63C(struct Pokemon *mon) { sub_809FE80(); - sub_809FC34(mon); + SummaryScreen_PrintPokemonInfo(mon); } static void sub_809F650(struct Pokemon *mon) { sub_80A00A4(); - sub_809FF64(mon); + SummaryScreen_PrintPokemonSkills(mon); } static void sub_809F664(struct Pokemon *mon) @@ -2130,9 +1981,9 @@ static void sub_809F664(struct Pokemon *mon) sub_80A015C(mon); } -static void sub_809F678(struct Pokemon *mon) +static void SummaryScreen_GetPokemon(struct Pokemon *mon) { - if (pssData.usingPC == FALSE) + if (!pssData.usingPC) { struct Pokemon *mons = pssData.monList.partyMons; *mon = mons[pssData.monIndex]; @@ -2144,17 +1995,17 @@ static void sub_809F678(struct Pokemon *mon) } } -static u8 sub_809F6B4(struct Pokemon *mon, u8 *b) +static u8 SummaryScreen_LoadPokemonSprite(struct Pokemon *mon, u8 *state) { u16 species; u32 personality; u32 otId; const struct CompressedSpritePalette *palette; - switch (*b) + switch (*state) { default: - return sub_80A1808(mon); + return SummaryScreen_CreatePokemonSprite(mon); case 0: species = GetMonData(mon, MON_DATA_SPECIES2); personality = GetMonData(mon, MON_DATA_PERSONALITY); @@ -2167,7 +2018,7 @@ static u8 sub_809F6B4(struct Pokemon *mon, u8 *b) gUnknown_081FAF4C[1], species, personality); - *b += 1; + *state += 1; return 0xFF; case 1: species = GetMonData(mon, MON_DATA_SPECIES2); @@ -2177,7 +2028,7 @@ static u8 sub_809F6B4(struct Pokemon *mon, u8 *b) palette = GetMonSpritePalStructFromOtIdPersonality(species, otId, personality); LoadCompressedObjectPalette(palette); GetMonSpriteTemplate_803C56C(palette->tag, 1); - *b += 1; + *state += 1; return 0xFF; } } @@ -2212,12 +2063,12 @@ static u16 GetMonMovePP(struct Pokemon *mon, u8 moveId) } } -static bool8 sub_809F7D0(u8 taskId) +static bool8 SummaryScreen_CanForgetSelectedMove(u8 taskId) { struct Pokemon mon; u16 move; - sub_809F678(&mon); + SummaryScreen_GetPokemon(&mon); move = GetMonMove(&mon, pssData.selectedMoveIndex); if (IsHMMove(move) == TRUE && pssData.mode != PSS_MODE_UNKNOWN) return FALSE; @@ -2285,11 +2136,11 @@ void sub_809F814(u8 taskId) } } -static void sub_809F9D0(u8 taskId, u8 b) +static void sub_809F9D0(u8 taskId, u8 moveIndex) { s16 *taskData = gTasks[taskId].data; taskData[14] = 0; - taskData[15] = b; + taskData[15] = moveIndex; sub_80A1488(-2, 4); sub_80A1654(-2, 4); @@ -2304,51 +2155,16 @@ u8 sub_809FA30(void) return pssData.switchMoveIndex; } -// void GetStringCenterAlignXOffsetWithLetterSpacing(u8 a, u8 b, u8 c, u8 d) -// { -// u16 *vramAddr = (u16 *)(VRAM + 0xF000); - -// vramAddr[(d * 32) + c] = (b * 0x1000) + (a * 2) + 0x200 + 0x80; -// vramAddr[(d * 32) + c + 32] = (b * 0x1000) + (a * 2) + 0x200 + 0x81; -// } -NAKED -void GetStringCenterAlignXOffsetWithLetterSpacing(u8 a, u8 b, u8 c, u8 d) +static void SummaryScreen_PlaceTextTile(u8 tile, u8 palette, u8 x, u8 y) { - asm(".syntax unified\n\ - push {r4,lr}\n\ - lsls r0, 24\n\ - lsls r1, 24\n\ - lsls r2, 24\n\ - lsls r3, 24\n\ - lsrs r2, 23\n\ - lsrs r3, 18\n\ - ldr r4, _0809FA70 @ =0x0600f000\n\ - adds r3, r4\n\ - adds r2, r3\n\ - lsrs r1, 12\n\ - lsrs r0, 23\n\ - movs r4, 0x80\n\ - lsls r4, 2\n\ - adds r3, r4, 0\n\ - adds r0, r3\n\ - adds r1, r0\n\ - adds r0, r1, 0\n\ - adds r0, 0x80\n\ - strh r0, [r2]\n\ - adds r2, 0x40\n\ - adds r1, 0x81\n\ - strh r1, [r2]\n\ - pop {r4}\n\ - pop {r0}\n\ - bx r0\n\ - .align 2, 0\n\ -_0809FA70: .4byte 0x0600f000\n\ - .syntax divided\n"); + u16 *vramAddr = (u16 *)(VRAM + 0xF000) + x + y * 32; + vramAddr[0] = (palette << 12) + 0x200 + tile * 2 + 0x80; + vramAddr[32] = (palette << 12) + 0x200 + tile * 2 + 0x81; } -void GetStringCenterAlignXOffset(u8 a, u8 b, u8 c) +static void SummaryScreen_PlaceTextTile_White(u8 tile, u8 x, u8 y) { - GetStringCenterAlignXOffsetWithLetterSpacing(a, 15, b, c); + SummaryScreen_PlaceTextTile(tile, 15, x, y); } bool8 sub_809FA94(struct Pokemon *mon) @@ -2367,7 +2183,7 @@ bool8 sub_809FA94(struct Pokemon *mon) static void sub_809FAC8(struct Pokemon *mon) { - bool8 shinyDexNum; + bool8 shiny; u16 dexNum; u8 *buffer; @@ -2377,24 +2193,24 @@ static void sub_809FAC8(struct Pokemon *mon) Menu_EraseWindowRect(3, 16, 9, 17); Menu_EraseWindowRect(0, 12, 11, 15); GetMonNickname(mon, gStringVar1); - sub_80A1FF8(gStringVar1, 13, 3, 16); + SummaryScreen_PrintColoredText(gStringVar1, 13, 3, 16); LoadPalette(sUnknown_083C157C, 4, 2); } else { - shinyDexNum = sub_809FA94(mon); + shiny = sub_809FA94(mon); dexNum = SpeciesToPokedexNum(GetMonData(mon, MON_DATA_SPECIES)); if (dexNum != 0xFFFF) { - if (!shinyDexNum) + if (!shiny) { - GetStringCenterAlignXOffset(2, 1, 2); - sub_80A1F98(dexNum, 13, 3, 2, 17, 16, 1); + SummaryScreen_PlaceTextTile_White(2, 1, 2); + SummaryScreen_PrintColoredIntPixelCoords(dexNum, 13, 3, 2, 17, 16, 1); } else { - GetStringCenterAlignXOffsetWithLetterSpacing(2, 8, 1, 2); - sub_80A1F98(dexNum, 8, 3, 2, 17, 16, 1); + SummaryScreen_PlaceTextTile(2, 8, 1, 2); + SummaryScreen_PrintColoredIntPixelCoords(dexNum, 8, 3, 2, 17, 16, 1); } } else @@ -2403,7 +2219,7 @@ static void sub_809FAC8(struct Pokemon *mon) } buffer = gStringVar1; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer = GetMonNickname(mon, buffer); buffer[0] = EXT_CTRL_CODE_BEGIN; buffer[1] = 0x13; @@ -2425,14 +2241,14 @@ static void sub_809FBE4(void) Menu_EraseWindowRect(11, 4, 29, 18); } -static void sub_809FC0C(void) +static void SummaryScreen_PrintPokemonInfoLabels(void) { Menu_PrintText(gOtherText_Type2, 11, 6); - GetStringCenterAlignXOffset(0, 22, 4); - GetStringCenterAlignXOffset(2, 23, 4); + SummaryScreen_PlaceTextTile_White(0, 22, 4); + SummaryScreen_PlaceTextTile_White(2, 23, 4); } -static void sub_809FC34(struct Pokemon *mon) +static void SummaryScreen_PrintPokemonInfo(struct Pokemon *mon) { u8 i; u8 *buffer; @@ -2448,7 +2264,7 @@ static void sub_809FC34(struct Pokemon *mon) if (GetMonData(mon, MON_DATA_IS_EGG)) { buffer = gStringVar1; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer = StringCopy(buffer, gOtherText_OriginalTrainer); buffer = StringCopy(buffer, gOtherText_FiveQuestions); buffer[0] = EXT_CTRL_CODE_BEGIN; @@ -2457,15 +2273,15 @@ static void sub_809FC34(struct Pokemon *mon) buffer[3] = EOS; Menu_PrintText(gStringVar1, 11, 4); - sub_80A1EF8(gOtherText_FiveQuestions, 13, 193, 32, 1); - sub_80A198C(9, 120, 48, 0); + SummaryScreen_PrintColoredTextPixelCoords(gOtherText_FiveQuestions, 13, 193, 32, 1); + SummaryScreen_DrawTypeIcon(TYPE_MYSTERY, 120, 48, 0); friendship = GetMonData(mon, MON_DATA_FRIENDSHIP); - if (friendship < 6) + if (friendship <= 5) Menu_PrintText(gOtherText_EggAbout, 11, 9); - else if (friendship < 11) + else if (friendship <= 10) Menu_PrintText(gOtherText_EggSoon, 11, 9); - else if (friendship < 41) + else if (friendship <= 40) Menu_PrintText(gOtherText_EggSomeTime, 11, 9); else Menu_PrintText(gOtherText_EggLongTime, 11, 9); @@ -2479,13 +2295,13 @@ static void sub_809FC34(struct Pokemon *mon) ConvertInternationalString(gStringVar2, language); buffer = gStringVar1; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer = StringCopy(buffer, gOtherText_OriginalTrainer); if (GetMonData(mon, MON_DATA_OT_GENDER) == MALE) - buffer = sub_80A1E58(buffer, 9); + buffer = SummaryScreen_SetTextColor(buffer, 9); else - buffer = sub_80A1E58(buffer, 10); + buffer = SummaryScreen_SetTextColor(buffer, 10); buffer = StringCopy(buffer, gStringVar2); buffer[0] = EXT_CTRL_CODE_BEGIN; @@ -2494,15 +2310,15 @@ static void sub_809FC34(struct Pokemon *mon) buffer[3] = EOS; Menu_PrintText(gStringVar1, 11, 4); - sub_80A1F98(GetMonData(mon, MON_DATA_OT_ID) & 0xFFFF, 13, 5, 2, 193, 32, 1); + SummaryScreen_PrintColoredIntPixelCoords(GetMonData(mon, MON_DATA_OT_ID) & 0xFFFF, 13, 5, 2, 193, 32, 1); species = GetMonData(mon, MON_DATA_SPECIES); - sub_80A198C(gBaseStats[species].type1, 120, 48, 0); + SummaryScreen_DrawTypeIcon(gBaseStats[species].type1, 120, 48, 0); if (gBaseStats[species].type1 != gBaseStats[species].type2) - sub_80A198C(gBaseStats[species].type2, 160, 48, 1); + SummaryScreen_DrawTypeIcon(gBaseStats[species].type2, 160, 48, 1); ability = GetAbilityBySpecies(GetMonData(mon, MON_DATA_SPECIES), GetMonData(mon, MON_DATA_ALT_ABILITY)); - sub_80A1FF8(gAbilityNames[ability], 13, 11, 9); + SummaryScreen_PrintColoredText(gAbilityNames[ability], 13, 11, 9); Menu_PrintText(gAbilityDescriptions[ability], 11, 11); PokemonSummaryScreen_PrintTrainerMemo(mon, 11, 14); @@ -2511,8 +2327,8 @@ static void sub_809FC34(struct Pokemon *mon) static void sub_809FE6C(struct Pokemon *mon) { - sub_809FC0C(); - sub_809FC34(mon); + SummaryScreen_PrintPokemonInfoLabels(); + SummaryScreen_PrintPokemonInfo(mon); } static void sub_809FE80(void) @@ -2523,21 +2339,21 @@ static void sub_809FE80(void) Menu_EraseWindowRect(11, 14, 28, 17); } -static void sub_809FEB8(void) +static void SummaryScreen_PrintPokemonSkillsLabels(void) { - sub_80A1FF8(gOtherText_ExpPoints, 13, 11, 14); - sub_80A1FF8(gOtherText_NextLv, 13, 11, 16); + SummaryScreen_PrintColoredText(gOtherText_ExpPoints, 13, 11, 14); + SummaryScreen_PrintColoredText(gOtherText_NextLv, 13, 11, 16); Menu_PrintText(gOtherText_Terminator18, 21, 16); - sub_80A1F48(gOtherText_HP, 13, 11, 7, 42); - sub_80A1F48(gOtherText_Attack, 13, 11, 9, 42); - sub_80A1F48(gOtherText_Defense, 13, 11, 11, 42); - sub_80A1F48(gOtherText_SpAtk, 13, 22, 7, 36); - sub_80A1F48(gOtherText_SpDef, 13, 22, 9, 36); - sub_80A1F48(gOtherText_Speed, 13, 22, 11, 36); + SummaryScreen_PrintColoredTextCentered(gOtherText_HP, 13, 11, 7, 42); + SummaryScreen_PrintColoredTextCentered(gOtherText_Attack, 13, 11, 9, 42); + SummaryScreen_PrintColoredTextCentered(gOtherText_Defense, 13, 11, 11, 42); + SummaryScreen_PrintColoredTextCentered(gOtherText_SpAtk, 13, 22, 7, 36); + SummaryScreen_PrintColoredTextCentered(gOtherText_SpDef, 13, 22, 9, 36); + SummaryScreen_PrintColoredTextCentered(gOtherText_Speed, 13, 22, 11, 36); } -static void sub_809FF64(struct Pokemon *mon) +static void SummaryScreen_PrintPokemonSkills(struct Pokemon *mon) { u8 i; u16 heldItem; @@ -2557,19 +2373,19 @@ static void sub_809FF64(struct Pokemon *mon) DrawExperienceProgressBar(mon, 23, 16); ConvertIntToDecimalString(buffer, GetMonData(mon, MON_DATA_ATK)); - sub_8072BD8(buffer, 16, 9, 50); + MenuPrint_Centered(buffer, 16, 9, 50); ConvertIntToDecimalString(buffer, GetMonData(mon, MON_DATA_DEF)); - sub_8072BD8(buffer, 16, 11, 50); + MenuPrint_Centered(buffer, 16, 11, 50); ConvertIntToDecimalString(buffer, GetMonData(mon, MON_DATA_SPATK)); - sub_8072BD8(buffer, 27, 7, 18); + MenuPrint_Centered(buffer, 27, 7, 18); ConvertIntToDecimalString(buffer, GetMonData(mon, MON_DATA_SPDEF)); - sub_8072BD8(buffer, 27, 9, 18); + MenuPrint_Centered(buffer, 27, 9, 18); ConvertIntToDecimalString(buffer, GetMonData(mon, MON_DATA_SPEED)); - sub_8072BD8(buffer, 27, 11, 18); + MenuPrint_Centered(buffer, 27, 11, 18); buffer = AlignInt1InMenuWindow(buffer, GetMonData(mon, MON_DATA_HP), 24, 1); *buffer++ = CHAR_SLASH; @@ -2580,8 +2396,8 @@ static void sub_809FF64(struct Pokemon *mon) static void sub_80A0090(struct Pokemon *mon) { - sub_809FEB8(); - sub_809FF64(mon); + SummaryScreen_PrintPokemonSkillsLabels(); + SummaryScreen_PrintPokemonSkills(mon); } static void sub_80A00A4(void) @@ -2600,13 +2416,13 @@ static void sub_80A00F4(u8 a) { if (pssData.page == PSS_PAGE_BATTLE_MOVES) { - sub_80A1FF8(gOtherText_Power2, 13, 1, 15); - sub_80A1FF8(gOtherText_Accuracy2, 13, 1, 17); + SummaryScreen_PrintColoredText(gOtherText_Power2, 13, 1, 15); + SummaryScreen_PrintColoredText(gOtherText_Accuracy2, 13, 1, 17); } else { - sub_80A1FF8(gOtherText_Appeal2, 13, 1, 15); - sub_80A1FF8(gOtherText_Jam2, 13, 1, 17); + SummaryScreen_PrintColoredText(gOtherText_Appeal2, 13, 1, 15); + SummaryScreen_PrintColoredText(gOtherText_Jam2, 13, 1, 17); } } } @@ -2628,18 +2444,18 @@ static void sub_80A015C(struct Pokemon *mon) if (move == 0) { sub_80A1918(i, 1); - sub_80A1FF8(gOtherText_OneDash, 13, 15, (2 * i) + 4); + SummaryScreen_PrintColoredText(gOtherText_OneDash, 13, 15, (2 * i) + 4); Menu_PrintText(gOtherText_TwoDashes, 26, (2 * i) + 4); } else { if (pssData.page == PSS_PAGE_BATTLE_MOVES) - sub_80A198C(gBattleMoves[move].type, 87, ((2 * i) + 4) * 8, i); + SummaryScreen_DrawTypeIcon(gBattleMoves[move].type, 87, ((2 * i) + 4) * 8, i); else - sub_80A198C(gContestMoves[move].contestCategory + 18, 87, ((2 * i) + 4) * 8, i); + SummaryScreen_DrawTypeIcon(gContestMoves[move].contestCategory + 18, 87, ((2 * i) + 4) * 8, i); - sub_80A1FF8(gMoveNames[move], 13, 15, (2 * i) + 4); - GetStringCenterAlignXOffset(1, 24, (2 * i) + 4); + SummaryScreen_PrintColoredText(gMoveNames[move], 13, 15, (2 * i) + 4); + SummaryScreen_PlaceTextTile_White(1, 24, (2 * i) + 4); ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES); maxPP = CalculatePPWithBonus(move, ppBonuses, i); @@ -2661,23 +2477,23 @@ static void sub_80A029C(struct Pokemon *mon) if (pssData.moveToLearn == 0) { - sub_80A1FF8(gOtherText_CancelNoTerminator, 13, 15, 12); + SummaryScreen_PrintColoredText(gOtherText_CancelNoTerminator, 13, 15, 12); return; } move = pssData.moveToLearn; if (pssData.page == PSS_PAGE_BATTLE_MOVES) - sub_80A198C(gBattleMoves[move].type, 87, 96, 4); + SummaryScreen_DrawTypeIcon(gBattleMoves[move].type, 87, 96, 4); else - sub_80A198C(gContestMoves[move].contestCategory + 18, 87, 96, 4); + SummaryScreen_DrawTypeIcon(gContestMoves[move].contestCategory + 18, 87, 96, 4); if (pssData.page == PSS_PAGE_BATTLE_MOVES) - sub_80A1FF8(gMoveNames[move], 10, 15, 12); + SummaryScreen_PrintColoredText(gMoveNames[move], 10, 15, 12); else - sub_80A1FF8(gMoveNames[move], 9, 15, 12); + SummaryScreen_PrintColoredText(gMoveNames[move], 9, 15, 12); - GetStringCenterAlignXOffset(1, 24, 12); + SummaryScreen_PlaceTextTile_White(1, 24, 12); buffer = gStringVar1; pp = gBattleMoves[move].pp; @@ -3031,13 +2847,13 @@ static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *mon, u8 left, u8 nature = GetNature(mon); #if ENGLISH - ptr = sub_80A1E9C(ptr, gNatureNames[nature], 14); + ptr = SummaryScreen_CopyColoredString(ptr, gNatureNames[nature], 14); if (nature != NATURE_BOLD && nature != NATURE_GENTLE) ptr = StringCopy(ptr, gOtherText_Terminator4); ptr = StringCopy(ptr, gOtherText_Nature); #elif GERMAN ptr = StringCopy(gStringVar4, gOtherText_Nature); - ptr = sub_80A1E9C(ptr, gNatureNames[nature], 14); + ptr = SummaryScreen_CopyColoredString(ptr, gNatureNames[nature], 14); ptr = StringCopy(ptr, gOtherText_Terminator4); #endif @@ -3052,7 +2868,7 @@ static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *mon, u8 left, ptr++; CopyLocationName(gStringVar1, locationMet); - ptr = sub_80A1E9C(ptr, gStringVar1, 14); + ptr = SummaryScreen_CopyColoredString(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Egg2); } else if (locationMet >= 88) @@ -3071,7 +2887,7 @@ static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *mon, u8 left, ptr++; CopyLocationName(gStringVar1, locationMet); - ptr = sub_80A1E9C(ptr, gStringVar1, 14); + ptr = SummaryScreen_CopyColoredString(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Met); } } @@ -3115,7 +2931,7 @@ static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *mon, u8 left, ptr++; CopyLocationName(gStringVar1, locationMet); - ptr = sub_80A1E9C(ptr, gStringVar1, 14); + ptr = SummaryScreen_CopyColoredString(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Met2); } } @@ -3133,7 +2949,7 @@ static void sub_80A0958(struct Pokemon *mon) species = GetMonData(mon, MON_DATA_SPECIES); buffer = gStringVar1; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer[0] = EXT_CTRL_CODE_BEGIN; buffer[1] = 0x11; buffer[2] = 0x7; @@ -3151,8 +2967,8 @@ static void sub_80A0958(struct Pokemon *mon) level = GetMonData(mon, MON_DATA_LEVEL); - buffer = sub_80A1E58(gStringVar1, 13); - buffer[0] = 0x34; + buffer = SummaryScreen_SetTextColor(gStringVar1, 13); + buffer[0] = CHAR_LV; buffer += 1; buffer = ConvertIntToDecimalString(buffer, level); @@ -3168,7 +2984,7 @@ static void sub_80A0958(struct Pokemon *mon) static void sub_80A0A2C(struct Pokemon *mon, u8 left, u8 top) { const u8 *genderSymbol; - u8 var1; + u8 color; u8 bottom; u16 species = GetMonData(mon, MON_DATA_SPECIES2); @@ -3183,21 +2999,22 @@ static void sub_80A0A2C(struct Pokemon *mon, u8 left, u8 top) return; case MON_MALE: genderSymbol = gOtherText_MaleSymbol2; - var1 = 11; + color = 11; break; case MON_FEMALE: - genderSymbol = gOtherText_FemaleSymbolAndLv; - var1 = 12; + genderSymbol = gOtherText_FemaleSymbol2; + color = 12; break; } - sub_80A1FF8(genderSymbol, var1, left, top); + SummaryScreen_PrintColoredText(genderSymbol, color, left, top); } } u8 GetNumRibbons(struct Pokemon *mon) { - u8 numRibbons = GetMonData(mon, MON_DATA_COOL_RIBBON); + u8 numRibbons = 0; + numRibbons += GetMonData(mon, MON_DATA_COOL_RIBBON); numRibbons += GetMonData(mon, MON_DATA_BEAUTY_RIBBON); numRibbons += GetMonData(mon, MON_DATA_CUTE_RIBBON); numRibbons += GetMonData(mon, MON_DATA_SMART_RIBBON); @@ -3308,12 +3125,11 @@ static void DrawExperienceProgressBar(struct Pokemon *mon, u8 left, u8 top) for (i = 0; i < 8; i++) { u16 tile; - u16 baseTile = 0x2062; - if (numExpProgressBarTicks > 7) - tile = 0x206A; // full exp. bar block + if (numExpProgressBarTicks >= 8) + tile = 0x2062 + 8; // full exp. bar block else - tile = (numExpProgressBarTicks % 8) + baseTile; + tile = 0x2062 + (numExpProgressBarTicks % 8); vramAddr[i] = tile; @@ -3336,7 +3152,7 @@ static void PrintSummaryWindowHeaderText(void) buffer[2] = 0x2; buffer += 3; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer = StringCopy(buffer, sPageHeaderTexts[pssData.headerTextId]); buffer[0] = EXT_CTRL_CODE_BEGIN; @@ -3348,8 +3164,8 @@ static void PrintSummaryWindowHeaderText(void) if (pssData.headerActionTextId != 0) { - GetStringCenterAlignXOffset(5, 23, 0); - GetStringCenterAlignXOffset(6, 24, 0); + SummaryScreen_PlaceTextTile_White(5, 23, 0); + SummaryScreen_PlaceTextTile_White(6, 24, 0); } else { @@ -3357,7 +3173,7 @@ static void PrintSummaryWindowHeaderText(void) } buffer = gStringVar1; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer = StringCopy(buffer, sPageHeaderTexts[pssData.headerActionTextId]); buffer[0] = EXT_CTRL_CODE_BEGIN; @@ -3935,7 +3751,7 @@ _080A1286:\n\ movs r1, 0xD\n\ movs r2, 0x1\n\ movs r3, 0x12\n\ - bl sub_80A1FF8\n\ + bl SummaryScreen_PrintColoredText\n\ _080A129A:\n\ bl sub_80A1D18\n\ mov r0, r8\n\ @@ -4026,7 +3842,7 @@ static void sub_80A12D0(s8 a) // if (GetMonStatusAndPokerus(pssData.loadedMon)) // { -// sub_80A1FF8(gOtherText_Status, 13, 1, 18); +// SummaryScreen_PrintColoredText(gOtherText_Status, 13, 1, 18); // } // DestroyTask(taskId); @@ -4179,7 +3995,7 @@ _080A1410:\n\ movs r1, 0xD\n\ movs r2, 0x1\n\ movs r3, 0x12\n\ - bl sub_80A1FF8\n\ + bl SummaryScreen_PrintColoredText\n\ _080A1444:\n\ mov r0, r10\n\ bl DestroyTask\n\ @@ -4375,7 +4191,7 @@ _080A15DC:\n\ movs r1, 0xD\n\ movs r2, 0x1\n\ movs r3, 0x12\n\ - bl sub_80A1FF8\n\ + bl SummaryScreen_PrintColoredText\n\ _080A1610:\n\ mov r0, r10\n\ bl DestroyTask\n\ @@ -4652,7 +4468,7 @@ _080A1804: .4byte gUnknown_08E94550\n\ } #endif // NONMATCHING -u8 sub_80A1808(struct Pokemon *mon) +u8 SummaryScreen_CreatePokemonSprite(struct Pokemon *mon) { u16 species; u8 spriteId; @@ -4663,7 +4479,7 @@ u8 sub_80A1808(struct Pokemon *mon) FreeSpriteOamMatrix(&gSprites[spriteId]); gSprites[spriteId].data[0] = species; - gSprites[spriteId].callback = sub_80A1888; + gSprites[spriteId].callback = SummaryScreen_SpritePlayCry; if (!IsPokeSpriteNotFlipped(species)) gSprites[spriteId].hFlip = TRUE; @@ -4673,7 +4489,7 @@ u8 sub_80A1808(struct Pokemon *mon) return spriteId; } -static void sub_80A1888(struct Sprite *sprite) +static void SummaryScreen_SpritePlayCry(struct Sprite *sprite) { if (!gPaletteFade.active) { @@ -4719,7 +4535,7 @@ static void sub_80A1950(void) } } -static void sub_80A198C(u8 animNum, u8 x, u8 y, u8 d) +static void SummaryScreen_DrawTypeIcon(u8 animNum, u8 x, u8 y, u8 d) { StartSpriteAnim(&gSprites[ewram1A000[d]], animNum); @@ -4860,7 +4676,7 @@ void sub_80A1D18(void) u8 statusAndPkrs; u8 statusAndPkrs2; - sub_809F678(&mon); + SummaryScreen_GetPokemon(&mon); statusAndPkrs = GetMonStatusAndPokerus(&mon); if (statusAndPkrs) @@ -4886,7 +4702,7 @@ void sub_80A1D18(void) push {r4,r5,lr}\n\ sub sp, 0x64\n\ mov r0, sp\n\ - bl sub_809F678\n\ + bl SummaryScreen_GetPokemon\n\ mov r0, sp\n\ bl GetMonStatusAndPokerus\n\ lsls r0, 24\n\ @@ -4940,7 +4756,7 @@ static void sub_80A1D84(struct Pokemon *mon) { struct Sprite *sprite; - sprite = sub_80F7920(0x7533, 0x7533, sSummaryScreenMonMarkingsPalette); + sprite = sub_80F7920(30003, 30003, sSummaryScreenMonMarkingsPalette); gUnknown_020384F4 = sprite; if (sprite != NULL) @@ -4969,20 +4785,20 @@ static void sub_80A1DE8(struct Pokemon *mon) gSprites[pssData.ballSpriteId].oam.priority = 3; } -static u8 *sub_80A1E58(u8 *text, u8 id) +static u8 *SummaryScreen_SetTextColor(u8 *text, u8 id) { if (id != 0xFF) { - const u8 *ptr = sUnknown_083C15BC; + const struct TextColors *colors = sSummaryScreenTextColors; - while (*ptr != 0xFF && *ptr != id) - ptr += 4; + while (colors->id != 0xFF && colors->id != id) + colors++; text[0] = EXT_CTRL_CODE_BEGIN; - text[1] = 4; - text[2] = ptr[1]; - text[3] = ptr[2]; - text[4] = ptr[3]; + text[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW; + text[2] = colors->color; + text[3] = colors->background; + text[4] = colors->shadow; text += 5; } @@ -4990,22 +4806,22 @@ static u8 *sub_80A1E58(u8 *text, u8 id) return text; } -u8 *sub_80A1E9C(u8 *dest, const u8 *src, u8 id) +static u8 *SummaryScreen_CopyColoredString(u8 *dest, const u8 *src, u8 id) { - u8 arr[3]; + u8 colors[3]; - Menu_GetTextColors(&arr[0], &arr[1], &arr[2]); + Menu_GetTextColors(&colors[0], &colors[1], &colors[2]); - dest = sub_80A1E58(dest, id); + dest = SummaryScreen_SetTextColor(dest, id); dest = StringCopy(dest, src); if (id != 0xFF) { dest[0] = EXT_CTRL_CODE_BEGIN; - dest[1] = 4; - dest[2] = arr[0]; - dest[3] = arr[1]; - dest[4] = arr[2]; + dest[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW; + dest[2] = colors[0]; + dest[3] = colors[1]; + dest[4] = colors[2]; dest[5] = 0xFF; dest += 5; @@ -5014,27 +4830,27 @@ u8 *sub_80A1E9C(u8 *dest, const u8 *src, u8 id) return dest; } -static void sub_80A1EF8(const u8 *text, u8 id, u8 left, u16 top, s32 e) +static void SummaryScreen_PrintColoredTextPixelCoords(const u8 *text, u8 id, u8 left, u16 top, s32 e) { - sub_80A1E9C(gStringVar4, text, id); + SummaryScreen_CopyColoredString(gStringVar4, text, id); Menu_PrintTextPixelCoords(gStringVar4, left, top, (bool8)e); } -static void sub_80A1F48(const u8 *text, u8 id, u8 c, u8 d, u16 e) +static void SummaryScreen_PrintColoredTextCentered(const u8 *text, u8 id, u8 left, u8 top, u16 width) { - sub_80A1E9C(gStringVar4, text, id); - sub_8072BD8(gStringVar4, c, d, e); + SummaryScreen_CopyColoredString(gStringVar4, text, id); + MenuPrint_Centered(gStringVar4, left, top, width); } -static void sub_80A1F98(s32 value, u8 id, u8 n, u8 mode, u8 left, u16 top, s32 e) +static void SummaryScreen_PrintColoredIntPixelCoords(s32 value, u8 id, u8 n, u8 mode, u8 left, u16 top, s32 e) { ConvertIntToDecimalStringN(gStringVar1, value, mode, n); - sub_80A1EF8(gStringVar1, id, left, top, e); + SummaryScreen_PrintColoredTextPixelCoords(gStringVar1, id, left, top, e); } -static void sub_80A1FF8(const u8 *text, u8 id, u8 left, u8 top) +static void SummaryScreen_PrintColoredText(const u8 *text, u8 id, u8 left, u8 top) { - sub_80A1E9C(gStringVar4, text, id); + SummaryScreen_CopyColoredString(gStringVar4, text, id); Menu_PrintText(gStringVar4, left, top); } @@ -5042,14 +4858,13 @@ u8 *PokemonSummaryScreen_CopyPokemonLevel(u8 *dest, u8 level) { u8 buffer[12]; - dest[0] = 0x34; - dest++; + *dest++ = CHAR_LV; if (level == 0) level = 5; ConvertIntToDecimalString(buffer, level); - dest = sub_80A1E9C(dest, buffer, 14); + dest = SummaryScreen_CopyColoredString(dest, buffer, 14); dest = StringCopy(dest, gOtherText_Comma); return dest; diff --git a/src/script_pokemon_util_80F99CC.c b/src/script_pokemon_util_80F99CC.c index b292265a6..87ef2517b 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -19,7 +19,7 @@ #include "text.h" #include "ewram.h" -extern const u8 gUnknown_08208238[]; +extern const u8 gPPUpReadMasks[]; extern u8 gPlayerPartyCount; extern u16 gSpecialVar_0x8004; @@ -307,11 +307,11 @@ void sub_80F9FDC(struct Pokemon *pkmn, u8 moveIndex1, u8 moveIndex2) u8 pp2 = GetMonData(pkmn, MON_DATA_PP1 + moveIndex2); u8 bonuses = GetMonData(pkmn, MON_DATA_PP_BONUSES); - u8 r2 = (bonuses & gUnknown_08208238[moveIndex1]) >> (moveIndex1 * 2); - u8 r1 = (bonuses & gUnknown_08208238[moveIndex2]) >> (moveIndex2 * 2); + u8 r2 = (bonuses & gPPUpReadMasks[moveIndex1]) >> (moveIndex1 * 2); + u8 r1 = (bonuses & gPPUpReadMasks[moveIndex2]) >> (moveIndex2 * 2); - bonuses &= ~gUnknown_08208238[moveIndex1]; - bonuses &= ~gUnknown_08208238[moveIndex2]; + bonuses &= ~gPPUpReadMasks[moveIndex1]; + bonuses &= ~gPPUpReadMasks[moveIndex2]; bonuses |= (r2 << (moveIndex2 * 2)) + (r1 << (moveIndex1 * 2)); SetMonData(pkmn, MON_DATA_MOVE1 + moveIndex1, &move2); diff --git a/src/strings.c b/src/strings.c index cded04f96..e9d9ea87e 100644 --- a/src/strings.c +++ b/src/strings.c @@ -2,6 +2,7 @@ #include "strings.h" #if ENGLISH + // placeholder strings const u8 gExpandedPlaceholder_Empty[] = _(""); const u8 gExpandedPlaceholder_Kun[] = _(""); @@ -180,7 +181,8 @@ const u8 gOtherText_OneDash[] = _("-"); const u8 gOtherText_TwoDashes[] = _("--"); const u8 gOtherText_ThreeDashes2[] = _("---"); const u8 gOtherText_MaleSymbol2[] = _("♂"); -const u8 gOtherText_FemaleSymbolAndLv[] = _("♀$Lv."); +const u8 gOtherText_FemaleSymbol2[] = _("♀"); +const u8 gOtherText_Lv[] = _("Lv."); const u8 gOtherText_TallPlusAndRightArrow[] = _("{TALL_PLUS}${RIGHT_ARROW}"); const u8 gMenuText_GoBackToPrev[] = _("Go back to the\nprevious menu."); const u8 gOtherText_WhatWillYouDo[] = _("What would you like to do?"); @@ -926,6 +928,7 @@ const u8 gSystemText_SaveFailed[] = _("Save failed..."); const u8 gSystemText_NoSaveFileNoTime[] = _("There is no save file, so the time\ncan’t be set."); const u8 gSystemText_ClockAdjustmentUsable[] = _("The in-game clock adjustment system\nis now useable."); const u8 gSystemText_Saving[] = _("SAVING...\nDON’T TURN OFF THE POWER."); + #elif GERMAN // placeholder strings @@ -1106,7 +1109,8 @@ const u8 gOtherText_OneDash[] = _("-"); const u8 gOtherText_TwoDashes[] = _("--"); const u8 gOtherText_ThreeDashes2[] = _("---"); const u8 gOtherText_MaleSymbol2[] = _("♂"); -const u8 gOtherText_FemaleSymbolAndLv[] = _("♀$Lv."); +const u8 gOtherText_FemaleSymbol2[] = _("♀"); +const u8 gOtherText_Lv[] = _("Lv."); const u8 gOtherText_TallPlusAndRightArrow[] = _("{TALL_PLUS}${RIGHT_ARROW}"); const u8 gMenuText_GoBackToPrev[] = _("Kehre zurück zum\nvorherigen Menü."); const u8 gOtherText_WhatWillYouDo[] = _("Was möchtest du tun?"); diff --git a/src/text.c b/src/text.c index c2f78276b..dbf74ab61 100644 --- a/src/text.c +++ b/src/text.c @@ -2003,7 +2003,7 @@ void Text_InitWindow8002E4C(struct Window *win, const u8 *text, u16 tileDataStar if (a6) val = 255; win->win_field_F = val; - if (val) + if (win->win_field_F) ClipLeft(win); } @@ -3394,7 +3394,7 @@ static u16 GetBlankTileNum(struct Window *win) return retVal; } -static s32 sub_80048D8(struct Window *win, u8 x, u8 y) +static s32 Window_MoveCursor(struct Window *win, u8 x, u8 y) { win->cursorX = x; win->cursorY = y & 0xF8; @@ -3672,25 +3672,26 @@ u8 Text_InitWindow8004D04(struct Window *win, const u8 *text, u16 tileDataStartO return Text_PrintWindow8002F44(win); } -u8 Text_InitWindow8004D38(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top) +u8 Text_InitWindow_RightAligned(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 right, u8 top) { u8 width = GetStringWidth(win, text); - Text_InitWindow(win, text, tileDataStartOffset, left - ((u32)(width + 7) >> 3), top); + Text_InitWindow(win, text, tileDataStartOffset, right - ((u32)(width + 7) >> 3), top); EraseAtCursor(win); width &= 7; if (width) width = 8 - width; - sub_80048D8(win, width, 0); + Window_MoveCursor(win, width, 0); return Text_PrintWindow8002F44(win); } -u8 Text_InitWindow8004DB0(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 a6) +u8 Text_InitWindow_Centered(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 width) { - register u32 val asm("r5") = (u8)((a6 >> 1) - (GetStringWidth(win, text) >> 1)); - left += (val >> 3); + width = (u8)(width / 2 - GetStringWidth(win, text) / 2); + left += (u8)width / 8; Text_InitWindow(win, text, tileDataStartOffset, left, top); EraseAtCursor(win); - sub_80048D8(win, val & 7, 0); + width &= 7; + Window_MoveCursor(win, width, 0); return Text_PrintWindow8002F44(win); } |