From d29e95d43ed353f2513331ac71176004effd8109 Mon Sep 17 00:00:00 2001 From: fakuzatsu Date: Sat, 27 Sep 2025 15:25:26 +0100 Subject: [PATCH] put ditto's stats on the party screen --- graphics/party_menu/bg.bin | Bin 2048 -> 2048 bytes graphics/party_menu/bg.png | Bin 1541 -> 1422 bytes graphics/party_menu/bg_ditto.bin | Bin 0 -> 2048 bytes include/constants/party_menu.h | 3 +- include/graphics.h | 2 + src/data/party_menu.h | 47 +++++++++++++++------ src/graphics.c | 2 + src/party_menu.c | 68 +++++++++++++++++++++++-------- 8 files changed, 93 insertions(+), 29 deletions(-) create mode 100644 graphics/party_menu/bg_ditto.bin diff --git a/graphics/party_menu/bg.bin b/graphics/party_menu/bg.bin index d6ff1114d1161f5b54afcfeb1b35d483e3ee790f..4b7f4aa72c033ce3631ec1a16176afeb182192f6 100644 GIT binary patch literal 2048 zcmeH{y9$6X3`M2*t}PesP_RNl2mk*IZIyJk8N{JEYYqvQ5CMT24T~z22!0FAf_$E> zQT!+Wk{>UDaz9_+kAh1mL-`M{zlVXdgh_sfo<*FWSF3l4&F8tXd-v`n4u(HMCZ_xU T+j(}6XSwkqY-iC$1!^fEI!V?rdLlpvkCkTI?&($ TFK&kcdSXU_AD5P<|KGp?HnU1V diff --git a/graphics/party_menu/bg.png b/graphics/party_menu/bg.png index 15ff74304dd358f446b7edc92f8da14df52444b8..ec4d51d70932002d7ed242a0ec42eef0653f892e 100644 GIT binary patch delta 620 zcmV-y0+aoP42}zsBn<>-K}|sb0I`mI`%#mzdkzDC0y#-UK~z|U-IvRb!ypVrS#X7c z#!qa2Jf@2a0an&P)P(Du_e+-P*---%3D-vuF!Gm#>8~g>k;9z>zPe?mYa^I9hgAo} z!q5W-4C@X?)c{y1Vco&zK>}d-jRW*>%)zqh=DjhE12VJG!~u;1GV^Xgd=m;7(E%^6 zBo#1V`o>&;>Hb^LAOpq?kT(?odiNI{kjA8c&zzb3^$=jJ?+DvE-yZ@L1gVWT08Lt7 zprE$^tuOQdF9;k+eW3$LzxJB^+>A`w_Sl1~~P4K(Fm)T6s4+qSkI6j^O@|8~%iSQuLo0?zM zK|nx05X^x&z_nn22^0aZd=x03CjoHf^T1vJSpy0nYw!W^F$<3(70_1!tB1OoXa%Jo zy0Rh#mO4o5CrpNu-&oIpn$)sFA#@H?>f$Y30WA%nVCNoCXI#1hLO=pOOOgdZ&HvIB z5C9;$56~140`i4x@StkffE7>+z%1~liEFU1EU+}z%>4l4*!Rl|MoA<90000OV1ZP1_K>z@;j|==^1+g&> z1AhPkVoOIv|D^}=#Q*>TSxH1eRCt`-mP>BJFc5|vL%RT}k`-rFB+lT9wB2z3C8y{G zkYH0F^*i=FLSWfXK$405`;R@IAOxVT(7Gk)bc%N!>@Vu>q(J9L7gGY77U-(@gn;G* z<~m>mIz7{Y<^<+Cs0HGA2JTV z&14fkj2yt(4I^zU;!4XKSpz&=T~P01n~jul#oe^Cf58uS8DJz$bcw&=k8gEjd)ZI|B-Q~Lo-L4^z%Yu~!q5ZAx=>DD zV#91E$^mI-@)5uskP|W~(4;~j{D0vo2aEA)@sxvRtPAv#+;b2L!O#=D$NHLDgaR7&!T}4UH@H~mklPUF^Lo5=$bW-_aBzzF zp`>>pC9x;j-B@u8zqi{10{JCzs=}+)iRtk0Dtrf60h|ROAJS$jGsxXQX;mbcqW%v+ zexf3B(FiOe9biSQZHJOag(TnPz>r1FOI+;~%xF Wn<3?JVUYj;002ovPDHLkU;%=ub3cjz diff --git a/graphics/party_menu/bg_ditto.bin b/graphics/party_menu/bg_ditto.bin new file mode 100644 index 0000000000000000000000000000000000000000..7a1fce1faf03536d5c7d666d9ef5887618256440 GIT binary patch literal 2048 zcmeH{y9$6X3`Mo5h%YYMpxd`^Wo3kJdata[0]++; } break; @@ -985,18 +990,17 @@ static void FreePartyPointers(void) static void InitPartyMenuBoxes(u8 layout) { - u8 partySize = PlayerIsDitto() ? DITTO_PARTY : PARTY_SIZE; - - sPartyMenuBoxes = Alloc(sizeof(struct PartyMenuBox[partySize])); + sPartyMenuBoxes = Alloc(sizeof(struct PartyMenuBox[PARTY_SIZE])); LoadPartyMenuBoxes(layout); } static void LoadPartyMenuBoxes(u8 layout) { u32 i; - u8 partySize = PlayerIsDitto() ? DITTO_PARTY : PARTY_SIZE; + if (PlayerIsDitto()) + layout = PARTY_LAYOUT_DITTO; - for (i = 0; i < partySize; i++) + for (i = 0; i < PARTY_SIZE; i++) { sPartyMenuBoxes[i].infoRects = &sPartyBoxInfoRects[PARTY_BOX_RIGHT_COLUMN]; sPartyMenuBoxes[i].spriteCoords = sPartyMenuSpriteCoords[layout][i]; @@ -1009,7 +1013,9 @@ static void LoadPartyMenuBoxes(u8 layout) // The first party mon goes in the left column sPartyMenuBoxes[0].infoRects = &sPartyBoxInfoRects[PARTY_BOX_LEFT_COLUMN]; - if (layout == PARTY_LAYOUT_MULTI_SHOWCASE) + if (PlayerIsDitto()) + sPartyMenuBoxes[5].infoRects = &sPartyBoxInfoRects[PARTY_BOX_DITTO_STATS]; + else if (layout == PARTY_LAYOUT_MULTI_SHOWCASE) sPartyMenuBoxes[3].infoRects = &sPartyBoxInfoRects[PARTY_BOX_LEFT_COLUMN]; else if (layout != PARTY_LAYOUT_SINGLE) sPartyMenuBoxes[1].infoRects = &sPartyBoxInfoRects[PARTY_BOX_LEFT_COLUMN]; @@ -1036,6 +1042,10 @@ static void RenderPartyMenuBox(u8 slot) LoadDittoPalette(DITTO_PALSLOT, DITTO_PALETTE_NORMAL); CopyWindowToVram(sPartyMenuBoxes[0].windowId, COPYWIN_GFX); } + else if (PlayerIsDitto() && slot == 5) + { + DisplayDittoPokemonData(slot); + } else if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) == SPECIES_NONE) { DrawEmptySlot(sPartyMenuBoxes[slot].windowId); @@ -1088,6 +1098,16 @@ static void DisplayPartyPokemonData(u8 slot) } } +static void DisplayDittoPokemonData(u8 slot) +{ + DisplayPartyPokemonNickname(&gPlayerParty[0], &sPartyMenuBoxes[slot], 0); + DisplayPartyPokemonLevelCheck(&gPlayerParty[0], &sPartyMenuBoxes[slot], 0); + DisplayPartyPokemonGenderNidoranCheck(&gPlayerParty[0], &sPartyMenuBoxes[slot], 0); + DisplayPartyPokemonHPCheck(&gPlayerParty[0], &sPartyMenuBoxes[slot], 0); + DisplayPartyPokemonMaxHPCheck(&gPlayerParty[0], &sPartyMenuBoxes[slot], 0); + DisplayPartyPokemonHPBarCheck(&gPlayerParty[0], &sPartyMenuBoxes[slot]); +} + static void DisplayPartyPokemonDescriptionData(u8 slot, u8 stringID) { if (PlayerIsDitto() && slot == 0) @@ -1283,7 +1303,8 @@ static void CreatePartyMonSprites(u8 slot) } else if (PlayerIsDitto() && slot == 0) { - return; // Replace with any sprites we want to Animate onto Ditto + CreatePartyMonHeldItemSprite(&gPlayerParty[0], &sPartyMenuBoxes[5]); + CreatePartyMonStatusSprite(&gPlayerParty[0], &sPartyMenuBoxes[5]); } else if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) != SPECIES_NONE) { @@ -2130,16 +2151,21 @@ static void BufferBagFullCantTakeItemMessage(u16 itemUnused) #define tHPToAdd data[3] #define tPartyId data[4] #define tStartHP data[5] +#define tPartySlot data[6] static void Task_PartyMenuModifyHP(u8 taskId) { s16 *data = gTasks[taskId].data; + bool8 drawHpIcon = 1; + + if (PlayerIsDitto() && tPartyId == 0) + drawHpIcon = 3; tHP += tHPIncrement; tHPToAdd--; SetMonData(&gPlayerParty[tPartyId], MON_DATA_HP, &tHP); - DisplayPartyPokemonHPCheck(&gPlayerParty[tPartyId], &sPartyMenuBoxes[tPartyId], 1); - DisplayPartyPokemonHPBarCheck(&gPlayerParty[tPartyId], &sPartyMenuBoxes[tPartyId]); + DisplayPartyPokemonHPCheck(&gPlayerParty[tPartyId], &sPartyMenuBoxes[tPartySlot], drawHpIcon); + DisplayPartyPokemonHPBarCheck(&gPlayerParty[tPartyId], &sPartyMenuBoxes[tPartySlot]); if (tHPToAdd == 0 || tHP == 0 || tHP == tMaxHP) { // If HP was recovered, buffer the amount recovered @@ -2161,6 +2187,11 @@ void PartyMenuModifyHP(u8 taskId, u8 slot, s8 hpIncrement, s16 hpDifference, Tas tHPToAdd = hpDifference; tPartyId = slot; tStartHP = tHP; + tPartySlot = slot; + + if (PlayerIsDitto() && tPartyId == 0) + tPartySlot = 5; + SetTaskFuncWithFollowupFunc(taskId, Task_PartyMenuModifyHP, task); } @@ -2341,13 +2372,13 @@ u8 CanTeachMove(struct Pokemon *mon, u16 move) static void InitPartyMenuWindows(u8 layout) { + if (PlayerIsDitto()) + layout = PARTY_LAYOUT_DITTO; + switch (layout) { case PARTY_LAYOUT_SINGLE: - if (PlayerIsDitto()) - InitWindows(sDittoPartyMenuWindowTemplate); - else - InitWindows(sSinglePartyMenuWindowTemplate); + InitWindows(sSinglePartyMenuWindowTemplate); break; case PARTY_LAYOUT_DOUBLE: InitWindows(sDoublePartyMenuWindowTemplate); @@ -2355,6 +2386,9 @@ static void InitPartyMenuWindows(u8 layout) case PARTY_LAYOUT_MULTI: InitWindows(sMultiPartyMenuWindowTemplate); break; + case PARTY_LAYOUT_DITTO: + InitWindows(sDittoPartyMenuWindowTemplate); + break; default: // PARTY_LAYOUT_MULTI_SHOWCASE InitWindows(sShowcaseMultiPartyMenuWindowTemplate); break; @@ -2670,7 +2704,9 @@ static void DisplayPartyPokemonHPCheck(struct Pokemon *mon, struct PartyMenuBox { if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) { - if (c != 0) + if (c == 3) + FillWindowPixelRect(menuBox->windowId, PIXEL_FILL(0), 20, 25, 15, 8); + else if (c != 0) menuBox->infoRects->blitFunc(menuBox->windowId, menuBox->infoRects->dimensions[12] >> 3, (menuBox->infoRects->dimensions[13] >> 3) + 1, menuBox->infoRects->dimensions[14] >> 3, menuBox->infoRects->dimensions[15] >> 3, FALSE); if (c != 2) DisplayPartyPokemonHP(GetMonData(mon, MON_DATA_HP), GetMonData(mon, MON_DATA_MAX_HP), menuBox); @@ -4889,7 +4925,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task) PlaySE(SE_GLASS_FLUTE); } SetPartyMonAilmentGfx(mon, &sPartyMenuBoxes[gPartyMenu.slotId]); - if (gSprites[sPartyMenuBoxes[gPartyMenu.slotId].statusSpriteId].invisible) + if (gSprites[sPartyMenuBoxes[gPartyMenu.slotId].statusSpriteId].invisible && (!PlayerIsDitto() && gPartyMenu.slotId == 0)) DisplayPartyPokemonLevelCheck(mon, &sPartyMenuBoxes[gPartyMenu.slotId], 1); if (canHeal == TRUE) {