From 20db3cf040eb8c7158f1818532a2caf892acb5ca Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 10 Jun 2025 15:34:45 +0200 Subject: [PATCH] start moves --- charmap.txt | 19 ++++---- data/data_81076E4.s | 70 --------------------------- include/code_809447C.h | 11 +---- include/moves.h | 17 +++++-- include/text_3.h | 2 +- ld_script.ld | 2 + src/code_801EE10.c | 10 ++-- src/code_809447C.c | 1 - src/data/options_menu2.h | 2 +- src/data/pokemon_mail.h | 4 +- src/dungeon_menu_moves.c | 6 +-- src/dungeon_menu_team.c | 10 ++-- src/dungeon_message.c | 6 +-- src/dungeon_strings.c | 12 ++--- src/friend_area.c | 9 ++-- src/items.c | 4 +- src/moves.c | 100 +++++++++++++++++++-------------------- src/string_format.c | 8 ++-- src/strings.c | 2 +- src/text_3.c | 32 ++++++------- 20 files changed, 125 insertions(+), 202 deletions(-) diff --git a/charmap.txt b/charmap.txt index c32d7752d..18e570513 100644 --- a/charmap.txt +++ b/charmap.txt @@ -460,7 +460,7 @@ R_BUTTON = 84 86 ENVELOPE_CLOSED = 84 87 ICON_BLANK = 87 40 -ICON_ITEM_SET = 87 41 @ E +ICON_SET = 87 41 @ E STAR_BULLET = 87 42 @ = 87 43 @ Star with E ICON_STICKY = 87 44 @@ -524,7 +524,13 @@ TEAM_NAME = 24 74 @ $t @ case is insensitive but need different definitions to match CENTER_ALIGN = 23 2B @ #+ -UNK_MACRO_3D = 23 3D @ #= (Probably used to manually position text at an x coordinate) +MOVE_X_POSITION = 23 3D @ #= (Used to manually position text at an x coordinate) +@ The '.' doesn't do anything, it's specifically coded to not do anything +MOVE_X_POSITION_BY_64 = 23 3D 40 2E @ . +MOVE_X_POSITION_BY_80 = 23 3D 50 2E @ . +MOVE_X_POSITION_BY_120 = 23 3D 78 2E @ . +MOVE_X_POSITION_BY_136 = 23 3D 88 2E @ . +MOVE_X_POSITION_BY_160 = 23 3D A0 2E @ . UNK_MACRO_3E = 23 3E @ #> (Seems to be an alignment operator) EXTRA_MSG = 23 50 @ #P WAIT_PRESS = 23 57 @ #W @@ -575,15 +581,6 @@ GENDER_COLOR = 45 @ E - color 15 COLOR15_S = 53 @ S - color 15 - unused COLOR15_T = 54 @ T - color 15 - unused - -@ FOR UNK_MACRO_3D -UNK_MACRO_3D_50 = 23 3D 32 @ #2 (Unlike the other ones, this one is used without the '.') -M3D_64 = 40 2E @ @. -M3D_80 = 50 2E @ P. -M3D_120 = 78 2E @ x. -M3D_136 = 88 2E @ ˆ. -M3D_160 = A0 2E @ \u00A0. - @ FOR UNK_MACRO_3E M3E_22 = 32 32 2E @ 22. M3E_35 = 33 35 2E @ 35. diff --git a/data/data_81076E4.s b/data/data_81076E4.s index c01399c98..2e8f089c9 100644 --- a/data/data_81076E4.s +++ b/data/data_81076E4.s @@ -3,76 +3,6 @@ -@ START friend_area.c -.string "pksdir0\0" - -.global sUnknown_81098A4 -sUnknown_81098A4: @ 81098A4 -.string "{color GREEN_RAW}%s{reset}\0" -.align 2,0 - -.global sUnknown_81098AC -sUnknown_81098AC: @ 81098AC -.string "%s{UNK_MACRO_3D}%c{COLOR GREEN_RAW}%s{RESET}\0" -.align 2,0 -@ END friend_area.c -@ moves.c -.string "pksdir0" -.align 2,0 - -.global gUnknown_81098C4 -gUnknown_81098C4: @ 81098C4 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - -.global gUnknown_81098D0 -gUnknown_81098D0: @ 81098D0 -.string "wazapara\0" -.align 2,0 - -.global gUnknown_81098DC -gUnknown_81098DC: @ 81098DC -.string "%+d\0" - -.global gUnknown_81098E0 -gUnknown_81098E0: @ 81098E0 -.string "{color}%c%s%s{reset}\0" -.align 2,0 - -.global gUnknown_81098EC -gUnknown_81098EC: @ 81098EC -.string "{color}%c#:%s%s%s#;%c%2d/%2d{reset}\0" -.align 2,0 - -.global gUnknown_8109908 -gUnknown_8109908: @ 8109908 -.byte 0x87, 0x41, 0x00, 0x00 @ apparently shows A in memory viewer - -.global gUnknown_810990C -gUnknown_810990C: @ 810990C -.byte 0x87, 0x40, 0x00, 0x00 @ apparently shows @ in memory viewer - -.global gUnknown_8109910 -gUnknown_8109910: @ 8109910 -.string "{color}%c%s%s%s{UNK_MACRO_3D}%c%2d/%2d{reset}\0" -.align 2,0 - -.global gUnknown_8109928 -gUnknown_8109928: @ 8109928 -.byte 0x87, 0x42, 0x00 @ apparently shows B in memory viewer - -.global gUnknown_810992B -gUnknown_810992B: @ 810992B -.byte 0x00 - -.global gUnknown_810992C -gUnknown_810992C: @ 810992C -.string "%s\0" -.align 2,0 - -.global gUnknown_8109930 -gUnknown_8109930: @ 8109930 -.string "{POKEMON_0}\0" .align 2,0 @ ??? .string "pksdir0\0" diff --git a/include/code_809447C.h b/include/code_809447C.h index 08cbc077c..492301429 100644 --- a/include/code_809447C.h +++ b/include/code_809447C.h @@ -1,13 +1,6 @@ #ifndef GUARD_CODE_809447C_H #define GUARD_CODE_809447C_H -// size: 0xC -typedef struct unkStruct_80928C0 -{ - u32 unk0; - s32 unk4; - u8 unk8; - u8 unk9; -} unkStruct_80928C0; -#endif // GUARD_CODE_809447C_H \ No newline at end of file + +#endif // GUARD_CODE_809447C_H diff --git a/include/moves.h b/include/moves.h index fd46650c4..d67a7fb80 100644 --- a/include/moves.h +++ b/include/moves.h @@ -1,12 +1,22 @@ #ifndef GUARD_MOVES_H #define GUARD_MOVES_H -#include "code_809447C.h" #include "constants/move.h" #include "constants/move_id.h" #include "pokemon.h" #include "structs/str_status_text.h" +#define X_PP_COORD_DEFAULT 106 + +// size: 0xC +typedef struct MoveBufferStruct +{ + u32 style; + s32 xPPCoord; + u8 unk8; + u8 unk9; +} MoveBufferStruct; + // size: 0x8 typedef struct MoveLearnset { @@ -75,9 +85,8 @@ s32 unk_SetMoveToLastInLinkedSequence8_v2(Move *moves, s32 index); bool8 UnlinkMovesAfter(s32 index, Move *moves); void UnSetMove(s32 index, Move *moves); -u8 sub_809287C(Move *move); -void sub_80928A0(u8 *buffer, Move *move, const unkStruct_80928C0 *); -void BufferMoveName(u8 *buffer, Move *move, const unkStruct_80928C0 *); +void BufferDefaultMoveName(u8 *buffer, Move *move, const MoveBufferStruct *); // Default = regular PP num and no flags2 +void BufferMoveName(u8 *buffer, Move *move, const MoveBufferStruct *); void InitPokemonMoveOrNullObject(Move *move, u16 moveID); void sub_8092C84(u8 *buffer, u16 moveID); s32 sub_8092DB8(Move *moves, s32 index); diff --git a/include/text_3.h b/include/text_3.h index 205d33c12..cfdf83bc1 100644 --- a/include/text_3.h +++ b/include/text_3.h @@ -4,7 +4,7 @@ // size: 0x34 typedef struct UnkDrawStringStruct { - s16 unk0; + s16 x; s16 unk2; s16 unk4; s16 unk6; diff --git a/ld_script.ld b/ld_script.ld index ba3717ace..44f5544cd 100755 --- a/ld_script.ld +++ b/ld_script.ld @@ -684,6 +684,8 @@ SECTIONS { src/text_util.o(.rodata); src/pokemon_types.o(.rodata); src/pokemon_abilities.o(.rodata); + src/friend_area.o(.rodata); + src/moves.o(.rodata); data/data_81076E4.o(.rodata); src/game_options.o(.rodata); src/random_mersenne_twister.o(.rodata); diff --git a/src/code_801EE10.c b/src/code_801EE10.c index bbdd95eee..46da57bd3 100644 --- a/src/code_801EE10.c +++ b/src/code_801EE10.c @@ -293,16 +293,16 @@ void sub_801F280(bool8 param_1) struct Move *move; bool8 linkChain; s32 x, y; - struct unkStruct_80928C0 uStack_30 = {0}; + struct MoveBufferStruct uStack_30 = {0}; - uStack_30.unk4 = 0x6a; + uStack_30.xPPCoord = X_PP_COORD_DEFAULT; move = &gUnknown_203B270->moves[i]; if (MoveFlagExists(move)) { if (gUnknown_203B270->isTeamLeader) { - uStack_30.unk0 = 2; + uStack_30.style = 2; } else { - uStack_30.unk0 = 4; + uStack_30.style = 4; } if (gUnknown_203B270->unk6) { @@ -316,7 +316,7 @@ void sub_801F280(bool8 param_1) uStack_30.unk8 = 1; } - sub_80928A0(gFormatBuffer_Items[0],move,&uStack_30); + BufferDefaultMoveName(gFormatBuffer_Items[0],move,&uStack_30); y = GetMenuEntryYCoord(&gUnknown_203B270->input,i); linkChain = MoveFlagLinkChain(move); x = !linkChain ? 0x8 : 0xD; diff --git a/src/code_809447C.c b/src/code_809447C.c index 9271ecbce..8b56285f1 100644 --- a/src/code_809447C.c +++ b/src/code_809447C.c @@ -1,7 +1,6 @@ #include "global.h" #include "structs/str_dungeon.h" #include "code_8092334.h" -#include "code_809447C.h" #include "dungeon_info.h" #include "items.h" #include "moves.h" diff --git a/src/data/options_menu2.h b/src/data/options_menu2.h index 34b8deeed..55f3b5f32 100644 --- a/src/data/options_menu2.h +++ b/src/data/options_menu2.h @@ -18,7 +18,7 @@ static const WindowTemplate sUnknown_80DC03C = { }; ALIGNED(4) static const u8 sGameOptions[] = _("Game Options"); -ALIGNED(4) static const u8 sUnknown_80DC064[] = _("Windows{UNK_MACRO_3D M3D_80}Blue{UNK_MACRO_3D M3D_120}Red{UNK_MACRO_3D M3D_160}Green"); +ALIGNED(4) static const u8 sUnknown_80DC064[] = _("Windows{MOVE_X_POSITION_BY_80}Blue{MOVE_X_POSITION_BY_120}Red{MOVE_X_POSITION_BY_160}Green"); ALIGNED(4) static const u8 sBlue[] = _("Blue"); ALIGNED(4) static const u8 sRed[] = _("Red"); ALIGNED(4) static const u8 sGreen[] = _("Green"); diff --git a/src/data/pokemon_mail.h b/src/data/pokemon_mail.h index b4f9bcd2a..f5375aa1a 100644 --- a/src/data/pokemon_mail.h +++ b/src/data/pokemon_mail.h @@ -1350,8 +1350,8 @@ ALIGNED(4) static const u8 sWondersText[] = _( ALIGNED(4) static const u8 sWondersHeadline[] = _("#16 Seven Wonders of Pokémon"); ALIGNED(4) static const u8 sPollText[] = _( - "{COLOR YELLOW}First{UNK_MACRO_3D_50}Gravelerock{RESET}\n" - "{COLOR YELLOW}Second{UNK_MACRO_3D_50}Oran Berry{RESET}\n" + "{COLOR YELLOW}First{MOVE_X_POSITION}{50}Gravelerock{RESET}\n" + "{COLOR YELLOW}Second{MOVE_X_POSITION}{50}Oran Berry{RESET}\n" "In a nationwide survey involving rescue\n" "teams, the most popular item was found to\n" "be {COLOR GREEN}Gravelerocks{RESET}. According to Sudowoodo\n" diff --git a/src/dungeon_menu_moves.c b/src/dungeon_menu_moves.c index b69da6aee..de2d031a9 100644 --- a/src/dungeon_menu_moves.c +++ b/src/dungeon_menu_moves.c @@ -489,15 +489,15 @@ static void PrintMoveNamesOnWindow(s32 count, Entity *entity, Move *moves, s32 w PrintFormattedStringOnWindow((a5 * 8) + 10, 0, gUnknown_80FE978, windowId, '\0'); for (i = 0; i < count; i++) { s32 x, y; - unkStruct_80928C0 movStruct = {0, 106, 0, a4}; + MoveBufferStruct movStruct = {0, .xPPCoord = X_PP_COORD_DEFAULT, 0, a4}; Move *move = &moves[i]; if (MoveFlagExists(move)) { if (entInfo->isTeamLeader) { - movStruct.unk0 = 2; + movStruct.style = 2; } else { - movStruct.unk0 = 4; + movStruct.style = 4; } movStruct.unk8 = (CanMonsterUseMove(entity, move, TRUE) == FALSE); diff --git a/src/dungeon_menu_team.c b/src/dungeon_menu_team.c index 5aada1953..518cf25c7 100644 --- a/src/dungeon_menu_team.c +++ b/src/dungeon_menu_team.c @@ -418,10 +418,10 @@ static void PrintOnDungeonTeamMenu(struct UnkFieldTeamMenuStruct *a0, WindowTemp gFormatArgs[1] = monInfo->maxHPStat; y = GetMenuEntryYCoord(&gDungeonMenu, i); if (monInfo->isTeamLeader) { - PrintFormattedStringOnWindow(9, y, _("{STAR_BULLET}{POKEMON_0}{UNK_MACRO_3D}{0x59}{POKEMON_1}"), 0, 0); + PrintFormattedStringOnWindow(9, y, _("{STAR_BULLET}{POKEMON_0}{MOVE_X_POSITION}{0x59}{POKEMON_1}"), 0, 0); } else { - PrintFormattedStringOnWindow(9, y, _("{ICON_BLANK}{POKEMON_0}{UNK_MACRO_3D}{0x59}{POKEMON_1}"), 0, 0); + PrintFormattedStringOnWindow(9, y, _("{ICON_BLANK}{POKEMON_0}{MOVE_X_POSITION}{0x59}{POKEMON_1}"), 0, 0); } } } @@ -1567,15 +1567,15 @@ static void PrintMoveNamesOnBottomWindow(Entity *entity) s32 i; for (i = 0; i < MAX_MON_MOVES; i++) { - unkStruct_80928C0 movStruct = {0, 106, 0, 0}; + MoveBufferStruct movStruct = {0, .xPPCoord = X_PP_COORD_DEFAULT, 0, 0}; Move *move = &entInfo->moves.moves[i]; if (MoveFlagExists(move)) { if (entInfo->isTeamLeader) { - movStruct.unk0 = 2; + movStruct.style = 2; } else { - movStruct.unk0 = 4; + movStruct.style = 4; } movStruct.unk8 = (CanMonsterUseMove(entity, move, TRUE) == FALSE); diff --git a/src/dungeon_message.c b/src/dungeon_message.c index a9d8ebd70..57d335fbc 100644 --- a/src/dungeon_message.c +++ b/src/dungeon_message.c @@ -234,7 +234,7 @@ void xxx_draw_string_80524F0(void) else { const u8 *txtPtr = strPtr->unk0[id]; - sp.unk0 = 4; + sp.x = 4; sp.unk2 = strPtr->unk1C066; sp.unk10 = 7; sub_80073B8(0); @@ -248,10 +248,10 @@ void xxx_draw_string_80524F0(void) break; txtPtr = xxx_get_next_char_from_string(txtPtr, &currChr); if (currChr == '`') { - sp.unk0 += 6; + sp.x += 6; } else { - sp.unk0 += DrawCharOnWindow(sp.unk0, sp.unk2, currChr, sp.unk10, 0); + sp.x += DrawCharOnWindow(sp.x, sp.unk2, currChr, sp.unk10, 0); } } sub_80073E0(0); diff --git a/src/dungeon_strings.c b/src/dungeon_strings.c index 2d4294605..e23efb84c 100644 --- a/src/dungeon_strings.c +++ b/src/dungeon_strings.c @@ -924,12 +924,12 @@ const u8 *const gUnknown_80FE724 = _("Warp Zone"); const u8 *const gOptionsDungeonTextPtr = _("Dungeon"); const u8 *const gOptionsOthersTextPtr = _("Others"); const u8 *const gUnknown_80FE748 = _("Default"); -const u8 *const gUnknown_80FE764 = _("Speed{UNK_MACRO_3D M3D_80}Slow{UNK_MACRO_3D M3D_136}Fast"); -const u8 *const gUnknown_80FE788 = _("Far-off pals{UNK_MACRO_3D M3D_80}Self{UNK_MACRO_3D M3D_136}Look"); -const u8 *const gUnknown_80FE7A8 = _("Damage turn{UNK_MACRO_3D M3D_80}No{UNK_MACRO_3D M3D_136}Yes"); -const u8 *const gUnknown_80FE7C0 = _("Grids{UNK_MACRO_3D M3D_80}Off{UNK_MACRO_3D M3D_136}On"); -const u8 *const gUnknown_80FE7E4 = _("Map{UNK_MACRO_3D M3D_80}Off{UNK_MACRO_3D M3D_120}Clear{UNK_MACRO_3D M3D_160}Shade"); -const u8 *const gOptionsWindowColorPtr = _("Windows{UNK_MACRO_3D M3D_80}Blue{UNK_MACRO_3D M3D_120}Red{UNK_MACRO_3D M3D_160}Green"); +const u8 *const gUnknown_80FE764 = _("Speed{MOVE_X_POSITION_BY_80}Slow{MOVE_X_POSITION_BY_136}Fast"); +const u8 *const gUnknown_80FE788 = _("Far-off pals{MOVE_X_POSITION_BY_80}Self{MOVE_X_POSITION_BY_136}Look"); +const u8 *const gUnknown_80FE7A8 = _("Damage turn{MOVE_X_POSITION_BY_80}No{MOVE_X_POSITION_BY_136}Yes"); +const u8 *const gUnknown_80FE7C0 = _("Grids{MOVE_X_POSITION_BY_80}Off{MOVE_X_POSITION_BY_136}On"); +const u8 *const gUnknown_80FE7E4 = _("Map{MOVE_X_POSITION_BY_80}Off{MOVE_X_POSITION_BY_120}Clear{MOVE_X_POSITION_BY_160}Shade"); +const u8 *const gOptionsWindowColorPtr = _("Windows{MOVE_X_POSITION_BY_80}Blue{MOVE_X_POSITION_BY_120}Red{MOVE_X_POSITION_BY_160}Green"); const u8 *const gDsTopScreenOptions[] = { [0] = _("Top screen: Team data"), [1] = _("Top screen: Team data"), diff --git a/src/friend_area.c b/src/friend_area.c index 3eb41a680..21a46e852 100644 --- a/src/friend_area.c +++ b/src/friend_area.c @@ -1,4 +1,5 @@ #include "global.h" +#include "globaldata.h" #include "code_800D090.h" #include "code_8092334.h" #include "constants/dungeon.h" @@ -13,10 +14,6 @@ EWRAM_DATA static bool8 sBoughtFriendAreas[NUM_FRIEND_AREAS] = {0}; EWRAM_INIT bool8 *gFriendAreas = {NULL}; -// data_8107010.s -extern const u8 sUnknown_81098A4[]; -extern const u8 sUnknown_81098AC[]; - void LoadFriendAreas(void) { gFriendAreas = sBoughtFriendAreas; @@ -110,7 +107,7 @@ s32 GetFriendAreaPrice(u8 index) void sub_8092558(u8 *buffer, u8 index) { - sprintfStatic(buffer, sUnknown_81098A4, gFriendAreaNames[index]); + sprintfStatic(buffer, _("{color GREEN_RAW}%s{reset}"), gFriendAreaNames[index]); } void WriteFriendAreaName(u8 *buffer, u8 index, bool8 printPrice) @@ -120,7 +117,7 @@ void WriteFriendAreaName(u8 *buffer, u8 index, bool8 printPrice) if (printPrice) { WriteHighDecimal(gFriendAreaSettings[index].price, priceBuffer, 1); - sprintfStatic(buffer, sUnknown_81098AC, gFriendAreaNames[index], 96, priceBuffer); + sprintfStatic(buffer, _("%s{MOVE_X_POSITION}%c{COLOR GREEN_RAW}%s{RESET}"), gFriendAreaNames[index], 96, priceBuffer); } else strcpy(buffer, gFriendAreaNames[index]); diff --git a/src/items.c b/src/items.c index ccf10a95e..7aba93901 100644 --- a/src/items.c +++ b/src/items.c @@ -399,7 +399,7 @@ void sub_8090E14(u8* ext_buffer, Item* slot, const struct unkStruct_8090F58* a3) if (a3) { if (a3->unk4 && (slot->flags & ITEM_FLAG_SET)) { - sprintfStatic(ext_buffer, _("{ICON_ITEM_SET}%s"), buffer); + sprintfStatic(ext_buffer, _("{ICON_SET}%s"), buffer); strncpy(buffer, ext_buffer, 80); } if ((*(u32*)a3 == 1) || (*(u32*)a3 == 3)) { @@ -455,7 +455,7 @@ static void sub_8090F58(u8* a1, u8 *a2, Item *slot, const struct unkStruct_8090F if (a4->unk6) { WriteHighDecimal(value, buffer, 1); - sprintfStatic(a1, _("%s{UNK_MACRO_3D}%c{COLOR GREEN_RAW}%s{RESET}"), a2, a4->unk6, buffer); + sprintfStatic(a1, _("%s{MOVE_X_POSITION}%c{COLOR GREEN_RAW}%s{RESET}"), a2, a4->unk6, buffer); } else { WriteHighDecimal(value, buffer, 0); diff --git a/src/moves.c b/src/moves.c index 312339aa3..ae1c1b6cd 100644 --- a/src/moves.c +++ b/src/moves.c @@ -1,4 +1,5 @@ #include "global.h" +#include "globaldata.h" #include "constants/colors.h" #include "constants/monster.h" #include "code_800D090.h" @@ -17,20 +18,6 @@ static EWRAM_DATA OpenedFile *sWazaParametersFile = { NULL }; // NDS=213C188 static EWRAM_DATA MoveDataEntry *sMovesData = { NULL }; // NDS=213C18C static EWRAM_DATA MoveLearnset *sMoveLearnsets = { NULL }; // NDS=0213C184 | 420 entries, aka (MONSTER_DEOXYS_SPEED + 1), aka (MONSTER_MUNCHLAX) -// data_8107010.s -extern const unkStruct_80928C0 gUnknown_81098C4; -extern const u8 gUnknown_81098D0[]; -extern const u8 gUnknown_81098DC[]; -extern const u8 gUnknown_81098E0[]; -extern const u8 gUnknown_81098EC[]; -extern const u8 gUnknown_8109908[]; -extern const u8 gUnknown_810990C[]; -extern const u8 gUnknown_8109910[]; -extern const u8 gUnknown_8109928[]; -extern const u8 gUnknown_810992B; -extern const u8 gUnknown_810992C[]; -extern const u8 gUnknown_8109930[]; - static void CopyAndResetMove(Move *, Move *); static bool8 sub_80933D8(s32, Move *); static s32 unk_FindMarkedMoveInLinkedSequences44(Move [MAX_MON_MOVES][MAX_MON_MOVES]); @@ -44,16 +31,18 @@ static void unk_LinkedSequencesToMoves8(Move *, Move [8][8]); static void unk_LinkedSequencesToMoves8_v2(Move *, Move [8][8]); static void unk_MovePrintData(Move *, s32); +static const MoveBufferStruct sDefaultMoveBufferParams = {0}; + // arm9.bin::020640A0 void LoadWazaParameters(void) { - sWazaParametersFile = OpenFileAndGetFileDataPtr(gUnknown_81098D0, &gSystemFileArchive); + sWazaParametersFile = OpenFileAndGetFileDataPtr("wazapara", &gSystemFileArchive); sMovesData = ((MoveDataFile *)(sWazaParametersFile->data))->moveData; sMoveLearnsets = ((MoveDataFile *)(sWazaParametersFile->data))->moveLearnsets; } -u8 sub_809287C(Move *move) +static u8 GetColorForMove(Move *move) { if (move->moveFlags & MOVE_FLAG_DISABLED) return 50; @@ -62,62 +51,67 @@ u8 sub_809287C(Move *move) return 50; } -void sub_80928A0(u8 *buffer, Move *move, const unkStruct_80928C0 *a2) +void BufferDefaultMoveName(u8 *buffer, Move *move, const MoveBufferStruct *bufferParams) { - Move stack; - CopyAndResetMove(&stack, move); - BufferMoveName(buffer, &stack, a2); + Move moveCopy; + CopyAndResetMove(&moveCopy, move); + BufferMoveName(buffer, &moveCopy, bufferParams); } -void BufferMoveName(u8 *buffer, Move *move, const unkStruct_80928C0 *param_3) +enum { - u32 uVar2; + BUFFER_MOVE_JUST_NAME, +}; + +void BufferMoveName(u8 *buffer, Move *move, const MoveBufferStruct *bufferParams) +{ + u32 color; u32 basePP; u8 localBuffer[12]; - uVar2 = sub_809287C(move); + color = GetColorForMove(move); - if (param_3 == NULL) - param_3 = &gUnknown_81098C4; + if (bufferParams == NULL) + bufferParams = &sDefaultMoveBufferParams; if (move->ginseng != 0) - sprintfStatic(localBuffer, gUnknown_81098DC, move->ginseng); // %+d + sprintfStatic(localBuffer, _("%+d"), move->ginseng); else localBuffer[0] = '\0'; - if (param_3->unk8 != 0) - uVar2 = 2; - if (param_3->unk9 != 0 && DoesMoveCharge(move->id)) - uVar2 = 2; + if (bufferParams->unk8 != 0) + color = COLOR_RED; + if (bufferParams->unk9 != 0 && DoesMoveCharge(move->id)) + color = COLOR_RED; - switch (param_3->unk0) { - case 0: - sprintfStatic(buffer, gUnknown_81098E0, - uVar2, sMovesData[move->id].name, localBuffer); + switch (bufferParams->style) { + case BUFFER_MOVE_JUST_NAME: + sprintfStatic(buffer, _("{color}%c%s%s{reset}"), + color, sMovesData[move->id].name, localBuffer); break; case 1: basePP = GetMoveBasePP(move); - sprintfStatic(buffer, gUnknown_81098EC, - uVar2, move->moveFlags & MOVE_FLAG_SET ? gUnknown_8109908 : gUnknown_810990C, - sMovesData[move->id].name, localBuffer, param_3->unk4, move->PP, basePP); + sprintfStatic(buffer, _("{color}%c#:%s%s%s#;%c%2d/%2d{reset}"), + color, move->moveFlags & MOVE_FLAG_SET ? _("{ICON_SET}") : _("{ICON_BLANK}"), + sMovesData[move->id].name, localBuffer, bufferParams->xPPCoord, move->PP, basePP); break; case 2: basePP = GetMoveBasePP(move); - sprintfStatic(buffer, gUnknown_8109910, - uVar2, move->moveFlags & MOVE_FLAG_SET ? gUnknown_8109908 : gUnknown_810990C, - sMovesData[move->id].name, localBuffer, param_3->unk4, move->PP, basePP); + sprintfStatic(buffer, _("{color}%c%s%s%s{MOVE_X_POSITION}%c%2d/%2d{reset}"), + color, move->moveFlags & MOVE_FLAG_SET ? _("{ICON_SET}") : _("{ICON_BLANK}"), + sMovesData[move->id].name, localBuffer, bufferParams->xPPCoord, move->PP, basePP); break; case 3: basePP = GetMoveBasePP(move); - sprintfStatic(buffer, gUnknown_81098EC, - uVar2, move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI ? gUnknown_8109928 : gUnknown_810990C, - sMovesData[move->id].name, localBuffer, param_3->unk4, move->PP, basePP); + sprintfStatic(buffer, _("{color}%c#:%s%s%s#;%c%2d/%2d{reset}"), + color, move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI ? _("{STAR_BULLET}") : _("{ICON_BLANK}"), + sMovesData[move->id].name, localBuffer, bufferParams->xPPCoord, move->PP, basePP); break; case 4: basePP = GetMoveBasePP(move); - sprintfStatic(buffer, gUnknown_8109910, - uVar2, move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI ? gUnknown_8109928 : gUnknown_810990C, - sMovesData[move->id].name, localBuffer, param_3->unk4, move->PP, basePP); + sprintfStatic(buffer, _("{color}%c%s%s%s{MOVE_X_POSITION}%c%2d/%2d{reset}"), + color, move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI ? _("{STAR_BULLET}") : _("{ICON_BLANK}"), + sMovesData[move->id].name, localBuffer, bufferParams->xPPCoord, move->PP, basePP); break; } } @@ -162,13 +156,15 @@ u8 GetMoveType(Move *move) return sMovesData[move->id].type; } +static const u8 gDummyMoves[] = {0}; + const u8 *GetLevelUpMoves(s16 species) { s32 id = SpeciesId(species); if (species == MONSTER_DECOY || species == MONSTER_NONE) - return &gUnknown_810992B; + return gDummyMoves; if (id == MONSTER_MUNCHLAX) - return &gUnknown_810992B; + return gDummyMoves; return sMoveLearnsets[id].levelUpMoves; } @@ -177,9 +173,9 @@ const u8 *GetHMTMMoves(s16 species) { s32 id = SpeciesId(species); if (species == MONSTER_DECOY || species == MONSTER_NONE) - return &gUnknown_810992B; + return gDummyMoves; if (id == MONSTER_MUNCHLAX) - return &gUnknown_810992B; + return gDummyMoves; return sMoveLearnsets[id].HMTMMoves; } @@ -280,7 +276,7 @@ bool8 IsSoundMove(Move *move) static void sub_8092D54(u8 *buffer, Move *move) { - sprintfStatic(buffer, gUnknown_810992C, gRangeNames[GetMoveRangeID(move)]); + sprintfStatic(buffer, _("%s"), gRangeNames[GetMoveRangeID(move)]); } // this function is the same as the two after the next one @@ -1378,7 +1374,7 @@ s32 unk_PrintMoveDescription(s32 x, Move *move, s32 a3, STATUSTEXTS(statuses)) sub_80073B8(a3); BufferMoveName(gFormatBuffer_Monsters[0], move, 0); - PrintFormattedStringOnWindow(8 * x + 16, 0, gUnknown_8109930, a3, 0); + PrintFormattedStringOnWindow(8 * x + 16, 0, _("{POKEMON_0}"), a3, 0); y = 19; moveDescription = sMovesData[move->id].description; diff --git a/src/string_format.c b/src/string_format.c index 06f8ffa79..0b1cf8ba2 100644 --- a/src/string_format.c +++ b/src/string_format.c @@ -261,7 +261,7 @@ void CreateMenuDialogueBoxAndPortrait(const u8 *text, void *a1, u32 r9, const Me sUnknown_203B198.id[3] = gUnknown_80D48AC; ResetUnusedInputStruct(); ShowWindows(&sUnknown_203B198, TRUE, TRUE); - gUnknown_202E748.unk0 = 4; + gUnknown_202E748.x = 4; gUnknown_202E748.unk2 = 4; gUnknown_202E748.unk8 = 0x70; gUnknown_202E748.unkA = (gWindows[0].y * 8) + 34; @@ -360,7 +360,7 @@ void DrawDialogueBoxString(void) } if (*str == '\r' || *str == '\n') { - gUnknown_202E748.unk0 = 4; + gUnknown_202E748.x = 4; gUnknown_202E748.unk2 += 11; str++; } @@ -368,7 +368,7 @@ void DrawDialogueBoxString(void) u32 chr; str = xxx_get_next_char_from_string(str, &chr); - gUnknown_202E748.unk0 += DrawCharOnWindow(gUnknown_202E748.unk0, gUnknown_202E748.unk2, chr, gUnknown_202E748.unk10, 0); + gUnknown_202E748.x += DrawCharOnWindow(gUnknown_202E748.x, gUnknown_202E748.unk2, chr, gUnknown_202E748.unk10, 0); gUnknown_202E748.unk2C = gUnknown_202E78C; } @@ -521,7 +521,7 @@ void DrawDialogueBoxString(void) gUnknown_202E744 = 11; } else if (gUnknown_202E744 == 8) { - gUnknown_202E748.unk0 = 4; + gUnknown_202E748.x = 4; if (gUnknown_202E748.unk2 > 34) { gUnknown_202E748.unk2 = 4; if (sUnknownTextFlags & 0x10) { diff --git a/src/strings.c b/src/strings.c index cedc81e89..0cf70e9e5 100644 --- a/src/strings.c +++ b/src/strings.c @@ -334,7 +334,7 @@ const u8 *const gRangeNames[49] = { [48] = _("48"), }; -const u8 *const gUnknown_810CF00 = _("Range{UNK_MACRO_3D M3D_64}{POKEMON_0} "); +const u8 *const gUnknown_810CF00 = _("Range{MOVE_X_POSITION_BY_64}{POKEMON_0} "); const u8 *const gTextType = _("Type"); const u8 *const gTextPower = _("Power"); const u8 *const gStatusNames[89] = { diff --git a/src/text_3.c b/src/text_3.c index 8e0296cdb..c324add5b 100644 --- a/src/text_3.c +++ b/src/text_3.c @@ -173,7 +173,7 @@ static void DrawStringInternal(Window *windows, s32 x, s32 y, const u8 *str, u32 UnkDrawStringStruct sp; u32 currChr; - sp.unk0 = x; + sp.x = x; sp.unk2 = y; sp.unkC = x; sp.unk10 = 7; @@ -193,27 +193,27 @@ static void DrawStringInternal(Window *windows, s32 x, s32 y, const u8 *str, u32 break; } else if (currChr == '\r' || currChr == '\n') { - sp.unk0 = sp.unkC; + sp.x = sp.unkC; sp.unk2 += lineSpacing; } else if (currChr == '\x1D') { // ASCII group separator. - sp.unk0 = sp.unkC; + sp.x = sp.unkC; sp.unk2 += 5; } else if (currChr == '`') { - sp.unk0 += 6; + sp.x += 6; } else if (characterSpacing == 0) { - sp.unk0 += DrawCharOnWindowInternal(windows, sp.unk0, sp.unk2, currChr, sp.unk10, windowId); + sp.x += DrawCharOnWindowInternal(windows, sp.x, sp.unk2, currChr, sp.unk10, windowId); } else { const unkChar *chrPtr = GetCharacter(currChr); if (chrPtr != NULL) { - s32 x = sp.unk0; + s32 x = sp.x; s32 x2 = gCharacterSpacing + 10; x +=((x2 - chrPtr->width) / 2); DrawCharOnWindowInternal(windows, x, sp.unk2, currChr, sp.unk10, windowId); - sp.unk0 += characterSpacing; + sp.x += characterSpacing; } } } @@ -283,7 +283,7 @@ static const u8 *HandleTextFormat(Window *windows, const u8 *str, UnkDrawStringS break; } else if (str[1] == '=') { - sp->unk0 = str[2]; + sp->x = str[2]; str += 3; if (*str == '.') str++; @@ -295,29 +295,29 @@ static const u8 *HandleTextFormat(Window *windows, const u8 *str, UnkDrawStringS str++; } else if (str[1] == '>') { - str = sub_800915C(&sp->unk0, str + 2); + str = sub_800915C(&sp->x, str + 2); } else if (str[1] == '.') { - sp->unk0 += str[2]; + sp->x += str[2]; str += 3; } else if (str[1] == 'n') { - sp->unk0 = sp->unkC; + sp->x = sp->unkC; sp->unk2 += 11; str += 2; } else if (str[1] == ':') { - sp->unk4 = sp->unk0; + sp->unk4 = sp->x; str += 2; } else if (str[1] == ';') { - sp->unk0 = sp->unk4 + str[2]; + sp->x = sp->unk4 + str[2]; str += 3; } else if (str[1] == '+') { str += 2; - sp->unk0 = (windows[0].width * 8) - sub_8008ED0(str); - sp->unk0 /= 2; + sp->x = (windows[0].width * 8) - sub_8008ED0(str); + sp->x /= 2; } else if (str[1] == 'C') { sp->unk14 = sp->unk10; @@ -350,7 +350,7 @@ static const u8 *HandleTextFormat(Window *windows, const u8 *str, UnkDrawStringS } else if (str[1] == 'W') { str += 2; - sp->unk8 = ((windows[0].x * 8) + sp->unk0) - 2; + sp->unk8 = ((windows[0].x * 8) + sp->x) - 2; sp->unkA = ((windows[0].y * 8) + sp->unk2) + 3; sp->unk20 = 1; break;