diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-30 16:30:08 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-30 16:30:08 -0500 |
commit | 6ecfa94ffb3d8c9ed8548c573a2ec1c1ef9357a4 (patch) | |
tree | e7eaa5dcf84b8ef89ff824fd37a4ae948a63cd51 | |
parent | 98075d9ba76a83a16a9182639c33b0e89d1864d6 (diff) |
Remove some explicit calls to memcpy in matsuda_debug_menu; label fields in ContestPokemon
-rw-r--r-- | include/contest.h | 19 | ||||
-rw-r--r-- | src/battle/battle_2.c | 3 | ||||
-rw-r--r-- | src/contest.c | 16 | ||||
-rw-r--r-- | src/debug/matsuda_debug_menu.c | 326 |
4 files changed, 178 insertions, 186 deletions
diff --git a/include/contest.h b/include/contest.h index b0bdd7f61..557b9e5c4 100644 --- a/include/contest.h +++ b/include/contest.h @@ -43,17 +43,13 @@ struct ContestPokemon /*0x02*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; /*0x0D*/ u8 trainerName[8]; /*0x15*/ u8 trainerGfxId; - /*0x16*/ u8 unk16; - /*0x17*/ u8 filler17; /*0x18*/ u32 flags; - /*0x1C*/ u8 unk1C_0:2; - u8 unk1C_2:1; - u8 unk1C_3:1; - u8 unk1C_4:1; - u8 unk1C_5:1; - u8 unk1C_6:1; - u8 unk1C_7:1; - u8 filler1D; + /*0x1C*/ u8 whichRank:2; + u8 aiPool_Cool:1; + u8 aiPool_Beauty:1; + u8 aiPool_Cute:1; + u8 aiPool_Smart:1; + u8 aiPool_Tough:1; /*0x1E*/ u16 moves[4]; // moves /*0x26*/ u8 cool; // cool /*0x27*/ u8 beauty; // beauty @@ -61,8 +57,7 @@ struct ContestPokemon /*0x29*/ u8 smart; // smart /*0x2A*/ u8 tough; // tough /*0x2B*/ u8 sheen; // sheen - /*0x2C*/ u8 unk2C; - /*0x2D*/ u8 unk2D[11]; + /*0x2C*/ u8 unk2C[12]; /*0x38*/ u32 personality; // personality /*0x3C*/ u32 otId; // otId }; // wow diff --git a/src/battle/battle_2.c b/src/battle/battle_2.c index 2ad2adb04..ea8c39066 100644 --- a/src/battle/battle_2.c +++ b/src/battle/battle_2.c @@ -4721,9 +4721,8 @@ void HandleAction_UseItem(void) } else { - ewram16003 = gBankAttacker; - switch (ewram160D8(gBankAttacker)) + switch (ewram160D8((ewram16003 = gBankAttacker))) { case AI_ITEM_FULL_RESTORE: case AI_ITEM_HEAL_HP: diff --git a/src/contest.c b/src/contest.c index ce29d80b0..ef16f0129 100644 --- a/src/contest.c +++ b/src/contest.c @@ -1955,7 +1955,7 @@ void Contest_CreatePlayerMon(u8 partyIndex) else gContestMons[gContestPlayerMonIndex].trainerGfxId = MAP_OBJ_GFX_LINK_MAY; gContestMons[gContestPlayerMonIndex].flags = 0; - gContestMons[gContestPlayerMonIndex].unk2C = 0; + gContestMons[gContestPlayerMonIndex].unk2C[0] = 0; gContestMons[gContestPlayerMonIndex].species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES); GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, name); StringGetEnd10(name); @@ -2022,7 +2022,7 @@ void Contest_CreatePlayerMon(u8 partyIndex) gContestMons[gContestPlayerMonIndex].tough = tough; } -void Contest_InitAllPokemon(u8 a, u8 b) +void Contest_InitAllPokemon(u8 contestType, u8 rank) { s32 i; u8 opponentsCount = 0; @@ -2033,17 +2033,17 @@ void Contest_InitAllPokemon(u8 a, u8 b) // Find all suitable opponents for (i = 0; i < 60; i++) { - if (b == gContestOpponents[i].unk1C_0) + if (rank == gContestOpponents[i].whichRank) { - if (a == 0 && gContestOpponents[i].unk1C_2) + if (contestType == 0 && gContestOpponents[i].aiPool_Cool) opponents[opponentsCount++] = i; - else if (a == 1 && gContestOpponents[i].unk1C_3) + else if (contestType == 1 && gContestOpponents[i].aiPool_Beauty) opponents[opponentsCount++] = i; - else if (a == 2 && gContestOpponents[i].unk1C_4) + else if (contestType == 2 && gContestOpponents[i].aiPool_Cute) opponents[opponentsCount++] = i; - else if (a == 3 && gContestOpponents[i].unk1C_5) + else if (contestType == 3 && gContestOpponents[i].aiPool_Smart) opponents[opponentsCount++] = i; - else if (a == 4 && gContestOpponents[i].unk1C_6) + else if (contestType == 4 && gContestOpponents[i].aiPool_Tough) opponents[opponentsCount++] = i; } } diff --git a/src/debug/matsuda_debug_menu.c b/src/debug/matsuda_debug_menu.c index efd952ef7..c8f80eb50 100644 --- a/src/debug/matsuda_debug_menu.c +++ b/src/debug/matsuda_debug_menu.c @@ -76,166 +76,6 @@ const struct MenuAction gMatsudaDebugMenuActions[] = {gMatsudaDebugMenu_ActionSetAllArtMuseumText, MatsudaDebugMenu_SetArtMuseumItems}, }; -const u8 gMatsudaDebugMenu_UnknownByteArray[] = {0xFC, 0x02, 0x0F, 0x00, 0xFF}; -const u8 Unknown_083C922D[] = INCBIN_U8("graphics/unknown/ball.4bpp"); -const u16 Unknown_083C924E[] = INCBIN_U16("graphics/unknown/ball.gbapal"); - -const u8 gUnknown_083C926E[][2] = -{ - {2, 0}, - {17, 0}, - {2, 2}, - {17, 2}, -}; - -const u8 gMatsudaDebugMenuContestTopLeft[][2] = -{ - {0, 6}, - {15, 6}, - {0, 8}, - {15, 8}, - {0, 10}, - {15, 10}, -}; - -const u8 gUnknown_083C9282[] = -{ - // TODO: 2d array? - 7, 6, - 22, 6, - 7, 8, - 22, 8, - 7, 10, - 22, 10, -}; - -const u8 gUnknown_083C928E[][2] = -{ - {2, 14}, - {17, 14}, - {2, 16}, - {17, 16}, -}; - -const u8 gUnknown_083C9296[] = {0x08, 0x80, 0x08, 0x80, 0x10, 0x10, 0x30, 0xA8, 0x30, 0xA8, 0x30, 0xA8, 0x08, 0x80, 0x08, 0x80, 0x10, 0x88}; -const u8 gUnknown_083C92A8[] = {0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x78, 0x88, 0x98}; - -const struct SpriteSheet gUnknown_083C92B4[] = {Unknown_083C922D, 32, 0x4B0}; -const struct SpritePalette gUnknown_083C92BC[] = {Unknown_083C924E, 0x4B0}; - -const struct OamData gOamData_83C92C4 = -{ - .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, - .shape = 0, - .x = 0, - .matrixNum = 0, - .size = 0, - .tileNum = 0, - .priority = 0, - .paletteNum = 0, - .affineParam = 0, -}; - -const struct SpriteTemplate gSpriteTemplate_83C92CC = -{ - .tileTag = 1200, - .paletteTag = 1200, - .oam = &gOamData_83C92C4, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80AA754, -}; - -static void (* const gUnknown_083C92E4[][2])(struct Sprite *, s8) = -{ - {sub_80AA8C8, sub_80AA8D8}, - {sub_80AA8E8, sub_80AA8F8}, - {sub_80AAC5C, sub_80AAC5C}, - {sub_80AA930, sub_80AA974}, - {sub_80AA9B8, sub_80AA9FC}, - {sub_80AAA40, sub_80AAA84}, - {sub_80AAAF0, sub_80AAB30}, - {sub_80AAB70, sub_80AABB0}, - {sub_80AABF0, sub_80AAD44}, -}; - -static const u8 gMatsudaDebugMenu_StartText[] = _("{COLOR CYAN}{HIGHLIGHT RED}"); -static const u8 gMatsudaDebugMenu_StartJapText[] = _("かいし"); // because StartText is only called by StringCopy, this part appears to be unused. -static const u8 gMatsudaDebugMenu_GoBackText[] = _("もどる"); - -#ifdef GERMAN -static const u8 gMatsudaDebugMenu_BattlePointsText[] = _("{COLOR MAGENTA}BP,"); -#else -static const u8 gMatsudaDebugMenu_BattlePointsText[] = _("{COLOR MAGENTA}BP."); -#endif - -static const u8 MatsudaDebugMenuText_Cool[] = _("かっこよさ"); // cool -static const u8 MatsudaDebugMenuText_Cute[] = _("かわいさ"); // cute -static const u8 MatsudaDebugMenuText_Beauty[] = _("うつくしさ"); // beauty -static const u8 MatsudaDebugMenuText_Smart[] = _("かしこさ"); // smart -static const u8 MatsudaDebugMenuText_Tough[] = _("たくましさ"); // tough -static const u8 MatsudaDebugMenuText_Sheen[] = _("けづや"); // sheen - -static const u8 *const gMatsudaDebugMenuTextList1[] = -{ - MatsudaDebugMenuText_Cool, - MatsudaDebugMenuText_Cute, - MatsudaDebugMenuText_Beauty, - MatsudaDebugMenuText_Smart, - MatsudaDebugMenuText_Tough, - MatsudaDebugMenuText_Sheen, -}; - -static const u8 MatsudaDebugMenuText_CoolContest[] = _("かっこよさコンテスト"); -static const u8 MatsudaDebugMenuText_BeautyContest[] = _("うつくしさコンテスト"); -static const u8 MatsudaDebugMenuText_CuteContest[] = _("かわいさコンテスト "); -static const u8 MatsudaDebugMenuText_SmartContest[] = _("かしこさコンテスト "); -static const u8 MatsudaDebugMenuText_ToughContest[] = _("たくましさコンテスト"); - -static const u8 *const gMatsudaDebugMenuTextList2[] = -{ - MatsudaDebugMenuText_CoolContest, - MatsudaDebugMenuText_BeautyContest, - MatsudaDebugMenuText_CuteContest, - MatsudaDebugMenuText_SmartContest, - MatsudaDebugMenuText_ToughContest, -}; - -static const u8 MatsudaDebugMenuText_Fallarbor[] = _("ハジツゲ/ノーマル"); // Fallarbor / Normal -static const u8 MatsudaDebugMenuText_Verdanturf[] = _("シダケ/スーパー "); // Verdanturf / Super -static const u8 MatsudaDebugMenuText_Slateport[] = _("カイナ/ハイパー "); // Slateport / Hyper -static const u8 MatsudaDebugMenuText_Lilycove[] = _("ミナモ/マスター "); // Lilycove / Master - -static const u8 *const gMatsudaDebugMenuTextList3[] = -{ - MatsudaDebugMenuText_Fallarbor, - MatsudaDebugMenuText_Verdanturf, - MatsudaDebugMenuText_Slateport, - MatsudaDebugMenuText_Lilycove, -}; - -static const struct OamData gUnknown_083C9400 = -{ - .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, - .shape = 1, - .x = 0, - .matrixNum = 0, - .size = 1, - .tileNum = 1023, - .priority = 0, - .paletteNum = 15, - .affineParam = 0, -}; - u8 unref_sub_80A9B28(void) { Menu_EraseScreen(); @@ -460,14 +300,172 @@ static void sub_80A9F50(void) static void sub_80A9FE4(void) { - u8 ptr[5]; - - memcpy(ptr, gMatsudaDebugMenu_UnknownByteArray, 5); + u8 ptr[] = _("{HIGHLIGHT WHITE2} "); DmaFill32Large(3, 0, (void *)VRAM, VRAM_SIZE, 0x1000); sub_80034D4((void *)VRAM, ptr); LoadFontDefaultPalette(&gWindowTemplate_81E6C3C); } +//const u8 gMatsudaDebugMenu_UnknownByteArray[] = {0xFC, 0x02, 0x0F, 0x00, 0xFF}; +const u8 Unknown_083C922D[] = INCBIN_U8("graphics/unknown/ball.4bpp"); +const u16 Unknown_083C924E[] = INCBIN_U16("graphics/unknown/ball.gbapal"); + +const u8 gUnknown_083C926E[][2] = + { + {2, 0}, + {17, 0}, + {2, 2}, + {17, 2}, + }; + +const u8 gMatsudaDebugMenuContestTopLeft[][2] = + { + {0, 6}, + {15, 6}, + {0, 8}, + {15, 8}, + {0, 10}, + {15, 10}, + }; + +const u8 gUnknown_083C9282[] = + { + // TODO: 2d array? + 7, 6, + 22, 6, + 7, 8, + 22, 8, + 7, 10, + 22, 10, + }; + +const u8 gUnknown_083C928E[][2] = + { + {2, 14}, + {17, 14}, + {2, 16}, + {17, 16}, + }; + +const u8 gUnknown_083C9296[] = {0x08, 0x80, 0x08, 0x80, 0x10, 0x10, 0x30, 0xA8, 0x30, 0xA8, 0x30, 0xA8, 0x08, 0x80, 0x08, 0x80, 0x10, 0x88}; +const u8 gUnknown_083C92A8[] = {0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x78, 0x88, 0x98}; + +const struct SpriteSheet gUnknown_083C92B4[] = {Unknown_083C922D, 32, 0x4B0}; +const struct SpritePalette gUnknown_083C92BC[] = {Unknown_083C924E, 0x4B0}; + +const struct OamData gOamData_83C92C4 = + { + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, + }; + +const struct SpriteTemplate gSpriteTemplate_83C92CC = + { + .tileTag = 1200, + .paletteTag = 1200, + .oam = &gOamData_83C92C4, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80AA754, + }; + +static void (* const gUnknown_083C92E4[][2])(struct Sprite *, s8) = + { + {sub_80AA8C8, sub_80AA8D8}, + {sub_80AA8E8, sub_80AA8F8}, + {sub_80AAC5C, sub_80AAC5C}, + {sub_80AA930, sub_80AA974}, + {sub_80AA9B8, sub_80AA9FC}, + {sub_80AAA40, sub_80AAA84}, + {sub_80AAAF0, sub_80AAB30}, + {sub_80AAB70, sub_80AABB0}, + {sub_80AABF0, sub_80AAD44}, + }; + +static const u8 gMatsudaDebugMenu_StartText[] = _("{COLOR CYAN}{HIGHLIGHT RED}"); +static const u8 gMatsudaDebugMenu_StartJapText[] = _("かいし"); // because StartText is only called by StringCopy, this part appears to be unused. +static const u8 gMatsudaDebugMenu_GoBackText[] = _("もどる"); + +#ifdef GERMAN +static const u8 gMatsudaDebugMenu_BattlePointsText[] = _("{COLOR MAGENTA}BP,"); +#else +static const u8 gMatsudaDebugMenu_BattlePointsText[] = _("{COLOR MAGENTA}BP."); +#endif + +static const u8 MatsudaDebugMenuText_Cool[] = _("かっこよさ"); // cool +static const u8 MatsudaDebugMenuText_Cute[] = _("かわいさ"); // cute +static const u8 MatsudaDebugMenuText_Beauty[] = _("うつくしさ"); // beauty +static const u8 MatsudaDebugMenuText_Smart[] = _("かしこさ"); // smart +static const u8 MatsudaDebugMenuText_Tough[] = _("たくましさ"); // tough +static const u8 MatsudaDebugMenuText_Sheen[] = _("けづや"); // sheen + +static const u8 *const gMatsudaDebugMenuTextList1[] = + { + MatsudaDebugMenuText_Cool, + MatsudaDebugMenuText_Cute, + MatsudaDebugMenuText_Beauty, + MatsudaDebugMenuText_Smart, + MatsudaDebugMenuText_Tough, + MatsudaDebugMenuText_Sheen, + }; + +static const u8 MatsudaDebugMenuText_CoolContest[] = _("かっこよさコンテスト"); +static const u8 MatsudaDebugMenuText_BeautyContest[] = _("うつくしさコンテスト"); +static const u8 MatsudaDebugMenuText_CuteContest[] = _("かわいさコンテスト "); +static const u8 MatsudaDebugMenuText_SmartContest[] = _("かしこさコンテスト "); +static const u8 MatsudaDebugMenuText_ToughContest[] = _("たくましさコンテスト"); + +static const u8 *const gMatsudaDebugMenuTextList2[] = + { + MatsudaDebugMenuText_CoolContest, + MatsudaDebugMenuText_BeautyContest, + MatsudaDebugMenuText_CuteContest, + MatsudaDebugMenuText_SmartContest, + MatsudaDebugMenuText_ToughContest, + }; + +static const u8 MatsudaDebugMenuText_Fallarbor[] = _("ハジツゲ/ノーマル"); // Fallarbor / Normal +static const u8 MatsudaDebugMenuText_Verdanturf[] = _("シダケ/スーパー "); // Verdanturf / Super +static const u8 MatsudaDebugMenuText_Slateport[] = _("カイナ/ハイパー "); // Slateport / Hyper +static const u8 MatsudaDebugMenuText_Lilycove[] = _("ミナモ/マスター "); // Lilycove / Master + +static const u8 *const gMatsudaDebugMenuTextList3[] = + { + MatsudaDebugMenuText_Fallarbor, + MatsudaDebugMenuText_Verdanturf, + MatsudaDebugMenuText_Slateport, + MatsudaDebugMenuText_Lilycove, + }; + +static const struct OamData gUnknown_083C9400 = + { + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 1, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 1023, + .priority = 0, + .paletteNum = 15, + .affineParam = 0, + }; + static void sub_80AA064(void) { AnimateSprites(); @@ -963,7 +961,7 @@ void sub_80AAF30(void) gUnknown_02038670[i] = 0; gUnknown_02038680[i] = 0; gUnknown_02038678[i] = 0; - memcpy(&gContestMons[i], &gContestMons[3], sizeof(struct ContestPokemon)); + gContestMons[i] = gContestMons[3]; } gUnknown_02038670[3] = 0x12C; |