From abf5d238c2a5fe020123544a72fe432c27191153 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 31 Oct 2020 14:34:37 +0100 Subject: [PATCH 01/88] PokedexPlus with HGSS styled UI by TheXaman more ui, BROKEN atm type icons in info screen working topbar dpad for switching and white mon name initial working stats screen additional stats, proper move list array Working stats screen, all infos in, all icons in, buggy when switching Fixed sprite bug, proper sprite destruction, works with old compiler new navigation: info>area>stats power+accuracy text, change of positions layout for stats screen, other screen visually broken new stats layout properly working plus toggle infos show lvl of LevelUpMove and TM/HM of TMHM_Move 3 dashes for EggMoves and CORRECT icon for TM/HMs pog improved layout and contest move data! TutorMoves now available hold dpad to scroll, pure relieve search by move code working 6evs, 16 character move names, tripple digit moves, new eduardo layout working tileset, info screen no correct xy layout for elements yet new list menu start new layout working, only missing stats bars new list, new search fixed area screen change and fixed "new caught" bug (type icons) --- graphics/pokedex/bg_hoenn.pal | 30 +- graphics/pokedex/bg_national.pal | 30 +- graphics/pokedex/caught_screen.pal | 30 +- graphics/pokedex/cry_screen.bin | Bin 1280 -> 1280 bytes graphics/pokedex/hgss_pokedex_tileset.pal | 19 + graphics/pokedex/info_screen.bin | Bin 1280 -> 1280 bytes graphics/pokedex/interface.png | Bin 1044 -> 1126 bytes graphics/pokedex/list.bin | Bin 1280 -> 1280 bytes graphics/pokedex/list_underlay.bin | Bin 1280 -> 1280 bytes graphics/pokedex/menu.png | Bin 2045 -> 1542 bytes graphics/pokedex/menuOLD.png | Bin 0 -> 2045 bytes graphics/pokedex/menu_list.png | Bin 0 -> 1576 bytes graphics/pokedex/menu_rest.png | Bin 0 -> 1075 bytes graphics/pokedex/screen_select_bar_main.bin | Bin 192 -> 192 bytes .../pokedex/screen_select_bar_submenu.bin | Bin 192 -> 192 bytes .../screen_select_bar_submenu_clear.bin | Bin 0 -> 192 bytes graphics/pokedex/search_menu.png | Bin 1116 -> 1745 bytes graphics/pokedex/search_menu_hoenn.bin | Bin 1280 -> 1280 bytes graphics/pokedex/search_menu_national.bin | Bin 1280 -> 1280 bytes graphics/pokedex/search_results_bg.pal | 30 +- graphics/pokedex/size_screen.bin | Bin 1280 -> 1280 bytes graphics/pokedex/start_menu_main.bin | Bin 768 -> 768 bytes .../pokedex/start_menu_search_results.bin | Bin 768 -> 768 bytes graphics/pokedex/stats_screen.bin | Bin 0 -> 1280 bytes include/daycare.h | 3 + include/graphics.h | 4 + include/party_menu.h | 2 + include/pokemon_summary_screen.h | 2 + include/strings.h | 63 + src/daycare.c | 55 + src/graphics.c | 7 + src/party_menu.c | 4 +- src/pokedex.c | 1632 ++++++++++++++--- src/pokedex_area_screen.c | 13 +- src/pokemon_summary_screen.c | 6 +- src/strings.c | 63 + 36 files changed, 1721 insertions(+), 272 deletions(-) create mode 100644 graphics/pokedex/hgss_pokedex_tileset.pal create mode 100644 graphics/pokedex/menuOLD.png create mode 100644 graphics/pokedex/menu_list.png create mode 100644 graphics/pokedex/menu_rest.png create mode 100644 graphics/pokedex/screen_select_bar_submenu_clear.bin create mode 100644 graphics/pokedex/stats_screen.bin diff --git a/graphics/pokedex/bg_hoenn.pal b/graphics/pokedex/bg_hoenn.pal index 569c7821a9db..5889ede7ac0f 100644 --- a/graphics/pokedex/bg_hoenn.pal +++ b/graphics/pokedex/bg_hoenn.pal @@ -1,21 +1,21 @@ JASC-PAL 0100 48 -123 131 0 -255 255 255 -222 222 222 -189 189 189 -164 164 164 -98 98 115 -41 57 65 -41 57 106 -0 0 41 -255 255 255 -238 246 57 -255 0 189 -49 213 74 -24 131 32 -189 156 90 +193 33 177 +249 249 249 +225 225 225 +201 201 201 +169 169 169 +129 129 129 +249 153 161 +233 49 49 +193 33 41 +145 17 33 +249 153 161 +193 33 41 +141 251 184 +52 66 162 +194 181 66 0 0 0 123 131 0 255 255 255 diff --git a/graphics/pokedex/bg_national.pal b/graphics/pokedex/bg_national.pal index ea8f2bc64cfd..10dc02e885c8 100644 --- a/graphics/pokedex/bg_national.pal +++ b/graphics/pokedex/bg_national.pal @@ -1,21 +1,21 @@ JASC-PAL 0100 96 -123 131 0 -255 255 255 -222 222 222 -189 189 189 -164 164 164 -98 98 115 -41 57 65 -164 164 164 -41 57 65 -255 255 255 -238 246 57 -255 0 189 -123 164 115 -74 115 65 -189 156 90 +193 33 177 +249 249 249 +225 225 225 +201 201 201 +169 169 169 +129 129 129 +249 153 161 +233 49 49 +193 33 41 +145 17 33 +249 153 161 +193 33 41 +141 251 184 +52 66 162 +194 181 66 0 0 0 123 131 0 255 255 255 diff --git a/graphics/pokedex/caught_screen.pal b/graphics/pokedex/caught_screen.pal index 26da98a84c9d..7b855bfc66ab 100644 --- a/graphics/pokedex/caught_screen.pal +++ b/graphics/pokedex/caught_screen.pal @@ -1,21 +1,21 @@ JASC-PAL 0100 48 -123 131 0 -255 255 255 -255 238 0 -255 189 0 -255 115 0 -98 98 115 -41 57 65 -41 57 106 -0 0 41 -255 255 255 -238 246 57 -255 0 189 -49 213 74 -24 131 32 -189 156 90 +193 33 177 +249 249 249 +225 225 225 +201 201 201 +169 169 169 +129 129 129 +249 153 161 +233 49 49 +193 33 41 +145 17 33 +249 153 161 +193 33 41 +141 251 184 +52 66 162 +194 181 66 0 0 0 123 131 0 255 255 255 diff --git a/graphics/pokedex/cry_screen.bin b/graphics/pokedex/cry_screen.bin index 6a72a88bc4bf21b1913ec74f3b1c54f16fc476de..411311b5313139a87af1c53a3a1e5a6bb8660dc6 100644 GIT binary patch literal 1280 zcmeH@S5v}J6ofzVDzSpSU;*sC#TL{cK@r6g3;zFq;<+~u2_(KSyg1|CnVp^4vvc;` z9#Zt8=%b%B76S}2Br44?BaD(ED|(D^CYTg8#WXX_l2UW%H&2cQ7FlAMJOzrZuqrCg z8tZJZ$(HDCcGzW4)IJ9sazsuYoBRnjr-HKx+nftRZgqo6n+ub_#G%v%M_myj?(2C+ zU7P$3ZdVefv$j+0jmPY3BO8#DuI~-vjTPo>;mgY ejXe+#5r6V591NsGd8qqAXZljjKqE~w(?Tn$)kcVR!gSC{gf6=2p;uglKKdD8 zkRkEIj4;ZWxN#w@MT7I6fVE)jPjq4^}sBn6YMu*pzM7Eo*+89d_Bv^E$`ce_tnakmq&jym@lzi5_bHh+|F+oLc*zan1#oTybsS z#@avgFSptw)hU}h&ENCDqu{1bJo6&t>Z|78a?Z>?-{#*v=07~syfW-H=D```Is`Aj23qMs9AvtnSaWsh`1UL(;ZN`9aIKUZs6#a93T diff --git a/graphics/pokedex/interface.png b/graphics/pokedex/interface.png index 529914813499a91842f1832feda77864a89c0f4a..8b4e944417a75af8c2212ae3953af20e4cd3b25d 100644 GIT binary patch delta 1105 zcmV-X1g`s(2<8ZoB!35VNliruH4I}Ui%tMC8-02g#cSaefwW^{L9a%BKVOhiyl zM<8}(av(DOV1ZP1_K>z@;j|==^1poj5 zFi=cXMZqDl`T65>LGCKlK_UNIGQfNjDLW^>H9n%Gavv2Ol0F=gW1cJ zjiQ$+8(oe$_p!%Dfdb-S$DiBZRwrNDALUQ?2WEBS1k3&qK=%iYZS8irYHSx9v@lnLu`K{G z_4R|-r$Y6^yjVWo0gU1?a(KIFxQ;FXUpZmqf(i%u<*?aaf5!o%q$rA#9)6~H*)WhA?1 zAmunXbj>_65b|u|;X>+`r5+qK@o?h*A!-tr3V5S=VRFo?#DUkrfVU+t_-1|Mzb;Jt zw}0^{Jglr*-PQn!CCLi`ZC;2+mlxupd6D^QCx@*yJmkNXco8&ZFRG2DGj)8dtWx>h^3cLqcqkuREZYEeAyU+= zXo*{05LWC^24tF*DR(?f_TPM#@}769UJgOkXj#_JiRr&f8V9YyV$j~xxbP7F^-4=x zGk3#7`II;)AK}sF#dmyed3=$VYOrpQx-Fjpb)Skn$;X9<8VunN9)=7VGGxe*A#a!8 X8nu#o8tc|X00000NkvXXu0mjf=c@XX delta 1022 zcmV7ib_A^C3QPdiON-SKyzrVNlfXL-<{C{H#=TRmAZ#Nu)c;0TT z;s7a#iUF)3Dh{AXakr~f052^bWZ;yEht3*tTXI|f&kEf@0R?d{hFHgFGkC~chE zXm2xv3G&Q<$9W!9;thEa$J=?xj|#-w1dxrB0j)9s$EtBGHrNaQ2of(Jczk5~5`hdU zb5W=$IfPs*B7YZ|3ISp*Ap<@069Kh=0YR!nu5LggAW-#^QcXwzG5~C&ib3@PYLvWy z8qGE7Gd+n>S?wEq&4+LzCjlL30T;S-wMpcE`hoN(+m<* zuJbsg4SxaKfOY7`dFVo2qCy*uY4V~CN|`m%+PJy`G<(Il%AP;Ad|JTMEI$RLtN>&M zXa*=WP-qKj0DqPIV*sD=Fug<@7+^W<+GPNk2R1$oFb^7+#rd!o8kfcS#O5~kfz>QR z?gIvv?_dw&;aDqK=;CD zdVf9*l(wXQ8{u0JV4_g;LL^nb456ZCJ=rF?$AAt{T#^Dcrv_95RKu%a13&=eyABFk z=3^{hb;$3ZZXfurrnT%2Kr;(YK=Av8OBz1?nn7$6YFa(uxW0gSF|-{YT^rhI(fLG+ z!}WcK@$iYU@o+w|S&o=`Lu^uurUm_w>US#-whvYN$yiFrw-#c&Cb4=$>y2eY}TRy zOPH57(nK>Yw9-a99mXBR>ZFTqVW#%bOCS9V;KR=#Lku&*C}YB<1|&|9akZN=L5NAF zm?q2&5u(fzQ?<%^E#?#wByOVWB*DBZvY_#cD!TL~zs!n@U)A_E75y&%x{FV0yp#X8 z{C}!H#Rh3Mg-hM4yZ_r-|99%#1CKoM%nPr)@h)8IhkD&7%VjJ4 literal 1280 zcmbW0iERQg5JjJ*#rg@Xl>1I9qyw%3xEkQ70O$ZZpcE<~C~MA{%?GbIlv-%4Q09WdmHp^$l$Yo^v{`6c3S=w8?lR-YJO`w Tq8BsO{Mt5zOZ0R9|2OpyGW|KH literal 1280 zcmdUvK?=Yi3YNmYH6a=hhzusd27R#|COco)Y3Psp z1&n?Bb$$io^&1$kAHn?J*QuhjKHb*+=jvmhAC>uR>~+8E+Z|lZ-<)OJ@8maOy!lla QuU~}m`uux*|Ng!C2cR)2X#fBK diff --git a/graphics/pokedex/menu.png b/graphics/pokedex/menu.png index fea195312c06171e1717ec26aca2933805ea317f..7896d7f09efe5c280b2dbbba29c093bd714f6b09 100644 GIT binary patch delta 1537 zcmV+c2LAc|4~7ho7k_930{{R3%LnBb00007bV*G`2jmL|7YP{1eG3x+000+sMObuG zZ)S9NVRB^vM@&RePDdbiWpW@hE;Mn4q~QPn00?w&PDe*fL^A*Y002sWDIWj;00d`2 zO+f$vv5yP8<;5Xbon zMB?HqK7*i5eOSO-9|EsyV;cglQr!uzTwdBV_VF==K&MhSAEY=#(TwY}?|wRVDk)cD@yN3{TeDUkq_v7B%wH4tJmfV&C+xG)1mDzltt zB{l;{u@I1mL%^(Lz_TFBNgNS&hTjQ2*moUeB><+v5RhVk01inPV}S1MLjp`y zK#{UBVSg9}Lim(0C%#KVg+|Z{W8m!AiAj@E)~B35>mt2{o}LpRPumjU6(Fj0N;850 zxMm#F!l9BU(7ZoGfteKVM8X{?^w(24s3k7c7CiI(Ni(G^@3qeZx|DvXYsfjjX8X3z zM%R|@9)1*f)3I!eS@#Y=G3(;I7oEOkhrd?rI3m$y?@&B)|kw-`I8&w%%<6yV1j0jsRZhJbTE-UzTUnI7=UW03^Ew(AcOuiQEW4x&RO5 z2!B_~dDs1s!0X@e+HKQIGhj8wMg#Hh=C^AAU(c!tfNYfge<0^S1jupuj{q@BHv{g! z-hWkq-Dd&QNRlF8H+*CWQ|Gb9=mxP7JoMev!f%@zqT&5wZ=@%44xkMZ&=!EU4w$nr z=H69+K0rpm-8^Z)etiSr(;)=6l**#|Xn!?e^s^lkz@O5$Lj^Esz)n3w0B*(ew}bJe z9VZP~Nx%k!c-r$$N+%^_3rpjk0XjZQKq(8mxcA9LT7G)`0E6>nIu1%1D*%i#0M4}Y z17J#Dar1#x15^aZEYq2G{so{2xq&Yi>&V6Qop_kf3bgYdb%)s8rNX2!s_(=rR(~|N zCcDUo?zhf`*c=*8sSp7E%v&Z_F$8$g*gNb+g~>AUpxy-FIS_kV0`w#!#L0?EyzA70 zlFLOM1Cl?v=yVE`JyrpDtV^%9*^y4}%@lK3X{rD`+0wXRc$i3Wl$|^sM1X6m0Niw^ zX%bS?T@BFcVSVQz0HCIK6|hq|^?!Se!C0m@SrsrANx8y}#eD*><9&gH(k~hw8;102 zD7T~NXzgpu&t9(rQX_oU{(QiELh?^P36NEB3c#Wb9|y#`$9Ds0vbl|^CQKhomHR`x z9=jh<{ROiB2VYxfYSWhKcu=@Y8xkLP8NlTXSS}o!_~vappLXMMw+i4!4}bDaZK}(@ zu~HWRcO{^Sb`4+0j~lumVjfU0F*03323eXS_N3K>}SJC;)SP6US?-fR&E40HEas_aZ<=d-woA1?zYnP?@DApt%ZI&HuY|5zxl< nVWD;Tu{l00000NkvXXu0mjfO2VKgCM<}S^xk5SrGW^000MwNkll*O6vwr+ zb7|O~Y6Q^gAwc^Hf-2dHqQfcBz#)UV*hZ&B$do0627Bbdv43mF3|=&ND>Be9JP3#Y z9rO(fLw+yYRy00;o~{%}SF?oW%+`oB+zaj@v!2$3^H~P9ey*|>7Ew zO9=pLz2>6nSl_LeODaBKjT>nCaBB!C*IZDk0gD^z9Rf;?8*c5-{2PD@-MjVy{JmYo z0c3_vz<*+0x0FjV5q<_13jl1E#ab_naU6h7m%0YrX#B!0>7hdaEXY3|7?A)=jH2{} z0gE!G!g8@;gWIKE2Y|JF;(!}Wt`E4W2pUWR*+9qrK$jXt<5=IW_00kw-v$e9#Q+}d z%8w4F?lK_3Gw8wjKmflxz`N?})_bGF7C>SF?|<&6*V_nhrZH&%?y2c|Jbqieq>_(w zIu=EqGvJgiRmW6T(-j@7YPH$`ykqFsajtSIgy4#DfK`7*g%Din#{kue0b}aK093{` zU`m}BfXZ|ea6er=JtiHvQw|xALjaW(#MC2z>n5OpF(QBp#+Xj~Bv^b{090TAY&YT& zsDA(e+dbtG^rL`U1v1~;m=pIY~K(~~0SZULLX$yl0KeGm(*QtP0sf}Wr+?F{4FHdzDAGBXT<3aDXGN~5rfC|fvA`Js zG#%5cC_thZWv=vWr0A0ZpmOsO09)S&pfgrlJ^EoTL`b!sr}zM%F(Sn^23)UdfYo0{ zU;w(nZ#4kg0!}$#nkw)J3f3NgvfvX111zT|^BCxH#XT{1BSFlKOoI`kzU za7u^(2Iz3XJud=)7y9hVBRXsaVEA-&I`qQOj{~lJz{J_Y2iVYW1K_b=Sa0?3T*+;@&0Uoc>W-O4d;E8mChHss9^d( zQ`uRGcSjR1F|-087YtrxU$S$u!_dV7ODh1&F#8RE_B{apH1k2OaZ-#VF{Ja<2Vlti znTv&TGat-38PG>bV#o^yB!3>@;A|66=K~Xp^tFMk4`$ zKmbJJa|5^x0VW^JMej|(;K%}AhzcgPHS+;%-~*Hcqy{j+Ye`Z%s$q7XH330BAR8#kXAI!PAOK~iF(V&1vwtcWZw~XpjFK4@ zN(d$~c&Wkofe*m9lPlZ#m*pO&@v>bk@F0iT7xxa)0lGcjpSjnd3^0DsS_SjVWqFd6 z=K07g)vf@oPku!m`ackmsQ?h&FBGl?c_QVtaBfxjGYeFR?-y*#+|(shke&VK;;#Jy zH}W%9*79@0>c&EwRDampx?eyewao2ifB_KuPM86EvS*6z7Z@Ppr%GWq4k4i2+qz$n z6?nm`Zr%^bBfHl-WAC$&J-g-E+%G5|R&Fas1pvG^+k3&DskvW}7H1(djS)a}zd$u< z;a35w_JaT*d#3n)0ja^ZqbR-_1$1*|AF%g-1lYy4pIEv9et-IbQ<|UJIsx7r0MCjA zaJXnm3EmPRr4Kd^SSwJy24LtmtQlbZ*klE}L?9m|F4xs2z^#vZ-)22z0u%JgM8gQr zWo7FoN-V%716Cp9hpPo>4}kq|9tF_X81as#^`-`lIQ=<*dDM?!med2hHvr5g{GtZT zV1pD!GypaqmUaHY2#orN^n8&2hB|=F2uktVBsG<$3Z{CfwFBhV1}3Gj7AiNo$Wmbk zKwkdQQ7QoN%3!3>N+se4feIY)hKgCM<}S^xk5SrGW^000Mw zNkll*O6vwr+b7|O~Y6Q^gAwc^Hf-2dHqQfcBz#)UV*hZ&B$do0627Bbd zv1`W+UNm?sGSDzQ2#5e3^bHC`2%5nV*!O?$?s!L?RMPI!rxSfV@_xGa?!Cu5y4NEq zNfMGjNM4mE)G{n5B)Eol`tujssFZSD+7mkG6HQ_PiKZLA8R`f?Q?q`heSp?cfKr(Q zC=v^xW(J@w0Qf2--=Fld?98chrph5shPWapcP`3aG0QUa44Uz*sw*b_w z3J|DZ?~mJnY}OeNs*rrwMui_qScSV}hg6?;T|Huey%q9V{?IXbg1+3pd4<0s2T;KQ z@I^QJx;wo-(v2=YsfPu>*aE1eVrX?6L!A!ri%}K+q#MGTT2N5YrW>8=~&;bmrE)>V2vAS`fzIqDA!z2sR4@{>Ky_~jT>(5 z&-@#J3f;T*0sOsP!~tZ6O~7JZx0FjV5q<_13jl1E#ab_naU6h7m%0YrX#B!0>7hda zEXY3|7?A)=jH2{}0gE!G!g8@;gWIKE2Y|JF;(!}Wt`E4W2pUWR*+9qrK$jXt<5=IW z_00kw-v$e9#Q+}d%8w4F?lK_3Gw8wjKmflxz`N?})_bGF7C>SF@9wA9+X!!_F=+tq zsp)z=ep|exl8ZB7h3Um`?j7 zSbSIjRA2yXH{ubf007%PXY^3Ou0-$p95dd4?2cR=nT0Qz2kbShXIAc|vvnaV?e zeHu+XVHFer_=W(h1_LOUOx?VGY5=5+HjS9qM#Knogg`dHKoQHc9DrFtvmxP3jUm8$ zrgGo|=%sCm*M@eGH3kD<};NWZ%Q0D^^iuAkU(*`g|1b_|)=aLOYg=Riz z0!AYNfIt95<8uSJ3;`w|%th}_z~IONUWf`NwKekrY~TZw1EdBpz-vifsaQV<@bk@F0iT7xxa)0lGcjpSjnd3^0DsS_SjV zWqFd6=K07g)vf@oPku!m`ackmsQ?h&FBGl?c_QVtaBfxjGYeFR?-y*#+|(shke&VK z;;#JyH}W%9*79@0>c&EwRM^|PUqBXZYxFw0K7Nbd%>QmxnGbLXCX6<5kPdm zKs9OMR{^T_g8(3VrucpVslm3RD83p6baQ1Nu=jri*u}P=Sh@jz`hioLpV~SB-WveV ziUn}EXh{j)5+S7zHV#-TP`w6V=r*hwVEou*1-nEbA0#f<)h58Lk9yx`J!AqC^vXoT z2+w6@>n2Jpz$F7#A>)Uu1!xa|{cj!x(AOC8j;8gd28=lUIe>Z8k6@P61H3l?%qIMz z2FzfC6h<@vHXoM$!3d1{hxB}q|Asn%%?L{I+9WlVrV6HdsI>#+)&?e}uofyey2w&t z2S8r_(NQV@@XBDM&`KrZ2Z0J4@rZk=AS0NS0a{U%TO~vRx`RYj=n61CaCr1kfQf^{ b#HjEOB!6_L#;B%&00000NkvXXu0mjfTJeaY literal 0 HcmV?d00001 diff --git a/graphics/pokedex/menu_list.png b/graphics/pokedex/menu_list.png new file mode 100644 index 0000000000000000000000000000000000000000..12faa82764f50319d5961c00d6eeeeb50d579b80 GIT binary patch literal 1576 zcmV+@2G{wCP)d88qBY5TIJHlLbo^X`j@#+UK#y@RO zk2F(p98BPI{ZXJ43W!`_lGS#*kZw?C0L3%@>VF^b@SE~H0(gH7oATp!0H8M}_kg#b zhX6e{<)`kU9`Hft6X1~>v<0Z?OVa>)VF+z-@cy@o@^%Y=Vgg8mzwWnX;9Jmv@G}8; zQhFn>*4*dJS~wAKp95;LFH>1)D5n6q)9U_=2HSD}0^lTX6sr%(^60<=0K=K9lKo*? zh+G7`&(ryq0W1R}fc;N;3=+u*cnp7LI>2)dz`U9Pf(DRj@DhNAIEiuzljwzgw(YR5 zG(pmM8=xfu4B(_HoY;#MbqO$gfW0tAfSm!{A;6E1ZGf2oI~B+t0$7pX?IfuU-_wAL z#@7J#ymL6!^AGC0#{u|UCea=HACydKJS9>|O#o+#H2$z*3{2xIy9c;{oy!vN*wx^I zFUZA&F=iV7IqU<9rCg3dK>z;+EQ(1S!%O-j0Cp3};-FYSqHrbp9O{0kQF>)}MF46K zkiCxOkt<+v*=E}r$=e45`UFU;_b>6*=P>Jel}84oUh+|@hVY4izJ`8)KJ*}f(5h83O~CZV5hdJ5?(44ldO-lbAG2hpI$di3Ps%0$ zPWJ5*u!w&GkgC_QO91H51n)bfARwL}^9(Eiz$WMkfG@v{U56?lpj@&+mViqFj0|8W z>Q04DjdqQ6yW$PWbAZGgbruV-HL?$|6#*mJMYnNe)iOXU$9!ln?N$1))zTAwFAAgj zn%94QhkFou%-iX(2oNi_!nc(hh&==dP36b(9Q1Jv5H-M9<{JnvnzJV48wdf+CLr6k zqX?kPg)i)0YOn{`f+Y>w6M)==sDaocPB6tFu6aqGuqH~>S&|O}?4*FG@NGaQCBS>5 z`EuYu+SMc?cj^V+w#<2avYj zVQ}%zc9WtF-YZ9d%A?2eFTAi*JP?Ot9%u$w7e4GmW5HH@NADUScZyrF6NhHQF%KG* z)U!+V)+8T}=4Ajl2Y>?5cyk6I!v&B!CCt=Gep?ldMoU~cJiHbrfT+g(c6~nonFC@b z=3(akE&bO3UIH7#3>bF-X#9r)?i*hCGR-@S_A!75>YG9{@-S1(D--RdNL#)&jYGfT zqNBXP0h}O}sf;4rA$6T!9e5njth;6hAa;KVSf9NV7cN&(Rb+oQWY~E?tQ6L=UMB#~ zP1S;2Bsr(J%7c`9st6(cWVX|i2ka)y63G>55P&m5h58jLz764Tj6*KBtpKP(aIQ#$ z5`i;8Ij#|*+(V2WPK@nf^OmUO9BD)V)iHMt(2x&I0)(a8h`Boe5I4~h<~QZFpVs^4 zOsT#eGf@JXRLudKX-eZPZ&S(zoh4(>0K{{uu@qgrLcFOc-27A1p`UwvIuWpwc;5>p zjCK!I8Hz4l7-9s_DY4;Pphb^8=|rGIJ9x=TZmgzqSjkaU&R%C?8)h}{C;%C#Rj5y=j1(ouN-d+W?~3vq1s_UW6~O5+5HayD#r`lrud!($XS5bIG+g41HLK$ aJ>VBICcI~CkFaO}0000k?HF)wyKvPFTlg4Jv5V<$y88tW>)%)L( z6v@c(M>_SAf+9oybYD7NtBQr_&u@39R1099KL+T>+PRJrIqDY5*C>|-FdG1@9onI_ z))N29`EIc7Aahys(>4qd(2oIN1%SUQz)$>8Ol<_rMgaVN0EnQ72asx|Ynbu_g&_h) z0l1-6eESxlYdoc+a%3npSOti(WYuW+Ku%f#4AoV!dW65DpG2Qv(oKLQQVcjcXvFHv zmO0Ag-ljtUXs-BBb4svf6-z0;ENQ_a4eLmxpWQS#Z3_)1O~vYVA2J^o?!2D0D!=N)TuWDwqF3q>VZFKl4LSI7erR7 zVI~ofiq``2>0bcy&aqDon63fDMo}-Q8Eu620{C4hSuw0`zDGc=OHtC;*{R zRDj%X>}_r)ya|SD#% zqG-E6$(u0~~TdyIy>AK};6~CKPiUHMkw%tjqxj tlY8a=0H{ar2OJhJ-v?+u3{bfj@E0!&)PBSf7)1a8002ovPDHLkV1hme)g=G` literal 0 HcmV?d00001 diff --git a/graphics/pokedex/screen_select_bar_main.bin b/graphics/pokedex/screen_select_bar_main.bin index 154ed7196270686efe1e9b4e047c9fa21f5fb832..16bff536188aa2efc40405909c383d0c8252fcd2 100644 GIT binary patch literal 192 zcmbu$hYi9|6hqN76*ZxgKm$n3|beWLjET+t?BS`=N diff --git a/graphics/pokedex/screen_select_bar_submenu_clear.bin b/graphics/pokedex/screen_select_bar_submenu_clear.bin new file mode 100644 index 0000000000000000000000000000000000000000..85cab7327e8ec5105ae2586975042df8f9948b50 GIT binary patch literal 192 LcmZQz7}@{;0KfnN literal 0 HcmV?d00001 diff --git a/graphics/pokedex/search_menu.png b/graphics/pokedex/search_menu.png index 755c2d35d1ec9c59b153a6c10f587692a5e36556..9410eef337cbb2aa52ced0e5413c6ae54f4e955e 100644 GIT binary patch delta 1683 zcmV;E25kA<2+<9Y7i4$@0{{R3$kFGF00007bV*G`2jmL}76mV53+zGw000+sMObuG zZ)S9NVRB^vM@&RePDdbiWpW@hE;Mn4q~QPn00?w&PDe*fL^A*Y002sWDIWj;00d`2 zO+f$vv5yPc@D`q>ch+qZpy+DOP*T5?M5UAXF}5=!%b!V# zWF$oh5NTxrkwm&@yuO+*f7#Q^lfH`g0KVP_c&Z9|1&C0`R@996r5y8#Q!*1Ij1!3$F43pViN&cl2oi z;G+P*6CZ=q_ax7l$Kd8ePzy(?063TrmKNGHRPq4q;GcQWR_Hbluo@i78c0b^aJoh& z7;YIrop_K=gMZ*e<65r*1$;;>fMlPQd)qKd0njax=+1Yx9Wf3b|A}w>2RH6*lNzuj zf}QVdbAWbfFLIN3w6?Q^7IVlI8V$hogRAT30CH_xWe#Nk7qzbTP;lK003L=;y0?lo z09njo)xB(&)gB9cwgB6&_5D0RSpZm(0>Fv@Sam<;`+pH1*h3M3Y!RRoc)|g$Xnp91 zl_~*H6I6RKCMe=Wr>r$WdJR^oBp!AYuK4;Dm4H#$oD=-xEA#<9W6JV$`- z>JxwUsSAM*xR5vinC7NO!g-vA7_eMe0DKEI0s#X6K#if7QxV{E9{|@D9H4COYk-vF zgn&5#gxa;MCr06^JbI*$xsq$c!?3A&avjZq^3jF9Z-hMF*% zQ3wF22c{y8v&?;fi9XE4g!w#~w1<1ngntRY;~lID0q`r1k9SAn?p)ZPjXUcB%6r~O z#RE9o?(qQ+_`&qnZTTqhfTGKXA#L*jF3;I|kj)PsI}PCSoUaGz{GdB&0GH={JxJ#V zPv5Kwd7kI>fSVsY`9CbRbsd}Yd2I-D1qv8SInUPyGglyh??Wl)+1g;|3Iu>w@qanb z*9J3JAbBtp>cHDkDg3S#j58a6f5;1;&ghtO-j#&_&hBGP(!Ksuo1k+(erDoI6+FPK z9R;29v2&wmyO(x+t+}jl7LNB__0HDcnS0MKeXGo;bT1EP39ElL35+{ccN28{>w!z3MmbT~si;Mjiv d5XS=r{01G$TpO1|UFrY;002ovPDHLkV1jTN{>A_R delta 1050 zcmV+#1m*kD4crKj7YaZG0{{R3AoyZTk$XOW1LsLZK~z|Ut(L!T+b|Hu{Z2y1Gz%9( zW0Af=grYz@HZLF)($Yx-xf>nmRg<`960!vFrYv1DBwq3W?svz3k|G;w(laH?|Qu;n4;W|rzKUwxMN%(g_aexg2ozDVh5+a}< z*-5~CcE*k`=SD9m!cA}`dvRYlXP0y@-#;JWBh66)&_TE1h@PW++-(@VOkvR~od6u& zg{P%HhGxqEa)|d_vI_2t03X5ebOc#{HkJ@#ok(!p(}3|L9Q zsO8>SpvN`QqSFDKAI{#70mI%H(dM~z&CAPHG6nqffVH_l4}d}l0BkEt8RLq82e?h2Y6Jj6m9kV4Cn047#N4M%-=^HR*!5;q zBZ{KbQZ|jGlhzYJw~LA2#@xro2QDQJ07}b}2z8?>Ig+sTweeN?rh(-}WJAiw=iRH_Z$)pp&O8`LVGzT>#AYK4}gbaY1qW6Hx%bEbB z98Dr5XpTYa0H{a;fI?C_HwzM)v4nC#0@o5LT^KV!gJiE|1l05xUWEieJ#ZDN(c<+S zP@-3QBth58r9H-i1Vz7TgsMUUJWlt=F9Iy>x~0DVk_*GbG#j58u-e{L56J!kb3A{r UuyFM600000NkvWtM6N<$g4*cl2LJ#7 diff --git a/graphics/pokedex/search_menu_hoenn.bin b/graphics/pokedex/search_menu_hoenn.bin index 838007715d86a7e7121c6e2c95346143d38d5351..ec2f179065001de656642d1759be6af8ffa6896a 100644 GIT binary patch literal 1280 zcmc(dIZMP)6op@gFh&?A=O0YvzHkZ!5k%Z~V=1DAiu*F6h$4!ALJ&a&TTukH5tl+m z8~p>pVqhQ^`Xjv2!c3S+AdTA!@fEMqw68GnTxgc`a zb6nsOSGdLvj&O_91r!b8f%wi5jQ3(;9cYNRzU--rkp74wpyy7jYH?WB9kgmF&e>FAD5t4}00i466+&OMZZZ9O5uX9R2fL;3Ai}?C2lm7{@um zNzI?lmuF$?e}$`D<2p;4Ka(%d!q$HcbF5_@>ovc=2b;f*?d)JDyEMPP2b+Hvd)UVT z4pAk{B=7$gceuv`9v$;$r+%C4*I%0J)2xag;@+wp*2SPva Pi#gq$KaRYba4B-mfB&$e&PBQl=t>i97~~2`S`V z)UEqF?8CshC+F-s6MOZozQJCtz4rHwVhrP$z$B(HfI$pl7$d50MH|}DflkDQ7lb+s zSivHeu!?2OVhwYc$GYl!uz_CmVN;_oWD$#5!cxXq{Rg(_NXhTq0^R)k@rWlp;{_oR z60fS^AVTo`6SknB_i+|P|mJtpB VD{4mV{L)Am5e0v?Z@3}9^-#-YwmkXHQdnfb`qW9iAzmCl&vv3$`R=l%$o2#Q&&Tx(k zT;dAXIK&Z-ae~vZpTH!hFpU{xL@q>FZ+OQCKJkTbJmLw@c)@GfuVVw7*uu6UU&U(H zu$Fa9vp0r%=CWrZz35;kyV%VhrkEdtGUWT%&jAi{$kIQ{InHx|i!i$|L+N3BrNcy_doK=R|yMz R*K?!!rE*l#0>_oV`5(znjZOdn diff --git a/graphics/pokedex/search_results_bg.pal b/graphics/pokedex/search_results_bg.pal index 41196a26984a..a5df732edf77 100644 --- a/graphics/pokedex/search_results_bg.pal +++ b/graphics/pokedex/search_results_bg.pal @@ -1,21 +1,21 @@ JASC-PAL 0100 96 -123 131 0 -255 255 255 -222 222 222 -189 189 189 -164 164 164 -98 98 115 -41 57 65 -98 98 115 -49 49 65 -255 255 255 -238 246 57 -255 0 189 -123 148 32 -41 82 0 -189 156 90 +193 33 177 +249 249 249 +225 225 225 +201 201 201 +169 169 169 +129 129 129 +249 153 161 +233 49 49 +193 33 41 +145 17 33 +249 153 161 +193 33 41 +141 251 184 +52 66 162 +194 181 66 0 0 0 123 131 0 255 255 255 diff --git a/graphics/pokedex/size_screen.bin b/graphics/pokedex/size_screen.bin index 283aa518c50e371e53fe27d97b6effc19aa89977..cbcfbf34120d694ba6eb3915bc97e4c7c05e22f6 100644 GIT binary patch literal 1280 zcmds$OHTqZ7)6g#9TicxiXtk$wg@VWf`YL2fkfmXz6C|_|8M--vNU8e!^)ntxr=+! zrk$B!k`Rh1rg4~ImN~+b9Oj9zz#>bM@2GK4T~dQ4EgopIj2%`e$lPwaG z;%u|SE_>`te&mT~UL?Kp#ycN$NE*M(0V$3QX%0yXqgLBYaZK0vE*VY?SzHffm2IC& zSC1+=&J1}Ewo6{w_PLmPxDiM`X8)k~7u5d+I##aa literal 1280 zcmeH_K@No=395oHvS$7!E-mSA)A@;4{w_WG3>X^E zulys%Oqen==I1O}vSQ7KEj#ucWDouQA31U6!j&6$9z1zz^CD<_gb3-}&%bNl(SkdX literal 768 zcmcK2H&#Mn5C%||atjL!7lqkU6wuOuN(rcF3FZ>BdteDP=F~jQN&}u_4d?xZ^K~mw6^sY#~OQOEs@^9MEmNaO{uo0uijGOrFwKZbhSlj^An z2{RU~*s$Zki3_(flQ3!KJ$UiqCqR%8ix(}zhlvnX{7Y7ER?HtGPD1e~N&UsE{xlh~ zv=}e1$4C>NIH5qD_acvV->b@6l(# WkP%}hOqns)%*%S?mzE9BANl~f&rAUT literal 768 zcmb8tr&0q@5Cu>^

0VkD`O5gQSC`gQSC`gQT|@dW)eq6M8cN2AxdaUblCS+1a$T z{3NSQ3bADru+w>8y_1$5j7FzrHQ;W8bt98 zqCC_9f{G}AirYPzN++3_%&9qZrmMfceY^S)HC7M3T;>V^4s(Q~R7eWYM?VAH)aqnJq7hl%;}W~YUm^Ov^N0-v}TDAgiMd}dkX?O%NBe|7E4 zsja>%zWgd{tc$*R`ghHHo&OKx-sNwgnNqrcuk+8cQASx`e$(|_&6D2p-TzOv*%5jB sFU|jUt@DS7)sDX+n&0Iwd!l0hM`s!R*L;)?qM~Bor<*R3w_niw0p{N2-~a#s literal 0 HcmV?d00001 diff --git a/include/daycare.h b/include/daycare.h index 7d6f2fb19303..b95cd834d52b 100644 --- a/include/daycare.h +++ b/include/daycare.h @@ -24,4 +24,7 @@ bool8 NameHasGenderSymbol(const u8 *name, u8 genderRatio); void ShowDaycareLevelMenu(void); void ChooseSendDaycareMon(void); +u8 GetEggMovesSpecies(u16 species, u16 *eggMoves); +bool8 SpeciesCanLearnEggMove(u16 species, u16 move); + #endif // GUARD_DAYCARE_H diff --git a/include/graphics.h b/include/graphics.h index 32268d6dbdc7..6c78508593f6 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -3285,6 +3285,8 @@ extern const u32 gBattleTerrainPalette_StadiumWallace[]; // pokedex extern const u32 gPokedexInterface_Gfx[]; extern const u16 gPokedexBgHoenn_Pal[]; +extern const u32 gPokedexMenuRest_Gfx[]; +extern const u32 gPokedexMenuList_Gfx[]; extern const u32 gPokedexMenu_Gfx[]; extern const u8 gPokedexList_Tilemap[]; extern const u8 gPokedexListUnderlay_Tilemap[]; @@ -3293,10 +3295,12 @@ extern const u8 gPokedexStartMenuSearchResults_Tilemap[]; extern const u16 gPokedexSearchResults_Pal[]; extern const u16 gPokedexBgNational_Pal[]; extern const u8 gPokedexInfoScreen_Tilemap[]; +extern const u8 gPokedexStatsScreen_Tilemap[]; extern const u8 gPokedexCryScreen_Tilemap[]; extern const u8 gPokedexSizeScreen_Tilemap[]; extern const u8 gPokedexScreenSelectBarMain_Tilemap[]; extern const u8 gPokedexScreenSelectBarSubmenu_Tilemap[]; +extern const u8 gPokedexScreenSelectBarSubmenu_Tilemap_Clear[]; extern const u16 gPokedexCaughtScreen_Pal[]; extern const u32 gPokedexSearchMenu_Gfx[]; extern const u32 gPokedexSearchMenuHoenn_Tilemap[]; diff --git a/include/party_menu.h b/include/party_menu.h index 7f51d08c9ff8..4457646731e6 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -90,4 +90,6 @@ void BufferMoveDeleterNicknameAndMove(void); void GetNumMovesSelectedMonHas(void); void MoveDeleterChooseMoveToForget(void); +bool8 CanLearnTutorMove(u16, u8); + #endif // GUARD_PARTY_MENU_H diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 6413dcdeca7a..53f3bf71a2a2 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -7,6 +7,8 @@ extern u8 gLastViewedMonIndex; extern const u8 *const gMoveDescriptionPointers[]; extern const u8 *const gNatureNamePointers[]; +extern const struct SpriteTemplate sSpriteTemplate_MoveTypes; +extern const struct CompressedSpriteSheet sSpriteSheet_MoveTypes; void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); void ShowSelectMovePokemonSummaryScreen(struct Pokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void), u16 newMove); diff --git a/include/strings.h b/include/strings.h index 7018f9e0d38e..5f224e2459f6 100644 --- a/include/strings.h +++ b/include/strings.h @@ -532,6 +532,69 @@ extern const u8 gText_SearchingPleaseWait[]; extern const u8 gText_SearchCompleted[]; extern const u8 gText_NoMatchingPkmnWereFound[]; extern const u8 gText_SelectorArrow[]; +//PokedexPlus HGSS_Ui +extern const u8 gText_Stats_EV[]; +extern const u8 gText_Stats_EV_HP[]; +extern const u8 gText_Stats_EV_Attack[]; +extern const u8 gText_Stats_EV_Defense[]; +extern const u8 gText_Stats_EV_Speed[]; +extern const u8 gText_Stats_EV_SpAtk[]; +extern const u8 gText_Stats_EV_SpDef[]; +extern const u8 gText_Stats_HP[]; +extern const u8 gText_Stats_Attack[]; +extern const u8 gText_Stats_Defense[]; +extern const u8 gText_Stats_Speed[]; +extern const u8 gText_Stats_SpAtk[]; +extern const u8 gText_Stats_SpDef[]; +extern const u8 gText_Stats_EVHP[]; +extern const u8 gText_Stats_EVAttack[]; +extern const u8 gText_Stats_EVDefense[]; +extern const u8 gText_Stats_EVSpeed[]; +extern const u8 gText_Stats_EVSpAtk[]; +extern const u8 gText_Stats_EVSpDef[]; +extern const u8 gText_Stats_MoveSelectedMax[]; +extern const u8 gText_Stats_MoveLevel[]; +extern const u8 gText_Stats_Gender_0[]; +extern const u8 gText_Stats_Gender_12_5[]; +extern const u8 gText_Stats_Gender_25[]; +extern const u8 gText_Stats_Gender_50[]; +extern const u8 gText_Stats_Gender_75[]; +extern const u8 gText_Stats_Gender_87_5[]; +extern const u8 gText_Stats_Gender_100[]; +extern const u8 gText_Stats_Catch[]; +extern const u8 gText_Stats_Exp[]; +extern const u8 gText_Stats_EggCycles[]; +extern const u8 gText_Stats_Growthrate[]; +extern const u8 gText_Stats_Friendship[]; +extern const u8 gText_Stats_MEDIUM_FAST[]; +extern const u8 gText_Stats_ERRATIC[]; +extern const u8 gText_Stats_FLUCTUATING[]; +extern const u8 gText_Stats_MEDIUM_SLOW[]; +extern const u8 gText_Stats_FAST[]; +extern const u8 gText_Stats_SLOW[]; +extern const u8 gText_Stats_ContestHeart[]; +extern const u8 gText_PlusSymbol[]; +extern const u8 gText_Stats_Minus[]; +extern const u8 gText_Stats_eggGroup_g1[]; +extern const u8 gText_Stats_eggGroup_g2[]; +extern const u8 gText_Stats_eggGroup_MONSTER[]; +extern const u8 gText_Stats_eggGroup_WATER_1[]; +extern const u8 gText_Stats_eggGroup_BUG[]; +extern const u8 gText_Stats_eggGroup_FLYING[]; +extern const u8 gText_Stats_eggGroup_FIELD[]; +extern const u8 gText_Stats_eggGroup_FAIRY[]; +extern const u8 gText_Stats_eggGroup_GRASS[]; +extern const u8 gText_Stats_eggGroup_HUMAN_LIKE[]; +extern const u8 gText_Stats_eggGroup_WATER_3[]; +extern const u8 gText_Stats_eggGroup_MINERAL[]; +extern const u8 gText_Stats_eggGroup_AMORPHOUS[]; +extern const u8 gText_Stats_eggGroup_WATER_2[]; +extern const u8 gText_Stats_eggGroup_DITTO[]; +extern const u8 gText_Stats_eggGroup_DRAGON[]; +extern const u8 gText_Stats_eggGroup_UNDISCOVERED[]; +extern const u8 gText_Dex_SEEN[]; +extern const u8 gText_Dex_OWN[]; + // birch dex rating text extern const u8 gBirchDexRatingText_LessThan10[]; diff --git a/src/daycare.c b/src/daycare.c index 31014bf7f4f6..882859eac413 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -625,6 +625,61 @@ static u8 GetEggMoves(struct Pokemon *pokemon, u16 *eggMoves) return numEggMoves; } +u8 GetEggMovesSpecies(u16 species, u16 *eggMoves) +{ + u16 eggMoveIdx; + u16 numEggMoves; + u16 i; + + numEggMoves = 0; + eggMoveIdx = 0; + for (i = 0; i < ARRAY_COUNT(gEggMoves) - 1; i++) + { + if (gEggMoves[i] == species + EGG_MOVES_SPECIES_OFFSET) + { + eggMoveIdx = i + 1; + break; + } + } + + for (i = 0; i < EGG_MOVES_ARRAY_COUNT; i++) + { + if (gEggMoves[eggMoveIdx + i] > EGG_MOVES_SPECIES_OFFSET) + { + // TODO: the curly braces around this if statement are required for a matching build. + break; + } + + eggMoves[i] = gEggMoves[eggMoveIdx + i]; + numEggMoves++; + } + + return numEggMoves; +} +bool8 SpeciesCanLearnEggMove(u16 species, u16 move) //Move search PokedexPlus HGSS_Ui +{ + u16 eggMoveIdx; + u16 i; + eggMoveIdx = 0; + for (i = 0; i < ARRAY_COUNT(gEggMoves) - 1; i++) + { + if (gEggMoves[i] == species + EGG_MOVES_SPECIES_OFFSET) + { + eggMoveIdx = i + 1; + break; + } + } + + for (i = 0; i < EGG_MOVES_ARRAY_COUNT; i++) + { + if (gEggMoves[eggMoveIdx + i] > EGG_MOVES_SPECIES_OFFSET) + return FALSE; + + if (move == gEggMoves[eggMoveIdx + i]) + return TRUE; + } + return FALSE; +} static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, struct BoxPokemon *mother) { diff --git a/src/graphics.c b/src/graphics.c index 3973c15076a6..6ee521d1c543 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1257,6 +1257,8 @@ const u16 gPokedexBgHoenn_Pal[] = INCBIN_U16("graphics/pokedex/bg_hoenn.gbapal") const u16 gPokedexCaughtScreen_Pal[] = INCBIN_U16("graphics/pokedex/caught_screen.gbapal"); const u16 gPokedexSearchResults_Pal[] = INCBIN_U16("graphics/pokedex/search_results_bg.gbapal"); const u16 gPokedexBgNational_Pal[] = INCBIN_U16("graphics/pokedex/bg_national.gbapal"); +const u32 gPokedexMenuRest_Gfx[] = INCBIN_U32("graphics/pokedex/menu_rest.4bpp.lz"); +const u32 gPokedexMenuList_Gfx[] = INCBIN_U32("graphics/pokedex/menu_list.4bpp.lz"); const u32 gPokedexMenu_Gfx[] = INCBIN_U32("graphics/pokedex/menu.4bpp.lz"); const u32 gPokedexInterface_Gfx[] = INCBIN_U32("graphics/pokedex/interface.4bpp.lz"); const u32 gUnused_PokedexNoBall[] = INCBIN_U32("graphics/pokedex/noball_unused.4bpp.lz"); @@ -1267,7 +1269,12 @@ const u32 gPokedexListUnderlay_Tilemap[] = INCBIN_U32("graphics/pokedex/list_und const u32 gPokedexSizeScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/size_screen.bin.lz"); const u32 gPokedexScreenSelectBarMain_Tilemap[] = INCBIN_U32("graphics/pokedex/screen_select_bar_main.bin.lz"); const u32 gPokedexScreenSelectBarSubmenu_Tilemap[] = INCBIN_U32("graphics/pokedex/screen_select_bar_submenu.bin.lz"); +const u32 gPokedexScreenSelectBarSubmenu_Tilemap_Clear[] = INCBIN_U32("graphics/pokedex/screen_select_bar_submenu_clear.bin.lz"); +// const u32 gPokedexScreenSelectBarSubmenu_Area_Tilemap[] = INCBIN_U32("graphics/pokedex/screen_select_bar_submenu_area.bin.lz"); +// const u32 gPokedexScreenSelectBarSubmenu_Cry_Tilemap[] = INCBIN_U32("graphics/pokedex/screen_select_bar_submenu_cry.bin.lz"); +// const u32 gPokedexScreenSelectBarSubmenu_Size_Tilemap[] = INCBIN_U32("graphics/pokedex/screen_select_bar_submenu_size.bin.lz"); const u32 gPokedexInfoScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/info_screen.bin.lz"); +const u32 gPokedexStatsScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/stats_screen.bin.lz"); const u32 gPokedexCryScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/cry_screen.bin.lz"); const u16 gPokedexSearchMenu_Pal[] = INCBIN_U16("graphics/pokedex/search_menu.gbapal"); const u32 gPokedexSearchMenu_Gfx[] = INCBIN_U32("graphics/pokedex/search_menu.4bpp.lz"); diff --git a/src/party_menu.c b/src/party_menu.c index 1d49523756f7..2eda56b6c754 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -254,7 +254,7 @@ static bool16 IsMonAllowedInPokemonJump(struct Pokemon*); static bool16 IsMonAllowedInDodrioBerryPicking(struct Pokemon*); static void Task_CancelParticipationYesNo(u8); static void Task_HandleCancelParticipationYesNoInput(u8); -static bool8 CanLearnTutorMove(u16, u8); +// static bool8 CanLearnTutorMove(u16, u8); static u16 GetTutorMove(u8); static bool8 ShouldUseChooseMonText(void); static void SetPartyMonFieldSelectionActions(struct Pokemon*, u8); @@ -1989,7 +1989,7 @@ static u16 GetTutorMove(u8 tutor) return gTutorMoves[tutor]; } -static bool8 CanLearnTutorMove(u16 species, u8 tutor) +bool8 CanLearnTutorMove(u16 species, u8 tutor) { if (sTutorLearnsets[species] & (1 << tutor)) return TRUE; diff --git a/src/pokedex.c b/src/pokedex.c index 803b6019c315..fbc925d7536e 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1,22 +1,30 @@ #include "global.h" #include "battle_main.h" #include "bg.h" +#include "contest_effect.h" #include "data.h" +#include "daycare.h" #include "decompress.h" #include "event_data.h" #include "gpu_regs.h" #include "graphics.h" #include "international_string_util.h" +#include "item.h" +#include "item_icon.h" #include "main.h" #include "malloc.h" #include "menu.h" #include "m4a.h" #include "overworld.h" #include "palette.h" +#include "party_menu.h" #include "pokedex.h" #include "pokedex_area_screen.h" #include "pokedex_cry_screen.h" +#include "pokemon_icon.h" +#include "pokemon_summary_screen.h" #include "scanline_effect.h" +#include "shop.h" #include "sound.h" #include "sprite.h" #include "string_util.h" @@ -26,6 +34,10 @@ #include "trainer_pokemon_sprites.h" #include "trig.h" #include "window.h" +#include "constants/abilities.h" +#include "constants/items.h" +#include "constants/moves.h" +#include "constants/party_menu.h" #include "constants/rgb.h" #include "constants/songs.h" @@ -43,6 +55,8 @@ enum enum { + INFO_SCREEN, + STATS_SCREEN, AREA_SCREEN, CRY_SCREEN, SIZE_SCREEN, @@ -109,6 +123,12 @@ static EWRAM_DATA struct PokedexView *sPokedexView = NULL; static EWRAM_DATA u16 sLastSelectedPokemon = 0; static EWRAM_DATA u8 sPokeBallRotation = 0; static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL; +//Pokedex Plus HGSS_Ui +EWRAM_DATA static u16 sStatsMovesLevelUp[EGG_LVL_UP_MOVES_ARRAY_COUNT] = {0}; +EWRAM_DATA static u16 sStatsMovesEgg[EGG_MOVES_ARRAY_COUNT] = {0}; +EWRAM_DATA static u16 sStatsMovesTMHM[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; +EWRAM_DATA static u16 sStatsMovesTMHM_ID[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; +EWRAM_DATA static u16 sStatsMovesTutor[TUTOR_MOVE_COUNT] = {0}; // IWRAM common // This is written to, but never read. @@ -170,6 +190,14 @@ struct PokedexView u16 seenCount; u16 ownCount; u16 monSpriteIds[MAX_MONS_ON_SCREEN]; + u8 typeIconSpriteIds[2]; //HGSS_Ui + u16 moveSelected; //HGSS_Ui + u8 moveMax; //HGSS_Ui + // u8 splitIconSpriteId; //HGSS_Ui Physical/Special Split from BE + u8 numEggMoves; + u8 numLevelUpMoves; + u8 numTMHMMoves; + u8 numTutorMoves; u16 selectedMonSpriteId; s16 pokeBallRotationStep; s16 pokeBallRotationBackup; @@ -299,6 +327,78 @@ static void EraseSelectorArrow(u32); static void PrintSelectorArrow(u32); static void PrintSearchParameterTitle(u32, const u8*); static void ClearSearchParameterBoxText(void); +static void SetSpriteInvisibility(u8 spriteArrayId, bool8 invisible); +static void CreateTypeIconSprites(void); +//Stats screen HGSS_Ui +#define SCROLLING_MON_X 146 +static void Task_HandleStatsScreenInput(u8 taskId); +static void PrintMonStats(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry); +static void Task_LoadStatsScreen(u8 taskId); +static void Task_SwitchScreensFromStatsScreen(u8 taskId); +static void Task_ExitStatsScreen(u8 taskId); +static bool8 CalculateMoves(void); +static void DestroyMoveIcon(u8 taskId); +static void PrintMoveNameAndInfo(u8 taskId, bool8 toogle); +static void PrintMonStatsToggle(u8 taskId); +static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top); +static void PrintInfoScreenTextSmall(const u8* str, u8 left, u8 top); +static void PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top); +// static u8 ShowSplitIcon(u32 split); //Physical/Special Split from BE +// static void DestroySplitIcon(void); //Physical/Special Split from BE + +//Physical/Special Split from BE +// #define TAG_SPLIT_ICONS 30004 +// static const u16 sSplitIcons_Pal[] = INCBIN_U16("graphics/interface/split_icons.gbapal"); +// static const u32 sSplitIcons_Gfx[] = INCBIN_U32("graphics/interface/split_icons.4bpp.lz"); +// static const struct OamData sOamData_SplitIcons = +// { +// .size = SPRITE_SIZE(16x16), +// .shape = SPRITE_SHAPE(16x16), +// .priority = 0, +// }; +// static const struct CompressedSpriteSheet sSpriteSheet_SplitIcons = +// { +// .data = sSplitIcons_Gfx, +// .size = 16*16*3/2, +// .tag = TAG_SPLIT_ICONS, +// }; +// static const struct SpritePalette sSpritePal_SplitIcons = +// { +// .data = sSplitIcons_Pal, +// .tag = TAG_SPLIT_ICONS +// }; +// static const union AnimCmd sSpriteAnim_SplitIcon0[] = +// { +// ANIMCMD_FRAME(0, 0), +// ANIMCMD_END +// }; +// static const union AnimCmd sSpriteAnim_SplitIcon1[] = +// { +// ANIMCMD_FRAME(4, 0), +// ANIMCMD_END +// }; +// static const union AnimCmd sSpriteAnim_SplitIcon2[] = +// { +// ANIMCMD_FRAME(8, 0), +// ANIMCMD_END +// }; +// static const union AnimCmd *const sSpriteAnimTable_SplitIcons[] = +// { +// sSpriteAnim_SplitIcon0, +// sSpriteAnim_SplitIcon1, +// sSpriteAnim_SplitIcon2, +// }; +// static const struct SpriteTemplate sSpriteTemplate_SplitIcons = +// { +// .tileTag = TAG_SPLIT_ICONS, +// .paletteTag = TAG_SPLIT_ICONS, +// .oam = &sOamData_SplitIcons, +// .anims = sSpriteAnimTable_SplitIcons, +// .images = NULL, +// .affineAnims = gDummySpriteAffineAnimTable, +// .callback = SpriteCallbackDummy +// }; + // const rom data #include "data/pokemon/pokedex_orders.h" @@ -907,8 +1007,8 @@ static const struct WindowTemplate sInfoScreen_WindowTemplates[] = [WIN_FOOTPRINT] = { .bg = 2, - .tilemapLeft = 25, - .tilemapTop = 8, + .tilemapLeft = 15, //HGSSS_Ui + .tilemapTop = 7, //HGSSS_Ui .width = 2, .height = 2, .paletteNum = 15, @@ -974,8 +1074,8 @@ static const struct WindowTemplate sNewEntryInfoScreen_WindowTemplates[] = [WIN_FOOTPRINT] = { .bg = 2, - .tilemapLeft = 25, - .tilemapTop = 8, + .tilemapLeft = 15, //HGSSS_Ui + .tilemapTop = 7, //HGSSS_Ui .width = 2, .height = 2, .paletteNum = 15, @@ -2063,7 +2163,7 @@ static bool8 LoadPokedexListPage(u8 page) SetBgTilemapBuffer(2, AllocZeroed(BG_SCREEN_SIZE)); SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE)); SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE)); - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0); + DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenuList_Gfx, 0x2000, 0, 0); CopyToBgTilemapBuffer(1, gPokedexList_Tilemap, 0, 0); CopyToBgTilemapBuffer(3, gPokedexListUnderlay_Tilemap, 0, 0); if (page == PAGE_MAIN) @@ -2326,6 +2426,7 @@ static void PrintMonDexNumAndName(u8 windowId, u8 fontId, const u8* str, u8 left } // u16 ignored is passed but never used +#define MON_LIST_X 2 static void CreateMonListEntry(u8 position, u16 b, u16 ignored) { s16 entryNum; @@ -2341,22 +2442,22 @@ static void CreateMonListEntry(u8 position, u16 b, u16 ignored) { if (entryNum < 0 || entryNum >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[entryNum].dexNum == 0xFFFF) { - ClearMonListEntry(17, i * 2, ignored); + ClearMonListEntry(MON_LIST_X, i * 2, ignored); } else { - ClearMonListEntry(17, i * 2, ignored); + ClearMonListEntry(MON_LIST_X, i * 2, ignored); if (sPokedexView->pokedexList[entryNum].seen) { - CreateMonDexNum(entryNum, 0x12, i * 2, ignored); - CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, 0x11, i * 2, ignored); - CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, 0x16, i * 2); + CreateMonDexNum(entryNum, MON_LIST_X+1, i * 2, ignored); + CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, MON_LIST_X, i * 2, ignored); + CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, MON_LIST_X+5, i * 2); } else { - CreateMonDexNum(entryNum, 0x12, i * 2, ignored); - CreateCaughtBall(FALSE, 0x11, i * 2, ignored); - CreateMonName(0, 0x16, i * 2); + CreateMonDexNum(entryNum, MON_LIST_X+1, i * 2, ignored); + CreateCaughtBall(FALSE, MON_LIST_X, i * 2, ignored); + CreateMonName(0, MON_LIST_X+5, i * 2); } } entryNum++; @@ -2366,22 +2467,22 @@ static void CreateMonListEntry(u8 position, u16 b, u16 ignored) entryNum = b - 5; if (entryNum < 0 || entryNum >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[entryNum].dexNum == 0xFFFF) { - ClearMonListEntry(17, sPokedexView->listVOffset * 2, ignored); + ClearMonListEntry(MON_LIST_X, sPokedexView->listVOffset * 2, ignored); } else { - ClearMonListEntry(17, sPokedexView->listVOffset * 2, ignored); + ClearMonListEntry(MON_LIST_X, sPokedexView->listVOffset * 2, ignored); if (sPokedexView->pokedexList[entryNum].seen) { - CreateMonDexNum(entryNum, 18, sPokedexView->listVOffset * 2, ignored); - CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, 0x11, sPokedexView->listVOffset * 2, ignored); - CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, 0x16, sPokedexView->listVOffset * 2); + CreateMonDexNum(entryNum, MON_LIST_X+1, sPokedexView->listVOffset * 2, ignored); + CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, MON_LIST_X, sPokedexView->listVOffset * 2, ignored); + CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, MON_LIST_X+5, sPokedexView->listVOffset * 2); } else { - CreateMonDexNum(entryNum, 18, sPokedexView->listVOffset * 2, ignored); - CreateCaughtBall(FALSE, 17, sPokedexView->listVOffset * 2, ignored); - CreateMonName(0, 0x16, sPokedexView->listVOffset * 2); + CreateMonDexNum(entryNum, MON_LIST_X+1, sPokedexView->listVOffset * 2, ignored); + CreateCaughtBall(FALSE, MON_LIST_X, sPokedexView->listVOffset * 2, ignored); + CreateMonName(0, MON_LIST_X+5, sPokedexView->listVOffset * 2); } } break; @@ -2391,21 +2492,21 @@ static void CreateMonListEntry(u8 position, u16 b, u16 ignored) if (vOffset >= LIST_SCROLL_STEP) vOffset -= LIST_SCROLL_STEP; if (entryNum < 0 || entryNum >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[entryNum].dexNum == 0xFFFF) - ClearMonListEntry(17, vOffset * 2, ignored); + ClearMonListEntry(MON_LIST_X, vOffset * 2, ignored); else { - ClearMonListEntry(17, vOffset * 2, ignored); + ClearMonListEntry(MON_LIST_X, vOffset * 2, ignored); if (sPokedexView->pokedexList[entryNum].seen) { - CreateMonDexNum(entryNum, 18, vOffset * 2, ignored); - CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, 0x11, vOffset * 2, ignored); - CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, 0x16, vOffset * 2); + CreateMonDexNum(entryNum, MON_LIST_X+1, vOffset * 2, ignored); + CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, MON_LIST_X, vOffset * 2, ignored); + CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, MON_LIST_X+5, vOffset * 2); } else { - CreateMonDexNum(entryNum, 18, vOffset * 2, ignored); - CreateCaughtBall(FALSE, 0x11, vOffset * 2, ignored); - CreateMonName(0, 0x16, vOffset * 2); + CreateMonDexNum(entryNum, MON_LIST_X+1, vOffset * 2, ignored); + CreateCaughtBall(FALSE, MON_LIST_X, vOffset * 2, ignored); + CreateMonName(0, MON_LIST_X+5, vOffset * 2); } } break; @@ -2471,7 +2572,7 @@ static void CreateMonSpritesAtPos(u16 selectedMon, u16 ignored) dexNum = GetPokemonSpriteToDisplay(selectedMon - 1); if (dexNum != 0xFFFF) { - spriteId = CreatePokedexMonSprite(dexNum, 0x60, 0x50); + spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; gSprites[spriteId].data[5] = -32; } @@ -2480,7 +2581,7 @@ static void CreateMonSpritesAtPos(u16 selectedMon, u16 ignored) dexNum = GetPokemonSpriteToDisplay(selectedMon); if (dexNum != 0xFFFF) { - spriteId = CreatePokedexMonSprite(dexNum, 0x60, 0x50); + spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; gSprites[spriteId].data[5] = 0; } @@ -2489,7 +2590,7 @@ static void CreateMonSpritesAtPos(u16 selectedMon, u16 ignored) dexNum = GetPokemonSpriteToDisplay(selectedMon + 1); if (dexNum != 0xFFFF) { - spriteId = CreatePokedexMonSprite(dexNum, 0x60, 0x50); + spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; gSprites[spriteId].data[5] = 32; } @@ -2555,7 +2656,7 @@ static void CreateScrollingPokemonSprite(u8 direction, u16 selectedMon) dexNum = GetPokemonSpriteToDisplay(selectedMon - 1); if (dexNum != 0xFFFF) { - spriteId = CreatePokedexMonSprite(dexNum, 0x60, 0x50); + spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; gSprites[spriteId].data[5] = -64; } @@ -2568,7 +2669,7 @@ static void CreateScrollingPokemonSprite(u8 direction, u16 selectedMon) dexNum = GetPokemonSpriteToDisplay(selectedMon + 1); if (dexNum != 0xFFFF) { - spriteId = CreatePokedexMonSprite(dexNum, 0x60, 0x50); + spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; gSprites[spriteId].data[5] = 64; } @@ -2763,43 +2864,47 @@ static u32 CreatePokedexMonSprite(u16 num, s16 x, s16 y) #define sIsDownArrow data[1] +#define LIST_RIGHT_SIDE_TEXT_X 204 +#define LIST_RIGHT_SIDE_TEXT_X_OFFSET 12 +#define LIST_RIGHT_SIDE_TEXT_Y_OFFSET 13 static void CreateInterfaceSprites(u8 page) { u8 spriteId; u16 digitNum; + u8 color[3]; // Scroll arrows - spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 184, 4, 0); + spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 10, 4, 0); gSprites[spriteId].sIsDownArrow = FALSE; - spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 184, 156, 0); + spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 10, 156, 0); gSprites[spriteId].sIsDownArrow = TRUE; gSprites[spriteId].vFlip = TRUE; - CreateSprite(&sScrollBarSpriteTemplate, 230, 20, 0); + CreateSprite(&sScrollBarSpriteTemplate, 8, 20, 0); // Start button - CreateSprite(&sInterfaceTextSpriteTemplate, 16, 120, 0); + // CreateSprite(&sInterfaceTextSpriteTemplate, 16, 120, 0); // Menu text - spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 48, 120, 0); - StartSpriteAnim(&gSprites[spriteId], 3); + // spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 48, 120, 0); + // StartSpriteAnim(&gSprites[spriteId], 3); // Select button - spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 16, 144, 0); - StartSpriteAnim(&gSprites[spriteId], 2); - gSprites[spriteId].data[2] = 0x80; + // spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 16, 144, 0); + // StartSpriteAnim(&gSprites[spriteId], 2); + // gSprites[spriteId].data[2] = 0x80; // Search text - spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 48, 144, 0); - StartSpriteAnim(&gSprites[spriteId], 1); + // spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 48, 144, 0); + // StartSpriteAnim(&gSprites[spriteId], 1); - spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, 80, 2); - gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[spriteId].oam.matrixNum = 30; - gSprites[spriteId].data[0] = 30; - gSprites[spriteId].data[1] = 0; + // spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, 80, 2); + // gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + // gSprites[spriteId].oam.matrixNum = 30; + // gSprites[spriteId].data[0] = 30; + // gSprites[spriteId].data[1] = 0; - spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, 80, 2); - gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[spriteId].oam.matrixNum = 31; - gSprites[spriteId].data[0] = 31; - gSprites[spriteId].data[1] = 128; + // spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, 80, 2); + // gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + // gSprites[spriteId].oam.matrixNum = 31; + // gSprites[spriteId].data[0] = 31; + // gSprites[spriteId].data[1] = 128; if (page == PAGE_MAIN) { @@ -2807,15 +2912,70 @@ static void CreateInterfaceSprites(u8 page) if (!IsNationalPokedexEnabled()) { - // Seen text - CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 40, 1); - // Own text - spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 72, 1); + + // // Seen text + // CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 40, 1); + // // Own text + // spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 72, 1); + // StartSpriteAnim(&gSprites[spriteId], 1); + + // // Seen value - 100s + // drawNextDigit = FALSE; + // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 24, 48, 1); + // digitNum = sPokedexView->seenCount / 100; + // StartSpriteAnim(&gSprites[spriteId], digitNum); + // if (digitNum != 0) + // drawNextDigit = TRUE; + // else + // gSprites[spriteId].invisible = TRUE; + + // // Seen value - 10s + // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 32, 48, 1); + // digitNum = (sPokedexView->seenCount % 100) / 10; + // if (digitNum != 0 || drawNextDigit) + // StartSpriteAnim(&gSprites[spriteId], digitNum); + // else + // gSprites[spriteId].invisible = TRUE; + + // // Seen value - 1s + // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 40, 48, 1); + // digitNum = (sPokedexView->seenCount % 100) % 10; + // StartSpriteAnim(&gSprites[spriteId], digitNum); + + // // Owned value - 100s + // drawNextDigit = FALSE; + // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 24, 80, 1); + // digitNum = sPokedexView->ownCount / 100; + // StartSpriteAnim(&gSprites[spriteId], digitNum); + // if (digitNum != 0) + // drawNextDigit = TRUE; + // else + // gSprites[spriteId].invisible = TRUE; + + // // Owned value - 10s + // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 32, 80, 1); + // digitNum = (sPokedexView->ownCount % 100) / 10; + // if (digitNum != 0 || drawNextDigit) + // StartSpriteAnim(&gSprites[spriteId], digitNum); + // else + // gSprites[spriteId].invisible = TRUE; + + // // Owned value - 1s + // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 40, 80, 1); + // digitNum = (sPokedexView->ownCount % 100) % 10; + // StartSpriteAnim(&gSprites[spriteId], digitNum); + + // Hoenn text + CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 40 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); + // Hoenn seen + CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); + // Hoenn own + spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 7, 1); StartSpriteAnim(&gSprites[spriteId], 1); - // Seen value - 100s + // Hoenn seen value - 100s drawNextDigit = FALSE; - spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 24, 48, 1); + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = sPokedexView->seenCount / 100; StartSpriteAnim(&gSprites[spriteId], digitNum); if (digitNum != 0) @@ -2823,22 +2983,23 @@ static void CreateInterfaceSprites(u8 page) else gSprites[spriteId].invisible = TRUE; - // Seen value - 10s - spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 32, 48, 1); + // Hoenn seen value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = (sPokedexView->seenCount % 100) / 10; if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); else gSprites[spriteId].invisible = TRUE; - // Seen value - 1s - spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 40, 48, 1); + // Hoenn seen value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = (sPokedexView->seenCount % 100) % 10; StartSpriteAnim(&gSprites[spriteId], digitNum); - // Owned value - 100s + + // Hoenn owned value - 100s drawNextDigit = FALSE; - spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 24, 80, 1); + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = sPokedexView->ownCount / 100; StartSpriteAnim(&gSprites[spriteId], digitNum); if (digitNum != 0) @@ -2846,16 +3007,16 @@ static void CreateInterfaceSprites(u8 page) else gSprites[spriteId].invisible = TRUE; - // Owned value - 10s - spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 32, 80, 1); + // Hoenn owned value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = (sPokedexView->ownCount % 100) / 10; if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); else gSprites[spriteId].invisible = TRUE; - // Owned value - 1s - spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 40, 80, 1); + // Hoenn owned value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = (sPokedexView->ownCount % 100) % 10; StartSpriteAnim(&gSprites[spriteId], digitNum); } @@ -2863,30 +3024,28 @@ static void CreateInterfaceSprites(u8 page) { u16 seenOwnedCount; - // Seen text - CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 40, 1); - // Own text - spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 76, 1); - StartSpriteAnim(&gSprites[spriteId], 1); - - // Hoenn text (seen) - CreateSprite(&sHoennNationalTextSpriteTemplate, 17, 45, 1); - // National text (seen) - spriteId = CreateSprite(&sHoennNationalTextSpriteTemplate, 17, 55, 1); + // Hoenn text + CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 40 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); + // Hoenn seen + CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); + // Hoenn own + spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 7, 1); StartSpriteAnim(&gSprites[spriteId], 1); - // Hoenn text (own) - CreateSprite(&sHoennNationalTextSpriteTemplate, 17, 81, 1); - - // National text (own) - spriteId = CreateSprite(&sHoennNationalTextSpriteTemplate, 17, 91, 1); + // National text + spriteId = CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 73 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + // National seen + CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); + // National own + spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); StartSpriteAnim(&gSprites[spriteId], 1); // Hoenn seen value - 100s seenOwnedCount = GetHoennPokedexCount(FLAG_GET_SEEN); drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 40, 45, 1); + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = seenOwnedCount / 100; StartSpriteAnim(&gSprites[spriteId], digitNum); if (digitNum != 0) @@ -2895,7 +3054,7 @@ static void CreateInterfaceSprites(u8 page) gSprites[spriteId].invisible = TRUE; // Hoenn seen value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 48, 45, 1); + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = (seenOwnedCount % 100) / 10; if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); @@ -2903,61 +3062,63 @@ static void CreateInterfaceSprites(u8 page) gSprites[spriteId].invisible = TRUE; // Hoenn seen value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 56, 45, 1); + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = (seenOwnedCount % 100) % 10; StartSpriteAnim(&gSprites[spriteId], digitNum); - // National seen value - 100s + seenOwnedCount = GetHoennPokedexCount(FLAG_GET_CAUGHT); + // Hoenn owned value - 100s drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 40, 55, 1); - digitNum = sPokedexView->seenCount / 100; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = seenOwnedCount / 100; StartSpriteAnim(&gSprites[spriteId], digitNum); if (digitNum != 0) drawNextDigit = TRUE; else gSprites[spriteId].invisible = TRUE; - // National seen value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 48, 55, 1); - digitNum = (sPokedexView->seenCount % 100) / 10; + // Hoenn owned value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (seenOwnedCount % 100) / 10; if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); else gSprites[spriteId].invisible = TRUE; - // National seen value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 56, 55, 1); - digitNum = (sPokedexView->seenCount % 100) % 10; + // Hoenn owned value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (seenOwnedCount % 100) % 10; StartSpriteAnim(&gSprites[spriteId], digitNum); - seenOwnedCount = GetHoennPokedexCount(FLAG_GET_CAUGHT); - // Hoenn owned value - 100s + + //**************************** + // National seen value - 100s drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 40, 81, 1); - digitNum = seenOwnedCount / 100; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = sPokedexView->seenCount / 100; StartSpriteAnim(&gSprites[spriteId], digitNum); if (digitNum != 0) drawNextDigit = TRUE; else gSprites[spriteId].invisible = TRUE; - // Hoenn owned value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 48, 81, 1); - digitNum = (seenOwnedCount % 100) / 10; + // National seen value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->seenCount % 100) / 10; if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); else gSprites[spriteId].invisible = TRUE; - // Hoenn owned value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 56, 81, 1); - digitNum = (seenOwnedCount % 100) % 10; + // National seen value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->seenCount % 100) % 10; StartSpriteAnim(&gSprites[spriteId], digitNum); // National owned value - 100s drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 40, 91, 1); + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = sPokedexView->ownCount / 100; StartSpriteAnim(&gSprites[spriteId], digitNum); if (digitNum != 0) @@ -2966,7 +3127,7 @@ static void CreateInterfaceSprites(u8 page) gSprites[spriteId].invisible = TRUE; // National owned value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 48, 91, 1); + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = (sPokedexView->ownCount % 100) / 10; if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); @@ -2974,7 +3135,7 @@ static void CreateInterfaceSprites(u8 page) gSprites[spriteId].invisible = TRUE; // National owned value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 56, 91, 1); + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); digitNum = (sPokedexView->ownCount % 100) % 10; StartSpriteAnim(&gSprites[spriteId], digitNum); } @@ -3008,14 +3169,14 @@ void SpriteCB_MoveMonForInfoScreen(struct Sprite *sprite) if (sprite->pos1.x != 48 || sprite->pos1.y != 56) { if (sprite->pos1.x > 48) - sprite->pos1.x--; + sprite->pos1.x -= 4; if (sprite->pos1.x < 48) - sprite->pos1.x++; + sprite->pos1.x = 48; if (sprite->pos1.y > 56) - sprite->pos1.y--; + sprite->pos1.y -= 4; if (sprite->pos1.y < 56) - sprite->pos1.y++; + sprite->pos1.y = 56; } else { @@ -3168,6 +3329,34 @@ static void PrintInfoScreenText(const u8* str, u8 left, u8 top) AddTextPrinterParameterized4(0, 1, left, top, 0, 0, color, -1, str); } +static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top) //HGSS_Ui +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_COLOR_WHITE; + color[2] = TEXT_DYNAMIC_COLOR_6; + + AddTextPrinterParameterized4(0, 1, left, top, 0, 0, color, -1, str); +} +static void PrintInfoScreenTextSmall(const u8* str, u8 left, u8 top) +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_DYNAMIC_COLOR_6; + color[2] = TEXT_COLOR_LIGHT_GREY; + + AddTextPrinterParameterized4(0, 0, left, top, 0, 0, color, 0, str); +} +static void PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top) +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_COLOR_WHITE; + color[2] = TEXT_DYNAMIC_COLOR_6; + + AddTextPrinterParameterized4(0, 0, left, top, 0, 0, color, 0, str); +} + #define tMonSpriteId data[4] @@ -3247,11 +3436,14 @@ static void Task_LoadInfoScreen(u8 taskId) break; case 2: LoadScreenSelectBarMain(0xD); - HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); + // HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); gMain.state++; break; case 3: + sPokedexView->typeIconSpriteIds[0] = 0xFF; + sPokedexView->typeIconSpriteIds[1] = 0xFF; + CreateTypeIconSprites(); gMain.state++; break; case 4: @@ -3300,20 +3492,20 @@ static void Task_LoadInfoScreen(u8 taskId) if (!gPaletteFade.active) { gMain.state++; - if (gTasks[taskId].data[3] == 0) - { - StopCryAndClearCrySongs(); - PlayCry2(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, 0x7D, 0xA); - } - else - { - gMain.state++; - } + // if (gTasks[taskId].data[3] == 0) + // { + // StopCryAndClearCrySongs(); + // PlayCry2(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, 0x7D, 0xA); + // } + // else + // { + // gMain.state++; + // } } break; case 9: - if (!IsCryPlayingOrClearCrySongs()) - gMain.state++; + // if (!IsCryPlayingOrClearCrySongs()) + gMain.state++; break; case 10: gTasks[taskId].data[0] = 0; @@ -3362,61 +3554,71 @@ static void Task_HandleInfoScreenInput(u8 taskId) PlaySE(SE_PC_OFF); return; } - if (JOY_NEW(A_BUTTON)) - { - switch (sPokedexView->selectedScreen) - { - case AREA_SCREEN: - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 16, RGB_BLACK); - sPokedexView->screenSwitchState = 1; - gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; - PlaySE(SE_PIN); - break; - case CRY_SCREEN: - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 2; - gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; - PlaySE(SE_PIN); - break; - case SIZE_SCREEN: - if (!sPokedexListItem->owned) - { - PlaySE(SE_FAILURE); - } - else - { - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 3; - gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; - PlaySE(SE_PIN); - } - break; - case CANCEL_SCREEN: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); - gTasks[taskId].func = Task_ExitInfoScreen; - PlaySE(SE_PC_OFF); - break; - } - return; - } - if ((JOY_NEW(DPAD_LEFT) - || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) - && sPokedexView->selectedScreen > 0) + // if (JOY_NEW(A_BUTTON)) + // { + // switch (sPokedexView->selectedScreen) + // { + // case AREA_SCREEN: + // BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 16, RGB_BLACK); + // sPokedexView->screenSwitchState = 1; + // gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; + // PlaySE(SE_PIN); + // break; + // case CRY_SCREEN: + // BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + // sPokedexView->screenSwitchState = 2; + // gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; + // PlaySE(SE_PIN); + // break; + // case SIZE_SCREEN: + // if (!sPokedexListItem->owned) + // { + // PlaySE(SE_FAILURE); + // } + // else + // { + // BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + // sPokedexView->screenSwitchState = 3; + // gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; + // PlaySE(SE_PIN); + // } + // break; + // case CANCEL_SCREEN: + // BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + // gTasks[taskId].func = Task_ExitInfoScreen; + // PlaySE(SE_PC_OFF); + // break; + // } + // return; + // } + // if ((JOY_NEW(DPAD_LEFT) + // || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + // && sPokedexView->selectedScreen > 0) + // { + // sPokedexView->selectedScreen--; + // HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); + // PlaySE(SE_DEX_PAGE); + // return; + // } + // if ((JOY_NEW(DPAD_RIGHT) + // || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + // && sPokedexView->selectedScreen < CANCEL_SCREEN) + // { + // sPokedexView->selectedScreen++; + // HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); + // PlaySE(SE_DEX_PAGE); + // return; + // } + + if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) { - sPokedexView->selectedScreen--; - HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); - PlaySE(SE_DEX_PAGE); - return; - } - if ((JOY_NEW(DPAD_RIGHT) - || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) - && sPokedexView->selectedScreen < CANCEL_SCREEN) - { - sPokedexView->selectedScreen++; - HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); - PlaySE(SE_DEX_PAGE); - return; + sPokedexView->selectedScreen = AREA_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; + PlaySE(SE_PIN); } + } static void Task_SwitchScreensFromInfoScreen(u8 taskId) @@ -3476,8 +3678,8 @@ static void Task_LoadAreaScreen(u8 taskId) } break; case 1: - LoadScreenSelectBarSubmenu(0xD); - HighlightSubmenuScreenSelectBarItem(0, 0xD); + LoadScreenSelectBarSubmenu(0xD); //HGSS_Ui + // HighlightSubmenuScreenSelectBarItem(0, 0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(13) | BGCNT_16COLOR | BGCNT_TXT256x256); gMain.state++; @@ -3510,7 +3712,10 @@ static void Task_SwitchScreensFromAreaScreen(u8 taskId) gTasks[taskId].func = Task_LoadInfoScreen; break; case 2: - gTasks[taskId].func = Task_LoadCryScreen; + if (!sPokedexListItem->owned) + PlaySE(SE_FAILURE); + else + gTasks[taskId].func = Task_LoadStatsScreen; break; } } @@ -3534,7 +3739,7 @@ static void Task_LoadCryScreen(u8 taskId) } break; case 1: - DecompressAndLoadBgGfxUsingHeap(3, &gPokedexMenu_Gfx, 0x2000, 0, 0); + DecompressAndLoadBgGfxUsingHeap(3, &gPokedexMenuRest_Gfx, 0x2000, 0, 0); CopyToBgTilemapBuffer(3, &gPokedexCryScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); @@ -3543,8 +3748,8 @@ static void Task_LoadCryScreen(u8 taskId) gMain.state++; break; case 2: - LoadScreenSelectBarSubmenu(0xD); - HighlightSubmenuScreenSelectBarItem(1, 0xD); + LoadScreenSelectBarMain(0xD); //HGSS_Ui + // HighlightSubmenuScreenSelectBarItem(1, 0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); gMain.state++; break; @@ -3689,7 +3894,7 @@ static void Task_SwitchScreensFromCryScreen(u8 taskId) gTasks[taskId].func = Task_LoadInfoScreen; break; case 2: - gTasks[taskId].func = Task_LoadAreaScreen; + gTasks[taskId].func = Task_LoadStatsScreen; break; case 3: gTasks[taskId].func = Task_LoadSizeScreen; @@ -3728,15 +3933,15 @@ static void Task_LoadSizeScreen(u8 taskId) } break; case 1: - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0); + DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenuRest_Gfx, 0x2000, 0, 0); CopyToBgTilemapBuffer(3, gPokedexSizeScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); gMain.state++; break; case 2: - LoadScreenSelectBarSubmenu(0xD); - HighlightSubmenuScreenSelectBarItem(2, 0xD); + LoadScreenSelectBarMain(0xD); //HGSS_Ui + // HighlightSubmenuScreenSelectBarItem(2, 0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); gMain.state++; break; @@ -3849,15 +4054,18 @@ static void Task_SwitchScreensFromSizeScreen(u8 taskId) static void LoadScreenSelectBarMain(u16 unused) { - CopyToBgTilemapBuffer(1, gPokedexScreenSelectBarMain_Tilemap, 0, 0); + //CopyToBgTilemapBuffer(1, gPokedexScreenSelectBarMain_Tilemap, 0, 0); + CopyToBgTilemapBuffer(1, gPokedexScreenSelectBarSubmenu_Tilemap_Clear, 0, 0); + CopyBgTilemapBufferToVram(1); } static void LoadScreenSelectBarSubmenu(u16 unused) { CopyToBgTilemapBuffer(1, gPokedexScreenSelectBarSubmenu_Tilemap, 0, 0); + CopyBgTilemapBufferToVram(1); } -static void HighlightScreenSelectBarItem(u8 selectedScreen, u16 unused) +static void HighlightScreenSelectBarItem(u8 selectedScreen, u16 unused) //HGSS_Ui { u8 i; u8 j; @@ -4078,6 +4286,96 @@ static void SpriteCB_SlideCaughtMonToCenter(struct Sprite *sprite) #undef tPersonalityLo #undef tPersonalityHi +//Type Icon +static void SetSpriteInvisibility(u8 spriteArrayId, bool8 invisible) +{ + gSprites[sPokedexView->typeIconSpriteIds[spriteArrayId]].invisible = invisible; +} +// different from pokemon_summary_screen +#define TYPE_ICON_PAL_NUM_0 13 +#define TYPE_ICON_PAL_NUM_1 14 +#define TYPE_ICON_PAL_NUM_2 15 +static const u8 sMoveTypeToOamPaletteNum[NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT] = +{ + [TYPE_NORMAL] = TYPE_ICON_PAL_NUM_0, + [TYPE_FIGHTING] = TYPE_ICON_PAL_NUM_0, + [TYPE_FLYING] = TYPE_ICON_PAL_NUM_1, + [TYPE_POISON] = TYPE_ICON_PAL_NUM_1, + [TYPE_GROUND] = TYPE_ICON_PAL_NUM_0, + [TYPE_ROCK] = TYPE_ICON_PAL_NUM_0, + [TYPE_BUG] = TYPE_ICON_PAL_NUM_2, + [TYPE_GHOST] = TYPE_ICON_PAL_NUM_1, + [TYPE_STEEL] = TYPE_ICON_PAL_NUM_0, + [TYPE_MYSTERY] = TYPE_ICON_PAL_NUM_2, + [TYPE_FIRE] = TYPE_ICON_PAL_NUM_0, + [TYPE_WATER] = TYPE_ICON_PAL_NUM_1, + [TYPE_GRASS] = TYPE_ICON_PAL_NUM_2, + [TYPE_ELECTRIC] = TYPE_ICON_PAL_NUM_0, + [TYPE_PSYCHIC] = TYPE_ICON_PAL_NUM_1, + [TYPE_ICE] = TYPE_ICON_PAL_NUM_1, + [TYPE_DRAGON] = TYPE_ICON_PAL_NUM_2, + [TYPE_DARK] = TYPE_ICON_PAL_NUM_0, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_COOL] = TYPE_ICON_PAL_NUM_0, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_BEAUTY] = TYPE_ICON_PAL_NUM_1, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_CUTE] = TYPE_ICON_PAL_NUM_1, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_SMART] = TYPE_ICON_PAL_NUM_2, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_TOUGH] = TYPE_ICON_PAL_NUM_0, + #ifdef TYPE_FAIRY + [TYPE_FAIRY] = TYPE_ICON_PAL_NUM_1, //based on battle_engine + #endif +}; +static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) +{ + struct Sprite *sprite; + + sprite = &gSprites[sPokedexView->typeIconSpriteIds[spriteArrayId]]; + StartSpriteAnim(sprite, typeId); + sprite->oam.paletteNum = sMoveTypeToOamPaletteNum[typeId]; + sprite->pos1.x = x + 16; + sprite->pos1.y = y + 8; + SetSpriteInvisibility(spriteArrayId, FALSE); +} +static void PrintCurrentSpeciesTypeInfo(void) +{ + u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + u32 i; + u16 dexNum = SpeciesToNationalPokedexNum(species); + u8 type1, type2; + + //type icon(s) + type1 = gBaseStats[species].type1; + type2 = gBaseStats[species].type2; + if (species == SPECIES_NONE) + type1 = type2 = TYPE_MYSTERY; + + if (type1 == type2) + { + SetTypeIconPosAndPal(type1, 147, 48, 0); + SetSpriteInvisibility(1, TRUE); + } + else + { + SetTypeIconPosAndPal(type1, 147, 48, 0); + SetTypeIconPosAndPal(type2, 147 + 33, 48, 1); + } + +} +static void CreateTypeIconSprites(void) +{ + u8 i; + + LoadCompressedSpriteSheet(&sSpriteSheet_MoveTypes); + LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); + for (i = 0; i < 2; i++) + { + if (sPokedexView->typeIconSpriteIds[i] == 0xFF) + sPokedexView->typeIconSpriteIds[i] = CreateSprite(&sSpriteTemplate_MoveTypes, 10, 10, 2); + + SetSpriteInvisibility(i, TRUE); + } +} + + // u32 value is re-used, but passed as a bool that's TRUE if national dex is enabled static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) { @@ -4088,20 +4386,20 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) const u8 *category; const u8 *description; - if (newEntry) - PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(1, gText_PokedexRegistration, 0xF0), 0); + // if (newEntry) + // PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(1, gText_PokedexRegistration, 0xF0), 0); if (value == 0) value = NationalToHoennOrder(num); else value = num; ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); - PrintInfoScreenText(str, 0x60, 0x19); + PrintInfoScreenTextWhite(str, 123, 17); //HGSS_Ui natNum = NationalPokedexNumToSpecies(num); if (natNum) name = gSpeciesNames[natNum]; else name = sText_TenDashes2; - PrintInfoScreenText(name, 0x84, 0x19); + PrintInfoScreenTextWhite(name, 157, 17); //HGSS_Ui if (owned) { CopyMonCategoryText(num, str2); @@ -4111,24 +4409,33 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) { category = gText_5MarksPokemon; } - PrintInfoScreenText(category, 0x64, 0x29); - PrintInfoScreenText(gText_HTHeight, 0x60, 0x39); - PrintInfoScreenText(gText_WTWeight, 0x60, 0x49); + PrintInfoScreenText(category, 123, 31); //HGSS_Ui + PrintInfoScreenText(gText_HTHeight, 155, 64); //HGSS_Ui + PrintInfoScreenText(gText_WTWeight, 155, 77); //HGSS_Ui if (owned) { - PrintMonHeight(gPokedexEntries[num].height, 0x81, 0x39); - PrintMonWeight(gPokedexEntries[num].weight, 0x81, 0x49); + PrintMonHeight(gPokedexEntries[num].height, 180, 64); //HGSS_Ui + PrintMonWeight(gPokedexEntries[num].weight, 180, 77); //HGSS_Ui } else { - PrintInfoScreenText(gText_UnkHeight, 0x81, 0x39); - PrintInfoScreenText(gText_UnkWeight, 0x81, 0x49); + PrintInfoScreenText(gText_UnkHeight, 180, 64); //HGSS_Ui + PrintInfoScreenText(gText_UnkWeight, 180, 77); //HGSS_Ui } if (owned) + { description = gPokedexEntries[num].description; + } else description = gExpandedPlaceholder_PokedexDescription; - PrintInfoScreenText(description, GetStringCenterAlignXOffset(1, description, 0xF0), 0x5F); + PrintInfoScreenText(description, GetStringCenterAlignXOffset(1, description, 0xF0), 93); //HGSS_Ui + + //Type Icon(s) //HGSS_Ui + if (owned && !newEntry) + { + description = gPokedexEntries[num].description; + PrintCurrentSpeciesTypeInfo(); //HGSS_Ui + } } static void PrintMonHeight(u16 height, u8 left, u8 top) @@ -4652,13 +4959,31 @@ static u16 CreateSizeScreenTrainerPic(u16 species, s16 x, s16 y, s8 paletteSlot) return CreateTrainerPicSprite(species, TRUE, x, y, paletteSlot, 0xFFFF); } -static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 type1, u8 type2) + +bool8 SpeciesCanLearnLvlUpMove(u16 species, u16 move) //Move search PokedexPlus HGSS_Ui +{ + u16 j; + for (j = 0; j < MAX_LEVEL_UP_MOVES && gLevelUpLearnsets[species][j] != LEVEL_UP_END; j++) + { + if (move == (gLevelUpLearnsets[species][j] & LEVEL_UP_MOVE_ID)) + { + return TRUE; + } + } + return FALSE; +} + + +static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 type1, u8 type2) // ,u16 move) { u16 species; - u16 i; + u16 i,j; u16 resultsCount; u8 types[2]; + u8 tutorMoveId, tmMoveId; //PokedexPlus HGSS_Ui + u16 move = 0xFFFF; + CreatePokedexList(dexMode, order); for (i = 0, resultsCount = 0; i < NATIONAL_DEX_COUNT; i++) @@ -4753,6 +5078,66 @@ static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 t sPokedexView->pokemonListCount = resultsCount; } + // Search by move + if (move != 0xFFFF) + { + //Calc tutor move ID + tutorMoveId = 0xFF; + for (i = 0; i < TUTOR_MOVE_COUNT; i++) + { + if(move == gTutorMoves[i]) + { + tutorMoveId = i; + break; + } + } + //Calc tm move ID + tmMoveId = 0xFF; + for (i = 0; i < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; i++) + { + if(move == ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + i)) + { + tmMoveId = (ITEM_TM01_FOCUS_PUNCH + i); + break; + } + } + + for (i = 0, resultsCount = 0; i < sPokedexView->pokemonListCount; i++) + { + species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum); + + //LevelUp + if (SpeciesCanLearnLvlUpMove(species, move)) + { + sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; + resultsCount++; + continue; + } + //TMHM + if(CanSpeciesLearnTMHM(species, tmMoveId)) + { + sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; + resultsCount++; + continue; + } + //Tutor + if(CanLearnTutorMove(species, tutorMoveId)) + { + sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; + resultsCount++; + continue; + } + //EGGs + if(SpeciesCanLearnEggMove(species, move)) + { + sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; + resultsCount++; + continue; + } + } + sPokedexView->pokemonListCount = resultsCount; + } + if (sPokedexView->pokemonListCount != 0) { for (i = sPokedexView->pokemonListCount; i < NATIONAL_DEX_COUNT; i++) @@ -5631,3 +6016,838 @@ static void ClearSearchParameterBoxText(void) { ClearSearchMenuRect(144, 8, 96, 96); } + + + + + +//PokedexPlus HGSS_Ui Stats Page +#define tMonSpriteId data[4] +static void Task_LoadStatsScreen(u8 taskId) +{ + switch (gMain.state) + { + case 0: + default: + if (!gPaletteFade.active) + { + u16 r2; + + sPokedexView->currentPage = STATS_SCREEN; + gPokedexVBlankCB = gMain.vblankCallback; + SetVBlankCallback(NULL); + r2 = 0; + if (gTasks[taskId].data[1] != 0) + r2 += DISPCNT_OBJ_ON; + if (gTasks[taskId].data[2] != 0) + r2 |= DISPCNT_BG1_ON; + ResetOtherVideoRegisters(r2); + gMain.state = 1; + } + break; + case 1: + DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexStatsScreen_Tilemap, 0, 0); + FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); + PutWindowTilemap(WIN_INFO); + // PutWindowTilemap(WIN_FOOTPRINT); + // PrintFootprint(WIN_FOOTPRINT, sPokedexListItem->dexNum); + // CopyWindowToVram(WIN_FOOTPRINT, 2); + gMain.state++; + break; + case 2: + LoadScreenSelectBarMain(0xD); + LoadPokedexBgPalette(sPokedexView->isSearchResults); + gMain.state++; + break; + case 3: + sPokedexView->typeIconSpriteIds[0] = 0xFF; + sPokedexView->typeIconSpriteIds[1] = 0xFF; + CreateTypeIconSprites(); + // sMonSummaryScreen->splitIconSpriteId = 0xFF; //Physical/Special Split from BE + // LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); //Physical/Special Split from BE + // LoadCompressedSpriteSheet(&sSpriteSheet_SplitIcons); //Physical/Special Split from BE + // LoadSpritePalette(&sSpritePal_SplitIcons); //Physical/Special Split from BE + gMain.state++; + break; + case 4: + sPokedexView->moveSelected = 0; + sPokedexView->moveMax = 0; + sPokedexView->numEggMoves = 0; + sPokedexView->numLevelUpMoves = 0; + sPokedexView->numTMHMMoves = 0; + if(CalculateMoves()) + gMain.state++; + break; + case 5: + if (gTasks[taskId].data[1] == 0) + { + //Icon + FreeMonIconPalettes(); //Free space for new pallete + LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 17, 31, 4, 0, TRUE); //Create pokemon sprite + gSprites[gTasks[taskId].data[4]].oam.priority = 0; + } + gMain.state++; + break; + case 6: + gTasks[taskId].data[5] = 0; + PrintMonStats(taskId, sPokedexListItem->dexNum, sPokedexView->dexMode == DEX_MODE_HOENN ? FALSE : TRUE, sPokedexListItem->owned, 0); + PrintMonStatsToggle(taskId); + if (!sPokedexListItem->owned) + LoadPalette(gPlttBufferUnfaded + 1, 0x31, 0x1E); + CopyWindowToVram(WIN_INFO, 3); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + gMain.state++; + break; + case 7: + { + u32 preservedPalettes = 0; + + if (gTasks[taskId].data[2] != 0) + preservedPalettes = 0x14; // each bit represents a palette index + if (gTasks[taskId].data[1] != 0) + preservedPalettes |= (1 << (gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum + 16)); + BeginNormalPaletteFade(~preservedPalettes, 0, 16, 0, RGB_BLACK); + SetVBlankCallback(gPokedexVBlankCB); + gMain.state++; + } + break; + case 8: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + HideBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 9: + if (!gPaletteFade.active) + gMain.state++; + break; + case 10: + gMain.state++; + break; + case 11: + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 1; + gTasks[taskId].func = Task_HandleStatsScreenInput; + gMain.state = 0; + break; + } +} +static void FreeStatsScreenWindowAndBgBuffers(void) +{ + void *tilemapBuffer; + + FreeAllWindowBuffers(); + tilemapBuffer = GetBgTilemapBuffer(0); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(1); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(2); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(3); + if (tilemapBuffer) + Free(tilemapBuffer); +} +static void Task_HandleStatsScreenInput(u8 taskId) +{ + // gTasks[taskId].data[5] = 0; + if (JOY_NEW(A_BUTTON)) + { + PlaySE(SE_DEX_PAGE); + if (gTasks[taskId].data[5] == 0) + gTasks[taskId].data[5] = 1; + else + gTasks[taskId].data[5] = 0; + PrintMonStatsToggle(taskId); + DestroyMoveIcon(taskId); + PrintMoveNameAndInfo(taskId, TRUE); + } + if (JOY_NEW(B_BUTTON)) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_ExitStatsScreen; + PlaySE(SE_PC_OFF); + return; + } + + //Change moves + if (JOY_REPEAT(DPAD_UP) && sPokedexView->moveSelected > 0) + { + sPokedexView->moveSelected -= 1; + PlaySE(SE_SELECT); + DestroyMoveIcon(taskId); + PrintMoveNameAndInfo(taskId, FALSE); + } + if (JOY_REPEAT(DPAD_DOWN) && sPokedexView->moveSelected < sPokedexView->moveMax -1 ) + { + sPokedexView->moveSelected = sPokedexView->moveSelected + 1; + PlaySE(SE_SELECT); + DestroyMoveIcon(taskId); + PrintMoveNameAndInfo(taskId, FALSE); + } + + //Switch screens + if ((JOY_NEW(DPAD_LEFT) || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) + { + sPokedexView->selectedScreen = INFO_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromStatsScreen; + PlaySE(SE_PIN); + } + + if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) + { + if (!sPokedexListItem->owned) + PlaySE(SE_FAILURE); + else + { + sPokedexView->selectedScreen = AREA_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 2; + gTasks[taskId].func = Task_SwitchScreensFromStatsScreen; + PlaySE(SE_PIN); + } + } + +} +#define ITEM_TAG 0xFDF3 +static void DestroyMoveIcon(u8 taskId) +{ + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon +} +static bool8 CalculateMoves(void) +{ + //Moves + u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + u8 numEggMoves = GetEggMovesSpecies(species, sStatsMovesEgg); + u8 numLevelUpMoves = GetLevelUpMovesBySpecies(species, sStatsMovesLevelUp); + u8 numTMHMMoves; + u8 numTutorMoves = 0; + u16 movestotal; + u8 i,j; + + // sTutorLearnsets + for (i=0; imoveMax = movestotal; + + sPokedexView->numEggMoves = numEggMoves; + sPokedexView->numLevelUpMoves = numLevelUpMoves; + sPokedexView->numTMHMMoves = numTMHMMoves; + sPokedexView->numTutorMoves = numTutorMoves; + + return TRUE; +} +static void PrintMoveNameAndInfo(u8 taskId, bool8 toggle) +{ + u8 numEggMoves = sPokedexView->numEggMoves; + u8 numLevelUpMoves = sPokedexView->numLevelUpMoves; + u8 numTMHMMoves = sPokedexView->numTMHMMoves; + u8 numTutorMoves = sPokedexView->numTutorMoves; + + u8 selected = sPokedexView->moveSelected; + u8 total = sPokedexView->moveMax; + + u16 move; + u16 item; + + u8 moves_x = 101; + u8 moves_y = 19; + + u8 level = 0; + + u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + + //Contest + u8 contest_i, contest_effectValue, contest_appeal, contest_jam; + + //Clear space + if (!toggle) + FillWindowPixelRect(0, PIXEL_FILL(0), moves_x-1, moves_y, 139, 78); + else + FillWindowPixelRect(0, PIXEL_FILL(0), moves_x-1, moves_y+29, 139, 55); + + //Calculate and retrieve correct move from the arrays + if (selected < numEggMoves) + { + move = sStatsMovesEgg[sPokedexView->moveSelected]; + StringCopy(gStringVar3, gMoveNames[move]); + StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); + PrintInfoScreenTextSmall(gText_ThreeDashes, moves_x + 113, moves_y + 9); + item = ITEM_LUCKY_EGG; + } + else if (selected < (numEggMoves + numLevelUpMoves)) + { + move = sStatsMovesLevelUp[sPokedexView->moveSelected - numEggMoves]; + StringCopy(gStringVar3, gMoveNames[move]); + StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); + //Calculate level of the move + while (((gLevelUpLearnsets[species][(selected-numEggMoves)] & LEVEL_UP_MOVE_LV) != (level << 9)) && level < 0xFF) + { + level++; + if (gLevelUpLearnsets[species][(selected-numEggMoves)] == LEVEL_UP_END) + level = 0xFF; + } + ConvertIntToDecimalStringN(gStringVar1, level, STR_CONV_MODE_LEFT_ALIGN, 3); //Move learn lvl + PrintInfoScreenTextSmall(gText_Stats_MoveLevel, moves_x + 113, moves_y + 3); //Level text + PrintInfoScreenTextSmall(gStringVar1, moves_x + 113, moves_y + 14); //Print level + item = ITEM_EXP_SHARE; + } + else if (selected < (numEggMoves + numLevelUpMoves + numTMHMMoves)) + { + move = sStatsMovesTMHM[sPokedexView->moveSelected - numEggMoves - numLevelUpMoves]; + StringCopy(gStringVar3, gMoveNames[move]); + StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); + CopyItemName(sStatsMovesTMHM_ID[(selected-numEggMoves-numLevelUpMoves)], gStringVar1); //TM name + PrintInfoScreenTextSmall(gStringVar1, moves_x + 113, moves_y + 9); + item = sStatsMovesTMHM_ID[(selected-numEggMoves-numLevelUpMoves)]; + } + else if (selected < (numEggMoves + numLevelUpMoves + numTMHMMoves + numTutorMoves)) + { + move = sStatsMovesTutor[sPokedexView->moveSelected - numEggMoves - numLevelUpMoves - numTMHMMoves]; + StringCopy(gStringVar3, gMoveNames[move]); + StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); + PrintInfoScreenTextSmall(gText_ThreeDashes, moves_x + 113, moves_y + 9); + item = ITEM_TEACHY_TV; + } + else + { + StringCopy(gStringVar4, gText_CommunicationError); + item = ITEM_MASTER_BALL; + } + + + //Move name and description + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 20); + PrintInfoScreenTextSmall(gStringVar3, moves_x, moves_y + 17); //Name + if (gTasks[taskId].data[5] == 0) + PrintInfoScreenTextSmall(gStringVar4, moves_x, moves_y + 34); + else + PrintInfoScreenTextSmall(gContestEffectDescriptionPointers[gContestMoves[move].effect], moves_x, moves_y + 34); + + + //Egg/TM/Level/Tutor Item Icon + gTasks[taskId].data[3] = AddItemIconSprite(ITEM_TAG, ITEM_TAG, item); + gSprites[gTasks[taskId].data[3]].pos2.x = 203; + gSprites[gTasks[taskId].data[3]].pos2.y = 39; + gSprites[gTasks[taskId].data[3]].oam.priority = 0; + + //Moves selected from move max + ConvertIntToDecimalStringN(gStringVar1, (selected+1), STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar2, total, STR_CONV_MODE_RIGHT_ALIGN, 3); + StringExpandPlaceholders(gStringVar1, gText_Stats_MoveSelectedMax); + PrintInfoScreenTextSmallWhite(gStringVar1, moves_x-1, moves_y+1); + + if (gTasks[taskId].data[5] == 0) + { + //Power + PrintInfoScreenTextSmall(gText_Power, moves_x + 3, moves_y + 64); + if (gBattleMoves[move].power < 2) + StringCopy(gStringVar1, gText_ThreeDashes); + else + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(gStringVar1, moves_x + 48, moves_y + 64); + //Accuracy + PrintInfoScreenTextSmall(gText_Accuracy2, moves_x + 69, moves_y + 64); + if (gBattleMoves[move].accuracy == 0) + StringCopy(gStringVar1, gText_ThreeDashes); + else + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].accuracy, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(gStringVar1, moves_x + 117, moves_y + 64); + } + else + { + //Appeal + PrintInfoScreenTextSmall(gText_Appeal, moves_x + 3, moves_y + 64); + contest_appeal = 0; + contest_effectValue = gContestEffects[gContestMoves[move].effect].appeal; + if (contest_effectValue != 0xFF) + contest_effectValue /= 10; + for (contest_i = 0; contest_i < 8; contest_i++) + { + if (contest_effectValue != 0xFF && contest_i < contest_effectValue) + contest_appeal += 1; + } + ConvertIntToDecimalStringN(gStringVar1, contest_appeal, STR_CONV_MODE_RIGHT_ALIGN, 1); + StringCopy(gStringVar2, gText_PlusSymbol); + StringAppend(gStringVar2, gStringVar1); + PrintInfoScreenTextSmall(gStringVar2, moves_x + 48, moves_y + 64); + + //Jam + PrintInfoScreenTextSmall(gText_Jam, moves_x + 69, moves_y + 64); + contest_jam = 0; + contest_effectValue = gContestEffects[gContestMoves[move].effect].jam; + if (contest_effectValue != 0xFF) + contest_effectValue /= 10; + for (contest_i = 0; contest_i < 8; contest_i++) + { + if (contest_effectValue != 0xFF && contest_i < contest_effectValue) + contest_jam += 1; + } + ConvertIntToDecimalStringN(gStringVar1, contest_jam, STR_CONV_MODE_RIGHT_ALIGN, 1); + StringCopy(gStringVar2, gText_Stats_Minus); + StringAppend(gStringVar2, gStringVar1); + PrintInfoScreenTextSmall(gStringVar2, moves_x + 122, moves_y + 64); + } + + //Draw move type icon + if (gTasks[taskId].data[5] == 0) + { + SetTypeIconPosAndPal(gBattleMoves[move].type, moves_x + 50, moves_y+1, 0); + SetSpriteInvisibility(1, TRUE); + } + else + { + SetTypeIconPosAndPal(NUMBER_OF_MON_TYPES + gContestMoves[move].contestCategory, moves_x + 50, moves_y+1, 1); + SetSpriteInvisibility(0, TRUE); + } + + + //Physical/Special Split from BE + // DestroySplitIcon(); + // ShowSplitIcon(GetBattleMoveSplit(move)); +} +// u32 value is re-used, but passed as a bool that's TRUE if national dex is enabled +static void PrintMonStats(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry) //HGSS_Ui +{ + u8 str[16]; + u8 str2[32]; + u8 strEV[25]; + u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + u16 natNum; + u8 evVal; + const u8 *category; + const u8 *description; + const u8 *strEVtype; + + u8 gender_x, gender_y; + + u8 base_i = 0; + u8 base_offset = 11; + u8 base_x = 8; + u8 base_y = 52; + + //Name + PrintInfoScreenTextSmall(gSpeciesNames[species], 38, 16); + + //Number + if (value == 0) + value = NationalToHoennOrder(num); + else + value = num; + ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); + PrintInfoScreenTextSmall(str, 38, 26); + + //Gender ratio //MON_GENDERLESS == 0xFF + gender_x = 38; + gender_y = 36; + switch (gBaseStats[species].genderRatio) + { + case 0: + PrintInfoScreenTextSmall(gText_Stats_Gender_0, gender_x, gender_y); + break; + case 31: + PrintInfoScreenTextSmall(gText_Stats_Gender_12_5, gender_x, gender_y); + break; + case 63: + PrintInfoScreenTextSmall(gText_Stats_Gender_25, gender_x, gender_y); + break; + case 127: + PrintInfoScreenTextSmall(gText_Stats_Gender_50, gender_x, gender_y); + break; + case 191: + PrintInfoScreenTextSmall(gText_Stats_Gender_75, gender_x, gender_y); + break; + case 223: + PrintInfoScreenTextSmall(gText_Stats_Gender_87_5, gender_x, gender_y); + break; + case 254: + PrintInfoScreenTextSmall(gText_Stats_Gender_100, gender_x, gender_y); + break; + default: + PrintInfoScreenTextSmall(gText_ThreeDashes, gender_x, gender_y); + break; + } + + + //Moves + PrintMoveNameAndInfo(taskId, FALSE); + +} +static void PrintMonStatsToggle(u8 taskId) +{ + u8 base_x = 8; + u8 base_x_offset = 70; + u8 base_offset = 11; + u8 base_x_first_row = 23; + u8 base_x_second_row = 43; + u8 base_i = 0; + u8 base_y = 52; + u32 align_x; + u8 total_x = 93; + u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + u8 strEV[25]; + u8 strBase[14]; + u8 abilities_x = 101; + u8 abilities_y = 99; + u8 ability0; + + //Clear old text + FillWindowPixelRect(0, PIXEL_FILL(0), base_x, base_y, 90, 100); //bottom stats + FillWindowPixelRect(0, PIXEL_FILL(0), abilities_x, 99, 130, 58); //abilities + + + //Base stats + if (gTasks[taskId].data[5] == 0) + { + PrintInfoScreenTextSmall(gText_Stats_HP, base_x, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseHP, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + + PrintInfoScreenTextSmall(gText_Stats_Speed, base_x+base_x_second_row, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpeed, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); + + base_i++; + PrintInfoScreenTextSmall(gText_Stats_Attack, base_x, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + + PrintInfoScreenTextSmall(gText_Stats_SpAtk, base_x+base_x_second_row, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); + + base_i++; + PrintInfoScreenTextSmall(gText_Stats_Defense, base_x, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + + PrintInfoScreenTextSmall(gText_Stats_SpDef, base_x+base_x_second_row, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); + base_i++; + } + else //EV increses + { + PrintInfoScreenTextSmall(gText_Stats_EVHP, base_x, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_HP, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + + PrintInfoScreenTextSmall(gText_Stats_EVSpeed, base_x+base_x_second_row, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Speed, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); + + base_i++; + PrintInfoScreenTextSmall(gText_Stats_EVAttack, base_x, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Attack, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + + PrintInfoScreenTextSmall(gText_Stats_EVSpAtk, base_x+base_x_second_row, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_SpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); + + base_i++; + PrintInfoScreenTextSmall(gText_Stats_EVDefense, base_x, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Defense, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + + PrintInfoScreenTextSmall(gText_Stats_EVSpDef, base_x+base_x_second_row, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_SpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); + base_i++; + } + + + base_y = 86; + base_i = 0; + + if (gTasks[taskId].data[5] == 0) + { + //Exp + PrintInfoScreenTextSmall(gText_Stats_Exp, base_x, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(gStringVar1, gBaseStats[species].expYield, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(gStringVar1, base_x + base_x_offset, base_y + base_offset*base_i); + base_i++; + + //friendship + PrintInfoScreenTextSmall(gText_Stats_Friendship, base_x, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strEV, gBaseStats[species].friendship, STR_CONV_MODE_RIGHT_ALIGN, 3); + align_x = GetStringRightAlignXOffset(0, strEV, total_x); + PrintInfoScreenTextSmall(strEV, align_x, base_y + base_offset*base_i); + base_i++; + + //Egg cycles + if (gBaseStats[species].eggGroup1 == EGG_GROUP_UNDISCOVERED || gBaseStats[species].eggGroup2 == EGG_GROUP_UNDISCOVERED) + { + PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_ThreeDashes, 78, base_y + base_offset*base_i); + } + else + { + PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(strEV, gBaseStats[species].eggCycles, STR_CONV_MODE_RIGHT_ALIGN, 2); + align_x = GetStringRightAlignXOffset(0, strEV, total_x); + PrintInfoScreenTextSmall(strEV, align_x, base_y + base_offset*base_i); + } + base_i++; + + //Catch rate + PrintInfoScreenTextSmall(gText_Stats_Catch, base_x, base_y + base_offset*base_i); + ConvertIntToDecimalStringN(gStringVar1, gBaseStats[species].catchRate, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(gStringVar1, base_x + base_x_offset, base_y + base_offset*base_i); + base_i++; + + //Growth rate + PrintInfoScreenTextSmall(gText_Stats_Growthrate, base_x, base_y + base_offset*base_i); + switch (gBaseStats[species].growthRate) + { + case GROWTH_MEDIUM_FAST: + StringCopy(strEV, gText_Stats_MEDIUM_FAST); + break; + case GROWTH_ERRATIC: + StringCopy(strEV, gText_Stats_ERRATIC); + break; + case GROWTH_FLUCTUATING: + StringCopy(strEV, gText_Stats_FLUCTUATING); + break; + case GROWTH_MEDIUM_SLOW: + StringCopy(strEV, gText_Stats_MEDIUM_SLOW); + break; + case GROWTH_FAST: + StringCopy(strEV, gText_Stats_FAST); + break; + case GROWTH_SLOW: + StringCopy(strEV, gText_Stats_SLOW); + break; + default: + break; + } + align_x = GetStringRightAlignXOffset(0, strEV, total_x); + PrintInfoScreenTextSmall(strEV, align_x, base_y + base_offset*base_i); + } + else + { + base_i = 0; + //Egg group 1 + PrintInfoScreenTextSmall(gText_Stats_eggGroup_g1, base_x, base_y + base_offset*base_i); + switch (gBaseStats[species].eggGroup1) + { + case EGG_GROUP_MONSTER : + StringCopy(gStringVar1, gText_Stats_eggGroup_MONSTER); + break; + case EGG_GROUP_WATER_1 : + StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_1); + break; + case EGG_GROUP_BUG : + StringCopy(gStringVar1, gText_Stats_eggGroup_BUG); + break; + case EGG_GROUP_FLYING : + StringCopy(gStringVar1, gText_Stats_eggGroup_FLYING); + break; + case EGG_GROUP_FIELD : + StringCopy(gStringVar1, gText_Stats_eggGroup_FIELD); + break; + case EGG_GROUP_FAIRY : + StringCopy(gStringVar1, gText_Stats_eggGroup_FAIRY); + break; + case EGG_GROUP_GRASS : + StringCopy(gStringVar1, gText_Stats_eggGroup_GRASS); + break; + case EGG_GROUP_HUMAN_LIKE : + StringCopy(gStringVar1, gText_Stats_eggGroup_HUMAN_LIKE); + break; + case EGG_GROUP_WATER_3 : + StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_3); + break; + case EGG_GROUP_MINERAL : + StringCopy(gStringVar1, gText_Stats_eggGroup_MINERAL); + break; + case EGG_GROUP_AMORPHOUS : + StringCopy(gStringVar1, gText_Stats_eggGroup_AMORPHOUS); + break; + case EGG_GROUP_WATER_2 : + StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_2); + break; + case EGG_GROUP_DITTO : + StringCopy(gStringVar1, gText_Stats_eggGroup_DITTO); + break; + case EGG_GROUP_DRAGON : + StringCopy(gStringVar1, gText_Stats_eggGroup_DRAGON); + break; + case EGG_GROUP_UNDISCOVERED: + StringCopy(gStringVar1, gText_Stats_eggGroup_UNDISCOVERED); + break; + } + PrintInfoScreenTextSmall(gStringVar1, base_x + 37, base_y + base_offset*base_i); + base_i++; + + //Egg group 2 + PrintInfoScreenTextSmall(gText_Stats_eggGroup_g2, base_x, base_y + base_offset*base_i); + switch (gBaseStats[species].eggGroup2) + { + case EGG_GROUP_MONSTER : + StringCopy(gStringVar1, gText_Stats_eggGroup_MONSTER); + break; + case EGG_GROUP_WATER_1 : + StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_1); + break; + case EGG_GROUP_BUG : + StringCopy(gStringVar1, gText_Stats_eggGroup_BUG); + break; + case EGG_GROUP_FLYING : + StringCopy(gStringVar1, gText_Stats_eggGroup_FLYING); + break; + case EGG_GROUP_FIELD : + StringCopy(gStringVar1, gText_Stats_eggGroup_FIELD); + break; + case EGG_GROUP_FAIRY : + StringCopy(gStringVar1, gText_Stats_eggGroup_FAIRY); + break; + case EGG_GROUP_GRASS : + StringCopy(gStringVar1, gText_Stats_eggGroup_GRASS); + break; + case EGG_GROUP_HUMAN_LIKE : + StringCopy(gStringVar1, gText_Stats_eggGroup_HUMAN_LIKE); + break; + case EGG_GROUP_WATER_3 : + StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_3); + break; + case EGG_GROUP_MINERAL : + StringCopy(gStringVar1, gText_Stats_eggGroup_MINERAL); + break; + case EGG_GROUP_AMORPHOUS : + StringCopy(gStringVar1, gText_Stats_eggGroup_AMORPHOUS); + break; + case EGG_GROUP_WATER_2 : + StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_2); + break; + case EGG_GROUP_DITTO : + StringCopy(gStringVar1, gText_Stats_eggGroup_DITTO); + break; + case EGG_GROUP_DRAGON : + StringCopy(gStringVar1, gText_Stats_eggGroup_DRAGON); + break; + case EGG_GROUP_UNDISCOVERED: + StringCopy(gStringVar1, gText_Stats_eggGroup_UNDISCOVERED); + break; + } + PrintInfoScreenTextSmall(gStringVar1, base_x + 37, base_y + base_offset*base_i); + } + + + + //Abilitie(s) + if (gTasks[taskId].data[5] == 0) + { + ability0 = gBaseStats[species].abilities[0]; + PrintInfoScreenTextSmallWhite(gAbilityNames[ability0], abilities_x, abilities_y); + PrintInfoScreenTextSmall(gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); + + if (gBaseStats[species].abilities[1] != ABILITY_NONE) + { + PrintInfoScreenTextSmallWhite(gAbilityNames[gBaseStats[species].abilities[1]], abilities_x, abilities_y + 30); + PrintInfoScreenTextSmall(gAbilityDescriptionPointers[gBaseStats[species].abilities[1]], abilities_x, abilities_y + 44); + } + // }else{ //For PokemonExpansion + // ability0 = gBaseStats[species].abilityHidden; + // PrintInfoScreenTextSmallWhite(gAbilityNames[ability0], abilities_x, abilities_y); + // PrintInfoScreenTextSmall(gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); + } + +} +static void Task_SwitchScreensFromStatsScreen(u8 taskId) +{ + if (!gPaletteFade.active) + { + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + switch (sPokedexView->screenSwitchState) + { + case 1: + gTasks[taskId].func = Task_LoadAreaScreen; + break; + case 2: + gTasks[taskId].func = Task_LoadCryScreen; + break; + default: + gTasks[taskId].func = Task_LoadInfoScreen; + break; + } + } +} +static void Task_ExitStatsScreen(u8 taskId) +{ + if (!gPaletteFade.active) + { + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + FreeInfoScreenWindowAndBgBuffers(); + DestroyTask(taskId); + } +} + +//Physical/Special Split from BE +// static u8 ShowSplitIcon(u32 split) +// { +// if (sPokedexListItem->splitIconSpriteId == 0xFF) +// sPokedexListItem->splitIconSpriteId = CreateSprite(&sSpriteTemplate_SplitIcons, 48, 129, 0); + +// gSprites[sPokedexListItem->splitIconSpriteId].invisible = FALSE; +// StartSpriteAnim(&gSprites[sPokedexListItem->splitIconSpriteId], split); +// return sPokedexListItem->splitIconSpriteId; +// } + +// static void DestroySplitIcon(void) +// { +// if (sPokedexListItem->splitIconSpriteId != 0xFF) +// DestroySprite(&gSprites[sPokedexListItem->splitIconSpriteId]); +// sPokedexListItem->splitIconSpriteId = 0xFF; +// } + diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index 7a3b38dc2a11..656c952208a7 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -8,6 +8,7 @@ #include "menu.h" #include "overworld.h" #include "palette.h" +#include "pokedex.h" #include "pokedex_area_screen.h" #include "region_map.h" #include "roamer.h" @@ -726,10 +727,20 @@ static void Task_HandlePokedexAreaScreenInput(u8 taskId) if (JOY_NEW(B_BUTTON)) { gTasks[taskId].data[1] = 1; - PlaySE(SE_PC_OFF); + PlaySE(SE_DEX_PAGE); + } + else if (JOY_NEW(DPAD_LEFT) || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + { + gTasks[taskId].data[1] = 1; + PlaySE(SE_DEX_PAGE); } else if (JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) { + if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(sPokedexAreaScreen->species), FLAG_GET_CAUGHT)) + { + PlaySE(SE_FAILURE); + return; + } gTasks[taskId].data[1] = 2; PlaySE(SE_DEX_PAGE); } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 012e133e66ed..3d97e77c0037 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -851,13 +851,13 @@ static const union AnimCmd *const sSpriteAnimTable_MoveTypes[NUMBER_OF_MON_TYPES sSpriteAnim_CategoryTough, }; -static const struct CompressedSpriteSheet sSpriteSheet_MoveTypes = +const struct CompressedSpriteSheet sSpriteSheet_MoveTypes = { .data = gMoveTypes_Gfx, .size = (NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT) * 0x100, .tag = TAG_MOVE_TYPES }; -static const struct SpriteTemplate sSpriteTemplate_MoveTypes = +const struct SpriteTemplate sSpriteTemplate_MoveTypes = { .tileTag = TAG_MOVE_TYPES, .paletteTag = TAG_MOVE_TYPES, @@ -3752,7 +3752,7 @@ static void CreateMoveTypeIcons(void) } } -static void SetTypeSpritePosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) +void SetTypeSpritePosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) //HGSS_Ui { struct Sprite *sprite = &gSprites[sMonSummaryScreen->spriteIds[spriteArrayId]]; StartSpriteAnim(sprite, typeId); diff --git a/src/strings.c b/src/strings.c index fe5051d71151..f8b3ede6de6c 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1817,3 +1817,66 @@ const u8 gText_Answer[] = _("ANSWER"); const u8 gText_PokeBalls[] = _("POKé BALLS"); const u8 gText_Berry[] = _("BERRY"); const u8 gText_Berries[] = _("BERRIES"); + + +//HGSS_Ui PokedexPlus +const u8 gText_Stats_EV[] = _("EV: "); +const u8 gText_Stats_EV_HP[] = _("HP {PLUS} "); +const u8 gText_Stats_EV_Attack[] = _("ATTACK {PLUS} "); +const u8 gText_Stats_EV_Defense[] = _("DEFENSE {PLUS} "); +const u8 gText_Stats_EV_Speed[] = _("SPEED {PLUS} "); +const u8 gText_Stats_EV_SpAtk[] = _("SP. ATK {PLUS} "); +const u8 gText_Stats_EV_SpDef[] = _("SP. DEF {PLUS}"); +const u8 gText_Stats_HP[] = _("HP "); +const u8 gText_Stats_Attack[] = _("ATK "); +const u8 gText_Stats_Defense[] = _("DEF "); +const u8 gText_Stats_Speed[] = _("SPE "); +const u8 gText_Stats_SpAtk[] = _("SP.A "); +const u8 gText_Stats_SpDef[] = _("SP.D "); +const u8 gText_Stats_EVHP[] = _("EV HP"); +const u8 gText_Stats_EVAttack[] = _("EV ATK"); +const u8 gText_Stats_EVDefense[] = _("EV DEF"); +const u8 gText_Stats_EVSpeed[] = _("EV SPE"); +const u8 gText_Stats_EVSpAtk[] = _("EV SP.A"); +const u8 gText_Stats_EVSpDef[] = _("EV SP.D"); +const u8 gText_Stats_MoveSelectedMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); +const u8 gText_Stats_MoveLevel[] = _("LVL"); +const u8 gText_Stats_Gender_0[] = _("♂"); +const u8 gText_Stats_Gender_12_5[] = _("♀ 1/7 ♂"); //_("♀ 12.5 / 87.5 ♂"); +const u8 gText_Stats_Gender_25[] = _("♀ 1/3 ♂"); //_("♀ 25 / 75 ♂"); +const u8 gText_Stats_Gender_50[] = _("♀ 1/1 ♂"); //_("♀ 50 / 50 ♂"); +const u8 gText_Stats_Gender_75[] = _("♀ 3/1 ♂"); //_("♀ 75 / 25 ♂"); +const u8 gText_Stats_Gender_87_5[] = _("♀ 7/1 ♂"); +const u8 gText_Stats_Gender_100[] = _("♀"); +const u8 gText_Stats_Catch[] = _("CATCH RATE: "); +const u8 gText_Stats_Exp[] = _("EXPERIENCE: "); +const u8 gText_Stats_EggCycles[] = _("EGG CYCLES: "); +const u8 gText_Stats_Growthrate[] = _("GROW: "); +const u8 gText_Stats_Friendship[] = _("FRIENDSHIP:" ); +const u8 gText_Stats_MEDIUM_FAST[] = _("MED. FAST"); +const u8 gText_Stats_ERRATIC[] = _("ERRATIC"); +const u8 gText_Stats_FLUCTUATING[] = _("FLUCTUATING"); +const u8 gText_Stats_MEDIUM_SLOW[] = _("MED. SLOW"); +const u8 gText_Stats_FAST[] = _("FAST"); +const u8 gText_Stats_SLOW[] = _("SLOW"); +const u8 gText_Stats_ContestHeart[] = _("H"); +const u8 gText_Stats_Minus[] = _("-"); +const u8 gText_Stats_eggGroup_g1[] = _("EGG G1:"); +const u8 gText_Stats_eggGroup_g2[] = _("EGG G2:"); +const u8 gText_Stats_eggGroup_MONSTER[] = _("MONSTER"); +const u8 gText_Stats_eggGroup_WATER_1[] = _("WATER 1"); +const u8 gText_Stats_eggGroup_BUG[] = _("BUG"); +const u8 gText_Stats_eggGroup_FLYING[] = _("FLYING"); +const u8 gText_Stats_eggGroup_FIELD[] = _("FIELD"); +const u8 gText_Stats_eggGroup_FAIRY[] = _("FAIR"); +const u8 gText_Stats_eggGroup_GRASS[] = _("GRASS"); +const u8 gText_Stats_eggGroup_HUMAN_LIKE[] = _("HUMAN LIKE"); +const u8 gText_Stats_eggGroup_WATER_3[] = _("WATER 3"); +const u8 gText_Stats_eggGroup_MINERAL[] = _("MINERAL"); +const u8 gText_Stats_eggGroup_AMORPHOUS[] = _("AMORPHOUS"); +const u8 gText_Stats_eggGroup_WATER_2[] = _("WATER 2"); +const u8 gText_Stats_eggGroup_DITTO[] = _("DITTO"); +const u8 gText_Stats_eggGroup_DRAGON[] = _("DRAGON"); +const u8 gText_Stats_eggGroup_UNDISCOVERED[]= _("---"); +const u8 gText_Dex_SEEN[] = _("SEEN"); +const u8 gText_Dex_OWN[] = _("OWN"); From 38f36955fd7a94c5f00a9565f681dcd2d981d37b Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sun, 8 Nov 2020 10:53:52 -0300 Subject: [PATCH 02/88] =?UTF-8?q?Support=20for=20Battle=20Engine=20and=20P?= =?UTF-8?q?ok=C3=A9mon=20Expansion=20(#1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Changed comment method to avoid conflict with Pokemon Expansion. * Changes the way level up moves are read if it detects either Battle Engine or Pokémon Expansion. * Support for Battle Engine's spit icon. --- src/pokedex.c | 324 +++++++++++++++++++++++++++----------------------- 1 file changed, 178 insertions(+), 146 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index fbc925d7536e..4035c2b23aaa 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -40,6 +40,9 @@ #include "constants/party_menu.h" #include "constants/rgb.h" #include "constants/songs.h" +#ifdef BATTLE_ENGINE +#include "battle_util.h" +#endif enum { @@ -193,7 +196,9 @@ struct PokedexView u8 typeIconSpriteIds[2]; //HGSS_Ui u16 moveSelected; //HGSS_Ui u8 moveMax; //HGSS_Ui - // u8 splitIconSpriteId; //HGSS_Ui Physical/Special Split from BE + #ifdef BATTLE_ENGINE + u8 splitIconSpriteId; //HGSS_Ui Physical/Special Split from BE + #endif u8 numEggMoves; u8 numLevelUpMoves; u8 numTMHMMoves; @@ -343,61 +348,64 @@ static void PrintMonStatsToggle(u8 taskId); static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top); static void PrintInfoScreenTextSmall(const u8* str, u8 left, u8 top); static void PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top); -// static u8 ShowSplitIcon(u32 split); //Physical/Special Split from BE -// static void DestroySplitIcon(void); //Physical/Special Split from BE + +#ifdef BATTLE_ENGINE +static u8 ShowSplitIcon(u32 split); //Physical/Special Split from BE +static void DestroySplitIcon(void); //Physical/Special Split from BE //Physical/Special Split from BE -// #define TAG_SPLIT_ICONS 30004 -// static const u16 sSplitIcons_Pal[] = INCBIN_U16("graphics/interface/split_icons.gbapal"); -// static const u32 sSplitIcons_Gfx[] = INCBIN_U32("graphics/interface/split_icons.4bpp.lz"); -// static const struct OamData sOamData_SplitIcons = -// { -// .size = SPRITE_SIZE(16x16), -// .shape = SPRITE_SHAPE(16x16), -// .priority = 0, -// }; -// static const struct CompressedSpriteSheet sSpriteSheet_SplitIcons = -// { -// .data = sSplitIcons_Gfx, -// .size = 16*16*3/2, -// .tag = TAG_SPLIT_ICONS, -// }; -// static const struct SpritePalette sSpritePal_SplitIcons = -// { -// .data = sSplitIcons_Pal, -// .tag = TAG_SPLIT_ICONS -// }; -// static const union AnimCmd sSpriteAnim_SplitIcon0[] = -// { -// ANIMCMD_FRAME(0, 0), -// ANIMCMD_END -// }; -// static const union AnimCmd sSpriteAnim_SplitIcon1[] = -// { -// ANIMCMD_FRAME(4, 0), -// ANIMCMD_END -// }; -// static const union AnimCmd sSpriteAnim_SplitIcon2[] = -// { -// ANIMCMD_FRAME(8, 0), -// ANIMCMD_END -// }; -// static const union AnimCmd *const sSpriteAnimTable_SplitIcons[] = -// { -// sSpriteAnim_SplitIcon0, -// sSpriteAnim_SplitIcon1, -// sSpriteAnim_SplitIcon2, -// }; -// static const struct SpriteTemplate sSpriteTemplate_SplitIcons = -// { -// .tileTag = TAG_SPLIT_ICONS, -// .paletteTag = TAG_SPLIT_ICONS, -// .oam = &sOamData_SplitIcons, -// .anims = sSpriteAnimTable_SplitIcons, -// .images = NULL, -// .affineAnims = gDummySpriteAffineAnimTable, -// .callback = SpriteCallbackDummy -// }; +#define TAG_SPLIT_ICONS 30004 +static const u16 sSplitIcons_Pal[] = INCBIN_U16("graphics/interface/split_icons.gbapal"); +static const u32 sSplitIcons_Gfx[] = INCBIN_U32("graphics/interface/split_icons.4bpp.lz"); +static const struct OamData sOamData_SplitIcons = +{ + .size = SPRITE_SIZE(16x16), + .shape = SPRITE_SHAPE(16x16), + .priority = 0, +}; +static const struct CompressedSpriteSheet sSpriteSheet_SplitIcons = +{ + .data = sSplitIcons_Gfx, + .size = 16*16*3/2, + .tag = TAG_SPLIT_ICONS, +}; +static const struct SpritePalette sSpritePal_SplitIcons = +{ + .data = sSplitIcons_Pal, + .tag = TAG_SPLIT_ICONS +}; +static const union AnimCmd sSpriteAnim_SplitIcon0[] = +{ + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; +static const union AnimCmd sSpriteAnim_SplitIcon1[] = +{ + ANIMCMD_FRAME(4, 0), + ANIMCMD_END +}; +static const union AnimCmd sSpriteAnim_SplitIcon2[] = +{ + ANIMCMD_FRAME(8, 0), + ANIMCMD_END +}; +static const union AnimCmd *const sSpriteAnimTable_SplitIcons[] = +{ + sSpriteAnim_SplitIcon0, + sSpriteAnim_SplitIcon1, + sSpriteAnim_SplitIcon2, +}; +static const struct SpriteTemplate sSpriteTemplate_SplitIcons = +{ + .tileTag = TAG_SPLIT_ICONS, + .paletteTag = TAG_SPLIT_ICONS, + .oam = &sOamData_SplitIcons, + .anims = sSpriteAnimTable_SplitIcons, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; +#endif // const rom data @@ -3554,61 +3562,63 @@ static void Task_HandleInfoScreenInput(u8 taskId) PlaySE(SE_PC_OFF); return; } - // if (JOY_NEW(A_BUTTON)) - // { - // switch (sPokedexView->selectedScreen) - // { - // case AREA_SCREEN: - // BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 16, RGB_BLACK); - // sPokedexView->screenSwitchState = 1; - // gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; - // PlaySE(SE_PIN); - // break; - // case CRY_SCREEN: - // BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - // sPokedexView->screenSwitchState = 2; - // gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; - // PlaySE(SE_PIN); - // break; - // case SIZE_SCREEN: - // if (!sPokedexListItem->owned) - // { - // PlaySE(SE_FAILURE); - // } - // else - // { - // BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - // sPokedexView->screenSwitchState = 3; - // gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; - // PlaySE(SE_PIN); - // } - // break; - // case CANCEL_SCREEN: - // BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); - // gTasks[taskId].func = Task_ExitInfoScreen; - // PlaySE(SE_PC_OFF); - // break; - // } - // return; - // } - // if ((JOY_NEW(DPAD_LEFT) - // || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) - // && sPokedexView->selectedScreen > 0) - // { - // sPokedexView->selectedScreen--; - // HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); - // PlaySE(SE_DEX_PAGE); - // return; - // } - // if ((JOY_NEW(DPAD_RIGHT) - // || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) - // && sPokedexView->selectedScreen < CANCEL_SCREEN) - // { - // sPokedexView->selectedScreen++; - // HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); - // PlaySE(SE_DEX_PAGE); - // return; - // } + /* + if (JOY_NEW(A_BUTTON)) + { + switch (sPokedexView->selectedScreen) + { + case AREA_SCREEN: + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 16, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; + PlaySE(SE_PIN); + break; + case CRY_SCREEN: + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 2; + gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; + PlaySE(SE_PIN); + break; + case SIZE_SCREEN: + if (!sPokedexListItem->owned) + { + PlaySE(SE_FAILURE); + } + else + { + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 3; + gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; + PlaySE(SE_PIN); + } + break; + case CANCEL_SCREEN: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].func = Task_ExitInfoScreen; + PlaySE(SE_PC_OFF); + break; + } + return; + } + if (((JOY_NEW(DPAD_LEFT)) + || ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + && sPokedexView->selectedScreen > 0) + { + sPokedexView->selectedScreen--; + HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); + PlaySE(SE_DEX_PAGE); + return; + } + if (((JOY_NEW(DPAD_RIGHT)) + || ((JOY_NEW(R_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + && sPokedexView->selectedScreen < CANCEL_SCREEN) + { + sPokedexView->selectedScreen++; + HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); + PlaySE(SE_DEX_PAGE); + return; + } + */ if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) { @@ -4963,13 +4973,23 @@ static u16 CreateSizeScreenTrainerPic(u16 species, s16 x, s16 y, s8 paletteSlot) bool8 SpeciesCanLearnLvlUpMove(u16 species, u16 move) //Move search PokedexPlus HGSS_Ui { u16 j; - for (j = 0; j < MAX_LEVEL_UP_MOVES && gLevelUpLearnsets[species][j] != LEVEL_UP_END; j++) - { - if (move == (gLevelUpLearnsets[species][j] & LEVEL_UP_MOVE_ID)) + #if defined (BATTLE_ENGINE) || defined (POKEMON_EXPANSION) + for (j = 0; j < MAX_LEVEL_UP_MOVES && gLevelUpLearnsets[species][j].move != LEVEL_UP_END; j++) { - return TRUE; + if (move == (gLevelUpLearnsets[species][j].move & LEVEL_UP_MOVE_ID)) + { + return TRUE; + } } - } + #else + for (j = 0; j < MAX_LEVEL_UP_MOVES && gLevelUpLearnsets[species][j] != LEVEL_UP_END; j++) + { + if (move == (gLevelUpLearnsets[species][j] & LEVEL_UP_MOVE_ID)) + { + return TRUE; + } + } + #endif return FALSE; } @@ -6064,10 +6084,12 @@ static void Task_LoadStatsScreen(u8 taskId) sPokedexView->typeIconSpriteIds[0] = 0xFF; sPokedexView->typeIconSpriteIds[1] = 0xFF; CreateTypeIconSprites(); - // sMonSummaryScreen->splitIconSpriteId = 0xFF; //Physical/Special Split from BE - // LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); //Physical/Special Split from BE - // LoadCompressedSpriteSheet(&sSpriteSheet_SplitIcons); //Physical/Special Split from BE - // LoadSpritePalette(&sSpritePal_SplitIcons); //Physical/Special Split from BE + #ifdef BATTLE_ENGINE + sPokedexView->splitIconSpriteId = 0xFF; //Physical/Special Split from BE + LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); //Physical/Special Split from BE + LoadCompressedSpriteSheet(&sSpriteSheet_SplitIcons); //Physical/Special Split from BE + LoadSpritePalette(&sSpritePal_SplitIcons); //Physical/Special Split from BE + #endif gMain.state++; break; case 4: @@ -6316,13 +6338,18 @@ static void PrintMoveNameAndInfo(u8 taskId, bool8 toggle) move = sStatsMovesLevelUp[sPokedexView->moveSelected - numEggMoves]; StringCopy(gStringVar3, gMoveNames[move]); StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); - //Calculate level of the move - while (((gLevelUpLearnsets[species][(selected-numEggMoves)] & LEVEL_UP_MOVE_LV) != (level << 9)) && level < 0xFF) - { - level++; - if (gLevelUpLearnsets[species][(selected-numEggMoves)] == LEVEL_UP_END) - level = 0xFF; - } + + #if defined (BATTLE_ENGINE) || defined (POKEMON_EXPANSION) + level = gLevelUpLearnsets[species][(selected-numEggMoves)].level; + #else + //Calculate level of the move + while (((gLevelUpLearnsets[species][(selected-numEggMoves)] & LEVEL_UP_MOVE_LV) != (level << 9)) && level < 0xFF) + { + level++; + if (gLevelUpLearnsets[species][(selected-numEggMoves)] == LEVEL_UP_END) + level = 0xFF; + } + #endif ConvertIntToDecimalStringN(gStringVar1, level, STR_CONV_MODE_LEFT_ALIGN, 3); //Move learn lvl PrintInfoScreenTextSmall(gText_Stats_MoveLevel, moves_x + 113, moves_y + 3); //Level text PrintInfoScreenTextSmall(gStringVar1, moves_x + 113, moves_y + 14); //Print level @@ -6382,6 +6409,11 @@ static void PrintMoveNameAndInfo(u8 taskId, bool8 toggle) else ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintInfoScreenTextSmall(gStringVar1, moves_x + 48, moves_y + 64); + //Physical/Special Split from BE + #ifdef BATTLE_ENGINE + DestroySplitIcon(); + ShowSplitIcon(GetBattleMoveSplit(move)); + #endif //Accuracy PrintInfoScreenTextSmall(gText_Accuracy2, moves_x + 69, moves_y + 64); if (gBattleMoves[move].accuracy == 0) @@ -6392,6 +6424,10 @@ static void PrintMoveNameAndInfo(u8 taskId, bool8 toggle) } else { + #ifdef BATTLE_ENGINE + DestroySplitIcon(); + gSprites[sPokedexView->splitIconSpriteId].invisible = TRUE; + #endif //Appeal PrintInfoScreenTextSmall(gText_Appeal, moves_x + 3, moves_y + 64); contest_appeal = 0; @@ -6436,11 +6472,6 @@ static void PrintMoveNameAndInfo(u8 taskId, bool8 toggle) SetTypeIconPosAndPal(NUMBER_OF_MON_TYPES + gContestMoves[move].contestCategory, moves_x + 50, moves_y+1, 1); SetSpriteInvisibility(0, TRUE); } - - - //Physical/Special Split from BE - // DestroySplitIcon(); - // ShowSplitIcon(GetBattleMoveSplit(move)); } // u32 value is re-used, but passed as a bool that's TRUE if national dex is enabled static void PrintMonStats(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry) //HGSS_Ui @@ -6834,20 +6865,21 @@ static void Task_ExitStatsScreen(u8 taskId) } //Physical/Special Split from BE -// static u8 ShowSplitIcon(u32 split) -// { -// if (sPokedexListItem->splitIconSpriteId == 0xFF) -// sPokedexListItem->splitIconSpriteId = CreateSprite(&sSpriteTemplate_SplitIcons, 48, 129, 0); - -// gSprites[sPokedexListItem->splitIconSpriteId].invisible = FALSE; -// StartSpriteAnim(&gSprites[sPokedexListItem->splitIconSpriteId], split); -// return sPokedexListItem->splitIconSpriteId; -// } - -// static void DestroySplitIcon(void) -// { -// if (sPokedexListItem->splitIconSpriteId != 0xFF) -// DestroySprite(&gSprites[sPokedexListItem->splitIconSpriteId]); -// sPokedexListItem->splitIconSpriteId = 0xFF; -// } +#ifdef BATTLE_ENGINE +static u8 ShowSplitIcon(u32 split) +{ + if (sPokedexView->splitIconSpriteId == 0xFF) + sPokedexView->splitIconSpriteId = CreateSprite(&sSpriteTemplate_SplitIcons, 139, 90, 0); + gSprites[sPokedexView->splitIconSpriteId].invisible = FALSE; + StartSpriteAnim(&gSprites[sPokedexView->splitIconSpriteId], split); + return sPokedexView->splitIconSpriteId; +} + +static void DestroySplitIcon(void) +{ + if (sPokedexView->splitIconSpriteId != 0xFF) + DestroySprite(&gSprites[sPokedexView->splitIconSpriteId]); + sPokedexView->splitIconSpriteId = 0xFF; +} +#endif From 86412bfe9106d7a966cb1b70a29f76b92f159e4e Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sun, 8 Nov 2020 16:22:03 +0100 Subject: [PATCH 03/88] fixed tileset and stats screen bug --- graphics/pokedex/info_screen.bin | Bin 1280 -> 1280 bytes graphics/pokedex/menu.png | Bin 1542 -> 1714 bytes .../pokedex/screen_select_bar_submenu.bin | Bin 192 -> 192 bytes graphics/pokedex/stats_screen.bin | Bin 1280 -> 1280 bytes src/pokedex.c | 15 ++++++--------- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/graphics/pokedex/info_screen.bin b/graphics/pokedex/info_screen.bin index 4db95aa345fd318091634f62ebec70c6e1730b36..4fe214f815cf099e578e1803291f4f8903e344bb 100644 GIT binary patch literal 1280 zcmd6k*G@t~6h)T}Y+&z*V(%SMuLAbod++uCKfuEwB#;buV(yExGCTWa&+IuMX^k}0N{(R`FyqJl|d%rP(9tP7fVSi})bxccQ z8*Bf}zuan%RHtn2G=I+nkAj;%@yv^mtFM}W%Q-Xqe4BswnE&vY_jZljjKqE~w(?Tn$)kcVR!gSC{gf6=2p;uglKKdD8 zkRkEIj4;ZWxN#w@MT7I6fVE)jPjq4^}sBn6YMu*pzM7Eo*+89d_Bv^E$`ce_tnakmq&jym@lzi5_bHh+|F+oLc*zan1#oTybsS z#@avgFSptw)hU}h&ENCDqu{1bJo6&t>Z|78a?Z>?-{#*v=07~euJP%y%@l$2ZqPBF^vFML5f|*mC8&vNMkQQQ%Jl@$Gs0e zE+sl~>|J1qD5NCv=)Oo^x~ia9``44Xuv7_P?R9|N^KZsvgZOcld4QOObfPHngzkZ_4 zqpir)sOnh&=Mq483jl+ueE3LDgV?$2dp#ro$BTD206-(@Y%mStNN0cVEdXFh1OP>B z7h|nzX+-oc19+$afCv#V3T5j7!PyKTk6DXEQ~{%s0YAs3@=E(K*|SDC7_L1^ur-FF z5&*7Hf(;PB5pKK?ccAa?NMT^#BS#^s7xVzu{|ddT)x0Hq!(QoF!k&w0VUT=J96iL6YzIS<-UKZgsZ~CHE)ff=q9yk zu!6q5UXxqQ5%1^0z{@iM^W>8i0b@L#2~a+mZtMnEujc@6>t+g&os#^wB>Y7H z(c!-V2q&KfxcPs2^ECr(t_8Ruc(tvLm#E-O8#+~~gYN_{TjLtI*0Lks7j{Qer5M0+ zlz?UgXvzR-5sbZe0iy&GHiF8>-K~%P-#-AfAql}W3Nl_bT2z-R2PA8^T>!NEa9F^p zIRYGWz$SZ#0Nje>*#Q8M=E>5z959!F6&i8B<(+gJ0m6UpD(D>nxqV6iHOi58WFjFV zEi(>}Kp`C*yKw|SD+AzQypdcu#l?hl3=m2V$xR2tZW;k5n;-x*i5Sj_yBH%o{MY5( z!R>UUN)?`V_!WJjFtHB|wv_^*sVg{w@MGSxo&A0VQ`80mCRLy+oG-yrFqP=_eh# znj!rH>h&N7D)rLvyB8dH5+FM@rvRI40dwch1H^v}slCqt@akH?>^wm7ik_%Io5`hs zjrjo*=;fyY6a#t%^X^BLy+T0m>n!$<%>p{Z<1aXf+mJBcIX4CznU0CVENn=e?lORD z4`|Q}qbOeaFRz=J?fP`L44747@8g;W-il<2=YAQmnE-0uQE%(B0P}vV!m_X)@{(8t zXqA6$?`XViJrs}61?ajjj7JwqfR~E^(gFBDz0?YI%Z9INS`)&omjWiN zGa0vKs(ZW^&=mn1f0NNHV-FWKdzwxYKwSb1_@l0VGLMjWKvvgb_0+33V}4Bl4X*Pl z&xiDbQXK(sNT^N%ID}UM@b+LH9w7xa?yVbsJ-J7!0MG>$c!u3Ki^YOEzb?L+SMGM~ zu-DV;0>1XTSoEq`Dqex;#QFx}K7zugC%^z-3*z?K?>ZSkNdSr)0bX1dwr3^4KgbKsNh5$S QrT_o{07*qoM6N<$g42h>x&QzG delta 1393 zcmV-%1&;c%4TcPm7aeE>0{{R3%LnBb00007bV*G`2jmL|7YP{1eG3zjG?RZSNkl8<;5XbonMB?HqK7*i5eOSO-9|EsyV;cglQr!uzTwdBV_VF==K&MhSAEY=# z(T^@*d148&5;PCQG*BvKeBR31u&hl0Rf<=I} zz3ZK|c7lJ@|8VmAllQ^XFT{V_Jr)XZcu4?DfZkfi0O*N5Vj*u8AXoyx`w=ir=tu+v zf7+k+J_IcA7A^u73h+XJ4gnTCa7zIA%z$ua&bi`26+k`*&tu0J5WoZAU79^(+~-(P zsBZ>LQw9jNtYI|^vCrtXmcDmm25`QR+=k^mOR*s|h@&w_wE%!AkpO>`v7B%wH4tJm zfV&C+xG)1mDzlttB{l;{u@I1mL%^(Lz_TFBNgNS&hTjQ2*moUeB><+v5RhVk z01inPV}S1MLjp`yK#{UBVHgEM_>?dwzDq-eM$igl;Oy9mNt066r<_0QBE5y4o)aKX z+Y;avAgXmrGlBrPW*mRh!l9BU(7ZoGfteKVM8X{?^w(24s3k7c7CiI(Ni(G^@3qeZ zx|DvXYsfjjX8X3zM%R|@9)1*f)3I!eS@#Y=G3(;I7oEOkhrd? z1#sZGs0;ut+ZXta`N44ssH^)9z$JOgh7r*In}EL|>fT_bkcxjQy?@&B)|kw-`I8&w%%<6yV1j0jsRZhJbTE-UzTUnI7=UW03^Ew z(AcOuiQEW4x&RO52v^E^*Zq;e>)-I&ZPQCLU^T`@1M% z$Z`3P05M881MYvn-hWkq-Dd&QNRlF8H+*CWQ|Gb9=mxP7JoMev!f%@zqT&5wZ=@%4 z4xkMZ&=!EU4w$nr=H69+K0rpm-8^Z)etiSr(;)=6l**#|Xfn zIu1%1D*%i#0M4}Y17J#Dar1#x15^aZEYq2G{so{2xq&Yi>&V6Qop_kf3bgYdb%)s8 zrNX2!s_(=rRy4OJyU2&`x6Xyw92!ok5CHznTP9X91bETdJM2Y;$ujYv-UQ$|5PMnz z^duw1$%=nUyzA70lFLOM1Cl?v=yVE`JyrpDtV^%9*^y4}%@lK3X{rD`+0wXRc$i3W zl$|^sM1X6m0Niw^X%bS?T@BFcVSVQz0HCIK6|hq|^?QuLSf)2w6)+Y_xx$UbeFCuK zeSw40FB%>jhV*MFx1;E2?Q6@=UataDBYf8We87KvLh?^P36NEB3c#Wb9|y#`$9Ds0 zvbl|^CQKhomHR`x9=jh<{ROiB2VYxfYSWhKcu=@Y8xkLP8NlTXSS}o!_~vappLXMM zw+i4!5AscIs>{ByQWpSsC7_9Q%}s#X+PAFZC9w+F(S@`@1y)qo0pkMTn!eH>C6a*X zm)U=QlWuMxfY9)@v2Zj|7`JI?O-QqnbH%l$)hY-;c{*xnN~cLB0aArV0PulO=Q3b^ z6Yd-mU=@HDl{6;=AdeNMR0b@he7pp3Ia0j<=slpruf?|kuL3ZZfMcTolq*9CXs!WT z1z54{3mH>}Sy@k!e`?p21Y5``0CRm4$7@NefR&E40HEas_aZ<=d-woA1?zYnP?@DA zpt%ZI&HuY|5zxlD;Tu{l00000NkvXXu0mjf=LUQ9 diff --git a/graphics/pokedex/screen_select_bar_submenu.bin b/graphics/pokedex/screen_select_bar_submenu.bin index 178ba4e0a2b8dac7b76228614837fbb78811a4eb..5b94416834b46c2014a531fb26868ee3808d983d 100644 GIT binary patch literal 192 zcmbu$Hx9y307St-vgC%G4V4>mHn$?@aC$ymfi0e<*_JgFdzw@GA(iE`#h{09OT(F=>Rjtj^#Z__$9BIa7N-3ip4_@L);D{s-l~hqp4c8?f zC6OeKNjgq4DWsA{I_8ss-?%~rSGk6dOtQ%4gd`s~sHKj28YG|O6sO6Nl*<|N$j8rF z#W&JKNOV)Vm7BQ5ZSK%4(!GVdguJctn%<`Pb^=Nrdtd7>OhoO$+(%URxUY?Rp!kOl z{39M8P$!oRYkt$aT>F=3BW)&3x7NQ$@xAoXFM6Wf%6&X#V6Sdh%rS#JV~FSSnm(-f z7ut+=p8(-~D~;Cm^iuI74t%Wj>vVt;S6<)ge$M{uHp~fLQS3da*NpOpw<2dBbM5~w z=DzIS=6BqcpJ0+H(X^w_DBkJ(-)r|SdIR+oQTul~|5-j9qFGn|W6X2aPx_PV`set} zyvW%X6u%g=&ld`ebGWNO@k=c8m2Z6K2P^z!m0wa><2UCI(YoS;6tcl4f7s$L+x+9d PRD$eqkqaVcFH-z26B_7v literal 1280 zcmaiyOH&g;6otRCW)YQ@peV2k;7SlQ>{3NSQ3bADru+w>8y_1$5j7FzrHQ;W8bt98 zqCC_9f{G}AirYPzN++3_%&9qZrmMfceY^S)HC7M3T;>V^4s(Q~R7eWYM?VAH)aqnJq7hl%;}W~YUm^Ov^N0-v}TDAgiMd}dkX?O%NBe|7E4 zsja>%zWgd{tc$*R`ghHHo&OKx-sNwgnNqrcuk+8cQASx`e$(|_&6D2p-TzOv*%5jB sFU|jUt@DS7)sDX+n&0Iwd!l0hM`s!R*L;)?qM~Bor<*R3w_niw0p{N2-~a#s diff --git a/src/pokedex.c b/src/pokedex.c index 4035c2b23aaa..dec98443470e 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -355,8 +355,8 @@ static void DestroySplitIcon(void); //Physical/Special Split from BE //Physical/Special Split from BE #define TAG_SPLIT_ICONS 30004 -static const u16 sSplitIcons_Pal[] = INCBIN_U16("graphics/interface/split_icons.gbapal"); -static const u32 sSplitIcons_Gfx[] = INCBIN_U32("graphics/interface/split_icons.4bpp.lz"); +// static const u16 sSplitIcons_Pal[] = INCBIN_U16("graphics/interface/split_icons.gbapal"); +// static const u32 sSplitIcons_Gfx[] = INCBIN_U32("graphics/interface/split_icons.4bpp.lz"); static const struct OamData sOamData_SplitIcons = { .size = SPRITE_SIZE(16x16), @@ -6070,9 +6070,10 @@ static void Task_LoadStatsScreen(u8 taskId) CopyToBgTilemapBuffer(3, gPokedexStatsScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); - // PutWindowTilemap(WIN_FOOTPRINT); - // PrintFootprint(WIN_FOOTPRINT, sPokedexListItem->dexNum); - // CopyWindowToVram(WIN_FOOTPRINT, 2); + CopyWindowToVram(WIN_INFO, 3); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); gMain.state++; break; case 2: @@ -6118,10 +6119,6 @@ static void Task_LoadStatsScreen(u8 taskId) PrintMonStatsToggle(taskId); if (!sPokedexListItem->owned) LoadPalette(gPlttBufferUnfaded + 1, 0x31, 0x1E); - CopyWindowToVram(WIN_INFO, 3); - CopyBgTilemapBufferToVram(1); - CopyBgTilemapBufferToVram(2); - CopyBgTilemapBufferToVram(3); gMain.state++; break; case 7: From 094a0b8774426101b833660635e5a56a665435c6 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 14 Nov 2020 12:39:40 +0100 Subject: [PATCH 04/88] More BattleEngine and PokemonExpansion compatibility --- src/pokedex.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index dec98443470e..58efe19bbf2e 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1501,6 +1501,9 @@ static const struct SearchOptionText sDexSearchTypeOptions[] = {gText_DexEmptyString, gTypeNames[TYPE_ICE]}, {gText_DexEmptyString, gTypeNames[TYPE_DRAGON]}, {gText_DexEmptyString, gTypeNames[TYPE_DARK]}, + #ifdef BATTLE_ENGINE + {gText_DexEmptyString, gTypeNames[TYPE_FAIRY]}, + #endif {}, }; @@ -1535,6 +1538,9 @@ static const u8 sDexSearchTypeIds[] = TYPE_ICE, TYPE_DRAGON, TYPE_DARK, + #ifdef BATTLE_ENGINE + TYPE_FAIRY, + #endif }; // Number pairs are the task data for tracking the cursor pos and scroll offset of each option list @@ -6810,12 +6816,16 @@ static void PrintMonStatsToggle(u8 taskId) { PrintInfoScreenTextSmallWhite(gAbilityNames[gBaseStats[species].abilities[1]], abilities_x, abilities_y + 30); PrintInfoScreenTextSmall(gAbilityDescriptionPointers[gBaseStats[species].abilities[1]], abilities_x, abilities_y + 44); - } - // }else{ //For PokemonExpansion - // ability0 = gBaseStats[species].abilityHidden; - // PrintInfoScreenTextSmallWhite(gAbilityNames[ability0], abilities_x, abilities_y); - // PrintInfoScreenTextSmall(gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); + } } + #if defined (BATTLE_ENGINE) && defined (POKEMON_EXPANSION) + else //Hidden abilities + { + ability0 = gBaseStats[species].abilityHidden; + PrintInfoScreenTextSmallWhite(gAbilityNames[ability0], abilities_x, abilities_y); + PrintInfoScreenTextSmall(gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); + } + #endif } static void Task_SwitchScreensFromStatsScreen(u8 taskId) From 04bf06a7c0647474e457ffdbbeed601cfa2b9fdf Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sun, 15 Nov 2020 16:30:59 +0100 Subject: [PATCH 05/88] Removed unnecessary check for BE --- src/pokedex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokedex.c b/src/pokedex.c index 58efe19bbf2e..b6bbba63d169 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -6818,7 +6818,7 @@ static void PrintMonStatsToggle(u8 taskId) PrintInfoScreenTextSmall(gAbilityDescriptionPointers[gBaseStats[species].abilities[1]], abilities_x, abilities_y + 44); } } - #if defined (BATTLE_ENGINE) && defined (POKEMON_EXPANSION) + #ifdef POKEMON_EXPANSION else //Hidden abilities { ability0 = gBaseStats[species].abilityHidden; From fbbc6048488295f26779280b11dc74875e86c637 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Thu, 4 Feb 2021 13:48:32 +0100 Subject: [PATCH 06/88] Added evolution screen! Improved BE compatibility --- graphics/pokedex/cry_screen.bin | Bin 1280 -> 1344 bytes graphics/pokedex/evo_tileset.bin | Bin 0 -> 1344 bytes graphics/pokedex/evo_tileset.png | Bin 0 -> 762 bytes graphics/pokedex/info_screen.bin | Bin 1280 -> 1344 bytes graphics/pokedex/menu.png | Bin 1714 -> 1741 bytes graphics/pokedex/menu_rest.png | Bin 1075 -> 1119 bytes .../pokedex/screen_select_bar_submenu.bin | Bin 192 -> 192 bytes graphics/pokedex/size_screen.bin | Bin 1280 -> 1344 bytes graphics/pokedex/stats_screen.bin | Bin 1280 -> 1344 bytes include/graphics.h | 2 + include/strings.h | 35 ++ src/graphics.c | 2 + src/pokedex.c | 486 +++++++++++++++++- src/strings.c | 35 ++ 14 files changed, 554 insertions(+), 6 deletions(-) create mode 100644 graphics/pokedex/evo_tileset.bin create mode 100644 graphics/pokedex/evo_tileset.png diff --git a/graphics/pokedex/cry_screen.bin b/graphics/pokedex/cry_screen.bin index 411311b5313139a87af1c53a3a1e5a6bb8660dc6..5e5087ae0d98e733bd966a56f0812553de05762a 100644 GIT binary patch literal 1344 zcmeH@$5O*U5JVql0Fh1325fT9K?KWyzygfH1QE>t{|2koL9!(-E?uZ%yQ&Y<(>2}O zM2cpF7Fub;pq&mn>7tt+dP%EUAN>q4$PmMfFv=L?OpuaEyf;OLX=a!uOO83_SzwVR zmRVtyH8opjgH5*BW`|w&*yn&lGIFH-$C#WboQBxsOd;S})!#HZ*Zw>fg*sSrL4c_4 z?OSrG{a4s^?gF-46CkR4ep_y|zlam@I}%P5)jidb+eG|#4d1^{afNNEM)8$L||EItG1697MDm21LH2(o; Cv0@hh literal 1280 zcmeH@S5v}J6ofzVDzSpSU;*sC#TL{cK@r6g3;zFq;<+~u2_(KSyg1|CnVp^4vvc;` z9#Zt8=%b%B76S}2Br44?BaD(ED|(D^CYTg8#WXX_l2UW%H&2cQ7FlAMJOzrZuqrCg z8tZJZ$(HDCcGzW4)IJ9sazsuYoBRnjr-HKx+nftRZgqo6n+ub_#G%v%M_myj?(2C+ zU7P$3ZdZ%1xfGDw8#z~C@&ErGvstY&Pn!bYBwf`>&!j7psU(0w z5R(vL4u}xtkRxKmIVQo0h$TspCPS7}a-5OpoC^%IfIEs@TN`qi9{^7{AFe;tRqNA16w(^32S-3RdB`@hCvBk-GD?FWZX I`G0n$FW)1LRsaA1 literal 0 HcmV?d00001 diff --git a/graphics/pokedex/evo_tileset.png b/graphics/pokedex/evo_tileset.png new file mode 100644 index 0000000000000000000000000000000000000000..9e6df6b2833f6c05bbd79388da628aaca4734772 GIT binary patch literal 762 zcmVf?;X&Wy!IV&{8@G zifY+BThh0kVhM`l3u0E95KLmNUM{>5^Vuk9e8 zcFd8WE(1=J0fGSV9{|AXklnb7WI*%+;Qaw0!a)Rp0};oF*o_+D@9HvO5&&j}+%5q) zumOnrFk*t;;shH29j1(}1^{prfSdbvM(uOWhCc(WYYzR6*}kN6l@gZHFhJ4`12`iT z&`1995Mw`R%9K+s+h_n$Zch#~3eZOM)?_N$z5z()Q0=LS*neuK1fZbJv$l&0ppFbU zn>oz!)-^y>qRPbr{tVL1RK!@A)nExo((kke&|FK~0GzdwuIY%fa7ZMl!odhBvkYWI z7X&bN`SN7xmPMGQD>dV41AwBtRIjnK>$?F+TN^;T#yLydoe8AZ2c&u}$b`_-h#?%0 zkozfqoglnlNZHU^Bi6zBPIK{2yC0y^<n-)~=lW2J)zZCXPhW7XSbN07*qoM6N<$f?xGbeEYLoRvb%eMjwDWaGXN-3k93M#3hni|4SEp^n>KqE~w(?Tn4w9`Q+U3AkU z-+Jkzp8*CLVwe#|8DpFYCe;rxML;m+G&2NcnR8Zsk2yTSl=Ce3u&92BB|?HJms#;) z)q4IK>uks}=cd))Vw)Xy{u4z=^g0DQBE>!6jD) zuC4ul|I3Z`2zQF+R{cBfc@X^aktd#o*nCm{HD=G~{cZ1Wj{du&?|Qzg|3CVF@X43( K_x#rRyT%WU8lltx literal 1280 zcmd6k*G@t~6h)T}Y+&z*V(%SMuLAbod++uCKfuEwB#;buV(yExGCTWa&+IuMX^k}0N{(R`FyqJl|d%rP(9tP7fVSi})bxccQ z8*Bf}zuan%RHtn2G=I+nkAj;%@yv^mtFM}W%Q-Xqe4BswnE&vY_j8<;5P1%A`vtpB__4v~tIr;S9;4 zEX9A@>>v&$ivBo%q=wEikhcBrrMgkF2x!~;0Q;t_s@e(}aKOHma@rFCZGix#I^Aid zl!ZSW-WCP?m5uw9htN}S699kv#sicCbV_Li;5T6$H;0p+0KjPg0P`cjT2#aV%BF;= znzC)7IdBhLa}xlK15^l5pn)C(P+<>f+kJ7s2hfZ(m;g9U%Z4oWK0pBUBH*UrzoP%i zZ&w4XjR1@ssNWu9R1Yq4$!!w$1K2o30OU@F7CAdx7g_v9!zQ=EWD$SH4%5Q}V6Lp; zEFn*$ANM}Utq8jSfC>Qssf^L!AmfDt(4`2w8vq?>0%j-yUQsf9#tKJ(%M#99H=u+u zrBl#lC;DD^A$0p?uUdVoy;l)hRe>C4H3igWU`F6}sZNJE^aY%*Sf02r#U zfI|98N5u3c1D%cm&>?@oFX0IQP3-|3Ik3CU;wCcS)sSYA&nB1ulyTU=9bfJ*OyxZ% z>FHhedZ%RePPrc-(idIhmQ&?Z5%1fW|4WjmWt68(EFg+eh~w!BoB@O-EC8bw$a{bQ zJOvZdO=Qn^9B9r1zY7V#HiYqlu#*75kbHs9a6=x<0Ims{B6)v=&u;{vS56<)Muh5D z;pBNkuS_r6;Qv{G=YNB;upDH3_sanIGcJ1vtJ6} zL0*030r{-}Io5vzthDkLfL~Sp4S>gQkKY2Iz7oT6AQo#XE0qEU@B1PJZ07)d z3J~K`fFLJQ+Z3>v1w`AVc)J5Y_$R}-PQD-0m!*5*mt23tcK%EP?-~S{3jkO?0N~)> z{H`jr?p)>p>7k%b92fu%0`Sd01>ga69JKD(=uS_rx``7U+?!wGGw?72ipC!Y$wtM^ z@TqaIq4b8FgaCFDtB6jr060@8uF;89Jr`6dMH>k)mtM{UjO7V{!{l6X4lr*co*!y8 zAPpM4OBa6|wV9m-pdko|&BS6`F`ynl80d5)0BDwYH!ISo&*+FikyoOjzS<6m!$y%? zM*z*cavJ&09erv(evshZBmiSc_Cm-+GZphm0A)MojC9y^$UXr$dt=Dp?qa}HY(v|{ zfrk81=LG4N&~BjbYJefYJ3ceN1(4qZfQl+JX?lNtza9|I9!~zf3ILzXq-&{;3#Pvj z5EhJHT?7bUgiiS|hzE4sCO+%UG+<)cnk~1!TJ&$GNxEdHG1K3vos8ssIv7$Q#xIuai`|KE?c^Qwp z;n;uY2J0{QCAx-!@ky$=1_uKFJy%egBpAKUK?4F9*D}DQQ4oN%it5cgKt>@K0DK^# zGY<$eVHGa{DgmfDK(rN>R0N!aay19g(NmoOq@VHyMpp+Ic`e1sJd@(JxgBaLc(L0}SsEy#VMRO4X-;1ux$*fSkG(fa8zq#|{dS zDw82GQhw175zFP$4gP?`<;Sre-d?Od*4Dm!ERR+7v780u><>4aQadoX>KtI$9qWJU z?WI#kbc5g0#^K=~J{W-N27uiOMXm)@Fm<&P4gG%5!AH9bx17cR4S*U;#}3Oe{QVl5 z0NBY+XV=>pKrx4`!SXLmMgjn-)(k+CR!Iu`i_A*L0H8iKVai7lus|v`gkNiK1SneuJP%y%@l$2ZqPBF^vFML5f|*mC8&vNMkQQQ%Jl@$Gs0e zE+sl~>|J1qD5NCv=)Oo^x~ia9``44Xuv7_P?R9|N^KZsvgZOcld4QOObfPHngzkZ_4 zqpir)sOnh&=Mq483jl+ueE3LDgV?$2dp#ro$BTD206-(@Y%mStNN0cVEdXFh1OP>B z7h|nzX+-oc19+$afCv#V3T5j7!PyKTk6DXEQ~{%s0YAs3@=E(K*|SDC7_L1^ur-FF z5&*7Hf(;PB5pKK?ccAa?NMT^#BS#^s7xVzu{|ddT)x0Hq!(QoF!k&w0VUT=J96iL6YzIS<-UKZgsZ~CHE)ff=q9yk zu!6q5UXxqQ5%1^0z{@iM^W>8i0b@L#2~a+mZtMnEujc@6>t+g&os#^wB>Y7H z(c!-V2q&KfxcPs2^ECr(t_8Ruc(tvLm#E-O8#+~~gYN_{TjLtI*0Lks7j{Qer5M0+ zlz?UgXvzR-5sbZe0iy&GHiF8>-K~%P-#-AfAql}W3Nl_bT2z-R2PA8^T>!NEa9F^p zIRYGWz$SZ#0Nje>*#Q8M=E>5z959!F6&i8B<(+gJ0m6UpD(D>nxqV6iHOi58WFjFV zEi(>}Kp`C*yKw|SD+AzQypdcu#l?hl3=m2V$xR2tZW;k5n;-x*i5Sj_yBH%o{MY5( z!R>UUN)?`V_!WJjFtHB|wv_^*sVg{w@MGSxo&A0VQ`80mCRLy+oG-yrFqP=_eh# znj!rH>h&N7D)rLvyB8dH5+FM@rvRI40dwch1H^v}slCqt@akH?>^wm7ik_%Io5`hs zjrjo*=;fyY6a#t%^X^BLy+T0m>n!$<%>p{Z<1aXf+mJBcIX4CznU0CVENn=e?lORD z4`|Q}qbOeaFRz=J?fP`L44747@8g;W-il<2=YAQmnE-0uQE%(B0P}vV!m_X)@{(8t zXqA6$?`XViJrs}61?ajjj7JwqfR~E^(gFBDz0?YI%Z9INS`)&omjWiN zGa0vKs(ZW^&=mn1f0NNHV-FWKdzwxYKwSb1_@l0VGLMjWKvvgb_0+33V}4Bl4X*Pl z&xiDbQXK(sNT^N%ID}UM@b+LH9w7xa?yVbsJ-J7!0MG>$c!u3Ki^YOEzb?L+SMGM~ zu-DV;0>1XTSoEq`Dqex;#QFx}K7zugC%^z-3*z?K?>ZSkNdSr)0bX1dwr3^4KgbKsNh5$S QrT_o{07*qoM6N<$f{YZy0ssI2 diff --git a/graphics/pokedex/menu_rest.png b/graphics/pokedex/menu_rest.png index 724ef5201030e0ec5d3ba73bd8e9b45b06c34f68..e4b649c87051684f3c0b372317dd4b26fa61f9b2 100644 GIT binary patch delta 948 zcmV;l155m~2;T^hDhlNR926iD(BQv7ku;NkgGod|RCt`#m$7o&FbszI3cPEFPI`u( zuW#TC8GEe;Pu_H=siRJl#%AphshIMN9vqDdet@7TT8$lRDiWCzMSdoMpCs%Y8`0n2 z&7J0Ez%*?Gbf=pR5!VrMF@zev4@Cr=1c0|fu5$neYyhIR8t{UP zYy>NS@TfC39{|9$0DL%ZPw;*8S${XcqUI3qEc8>fF%SDN15`H*;2Ft0$wH68u}dfZ z8)Mk#Fd9IV+mh>pO4QTvTj#w;OaefEyRHD#Trd8XAP2{H-1AhNBET9z9TD(k=I|~A zc?L`X@Jz-KcD{OvraEy-%zTgoJp2G*h!3E-n$`gj+CsXfBZ|Tykz5dtw#2AaYpxQ& z(8R?PrCTT3pQS4<(WNO}oG#y?vE{o0(62T?h#JpXx;PU^8&tH|Eu>1cuWCbo!B62< zy4)aTL$5ut4xToen>N~ZK#(pk9$r072sYsVeznZJCVM|ak+S| z0kC`%z~$;gr+nx?XMk-Wo$Mct1v=S4xa~0y?l}Rx7j^;ccDpfe)^Vi(u1ER`;FeIK z;U(a!|1iLw6TmBcfH-=qWZ%4hvipBk_$bR#H%MO;`tDS4-RGr{mH_L3n<9C(dz8m= zwz~jl?s%Z*O@IT719 zqff--gBHY0k4FJs(xq~-3c%-p>dM*Jh9s5r=(f}aX9#b>$iDvx2&sLg>3b^&eIu!pW?{ZATa7+Nlc~!m(z{flQ{Z;`Vly?Di-U?8=26zLH W8#9A>289m*0000YM?#avX3Y?}H{}^MI2zUa-;or_$ni%y^^$@jL;iGMI$o=ah3L<3 zcc)YfV4gn)=*QZ*juJWQ7RuKsmjy5z0IVI_p|#c$|H}Dpu^i`xc;UJf)*@WGFOP1&Fd_ z)oA!YPFevB)m5>2gukPoM4w>NO@Jg)3^+Py#OlkIIm+bTrb7T|uJ}-MO0Z=WTf`@z z9J_Jm9{@;f_R&fJlC50?^V6}C4X!tT#vl$Jphs5#E2&H#Fq^R+BS3;cB(92p$2F-m zsDn~j9ZT1`E1XUIL^=gZCcFXq_$r;!Xx^Hk+vg^t|{kV2S9RfYe^Uu>i>C+W=vnY?hGW z!Qvs00xvX86BcTX@mTZP=k?rw`TjCb^gvID@V)}7PKe1;CzQ?{ffvz<|`LHv+a_0LbcrKWLIwX2rZ!k^k@cn^UeGy0HIM-fZT8FZEhyK35ILNw~dM) z3xHn4dc)x`{~Mt}?al#A3DEA?c^@#q)Y@74nkZ^oxg)fqXuE=5fYrpikrOblNo97{ zw|QN>*rBD^nK)`-EC5Y%DF6&&n1m_;6$(u0~~TdyIy>AK};6~CKPiUHMkw%tjqxjlY8a=0H{ar2OJhJ-v?+u d3{bfj@E0!&)PBSf7)1a8002ovPDHLkV1k->pIZO` diff --git a/graphics/pokedex/screen_select_bar_submenu.bin b/graphics/pokedex/screen_select_bar_submenu.bin index 5b94416834b46c2014a531fb26868ee3808d983d..390bcbd3f041647b5a1e2fc7a6084907100b6d6f 100644 GIT binary patch literal 192 zcmbu$H4Z`n0Km{k@)H)^ePY2~Z-u)Yoex)_Lx(1fs0ABaJ9|+FM<-`7aS2JOu%%^W y<>VC^`u=NcLjf_o9&CD$mHn$?@aC$ymfi0e<*_b@baR|OYFMMXU;j1;&lD2gKZ_w6JcEoy3pll>|=q`p^4 zb&?Q0^rGmapD+Uq5@Cp8Mi?bZOxDI2Cr*hnH{5c^Jr6wc#00t~nPQq5W|?E21r}K% z!7@o!SY=Jt*4bc_XI`jK<&`&Tyz{}9@#}1pV%LynhqTaXw#gKG)Q#`3&w(L>mCNFUvJ>Ne*gdg literal 1280 zcmds$OHTqZ7)6g#9TicxiXtk$wg@VWf`YL2fkfmXz6C|_|8M--vNU8e!^)ntxr=+! zrk$B!k`Rh1rg4~ImN~+b9Oj9zz#>bM@2GK4T~dQ4EgopIj2%`e$lPwaG z;%u|SE_>`te&mT~UL?Kp#ycN$NE*M(0V$3QX%0yXqgLBYaZK0vE*VY?SzHffm2IC& zSC1+=&J1}Ewo6{w_PLmPxDiM`X8)k~7u5d+I##aa diff --git a/graphics/pokedex/stats_screen.bin b/graphics/pokedex/stats_screen.bin index 0156472a3a2416cbffd944f1c5b907bdb2976b5e..a6eb2fd1626def8f8c422588414b94b5bc0a9b57 100644 GIT binary patch literal 1344 zcmbu7-7{5D7>A!`_KXu(Azz(bC9ZrVp}R8^O*3-crSTu2o8m@9g-}vQNFALN`HGUy zRFVpn{ytde-}{ch(WyS`o#RaFq~T93_-6%DF)WmE07u zV}uhyB*%#&niyh<;{1NC;x>0gESVHiN#hLZoF#*E zWRgWT=Otf5EpS>^ndqS$;r-?e(1M%zLEcu6cq#o^!#>z{JsQjQF)2i%h zlYF}k|AdYpJ*7}H&e#2!WBvkVr^$HnDfv4k{~SLrgu0{~b3ZS6wHG%d`krojculYP zb?=jWzjC6P$AdSZ(*3wP8<6~<4R2MyN_!}9wiYr({4D*(ELiRr5 znE$=yz0BPDIO@ocG0ue0q^(a$-md>2f?nUj*VrQOZ`c26J|3cJNB)y#U)4^3cC3Gf zFU$(r`&Y@&S?2jhj&=cOr9-qL`CKlt${Oozu*nwN T{1cH}cDPKQkiF+i{(o&3Se*5_ literal 1280 zcmaiyNlz3(7=|B`PG-Q9psc3>JgFdzw@GA(iE`#h{09OT(F=>Rjtj^#Z__$9BIa7N-3ip4_@L);D{s-l~hqp4c8?f zC6OeKNjgq4DWsA{I_8ss-?%~rSGk6dOtQ%4gd`s~sHKj28YG|O6sO6Nl*<|N$j8rF z#W&JKNOV)Vm7BQ5ZSK%4(!GVdguJctn%<`Pb^=Nrdtd7>OhoO$+(%URxUY?Rp!kOl z{39M8P$!oRYkt$aT>F=3BW)&3x7NQ$@xAoXFM6Wf%6&X#V6Sdh%rS#JV~FSSnm(-f z7ut+=p8(-~D~;Cm^iuI74t%Wj>vVt;S6<)ge$M{uHp~fLQS3da*NpOpw<2dBbM5~w z=DzIS=6BqcpJ0+H(X^w_DBkJ(-)r|SdIR+oQTul~|5-j9qFGn|W6X2aPx_PV`set} zyvW%X6u%g=&ld`ebGWNO@k=c8m2Z6K2P^z!m0wa><2UCI(YoS;6tcl4f7s$L+x+9d PRD$eqkqaVcFH-z26B_7v diff --git a/include/graphics.h b/include/graphics.h index 6c78508593f6..1ffc6e9828e3 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -3286,6 +3286,7 @@ extern const u32 gBattleTerrainPalette_StadiumWallace[]; extern const u32 gPokedexInterface_Gfx[]; extern const u16 gPokedexBgHoenn_Pal[]; extern const u32 gPokedexMenuRest_Gfx[]; +extern const u32 gPokedexEvo_Gfx[]; extern const u32 gPokedexMenuList_Gfx[]; extern const u32 gPokedexMenu_Gfx[]; extern const u8 gPokedexList_Tilemap[]; @@ -3296,6 +3297,7 @@ extern const u16 gPokedexSearchResults_Pal[]; extern const u16 gPokedexBgNational_Pal[]; extern const u8 gPokedexInfoScreen_Tilemap[]; extern const u8 gPokedexStatsScreen_Tilemap[]; +extern const u8 gPokedexEvolutionScreen_Tilemap[]; extern const u8 gPokedexCryScreen_Tilemap[]; extern const u8 gPokedexSizeScreen_Tilemap[]; extern const u8 gPokedexScreenSelectBarMain_Tilemap[]; diff --git a/include/strings.h b/include/strings.h index 5f224e2459f6..fd773e7f5243 100644 --- a/include/strings.h +++ b/include/strings.h @@ -595,6 +595,41 @@ extern const u8 gText_Stats_eggGroup_UNDISCOVERED[]; extern const u8 gText_Dex_SEEN[]; extern const u8 gText_Dex_OWN[]; +extern const u8 gText_EVO_Name[]; +extern const u8 gText_EVO_FRIENDSHIP[]; +extern const u8 gText_EVO_FRIENDSHIP_DAY[]; +extern const u8 gText_EVO_FRIENDSHIP_NIGHT[]; +extern const u8 gText_EVO_LEVEL[]; +extern const u8 gText_EVO_TRADE[]; +extern const u8 gText_EVO_TRADE_ITEM[]; +extern const u8 gText_EVO_ITEM[]; +extern const u8 gText_EVO_LEVEL_ATK_GT_DEF[]; +extern const u8 gText_EVO_LEVEL_ATK_EQ_DEF[]; +extern const u8 gText_EVO_LEVEL_ATK_LT_DEF[]; +extern const u8 gText_EVO_LEVEL_SILCOON[]; +extern const u8 gText_EVO_LEVEL_CASCOON[]; +extern const u8 gText_EVO_LEVEL_NINJASK[]; +extern const u8 gText_EVO_LEVEL_SHEDINJA[]; +extern const u8 gText_EVO_BEAUTY[]; +extern const u8 gText_EVO_LEVEL_FEMALE[]; +extern const u8 gText_EVO_LEVEL_MALE[]; +extern const u8 gText_EVO_LEVEL_NIGHT[]; +extern const u8 gText_EVO_LEVEL_DAY[]; +extern const u8 gText_EVO_LEVEL_DUSK[]; +extern const u8 gText_EVO_ITEM_HOLD_DAY[]; +extern const u8 gText_EVO_ITEM_HOLD_NIGHT[]; +extern const u8 gText_EVO_MOVE[]; +extern const u8 gText_EVO_MOVE_TYPE[]; +extern const u8 gText_EVO_MAPSEC[]; +extern const u8 gText_EVO_ITEM_MALE[]; +extern const u8 gText_EVO_ITEM_FEMALE[]; +extern const u8 gText_EVO_LEVEL_RAIN[]; +extern const u8 gText_EVO_SPECIFIC_MON_IN_PARTY[]; +extern const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[]; +extern const u8 gText_EVO_TRADE_SPECIFIC_MON[]; +extern const u8 gText_EVO_SPECIFIC_MAP[]; +extern const u8 gText_EVO_NONE[]; + // birch dex rating text extern const u8 gBirchDexRatingText_LessThan10[]; diff --git a/src/graphics.c b/src/graphics.c index 6ee521d1c543..8abc6d76fb05 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1258,6 +1258,7 @@ const u16 gPokedexCaughtScreen_Pal[] = INCBIN_U16("graphics/pokedex/caught_scree const u16 gPokedexSearchResults_Pal[] = INCBIN_U16("graphics/pokedex/search_results_bg.gbapal"); const u16 gPokedexBgNational_Pal[] = INCBIN_U16("graphics/pokedex/bg_national.gbapal"); const u32 gPokedexMenuRest_Gfx[] = INCBIN_U32("graphics/pokedex/menu_rest.4bpp.lz"); +const u32 gPokedexEvo_Gfx[] = INCBIN_U32("graphics/pokedex/evo_tileset.4bpp.lz"); const u32 gPokedexMenuList_Gfx[] = INCBIN_U32("graphics/pokedex/menu_list.4bpp.lz"); const u32 gPokedexMenu_Gfx[] = INCBIN_U32("graphics/pokedex/menu.4bpp.lz"); const u32 gPokedexInterface_Gfx[] = INCBIN_U32("graphics/pokedex/interface.4bpp.lz"); @@ -1275,6 +1276,7 @@ const u32 gPokedexScreenSelectBarSubmenu_Tilemap_Clear[] = INCBIN_U32("graphics/ // const u32 gPokedexScreenSelectBarSubmenu_Size_Tilemap[] = INCBIN_U32("graphics/pokedex/screen_select_bar_submenu_size.bin.lz"); const u32 gPokedexInfoScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/info_screen.bin.lz"); const u32 gPokedexStatsScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/stats_screen.bin.lz"); +const u32 gPokedexEvolutionScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/evo_tileset.bin.lz"); const u32 gPokedexCryScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/cry_screen.bin.lz"); const u16 gPokedexSearchMenu_Pal[] = INCBIN_U16("graphics/pokedex/search_menu.gbapal"); const u32 gPokedexSearchMenu_Gfx[] = INCBIN_U32("graphics/pokedex/search_menu.4bpp.lz"); diff --git a/src/pokedex.c b/src/pokedex.c index b6bbba63d169..b426da226cf8 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -60,6 +60,7 @@ enum { INFO_SCREEN, STATS_SCREEN, + EVO_SCREEN, AREA_SCREEN, CRY_SCREEN, SIZE_SCREEN, @@ -348,6 +349,11 @@ static void PrintMonStatsToggle(u8 taskId); static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top); static void PrintInfoScreenTextSmall(const u8* str, u8 left, u8 top); static void PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top); +static void Task_LoadEvolutionScreen(u8 taskId); +static void Task_HandleEvolutionScreenInput(u8 taskId); +static void Task_SwitchScreensFromEvolutionScreen(u8 taskId); +static void Task_ExitEvolutionScreen(u8 taskId); +static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species); #ifdef BATTLE_ENGINE static u8 ShowSplitIcon(u32 split); //Physical/Special Split from BE @@ -3910,7 +3916,7 @@ static void Task_SwitchScreensFromCryScreen(u8 taskId) gTasks[taskId].func = Task_LoadInfoScreen; break; case 2: - gTasks[taskId].func = Task_LoadStatsScreen; + gTasks[taskId].func = Task_LoadEvolutionScreen; break; case 3: gTasks[taskId].func = Task_LoadSizeScreen; @@ -6114,7 +6120,12 @@ static void Task_LoadStatsScreen(u8 taskId) //Icon FreeMonIconPalettes(); //Free space for new pallete LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 17, 31, 4, 0, TRUE); //Create pokemon sprite + #ifndef POKEMON_EXPANSION + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 17, 31, 4, 0, TRUE); //Create pokemon sprite + #endif + #ifdef POKEMON_EXPANSION + gTasks[taskId].data[6] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 17, 31, 4, 0); //Create pokemon sprite + #endif gSprites[gTasks[taskId].data[4]].oam.priority = 0; } gMain.state++; @@ -6239,14 +6250,13 @@ static void Task_HandleStatsScreenInput(u8 taskId) PlaySE(SE_FAILURE); else { - sPokedexView->selectedScreen = AREA_SCREEN; + sPokedexView->selectedScreen = EVO_SCREEN; BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 2; + sPokedexView->screenSwitchState = 3; gTasks[taskId].func = Task_SwitchScreensFromStatsScreen; PlaySE(SE_PIN); } } - } #define ITEM_TAG 0xFDF3 static void DestroyMoveIcon(u8 taskId) @@ -6848,6 +6858,9 @@ static void Task_SwitchScreensFromStatsScreen(u8 taskId) case 2: gTasks[taskId].func = Task_LoadCryScreen; break; + case 3: + gTasks[taskId].func = Task_LoadEvolutionScreen; + break; default: gTasks[taskId].func = Task_LoadInfoScreen; break; @@ -6882,7 +6895,6 @@ static u8 ShowSplitIcon(u32 split) StartSpriteAnim(&gSprites[sPokedexView->splitIconSpriteId], split); return sPokedexView->splitIconSpriteId; } - static void DestroySplitIcon(void) { if (sPokedexView->splitIconSpriteId != 0xFF) @@ -6890,3 +6902,465 @@ static void DestroySplitIcon(void) sPokedexView->splitIconSpriteId = 0xFF; } #endif + +//PokedexPlus HGSS_Ui Evolution Page +static void Task_LoadEvolutionScreen(u8 taskId) +{ + switch (gMain.state) + { + case 0: + default: + if (!gPaletteFade.active) + { + u16 r2; + + sPokedexView->currentPage = EVO_SCREEN; + gPokedexVBlankCB = gMain.vblankCallback; + SetVBlankCallback(NULL); + r2 = 0; + if (gTasks[taskId].data[1] != 0) + r2 += DISPCNT_OBJ_ON; + if (gTasks[taskId].data[2] != 0) + r2 |= DISPCNT_BG1_ON; + ResetOtherVideoRegisters(r2); + gMain.state = 1; + } + break; + case 1: + DecompressAndLoadBgGfxUsingHeap(3, gPokedexEvo_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexEvolutionScreen_Tilemap, 0, 0); + FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); + PutWindowTilemap(WIN_INFO); + CopyWindowToVram(WIN_INFO, 3); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + gMain.state++; + break; + case 2: + LoadScreenSelectBarMain(0xD); + LoadPokedexBgPalette(sPokedexView->isSearchResults); + gMain.state++; + break; + case 3: + if (gTasks[taskId].data[1] == 0) + { + //Icon + FreeMonIconPalettes(); //Free space for new pallete + LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon + #ifndef POKEMON_EXPANSION + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 17, 31, 4, 0, TRUE); //Create pokemon sprite + #endif + #ifdef POKEMON_EXPANSION + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 17, 31, 4, 0); //Create pokemon sprite + #endif + gSprites[gTasks[taskId].data[4]].oam.priority = 0; + } + gMain.state++; + break; + case 4: + //Print evo info and icons + gTasks[taskId].data[3] = 0; + PrintEvolutionTargetSpeciesAndMethod(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); + gMain.state++; + break; + case 5: + { + u32 preservedPalettes = 0; + + if (gTasks[taskId].data[2] != 0) + preservedPalettes = 0x14; // each bit represents a palette index + if (gTasks[taskId].data[1] != 0) + preservedPalettes |= (1 << (gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum + 16)); + BeginNormalPaletteFade(~preservedPalettes, 0, 16, 0, RGB_BLACK); + SetVBlankCallback(gPokedexVBlankCB); + gMain.state++; + } + break; + case 6: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + HideBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 7: + if (!gPaletteFade.active) + gMain.state++; + break; + case 8: + gMain.state++; + break; + case 9: + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 1; + gTasks[taskId].func = Task_HandleEvolutionScreenInput; + gMain.state = 0; + break; + } +} +static void Task_HandleEvolutionScreenInput(u8 taskId) +{ + //Exit to overview + if (JOY_NEW(B_BUTTON)) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_ExitEvolutionScreen; + PlaySE(SE_PC_OFF); + return; + } + + //Switch screens + if ((JOY_NEW(DPAD_LEFT) || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) + { + sPokedexView->selectedScreen = STATS_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromEvolutionScreen; + PlaySE(SE_PIN); + } + if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) + { + if (!sPokedexListItem->owned) + PlaySE(SE_FAILURE); + else + { + sPokedexView->selectedScreen = CRY_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 2; + gTasks[taskId].func = Task_SwitchScreensFromEvolutionScreen; + PlaySE(SE_PIN); + } + } +} +static void handleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u8 base_x, u8 base_y, u8 base_offset, u8 base_i) +{ + StringCopy(gStringVar3, gSpeciesNames[targetSpecies]); //evolution mon name + StringExpandPlaceholders(gStringVar3, gText_EVO_Name); //evolution mon name + PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_offset*base_i); //evolution mon name + + if(base_i < 6) + { + LoadMonIconPalette(targetSpecies); //Loads pallete for current mon + #ifndef POKEMON_EXPANSION + gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 50 + 32*base_i, 31, 4, 0, TRUE); //Create pokemon sprite + #endif + #ifdef POKEMON_EXPANSION + gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 50 + 32*base_i, 31, 4, 0); //Create pokemon sprite + #endif + gSprites[gTasks[taskId].data[4+base_i]].oam.priority = 0; + } +} +#define EVO_SCREEN_LVL_DIGITS 2 +static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) +{ + int i; + #ifdef POKEMON_EXPANSION + int j; + u16 currentMap; + #endif + u16 targetSpecies = 0; + + u16 item; + + bool8 left = TRUE; + u8 base_x = 5; + u8 base_x_offset = 54; + u8 base_y = 52; + u8 base_offset = 9; + u8 base_i = 0; + u8 times = 0; + + StringCopy(gStringVar1, gSpeciesNames[species]); + + //Calculate number of possible direct evolutions (e.g. Eevee has 5 but torchic has 1) + for (i = 0; i < EVOS_PER_MON; i++) + { + if(gEvolutionTable[species][i].method != 0) + times += 1; + gTasks[taskId].data[3] = times; + } + + //If there are no evolutions print text + if (times == 0) + { + StringExpandPlaceholders(gStringVar4, gText_EVO_NONE); + PrintInfoScreenTextSmall(gStringVar4, base_x, base_y + base_offset*base_i); + } + + //If there are evolutions find out which and print them 1 by 1 + for (i = 0; i < times; i++) + { + base_i = i; + left = !left; + switch (gEvolutionTable[species][i].method) + { + case EVO_FRIENDSHIP: + targetSpecies = gEvolutionTable[species][i].targetSpecies; + ConvertIntToDecimalStringN(gStringVar2, 220, STR_CONV_MODE_LEADING_ZEROS, 3); //friendship value + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_FRIENDSHIP_DAY: + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_DAY ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_FRIENDSHIP_NIGHT: + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_NIGHT ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL: + targetSpecies = gEvolutionTable[species][i].targetSpecies; + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_TRADE: + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_TRADE_ITEM: + item = gEvolutionTable[species][i].param; //item + CopyItemName(item, gStringVar2); //item + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_ITEM ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_ITEM: + item = gEvolutionTable[species][i].param; + CopyItemName(item, gStringVar2); + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_ATK_GT_DEF: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_GT_DEF ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_ATK_EQ_DEF: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_EQ_DEF ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_ATK_LT_DEF: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon namee + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_LT_DEF ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_SILCOON: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SILCOON ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_CASCOON: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_CASCOON ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_NINJASK: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NINJASK ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_BEAUTY: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, 3); //beauty + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_BEAUTY ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + #ifdef POKEMON_EXPANSION + case EVO_LEVEL_FEMALE: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_FEMALE ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_MALE: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_MALE ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_NIGHT: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NIGHT ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_DAY: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DAY ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_DUSK: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DUSK ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_ITEM_HOLD_DAY: + item = gEvolutionTable[species][i].param; //item + CopyItemName(item, gStringVar2); //item + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_DAY ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_ITEM_HOLD_NIGHT: + item = gEvolutionTable[species][i].param; //item + CopyItemName(item, gStringVar2); //item + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_NIGHT ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_MOVE: + StringCopy(gStringVar2, gMoveNames[gEvolutionTable[species][i].param]); + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_MOVE_TYPE: + StringCopy(gStringVar2, gTypeNames[gEvolutionTable[species][i].param]); + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE_TYPE ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_MAPSEC: + StringCopy(gStringVar2, gRegionMapEntries[gEvolutionTable[species][i].param].name); + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_MAPSEC ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_ITEM_MALE: + item = gEvolutionTable[species][i].param; //item + CopyItemName(item, gStringVar2); //item + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_MALE ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_ITEM_FEMALE: + item = gEvolutionTable[species][i].param; //item + CopyItemName(item, gStringVar2); //item + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_FEMALE ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_RAIN: + //if (j == WEATHER_RAIN || j == WEATHER_RAIN_THUNDERSTORM || j == WEATHER_DOWNPOUR) + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_RAIN ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_SPECIFIC_MON_IN_PARTY: + StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MON_IN_PARTY ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_LEVEL_DARK_TYPE_MON_IN_PARTY: + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_TRADE_SPECIFIC_MON: + StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_SPECIFIC_MON ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + case EVO_SPECIFIC_MAP: + //currentMap = ((gSaveBlock1Ptr->location.mapGroup) << 8 | gSaveBlock1Ptr->location.mapNum); + GetMapName(gStringVar2, gEvolutionTable[species][i].param, 0); + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MAP ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; + #endif + }//Switch end + }//For loop end +} +static void Task_SwitchScreensFromEvolutionScreen(u8 taskId) +{ + if (!gPaletteFade.active) + { + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + switch (sPokedexView->screenSwitchState) + { + case 1: + gTasks[taskId].func = Task_LoadStatsScreen; + break; + case 2: + gTasks[taskId].func = Task_LoadCryScreen; + break; + default: + gTasks[taskId].func = Task_LoadInfoScreen; + break; + } + } +} +static void Task_ExitEvolutionScreen(u8 taskId) +{ + u8 i; + if (!gPaletteFade.active) + { + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + for (i = 1; i <= gTasks[taskId].data[3]; i++) + { + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite + } + + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + FreeInfoScreenWindowAndBgBuffers(); + DestroyTask(taskId); + } +} diff --git a/src/strings.c b/src/strings.c index f8b3ede6de6c..f36626461a72 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1880,3 +1880,38 @@ const u8 gText_Stats_eggGroup_DRAGON[] = _("DRAGON"); const u8 gText_Stats_eggGroup_UNDISCOVERED[]= _("---"); const u8 gText_Dex_SEEN[] = _("SEEN"); const u8 gText_Dex_OWN[] = _("OWN"); + +const u8 gText_EVO_Name[] = _("{STR_VAR_3}:"); +const u8 gText_EVO_FRIENDSHIP[] = _("Lvl up with friendship >= 220"); +const u8 gText_EVO_FRIENDSHIP_DAY[] = _("Lvl up at day with friendship >= 220"); +const u8 gText_EVO_FRIENDSHIP_NIGHT[] = _("Lvl up at night with friendship >= 220"); +const u8 gText_EVO_LEVEL[] = _("Lvl up to {STR_VAR_2}"); +const u8 gText_EVO_TRADE[] = _("via trading"); +const u8 gText_EVO_TRADE_ITEM[] = _("via trading while holding {STR_VAR_2}"); +const u8 gText_EVO_ITEM[] = _("{STR_VAR_2} is used on Pokémon"); +const u8 gText_EVO_LEVEL_ATK_GT_DEF[] = _("Lvl up to {STR_VAR_2} with attack > defense"); +const u8 gText_EVO_LEVEL_ATK_EQ_DEF[] = _("Lvl up to {STR_VAR_2} with attack = defense"); +const u8 gText_EVO_LEVEL_ATK_LT_DEF[] = _("Lvl up to {STR_VAR_2} with attack < defense"); +const u8 gText_EVO_LEVEL_SILCOON[] = _("Lvl up to {STR_VAR_2} with Silcoon persona"); +const u8 gText_EVO_LEVEL_CASCOON[] = _("Lvl up to {STR_VAR_2} with Cascoon persona"); +const u8 gText_EVO_LEVEL_NINJASK[] = _("Lvl up to {STR_VAR_2} (special value for Ninjask)"); +const u8 gText_EVO_LEVEL_SHEDINJA[] = _("Lvl up to {STR_VAR_2} (special value for Shedinja)"); +const u8 gText_EVO_BEAUTY[] = _("Lvl up with beauty >= {STR_VAR_2}"); +const u8 gText_EVO_LEVEL_FEMALE[] = _("Lvl up to {STR_VAR_2}, is female"); +const u8 gText_EVO_LEVEL_MALE[] = _("Lvl up to {STR_VAR_2}, is male"); +const u8 gText_EVO_LEVEL_NIGHT[] = _("Lvl up to {STR_VAR_2} at night"); +const u8 gText_EVO_LEVEL_DAY[] = _("Lvl up to {STR_VAR_2} at day"); +const u8 gText_EVO_LEVEL_DUSK[] = _("Lvl up to {STR_VAR_2} at dusk (5-6 P.M)"); +const u8 gText_EVO_ITEM_HOLD_DAY[] = _("Lvl up, holds {STR_VAR_2} at day"); +const u8 gText_EVO_ITEM_HOLD_NIGHT[] = _("Lvl up, holds{STR_VAR_2} at night"); +const u8 gText_EVO_MOVE[] = _("Lvl up, knows {STR_VAR_2}"); +const u8 gText_EVO_MOVE_TYPE[] = _("Lvl up, knows {STR_VAR_2} type move"); +const u8 gText_EVO_MAPSEC[] = _("Lvl up on {STR_VAR_2}"); +const u8 gText_EVO_ITEM_MALE[] = _("{STR_VAR_2} used on male"); +const u8 gText_EVO_ITEM_FEMALE[] = _("{STR_VAR_2} used on female"); +const u8 gText_EVO_LEVEL_RAIN[] = _("Lvl up to {STR_VAR_2} while raining"); +const u8 gText_EVO_SPECIFIC_MON_IN_PARTY[] = _("Lvl up with a {STR_VAR_2} in party"); +const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[] = _("Lvl up with with dark type in party"); +const u8 gText_EVO_TRADE_SPECIFIC_MON[] = _("is traded for a {STR_VAR_2}"); +const u8 gText_EVO_SPECIFIC_MAP[] = _("Lvl up on {STR_VAR_2}"); +const u8 gText_EVO_NONE[] = _("There is no evolution for {STR_VAR_1}."); From 379a862586f5977975b6cfa263cd139876f1b813 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Thu, 4 Feb 2021 19:23:42 +0100 Subject: [PATCH 07/88] fixes a PE compatibility bug, thanks to BioToxtrix for pointing it out --- src/pokedex.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index b426da226cf8..343143df9fb1 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1,5 +1,8 @@ #include "global.h" #include "battle_main.h" +#ifdef BATTLE_ENGINE +#include "battle_util.h" +#endif #include "bg.h" #include "contest_effect.h" #include "data.h" @@ -23,6 +26,9 @@ #include "pokedex_cry_screen.h" #include "pokemon_icon.h" #include "pokemon_summary_screen.h" +#ifdef POKEMON_EXPANSION +#include "region_map.h" +#endif #include "scanline_effect.h" #include "shop.h" #include "sound.h" @@ -40,9 +46,6 @@ #include "constants/party_menu.h" #include "constants/rgb.h" #include "constants/songs.h" -#ifdef BATTLE_ENGINE -#include "battle_util.h" -#endif enum { From e663c35d1f7641dde149e4985c50d7947d57bd08 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Fri, 5 Feb 2021 16:56:00 +0100 Subject: [PATCH 08/88] Fixed missing SHEDINJA and updated ingame evolution description, thanks to juan.je7 --- src/pokedex.c | 7 +++++++ src/strings.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 343143df9fb1..68905c6467f2 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7193,6 +7193,13 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NINJASK ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); break; + case EVO_LEVEL_SHEDINJA: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + targetSpecies = gEvolutionTable[species][i].targetSpecies; + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SHEDINJA ); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + break; case EVO_BEAUTY: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, 3); //beauty targetSpecies = gEvolutionTable[species][i].targetSpecies; diff --git a/src/strings.c b/src/strings.c index f36626461a72..14d4455d9729 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1894,8 +1894,8 @@ const u8 gText_EVO_LEVEL_ATK_EQ_DEF[] = _("Lvl up to {STR_VAR_2} w const u8 gText_EVO_LEVEL_ATK_LT_DEF[] = _("Lvl up to {STR_VAR_2} with attack < defense"); const u8 gText_EVO_LEVEL_SILCOON[] = _("Lvl up to {STR_VAR_2} with Silcoon persona"); const u8 gText_EVO_LEVEL_CASCOON[] = _("Lvl up to {STR_VAR_2} with Cascoon persona"); -const u8 gText_EVO_LEVEL_NINJASK[] = _("Lvl up to {STR_VAR_2} (special value for Ninjask)"); -const u8 gText_EVO_LEVEL_SHEDINJA[] = _("Lvl up to {STR_VAR_2} (special value for Shedinja)"); +const u8 gText_EVO_LEVEL_NINJASK[] = _("Lvl up to {STR_VAR_2}"); +const u8 gText_EVO_LEVEL_SHEDINJA[] = _("Lvl up to {STR_VAR_2}, party<6, 1x POKéBALL"); const u8 gText_EVO_BEAUTY[] = _("Lvl up with beauty >= {STR_VAR_2}"); const u8 gText_EVO_LEVEL_FEMALE[] = _("Lvl up to {STR_VAR_2}, is female"); const u8 gText_EVO_LEVEL_MALE[] = _("Lvl up to {STR_VAR_2}, is male"); From 88207a0307da62c22b71226993b7264efe1a763f Mon Sep 17 00:00:00 2001 From: TheXaman Date: Thu, 11 Feb 2021 16:46:05 +0100 Subject: [PATCH 09/88] Implemented stat bars on main scrolling page, idea from Jaizu and code for the bars altered from DizzyEgg --- graphics/pokedex/stat_bars.png | Bin 0 -> 396 bytes src/pokedex.c | 730 +++++++++++++++++++++++---------- 2 files changed, 510 insertions(+), 220 deletions(-) create mode 100644 graphics/pokedex/stat_bars.png diff --git a/graphics/pokedex/stat_bars.png b/graphics/pokedex/stat_bars.png new file mode 100644 index 0000000000000000000000000000000000000000..b7245df4aa9169d1fddb2de1e10cba9c9090fdf4 GIT binary patch literal 396 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|e_7YEDSN5k&oIDotauOwiKq2uG z*NBqf{Irtt#G+INcOMs^F$!g=MGD4xCWWm_9s-qcloa^617(bXYzD6eO?e>2lJ4m1 z$iT3%pZiZDE0Avx;1lBd9|#y2h(SOdYuB#5!DIUp$YM&y5>)KuA^~TlJ7_lr{A`T0n5xb&1G?P(6(UZIyEilS>uPYAm!@^G8UON zB)-|7d`Y=f^lCudwxVMSYMHxuCwOH|3+!qa^ANgLCV#5;rQHLSDKiTW_f4)6z5Unq tr?mP)pI?P?v))bj)U22}rK!GyzoTZ8oxsgPFQ9W7JYD@<);T3K0RRIQiU9xs literal 0 HcmV?d00001 diff --git a/src/pokedex.c b/src/pokedex.c index 68905c6467f2..d711b14a44fc 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -200,6 +200,9 @@ struct PokedexView u8 typeIconSpriteIds[2]; //HGSS_Ui u16 moveSelected; //HGSS_Ui u8 moveMax; //HGSS_Ui + u8 statBarsSpriteId; //HGSS_Ui + u8 statBarsBgSpriteId; //HGSS_Ui + bool8 justScrolled; //HGSS_Ui #ifdef BATTLE_ENGINE u8 splitIconSpriteId; //HGSS_Ui Physical/Special Split from BE #endif @@ -357,6 +360,13 @@ static void Task_HandleEvolutionScreenInput(u8 taskId); static void Task_SwitchScreensFromEvolutionScreen(u8 taskId); static void Task_ExitEvolutionScreen(u8 taskId); static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species); +//Stat bars on scrolling screens +static void TryDestroyStatBars(void); +static void TryDestroyStatBarsBg(void); +static void CreateStatBars(struct PokedexListItem *dexMon); +static void CreateStatBarsBg(void); +static void SpriteCB_StatBars(struct Sprite *sprite); +static void SpriteCB_StatBarsBg(struct Sprite *sprite); #ifdef BATTLE_ENGINE static u8 ShowSplitIcon(u32 split); //Physical/Special Split from BE @@ -416,6 +426,100 @@ static const struct SpriteTemplate sSpriteTemplate_SplitIcons = }; #endif +//HGSS_Ui Stat bars by DizzyEgg +#define TAG_STAT_BAR 4097 +#define TAG_STAT_BAR_BG 4098 +static const struct OamData sOamData_StatBar = +{ + .y = 160, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(64x64), + .size = SPRITE_SIZE(64x64), +}; +static const struct OamData sOamData_StatBarBg = +{ + .y = 160, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(64x64), + .size = SPRITE_SIZE(64x64), +}; +static const struct SpriteTemplate sStatBarSpriteTemplate = +{ + .tileTag = TAG_STAT_BAR, + .paletteTag = TAG_STAT_BAR, + .oam = &sOamData_StatBar, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_StatBars, +}; +static const struct SpriteTemplate sStatBarBgSpriteTemplate = +{ + .tileTag = TAG_STAT_BAR_BG, + .paletteTag = TAG_STAT_BAR_BG, + .oam = &sOamData_StatBarBg, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_StatBarsBg, +}; +enum +{ + COLOR_ID_ALPHA, + COLOR_ID_BAR_WHITE, + // These are repeated 6 times + COLOR_ID_FILL, + COLOR_ID_FILL_SHADOW, + COLOR_ID_FONT = 14, + COLOR_ID_FONT_SHADOW = 15, +}; +enum +{ + COLOR_BEST, // Light blue + COLOR_VERY_GOOD, // Green + COLOR_GOOD, // Light Green + COLOR_AVERAGE, // Yellow + COLOR_BAD, // Orange + COLOR_WORST, // Red +}; +static const u8 sStatBarsGfx[] = INCBIN_U8("graphics/pokedex/stat_bars.4bpp"); +static const u16 sStatBarPalette[16] = { + [COLOR_ID_ALPHA] = RGB(0, 0, 10), + [COLOR_ID_BAR_WHITE] = RGB_WHITE, + + [COLOR_ID_FILL + COLOR_BEST * 2] = RGB(2, 25, 25), + [COLOR_ID_FILL_SHADOW + COLOR_BEST * 2] = RGB(13, 27, 27), + + [COLOR_ID_FILL + COLOR_VERY_GOOD * 2] = RGB(11, 25, 2), + [COLOR_ID_FILL_SHADOW + COLOR_VERY_GOOD * 2] = RGB(19, 27, 13), + + [COLOR_ID_FILL + COLOR_GOOD * 2] = RGB(22, 25, 2), + [COLOR_ID_FILL_SHADOW + COLOR_GOOD * 2] = RGB(26, 27, 13), + + [COLOR_ID_FILL + COLOR_AVERAGE * 2] = RGB(25, 22, 2), + [COLOR_ID_FILL_SHADOW + COLOR_AVERAGE * 2] = RGB(27, 26, 13), + + [COLOR_ID_FILL + COLOR_BAD * 2] = RGB(25, 17, 2), + [COLOR_ID_FILL_SHADOW + COLOR_BAD * 2] = RGB(27, 22, 13), + + [COLOR_ID_FILL + COLOR_WORST * 2] = RGB(25, 4, 2), + [COLOR_ID_FILL_SHADOW + COLOR_WORST * 2] = RGB(27, 15, 13), + + [COLOR_ID_FONT] = RGB_BLACK, + [COLOR_ID_FONT_SHADOW] = RGB(22, 22, 22), +}; +static const struct SpritePalette sStatBarSpritePal[] = //{sStatBarPalette, TAG_STAT_BAR}; +{ + {sStatBarPalette, TAG_STAT_BAR}, + {sStatBarPalette, TAG_STAT_BAR_BG}, + {0} +}; + + // const rom data #include "data/pokemon/pokedex_orders.h" @@ -1792,11 +1896,17 @@ static void Task_HandlePokedexInput(u8 taskId) if (sPokedexView->menuY) { sPokedexView->menuY -= 8; + if (sPokedexView->menuIsOpen == FALSE && sPokedexView->menuY == 8) //HGSS_Ui + { + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); + CreateStatBarsBg(); + } } else { if ((JOY_NEW(A_BUTTON)) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen) { + TryDestroyStatBars(); //HGSS_Ui UpdateSelectedMonSpriteId(); BeginNormalPaletteFade(~(1 << (gSprites[sPokedexView->selectedMonSpriteId].oam.paletteNum + 16)), 0, 0, 0x10, RGB_BLACK); gSprites[sPokedexView->selectedMonSpriteId].callback = SpriteCB_MoveMonForInfoScreen; @@ -1806,6 +1916,8 @@ static void Task_HandlePokedexInput(u8 taskId) } else if (JOY_NEW(START_BUTTON)) { + TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBarsBg(); //HGSS_Ui sPokedexView->menuY = 0; sPokedexView->menuIsOpen = TRUE; sPokedexView->menuCursorPos = 0; @@ -1828,6 +1940,7 @@ static void Task_HandlePokedexInput(u8 taskId) } else if (JOY_NEW(B_BUTTON)) { + TryDestroyStatBars(); //HGSS_Ui BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ClosePokedex; PlaySE(SE_PC_OFF); @@ -1838,12 +1951,15 @@ static void Task_HandlePokedexInput(u8 taskId) sPokedexView->selectedPokemon = TryDoPokedexScroll(sPokedexView->selectedPokemon, 0xE); if (sPokedexView->scrollTimer) gTasks[taskId].func = Task_WaitForScroll; + else if (!sPokedexView->scrollTimer && !sPokedexView->scrollSpeed &&sPokedexView->justScrolled) //HGSS_Ui + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui } } } static void Task_WaitForScroll(u8 taskId) { + TryDestroyStatBars(); //HGSS_Ui if (UpdateDexListScroll(sPokedexView->scrollDirection, sPokedexView->scrollMonIncrement, sPokedexView->maxScrollTimer)) gTasks[taskId].func = Task_HandlePokedexInput; } @@ -1939,6 +2055,8 @@ static void Task_WaitForExitSearch(u8 taskId) if (!gTasks[gTasks[taskId].tTaskId].isActive) { ClearMonSprites(); + TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBarsBg(); //HGSS_Ui // Search produced results if (sPokedexView->screenSwitchState != 0) @@ -1992,6 +2110,11 @@ static void Task_HandleSearchResultsInput(u8 taskId) if (sPokedexView->menuY) { sPokedexView->menuY -= 8; + if (sPokedexView->menuIsOpen == FALSE && sPokedexView->menuY == 8) //HGSS_Ui + { + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); + CreateStatBarsBg(); + } } else { @@ -1999,6 +2122,7 @@ static void Task_HandleSearchResultsInput(u8 taskId) { u32 a; + TryDestroyStatBars(); //HGSS_Ui UpdateSelectedMonSpriteId(); a = (1 << (gSprites[sPokedexView->selectedMonSpriteId].oam.paletteNum + 16)); gSprites[sPokedexView->selectedMonSpriteId].callback = SpriteCB_MoveMonForInfoScreen; @@ -2009,6 +2133,8 @@ static void Task_HandleSearchResultsInput(u8 taskId) } else if (JOY_NEW(START_BUTTON)) { + TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBarsBg(); //HGSS_Ui sPokedexView->menuY = 0; sPokedexView->menuIsOpen = TRUE; sPokedexView->menuCursorPos = 0; @@ -2026,6 +2152,7 @@ static void Task_HandleSearchResultsInput(u8 taskId) } else if (JOY_NEW(B_BUTTON)) { + TryDestroyStatBars(); //HGSS_Ui BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ReturnToPokedexFromSearchResults; PlaySE(SE_PC_OFF); @@ -2036,12 +2163,15 @@ static void Task_HandleSearchResultsInput(u8 taskId) sPokedexView->selectedPokemon = TryDoPokedexScroll(sPokedexView->selectedPokemon, 0xE); if (sPokedexView->scrollTimer) gTasks[taskId].func = Task_WaitForSearchResultsScroll; + else if (!sPokedexView->scrollTimer && !sPokedexView->scrollSpeed && sPokedexView->justScrolled) //HGSS_Ui + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui } } } static void Task_WaitForSearchResultsScroll(u8 taskId) { + TryDestroyStatBars(); //HGSS_Ui if (UpdateDexListScroll(sPokedexView->scrollDirection, sPokedexView->scrollMonIncrement, sPokedexView->maxScrollTimer)) gTasks[taskId].func = Task_HandleSearchResultsInput; } @@ -2211,6 +2341,7 @@ static bool8 LoadPokedexListPage(u8 page) gReservedSpritePaletteCount = 8; LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[0]); LoadSpritePalettes(sInterfaceSpritePalette); + LoadSpritePalettes(sStatBarSpritePal); //HGSS_Ui CreateInterfaceSprites(page); gMain.state++; break; @@ -2221,6 +2352,10 @@ static bool8 LoadPokedexListPage(u8 page) if (page == PAGE_MAIN) CreatePokedexList(sPokedexView->dexMode, sPokedexView->dexOrder); CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); + sPokedexView->statBarsSpriteId = 0xFF; //HGSS_Ui stat bars + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui stat bars + sPokedexView->statBarsBgSpriteId = 0xFF; //HGSS_Ui stat bars background + CreateStatBarsBg(); //HGSS_Ui stat bars background sPokedexView->menuIsOpen = FALSE; sPokedexView->menuY = 0; CopyBgTilemapBufferToVram(0); @@ -2719,6 +2854,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) selectedMon = GetNextPosition(1, selectedMon, 0, sPokedexView->pokemonListCount - 1); CreateScrollingPokemonSprite(1, selectedMon); CreateMonListEntry(1, selectedMon, ignored); + sPokedexView->justScrolled = TRUE; //HGSS_Ui PlaySE(SE_DEX_SCROLL); } else if (JOY_HELD(DPAD_DOWN) && (selectedMon < sPokedexView->pokemonListCount - 1)) @@ -2727,6 +2863,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) selectedMon = GetNextPosition(0, selectedMon, 0, sPokedexView->pokemonListCount - 1); CreateScrollingPokemonSprite(2, selectedMon); CreateMonListEntry(2, selectedMon, ignored); + sPokedexView->justScrolled = TRUE; //HGSS_Ui PlaySE(SE_DEX_SCROLL); } else if (JOY_NEW(DPAD_LEFT) && (selectedMon > 0)) @@ -2738,6 +2875,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) sPokedexView->pokeBallRotation += 16 * (selectedMon - startingPos); ClearMonSprites(); CreateMonSpritesAtPos(selectedMon, 0xE); + sPokedexView->justScrolled = TRUE; //HGSS_Ui PlaySE(SE_DEX_PAGE); } else if ((JOY_NEW(DPAD_RIGHT)) && (selectedMon < sPokedexView->pokemonListCount - 1)) @@ -2748,6 +2886,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) sPokedexView->pokeBallRotation += 16 * (selectedMon - startingPos); ClearMonSprites(); CreateMonSpritesAtPos(selectedMon, 0xE); + sPokedexView->justScrolled = TRUE; //HGSS_Ui PlaySE(SE_DEX_PAGE); } @@ -2895,6 +3034,7 @@ static void CreateInterfaceSprites(u8 page) u8 spriteId; u16 digitNum; u8 color[3]; + bool32 drawNextDigit; // Scroll arrows spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 10, 4, 0); @@ -2929,239 +3069,182 @@ static void CreateInterfaceSprites(u8 page) // gSprites[spriteId].data[0] = 31; // gSprites[spriteId].data[1] = 128; - if (page == PAGE_MAIN) - { - bool32 drawNextDigit; - - if (!IsNationalPokedexEnabled()) - { - - // // Seen text - // CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 40, 1); - // // Own text - // spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 72, 1); - // StartSpriteAnim(&gSprites[spriteId], 1); - - // // Seen value - 100s - // drawNextDigit = FALSE; - // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 24, 48, 1); - // digitNum = sPokedexView->seenCount / 100; - // StartSpriteAnim(&gSprites[spriteId], digitNum); - // if (digitNum != 0) - // drawNextDigit = TRUE; - // else - // gSprites[spriteId].invisible = TRUE; - - // // Seen value - 10s - // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 32, 48, 1); - // digitNum = (sPokedexView->seenCount % 100) / 10; - // if (digitNum != 0 || drawNextDigit) - // StartSpriteAnim(&gSprites[spriteId], digitNum); - // else - // gSprites[spriteId].invisible = TRUE; - - // // Seen value - 1s - // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 40, 48, 1); - // digitNum = (sPokedexView->seenCount % 100) % 10; - // StartSpriteAnim(&gSprites[spriteId], digitNum); - - // // Owned value - 100s - // drawNextDigit = FALSE; - // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 24, 80, 1); - // digitNum = sPokedexView->ownCount / 100; - // StartSpriteAnim(&gSprites[spriteId], digitNum); - // if (digitNum != 0) - // drawNextDigit = TRUE; - // else - // gSprites[spriteId].invisible = TRUE; - - // // Owned value - 10s - // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 32, 80, 1); - // digitNum = (sPokedexView->ownCount % 100) / 10; - // if (digitNum != 0 || drawNextDigit) - // StartSpriteAnim(&gSprites[spriteId], digitNum); - // else - // gSprites[spriteId].invisible = TRUE; - - // // Owned value - 1s - // spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 40, 80, 1); - // digitNum = (sPokedexView->ownCount % 100) % 10; - // StartSpriteAnim(&gSprites[spriteId], digitNum); - - // Hoenn text - CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 40 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); - // Hoenn seen - CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); - // Hoenn own - spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 7, 1); - StartSpriteAnim(&gSprites[spriteId], 1); - - // Hoenn seen value - 100s - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = sPokedexView->seenCount / 100; - StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; - - // Hoenn seen value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->seenCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) - StartSpriteAnim(&gSprites[spriteId], digitNum); - else - gSprites[spriteId].invisible = TRUE; + if (!IsNationalPokedexEnabled() && page == PAGE_MAIN) + { + // Hoenn text + CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 40 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); + // Hoenn seen + CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); + // Hoenn own + spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 7, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + + // Hoenn seen value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = sPokedexView->seenCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; - // Hoenn seen value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->seenCount % 100) % 10; + // Hoenn seen value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->seenCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + // Hoenn seen value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->seenCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); - // Hoenn owned value - 100s - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = sPokedexView->ownCount / 100; - StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; - // Hoenn owned value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->ownCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) - StartSpriteAnim(&gSprites[spriteId], digitNum); - else - gSprites[spriteId].invisible = TRUE; - - // Hoenn owned value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->ownCount % 100) % 10; - StartSpriteAnim(&gSprites[spriteId], digitNum); - } + // Hoenn owned value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = sPokedexView->ownCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; else - { - u16 seenOwnedCount; - - - // Hoenn text - CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 40 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); - // Hoenn seen - CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); - // Hoenn own - spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 7, 1); - StartSpriteAnim(&gSprites[spriteId], 1); - - // National text - spriteId = CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 73 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); - StartSpriteAnim(&gSprites[spriteId], 1); - // National seen - CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); - // National own - spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); - StartSpriteAnim(&gSprites[spriteId], 1); - - // Hoenn seen value - 100s - seenOwnedCount = GetHoennPokedexCount(FLAG_GET_SEEN); - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = seenOwnedCount / 100; - StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; - - // Hoenn seen value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (seenOwnedCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) - StartSpriteAnim(&gSprites[spriteId], digitNum); - else - gSprites[spriteId].invisible = TRUE; + gSprites[spriteId].invisible = TRUE; - // Hoenn seen value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (seenOwnedCount % 100) % 10; + // Hoenn owned value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->ownCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn owned value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->ownCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + } + else if (page == PAGE_MAIN) + { + u16 seenOwnedCount; + + // Hoenn text + CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 40 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); + // Hoenn seen + CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); + // Hoenn own + spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 7, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + + // National text + spriteId = CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 73 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + // National seen + CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); + // National own + spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + + // Hoenn seen value - 100s + seenOwnedCount = GetHoennPokedexCount(FLAG_GET_SEEN); + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = seenOwnedCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; - seenOwnedCount = GetHoennPokedexCount(FLAG_GET_CAUGHT); - // Hoenn owned value - 100s - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = seenOwnedCount / 100; - StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; - - // Hoenn owned value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (seenOwnedCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) - StartSpriteAnim(&gSprites[spriteId], digitNum); - else - gSprites[spriteId].invisible = TRUE; - - // Hoenn owned value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (seenOwnedCount % 100) % 10; + // Hoenn seen value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (seenOwnedCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn seen value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (seenOwnedCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + + seenOwnedCount = GetHoennPokedexCount(FLAG_GET_CAUGHT); + // Hoenn owned value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = seenOwnedCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; - - - //**************************** - // National seen value - 100s - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = sPokedexView->seenCount / 100; + // Hoenn owned value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (seenOwnedCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; - - // National seen value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->seenCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) - StartSpriteAnim(&gSprites[spriteId], digitNum); - else - gSprites[spriteId].invisible = TRUE; + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn owned value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (seenOwnedCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + + //**************************** + // National seen value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = sPokedexView->seenCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; - // National seen value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->seenCount % 100) % 10; + // National seen value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->seenCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // National seen value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->seenCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + + // National owned value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = sPokedexView->ownCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; - // National owned value - 100s - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = sPokedexView->ownCount / 100; + // National owned value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->ownCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; + else + gSprites[spriteId].invisible = TRUE; - // National owned value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->ownCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) - StartSpriteAnim(&gSprites[spriteId], digitNum); - else - gSprites[spriteId].invisible = TRUE; + // National owned value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->ownCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + } - // National owned value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->ownCount % 100) % 10; - StartSpriteAnim(&gSprites[spriteId], digitNum); - } + if (page == PAGE_MAIN) + { spriteId = CreateSprite(&sDexListStartMenuCursorSpriteTemplate, 136, 96, 1); gSprites[spriteId].invisible = TRUE; } @@ -3179,7 +3262,7 @@ static void SpriteCB_EndMoveMonForInfoScreen(struct Sprite *sprite) static void SpriteCB_SeenOwnInfo(struct Sprite *sprite) { - if (sPokedexView->currentPage != PAGE_MAIN) + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) DestroySprite(sprite); } @@ -5258,6 +5341,7 @@ static void Task_LoadSearchMenu(u8 taskId) case 1: LoadCompressedSpriteSheet(sInterfaceSpriteSheet); LoadSpritePalettes(sInterfaceSpritePalette); + LoadSpritePalettes(sStatBarSpritePal); //HGSS_Ui CreateSearchParameterScrollArrows(taskId); for (i = 0; i < NUM_TASK_DATA; i++) gTasks[taskId].data[i] = 0; @@ -5272,6 +5356,8 @@ static void Task_LoadSearchMenu(u8 taskId) break; case 2: BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + sPokedexView->statBarsSpriteId = 0xFF; //HGSS_Ui + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui gMain.state++; break; case 3: @@ -7064,8 +7150,8 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) { int i; #ifdef POKEMON_EXPANSION - int j; - u16 currentMap; + int j; + u16 currentMap; #endif u16 targetSpecies = 0; @@ -7337,12 +7423,17 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) } static void Task_SwitchScreensFromEvolutionScreen(u8 taskId) { + u8 i; if (!gPaletteFade.active) { FreeMonIconPalettes(); //Destroy pokemon icon sprite FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite - + for (i = 1; i <= gTasks[taskId].data[3]; i++) + { + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite + } FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + switch (sPokedexView->screenSwitchState) { case 1: @@ -7368,9 +7459,208 @@ static void Task_ExitEvolutionScreen(u8 taskId) { FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite } - FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + FreeInfoScreenWindowAndBgBuffers(); DestroyTask(taskId); } } + +//Stat bars on main screen, code by DizzyEgg, idea by Jaizu +#define PIXEL_COORDS_TO_OFFSET(x, y)( \ +/*Add tiles by X*/ \ +((y / 8) * 32 * 8) \ +/*Add tiles by X*/ \ ++ ((x / 8) * 32) \ +/*Add pixels by Y*/ \ ++ ((((y) - ((y / 8) * 8))) * 4) \ +/*Add pixels by X*/ \ ++ ((((x) - ((x / 8) * 8)) / 2))) + +static inline void WritePixel(u8 *dst, u32 x, u32 y, u32 value) +{ + if (x & 1) + { + dst[PIXEL_COORDS_TO_OFFSET(x, y)] &= ~0xF0; + dst[PIXEL_COORDS_TO_OFFSET(x, y)] |= (value << 4); + } + else + { + dst[PIXEL_COORDS_TO_OFFSET(x, y)] &= ~0xF; + dst[PIXEL_COORDS_TO_OFFSET(x, y)] |= (value); + } +} +#define STAT_BAR_X_OFFSET 10 +static void CreateStatBar(u8 *dst, u32 y, u32 width) +{ + u32 i, color; + + switch (width) + { + case 0 ... 5: + color = COLOR_WORST; + break; + case 6 ... 15: + color = COLOR_BAD; + break; + case 16 ... 25: + color = COLOR_AVERAGE; + break; + case 26 ... 31: + color = COLOR_GOOD; + break; + case 32 ... 37: + color = COLOR_VERY_GOOD; + break; + default: + color = COLOR_BEST; + break; + } + + // white pixes left side + WritePixel(dst, STAT_BAR_X_OFFSET, y + 0, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET, y + 1, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET, y + 2, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET, y + 3, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET, y + 4, COLOR_ID_BAR_WHITE); + + // white pixels right side + WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 0, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 1, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 2, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 3, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 4, COLOR_ID_BAR_WHITE); + + // Fill + for (i = 1; i < width - 1; i++) + { + WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 0, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 1, COLOR_ID_FILL_SHADOW + color * 2); + WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 2, COLOR_ID_FILL + color * 2); + WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 3, COLOR_ID_FILL + color * 2); + WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 4, COLOR_ID_BAR_WHITE); + } +} +static const u8 sBaseStatOffsets[] = +{ + offsetof(struct BaseStats, baseHP), + offsetof(struct BaseStats, baseAttack), + offsetof(struct BaseStats, baseDefense), + offsetof(struct BaseStats, baseSpAttack), + offsetof(struct BaseStats, baseSpDefense), + offsetof(struct BaseStats, baseSpeed), +}; +static void TryDestroyStatBars(void) +{ + if (sPokedexView->statBarsSpriteId != 0xFF) + { + FreeSpriteTilesByTag(TAG_STAT_BAR); + //FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsSpriteId]); + DestroySprite(&gSprites[sPokedexView->statBarsSpriteId]); + sPokedexView->statBarsSpriteId = 0xFF; + } +} +static void TryDestroyStatBarsBg(void) +{ + if (sPokedexView->statBarsBgSpriteId != 0xFF) + { + FreeSpriteTilesByTag(TAG_STAT_BAR_BG); + //FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsBgSpriteId]); + DestroySprite(&gSprites[sPokedexView->statBarsBgSpriteId]); + sPokedexView->statBarsBgSpriteId = 0xFF; + } +} +static void CreateStatBars(struct PokedexListItem *dexMon) +{ + u8 offset_x = 184; //Moves the complete stat box left/right + u8 offset_y = 16; //Moves the complete stat box up/down + TryDestroyStatBars(); + + sPokedexView->justScrolled = FALSE; + + + if (dexMon->owned) // Show filed bars + { + u8 i; + u32 width, statValue; + u8 *gfx = Alloc(64 * 64); + static const u8 sBarsYOffset[] = {3, 13, 23, 33, 43, 53}; + struct SpriteSheet sheet = {gfx, 64 * 64, TAG_STAT_BAR}; + u32 species = NationalPokedexNumToSpecies(dexMon->dexNum); + + memcpy(gfx, sStatBarsGfx, sizeof(sStatBarsGfx)); + for (i = 0; i < NUM_STATS; i++) + { + statValue = *((u8*)(&gBaseStats[species]) + sBaseStatOffsets[i]); + if (statValue <= 100) + { + width = statValue / 3; + if (width >= 33) + width -= 1; + } + else + width = (100 / 3) + ((statValue - 100) / 14); + + if (width > 39) // Max pixels + width = 39; + if (width < 3) + width = 3; + + CreateStatBar(gfx, sBarsYOffset[i], width); + } + + LoadSpriteSheet(&sheet); + free(gfx); + } + else if (dexMon->seen) // Just HP/ATK/DEF + { + static const struct SpriteSheet sheet = {sStatBarsGfx, 64 * 64, TAG_STAT_BAR}; + + LoadSpriteSheet(&sheet); + } + else // neither seen nor owned + { + return; + } + sPokedexView->statBarsSpriteId = CreateSprite(&sStatBarSpriteTemplate, 36+offset_x, 107+offset_y, 10); +} +static void CreateStatBarsBg(void) //HGSS_Ui stat bars background text +{ + static const struct SpriteSheet sheetStatBarsBg = {sStatBarsGfx, 64 * 64, TAG_STAT_BAR_BG}; + u8 offset_x = 184; //Moves the complete stat box left/right + u8 offset_y = 16; //Moves the complete stat box up/down + + TryDestroyStatBarsBg(); + + LoadSpriteSheet(&sheetStatBarsBg); + sPokedexView->statBarsBgSpriteId = CreateSprite(&sStatBarBgSpriteTemplate, 36+offset_x, 107+offset_y, 0); +} +// Hack to destroy sprites when a pokemon data is being loaded in +static bool32 IsMonInfoBeingLoaded(void) +{ + return (gSprites[sPokedexView->selectedMonSpriteId].callback == SpriteCB_MoveMonForInfoScreen); +} +static void SpriteCB_StatBars(struct Sprite *sprite) +{ + if (IsMonInfoBeingLoaded()) + sprite->invisible = TRUE; + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + { + FreeSpriteTilesByTag(TAG_STAT_BAR); + FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsSpriteId]); + DestroySprite(&gSprites[sPokedexView->statBarsSpriteId]); + sPokedexView->statBarsSpriteId = 0xFF; + } +} +static void SpriteCB_StatBarsBg(struct Sprite *sprite) +{ + if (IsMonInfoBeingLoaded()) + sprite->invisible = TRUE; + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + { + FreeSpriteTilesByTag(TAG_STAT_BAR_BG); + FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsBgSpriteId]); + DestroySprite(&gSprites[sPokedexView->statBarsBgSpriteId]); + sPokedexView->statBarsBgSpriteId = 0xFF; + } +} From 1b3b717248cb7b803d617e9ec2610fbaaa647b6c Mon Sep 17 00:00:00 2001 From: TheXaman Date: Thu, 11 Feb 2021 17:55:53 +0100 Subject: [PATCH 10/88] Added Forms screen for PokemonExpansion (rhh) --- graphics/pokedex/evoPE_tilemap.bin | Bin 0 -> 1344 bytes .../{evo_tileset.bin => evo_tilemap.bin} | Bin graphics/pokedex/evo_tileset.png | Bin 762 -> 915 bytes graphics/pokedex/forms_tilemap.bin | Bin 0 -> 1344 bytes include/graphics.h | 2 + include/strings.h | 1 + src/graphics.c | 4 +- src/pokedex.c | 265 +++++++++++++++++- src/strings.c | 1 + 9 files changed, 266 insertions(+), 7 deletions(-) create mode 100644 graphics/pokedex/evoPE_tilemap.bin rename graphics/pokedex/{evo_tileset.bin => evo_tilemap.bin} (100%) create mode 100644 graphics/pokedex/forms_tilemap.bin diff --git a/graphics/pokedex/evoPE_tilemap.bin b/graphics/pokedex/evoPE_tilemap.bin new file mode 100644 index 0000000000000000000000000000000000000000..8a13a6ffd8700298cfeb6133e6f2d557188d578c GIT binary patch literal 1344 zcmeH_Sx-VS5QRVC0-^}0xS{MWxQig0vbbDCeF66k{r~^M-d;#-VqyclK~HkpGt-k! zCo_QqCk8Iuc$mb?6w~;a!B2poh|My`JRufXWQk=~2(yaASi@QoqQr=kAW4dKHrQl~ zG~4X3%btksbHE`-WH=^EjuY|}h#E!dFHz=H;7qc8*5iuwSE)(VySuG)_+0ug`u1NA z<^3y68Uojn?X#u-gGp1VU+2f_9kqTnr=#rt_4=>lQ17VyS93aQT)#B{qtyQvZSHyC hktd#ck@J7UEq4OH+0uXEl{en`;FAttd`thJ^aEdrj(h+B literal 0 HcmV?d00001 diff --git a/graphics/pokedex/evo_tileset.bin b/graphics/pokedex/evo_tilemap.bin similarity index 100% rename from graphics/pokedex/evo_tileset.bin rename to graphics/pokedex/evo_tilemap.bin diff --git a/graphics/pokedex/evo_tileset.png b/graphics/pokedex/evo_tileset.png index 9e6df6b2833f6c05bbd79388da628aaca4734772..e39cb4de556c5d7c87a726b0187d05cacfc8ec14 100644 GIT binary patch delta 761 zcmVU$ zn=qo~Pa^qSHULXQh?W7kJ^=t|BMhJo0mcB(O%lQ1;xZsGfUYvR zTLWmr3IOQai7ud9?O+EW!<4bsfB+aJz(4oxLbcB|8@~+Dt{Lig%rUYiU>+jjuT3{^Y0Nb7$G7ZLzkX`Z&7 zRY2;;9|&V>-YTuzmXMFT0qdua6R-t?xw$ludnr=;Q_9P9@-|?Y96;2HfxT z9l&Q=^?v~xc;SG1+nfAS#>zRa0Hh%LZOfVpTC7gp+yXYDdEI{k3O#KB);4HAnq=&6 z?!fK?zO4YKDy>yYpGX1s`E)y_<05LM>a^|v!Ww|OuhTl!fI~x|J3ss9tF`ms&i?(6 z_t(V*_eKDEOK4{t4wCxtR}56t83BO-vmfw{j7Ra10gd4|@?b56iV1^tX@Xv-*Fd=d zTLR41;tKWNN^zebWU}g#o*+TT%z|NQ^kvDhlh9H+2#RXi zJX_MYons^Vc<=sbZU)47AK)}KUDs1#BNkKyX{Jie!I4^a9}h0U*Lb1b_n($B5XC8sYEiGGGz_W`*1?0XVP$ zi25*Mg5BZ-8vq@qjI9O$a1?->`*ud{bIpc71FUNf{f^nbq;r)LmeMdl(hUPRBNWg_ z{_zlFKWNI7Q!d+R08wsF4l@eSM)cNXD%!pQNaj%OsfpNsYNiCBpv`}?wu=g&jtn@P zIn43aH9%CN%Ebcy4ARY1#8{ZsU4>s$NF=Ai!3Zg{3}izW z1Tc2_@?`0jMVO^4HREanfTFupud%c1y8%dB8$i3pIZNA}38dEtq=IPIK{2yC0y^< diff --git a/graphics/pokedex/forms_tilemap.bin b/graphics/pokedex/forms_tilemap.bin new file mode 100644 index 0000000000000000000000000000000000000000..0549c17f0b132ef5b4a3fc801b62507f8751e6b9 GIT binary patch literal 1344 zcmeIx*G@w*5CqUe2)*~7(0lK_J^`Zl{{Mf$jRO)_;^B($1|Dhb@$Sg$m0cvISXzlv zWy)2kRHa&tT6OB9y#|e%G;7hSO}h@Ax}?(Ga-&B^R28^Xp{175v+F0(L*SuRk73qVoOw?0*tRJSX1&cr1zfuRr$y|5E?YUAT1R+KpRx;r|^vavb3+=k#~D Q_u$c!XD?p81%ILR4vK({`2YX_ literal 0 HcmV?d00001 diff --git a/include/graphics.h b/include/graphics.h index 1ffc6e9828e3..79346190356f 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -3298,6 +3298,8 @@ extern const u16 gPokedexBgNational_Pal[]; extern const u8 gPokedexInfoScreen_Tilemap[]; extern const u8 gPokedexStatsScreen_Tilemap[]; extern const u8 gPokedexEvolutionScreen_Tilemap[]; +extern const u8 gPokedexEvolutionScreen_Tilemap_PE[]; +extern const u8 gPokedexFormsScreen_Tilemap[]; extern const u8 gPokedexCryScreen_Tilemap[]; extern const u8 gPokedexSizeScreen_Tilemap[]; extern const u8 gPokedexScreenSelectBarMain_Tilemap[]; diff --git a/include/strings.h b/include/strings.h index fd773e7f5243..5707412579ee 100644 --- a/include/strings.h +++ b/include/strings.h @@ -629,6 +629,7 @@ extern const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[]; extern const u8 gText_EVO_TRADE_SPECIFIC_MON[]; extern const u8 gText_EVO_SPECIFIC_MAP[]; extern const u8 gText_EVO_NONE[]; +extern const u8 gText_FORMS_NONE[]; // birch dex rating text diff --git a/src/graphics.c b/src/graphics.c index 8abc6d76fb05..bf69f95bbae3 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1276,7 +1276,9 @@ const u32 gPokedexScreenSelectBarSubmenu_Tilemap_Clear[] = INCBIN_U32("graphics/ // const u32 gPokedexScreenSelectBarSubmenu_Size_Tilemap[] = INCBIN_U32("graphics/pokedex/screen_select_bar_submenu_size.bin.lz"); const u32 gPokedexInfoScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/info_screen.bin.lz"); const u32 gPokedexStatsScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/stats_screen.bin.lz"); -const u32 gPokedexEvolutionScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/evo_tileset.bin.lz"); +const u32 gPokedexEvolutionScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/evo_tilemap.bin.lz"); +const u32 gPokedexEvolutionScreen_Tilemap_PE[] = INCBIN_U32("graphics/pokedex/evoPE_tilemap.bin.lz"); +const u32 gPokedexFormsScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/forms_tilemap.bin.lz"); const u32 gPokedexCryScreen_Tilemap[] = INCBIN_U32("graphics/pokedex/cry_screen.bin.lz"); const u16 gPokedexSearchMenu_Pal[] = INCBIN_U16("graphics/pokedex/search_menu.gbapal"); const u32 gPokedexSearchMenu_Gfx[] = INCBIN_U32("graphics/pokedex/search_menu.4bpp.lz"); diff --git a/src/pokedex.c b/src/pokedex.c index d711b14a44fc..560d64dbba74 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -64,6 +64,7 @@ enum INFO_SCREEN, STATS_SCREEN, EVO_SCREEN, + FORMS_SCREEN, //Pokemonexpansion only (rhh) AREA_SCREEN, CRY_SCREEN, SIZE_SCREEN, @@ -368,6 +369,16 @@ static void CreateStatBarsBg(void); static void SpriteCB_StatBars(struct Sprite *sprite); static void SpriteCB_StatBarsBg(struct Sprite *sprite); +//HGSS_UI Forms screen for PokemonExpansion (rhh) +#ifdef POKEMON_EXPANSION +static void Task_LoadFormsScreen(u8 taskId); +static void Task_HandleFormsScreenInput(u8 taskId); +static void PrintForms(u8 taskId, u16 species); +static void Task_SwitchScreensFromFormsScreen(u8 taskId); +static void Task_ExitFormsScreen(u8 taskId); +#endif + +//HGSS_UI Physical Special Split icon for BattleEngine (rhh) #ifdef BATTLE_ENGINE static u8 ShowSplitIcon(u32 split); //Physical/Special Split from BE static void DestroySplitIcon(void); //Physical/Special Split from BE @@ -6210,10 +6221,10 @@ static void Task_LoadStatsScreen(u8 taskId) FreeMonIconPalettes(); //Free space for new pallete LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon #ifndef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 17, 31, 4, 0, TRUE); //Create pokemon sprite + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0, TRUE); //Create pokemon sprite #endif #ifdef POKEMON_EXPANSION - gTasks[taskId].data[6] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 17, 31, 4, 0); //Create pokemon sprite + gTasks[taskId].data[6] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite #endif gSprites[gTasks[taskId].data[4]].oam.priority = 0; } @@ -7017,7 +7028,12 @@ static void Task_LoadEvolutionScreen(u8 taskId) break; case 1: DecompressAndLoadBgGfxUsingHeap(3, gPokedexEvo_Gfx, 0x2000, 0, 0); - CopyToBgTilemapBuffer(3, gPokedexEvolutionScreen_Tilemap, 0, 0); + #ifndef POKEMON_EXPANSION + CopyToBgTilemapBuffer(3, gPokedexEvolutionScreen_Tilemap, 0, 0); + #endif + #ifdef POKEMON_EXPANSION + CopyToBgTilemapBuffer(3, gPokedexEvolutionScreen_Tilemap_PE, 0, 0); + #endif FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); CopyWindowToVram(WIN_INFO, 3); @@ -7038,10 +7054,10 @@ static void Task_LoadEvolutionScreen(u8 taskId) FreeMonIconPalettes(); //Free space for new pallete LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon #ifndef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 17, 31, 4, 0, TRUE); //Create pokemon sprite + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0, TRUE); //Create pokemon sprite #endif #ifdef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 17, 31, 4, 0); //Create pokemon sprite + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite #endif gSprites[gTasks[taskId].data[4]].oam.priority = 0; } @@ -7085,6 +7101,7 @@ static void Task_LoadEvolutionScreen(u8 taskId) gMain.state++; break; case 9: + sPokedexView->screenSwitchState = 0; gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = 0; gTasks[taskId].data[2] = 1; @@ -7095,6 +7112,18 @@ static void Task_LoadEvolutionScreen(u8 taskId) } static void Task_HandleEvolutionScreenInput(u8 taskId) { + //Switch to forms screen, Pokemon Expansion only (rhh) + #ifdef POKEMON_EXPANSION + if (JOY_NEW(A_BUTTON)) + { + sPokedexView->selectedScreen = FORMS_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 3; + gTasks[taskId].func = Task_SwitchScreensFromEvolutionScreen; + PlaySE(SE_PIN); + } + #endif + //Exit to overview if (JOY_NEW(B_BUTTON)) { @@ -7170,7 +7199,14 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) //Calculate number of possible direct evolutions (e.g. Eevee has 5 but torchic has 1) for (i = 0; i < EVOS_PER_MON; i++) { - if(gEvolutionTable[species][i].method != 0) + #ifndef POKEMON_EXPANSION + if(gEvolutionTable[species][i].method != 0) + times += 1; + #endif + #ifdef POKEMON_EXPANSION + if(gEvolutionTable[species][i].method != 0 && gEvolutionTable[species][i].method != EVO_MEGA_EVOLUTION) + times += 1; + #endif times += 1; gTasks[taskId].data[3] = times; } @@ -7442,6 +7478,11 @@ static void Task_SwitchScreensFromEvolutionScreen(u8 taskId) case 2: gTasks[taskId].func = Task_LoadCryScreen; break; + #ifdef POKEMON_EXPANSION + case 3: + gTasks[taskId].func = Task_LoadFormsScreen; + break; + #endif default: gTasks[taskId].func = Task_LoadInfoScreen; break; @@ -7664,3 +7705,215 @@ static void SpriteCB_StatBarsBg(struct Sprite *sprite) sPokedexView->statBarsBgSpriteId = 0xFF; } } + + +//PokedexPlus HGSS_Ui Forms Page PokemonExpansion form rhh only +#ifdef POKEMON_EXPANSION +static void Task_LoadFormsScreen(u8 taskId) +{ + switch (gMain.state) + { + case 0: + default: + if (!gPaletteFade.active) + { + u16 r2; + + sPokedexView->currentPage = FORMS_SCREEN; + gPokedexVBlankCB = gMain.vblankCallback; + SetVBlankCallback(NULL); + r2 = 0; + if (gTasks[taskId].data[1] != 0) + r2 += DISPCNT_OBJ_ON; + if (gTasks[taskId].data[2] != 0) + r2 |= DISPCNT_BG1_ON; + ResetOtherVideoRegisters(r2); + gMain.state = 1; + } + break; + case 1: + DecompressAndLoadBgGfxUsingHeap(3, gPokedexEvo_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexFormsScreen_Tilemap, 0, 0); + FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); + PutWindowTilemap(WIN_INFO); + CopyWindowToVram(WIN_INFO, 3); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + gMain.state++; + break; + case 2: + LoadScreenSelectBarMain(0xD); + LoadPokedexBgPalette(sPokedexView->isSearchResults); + gMain.state++; + break; + case 3: + if (gTasks[taskId].data[1] == 0) + { + //Icon + FreeMonIconPalettes(); //Free space for new pallete + LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite + gSprites[gTasks[taskId].data[4]].oam.priority = 0; + } + gMain.state++; + break; + case 4: + //Print form icons + gTasks[taskId].data[3] = 0; + PrintForms(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); + gMain.state++; + break; + case 5: + { + u32 preservedPalettes = 0; + + if (gTasks[taskId].data[2] != 0) + preservedPalettes = 0x14; // each bit represents a palette index + if (gTasks[taskId].data[1] != 0) + preservedPalettes |= (1 << (gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum + 16)); + BeginNormalPaletteFade(~preservedPalettes, 0, 16, 0, RGB_BLACK); + SetVBlankCallback(gPokedexVBlankCB); + gMain.state++; + } + break; + case 6: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + HideBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 7: + if (!gPaletteFade.active) + gMain.state++; + break; + case 8: + gMain.state++; + break; + case 9: + sPokedexView->screenSwitchState = 0; + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 1; + gTasks[taskId].func = Task_HandleFormsScreenInput; + gMain.state = 0; + break; + } +} +static void Task_HandleFormsScreenInput(u8 taskId) +{ + if (JOY_NEW(A_BUTTON)) + { + sPokedexView->selectedScreen = EVO_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromFormsScreen; + PlaySE(SE_PIN); + } + + + //Exit to overview + if (JOY_NEW(B_BUTTON)) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_ExitFormsScreen; + PlaySE(SE_PC_OFF); + return; + } +} +#define FORM_SPECIES_END (0xffff) +static void PrintForms(u8 taskId, u16 species) +{ + int i; + u16 speciesForm; + + + bool8 left = TRUE; + u8 base_x = 5; + u8 base_x_offset = 54; + u8 base_y = 52; + u8 base_offset = 9; + u8 base_i = 0; + u8 times = 0; + + StringCopy(gStringVar1, gSpeciesNames[species]); + + for (i=0; i < 30; i++) + { + speciesForm = GetFormSpeciesId(species, i); + if (speciesForm == FORM_SPECIES_END) + break; + else if (speciesForm == species) + continue; + else + { + times += 1; + LoadMonIconPalette(speciesForm); //Loads pallete for current mon + if (times < 7) + gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 52 + 34*(times-1), 31, 4, 0); //Create pokemon sprite + else if (times < 14) + gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-7), 70, 4, 0); //Create pokemon sprite + else if (times < 21) + gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-14), 104, 4, 0); //Create pokemon sprite + else + gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-21), 138, 4, 0); //Create pokemon sprite + gSprites[gTasks[taskId].data[4+times]].oam.priority = 0; + } + } + gTasks[taskId].data[3] = times; + + //If there are no forms print text + if (times == 0) + { + StringExpandPlaceholders(gStringVar4, gText_FORMS_NONE); + PrintInfoScreenTextSmall(gStringVar4, base_x, base_y + base_offset*times); + } +} +static void Task_SwitchScreensFromFormsScreen(u8 taskId) +{ + u8 i; + if (!gPaletteFade.active) + { + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + for (i = 1; i <= gTasks[taskId].data[3]; i++) + { + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite + } + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + + switch (sPokedexView->screenSwitchState) + { + case 1: + gTasks[taskId].func = Task_LoadEvolutionScreen; + break; + default: + gTasks[taskId].func = Task_LoadInfoScreen; + break; + } + } +} +static void Task_ExitFormsScreen(u8 taskId) +{ + u8 i; + if (!gPaletteFade.active) + { + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + for (i = 1; i <= gTasks[taskId].data[3]; i++) + { + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite + } + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + + FreeInfoScreenWindowAndBgBuffers(); + DestroyTask(taskId); + } +} +#endif + diff --git a/src/strings.c b/src/strings.c index 14d4455d9729..5bab8cbb03c1 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1915,3 +1915,4 @@ const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[] = _("Lvl up with with dark t const u8 gText_EVO_TRADE_SPECIFIC_MON[] = _("is traded for a {STR_VAR_2}"); const u8 gText_EVO_SPECIFIC_MAP[] = _("Lvl up on {STR_VAR_2}"); const u8 gText_EVO_NONE[] = _("There is no evolution for {STR_VAR_1}."); +const u8 gText_FORMS_NONE[] = _("No alternate forms for {STR_VAR_1}."); From 80af708958bdf166cfab680a111a67a29dc3da26 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Thu, 11 Feb 2021 18:58:26 +0100 Subject: [PATCH 11/88] Fixed EVO_SPECIFIC_MAP (PE from rhh), huge thanks to "Spherical Ice" --- src/pokedex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 560d64dbba74..02f7d6930182 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7180,7 +7180,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) int i; #ifdef POKEMON_EXPANSION int j; - u16 currentMap; + const struct MapHeader *mapHeader; #endif u16 targetSpecies = 0; @@ -7446,8 +7446,8 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); break; case EVO_SPECIFIC_MAP: - //currentMap = ((gSaveBlock1Ptr->location.mapGroup) << 8 | gSaveBlock1Ptr->location.mapNum); - GetMapName(gStringVar2, gEvolutionTable[species][i].param, 0); + mapHeader = Overworld_GetMapHeaderByGroupAndId(gEvolutionTable[species][i].param >> 8, gEvolutionTable[species][i].param & 0xFF); + GetMapName(gStringVar2, mapHeader->regionMapSectionId, 0); targetSpecies = gEvolutionTable[species][i].targetSpecies; handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MAP ); From ac7a38850b223d59d11881784336583ddd76c565 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Thu, 11 Feb 2021 19:47:24 +0100 Subject: [PATCH 12/88] fixed small bug in calcing times --- src/pokedex.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 02f7d6930182..5fa51ea29212 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7207,9 +7207,8 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) if(gEvolutionTable[species][i].method != 0 && gEvolutionTable[species][i].method != EVO_MEGA_EVOLUTION) times += 1; #endif - times += 1; - gTasks[taskId].data[3] = times; } + gTasks[taskId].data[3] = times; //If there are no evolutions print text if (times == 0) From c89df9d9d1e66e7ef280a3a8219305217b404426 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Fri, 12 Feb 2021 11:16:23 +0100 Subject: [PATCH 13/88] Changed graphics file structure, added DECAPPED version by NobodySociety, added constant to make custom dark palette switch easy --- ...ect_bar_submenu.bin => HGSS_SelectBar.bin} | Bin ...enu_clear.bin => HGSS_SelectBar_clear.bin} | Bin graphics/pokedex/HGSS_palette_default.pal | 51 ++++++ .../pokedex/HGSS_palette_default_dark.pal | 51 ++++++ graphics/pokedex/HGSS_palette_national.pal | 51 ++++++ .../pokedex/HGSS_palette_national_dark.pal | 51 ++++++ ..._menu.pal => HGSS_palette_search_menu.pal} | 0 .../pokedex/HGSS_palette_search_menu_dark.pal | 67 +++++++ ...et.pal => HGSS_palette_search_results.pal} | 0 .../HGSS_palette_search_results_dark.pal | 19 ++ ...screen.bin => HGSS_tilemap_cry_screen.bin} | Bin ...ilemap.bin => HGSS_tilemap_evo_screen.bin} | Bin ...map.bin => HGSS_tilemap_evo_screen_PE.bin} | Bin ...emap.bin => HGSS_tilemap_forms_screen.bin} | Bin ...creen.bin => HGSS_tilemap_info_screen.bin} | Bin ...{list.bin => HGSS_tilemap_list_screen.bin} | Bin ... => HGSS_tilemap_list_screen_underlay.bin} | Bin ...n => HGSS_tilemap_search_screen_hoenn.bin} | Bin ...> HGSS_tilemap_search_screen_national.bin} | Bin ...creen.bin => HGSS_tilemap_size_screen.bin} | Bin ...u_main.bin => HGSS_tilemap_start_menu.bin} | Bin ...GSS_tilemap_start_menu_search_results.bin} | Bin ...reen.bin => HGSS_tilemap_stats_screen.bin} | Bin ...terface.png => HGSS_tileset_interface.png} | Bin .../pokedex/HGSS_tileset_interface_DECA.png | Bin 0 -> 1097 bytes .../{menu.png => HGSS_tileset_menu1.png} | Bin ...evo_tileset.png => HGSS_tileset_menu2.png} | Bin .../{menu_rest.png => HGSS_tileset_menu3.png} | Bin ...nu_list.png => HGSS_tileset_menu_list.png} | Bin .../pokedex/HGSS_tileset_menu_list_DECA.png | Bin 0 -> 1542 bytes ..._menu.png => HGSS_tileset_menu_search.png} | Bin .../pokedex/HGSS_tileset_menu_search_DECA.png | Bin 0 -> 1742 bytes graphics/pokedex/RES_HGSS_palette.pal | 19 ++ graphics/pokedex/bg_national.pal | 99 ---------- graphics/pokedex/menuOLD.png | Bin 2045 -> 0 bytes graphics/pokedex/screen_select_bar_main.bin | Bin 192 -> 0 bytes graphics/pokedex/search_results_bg.pal | 99 ---------- include/graphics.h | 61 ++++--- src/graphics.c | 68 +++---- src/pokedex.c | 170 +++++++++++++----- 40 files changed, 509 insertions(+), 297 deletions(-) rename graphics/pokedex/{screen_select_bar_submenu.bin => HGSS_SelectBar.bin} (100%) rename graphics/pokedex/{screen_select_bar_submenu_clear.bin => HGSS_SelectBar_clear.bin} (100%) create mode 100644 graphics/pokedex/HGSS_palette_default.pal create mode 100644 graphics/pokedex/HGSS_palette_default_dark.pal create mode 100644 graphics/pokedex/HGSS_palette_national.pal create mode 100644 graphics/pokedex/HGSS_palette_national_dark.pal rename graphics/pokedex/{search_menu.pal => HGSS_palette_search_menu.pal} (100%) create mode 100644 graphics/pokedex/HGSS_palette_search_menu_dark.pal rename graphics/pokedex/{hgss_pokedex_tileset.pal => HGSS_palette_search_results.pal} (100%) create mode 100644 graphics/pokedex/HGSS_palette_search_results_dark.pal rename graphics/pokedex/{cry_screen.bin => HGSS_tilemap_cry_screen.bin} (100%) rename graphics/pokedex/{evo_tilemap.bin => HGSS_tilemap_evo_screen.bin} (100%) rename graphics/pokedex/{evoPE_tilemap.bin => HGSS_tilemap_evo_screen_PE.bin} (100%) rename graphics/pokedex/{forms_tilemap.bin => HGSS_tilemap_forms_screen.bin} (100%) rename graphics/pokedex/{info_screen.bin => HGSS_tilemap_info_screen.bin} (100%) rename graphics/pokedex/{list.bin => HGSS_tilemap_list_screen.bin} (100%) rename graphics/pokedex/{list_underlay.bin => HGSS_tilemap_list_screen_underlay.bin} (100%) rename graphics/pokedex/{search_menu_hoenn.bin => HGSS_tilemap_search_screen_hoenn.bin} (100%) rename graphics/pokedex/{search_menu_national.bin => HGSS_tilemap_search_screen_national.bin} (100%) rename graphics/pokedex/{size_screen.bin => HGSS_tilemap_size_screen.bin} (100%) rename graphics/pokedex/{start_menu_main.bin => HGSS_tilemap_start_menu.bin} (100%) rename graphics/pokedex/{start_menu_search_results.bin => HGSS_tilemap_start_menu_search_results.bin} (100%) rename graphics/pokedex/{stats_screen.bin => HGSS_tilemap_stats_screen.bin} (100%) rename graphics/pokedex/{interface.png => HGSS_tileset_interface.png} (100%) create mode 100644 graphics/pokedex/HGSS_tileset_interface_DECA.png rename graphics/pokedex/{menu.png => HGSS_tileset_menu1.png} (100%) rename graphics/pokedex/{evo_tileset.png => HGSS_tileset_menu2.png} (100%) rename graphics/pokedex/{menu_rest.png => HGSS_tileset_menu3.png} (100%) rename graphics/pokedex/{menu_list.png => HGSS_tileset_menu_list.png} (100%) create mode 100644 graphics/pokedex/HGSS_tileset_menu_list_DECA.png rename graphics/pokedex/{search_menu.png => HGSS_tileset_menu_search.png} (100%) create mode 100644 graphics/pokedex/HGSS_tileset_menu_search_DECA.png create mode 100644 graphics/pokedex/RES_HGSS_palette.pal delete mode 100644 graphics/pokedex/bg_national.pal delete mode 100644 graphics/pokedex/menuOLD.png delete mode 100644 graphics/pokedex/screen_select_bar_main.bin delete mode 100644 graphics/pokedex/search_results_bg.pal diff --git a/graphics/pokedex/screen_select_bar_submenu.bin b/graphics/pokedex/HGSS_SelectBar.bin similarity index 100% rename from graphics/pokedex/screen_select_bar_submenu.bin rename to graphics/pokedex/HGSS_SelectBar.bin diff --git a/graphics/pokedex/screen_select_bar_submenu_clear.bin b/graphics/pokedex/HGSS_SelectBar_clear.bin similarity index 100% rename from graphics/pokedex/screen_select_bar_submenu_clear.bin rename to graphics/pokedex/HGSS_SelectBar_clear.bin diff --git a/graphics/pokedex/HGSS_palette_default.pal b/graphics/pokedex/HGSS_palette_default.pal new file mode 100644 index 000000000000..5889ede7ac0f --- /dev/null +++ b/graphics/pokedex/HGSS_palette_default.pal @@ -0,0 +1,51 @@ +JASC-PAL +0100 +48 +193 33 177 +249 249 249 +225 225 225 +201 201 201 +169 169 169 +129 129 129 +249 153 161 +233 49 49 +193 33 41 +145 17 33 +249 153 161 +193 33 41 +141 251 184 +52 66 162 +194 181 66 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +49 213 74 +24 131 32 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +180 205 246 +49 139 255 +189 156 90 +0 0 0 diff --git a/graphics/pokedex/HGSS_palette_default_dark.pal b/graphics/pokedex/HGSS_palette_default_dark.pal new file mode 100644 index 000000000000..5889ede7ac0f --- /dev/null +++ b/graphics/pokedex/HGSS_palette_default_dark.pal @@ -0,0 +1,51 @@ +JASC-PAL +0100 +48 +193 33 177 +249 249 249 +225 225 225 +201 201 201 +169 169 169 +129 129 129 +249 153 161 +233 49 49 +193 33 41 +145 17 33 +249 153 161 +193 33 41 +141 251 184 +52 66 162 +194 181 66 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +49 213 74 +24 131 32 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +180 205 246 +49 139 255 +189 156 90 +0 0 0 diff --git a/graphics/pokedex/HGSS_palette_national.pal b/graphics/pokedex/HGSS_palette_national.pal new file mode 100644 index 000000000000..5889ede7ac0f --- /dev/null +++ b/graphics/pokedex/HGSS_palette_national.pal @@ -0,0 +1,51 @@ +JASC-PAL +0100 +48 +193 33 177 +249 249 249 +225 225 225 +201 201 201 +169 169 169 +129 129 129 +249 153 161 +233 49 49 +193 33 41 +145 17 33 +249 153 161 +193 33 41 +141 251 184 +52 66 162 +194 181 66 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +49 213 74 +24 131 32 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +180 205 246 +49 139 255 +189 156 90 +0 0 0 diff --git a/graphics/pokedex/HGSS_palette_national_dark.pal b/graphics/pokedex/HGSS_palette_national_dark.pal new file mode 100644 index 000000000000..5889ede7ac0f --- /dev/null +++ b/graphics/pokedex/HGSS_palette_national_dark.pal @@ -0,0 +1,51 @@ +JASC-PAL +0100 +48 +193 33 177 +249 249 249 +225 225 225 +201 201 201 +169 169 169 +129 129 129 +249 153 161 +233 49 49 +193 33 41 +145 17 33 +249 153 161 +193 33 41 +141 251 184 +52 66 162 +194 181 66 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +49 213 74 +24 131 32 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +180 205 246 +49 139 255 +189 156 90 +0 0 0 diff --git a/graphics/pokedex/search_menu.pal b/graphics/pokedex/HGSS_palette_search_menu.pal similarity index 100% rename from graphics/pokedex/search_menu.pal rename to graphics/pokedex/HGSS_palette_search_menu.pal diff --git a/graphics/pokedex/HGSS_palette_search_menu_dark.pal b/graphics/pokedex/HGSS_palette_search_menu_dark.pal new file mode 100644 index 000000000000..b6142eb3f7b0 --- /dev/null +++ b/graphics/pokedex/HGSS_palette_search_menu_dark.pal @@ -0,0 +1,67 @@ +JASC-PAL +0100 +64 +123 131 0 +0 0 0 +172 172 172 +255 255 255 +255 255 255 +98 98 115 +57 57 57 +123 115 74 +156 230 0 +57 115 0 +255 172 0 +131 32 32 +82 189 90 +24 131 32 +255 32 32 +0 0 0 +123 131 0 +0 0 0 +172 172 172 +255 255 255 +255 255 255 +98 98 115 +57 57 57 +123 115 74 +41 115 0 +32 49 32 +180 106 0 +16 0 0 +82 189 90 +24 131 32 +0 0 0 +0 0 0 +123 131 0 +0 0 0 +172 172 172 +172 172 172 +172 172 172 +98 98 115 +57 57 57 +123 115 74 +32 49 32 +32 32 32 +74 32 32 +32 32 32 +82 189 90 +24 131 32 +255 32 32 +0 0 0 +123 131 0 +0 0 0 +172 172 172 +172 172 172 +172 172 172 +98 98 115 +57 57 57 +123 115 74 +32 49 32 +32 32 32 +74 32 32 +32 32 32 +82 189 90 +24 131 32 +0 0 0 +0 0 0 diff --git a/graphics/pokedex/hgss_pokedex_tileset.pal b/graphics/pokedex/HGSS_palette_search_results.pal similarity index 100% rename from graphics/pokedex/hgss_pokedex_tileset.pal rename to graphics/pokedex/HGSS_palette_search_results.pal diff --git a/graphics/pokedex/HGSS_palette_search_results_dark.pal b/graphics/pokedex/HGSS_palette_search_results_dark.pal new file mode 100644 index 000000000000..892bb6c10488 --- /dev/null +++ b/graphics/pokedex/HGSS_palette_search_results_dark.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +193 33 177 +249 249 249 +225 225 225 +201 201 201 +169 169 169 +129 129 129 +249 153 161 +233 49 49 +193 33 41 +145 17 33 +156 226 199 +141 251 184 +52 66 162 +194 181 66 +159 216 234 +0 0 0 diff --git a/graphics/pokedex/cry_screen.bin b/graphics/pokedex/HGSS_tilemap_cry_screen.bin similarity index 100% rename from graphics/pokedex/cry_screen.bin rename to graphics/pokedex/HGSS_tilemap_cry_screen.bin diff --git a/graphics/pokedex/evo_tilemap.bin b/graphics/pokedex/HGSS_tilemap_evo_screen.bin similarity index 100% rename from graphics/pokedex/evo_tilemap.bin rename to graphics/pokedex/HGSS_tilemap_evo_screen.bin diff --git a/graphics/pokedex/evoPE_tilemap.bin b/graphics/pokedex/HGSS_tilemap_evo_screen_PE.bin similarity index 100% rename from graphics/pokedex/evoPE_tilemap.bin rename to graphics/pokedex/HGSS_tilemap_evo_screen_PE.bin diff --git a/graphics/pokedex/forms_tilemap.bin b/graphics/pokedex/HGSS_tilemap_forms_screen.bin similarity index 100% rename from graphics/pokedex/forms_tilemap.bin rename to graphics/pokedex/HGSS_tilemap_forms_screen.bin diff --git a/graphics/pokedex/info_screen.bin b/graphics/pokedex/HGSS_tilemap_info_screen.bin similarity index 100% rename from graphics/pokedex/info_screen.bin rename to graphics/pokedex/HGSS_tilemap_info_screen.bin diff --git a/graphics/pokedex/list.bin b/graphics/pokedex/HGSS_tilemap_list_screen.bin similarity index 100% rename from graphics/pokedex/list.bin rename to graphics/pokedex/HGSS_tilemap_list_screen.bin diff --git a/graphics/pokedex/list_underlay.bin b/graphics/pokedex/HGSS_tilemap_list_screen_underlay.bin similarity index 100% rename from graphics/pokedex/list_underlay.bin rename to graphics/pokedex/HGSS_tilemap_list_screen_underlay.bin diff --git a/graphics/pokedex/search_menu_hoenn.bin b/graphics/pokedex/HGSS_tilemap_search_screen_hoenn.bin similarity index 100% rename from graphics/pokedex/search_menu_hoenn.bin rename to graphics/pokedex/HGSS_tilemap_search_screen_hoenn.bin diff --git a/graphics/pokedex/search_menu_national.bin b/graphics/pokedex/HGSS_tilemap_search_screen_national.bin similarity index 100% rename from graphics/pokedex/search_menu_national.bin rename to graphics/pokedex/HGSS_tilemap_search_screen_national.bin diff --git a/graphics/pokedex/size_screen.bin b/graphics/pokedex/HGSS_tilemap_size_screen.bin similarity index 100% rename from graphics/pokedex/size_screen.bin rename to graphics/pokedex/HGSS_tilemap_size_screen.bin diff --git a/graphics/pokedex/start_menu_main.bin b/graphics/pokedex/HGSS_tilemap_start_menu.bin similarity index 100% rename from graphics/pokedex/start_menu_main.bin rename to graphics/pokedex/HGSS_tilemap_start_menu.bin diff --git a/graphics/pokedex/start_menu_search_results.bin b/graphics/pokedex/HGSS_tilemap_start_menu_search_results.bin similarity index 100% rename from graphics/pokedex/start_menu_search_results.bin rename to graphics/pokedex/HGSS_tilemap_start_menu_search_results.bin diff --git a/graphics/pokedex/stats_screen.bin b/graphics/pokedex/HGSS_tilemap_stats_screen.bin similarity index 100% rename from graphics/pokedex/stats_screen.bin rename to graphics/pokedex/HGSS_tilemap_stats_screen.bin diff --git a/graphics/pokedex/interface.png b/graphics/pokedex/HGSS_tileset_interface.png similarity index 100% rename from graphics/pokedex/interface.png rename to graphics/pokedex/HGSS_tileset_interface.png diff --git a/graphics/pokedex/HGSS_tileset_interface_DECA.png b/graphics/pokedex/HGSS_tileset_interface_DECA.png new file mode 100644 index 0000000000000000000000000000000000000000..2332c79fa0eac417e94a0b7e03396d78ddd967f4 GIT binary patch literal 1097 zcmV-P1h)H$P)QRr&CAI z2qG%lQf43y$qHBAv+!{PZTX#rYXVXpt_W1F3`dZ1VOT;hXND(?@Xf?gd;~m{H$qr0 za&Yy&6a;oZRQ-~2hdL681%4Wmkc1>8;d8(xr2Me}uc-Lo>mdmWM6gEz<{~OFRs_~T z38RRJ@W4Y2o-pa4t&odIJ*GO@;cUtO0@sE2m+mcvoY$^9jdj8BMRS& z{`_5ky^T-J5A)Z}4>T;Xk5W577=oW4_^p-)lsDMHLXbcbi+=yHrms0@};%9*O|ELkV?w8PJB}rY6#O z!@yR!AwW40&NXne*IFhLiA3TxWc=_U&80_HH zAz0}qTbtVrHTOSqbGv_Zg4#v3IhN0ZC=<%u|Ldq0Q;tEX5cV^F9vp4jtjBFa$JZV+_8T)waHPGgkcG;X7#r7PegZ7XBa?&2uKwIQ~(hhyw+?Cvc zUt8m8i+?w^-A!HF;|m||DS`hn;TTH(fswvr2M}M74@`uXq;N$~P~@U#Pe98lfP)~d zg#DqPo5+(CeU(4x3U9KWC-5IoYeMl#KidW$2Dy-Kj%F<1X}><7bggi464*$j7}1k- zXBXFd&v&K^>RgaF+rildjJ7~iS|ACmy}X5&`v-kvtQx(4%ntC9Q=`+x`o|nk+Nv>V z%_^>T{XY|m@kTdc*>+n&PPrGXu(yM4w{J{jxu@*l{DD}*3&r?@vBP3q6q6C?5@`4K zxQLWn?#_16%8?Mvla}%8$$jO;T{-Ijj!^d6ClZN7B9TZW5{X12@p=3MqV#DpTGNVh P00000NkvXXu0mjfZxsY} literal 0 HcmV?d00001 diff --git a/graphics/pokedex/menu.png b/graphics/pokedex/HGSS_tileset_menu1.png similarity index 100% rename from graphics/pokedex/menu.png rename to graphics/pokedex/HGSS_tileset_menu1.png diff --git a/graphics/pokedex/evo_tileset.png b/graphics/pokedex/HGSS_tileset_menu2.png similarity index 100% rename from graphics/pokedex/evo_tileset.png rename to graphics/pokedex/HGSS_tileset_menu2.png diff --git a/graphics/pokedex/menu_rest.png b/graphics/pokedex/HGSS_tileset_menu3.png similarity index 100% rename from graphics/pokedex/menu_rest.png rename to graphics/pokedex/HGSS_tileset_menu3.png diff --git a/graphics/pokedex/menu_list.png b/graphics/pokedex/HGSS_tileset_menu_list.png similarity index 100% rename from graphics/pokedex/menu_list.png rename to graphics/pokedex/HGSS_tileset_menu_list.png diff --git a/graphics/pokedex/HGSS_tileset_menu_list_DECA.png b/graphics/pokedex/HGSS_tileset_menu_list_DECA.png new file mode 100644 index 0000000000000000000000000000000000000000..dc84b9ea38c68347040e85a4002a4856cf0cbcf8 GIT binary patch literal 1542 zcmV+h2Ko7kP)$2P+2!J)3ZvXlIZ(9XXz-zKe&vd4oJxRPQ ze4?NmW3pH&-u7j?-tS2Ge9T(_i*_vk0{~~ZCFfHBXY6rDT7sJZSMA5IWP%3)Sfwc8 z^QYXHc>?H8;CTn&L-$UBR~63Sz`p4S5>$YN0V`_CJvg@&=sp=z9H9fCy~=1>-)8{s zsaAMB0G#IxfUlySiy2y;C}_#oDvoPzY-l4%)0y$fTV zDh4pk)#nJnRX_#MiNB91D1el!e+`@vEuS+0WFG=Z4`>1cNSTTO#P!t}qI3i_0X1P7 z!G_foH5;t z+aL8n$ubWBqyRn75|vo?)bTvE0&HI;poEe7p8?A;_cr=-B3hER011Ddf}=*MhmDul zL%(|f9=<)19f0!-4|qE#uu4xCApC|y>1}|X)Lm|&Cj;330PjRW51?+#65xI!a->Kd zIJDFgP+D|0fAB8?%!6qm3}7q^fWg>`415iJ^7h*Q30CZ%9KbdJ?Oyv^{IpHf<32T^ zOs9%@K#PGxkN9r@pdN7Xf%OS=dMXZ6la$K{&;v~#5H9I>z<$Js_bC8&2cQ?Wj{(>j zK+X@rpoCCeIYn(xD3!6VYDCr;sEiI zuFBaS3NU=UVE>eV$1bPOEqv@5<2q1UJZh&^E)o;gy;#TGW`pT`RN}BrukfuOe$Y0X{f!?W% z0g{Woug`K328b<82FMyN0;HF5-oqPu{wx+D*5d_xLD8G?;(l_@hu;VBcdry` z9MyN;7=p-DY0y)v9~y87dI&()n(XuCj{2Gha6t@zXq3(6F93822w-ApRIgR_r_@L)Jy53n)r5I+vE9O};l^koH* z+N6e347`nRM)y6y&-nxpdrE>(6^5$)ktqnF#y|yNCMAG)-0(m@p5=(^q$>b)He4AJ z+_32x53oh2)&NXI$X8olF}pHHqazvf7W4yss1X!aSC)a*(K$ZQg=_$%|1t(kuA2cw z0$%eB0Kb;yJpiBx*aVpS3w$5-!3{6c$5?4gctbN*xe$i4!SXC-)r)vRNSkwGb%>^3MoSfD|tEGl@eJYD<8{nGl z4LTN0uv`M$s0u!9tjF*j(PIF(`dJW#vZ!I|UI9Ss<@Df!&MPGs9EYJ}<8apaq6!Dq zIZXiZH>S*vd=s7;+=k##g1aKvrm0b_d1S<7uxteg8 zHl7HAaVjz$oma@v^8mt}VFAl_@2Yzgqu&5jy%E3#7OHix7UyZ#IgC_*i-|%e0%t7k z&!eM1QnaU`yr17m6t?Je?txVNU81-EFxu_EOBDM6O@fdBcN2wiJBi>$F=3Sm-Ugtp saF__*2C%C{@H)UM5xfuZv+^I{5A?RX#aAHMga7~l07*qoM6N<$g7=)rp#T5? literal 0 HcmV?d00001 diff --git a/graphics/pokedex/search_menu.png b/graphics/pokedex/HGSS_tileset_menu_search.png similarity index 100% rename from graphics/pokedex/search_menu.png rename to graphics/pokedex/HGSS_tileset_menu_search.png diff --git a/graphics/pokedex/HGSS_tileset_menu_search_DECA.png b/graphics/pokedex/HGSS_tileset_menu_search_DECA.png new file mode 100644 index 0000000000000000000000000000000000000000..3104d35452eb5c48cc4c5dea060e99f69ce8dc45 GIT binary patch literal 1742 zcmV;<1~K`GP)i?Zt~2td;^?Id-k|NptCK2T6V>`8Yx_a<#b zS>gkCwA)q$I(Zf8pQAjV&o_R4vy{h^--W!7_Idjmz~fASrzj@C$36pi6!{9^`FspA z19)=#wGQ6_JRW_rqYvov1%Ob<2cQ^!Uj^_X$dW1W^B)1|vIwwJG?&}$_I>8+!4BZo zgni4Oq28$ZX`Yse1EjVS0P0=%LLbRym@(lI1%Oq68@JV|33|Z3cmd?9wbHqo1i{5G>){N#W&M{SB#ND@SLXp+ zzvTFV9#jBZKj-*?9tVJs|3{&pTfv_zdCrtNfWEvr00fuH$7!YXBksD^-Ma ztJNg{$!KOJN(G*Kpp^%;)L;RGl%>Cl06B@M##;}Npo$VmjT>+6t4}_W_DWwNP z9|&0a@{g5=D<}&fgrGG6$q<$Lreev|1H1`f^gzT6=?dk_3eL&d9#v8S0`b659tVhU zA+=fh5b9@EFec|5RcX*;<;B}eD6aurH4|PP3mU)`(U1dND5rbCD-7Vww#~8|G6J01 zyQlUG0RynhU5oQ``XEY8~iISft!;5ZZl6(G%< zxo$0V;~IrGLDj*@9cY{{0Q+$yH$d_Qx#$46Bq;GVVBEI=gmnV~d?dO7_+ezO6vJO(iKfo!~lSx5nyML7hh_1^2{(3_ww19G&dabE;@Rp*CS z7(H-6G*>;)zG?tu8GwA#~slK{S$3F$hdABD>^;pMU5 z`e=BiWPrCRN#(@KGug6ztIaY&R-d=+nqCI5?H7V+xwK@j9s=0-bv@t!*i+nK_9;LPvRoekc)?^n zkQW6i}@|On7-LxIP+QDRtxWS2fgR0PwciS$$vuV0Qwnje-?`<^FBk z@BS`8@y74}TMu-98GY_;_uLu3|8G6O0piJw<^gB?UR)1=^?o3p%pgtRi{GyGfb;!8 zJV($^M0eid{Bhm2P7vN3C;&OrN?c!BCy@6BGC;|+64w{k34renL;%dR64%$(3GKas z7z1K6p(hOK@;LN_#7#IMmB#V3*pp(!5RS34NS^tH$N)$G6z;0z0JC!d7J$ctTW5a+n4AMJ09<`&mI&I{qE|5188nuyQUa132~{mH=$~>`X|}pYJ~`0)S^< zaoJps08H%5=Z-L+0U+-WN&tra zR~!HQ+!5vz0j&K&834?4hN5Q-0Mn<@?t7g3&2xqm0DcZ&)~n}a5G9Fx0w&d?|)0}Nzzg+K*R_aW|^weIhSA1M%&{Y3`g@z~a%C-woT`->F7)n~T;Jh3ru zJ^PCcz%y#L;Uuv>Zaw>pcO}36cfp;A@PnqB5!0#u-L7F$L9m-58#N^SsEv{LfSxv9 z13&_~5A*=8UcLl?KN6IFUnqFUH7~3IR9DNtZhP_s*Svt9SOgI5R}YN<`n-UB;T!-i ku6Y5+``-W<^MVHO4{26;xHbRasQ>@~07*qoM6N<$g83C5Gynhq literal 0 HcmV?d00001 diff --git a/graphics/pokedex/RES_HGSS_palette.pal b/graphics/pokedex/RES_HGSS_palette.pal new file mode 100644 index 000000000000..96fe4b782ac3 --- /dev/null +++ b/graphics/pokedex/RES_HGSS_palette.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +193 33 177 +249 249 249 +225 225 225 +201 201 201 +169 169 169 +129 129 129 +249 153 161 +233 49 49 +193 33 41 +145 17 33 +249 153 161 +193 33 41 +141 251 184 +52 66 162 +194 181 66 +0 0 0 \ No newline at end of file diff --git a/graphics/pokedex/bg_national.pal b/graphics/pokedex/bg_national.pal deleted file mode 100644 index 10dc02e885c8..000000000000 --- a/graphics/pokedex/bg_national.pal +++ /dev/null @@ -1,99 +0,0 @@ -JASC-PAL -0100 -96 -193 33 177 -249 249 249 -225 225 225 -201 201 201 -169 169 169 -129 129 129 -249 153 161 -233 49 49 -193 33 41 -145 17 33 -249 153 161 -193 33 41 -141 251 184 -52 66 162 -194 181 66 -0 0 0 -123 131 0 -255 255 255 -197 32 32 -189 189 189 -164 164 164 -98 98 115 -41 57 65 -164 164 164 -41 57 65 -255 255 255 -238 246 57 -255 0 189 -123 164 115 -74 115 65 -189 156 90 -0 0 0 -123 131 0 -255 255 255 -197 32 32 -189 189 189 -164 164 164 -98 98 115 -41 57 65 -164 164 164 -41 57 65 -255 255 255 -238 246 57 -255 0 189 -180 205 246 -49 139 255 -189 156 90 -0 0 0 -123 131 0 -255 255 255 -255 238 0 -255 189 0 -255 115 0 -98 98 115 -41 57 65 -164 164 164 -41 57 65 -255 255 255 -238 246 57 -255 0 189 -123 164 115 -74 115 65 -189 156 90 -0 0 0 -123 131 0 -255 255 255 -197 32 32 -189 189 189 -164 164 164 -98 98 115 -41 57 65 -164 164 164 -41 57 65 -255 255 255 -238 246 57 -189 0 0 -74 148 180 -8 90 131 -189 156 90 -0 0 0 -123 131 0 -255 255 255 -197 32 32 -189 189 189 -164 164 164 -98 98 115 -41 57 65 -164 164 164 -41 57 65 -255 255 255 -238 246 57 -255 0 189 -180 205 246 -49 139 255 -189 156 90 -0 0 0 diff --git a/graphics/pokedex/menuOLD.png b/graphics/pokedex/menuOLD.png deleted file mode 100644 index fea195312c06171e1717ec26aca2933805ea317f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2045 zcmVKgCM<}S^xk5SrGW^000Mw zNkll*O6vwr+b7|O~Y6Q^gAwc^Hf-2dHqQfcBz#)UV*hZ&B$do0627Bbd zv1`W+UNm?sGSDzQ2#5e3^bHC`2%5nV*!O?$?s!L?RMPI!rxSfV@_xGa?!Cu5y4NEq zNfMGjNM4mE)G{n5B)Eol`tujssFZSD+7mkG6HQ_PiKZLA8R`f?Q?q`heSp?cfKr(Q zC=v^xW(J@w0Qf2--=Fld?98chrph5shPWapcP`3aG0QUa44Uz*sw*b_w z3J|DZ?~mJnY}OeNs*rrwMui_qScSV}hg6?;T|Huey%q9V{?IXbg1+3pd4<0s2T;KQ z@I^QJx;wo-(v2=YsfPu>*aE1eVrX?6L!A!ri%}K+q#MGTT2N5YrW>8=~&;bmrE)>V2vAS`fzIqDA!z2sR4@{>Ky_~jT>(5 z&-@#J3f;T*0sOsP!~tZ6O~7JZx0FjV5q<_13jl1E#ab_naU6h7m%0YrX#B!0>7hda zEXY3|7?A)=jH2{}0gE!G!g8@;gWIKE2Y|JF;(!}Wt`E4W2pUWR*+9qrK$jXt<5=IW z_00kw-v$e9#Q+}d%8w4F?lK_3Gw8wjKmflxz`N?})_bGF7C>SF@9wA9+X!!_F=+tq zsp)z=ep|exl8ZB7h3Um`?j7 zSbSIjRA2yXH{ubf007%PXY^3Ou0-$p95dd4?2cR=nT0Qz2kbShXIAc|vvnaV?e zeHu+XVHFer_=W(h1_LOUOx?VGY5=5+HjS9qM#Knogg`dHKoQHc9DrFtvmxP3jUm8$ zrgGo|=%sCm*M@eGH3kD<};NWZ%Q0D^^iuAkU(*`g|1b_|)=aLOYg=Riz z0!AYNfIt95<8uSJ3;`w|%th}_z~IONUWf`NwKekrY~TZw1EdBpz-vifsaQV<@bk@F0iT7xxa)0lGcjpSjnd3^0DsS_SjV zWqFd6=K07g)vf@oPku!m`ackmsQ?h&FBGl?c_QVtaBfxjGYeFR?-y*#+|(shke&VK z;;#JyH}W%9*79@0>c&EwRM^|PUqBXZYxFw0K7Nbd%>QmxnGbLXCX6<5kPdm zKs9OMR{^T_g8(3VrucpVslm3RD83p6baQ1Nu=jri*u}P=Sh@jz`hioLpV~SB-WveV ziUn}EXh{j)5+S7zHV#-TP`w6V=r*hwVEou*1-nEbA0#f<)h58Lk9yx`J!AqC^vXoT z2+w6@>n2Jpz$F7#A>)Uu1!xa|{cj!x(AOC8j;8gd28=lUIe>Z8k6@P61H3l?%qIMz z2FzfC6h<@vHXoM$!3d1{hxB}q|Asn%%?L{I+9WlVrV6HdsI>#+)&?e}uofyey2w&t z2S8r_(NQV@@XBDM&`KrZ2Z0J4@rZk=AS0NS0a{U%TO~vRx`RYj=n61CaCr1kfQf^{ b#HjEOB!6_L#;B%&00000NkvXXu0mjfTJeaY diff --git a/graphics/pokedex/screen_select_bar_main.bin b/graphics/pokedex/screen_select_bar_main.bin deleted file mode 100644 index 16bff536188aa2efc40405909c383d0c8252fcd2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 192 zcmbu$hYi9|6hqN76*ZxgK Date: Fri, 12 Feb 2021 11:21:38 +0100 Subject: [PATCH 14/88] Fixed small bug --- src/pokedex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokedex.c b/src/pokedex.c index fce07ce6192e..7c1d0760425f 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -2357,7 +2357,7 @@ static bool8 LoadPokedexListPage(u8 page) ResetSpriteData(); FreeAllSpritePalettes(); gReservedSpritePaletteCount = 8; - LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[HGSS_DARK_MODE]); + LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[HGSS_DECAPPED]); LoadSpritePalettes(sInterfaceSpritePalette); LoadSpritePalettes(sStatBarSpritePal); //HGSS_Ui CreateInterfaceSprites(page); From 1463b857c35011cd8fc14173dcde5e4cd53a0fd1 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Wed, 9 Jun 2021 23:10:25 +0200 Subject: [PATCH 15/88] Small change how hidden abilities are accessed in PE --- src/pokedex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokedex.c b/src/pokedex.c index 7c1d0760425f..99c97b7faa6d 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7022,7 +7022,7 @@ static void PrintMonStatsToggle(u8 taskId) #ifdef POKEMON_EXPANSION else //Hidden abilities { - ability0 = gBaseStats[species].abilityHidden; + ability0 = gBaseStats[species].abilities[2]; PrintInfoScreenTextSmallWhite(gAbilityNames[ability0], abilities_x, abilities_y); PrintInfoScreenTextSmall(gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); } From 74e562da33e2aa862e927c707a21d63ffd81b477 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 12 Jun 2021 15:29:01 +0200 Subject: [PATCH 16/88] friendship now emoji based --- include/strings.h | 6 +++++- src/pokedex.c | 25 +++++++++++++++++++++++-- src/strings.c | 6 +++++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/include/strings.h b/include/strings.h index 5707412579ee..1e7f01190ce5 100644 --- a/include/strings.h +++ b/include/strings.h @@ -562,10 +562,14 @@ extern const u8 gText_Stats_Gender_75[]; extern const u8 gText_Stats_Gender_87_5[]; extern const u8 gText_Stats_Gender_100[]; extern const u8 gText_Stats_Catch[]; -extern const u8 gText_Stats_Exp[]; +extern const u8 gText_Stats_ExpYield[]; extern const u8 gText_Stats_EggCycles[]; extern const u8 gText_Stats_Growthrate[]; extern const u8 gText_Stats_Friendship[]; +extern const u8 gText_Stats_Friendship_BigAnger[]; +extern const u8 gText_Stats_Friendship_Neutral[]; +extern const u8 gText_Stats_Friendship_Happy[]; +extern const u8 gText_Stats_Friendship_BigSmile[]; extern const u8 gText_Stats_MEDIUM_FAST[]; extern const u8 gText_Stats_ERRATIC[]; extern const u8 gText_Stats_FLUCTUATING[]; diff --git a/src/pokedex.c b/src/pokedex.c index 99c97b7faa6d..5798c86f6a65 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -6834,14 +6834,35 @@ static void PrintMonStatsToggle(u8 taskId) if (gTasks[taskId].data[5] == 0) { //Exp - PrintInfoScreenTextSmall(gText_Stats_Exp, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_ExpYield, base_x, base_y + base_offset*base_i); ConvertIntToDecimalStringN(gStringVar1, gBaseStats[species].expYield, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintInfoScreenTextSmall(gStringVar1, base_x + base_x_offset, base_y + base_offset*base_i); base_i++; //friendship PrintInfoScreenTextSmall(gText_Stats_Friendship, base_x, base_y + base_offset*base_i); - ConvertIntToDecimalStringN(strEV, gBaseStats[species].friendship, STR_CONV_MODE_RIGHT_ALIGN, 3); + switch (gBaseStats[species].friendship) + { + case 35: + StringCopy(strEV, gText_Stats_Friendship_BigAnger); + break; + case 70: + StringCopy(strEV, gText_Stats_Friendship_Neutral); + break; + case 90: + StringCopy(strEV, gText_Stats_Friendship_Happy); + break; + case 100: + StringCopy(strEV, gText_Stats_Friendship_Happy); + break; + case 140: + StringCopy(strEV, gText_Stats_Friendship_BigSmile); + break; + default: + ConvertIntToDecimalStringN(strEV, gBaseStats[species].friendship, STR_CONV_MODE_RIGHT_ALIGN, 3); + break; + } + // ConvertIntToDecimalStringN(strEV, gBaseStats[species].friendship, STR_CONV_MODE_RIGHT_ALIGN, 3); align_x = GetStringRightAlignXOffset(0, strEV, total_x); PrintInfoScreenTextSmall(strEV, align_x, base_y + base_offset*base_i); base_i++; diff --git a/src/strings.c b/src/strings.c index 5bab8cbb03c1..1537e61a0d51 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1849,10 +1849,14 @@ const u8 gText_Stats_Gender_75[] = _("♀ 3/1 ♂"); //_("♀ 75 / 25 const u8 gText_Stats_Gender_87_5[] = _("♀ 7/1 ♂"); const u8 gText_Stats_Gender_100[] = _("♀"); const u8 gText_Stats_Catch[] = _("CATCH RATE: "); -const u8 gText_Stats_Exp[] = _("EXPERIENCE: "); +const u8 gText_Stats_ExpYield[] = _("EXP YIELD: "); const u8 gText_Stats_EggCycles[] = _("EGG CYCLES: "); const u8 gText_Stats_Growthrate[] = _("GROW: "); const u8 gText_Stats_Friendship[] = _("FRIENDSHIP:" ); +const u8 gText_Stats_Friendship_BigAnger[] = _("{EMOJI_BIGANGER}"); +const u8 gText_Stats_Friendship_Neutral[] = _("{EMOJI_NEUTRAL}"); +const u8 gText_Stats_Friendship_Happy[] = _("{EMOJI_HAPPY}"); +const u8 gText_Stats_Friendship_BigSmile[] = _("{EMOJI_BIGSMILE}"); const u8 gText_Stats_MEDIUM_FAST[] = _("MED. FAST"); const u8 gText_Stats_ERRATIC[] = _("ERRATIC"); const u8 gText_Stats_FLUCTUATING[] = _("FLUCTUATING"); From 73cc40fd030edaf5cd8a64e0eabfff2f66819b43 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 12 Jun 2021 19:52:43 +0200 Subject: [PATCH 17/88] Egg cycles now with icons insteat of numbers --- charmap.txt | 1 + graphics/fonts/font0_latin.png | Bin 3115 -> 3665 bytes graphics/fonts/font0_latin_widths.inc | 2 +- include/strings.h | 4 ++ src/pokedex.c | 55 ++++++++++++++++++-------- src/strings.c | 4 ++ 6 files changed, 48 insertions(+), 18 deletions(-) diff --git a/charmap.txt b/charmap.txt index ca4db0fc73b5..25e61acf2168 100644 --- a/charmap.txt +++ b/charmap.txt @@ -151,6 +151,7 @@ SUPER_RE = A0 'ä' = F4 'ö' = F5 'ü' = F6 +EMOJI_DIZZYEGG = F7 TALL_PLUS = FC 0C FB '$' = FF diff --git a/graphics/fonts/font0_latin.png b/graphics/fonts/font0_latin.png index 55ed43506050e1b98ad0397af077eb1cc530cd3b..371cd5a9684dbb02da670b7f02e3b6d80f72cb33 100644 GIT binary patch literal 3665 zcmai1c|6qJ_rGH>3=;Cl5+Vv&l6@VFT_}k>_I=CN*tZV}l`&*ZwxWj+5)>E4zZI!(`nh+7b^&-xgyP=!pq;3Go1iW@y?r!eJgE z!k1+fg722k(@dB!LFR@u&1ISlOdts%8qs^{T+spGC649Lg@HDgvoyP|pV3EEQBfHm zAE#2Ozit25*cktMmu3TVH8n(2pCLB7X-5w=M(bRUDEw9Al30H6MDl1m>YY7movv(# z8t~_AhB78Gb<~4VWimP9B^lW+FyqaO)&eQv_s&b+&4 z-+TMaQ!{p#WxEz$)TjgrtDyYa?Zr1h({J9+w7&oKc4jdt4_2j*WBI;jb)<$8(_L>k zH*+n~ae%{pf}(+XzCdvnyl94DeRIL?5~>S#x{ z)l&GtD&9CY6y4o&A>jsh{mVUR6Wu(f$6le1q>5??_KqBRbo%d_MHoJk`xLMG^GMcZ zYh!zXX4VAGstLaU78SvA&uU{(=%~*F_$Md@?LEyPy#DIx0{*j3$|ZhmL0jZ|fqcsO z`SyYutEcAoI}QyxLm+2Iv|Xz-K3m|oI#HY3b}?)op)(X0Kw0h6BZ zM-Bq7GgRO1S4CyQrr-F1N^(LRt4+h$pQ(d%rSw2vh$N2hmaN3GEc;0Iz&}evSi!7V zD^NdJBSlEO^`Lx74;!r4bl(2Em*BgKR#&d9^L&}UW`jySZnwZKN)>EsBOZzOREQH0 zW}|=2ba|hwlmVLQwVW8L=(X79V)j?wW94E_3lHU|!(Ow)+uB9tFTJV0)J~R=1MuH~ zl;QdLb9Y<=1mHwhxu`3Ykm79TR~*N7YYctER9U)av7;ru0^5c9z=SD!C{3^~NyJUd zJgX09)3h~64kZ(t>AY){odJ4I)lJqEx}5$zH`a)<<7c*(j&mMr4DoficEX6KB&^Ox z=Nu@oUtF(CS|-A~2tC97Qc%RtF&1d@Aufv9vgBbwZ?-6`gQEGJY)lcE12&oei}BUvwd3jFcbJ0iRDyKOKK8Ba#&U`Msdt& zTI&SGl^2Au)PKDY=`oQ zpx#BJ1$HjhjE9pF^Rd0?ZgDR&$6u*tX8UX=)IUJG<9frkGHj$XUkRW080_05knHKS z9eg5%P-{wa(Kb3vMX=45uKuwjKS4dNtP&-W*ml@yJW44+(LjT6$O~o0+vmy)@Z#Ak zLUW`;8 zB@C$dt6;hcl3gBUqA(N*zFT#8`OmCuxZ+HI>R4&wRbk9cgw1jpYZqe-nHwF15577DuPl6 zoTcR-2o3bU7I3(~ulCvYkAZc+OzTI|*;B@>VJ)F(adGWH_ZIST&84Mu-B6VmOFLn} zpMyttsBLik6<{M+G0fHeq4~&>RRLB)cgyHK#aT`C2*WWIGR#deM=x zCDp@aM=&LgKHWH$@=>zmbS|3?@r|~lbo4TjB)y4U<0{PcDfw|uCp|b?3qrRn=<3^d zn%zbjHR9%k39oJdEiD#2j+l2LVaj%Rjcr~1?$;h;dj=aD^v~e8i)COu*B$DATHL+G zM6t4*H8k?olo=OQQhSIy`2#)s4@GXskCwY{ zOVoW})0liTIIm-G)3!#SKM<`1^-b?Wc@z&WJAqw=zzF$HTl%0> zy;BZmFEJ$k`}}Tmhns@k`)?kZBubPJ`t@v7yz8%UVWAR_e1%@UsQKNt8N|zYLwDDW zHwF=f#jrwuw#Ne`X^}Sbh@7PzlNin0c5MZtKu$H58%2H3Pgc&xZ=3_-0ud)}#`8WQ zbTb+Cj)~!WD&-_QxxwA%=L$rNKae6}bADn_Qhkn|hgyeH(d?!}!b3Yy>X^61P*|$w z>r3P}ths;tx2lx5$HZocV5mW#p{v5m#yEjUlVO z_7|d(+Li(pUalL-I!o3^1czp-5+oGpy#CbDC;Ca2tOyTR%L+>0!B9v8Nw6%Mhk|uV zELyf}ZHN68i>Npdlpvzi_%01egx2*zT7CUd5c6k~)Xv;~S{9euoZ^a)4msw7tUU92 zBl=J{p3Pm6K2jt>jK_ojGdS!J@<^We;f@T<4ni5^kQr(RUxj!l?H@U{50bhi4>h4q ze#@BG2fak{F4W7;qb{=Th9SS}*&-+WLOJVhP=sETQympeSS?9=Rm?TVj!*^HZq9z= z7;IVWN*%&~A}J?s55tdgIpVVp5(4c~)@#`Z0XOA4w?|ZGzcNb-F!=~(Nz z(O&8FwykGcysdk>22lrXRo@PnG8utVfA>tIj1gG#4tH95cA|HFTT9m(Og>gB*Yx8R z{wM*TG`Z2*x?-%NTZjlQfGu7cav!vu1~1-xb6ojy*;LuDQllo`RGi)DoJiS#qdIA&UwJu zoVSa3MNMl_da*lqL%I_&aaE52pZQIQZO&46VbhZ}`(zk3rL0^+5RTX6_&y3WrVcJZ z0#Y6tUD&$efW!=;gjciYOnQ}p=S*!UBlKxob$($QVV%w2L@ylJI)fPf`M?04H!y?+ zl(e>q4x{{OcC#TDE3`%}-49&pq;C#?0<_B=h~kR5hFiKNjQ)Xx_^+HD!lJ_XF@k5( z^N~C7Y;yUD$NBk(-SPuAqThvxO%=bKjVEr|l4J$8vRe zOc3BY4{qU$f0A&SJw^fsepJ1+yrlTlsQCPZjwrTJE)jVlAuv2_d}^ZIa!%=N7cV+l zh<*g=)gpsjzejPagSg}4Rm`wihD!cxmkKlHH6VQG&lqWKuB>=m^Sgj~C5iLTv!mZ` z{2+e0Cr-RW=s|T)8lf=N zca<5Yps#9w}mMe|K!g`sV0b IUFXFA055H-fdBvi literal 3115 zcmV+`4Ak?9P)&rcgk7RPJQ25mU)g(z^^OCpB9g2QUhdsth< zT%29G2b%zY!APw=%7@TG!Qu3teeF zG{+bE7}D3}0zuNZuB!`UMOe90NBuc=q!K2js>>mV*k#p)W|)+gBW+y{Im9ljE^uEV z8zBvnEj$LuA$ECn!EP=pR2>-$u$zRFttcsD0rrXQJYBF)3^L5Zc4$Oh*bj}ok;lEz z5nT>B1^PzW|cm9ylW z0clfo;2hs%BYYC+hVuH|4LTqTUw_bfGywqXAG&dT;sAKpk<>>v~Wh)==mP zbmL4a!9aH5XvG1<73AF;4uI_fPvglGAx>Y80-y!o8GF!31Eh7qwh23RV-I#x00Y^A zj|@21V%vnb9b*q5`wrljZ*olI$ffMlh(Y3ka<8RG2?3iL@c#Ax5&%`b%ngwC?d)Zd zF$kyy`MaQ7kQ-2K(;)tw7tlK=z{k9Ri5HSj*#>H|S?~Z4`2Pg>L|-D+fXL6WK~0eh zTu(8y;>(PHeip!r{L?(7Ja8dd0H{K9LSBumHbwAAS-=eHC;H_(_afl zbs>H$gS+ife!V8UuqDLv7qTUK7JmAM2Jnpyz)IY90oY{7mh{eKOMaB!7rxi;6lE7K zqvY!V^}-QfGSmwNS?Z%Ke2q=US;mFrQ$eHps{oE~xOR~RkoeZ>NdH&q0>4wt-GZCm zZe{`$9)m_vz)n%X+ZzDqw=#`B-8@Kq-2;TU6Ov5J#*Ll!qecAkN52GlFDFMPI_+S=y=;8!l}$}jQ)@H-kRUuAt2<|h1(rkejGCjci40}6EkCkqXtx=>^q3oqs0 zV#+d5Hx8l)c)%wD@JYl!zGf1UGKj%SLBONEf`Ij^@jr5X6z!ZnfZP`nV!cbd5?qLX z{g22m5uaa#Ne>|R+q~GQ8lSu$LJ|PjvF|EOdO>~b0uFj~ksUkH5&+mY@ggK|Aa>xn z&;ah5nnniTRo|&@0XO|ZckPq``p&&H0Gg~EHLPa8i7Y1uJqtXLXAHpWz@yN-8r%zw zF9KQ>e-=sCvTFt?zk|@c8oZ2*FT%O~S(s}HK%s@?)0jcKcJdTafBqHH8gS=0GXU;& zc;SRqHy8ncQjG-Q?ttL#fN)FRA0`1fSB*@Lda+{kBD3q`k3Zn=m*a!1=k=Y~4NNY8LiW0BjR3ul2gPCYQr~YqolN_Qo#d z%V^9>^l7}&9A{ul0N{tDT4lmKjd|s<|FUfdR4%mZJ?{f>&~^ZTv;VRyZ3dv=Mr5A< z00a@8Z-&Ny*_MsaI0ULD;SGMp0<1))3+x?O4UG-Jejx_f&dhu=NCC7WpbsRH`4$wMgaKda-9E3miuKC02>KxFxc`aKkbN) z`8>BkDO0R4k#W6Fvp~C1QteSLuv@@p%HH1F+kZEH0{|EvwYjQT7f{fRs!;I?5q)d1 z0jdS<$QX^jo&{|AcpnhQD@3HuT&||;sa+ZCJ#-v)0KYNvJ|K=)h{*Aq%e~a~CR#{m zDdl_;6ByAnnaB$N*8n#;D2$V100v_U^>4U#Bsb%+QrJ5X=sgsQzfZgS1J=-^ziU9+ zE~FOf=*kfQST49F#{jngw)fjn(hl&e5`JB9w3Y&Z8bf_yOw>jqqVBNWXog0;j}9CF z^uMJm0sz>*L$VLH-8j{-V+a6k zH3oL2hLukQh+~bB(0nSNn*j-~1$!hzzDBdlSl=0d##8z{$QRfvDeb8Riptk0>wMu=%TIH1U?{T=}xtfot*g|sLkGo5ttDMKo3 zRL26w>GoJaLbtVIO$6Ze4N>Y`PeR55V*L(uMcIn^I_bsz`xyXrs|5^b$nH!_$ivkP zfX91u_m%^gmv_J0$pX-N4iE#{^3JQ%)QYiywx!#5(RZk+ymO^WGcy)o>-H3;u|qbZ zCslZ1Ap;wi zlmp;X8D_x)JfIu^pUN-`9^e7x0QgjfS?~Z4CJir6W0r05| zv)}<9P!51kWtasI@PKjve7dCshky8~-wq%p1R)auj_&-K{{>@&D9r*^r2q-{Up9_| zCintElGuMA(KC1D=Q&gi$PM3(ZBRiIHlXs<0BW*DQ}X;ALJ@TE(^SU*?kwwoC>zkM z8h|<_E6-s}IP^%Euq6Nj7x0go13*v!3d{42svc|&nCVKuwxH3E2d8U75b*CXf7YRb z5QHb7O9-Iqb#)hNE{!;(3a=a^kHz~q(cx?2$FRg=MXH#;R$Hf zg7E3Lnuh+NZgmoW>U41^Fbc=ZbpC6huTMK=r(5X&11a}Nq}Unqlu^Us$k zpRN)>*#i_t&<~cW=+N<2O=}&@9IQ-0pFjVrWI^S%g{mOFaYt&|{2xq9T8A;pbB|j3CIFxxtG_bU&!^i;ca|nAA8)caJTZP)P71iE!xQJM{}$lc!_gIa=_>&4jOX5*20$~B zmhYJy6`%`T5f4=yD*)~s=;uF{Cu{&JL9oPE=jl3hVO6%OeqV>{&T9Z3>6JjQ^^RP& zU21-JkqQFz)mIdz*OAY<&H{brus!iNspsvQ3A^PMAfeFnmgzg2Fw7RTQ~@4W>B-A! zdX?^uv0$?W-CvqEv&7w|7PONAfoKW#Mo?uyFmSWlxTw$i+@Joe0hN@HW44j^pC!W= z0b1-B8=?Tc&M@Hj`rIEElHrSsUDHa~kiy&jPvrZ;e*jVH^PJ|-408Yg002ovPDHLk FV1gh6s>=WX diff --git a/graphics/fonts/font0_latin_widths.inc b/graphics/fonts/font0_latin_widths.inc index 2392e9717967..70609d07d796 100644 --- a/graphics/fonts/font0_latin_widths.inc +++ b/graphics/fonts/font0_latin_widths.inc @@ -13,7 +13,7 @@ .byte 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5 .byte 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8 - .byte 7, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3 + .byte 7, 5, 5, 5, 5, 5, 5, 9, 3, 3, 3, 3, 3, 3, 3, 3 .byte 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 .byte 8, 8, 8, 8, 8, 8, 8, 8, 3, 3, 3, 3, 3, 3, 3, 3 .byte 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 diff --git a/include/strings.h b/include/strings.h index 1e7f01190ce5..698ea8471247 100644 --- a/include/strings.h +++ b/include/strings.h @@ -564,6 +564,10 @@ extern const u8 gText_Stats_Gender_100[]; extern const u8 gText_Stats_Catch[]; extern const u8 gText_Stats_ExpYield[]; extern const u8 gText_Stats_EggCycles[]; +extern const u8 gText_Stats_EggCycles_VeryFast[]; +extern const u8 gText_Stats_EggCycles_Fast[]; +extern const u8 gText_Stats_EggCycles_Normal[]; +extern const u8 gText_Stats_EggCycles_Slow[]; extern const u8 gText_Stats_Growthrate[]; extern const u8 gText_Stats_Friendship[]; extern const u8 gText_Stats_Friendship_BigAnger[]; diff --git a/src/pokedex.c b/src/pokedex.c index 5798c86f6a65..9ccefd9c8772 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -6833,7 +6833,7 @@ static void PrintMonStatsToggle(u8 taskId) if (gTasks[taskId].data[5] == 0) { - //Exp + //Exp Yield PrintInfoScreenTextSmall(gText_Stats_ExpYield, base_x, base_y + base_offset*base_i); ConvertIntToDecimalStringN(gStringVar1, gBaseStats[species].expYield, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintInfoScreenTextSmall(gStringVar1, base_x + base_x_offset, base_y + base_offset*base_i); @@ -6867,20 +6867,6 @@ static void PrintMonStatsToggle(u8 taskId) PrintInfoScreenTextSmall(strEV, align_x, base_y + base_offset*base_i); base_i++; - //Egg cycles - if (gBaseStats[species].eggGroup1 == EGG_GROUP_UNDISCOVERED || gBaseStats[species].eggGroup2 == EGG_GROUP_UNDISCOVERED) - { - PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_offset*base_i); - PrintInfoScreenTextSmall(gText_ThreeDashes, 78, base_y + base_offset*base_i); - } - else - { - PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_offset*base_i); - ConvertIntToDecimalStringN(strEV, gBaseStats[species].eggCycles, STR_CONV_MODE_RIGHT_ALIGN, 2); - align_x = GetStringRightAlignXOffset(0, strEV, total_x); - PrintInfoScreenTextSmall(strEV, align_x, base_y + base_offset*base_i); - } - base_i++; //Catch rate PrintInfoScreenTextSmall(gText_Stats_Catch, base_x, base_y + base_offset*base_i); @@ -6969,7 +6955,8 @@ static void PrintMonStatsToggle(u8 taskId) StringCopy(gStringVar1, gText_Stats_eggGroup_UNDISCOVERED); break; } - PrintInfoScreenTextSmall(gStringVar1, base_x + 37, base_y + base_offset*base_i); + align_x = GetStringRightAlignXOffset(0, gStringVar1, total_x); + PrintInfoScreenTextSmall(gStringVar1, align_x, base_y + base_offset*base_i); base_i++; //Egg group 2 @@ -7022,7 +7009,41 @@ static void PrintMonStatsToggle(u8 taskId) StringCopy(gStringVar1, gText_Stats_eggGroup_UNDISCOVERED); break; } - PrintInfoScreenTextSmall(gStringVar1, base_x + 37, base_y + base_offset*base_i); + align_x = GetStringRightAlignXOffset(0, gStringVar1, total_x); + PrintInfoScreenTextSmall(gStringVar1, align_x, base_y + base_offset*base_i); + base_i++; + + //Egg cycles + if (gBaseStats[species].eggGroup1 == EGG_GROUP_UNDISCOVERED || gBaseStats[species].eggGroup2 == EGG_GROUP_UNDISCOVERED) //Species without eggs (legendaries etc) + { + PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_ThreeDashes, 78, base_y + base_offset*base_i); + } + else + { + PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_offset*base_i); + if (gBaseStats[species].eggCycles <= 10) + { + StringCopy(strEV, gText_Stats_EggCycles_VeryFast); + align_x = 76; + } + else if (gBaseStats[species].eggCycles <= 20) + { + StringCopy(strEV, gText_Stats_EggCycles_Fast); + align_x = 85; + } + else if (gBaseStats[species].eggCycles <= 30) + { + StringCopy(strEV, gText_Stats_EggCycles_Normal); + align_x = 76; + } + else + { + StringCopy(strEV, gText_Stats_EggCycles_Slow); + align_x = 67; + } + PrintInfoScreenTextSmall(strEV, align_x, base_y + base_offset*base_i); + } } diff --git a/src/strings.c b/src/strings.c index 1537e61a0d51..2e9d04e3861d 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1851,6 +1851,10 @@ const u8 gText_Stats_Gender_100[] = _("♀"); const u8 gText_Stats_Catch[] = _("CATCH RATE: "); const u8 gText_Stats_ExpYield[] = _("EXP YIELD: "); const u8 gText_Stats_EggCycles[] = _("EGG CYCLES: "); +const u8 gText_Stats_EggCycles_VeryFast[] = _("{EMOJI_BOLT}{EMOJI_DIZZYEGG}"); +const u8 gText_Stats_EggCycles_Fast[] = _("{EMOJI_DIZZYEGG}"); +const u8 gText_Stats_EggCycles_Normal[] = _("{EMOJI_DIZZYEGG}{EMOJI_DIZZYEGG}"); +const u8 gText_Stats_EggCycles_Slow[] = _("{EMOJI_DIZZYEGG}{EMOJI_DIZZYEGG}{EMOJI_DIZZYEGG}"); const u8 gText_Stats_Growthrate[] = _("GROW: "); const u8 gText_Stats_Friendship[] = _("FRIENDSHIP:" ); const u8 gText_Stats_Friendship_BigAnger[] = _("{EMOJI_BIGANGER}"); From eeb1ec8e8dc88859319fd7b751c102db6812eaab Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 12 Jun 2021 21:02:14 +0200 Subject: [PATCH 18/88] WIP change how EVs are displayed --- src/pokedex.c | 295 +++++++++++++++++++++++++++++--------------------- 1 file changed, 174 insertions(+), 121 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 9ccefd9c8772..413a91922434 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -6693,7 +6693,7 @@ static void PrintMonStats(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry u8 gender_x, gender_y; u8 base_i = 0; - u8 base_offset = 11; + u8 base_y_offset = 11; u8 base_x = 8; u8 base_y = 52; @@ -6744,13 +6744,30 @@ static void PrintMonStats(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry PrintMoveNameAndInfo(taskId, FALSE); } +static u8 PrintMonStatsToggle_DifferentEVsColumn(u8 differentEVs) +{ + if (differentEVs == 1 || differentEVs == 3) + return 0; + else + return 1; +} +static u8 PrintMonStatsToggle_DifferentEVsRow(u8 differentEVs) +{ + if (differentEVs == 1 || differentEVs == 2) + return 0; + else + return 1; +} static void PrintMonStatsToggle(u8 taskId) { u8 base_x = 8; + u8 x_offset_column = 43; + u8 x_offset_value = 26; + u8 column = 0; u8 base_x_offset = 70; - u8 base_offset = 11; u8 base_x_first_row = 23; u8 base_x_second_row = 43; + u8 base_y_offset = 11; u8 base_i = 0; u8 base_y = 52; u32 align_x; @@ -6761,6 +6778,8 @@ static void PrintMonStatsToggle(u8 taskId) u8 abilities_x = 101; u8 abilities_y = 99; u8 ability0; + u8 differentEVs = 0; + u8 differentEVsOffsetX = 0; //Clear old text FillWindowPixelRect(0, PIXEL_FILL(0), base_x, base_y, 90, 100); //bottom stats @@ -6770,61 +6789,95 @@ static void PrintMonStatsToggle(u8 taskId) //Base stats if (gTasks[taskId].data[5] == 0) { - PrintInfoScreenTextSmall(gText_Stats_HP, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_HP, base_x, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseHP, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); - PrintInfoScreenTextSmall(gText_Stats_Speed, base_x+base_x_second_row, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_Speed, base_x+base_x_second_row, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpeed, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); base_i++; - PrintInfoScreenTextSmall(gText_Stats_Attack, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_Attack, base_x, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); - PrintInfoScreenTextSmall(gText_Stats_SpAtk, base_x+base_x_second_row, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_SpAtk, base_x+base_x_second_row, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); base_i++; - PrintInfoScreenTextSmall(gText_Stats_Defense, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_Defense, base_x, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); - PrintInfoScreenTextSmall(gText_Stats_SpDef, base_x+base_x_second_row, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_SpDef, base_x+base_x_second_row, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); base_i++; } else //EV increses { - PrintInfoScreenTextSmall(gText_Stats_EVHP, base_x, base_y + base_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_HP, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + if (gBaseStats[species].evYield_HP > 0) //HP + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_EVHP, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_HP, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } + + if (gBaseStats[species].evYield_Speed > 0) //Speed + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_EVSpeed, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Speed, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } - PrintInfoScreenTextSmall(gText_Stats_EVSpeed, base_x+base_x_second_row, base_y + base_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Speed, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); + if (gBaseStats[species].evYield_Attack > 0) //Attack + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_EVAttack, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Attack, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } - base_i++; - PrintInfoScreenTextSmall(gText_Stats_EVAttack, base_x, base_y + base_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Attack, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + if (gBaseStats[species].evYield_SpAttack > 0) //Special Attack + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_EVSpAtk, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_SpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } - PrintInfoScreenTextSmall(gText_Stats_EVSpAtk, base_x+base_x_second_row, base_y + base_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_SpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); + if (gBaseStats[species].evYield_Defense > 0) //Defense + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_EVDefense, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Defense, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } - base_i++; - PrintInfoScreenTextSmall(gText_Stats_EVDefense, base_x, base_y + base_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Defense, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_offset*base_i); + if (gBaseStats[species].evYield_SpDefense > 0) //Special Defense + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_EVSpDef, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_SpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } - PrintInfoScreenTextSmall(gText_Stats_EVSpDef, base_x+base_x_second_row, base_y + base_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_SpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_offset*base_i); - base_i++; } @@ -6834,13 +6887,13 @@ static void PrintMonStatsToggle(u8 taskId) if (gTasks[taskId].data[5] == 0) { //Exp Yield - PrintInfoScreenTextSmall(gText_Stats_ExpYield, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_ExpYield, base_x, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(gStringVar1, gBaseStats[species].expYield, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(gStringVar1, base_x + base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar1, base_x + base_x_offset, base_y + base_y_offset*base_i); base_i++; //friendship - PrintInfoScreenTextSmall(gText_Stats_Friendship, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_Friendship, base_x, base_y + base_y_offset*base_i); switch (gBaseStats[species].friendship) { case 35: @@ -6864,18 +6917,18 @@ static void PrintMonStatsToggle(u8 taskId) } // ConvertIntToDecimalStringN(strEV, gBaseStats[species].friendship, STR_CONV_MODE_RIGHT_ALIGN, 3); align_x = GetStringRightAlignXOffset(0, strEV, total_x); - PrintInfoScreenTextSmall(strEV, align_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(strEV, align_x, base_y + base_y_offset*base_i); base_i++; //Catch rate - PrintInfoScreenTextSmall(gText_Stats_Catch, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_Catch, base_x, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(gStringVar1, gBaseStats[species].catchRate, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(gStringVar1, base_x + base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar1, base_x + base_x_offset, base_y + base_y_offset*base_i); base_i++; //Growth rate - PrintInfoScreenTextSmall(gText_Stats_Growthrate, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_Growthrate, base_x, base_y + base_y_offset*base_i); switch (gBaseStats[species].growthRate) { case GROWTH_MEDIUM_FAST: @@ -6900,13 +6953,13 @@ static void PrintMonStatsToggle(u8 taskId) break; } align_x = GetStringRightAlignXOffset(0, strEV, total_x); - PrintInfoScreenTextSmall(strEV, align_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(strEV, align_x, base_y + base_y_offset*base_i); } else { base_i = 0; //Egg group 1 - PrintInfoScreenTextSmall(gText_Stats_eggGroup_g1, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_eggGroup_g1, base_x, base_y + base_y_offset*base_i); switch (gBaseStats[species].eggGroup1) { case EGG_GROUP_MONSTER : @@ -6956,11 +7009,11 @@ static void PrintMonStatsToggle(u8 taskId) break; } align_x = GetStringRightAlignXOffset(0, gStringVar1, total_x); - PrintInfoScreenTextSmall(gStringVar1, align_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar1, align_x, base_y + base_y_offset*base_i); base_i++; //Egg group 2 - PrintInfoScreenTextSmall(gText_Stats_eggGroup_g2, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_eggGroup_g2, base_x, base_y + base_y_offset*base_i); switch (gBaseStats[species].eggGroup2) { case EGG_GROUP_MONSTER : @@ -7010,18 +7063,18 @@ static void PrintMonStatsToggle(u8 taskId) break; } align_x = GetStringRightAlignXOffset(0, gStringVar1, total_x); - PrintInfoScreenTextSmall(gStringVar1, align_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar1, align_x, base_y + base_y_offset*base_i); base_i++; //Egg cycles if (gBaseStats[species].eggGroup1 == EGG_GROUP_UNDISCOVERED || gBaseStats[species].eggGroup2 == EGG_GROUP_UNDISCOVERED) //Species without eggs (legendaries etc) { - PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_offset*base_i); - PrintInfoScreenTextSmall(gText_ThreeDashes, 78, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gText_ThreeDashes, 78, base_y + base_y_offset*base_i); } else { - PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); if (gBaseStats[species].eggCycles <= 10) { StringCopy(strEV, gText_Stats_EggCycles_VeryFast); @@ -7042,7 +7095,7 @@ static void PrintMonStatsToggle(u8 taskId) StringCopy(strEV, gText_Stats_EggCycles_Slow); align_x = 67; } - PrintInfoScreenTextSmall(strEV, align_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(strEV, align_x, base_y + base_y_offset*base_i); } } @@ -7283,11 +7336,11 @@ static void Task_HandleEvolutionScreenInput(u8 taskId) } } } -static void handleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u8 base_x, u8 base_y, u8 base_offset, u8 base_i) +static void handleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u8 base_x, u8 base_y, u8 base_y_offset, u8 base_i) { StringCopy(gStringVar3, gSpeciesNames[targetSpecies]); //evolution mon name StringExpandPlaceholders(gStringVar3, gText_EVO_Name); //evolution mon name - PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_offset*base_i); //evolution mon name + PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); //evolution mon name if(base_i < 6) { @@ -7317,7 +7370,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) u8 base_x = 5; u8 base_x_offset = 54; u8 base_y = 52; - u8 base_offset = 9; + u8 base_y_offset = 9; u8 base_i = 0; u8 times = 0; @@ -7341,7 +7394,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) if (times == 0) { StringExpandPlaceholders(gStringVar4, gText_EVO_NONE); - PrintInfoScreenTextSmall(gStringVar4, base_x, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x, base_y + base_y_offset*base_i); } //If there are evolutions find out which and print them 1 by 1 @@ -7354,230 +7407,230 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_FRIENDSHIP: targetSpecies = gEvolutionTable[species][i].targetSpecies; ConvertIntToDecimalStringN(gStringVar2, 220, STR_CONV_MODE_LEADING_ZEROS, 3); //friendship value - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_FRIENDSHIP_DAY: targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_DAY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_FRIENDSHIP_NIGHT: targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_NIGHT ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL: targetSpecies = gEvolutionTable[species][i].targetSpecies; ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_TRADE: targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_TRADE_ITEM: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_ITEM ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM: item = gEvolutionTable[species][i].param; CopyItemName(item, gStringVar2); targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_ATK_GT_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_GT_DEF ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_ATK_EQ_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_EQ_DEF ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_ATK_LT_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon namee + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon namee StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_LT_DEF ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_SILCOON: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SILCOON ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_CASCOON: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_CASCOON ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_NINJASK: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NINJASK ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_SHEDINJA: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SHEDINJA ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_BEAUTY: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, 3); //beauty targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_BEAUTY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; #ifdef POKEMON_EXPANSION case EVO_LEVEL_FEMALE: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_FEMALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_MALE: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_MALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_NIGHT: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NIGHT ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_DAY: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DAY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_DUSK: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DUSK ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_HOLD_DAY: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_DAY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_HOLD_NIGHT: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_NIGHT ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_MOVE: StringCopy(gStringVar2, gMoveNames[gEvolutionTable[species][i].param]); targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_MOVE_TYPE: StringCopy(gStringVar2, gTypeNames[gEvolutionTable[species][i].param]); targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE_TYPE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_MAPSEC: StringCopy(gStringVar2, gRegionMapEntries[gEvolutionTable[species][i].param].name); targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MAPSEC ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_MALE: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_MALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_FEMALE: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_FEMALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_RAIN: //if (j == WEATHER_RAIN || j == WEATHER_RAIN_THUNDERSTORM || j == WEATHER_DOWNPOUR) targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_RAIN ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_SPECIFIC_MON_IN_PARTY: StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MON_IN_PARTY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_DARK_TYPE_MON_IN_PARTY: targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_TRADE_SPECIFIC_MON: StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_SPECIFIC_MON ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_SPECIFIC_MAP: mapHeader = Overworld_GetMapHeaderByGroupAndId(gEvolutionTable[species][i].param >> 8, gEvolutionTable[species][i].param & 0xFF); GetMapName(gStringVar2, mapHeader->regionMapSectionId, 0); targetSpecies = gEvolutionTable[species][i].targetSpecies; - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MAP ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; #endif }//Switch end @@ -7964,7 +8017,7 @@ static void PrintForms(u8 taskId, u16 species) u8 base_x = 5; u8 base_x_offset = 54; u8 base_y = 52; - u8 base_offset = 9; + u8 base_y_offset = 9; u8 base_i = 0; u8 times = 0; @@ -7998,7 +8051,7 @@ static void PrintForms(u8 taskId, u16 species) if (times == 0) { StringExpandPlaceholders(gStringVar4, gText_FORMS_NONE); - PrintInfoScreenTextSmall(gStringVar4, base_x, base_y + base_offset*times); + PrintInfoScreenTextSmall(gStringVar4, base_x, base_y + base_y_offset*times); } } static void Task_SwitchScreensFromFormsScreen(u8 taskId) From 6bbdc79f5a82d348e885d2a40fe6b6278f9f0db9 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 12 Jun 2021 21:55:02 +0200 Subject: [PATCH 19/88] EVs represented by Arrows instead of numbers, also now in 1 line --- include/strings.h | 20 ++--- src/pokedex.c | 195 +++++++++++++++++++++++++++++++++------------- src/strings.c | 20 ++--- 3 files changed, 151 insertions(+), 84 deletions(-) diff --git a/include/strings.h b/include/strings.h index 698ea8471247..c2838ceb4572 100644 --- a/include/strings.h +++ b/include/strings.h @@ -533,25 +533,15 @@ extern const u8 gText_SearchCompleted[]; extern const u8 gText_NoMatchingPkmnWereFound[]; extern const u8 gText_SelectorArrow[]; //PokedexPlus HGSS_Ui -extern const u8 gText_Stats_EV[]; -extern const u8 gText_Stats_EV_HP[]; -extern const u8 gText_Stats_EV_Attack[]; -extern const u8 gText_Stats_EV_Defense[]; -extern const u8 gText_Stats_EV_Speed[]; -extern const u8 gText_Stats_EV_SpAtk[]; -extern const u8 gText_Stats_EV_SpDef[]; extern const u8 gText_Stats_HP[]; extern const u8 gText_Stats_Attack[]; extern const u8 gText_Stats_Defense[]; extern const u8 gText_Stats_Speed[]; -extern const u8 gText_Stats_SpAtk[]; -extern const u8 gText_Stats_SpDef[]; -extern const u8 gText_Stats_EVHP[]; -extern const u8 gText_Stats_EVAttack[]; -extern const u8 gText_Stats_EVDefense[]; -extern const u8 gText_Stats_EVSpeed[]; -extern const u8 gText_Stats_EVSpAtk[]; -extern const u8 gText_Stats_EVSpDef[]; +extern const u8 gText_Stats_SpAttack[]; +extern const u8 gText_Stats_SpDefense[]; +extern const u8 gText_Stats_EV_Plus1[]; +extern const u8 gText_Stats_EV_Plus2[]; +extern const u8 gText_Stats_EV_Plus3[]; extern const u8 gText_Stats_MoveSelectedMax[]; extern const u8 gText_Stats_MoveLevel[]; extern const u8 gText_Stats_Gender_0[]; diff --git a/src/pokedex.c b/src/pokedex.c index 413a91922434..9d6643f44733 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -6758,6 +6758,22 @@ static u8 PrintMonStatsToggle_DifferentEVsRow(u8 differentEVs) else return 1; } +static u8* PrintMonStatsToggle_EV_Arrows(u8 *dest, u8 EVs[], u8 position) +{ + switch (EVs[position]) + { + case 1: + StringCopy(dest, gText_Stats_EV_Plus1); + break; + case 2: + StringCopy(dest, gText_Stats_EV_Plus2); + break; + case 3: + StringCopy(dest, gText_Stats_EV_Plus3); + break; + } + return dest; +} static void PrintMonStatsToggle(u8 taskId) { u8 base_x = 8; @@ -6779,7 +6795,7 @@ static void PrintMonStatsToggle(u8 taskId) u8 abilities_y = 99; u8 ability0; u8 differentEVs = 0; - u8 differentEVsOffsetX = 0; + u8 EVs[6] = {gBaseStats[species].evYield_HP, gBaseStats[species].evYield_Speed, gBaseStats[species].evYield_Attack, gBaseStats[species].evYield_SpAttack, gBaseStats[species].evYield_Defense, gBaseStats[species].evYield_SpDefense}; //Clear old text FillWindowPixelRect(0, PIXEL_FILL(0), base_x, base_y, 90, 100); //bottom stats @@ -6802,7 +6818,7 @@ static void PrintMonStatsToggle(u8 taskId) ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); - PrintInfoScreenTextSmall(gText_Stats_SpAtk, base_x+base_x_second_row, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_SpAttack, base_x+base_x_second_row, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -6811,71 +6827,142 @@ static void PrintMonStatsToggle(u8 taskId) ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); - PrintInfoScreenTextSmall(gText_Stats_SpDef, base_x+base_x_second_row, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_SpDefense, base_x+base_x_second_row, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); base_i++; } - else //EV increses + else //EV increases { - if (gBaseStats[species].evYield_HP > 0) //HP - { + //Count how many different EVs + if (EVs[0] > 0) //HP differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_EVHP, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_HP, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); - } - - if (gBaseStats[species].evYield_Speed > 0) //Speed - { + if (EVs[1] > 0) //Speed differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_EVSpeed, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Speed, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); - } - - if (gBaseStats[species].evYield_Attack > 0) //Attack - { + if (EVs[2] > 0) //Attack differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_EVAttack, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Attack, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); - } - - if (gBaseStats[species].evYield_SpAttack > 0) //Special Attack - { + if (EVs[3] > 0) //Special Attack + differentEVs++; + if (EVs[4] > 0) //Defense + differentEVs++; + if (EVs[5] > 0) //Special Defense differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_EVSpAtk, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_SpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); - } - if (gBaseStats[species].evYield_Defense > 0) //Defense + //If 1 or 2 EVs display with the same layout as the base stats + if (differentEVs < 3) { - differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_EVDefense, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_Defense, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); - } + differentEVs = 0; + + if (gBaseStats[species].evYield_HP > 0) //HP + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_HP, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 0); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } + + if (gBaseStats[species].evYield_Speed > 0) //Speed + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_Speed, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 1); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } - if (gBaseStats[species].evYield_SpDefense > 0) //Special Defense + if (gBaseStats[species].evYield_Attack > 0) //Attack + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_Attack, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 2); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } + + if (gBaseStats[species].evYield_SpAttack > 0) //Special Attack + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_SpAttack, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 3); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } + + if (gBaseStats[species].evYield_Defense > 0) //Defense + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_Defense, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 4); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } + + if (gBaseStats[species].evYield_SpDefense > 0) //Special Defense + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + PrintInfoScreenTextSmall(gText_Stats_SpDefense, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 5); + PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + } + } + else //3 different EVs in 1 row { - differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_EVSpDef, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].evYield_SpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + column = 0; + if (gBaseStats[species].evYield_HP > 0) //HP + { + PrintInfoScreenTextSmall(gText_Stats_HP, base_x + 29*column, base_y); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 0); + PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + column++; + } + + if (gBaseStats[species].evYield_Speed > 0) //Speed + { + PrintInfoScreenTextSmall(gText_Stats_Speed, base_x + 29*column, base_y); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 1); + PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + column++; + } + + if (gBaseStats[species].evYield_Attack > 0) //Attack + { + PrintInfoScreenTextSmall(gText_Stats_Attack, base_x + 29*column, base_y); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 2); + PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + column++; + } + + if (gBaseStats[species].evYield_SpAttack > 0) //Special Attack + { + PrintInfoScreenTextSmall(gText_Stats_SpAttack, base_x + 29*column, base_y); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 3); + PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + column++; + } + + if (gBaseStats[species].evYield_Defense > 0) //Defense + { + PrintInfoScreenTextSmall(gText_Stats_Defense, base_x + 29*column, base_y); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 4); + PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + column++; + } + + if (gBaseStats[species].evYield_SpDefense > 0) //Special Defense + { + PrintInfoScreenTextSmall(gText_Stats_SpDefense, base_x + 29*column, base_y); + PrintMonStatsToggle_EV_Arrows(strBase, EVs, 5); + PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + column++; + } } } diff --git a/src/strings.c b/src/strings.c index 2e9d04e3861d..9476cbc7e777 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1820,25 +1820,15 @@ const u8 gText_Berries[] = _("BERRIES"); //HGSS_Ui PokedexPlus -const u8 gText_Stats_EV[] = _("EV: "); -const u8 gText_Stats_EV_HP[] = _("HP {PLUS} "); -const u8 gText_Stats_EV_Attack[] = _("ATTACK {PLUS} "); -const u8 gText_Stats_EV_Defense[] = _("DEFENSE {PLUS} "); -const u8 gText_Stats_EV_Speed[] = _("SPEED {PLUS} "); -const u8 gText_Stats_EV_SpAtk[] = _("SP. ATK {PLUS} "); -const u8 gText_Stats_EV_SpDef[] = _("SP. DEF {PLUS}"); const u8 gText_Stats_HP[] = _("HP "); const u8 gText_Stats_Attack[] = _("ATK "); const u8 gText_Stats_Defense[] = _("DEF "); const u8 gText_Stats_Speed[] = _("SPE "); -const u8 gText_Stats_SpAtk[] = _("SP.A "); -const u8 gText_Stats_SpDef[] = _("SP.D "); -const u8 gText_Stats_EVHP[] = _("EV HP"); -const u8 gText_Stats_EVAttack[] = _("EV ATK"); -const u8 gText_Stats_EVDefense[] = _("EV DEF"); -const u8 gText_Stats_EVSpeed[] = _("EV SPE"); -const u8 gText_Stats_EVSpAtk[] = _("EV SP.A"); -const u8 gText_Stats_EVSpDef[] = _("EV SP.D"); +const u8 gText_Stats_SpAttack[] = _("SP.A "); +const u8 gText_Stats_SpDefense[] = _("SP.D "); +const u8 gText_Stats_EV_Plus1[] = _("{UP_ARROW_2}"); +const u8 gText_Stats_EV_Plus2[] = _("{UP_ARROW_2}{UP_ARROW_2}"); +const u8 gText_Stats_EV_Plus3[] = _("{UP_ARROW_2}{UP_ARROW_2}{UP_ARROW_2}"); const u8 gText_Stats_MoveSelectedMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); const u8 gText_Stats_MoveLevel[] = _("LVL"); const u8 gText_Stats_Gender_0[] = _("♂"); From ac56eec979af7de6310d7c585b632879cf0db030 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 12 Jun 2021 23:00:58 +0200 Subject: [PATCH 20/88] shortened evo methodes, fixed typos --- src/strings.c | 76 +++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/strings.c b/src/strings.c index 9476cbc7e777..420894fe8990 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1840,7 +1840,7 @@ const u8 gText_Stats_Gender_87_5[] = _("♀ 7/1 ♂"); const u8 gText_Stats_Gender_100[] = _("♀"); const u8 gText_Stats_Catch[] = _("CATCH RATE: "); const u8 gText_Stats_ExpYield[] = _("EXP YIELD: "); -const u8 gText_Stats_EggCycles[] = _("EGG CYCLES: "); +const u8 gText_Stats_EggCycles[] = _("HATCH SPEED:"); const u8 gText_Stats_EggCycles_VeryFast[] = _("{EMOJI_BOLT}{EMOJI_DIZZYEGG}"); const u8 gText_Stats_EggCycles_Fast[] = _("{EMOJI_DIZZYEGG}"); const u8 gText_Stats_EggCycles_Normal[] = _("{EMOJI_DIZZYEGG}{EMOJI_DIZZYEGG}"); @@ -1862,17 +1862,17 @@ const u8 gText_Stats_Minus[] = _("-"); const u8 gText_Stats_eggGroup_g1[] = _("EGG G1:"); const u8 gText_Stats_eggGroup_g2[] = _("EGG G2:"); const u8 gText_Stats_eggGroup_MONSTER[] = _("MONSTER"); -const u8 gText_Stats_eggGroup_WATER_1[] = _("WATER 1"); +const u8 gText_Stats_eggGroup_WATER_1[] = _("WATER{CIRCLE_1}"); const u8 gText_Stats_eggGroup_BUG[] = _("BUG"); const u8 gText_Stats_eggGroup_FLYING[] = _("FLYING"); const u8 gText_Stats_eggGroup_FIELD[] = _("FIELD"); -const u8 gText_Stats_eggGroup_FAIRY[] = _("FAIR"); +const u8 gText_Stats_eggGroup_FAIRY[] = _("FAIRY"); const u8 gText_Stats_eggGroup_GRASS[] = _("GRASS"); -const u8 gText_Stats_eggGroup_HUMAN_LIKE[] = _("HUMAN LIKE"); -const u8 gText_Stats_eggGroup_WATER_3[] = _("WATER 3"); +const u8 gText_Stats_eggGroup_HUMAN_LIKE[] = _("HUMAN"); +const u8 gText_Stats_eggGroup_WATER_3[] = _("WATER{CIRCLE_3}"); const u8 gText_Stats_eggGroup_MINERAL[] = _("MINERAL"); const u8 gText_Stats_eggGroup_AMORPHOUS[] = _("AMORPHOUS"); -const u8 gText_Stats_eggGroup_WATER_2[] = _("WATER 2"); +const u8 gText_Stats_eggGroup_WATER_2[] = _("WATER{CIRCLE_2}"); const u8 gText_Stats_eggGroup_DITTO[] = _("DITTO"); const u8 gText_Stats_eggGroup_DRAGON[] = _("DRAGON"); const u8 gText_Stats_eggGroup_UNDISCOVERED[]= _("---"); @@ -1880,37 +1880,37 @@ const u8 gText_Dex_SEEN[] = _("SEEN"); const u8 gText_Dex_OWN[] = _("OWN"); const u8 gText_EVO_Name[] = _("{STR_VAR_3}:"); -const u8 gText_EVO_FRIENDSHIP[] = _("Lvl up with friendship >= 220"); -const u8 gText_EVO_FRIENDSHIP_DAY[] = _("Lvl up at day with friendship >= 220"); -const u8 gText_EVO_FRIENDSHIP_NIGHT[] = _("Lvl up at night with friendship >= 220"); -const u8 gText_EVO_LEVEL[] = _("Lvl up to {STR_VAR_2}"); -const u8 gText_EVO_TRADE[] = _("via trading"); -const u8 gText_EVO_TRADE_ITEM[] = _("via trading while holding {STR_VAR_2}"); -const u8 gText_EVO_ITEM[] = _("{STR_VAR_2} is used on Pokémon"); -const u8 gText_EVO_LEVEL_ATK_GT_DEF[] = _("Lvl up to {STR_VAR_2} with attack > defense"); -const u8 gText_EVO_LEVEL_ATK_EQ_DEF[] = _("Lvl up to {STR_VAR_2} with attack = defense"); -const u8 gText_EVO_LEVEL_ATK_LT_DEF[] = _("Lvl up to {STR_VAR_2} with attack < defense"); -const u8 gText_EVO_LEVEL_SILCOON[] = _("Lvl up to {STR_VAR_2} with Silcoon persona"); -const u8 gText_EVO_LEVEL_CASCOON[] = _("Lvl up to {STR_VAR_2} with Cascoon persona"); -const u8 gText_EVO_LEVEL_NINJASK[] = _("Lvl up to {STR_VAR_2}"); -const u8 gText_EVO_LEVEL_SHEDINJA[] = _("Lvl up to {STR_VAR_2}, party<6, 1x POKéBALL"); -const u8 gText_EVO_BEAUTY[] = _("Lvl up with beauty >= {STR_VAR_2}"); -const u8 gText_EVO_LEVEL_FEMALE[] = _("Lvl up to {STR_VAR_2}, is female"); -const u8 gText_EVO_LEVEL_MALE[] = _("Lvl up to {STR_VAR_2}, is male"); -const u8 gText_EVO_LEVEL_NIGHT[] = _("Lvl up to {STR_VAR_2} at night"); -const u8 gText_EVO_LEVEL_DAY[] = _("Lvl up to {STR_VAR_2} at day"); -const u8 gText_EVO_LEVEL_DUSK[] = _("Lvl up to {STR_VAR_2} at dusk (5-6 P.M)"); -const u8 gText_EVO_ITEM_HOLD_DAY[] = _("Lvl up, holds {STR_VAR_2} at day"); -const u8 gText_EVO_ITEM_HOLD_NIGHT[] = _("Lvl up, holds{STR_VAR_2} at night"); -const u8 gText_EVO_MOVE[] = _("Lvl up, knows {STR_VAR_2}"); -const u8 gText_EVO_MOVE_TYPE[] = _("Lvl up, knows {STR_VAR_2} type move"); -const u8 gText_EVO_MAPSEC[] = _("Lvl up on {STR_VAR_2}"); +const u8 gText_EVO_FRIENDSHIP[] = _("LvlUp, high friendship"); +const u8 gText_EVO_FRIENDSHIP_DAY[] = _("LvlUp, high friendship, day"); +const u8 gText_EVO_FRIENDSHIP_NIGHT[] = _("Lvlup, high friendship, night"); +const u8 gText_EVO_LEVEL[] = _("LvlUp to {STR_VAR_2}"); +const u8 gText_EVO_TRADE[] = _("Trading"); +const u8 gText_EVO_TRADE_ITEM[] = _("Trading, holding {STR_VAR_2}"); +const u8 gText_EVO_ITEM[] = _("{STR_VAR_2} is used"); +const u8 gText_EVO_LEVEL_ATK_GT_DEF[] = _("LvlUp to {STR_VAR_2}, Atk > Def"); +const u8 gText_EVO_LEVEL_ATK_EQ_DEF[] = _("LvlUp to {STR_VAR_2}, Atk = Def"); +const u8 gText_EVO_LEVEL_ATK_LT_DEF[] = _("LvlUp to {STR_VAR_2}, Atk < Def"); +const u8 gText_EVO_LEVEL_SILCOON[] = _("LvlUp to {STR_VAR_2}, Silcoon persona"); +const u8 gText_EVO_LEVEL_CASCOON[] = _("LvlUp to {STR_VAR_2}, Cascoon persona"); +const u8 gText_EVO_LEVEL_NINJASK[] = _("LvlUp to {STR_VAR_2}"); +const u8 gText_EVO_LEVEL_SHEDINJA[] = _("LvlUp to {STR_VAR_2}, party<6, 1x POKéBALL"); +const u8 gText_EVO_BEAUTY[] = _("LvlUp, high beauty"); +const u8 gText_EVO_LEVEL_FEMALE[] = _("LvlUp to {STR_VAR_2}, is female"); +const u8 gText_EVO_LEVEL_MALE[] = _("LvlUp to {STR_VAR_2}, is male"); +const u8 gText_EVO_LEVEL_NIGHT[] = _("LvlUp to {STR_VAR_2}, night"); +const u8 gText_EVO_LEVEL_DAY[] = _("LvlUp to {STR_VAR_2}, day"); +const u8 gText_EVO_LEVEL_DUSK[] = _("LvlUp to {STR_VAR_2}, dusk (5-6PM)"); +const u8 gText_EVO_ITEM_HOLD_DAY[] = _("LvlUp, holds {STR_VAR_2}, day"); +const u8 gText_EVO_ITEM_HOLD_NIGHT[] = _("LvlUp, holds {STR_VAR_2}, night"); +const u8 gText_EVO_MOVE[] = _("LvlUp, knows {STR_VAR_2}"); +const u8 gText_EVO_MOVE_TYPE[] = _("LvlUp, knows {STR_VAR_2} move"); +const u8 gText_EVO_MAPSEC[] = _("LvlUp on {STR_VAR_2}"); const u8 gText_EVO_ITEM_MALE[] = _("{STR_VAR_2} used on male"); const u8 gText_EVO_ITEM_FEMALE[] = _("{STR_VAR_2} used on female"); -const u8 gText_EVO_LEVEL_RAIN[] = _("Lvl up to {STR_VAR_2} while raining"); -const u8 gText_EVO_SPECIFIC_MON_IN_PARTY[] = _("Lvl up with a {STR_VAR_2} in party"); -const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[] = _("Lvl up with with dark type in party"); -const u8 gText_EVO_TRADE_SPECIFIC_MON[] = _("is traded for a {STR_VAR_2}"); -const u8 gText_EVO_SPECIFIC_MAP[] = _("Lvl up on {STR_VAR_2}"); -const u8 gText_EVO_NONE[] = _("There is no evolution for {STR_VAR_1}."); -const u8 gText_FORMS_NONE[] = _("No alternate forms for {STR_VAR_1}."); +const u8 gText_EVO_LEVEL_RAIN[] = _("LvlUp to {STR_VAR_2} while raining"); +const u8 gText_EVO_SPECIFIC_MON_IN_PARTY[] = _("LvlUp with {STR_VAR_2} in party"); +const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[] = _("LvlUp with dark type in party"); +const u8 gText_EVO_TRADE_SPECIFIC_MON[] = _("Traded for {STR_VAR_2}"); +const u8 gText_EVO_SPECIFIC_MAP[] = _("LvlUp on {STR_VAR_2}"); +const u8 gText_EVO_NONE[] = _("{STR_VAR_1} has no evolution."); +const u8 gText_FORMS_NONE[] = _("{STR_VAR_1} has no alternate forms."); From 13256b856e958b76504c46e6b9118d1b0efda30d Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 12 Jun 2021 23:38:08 +0200 Subject: [PATCH 21/88] Egg groups now in one line (if 2 different one), changed where the bg is cleared --- include/strings.h | 4 +- src/pokedex.c | 124 +++++++++++++++++++++++----------------------- src/strings.c | 12 ++--- 3 files changed, 69 insertions(+), 71 deletions(-) diff --git a/include/strings.h b/include/strings.h index c2838ceb4572..3e7ab51fb4af 100644 --- a/include/strings.h +++ b/include/strings.h @@ -573,8 +573,8 @@ extern const u8 gText_Stats_SLOW[]; extern const u8 gText_Stats_ContestHeart[]; extern const u8 gText_PlusSymbol[]; extern const u8 gText_Stats_Minus[]; -extern const u8 gText_Stats_eggGroup_g1[]; -extern const u8 gText_Stats_eggGroup_g2[]; +extern const u8 gText_Stats_eggGroup[]; +extern const u8 gText_Stats_eggGroup_Groups[]; extern const u8 gText_Stats_eggGroup_MONSTER[]; extern const u8 gText_Stats_eggGroup_WATER_1[]; extern const u8 gText_Stats_eggGroup_BUG[]; diff --git a/src/pokedex.c b/src/pokedex.c index 9d6643f44733..4a88db676705 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -6323,6 +6323,7 @@ static void Task_LoadStatsScreen(u8 taskId) break; case 6: gTasks[taskId].data[5] = 0; + FillWindowPixelRect(0, PIXEL_FILL(0), 0, 48, 240, 130); PrintMonStats(taskId, sPokedexListItem->dexNum, sPokedexView->dexMode == DEX_MODE_HOENN ? FALSE : TRUE, sPokedexListItem->owned, 0); PrintMonStatsToggle(taskId); if (!sPokedexListItem->owned) @@ -6397,6 +6398,7 @@ static void Task_HandleStatsScreenInput(u8 taskId) gTasks[taskId].data[5] = 1; else gTasks[taskId].data[5] = 0; + FillWindowPixelRect(0, PIXEL_FILL(0), 0, 48, 240, 130); PrintMonStatsToggle(taskId); DestroyMoveIcon(taskId); PrintMoveNameAndInfo(taskId, TRUE); @@ -6414,6 +6416,7 @@ static void Task_HandleStatsScreenInput(u8 taskId) { sPokedexView->moveSelected -= 1; PlaySE(SE_SELECT); + FillWindowPixelRect(0, PIXEL_FILL(0), 96, 16, 144, 80); DestroyMoveIcon(taskId); PrintMoveNameAndInfo(taskId, FALSE); } @@ -6421,6 +6424,7 @@ static void Task_HandleStatsScreenInput(u8 taskId) { sPokedexView->moveSelected = sPokedexView->moveSelected + 1; PlaySE(SE_SELECT); + FillWindowPixelRect(0, PIXEL_FILL(0), 96, 16, 144, 80); DestroyMoveIcon(taskId); PrintMoveNameAndInfo(taskId, FALSE); } @@ -6522,12 +6526,6 @@ static void PrintMoveNameAndInfo(u8 taskId, bool8 toggle) //Contest u8 contest_i, contest_effectValue, contest_appeal, contest_jam; - //Clear space - if (!toggle) - FillWindowPixelRect(0, PIXEL_FILL(0), moves_x-1, moves_y, 139, 78); - else - FillWindowPixelRect(0, PIXEL_FILL(0), moves_x-1, moves_y+29, 139, 55); - //Calculate and retrieve correct move from the arrays if (selected < numEggMoves) { @@ -6797,10 +6795,6 @@ static void PrintMonStatsToggle(u8 taskId) u8 differentEVs = 0; u8 EVs[6] = {gBaseStats[species].evYield_HP, gBaseStats[species].evYield_Speed, gBaseStats[species].evYield_Attack, gBaseStats[species].evYield_SpAttack, gBaseStats[species].evYield_Defense, gBaseStats[species].evYield_SpDefense}; - //Clear old text - FillWindowPixelRect(0, PIXEL_FILL(0), base_x, base_y, 90, 100); //bottom stats - FillWindowPixelRect(0, PIXEL_FILL(0), abilities_x, 99, 130, 58); //abilities - //Base stats if (gTasks[taskId].data[5] == 0) @@ -7046,7 +7040,6 @@ static void PrintMonStatsToggle(u8 taskId) { base_i = 0; //Egg group 1 - PrintInfoScreenTextSmall(gText_Stats_eggGroup_g1, base_x, base_y + base_y_offset*base_i); switch (gBaseStats[species].eggGroup1) { case EGG_GROUP_MONSTER : @@ -7095,62 +7088,67 @@ static void PrintMonStatsToggle(u8 taskId) StringCopy(gStringVar1, gText_Stats_eggGroup_UNDISCOVERED); break; } - align_x = GetStringRightAlignXOffset(0, gStringVar1, total_x); - PrintInfoScreenTextSmall(gStringVar1, align_x, base_y + base_y_offset*base_i); - base_i++; //Egg group 2 - PrintInfoScreenTextSmall(gText_Stats_eggGroup_g2, base_x, base_y + base_y_offset*base_i); - switch (gBaseStats[species].eggGroup2) + if (gBaseStats[species].eggGroup1 != gBaseStats[species].eggGroup2) { - case EGG_GROUP_MONSTER : - StringCopy(gStringVar1, gText_Stats_eggGroup_MONSTER); - break; - case EGG_GROUP_WATER_1 : - StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_1); - break; - case EGG_GROUP_BUG : - StringCopy(gStringVar1, gText_Stats_eggGroup_BUG); - break; - case EGG_GROUP_FLYING : - StringCopy(gStringVar1, gText_Stats_eggGroup_FLYING); - break; - case EGG_GROUP_FIELD : - StringCopy(gStringVar1, gText_Stats_eggGroup_FIELD); - break; - case EGG_GROUP_FAIRY : - StringCopy(gStringVar1, gText_Stats_eggGroup_FAIRY); - break; - case EGG_GROUP_GRASS : - StringCopy(gStringVar1, gText_Stats_eggGroup_GRASS); - break; - case EGG_GROUP_HUMAN_LIKE : - StringCopy(gStringVar1, gText_Stats_eggGroup_HUMAN_LIKE); - break; - case EGG_GROUP_WATER_3 : - StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_3); - break; - case EGG_GROUP_MINERAL : - StringCopy(gStringVar1, gText_Stats_eggGroup_MINERAL); - break; - case EGG_GROUP_AMORPHOUS : - StringCopy(gStringVar1, gText_Stats_eggGroup_AMORPHOUS); - break; - case EGG_GROUP_WATER_2 : - StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_2); - break; - case EGG_GROUP_DITTO : - StringCopy(gStringVar1, gText_Stats_eggGroup_DITTO); - break; - case EGG_GROUP_DRAGON : - StringCopy(gStringVar1, gText_Stats_eggGroup_DRAGON); - break; - case EGG_GROUP_UNDISCOVERED: - StringCopy(gStringVar1, gText_Stats_eggGroup_UNDISCOVERED); - break; + switch (gBaseStats[species].eggGroup2) + { + case EGG_GROUP_MONSTER : + StringCopy(gStringVar2, gText_Stats_eggGroup_MONSTER); + break; + case EGG_GROUP_WATER_1 : + StringCopy(gStringVar2, gText_Stats_eggGroup_WATER_1); + break; + case EGG_GROUP_BUG : + StringCopy(gStringVar2, gText_Stats_eggGroup_BUG); + break; + case EGG_GROUP_FLYING : + StringCopy(gStringVar2, gText_Stats_eggGroup_FLYING); + break; + case EGG_GROUP_FIELD : + StringCopy(gStringVar2, gText_Stats_eggGroup_FIELD); + break; + case EGG_GROUP_FAIRY : + StringCopy(gStringVar2, gText_Stats_eggGroup_FAIRY); + break; + case EGG_GROUP_GRASS : + StringCopy(gStringVar2, gText_Stats_eggGroup_GRASS); + break; + case EGG_GROUP_HUMAN_LIKE : + StringCopy(gStringVar2, gText_Stats_eggGroup_HUMAN_LIKE); + break; + case EGG_GROUP_WATER_3 : + StringCopy(gStringVar2, gText_Stats_eggGroup_WATER_3); + break; + case EGG_GROUP_MINERAL : + StringCopy(gStringVar2, gText_Stats_eggGroup_MINERAL); + break; + case EGG_GROUP_AMORPHOUS : + StringCopy(gStringVar2, gText_Stats_eggGroup_AMORPHOUS); + break; + case EGG_GROUP_WATER_2 : + StringCopy(gStringVar2, gText_Stats_eggGroup_WATER_2); + break; + case EGG_GROUP_DITTO : + StringCopy(gStringVar2, gText_Stats_eggGroup_DITTO); + break; + case EGG_GROUP_DRAGON : + StringCopy(gStringVar2, gText_Stats_eggGroup_DRAGON); + break; + case EGG_GROUP_UNDISCOVERED: + StringCopy(gStringVar2, gText_Stats_eggGroup_UNDISCOVERED); + break; + } + StringExpandPlaceholders(gStringVar3, gText_Stats_eggGroup_Groups); + align_x = GetStringRightAlignXOffset(0, gStringVar3, total_x); + PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); + } + else + { + align_x = GetStringRightAlignXOffset(0, gStringVar1, total_x); + PrintInfoScreenTextSmall(gStringVar1, base_x, base_y + base_y_offset*base_i); } - align_x = GetStringRightAlignXOffset(0, gStringVar1, total_x); - PrintInfoScreenTextSmall(gStringVar1, align_x, base_y + base_y_offset*base_i); base_i++; //Egg cycles diff --git a/src/strings.c b/src/strings.c index 420894fe8990..a65bae0b2a34 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1859,20 +1859,20 @@ const u8 gText_Stats_FAST[] = _("FAST"); const u8 gText_Stats_SLOW[] = _("SLOW"); const u8 gText_Stats_ContestHeart[] = _("H"); const u8 gText_Stats_Minus[] = _("-"); -const u8 gText_Stats_eggGroup_g1[] = _("EGG G1:"); -const u8 gText_Stats_eggGroup_g2[] = _("EGG G2:"); +const u8 gText_Stats_eggGroup[] = _("EGG G1:"); +const u8 gText_Stats_eggGroup_Groups[] = _("{STR_VAR_1}/{STR_VAR_2}"); const u8 gText_Stats_eggGroup_MONSTER[] = _("MONSTER"); -const u8 gText_Stats_eggGroup_WATER_1[] = _("WATER{CIRCLE_1}"); +const u8 gText_Stats_eggGroup_WATER_1[] = _("WATER {CIRCLE_1}"); const u8 gText_Stats_eggGroup_BUG[] = _("BUG"); const u8 gText_Stats_eggGroup_FLYING[] = _("FLYING"); const u8 gText_Stats_eggGroup_FIELD[] = _("FIELD"); const u8 gText_Stats_eggGroup_FAIRY[] = _("FAIRY"); const u8 gText_Stats_eggGroup_GRASS[] = _("GRASS"); -const u8 gText_Stats_eggGroup_HUMAN_LIKE[] = _("HUMAN"); -const u8 gText_Stats_eggGroup_WATER_3[] = _("WATER{CIRCLE_3}"); +const u8 gText_Stats_eggGroup_HUMAN_LIKE[] = _("HUMAN LIKE"); +const u8 gText_Stats_eggGroup_WATER_3[] = _("WATER {CIRCLE_3}"); const u8 gText_Stats_eggGroup_MINERAL[] = _("MINERAL"); const u8 gText_Stats_eggGroup_AMORPHOUS[] = _("AMORPHOUS"); -const u8 gText_Stats_eggGroup_WATER_2[] = _("WATER{CIRCLE_2}"); +const u8 gText_Stats_eggGroup_WATER_2[] = _("WATER {CIRCLE_2}"); const u8 gText_Stats_eggGroup_DITTO[] = _("DITTO"); const u8 gText_Stats_eggGroup_DRAGON[] = _("DRAGON"); const u8 gText_Stats_eggGroup_UNDISCOVERED[]= _("---"); From 3896ce3abefa2e68366a36083be9e83ada606a4a Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sun, 13 Jun 2021 00:09:27 +0200 Subject: [PATCH 22/88] changed info per stats toggle page to an equal 5 --- .../pokedex/HGSS_tilemap_stats_screen.bin | Bin 1344 -> 1344 bytes graphics/pokedex/HGSS_tileset_menu1.png | Bin 1741 -> 1725 bytes src/pokedex.c | 142 +++++++++--------- src/strings.c | 2 +- 4 files changed, 69 insertions(+), 75 deletions(-) diff --git a/graphics/pokedex/HGSS_tilemap_stats_screen.bin b/graphics/pokedex/HGSS_tilemap_stats_screen.bin index a6eb2fd1626def8f8c422588414b94b5bc0a9b57..d6d4fb9463d01eeee51cffb058fc58664a53de79 100644 GIT binary patch delta 326 zcmaitO-{m46ot?0yCJn>h*qMNI3O;BvIU2-1I9W*w{TX#4jS+$0fb^yPy_)L6hY$# z2xCV+J8!sO@(s>8$qk**2}%}2wRKR%IW7$GzQq4k*jAhBia*NbO4+Pgdzl*QhDNNf zSywx%$%1xS)HaXx?tTm58d^Nj9?z^KSK8S)v~QyS0o&Tm-r~*>@B3)m;i;99E^@*n z*=A7^UM?yg@Q5Cs(8mDJ7-EF6NnY^EvbYSy_THkMk31%r;vFBD;S+N#Oyc8<-;(B1 I68sha4<0*h(EtDd delta 332 zcmaivO-=$)5QOXTIyjj%Mv)*ftT=`w3|DZ8H(uqr1o&TK- zkP{ZazSH=5$^GTM?B#fV@&X3oGE5JGjSEMQm?_BgFN0a$2&goi3Pr}G>(H6 Mmy+O*M7b5`7lEd4k^lez diff --git a/graphics/pokedex/HGSS_tileset_menu1.png b/graphics/pokedex/HGSS_tileset_menu1.png index e9bcae9a1f039f7675ec6c5be87c6aabdb28d2db..5e305a01716e893b2f90d4973c05abd18a7dbc55 100644 GIT binary patch delta 1578 zcmV+_2G#k^4ZRJJ7aec}0{{R3B!Xq(00007bV*G`2jvC~761py1R&^@a^lJOJj(4w5D8 zY4qdX2f0;YR{&5U03eky8WLo@AOK&gu+sqOKoc-S8SsLV;WJS<0w_x)b7?>YV=7XR zG86#5V7w2;08af{e1JJuwI1LS0H?1tN%~6ipyHA|Ev20#4{M0iREJC|5CB6R3Mizn zc0^2HHjs1-fDQq^geQLhJhcZ%KKz$GCwEcfvH2LXTRmD2}Jp+fb$BzfHM zC)0~9@b4@@^>ylnQ-E_nZv)hIe=DH51h9>O9`6^I0v0hQYXWAY!CwK4B-3~NgX6~l zAF^`*IgZcNKm!r&?1sYH@$jvvyE0mRQr_0T$cY*dUzBz+{1S)ZZ00V^el9=;dG(D4 zfBzN-2w0QW!ce*{2tEua*6%oD)2Ki33&xcnP$>}F~}0Jyp=YgfSU z2Cw}S0`Op4B!G|uD7^+0=K(?%O72|_xC=!C^4EC)RjjG3ObQsh@5>ahodfhKK#fZQ zikwK}Qov#s5N*@q?G6CtpA6$V`F%`3mh{1|WDncnw8B09+d;ER3Y8lA|y=aP3y(MAT$r5Bliu{;4tn8+1h0p@MQ^Fw0>q(Oss zX|ZvexmkYz8iIh>OcdKn0L}Qpz^5YxK(o}h*|0u+#zzE>yipDJHEuv0Hiq3g0$5p< z)5v#p^l9Yy!Gd>_0E{Ku3n5d@RLmy{@mXI?118G0*h=eni~h?r2{>Ii)-v;^2)kY0?)p8_V*=no-}Ov| z?~A(ek~Ral8v}Cb%f|p^>1QUarZ*p}8Njyw$E4CHj#b?$fCkw$tg~Z)l`zvjCE@uW5*cPex6(HR`_25!`nTlxy(B97#03WER z%mczqxO>+ClK^-zp;|}*(N-v>2sjDhY7Stdr#b~l*NhrZ7heP36kr$wn*0nv{u!VM z0KDZ4w8c1#l2F!+!>g{Tm=quhqXOKW2Uvfko>l;q`)FUhrdkMq#M}K9fW%qNB*5bT zVl3;}Iof2+0`e)qfV&aZ1JE%5XiiO-dP!g3 c;h+BjmR=(qWUQPm00000NkvXXu0jG}f>asR#Q*>R delta 1594 zcmV-A2F3Zk4b2UZ7ae#60{{R3$kFGF00007bV*G`2ju}A6dyChSA`;xG?RbvNkl8<;5P1%A`vtpB__4v~tIr;S9;4 zEX9A@>>v&$ivBo%q=wEikhcBrrMgkF2x!~;0Q;t_s@e(}aKOHma@rFCZGix#I^Aid zl!ZSW-WCP?m5uw9htN}S699kv#sicCbV_Li;5T6$H;0p+0KjPg0P`cjT2#aV%BF;= znzC)7IdBhLa}xlK15^l5pn)C(P+<>f+kJ7s2hfZ(m;g9U%Z4oWK0pBUBH*UrzoP%i zZ&w4XjR1@ssNWu9R1Yq4$!!w$1K2o30OU@F7CAdx7g_v9!zQ=EWD$SH4%5Q}V6Lp; zEFn*$ANM}Utq8jSfC>Qssf^L!AmfDt(4`2w8vq?>0%j-yUQsf9#tKJ(%M#99H=u+u zrBl#lC;DD^A$0p?uUdVoy;l)hRe>C4H3igWU`F6}sZNJE^aY%*Sf02r#U zfI|98N5u3c1D%cm&>?@oFX0IQP3-|3Ik3CU;wCcS)sSYA&nB1ulyTU=9bfJ*OyxZ% z>FHhedZ%RePPrc-(idIhmQ&?Z5%1fW|4WjmWt68(EFg+eh~w!BoB@O-EC8bw$a{bQ zJOvZdO=Qn^9B9r1zY7V#HiYqlu#*75kbHs9a6=x<0Ims{B6)v=&u;{vS56<)Muh5D z;pBNkuS_r6;Qv{G=YNB;upDH3_sanIGcJ1vtJ6} zL0*030r{-}Io5vzthDkLfL~Sp4S>gQkKY2Iz7oT6AQo#XE0qEU@B1PJZ07)d z3J~K`fFLJQ+Z3>v1w`AVc)J5Y_$R}-PQD-0m!*5*mt23tcK%EP?-~S{3jkO?0N~)> z{H`jr?p)>p>7k%b92fu%0`Sd01>ga69JKD(=uS_rx``7U+?!wGGw?72ipC!Y$wtM^ z@TqaIq4b8FgaCFDtB6jr060@8uF;89Jr`6dMH>k)mtM{UjO7V{!{l6X4lr*co*!y8 zAPpM4OBa6|wV9m-pdko|&BS6`F`ynl80d5)0BDwYH!ISo&*+FikyoOjzS<6m!$y%? zM*z*cavJ&09erv(evshZBmiSc_Cm-+GZphm0A)MojC9y^$UXr$dt=Dp?qa}HY(v|{ zfrk81=LG4N&~BjbYJefYJ3ceN1(4qZfQl+JX?lNtza9|I9!~zf3ILzXq-&{;3#Pvj z5EhJHT?7bUgiiS|hzE4sCO+%UG+<)cnk~1!TJ&$GNxEdHG1K3vos8ssIv7$Q#xIuai`|KE?c^Qwp z;n;uY2J0{QCAx-!@ky$=1_uKFJy%egBpAKUK?4F9*D}DQQ4oN%it5cgKt>@K0DK^# zGY<$eVHGa{DgmfDK(rN>R0N!aay19g(NmoOq@VHyMpp+Ic`e1sJd@(JxgBaLc(L0}SsEy#VMRO4X-;1ux$*fSkG(fa8zq#|{dS zDw82GQhw175zFP$4gP?`<;Sre-d?Od*4Dm!ERR+7v780u><>4aQadoX>KtI$9qWJU z?WI#kbc5g0#^K=~J{W-N27uiOMXm)@Fm<&P4gG%5!AH9bx17cR4S*U;#}3Oe{QVl5 z0NBY+XV=>pKrx4`!SXLmMgjn-)(k+CR!Iu`i_A*L0H8iKVai7lus|v`gkNiK1Sn Date: Sun, 13 Jun 2021 00:35:38 +0200 Subject: [PATCH 23/88] EV Arrows now close to stats --- include/strings.h | 1 + src/pokedex.c | 84 +++++++++++++++++++++++++++-------------------- src/strings.c | 13 ++++---- 3 files changed, 56 insertions(+), 42 deletions(-) diff --git a/include/strings.h b/include/strings.h index 3e7ab51fb4af..9a76c1afc497 100644 --- a/include/strings.h +++ b/include/strings.h @@ -542,6 +542,7 @@ extern const u8 gText_Stats_SpDefense[]; extern const u8 gText_Stats_EV_Plus1[]; extern const u8 gText_Stats_EV_Plus2[]; extern const u8 gText_Stats_EV_Plus3[]; +extern const u8 gText_Stats_EvStr1Str2[]; extern const u8 gText_Stats_MoveSelectedMax[]; extern const u8 gText_Stats_MoveLevel[]; extern const u8 gText_Stats_Gender_0[]; diff --git a/src/pokedex.c b/src/pokedex.c index d12f53fda8f4..4454969a1c39 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -6852,9 +6852,10 @@ static void PrintMonStatsToggle(u8 taskId) differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_HP, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 0); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + StringCopy(gStringVar1, gText_Stats_HP); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 0); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } if (gBaseStats[species].evYield_Speed > 0) //Speed @@ -6862,9 +6863,10 @@ static void PrintMonStatsToggle(u8 taskId) differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_Speed, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 1); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + StringCopy(gStringVar1, gText_Stats_Speed); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 1); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } if (gBaseStats[species].evYield_Attack > 0) //Attack @@ -6872,9 +6874,10 @@ static void PrintMonStatsToggle(u8 taskId) differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_Attack, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 2); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + StringCopy(gStringVar1, gText_Stats_Attack); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 2); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } if (gBaseStats[species].evYield_SpAttack > 0) //Special Attack @@ -6882,9 +6885,10 @@ static void PrintMonStatsToggle(u8 taskId) differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_SpAttack, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 3); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + StringCopy(gStringVar1, gText_Stats_SpAttack); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 3); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } if (gBaseStats[species].evYield_Defense > 0) //Defense @@ -6892,9 +6896,10 @@ static void PrintMonStatsToggle(u8 taskId) differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_Defense, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 4); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + StringCopy(gStringVar1, gText_Stats_Defense); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 4); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } if (gBaseStats[species].evYield_SpDefense > 0) //Special Defense @@ -6902,9 +6907,10 @@ static void PrintMonStatsToggle(u8 taskId) differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - PrintInfoScreenTextSmall(gText_Stats_SpDefense, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 5); - PrintInfoScreenTextSmall(strBase, base_x + x_offset_column*column + x_offset_value, base_y + base_y_offset*base_i); + StringCopy(gStringVar1, gText_Stats_SpDefense); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 5); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } } else //3 different EVs in 1 row @@ -6912,49 +6918,55 @@ static void PrintMonStatsToggle(u8 taskId) column = 0; if (gBaseStats[species].evYield_HP > 0) //HP { - PrintInfoScreenTextSmall(gText_Stats_HP, base_x + 29*column, base_y); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 0); - PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + StringCopy(gStringVar1, gText_Stats_HP); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 0); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } if (gBaseStats[species].evYield_Speed > 0) //Speed { - PrintInfoScreenTextSmall(gText_Stats_Speed, base_x + 29*column, base_y); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 1); - PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + StringCopy(gStringVar1, gText_Stats_Speed); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 1); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } if (gBaseStats[species].evYield_Attack > 0) //Attack { - PrintInfoScreenTextSmall(gText_Stats_Attack, base_x + 29*column, base_y); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 2); - PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + StringCopy(gStringVar1, gText_Stats_Attack); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 2); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } if (gBaseStats[species].evYield_SpAttack > 0) //Special Attack { - PrintInfoScreenTextSmall(gText_Stats_SpAttack, base_x + 29*column, base_y); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 3); - PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + StringCopy(gStringVar1, gText_Stats_SpAttack); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 3); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } if (gBaseStats[species].evYield_Defense > 0) //Defense { - PrintInfoScreenTextSmall(gText_Stats_Defense, base_x + 29*column, base_y); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 4); - PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + StringCopy(gStringVar1, gText_Stats_Defense); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 4); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } if (gBaseStats[species].evYield_SpDefense > 0) //Special Defense { - PrintInfoScreenTextSmall(gText_Stats_SpDefense, base_x + 29*column, base_y); - PrintMonStatsToggle_EV_Arrows(strBase, EVs, 5); - PrintInfoScreenTextSmall(strBase, base_x + 29*column + 21, base_y); + StringCopy(gStringVar1, gText_Stats_SpDefense); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 5); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } } diff --git a/src/strings.c b/src/strings.c index 848db7e13cd8..2cf731137159 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1820,15 +1820,16 @@ const u8 gText_Berries[] = _("BERRIES"); //HGSS_Ui PokedexPlus -const u8 gText_Stats_HP[] = _("HP "); -const u8 gText_Stats_Attack[] = _("ATK "); -const u8 gText_Stats_Defense[] = _("DEF "); -const u8 gText_Stats_Speed[] = _("SPE "); -const u8 gText_Stats_SpAttack[] = _("SP.A "); -const u8 gText_Stats_SpDefense[] = _("SP.D "); +const u8 gText_Stats_HP[] = _("HP"); +const u8 gText_Stats_Attack[] = _("ATK"); +const u8 gText_Stats_Defense[] = _("DEF"); +const u8 gText_Stats_Speed[] = _("SPE"); +const u8 gText_Stats_SpAttack[] = _("SP.A"); +const u8 gText_Stats_SpDefense[] = _("SP.D"); const u8 gText_Stats_EV_Plus1[] = _("{UP_ARROW_2}"); const u8 gText_Stats_EV_Plus2[] = _("{UP_ARROW_2}{UP_ARROW_2}"); const u8 gText_Stats_EV_Plus3[] = _("{UP_ARROW_2}{UP_ARROW_2}{UP_ARROW_2}"); +const u8 gText_Stats_EvStr1Str2[] = _("{STR_VAR_1}{STR_VAR_2}"); const u8 gText_Stats_MoveSelectedMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); const u8 gText_Stats_MoveLevel[] = _("LVL"); const u8 gText_Stats_Gender_0[] = _("♂"); From 1530da10a03328acad50b567ec8974aba256bda8 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sun, 13 Jun 2021 01:17:47 +0200 Subject: [PATCH 24/88] changed catch rate to words --- include/strings.h | 8 +++++++- src/pokedex.c | 16 +++++++++++++--- src/strings.c | 10 ++++++++-- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/include/strings.h b/include/strings.h index 9a76c1afc497..e3410e45fde4 100644 --- a/include/strings.h +++ b/include/strings.h @@ -552,7 +552,13 @@ extern const u8 gText_Stats_Gender_50[]; extern const u8 gText_Stats_Gender_75[]; extern const u8 gText_Stats_Gender_87_5[]; extern const u8 gText_Stats_Gender_100[]; -extern const u8 gText_Stats_Catch[]; +extern const u8 gText_Stats_CatchRate[]; +extern const u8 gText_Stats_CatchRate_Legend[]; +extern const u8 gText_Stats_CatchRate_VeryHard[]; +extern const u8 gText_Stats_CatchRate_Difficult[]; +extern const u8 gText_Stats_CatchRate_Medium[]; +extern const u8 gText_Stats_CatchRate_Relaxed[]; +extern const u8 gText_Stats_CatchRate_Easy[]; extern const u8 gText_Stats_ExpYield[]; extern const u8 gText_Stats_EggCycles[]; extern const u8 gText_Stats_EggCycles_VeryFast[]; diff --git a/src/pokedex.c b/src/pokedex.c index 4454969a1c39..8438010566d8 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -6977,9 +6977,19 @@ static void PrintMonStatsToggle(u8 taskId) if (gTasks[taskId].data[5] == 0) { //Catch rate - PrintInfoScreenTextSmall(gText_Stats_Catch, base_x, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(gStringVar1, gBaseStats[species].catchRate, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(gStringVar1, base_x + base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gText_Stats_CatchRate, base_x, base_y + base_y_offset*base_i); + if (gBaseStats[species].catchRate <= 10) + PrintInfoScreenTextSmall(gText_Stats_CatchRate_Legend, base_x + x_offset_column, base_y + base_y_offset*base_i); + else if (gBaseStats[species].catchRate <= 70) + PrintInfoScreenTextSmall(gText_Stats_CatchRate_VeryHard, base_x + x_offset_column, base_y + base_y_offset*base_i); + else if (gBaseStats[species].catchRate <= 100) + PrintInfoScreenTextSmall(gText_Stats_CatchRate_Difficult, base_x + x_offset_column, base_y + base_y_offset*base_i); + else if (gBaseStats[species].catchRate <= 150) + PrintInfoScreenTextSmall(gText_Stats_CatchRate_Medium, base_x + x_offset_column, base_y + base_y_offset*base_i); + else if (gBaseStats[species].catchRate <= 200) + PrintInfoScreenTextSmall(gText_Stats_CatchRate_Relaxed, base_x + x_offset_column, base_y + base_y_offset*base_i); + else + PrintInfoScreenTextSmall(gText_Stats_CatchRate_Easy, base_x + x_offset_column, base_y + base_y_offset*base_i); base_i++; //Growth rate diff --git a/src/strings.c b/src/strings.c index 2cf731137159..2644fc9e4d79 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1839,9 +1839,15 @@ const u8 gText_Stats_Gender_50[] = _("♀ 1/1 ♂"); //_("♀ 50 / 50 const u8 gText_Stats_Gender_75[] = _("♀ 3/1 ♂"); //_("♀ 75 / 25 ♂"); const u8 gText_Stats_Gender_87_5[] = _("♀ 7/1 ♂"); const u8 gText_Stats_Gender_100[] = _("♀"); -const u8 gText_Stats_Catch[] = _("CATCH RATE: "); +const u8 gText_Stats_CatchRate[] = _("CATCH{0x5B}: "); +const u8 gText_Stats_CatchRate_Legend[] = _("LEGENDARY"); +const u8 gText_Stats_CatchRate_VeryHard[] = _("VERY HARD"); +const u8 gText_Stats_CatchRate_Difficult[] = _("DIFFICULT"); +const u8 gText_Stats_CatchRate_Medium[] = _("MEDIUM"); +const u8 gText_Stats_CatchRate_Relaxed[] = _("RELAXED"); +const u8 gText_Stats_CatchRate_Easy[] = _("EASY"); const u8 gText_Stats_ExpYield[] = _("EXP YIELD: "); -const u8 gText_Stats_EggCycles[] = _("HATCH SPEED:"); +const u8 gText_Stats_EggCycles[] = _("HATCH STEPS:"); const u8 gText_Stats_EggCycles_VeryFast[] = _("{EMOJI_BOLT}{EMOJI_DIZZYEGG}"); const u8 gText_Stats_EggCycles_Fast[] = _("{EMOJI_DIZZYEGG}"); const u8 gText_Stats_EggCycles_Normal[] = _("{EMOJI_DIZZYEGG}{EMOJI_DIZZYEGG}"); From 982647d36ce5676a590163ecb347569a203cd93b Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 14 Jun 2021 12:28:56 +0200 Subject: [PATCH 25/88] Evolution screen now shows caught ball, new options for hiding unseen evolution names --- .../pokedex/HGSS_palette_search_results.pal | 38 ++++++++++++- .../HGSS_palette_search_results_dark.pal | 38 ++++++++++++- src/pokedex.c | 55 ++++++++++++++++++- 3 files changed, 122 insertions(+), 9 deletions(-) diff --git a/graphics/pokedex/HGSS_palette_search_results.pal b/graphics/pokedex/HGSS_palette_search_results.pal index 892bb6c10488..5889ede7ac0f 100644 --- a/graphics/pokedex/HGSS_palette_search_results.pal +++ b/graphics/pokedex/HGSS_palette_search_results.pal @@ -1,6 +1,6 @@ JASC-PAL 0100 -16 +48 193 33 177 249 249 249 225 225 225 @@ -11,9 +11,41 @@ JASC-PAL 233 49 49 193 33 41 145 17 33 -156 226 199 +249 153 161 +193 33 41 141 251 184 52 66 162 194 181 66 -159 216 234 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +49 213 74 +24 131 32 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +180 205 246 +49 139 255 +189 156 90 0 0 0 diff --git a/graphics/pokedex/HGSS_palette_search_results_dark.pal b/graphics/pokedex/HGSS_palette_search_results_dark.pal index 892bb6c10488..5889ede7ac0f 100644 --- a/graphics/pokedex/HGSS_palette_search_results_dark.pal +++ b/graphics/pokedex/HGSS_palette_search_results_dark.pal @@ -1,6 +1,6 @@ JASC-PAL 0100 -16 +48 193 33 177 249 249 249 225 225 225 @@ -11,9 +11,41 @@ JASC-PAL 233 49 49 193 33 41 145 17 33 -156 226 199 +249 153 161 +193 33 41 141 251 184 52 66 162 194 181 66 -159 216 234 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +49 213 74 +24 131 32 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +180 205 246 +49 139 255 +189 156 90 0 0 0 diff --git a/src/pokedex.c b/src/pokedex.c index 8438010566d8..79014ba50b61 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -346,6 +346,7 @@ static void CreateTypeIconSprites(void); #define SCROLLING_MON_X 146 #define HGSS_DECAPPED 0 //0 false, 1 true #define HGSS_DARK_MODE 0 //0 false, 1 true +#define HGSS_HIDE_UNSEEN_EVOLUTION_NAMES 0 //0 false, 1 true static void LoadTilesetTilemapHGSS(u8 page); static void Task_HandleStatsScreenInput(u8 taskId); static void PrintMonStats(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry); @@ -7439,7 +7440,12 @@ static void Task_HandleEvolutionScreenInput(u8 taskId) } static void handleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u8 base_x, u8 base_y, u8 base_y_offset, u8 base_i) { - StringCopy(gStringVar3, gSpeciesNames[targetSpecies]); //evolution mon name + bool8 seen = GetSetPokedexFlag(SpeciesToNationalPokedexNum(targetSpecies), FLAG_GET_SEEN); + + if (seen || !HGSS_HIDE_UNSEEN_EVOLUTION_NAMES) + StringCopy(gStringVar3, gSpeciesNames[targetSpecies]); //evolution mon name + else + StringCopy(gStringVar3, gText_ThreeQuestionMarks); //show questionmarks instead of name StringExpandPlaceholders(gStringVar3, gText_EVO_Name); //evolution mon name PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); //evolution mon name @@ -7455,6 +7461,17 @@ static void handleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u8 base_x, u8 gSprites[gTasks[taskId].data[4+base_i]].oam.priority = 0; } } +static void CreateCaughtBallEvolutionScreen(u16 targetSpecies, u8 x, u8 y, u16 unused) +{ + bool8 owned = GetSetPokedexFlag(SpeciesToNationalPokedexNum(targetSpecies), FLAG_GET_CAUGHT); + if (owned) + BlitBitmapToWindow(0, sCaughtBall_Gfx, x, y, 8, 16); + else + { + FillWindowPixelRect(0, PIXEL_FILL(0), x, y, 8, 16); + PrintInfoScreenTextSmall(gText_OneDash, x+1, y); + } +} #define EVO_SCREEN_LVL_DIGITS 2 static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) { @@ -7468,7 +7485,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) u16 item; bool8 left = TRUE; - u8 base_x = 5; + u8 base_x = 13; u8 base_x_offset = 54; u8 base_y = 52; u8 base_y_offset = 9; @@ -7495,7 +7512,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) if (times == 0) { StringExpandPlaceholders(gStringVar4, gText_EVO_NONE); - PrintInfoScreenTextSmall(gStringVar4, base_x, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x-7, base_y + base_y_offset*base_i); } //If there are evolutions find out which and print them 1 by 1 @@ -7507,6 +7524,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) { case EVO_FRIENDSHIP: targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); ConvertIntToDecimalStringN(gStringVar2, 220, STR_CONV_MODE_LEADING_ZEROS, 3); //friendship value handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP ); @@ -7514,18 +7532,21 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) break; case EVO_FRIENDSHIP_DAY: targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_DAY ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_FRIENDSHIP_NIGHT: targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_NIGHT ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL: targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL ); @@ -7533,6 +7554,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) break; case EVO_TRADE: targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7541,6 +7563,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_ITEM ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7549,6 +7572,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) item = gEvolutionTable[species][i].param; CopyItemName(item, gStringVar2); targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7556,6 +7580,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_ATK_GT_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_GT_DEF ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7563,6 +7588,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_ATK_EQ_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_EQ_DEF ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7570,6 +7596,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_ATK_LT_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon namee StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_LT_DEF ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7577,6 +7604,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_SILCOON: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SILCOON ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7584,6 +7612,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_CASCOON: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_CASCOON ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7591,6 +7620,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_NINJASK: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NINJASK ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7598,6 +7628,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_SHEDINJA: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SHEDINJA ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7605,6 +7636,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_BEAUTY: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, 3); //beauty targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_BEAUTY ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7613,6 +7645,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_FEMALE: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_FEMALE ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7620,6 +7653,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_MALE: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_MALE ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7627,6 +7661,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_NIGHT: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NIGHT ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7634,6 +7669,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_DAY: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DAY ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7641,6 +7677,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_DUSK: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DUSK ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7649,6 +7686,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_DAY ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7657,6 +7695,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_NIGHT ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7664,6 +7703,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_MOVE: StringCopy(gStringVar2, gMoveNames[gEvolutionTable[species][i].param]); targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7671,6 +7711,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_MOVE_TYPE: StringCopy(gStringVar2, gTypeNames[gEvolutionTable[species][i].param]); targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE_TYPE ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7678,6 +7719,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_MAPSEC: StringCopy(gStringVar2, gRegionMapEntries[gEvolutionTable[species][i].param].name); targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MAPSEC ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7686,6 +7728,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_MALE ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7694,6 +7737,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_FEMALE ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7701,6 +7745,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_LEVEL_RAIN: //if (j == WEATHER_RAIN || j == WEATHER_RAIN_THUNDERSTORM || j == WEATHER_DOWNPOUR) targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_RAIN ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7708,12 +7753,14 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_SPECIFIC_MON_IN_PARTY: StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MON_IN_PARTY ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_DARK_TYPE_MON_IN_PARTY: targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7721,6 +7768,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) case EVO_TRADE_SPECIFIC_MON: StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_SPECIFIC_MON ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); @@ -7729,6 +7777,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) mapHeader = Overworld_GetMapHeaderByGroupAndId(gEvolutionTable[species][i].param >> 8, gEvolutionTable[species][i].param & 0xFF); GetMapName(gStringVar2, mapHeader->regionMapSectionId, 0); targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MAP ); PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); From d0012305c0fd7b3259ba4653f8c4ab7227aa15a7 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 14 Jun 2021 14:55:55 +0200 Subject: [PATCH 26/88] stats page new navigation button prompts --- .../pokedex/HGSS_tilemap_stats_screen.bin | Bin 1344 -> 1344 bytes graphics/pokedex/HGSS_tileset_menu1.png | Bin 1725 -> 1566 bytes include/strings.h | 1 + src/pokedex.c | 25 ++++++++++++++++++ src/strings.c | 1 + 5 files changed, 27 insertions(+) diff --git a/graphics/pokedex/HGSS_tilemap_stats_screen.bin b/graphics/pokedex/HGSS_tilemap_stats_screen.bin index d6d4fb9463d01eeee51cffb058fc58664a53de79..9b9e04a5e3a40f714eca218f1276fd0e3892b837 100644 GIT binary patch delta 67 zcmX@Wb%1L_6U$@;77^xC45ueAWRaY_frUf<3r)nf#D*{1UdSRjc>@cF{8a`JaAR<1 mxW;gu;ReG^hFc7`8SXIL1&X*a+?#x#MSAi(7PiU1Slj^kAsyTR diff --git a/graphics/pokedex/HGSS_tileset_menu1.png b/graphics/pokedex/HGSS_tileset_menu1.png index 5e305a01716e893b2f90d4973c05abd18a7dbc55..2d9de88e6d2d53980459252b32fa5ff983bc863e 100644 GIT binary patch delta 1417 zcmV;41$O$q4W0~;7aeE>0{{R3%LnBb00007bV*G`2jvD13@s@6N2zm>G?RZqNklqsN$3!E_l6(GaAM=xt zq(_r6n8RnEKVv5eNZbDYuY6FF0BGCi0GGNb%W70Ipu(lqGVck1Hb;OlUD~C_m=XR^ zz0Gs@D{A@`jqk~&@qkP10ET}6oiQl_@J-N@rkVA401g8H7#{)Sh!Y_|Q5P^&U9>GU zjr72^G#*eBphSRy8KhGHPS^q3_L4XF0Gi1R763HUqGpSo4-f#o2zV&?ALxJf+ueY1 z3;>KAOuubHR2zz1bQ^`e0UL(^fZR#YBC@lk$l@EdnB01kRTw)=4+npMv65P{gguRZ zytp8@D(ngXQ}6&tWsHUd87~OHmn!U}03B!oW+($bP!fD56Al2%63JXrC_ty62~vgv zz!i-1!4$x$Uy2Vf=Ze+=#t6Xao0=$nC3$e-k~}S?og@#>5Qi!1L@E#fL+K01r>}NI zNMAOP=I8+(0$d3%0C<0B2aw2t-E9&UkpZuUIFnp9QT}trVFPz^dD)oC7fI6jUGnjy zB;%9vJV2!{x`xWBbg78HI z+)1D%58NuG0B0Y@4Pj>ifMxjtzu|#ASOMGei3v<9Y{&)^hmi@DU>K?#30D8RN-3!=-m>db1Oq6c{j3m=n{D=BefD73c zK!*B>QZx|JETkN^bhb0kTH{ zTGs(aZRH~XS5<%g1Ay1>uirhOdK8e0yk`;M+;24jAMXFboAk7#-~nTq=jCYOcfxD; zgaE9Z+6drt0HxOeyA9y8P;&2nz>6;$kZ;=ns#s$=m>4iP-{&#lyawoFfYOTriX2Hb z#(>=_AlRnG+3f+!KMBTl@%tEmEa`(^$R4(HXA=09drzhIogaI1*@@sqo9u`1eyW=3+Xrvjg8V3tXZ`nx* z5GTnL(Mcl!ZtN3}=tSN<=e$!2HZou>y~qTN}U0z!YYP;3VQRMQ6opN=^*;s1h5e=a2gV{_H{W^Dch?{1O}2QWXlOe-PjcCOvEd_!ps5 zKlI`NowSk9dbSuBjxl9zI1xi z(>s5H|#%Qz)m`r02E>eh`ikgz*#zO z0wQNs0U$4U69kCGcMXtD0Zva$qGgT&RL1=jU}atCX8;!!Xc@4R@|^-?qy@l>Tju@; X+ed?tDpf}M00000NkvXXu0mjf@a^lJOJj(4w5D8 zY4qdX2f0;YR{&5U03eky8WLo@AOK&gu+sqOKoc-S8SsLV;WJS<0w_x)b7?>YV=7XR zG86#5V7w2;08af{e1JJuwI1LS0H?1tN%~6ipyHA|Ev20#4{M0iREJC|5CB6R3Mizn zc0^2HHjs1-fDQq^geQLhJhcZ%KKz$GCwEcfvH2LXTRmD2}Jp+fb$BzfHM zC)0~9@b4@@^>ylnQ-E_nZv)hIe=DH51h9>O9`6^I0v0hQYXWAY!CwK4B-3~NgX6~l zAF^`*IgZcNKm!r&?1sYH@$jvvyE0mRQr_0T$cY*dUzBz+{1S)ZZ00V^el9=;dG(D4 zfBzN-2w0QW!ce*{2tEua*6%oD)2Ki33&xcnP$>}F~}0Jyp=YgfSU z2Cw}S0`Op4B!G|uD7^+0=K(?%O72|_xC=!C^4EC)RjjG3ObQsh@5>ahodfhKK#fZQ zikwK}Qov#s5N*@q?G6CtpA6$V`F%`3mh{1|WDncnw8B09+d;ER3Y8lA|y=aP3y(MAT$r5Bliu{;4tn8+1h0p@MQ^Fw0>q(Oss zX|ZvexmkYz8iIh>OcdKn0L}Qpz^5YxK(o}h*|0u+#zzE>yipDJHEuv0Hiq3g0$5p< z)5v#p^l9Yy!Gd>_0E{Ku3n5d@RLmy{@mXI?118G0*h=eni~h?r2{>Ii)-v;^2)kY0?)p8_V*=no-}Ov| z?~A(ek~Ral8v}Cb%f|p^>1QUarZ*p}8Njyw$E4CHj#b?$fCkw$tg~Z)l`zvjCE@uW5*cPex6(HR`_25!`nTlxy(B97#03WER z%mczqxO>+ClK^-zp;|}*(N-v>2sjDhY7Stdr#b~l*NhrZ7heP36kr$wn*0nv{u!VM z0KDZ4w8c1#l2F!+!>g{Tm=quhqXOKW2Uvfko>l;q`)FUhrdkMq#M}K9fW%qNB*5bT zVl3;}Iof2+0`e)qfV&aZ1JE%5XiiO-dP!g3 c;h+BjmR=(qWUQPm00000NkvXXu0jG}f-Ec5l>h($ diff --git a/include/strings.h b/include/strings.h index e3410e45fde4..049a2efd5c93 100644 --- a/include/strings.h +++ b/include/strings.h @@ -533,6 +533,7 @@ extern const u8 gText_SearchCompleted[]; extern const u8 gText_NoMatchingPkmnWereFound[]; extern const u8 gText_SelectorArrow[]; //PokedexPlus HGSS_Ui +extern const u8 gText_Stats_Buttons[]; extern const u8 gText_Stats_HP[]; extern const u8 gText_Stats_Attack[]; extern const u8 gText_Stats_Defense[]; diff --git a/src/pokedex.c b/src/pokedex.c index 79014ba50b61..91cb01dc0cfa 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1128,6 +1128,7 @@ static const struct BgTemplate sInfoScreen_BgTemplate[] = #define WIN_FOOTPRINT 1 #define WIN_CRY_WAVE 2 #define WIN_VU_METER 3 +#define WIN_NAVIGATION_BUTTONS 4 static const struct WindowTemplate sInfoScreen_WindowTemplates[] = { @@ -1171,6 +1172,16 @@ static const struct WindowTemplate sInfoScreen_WindowTemplates[] = .paletteNum = 9, .baseBlock = 869, }, + [WIN_NAVIGATION_BUTTONS] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 18, + .width = 12, + .height = 2, + .paletteNum = 15, + .baseBlock = 641, + }, DUMMY_WIN_TEMPLATE }; @@ -6245,6 +6256,16 @@ static void LoadTilesetTilemapHGSS(u8 page) } //PokedexPlus HGSS_Ui Stats Page +static const u8 sStatsPageNavigationTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY}; +static void StatsPage_PrintAToggleUpdownMoves(void) +{ + u8 x = 9; + u8 y = 0; + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons); + // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) + PutWindowTilemap(WIN_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); +} #define tMonSpriteId data[4] static void Task_LoadStatsScreen(u8 taskId) { @@ -6275,6 +6296,9 @@ static void Task_LoadStatsScreen(u8 taskId) FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); CopyWindowToVram(WIN_INFO, 3); + FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); + PutWindowTilemap(WIN_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(3); @@ -6329,6 +6353,7 @@ static void Task_LoadStatsScreen(u8 taskId) PrintMonStatsToggle(taskId); if (!sPokedexListItem->owned) LoadPalette(gPlttBufferUnfaded + 1, 0x31, 0x1E); + StatsPage_PrintAToggleUpdownMoves(); //gText_Stats_Buttons gMain.state++; break; case 7: diff --git a/src/strings.c b/src/strings.c index 2644fc9e4d79..eeb067c306e6 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1820,6 +1820,7 @@ const u8 gText_Berries[] = _("BERRIES"); //HGSS_Ui PokedexPlus +const u8 gText_Stats_Buttons[] = _("{A_BUTTON}TOGGLE {DPAD_UPDOWN}MOVES"); const u8 gText_Stats_HP[] = _("HP"); const u8 gText_Stats_Attack[] = _("ATK"); const u8 gText_Stats_Defense[] = _("DEF"); From 2d4a91f0b4765330e7ffe3b42e7ca1b330daf6d3 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 14 Jun 2021 15:00:26 +0200 Subject: [PATCH 27/88] added Decapped version of the button prompts --- include/strings.h | 1 + src/pokedex.c | 5 ++++- src/strings.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/strings.h b/include/strings.h index 049a2efd5c93..26dfd514b889 100644 --- a/include/strings.h +++ b/include/strings.h @@ -534,6 +534,7 @@ extern const u8 gText_NoMatchingPkmnWereFound[]; extern const u8 gText_SelectorArrow[]; //PokedexPlus HGSS_Ui extern const u8 gText_Stats_Buttons[]; +extern const u8 gText_Stats_Buttons_Decapped[]; extern const u8 gText_Stats_HP[]; extern const u8 gText_Stats_Attack[]; extern const u8 gText_Stats_Defense[]; diff --git a/src/pokedex.c b/src/pokedex.c index 91cb01dc0cfa..1e8b4c121861 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -6261,7 +6261,10 @@ static void StatsPage_PrintAToggleUpdownMoves(void) { u8 x = 9; u8 y = 0; - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons); + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons_Decapped); // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) PutWindowTilemap(WIN_NAVIGATION_BUTTONS); CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); diff --git a/src/strings.c b/src/strings.c index eeb067c306e6..e2b7e07852a9 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1821,6 +1821,7 @@ const u8 gText_Berries[] = _("BERRIES"); //HGSS_Ui PokedexPlus const u8 gText_Stats_Buttons[] = _("{A_BUTTON}TOGGLE {DPAD_UPDOWN}MOVES"); +const u8 gText_Stats_Buttons_Decapped[] = _("{A_BUTTON}Toggle {DPAD_UPDOWN}Moves"); const u8 gText_Stats_HP[] = _("HP"); const u8 gText_Stats_Attack[] = _("ATK"); const u8 gText_Stats_Defense[] = _("DEF"); From 6b8f40b3b1cf191d8218441dd5c7aa7669bb1822 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 14 Jun 2021 17:29:42 +0200 Subject: [PATCH 28/88] new layout for evo screen and new buttons for the PE version --- graphics/pokedex/HGSS_tilemap_evo_screen.bin | Bin 1344 -> 1344 bytes .../pokedex/HGSS_tilemap_evo_screen_PE.bin | Bin 1344 -> 1344 bytes .../pokedex/HGSS_tilemap_forms_screen.bin | Bin 1344 -> 1344 bytes graphics/pokedex/HGSS_tileset_menu2.png | Bin 915 -> 855 bytes include/strings.h | 5 +++ src/pokedex.c | 35 +++++++++++++++++- src/strings.c | 5 +++ 7 files changed, 44 insertions(+), 1 deletion(-) diff --git a/graphics/pokedex/HGSS_tilemap_evo_screen.bin b/graphics/pokedex/HGSS_tilemap_evo_screen.bin index 18bcc40a13c63d16e6f355d01bd63e92104a40f7..e7407faf7628b66172d24557d59dc387a2914607 100644 GIT binary patch delta 123 scmX@Wb%1L_1Iy$CEF$SX4BkLUi1cLu0Y3(RASR2P%*bj#S%8%d0Hf;_Gynhq delta 63 mcmX@Wb%1L_1IuIwCWpxlEF$XO41}Q! diff --git a/graphics/pokedex/HGSS_tilemap_evo_screen_PE.bin b/graphics/pokedex/HGSS_tilemap_evo_screen_PE.bin index 8a13a6ffd8700298cfeb6133e6f2d557188d578c..77ac6ad54f3e98fecd0ecc4f6f28cb3c1ffaa64c 100644 GIT binary patch delta 143 zcmX@Wb%1L_15154Lj($pWQbz$Veke*LZmMP2t+f)FvJ2OjErN5XYgn6146Z=ojPw delta 99 zcmX@Wb%1L_1IuIwCLR9(hCqfOhG2#ehERquhHwTD@MQ2}@CHI;62!*_BN!qXq8OqX UVi;l>;uzv5GqT!G7GPxq0I@|8ga7~l diff --git a/graphics/pokedex/HGSS_tilemap_forms_screen.bin b/graphics/pokedex/HGSS_tilemap_forms_screen.bin index 0549c17f0b132ef5b4a3fc801b62507f8751e6b9..c72154071ceaf220d9f609ace0e6acdf035272df 100644 GIT binary patch delta 103 zcmX@Wb%1L_10!buLm(IiO+LtIxOo@jC#H!H_#7P>Kp>bQgdr3Nkx3Ar5DZ}mo6N{+ JKUsj44FClv6~q7l delta 114 zcmX@Wb%1L_10$y|gC7|BPd>;uzv5GqT!G7GPxq0Eyuh_W%F@ diff --git a/graphics/pokedex/HGSS_tileset_menu2.png b/graphics/pokedex/HGSS_tileset_menu2.png index e39cb4de556c5d7c87a726b0187d05cacfc8ec14..65018e3a0e6bb2d9de0e21fc11f2f0e64ec66f32 100644 GIT binary patch delta 681 zcmV;a0#^N#2iFFWD+vY;4;uhSs4k_EG?RaONkl$0k}T_0O%kLpaTKM0MN}6!QbK%U||5wGPx@ObYKMl3}L1Tbj1lO02#)NwFU&h zC;=Ys+nH*gYBv2Cpj~s+?={(#J7<(oN<#rrHweItsDOUOKTl#DCP^7m%6S_Vz{(xK z(To735rZ}vvbI+M(HvEKX;#{QX_kKofFRA&wzCRI9SLw&b2NurTL7y>luHZnGjTU# z5!cML1|=X$zn2=2<~pbY=&VM%sv}6k0hXKyhenh#%78a?fdO-$E>DtfUW84$Tr;dT z0jTIM)@$zd`c?pOYXwNxFlTPNQ-KWf0x@q3P$3L3(~umFDED!_jwHNqNLhc;wGryz z{G_?{NqZh3(#6t%yhTNZG#2UlXb0n$IB;@#VvkZE?d9<=<-TtQFvS;`0`|AhfBMZD z`nu!*ZT%oZpls|5L>F&>=9mM%YWpofn*jGaeFyNJR{dXq22LDkKE7I#>^v?^}Pg*ESma7;1mp*lobC0&t8W12{gA!kZ?3DEtk;zF-dm zmJ-mUnU&;|J?N7tu*AV4qF_po%-6*Qx{*1+4?}hju4Oi!a>! zy8v_KOa8#ffKLOs>;dM;?-p<@=cAroQR!U97Eqb50dg51D}a2S5A_uf$kZfa6T*}I P00000NkvXXu0mjf|7$Vn delta 741 zcmVU$n=qo~Pa^qSHULXQh?W7kJ^=t|BMhJo0mcB(O%lQ1;xZsGfUYvRTLWmr3IOQai7ud9?O+EW!<4bs zfB+aJz(4oxLbcB|8@~+Dt{Lig%rUYiU>+jjuT3{^Y0Nb7$G7ZLzkX`Z&7RY2;;9|&V>-YTuzmXM zFT0qdua6R-t?xw$ludnr=;Q_9P9@-|?Y96;2HfxT9l&Q=^?v~xc;SG1+nfAS#>zRa z0Hh%LZOfVpTC7gp+yXYDdEI{k3O#KB);4HAnq=&6?!fK?zO4YKDy>yYpGX1s`E)y_ z<05LM>a^|v!Ww|OuhTl!fI~x|J3ss9tF`ms&i?(6_t(V*_eKDEOK4{t4wCxtR}56t z83BO-vmfw{j7Ra10gd4|@?b56iV1^tX@Xv-*Fd=dTLR41;tKWNNselectedScreen == EVO_SCREEN) + { + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_PE); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped_PE); + } + else if (sPokedexView->selectedScreen == FORMS_SCREEN) + { + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_PE); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Decapped_PE); + } + // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) + PutWindowTilemap(WIN_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); + #endif +} static void Task_LoadEvolutionScreen(u8 taskId) { switch (gMain.state) @@ -7347,6 +7372,9 @@ static void Task_LoadEvolutionScreen(u8 taskId) FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); CopyWindowToVram(WIN_INFO, 3); + FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); + PutWindowTilemap(WIN_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(3); @@ -7370,6 +7398,7 @@ static void Task_LoadEvolutionScreen(u8 taskId) gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite #endif gSprites[gTasks[taskId].data[4]].oam.priority = 0; + EvoFormsPage_PrintAToggleUpdownEvos(); //HGSS_Ui Navigation buttons } gMain.state++; break; @@ -7515,7 +7544,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) bool8 left = TRUE; u8 base_x = 13; u8 base_x_offset = 54; - u8 base_y = 52; + u8 base_y = 51; u8 base_y_offset = 9; u8 base_i = 0; u8 times = 0; @@ -8095,6 +8124,9 @@ static void Task_LoadFormsScreen(u8 taskId) FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); CopyWindowToVram(WIN_INFO, 3); + FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); + PutWindowTilemap(WIN_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(3); @@ -8114,6 +8146,7 @@ static void Task_LoadFormsScreen(u8 taskId) gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite gSprites[gTasks[taskId].data[4]].oam.priority = 0; } + EvoFormsPage_PrintAToggleUpdownEvos(); //HGSS_Ui Navigation buttons gMain.state++; break; case 4: diff --git a/src/strings.c b/src/strings.c index e2b7e07852a9..5706ff4d2904 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1888,6 +1888,8 @@ const u8 gText_Stats_eggGroup_UNDISCOVERED[]= _("---"); const u8 gText_Dex_SEEN[] = _("SEEN"); const u8 gText_Dex_OWN[] = _("OWN"); +const u8 gText_EVO_Buttons_PE[] = _("{A_BUTTON}FORMS"); +const u8 gText_EVO_Buttons_Decapped_PE[] = _("{A_BUTTON}Forms"); const u8 gText_EVO_Name[] = _("{STR_VAR_3}:"); const u8 gText_EVO_FRIENDSHIP[] = _("LvlUp, high friendship"); const u8 gText_EVO_FRIENDSHIP_DAY[] = _("LvlUp, high friendship, day"); @@ -1922,4 +1924,7 @@ const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[] = _("LvlUp with dark type in const u8 gText_EVO_TRADE_SPECIFIC_MON[] = _("Traded for {STR_VAR_2}"); const u8 gText_EVO_SPECIFIC_MAP[] = _("LvlUp on {STR_VAR_2}"); const u8 gText_EVO_NONE[] = _("{STR_VAR_1} has no evolution."); + +const u8 gText_FORMS_Buttons_PE[] = _("{A_BUTTON}EVOLUTIONS"); +const u8 gText_FORMS_Buttons_Decapped_PE[] = _("{A_BUTTON}Evolutions"); const u8 gText_FORMS_NONE[] = _("{STR_VAR_1} has no alternate forms."); From 3c22d5513045b50e54fe8aadbdd3b6608bafad36 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 14 Jun 2021 19:18:06 +0200 Subject: [PATCH 29/88] form screen new navigation buttons and special case for Unown --- .../pokedex/HGSS_tilemap_evo_screen_PE.bin | Bin 1344 -> 1344 bytes .../pokedex/HGSS_tilemap_forms_screen.bin | Bin 1344 -> 1344 bytes graphics/pokedex/HGSS_tileset_menu2.png | Bin 855 -> 847 bytes src/pokedex.c | 14 +++++++++----- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/graphics/pokedex/HGSS_tilemap_evo_screen_PE.bin b/graphics/pokedex/HGSS_tilemap_evo_screen_PE.bin index 77ac6ad54f3e98fecd0ecc4f6f28cb3c1ffaa64c..5cabb2e65b814c1f6157fea2adae0e6f45cef910 100644 GIT binary patch delta 63 zcmX@Wb%1L_1B-A7LnsOiV+fx-pGA7|Iu;?}NQNkeXdr}(Ug7rr-L@`7IA&iV+h-L6+@B=~u QBol+*WJXr|$pWlw0AcVLNdN!< delta 79 qcmX@Wb%1L_70YBRCO7L~h7g8OAVelXd_pjUA#5@utNmmFRyF{!ybp>1 diff --git a/graphics/pokedex/HGSS_tileset_menu2.png b/graphics/pokedex/HGSS_tileset_menu2.png index 65018e3a0e6bb2d9de0e21fc11f2f0e64ec66f32..7c271984cbc2a7dba805a4509f726ded6387e6bb 100644 GIT binary patch delta 671 zcmV;Q0$}~u2G0hNEe8<`CduD7bCEQYe{)GhK~#90wUkY6<1h?`bp>HEYo8(T%nfpZ zqR6^C0X~7@m6wwf*u!Ib5oGBhDN+_?JIxPFCI-+dlbaGi2UY+;7e-pZp*XW|rNlK{|PXn70L}5jq%YN(0WQ_I|$gWV{Egf2`=O8T#Pz zX1Mvycpo6v#nynlMa70R7wh^M2QyA_;^gu~jgpS`^7xi4)cN-sWtfK1n#c3CFc$ zHs>W5J4wa*ZEdV^e` zD7x-WfKOm}<>llA_VAcq1X+4Wij+lJX_^MZHep1`Pa^qc=gKJXe#JjeVjLz(8B)r58x_FH9l+6y z0HhIvHW{+ER{+r*ReNbx+J9-5e+Yme&C|BC3P>FZa8`3Phg(|!t3;Gb3-B{>H)9dk z%(Mn2AWFZN8j$8Xr~~M%M!KpaNWuY@oCt?TlrqYIH*|pkbDu6xl5SpvO}bn&tTq9t z=q}c4?)Cas0C8&tNY^lDZo5-~4DtdoZwpW%3^3D>9F8dWalMWtyl+TZf6=uO>frpO zx%EkV9w5@i(tx~0MTRsM>H25~p&OLNiATXP642bJD=C81QZ3W1M-JW6%WYNBw`c7ll=ey N002ovPDHLkV1i=kG7ta& diff --git a/src/pokedex.c b/src/pokedex.c index 4479cb7cdf8e..8447a7c85c79 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7329,9 +7329,9 @@ static void EvoFormsPage_PrintAToggleUpdownEvos(void) if (sPokedexView->selectedScreen == EVO_SCREEN) { if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_PE); + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_PE); else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped_PE); + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped_PE); } else if (sPokedexView->selectedScreen == FORMS_SCREEN) { @@ -8231,6 +8231,10 @@ static void PrintForms(u8 taskId, u16 species) u8 base_y_offset = 9; u8 base_i = 0; u8 times = 0; + u8 y_offset_icons = 0; //For unown only + + if (species == SPECIES_UNOWN) + y_offset_icons = 8; StringCopy(gStringVar1, gSpeciesNames[species]); @@ -8248,11 +8252,11 @@ static void PrintForms(u8 taskId, u16 species) if (times < 7) gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 52 + 34*(times-1), 31, 4, 0); //Create pokemon sprite else if (times < 14) - gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-7), 70, 4, 0); //Create pokemon sprite + gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-7), 70 - y_offset_icons, 4, 0); //Create pokemon sprite else if (times < 21) - gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-14), 104, 4, 0); //Create pokemon sprite + gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-14), 104 - y_offset_icons, 4, 0); //Create pokemon sprite else - gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-21), 138, 4, 0); //Create pokemon sprite + gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-21), 138 - y_offset_icons, 4, 0); //Create pokemon sprite gSprites[gTasks[taskId].data[4+times]].oam.priority = 0; } } From a83ece83cd15b313d6224f1e1a2341cc9992f66e Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 19 Jun 2021 11:45:15 +0200 Subject: [PATCH 30/88] fixed navigation buttons on evo page not showing when switching from cry screen, thanks to @AsparagusEduardo for pointing it out --- src/pokedex.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 8447a7c85c79..6ed94d9382a3 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7325,25 +7325,24 @@ static void EvoFormsPage_PrintAToggleUpdownEvos(void) { u8 x = 9; u8 y = 0; - #ifdef POKEMON_EXPANSION - if (sPokedexView->selectedScreen == EVO_SCREEN) - { - if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_PE); - else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped_PE); - } - else if (sPokedexView->selectedScreen == FORMS_SCREEN) - { - if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_PE); - else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Decapped_PE); - } - // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) - PutWindowTilemap(WIN_NAVIGATION_BUTTONS); - CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); - #endif + + if (sPokedexView->selectedScreen == EVO_SCREEN) + { + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_PE); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped_PE); + } + else if (sPokedexView->selectedScreen == FORMS_SCREEN) + { + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_PE); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Decapped_PE); + } + // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) + PutWindowTilemap(WIN_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); } static void Task_LoadEvolutionScreen(u8 taskId) { @@ -7388,6 +7387,7 @@ static void Task_LoadEvolutionScreen(u8 taskId) case 3: if (gTasks[taskId].data[1] == 0) { + sPokedexView->selectedScreen = EVO_SCREEN; //Icon FreeMonIconPalettes(); //Free space for new pallete LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon @@ -7396,9 +7396,9 @@ static void Task_LoadEvolutionScreen(u8 taskId) #endif #ifdef POKEMON_EXPANSION gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite + EvoFormsPage_PrintAToggleUpdownEvos(); //HGSS_Ui Navigation buttons #endif gSprites[gTasks[taskId].data[4]].oam.priority = 0; - EvoFormsPage_PrintAToggleUpdownEvos(); //HGSS_Ui Navigation buttons } gMain.state++; break; From c9d902d722d47ceb55d79a4f5fa868fc71bc9971 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Fri, 2 Jul 2021 12:26:15 +0200 Subject: [PATCH 31/88] Renamed functions for better readability --- src/pokedex.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 6ed94d9382a3..0ff38d2fa71d 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -349,14 +349,14 @@ static void CreateTypeIconSprites(void); #define HGSS_HIDE_UNSEEN_EVOLUTION_NAMES 0 //0 false, 1 true static void LoadTilesetTilemapHGSS(u8 page); static void Task_HandleStatsScreenInput(u8 taskId); -static void PrintMonStats(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry); static void Task_LoadStatsScreen(u8 taskId); static void Task_SwitchScreensFromStatsScreen(u8 taskId); static void Task_ExitStatsScreen(u8 taskId); static bool8 CalculateMoves(void); -static void DestroyMoveIcon(u8 taskId); -static void PrintMoveNameAndInfo(u8 taskId, bool8 toogle); -static void PrintMonStatsToggle(u8 taskId); +static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry); +static void PrintStatsScreen_DestroyMoveItemIcon(u8 taskId); +static void PrintStatsScreen_MoveNameAndInfo(u8 taskId); +static void PrintStatsScreen_Left(u8 taskId); static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top); static void PrintInfoScreenTextSmall(const u8* str, u8 left, u8 top); static void PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top); @@ -6352,8 +6352,9 @@ static void Task_LoadStatsScreen(u8 taskId) case 6: gTasks[taskId].data[5] = 0; FillWindowPixelRect(0, PIXEL_FILL(0), 0, 48, 240, 130); - PrintMonStats(taskId, sPokedexListItem->dexNum, sPokedexView->dexMode == DEX_MODE_HOENN ? FALSE : TRUE, sPokedexListItem->owned, 0); - PrintMonStatsToggle(taskId); + PrintStatsScreen_NameGender(taskId, sPokedexListItem->dexNum, sPokedexView->dexMode == DEX_MODE_HOENN ? FALSE : TRUE, sPokedexListItem->owned, 0); + PrintStatsScreen_Left(taskId); + PrintStatsScreen_MoveNameAndInfo(taskId); if (!sPokedexListItem->owned) LoadPalette(gPlttBufferUnfaded + 1, 0x31, 0x1E); StatsPage_PrintAToggleUpdownMoves(); //gText_Stats_Buttons @@ -6428,9 +6429,9 @@ static void Task_HandleStatsScreenInput(u8 taskId) else gTasks[taskId].data[5] = 0; FillWindowPixelRect(0, PIXEL_FILL(0), 0, 48, 240, 130); - PrintMonStatsToggle(taskId); - DestroyMoveIcon(taskId); - PrintMoveNameAndInfo(taskId, TRUE); + PrintStatsScreen_Left(taskId); + PrintStatsScreen_DestroyMoveItemIcon(taskId); + PrintStatsScreen_MoveNameAndInfo(taskId); } if (JOY_NEW(B_BUTTON)) { @@ -6446,16 +6447,16 @@ static void Task_HandleStatsScreenInput(u8 taskId) sPokedexView->moveSelected -= 1; PlaySE(SE_SELECT); FillWindowPixelRect(0, PIXEL_FILL(0), 96, 16, 144, 80); - DestroyMoveIcon(taskId); - PrintMoveNameAndInfo(taskId, FALSE); + PrintStatsScreen_DestroyMoveItemIcon(taskId); + PrintStatsScreen_MoveNameAndInfo(taskId); } if (JOY_REPEAT(DPAD_DOWN) && sPokedexView->moveSelected < sPokedexView->moveMax -1 ) { sPokedexView->moveSelected = sPokedexView->moveSelected + 1; PlaySE(SE_SELECT); FillWindowPixelRect(0, PIXEL_FILL(0), 96, 16, 144, 80); - DestroyMoveIcon(taskId); - PrintMoveNameAndInfo(taskId, FALSE); + PrintStatsScreen_DestroyMoveItemIcon(taskId); + PrintStatsScreen_MoveNameAndInfo(taskId); } //Switch screens @@ -6483,7 +6484,7 @@ static void Task_HandleStatsScreenInput(u8 taskId) } } #define ITEM_TAG 0xFDF3 -static void DestroyMoveIcon(u8 taskId) +static void PrintStatsScreen_DestroyMoveItemIcon(u8 taskId) { FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon @@ -6532,7 +6533,7 @@ static bool8 CalculateMoves(void) return TRUE; } -static void PrintMoveNameAndInfo(u8 taskId, bool8 toggle) +static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) { u8 numEggMoves = sPokedexView->numEggMoves; u8 numLevelUpMoves = sPokedexView->numLevelUpMoves; @@ -6705,7 +6706,7 @@ static void PrintMoveNameAndInfo(u8 taskId, bool8 toggle) } } // u32 value is re-used, but passed as a bool that's TRUE if national dex is enabled -static void PrintMonStats(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry) //HGSS_Ui +static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry) //HGSS_Ui { u8 str[16]; u8 str2[32]; @@ -6765,11 +6766,6 @@ static void PrintMonStats(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry PrintInfoScreenTextSmall(gText_ThreeDashes, gender_x, gender_y); break; } - - - //Moves - PrintMoveNameAndInfo(taskId, FALSE); - } static u8 PrintMonStatsToggle_DifferentEVsColumn(u8 differentEVs) { @@ -6801,7 +6797,7 @@ static u8* PrintMonStatsToggle_EV_Arrows(u8 *dest, u8 EVs[], u8 position) } return dest; } -static void PrintMonStatsToggle(u8 taskId) +static void PrintStatsScreen_Left(u8 taskId) { u8 base_x = 8; u8 x_offset_column = 43; From 9a5c196cd073e109365b0451a9a8c2cd69c40219 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sun, 11 Jul 2021 11:49:57 +0200 Subject: [PATCH 32/88] recursive printing of evolutions aka now shows all follow up evolutions aswell, even complexer lines like Wurmple --- src/pokedex.c | 207 ++++++++++++++++++++++++++------------------------ 1 file changed, 106 insertions(+), 101 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 0ff38d2fa71d..863578c0a849 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -364,7 +364,7 @@ static void Task_LoadEvolutionScreen(u8 taskId); static void Task_HandleEvolutionScreenInput(u8 taskId); static void Task_SwitchScreensFromEvolutionScreen(u8 taskId); static void Task_ExitEvolutionScreen(u8 taskId); -static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species); +static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_i); //Stat bars on scrolling screens static void TryDestroyStatBars(void); static void TryDestroyStatBarsBg(void); @@ -7401,7 +7401,7 @@ static void Task_LoadEvolutionScreen(u8 taskId) case 4: //Print evo info and icons gTasks[taskId].data[3] = 0; - PrintEvolutionTargetSpeciesAndMethod(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); + PrintEvolutionTargetSpeciesAndMethod(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, 0); gMain.state++; break; case 5: @@ -7526,7 +7526,7 @@ static void CreateCaughtBallEvolutionScreen(u16 targetSpecies, u8 x, u8 y, u16 u } } #define EVO_SCREEN_LVL_DIGITS 2 -static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) +static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_i) { int i; #ifdef POKEMON_EXPANSION @@ -7544,6 +7544,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) u8 base_y_offset = 9; u8 base_i = 0; u8 times = 0; + u8 depth_x = 16; StringCopy(gStringVar1, gSpeciesNames[species]); @@ -7562,7 +7563,7 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) gTasks[taskId].data[3] = times; //If there are no evolutions print text - if (times == 0) + if (times == 0 && depth == 0) { StringExpandPlaceholders(gStringVar4, gText_EVO_NONE); PrintInfoScreenTextSmall(gStringVar4, base_x-7, base_y + base_y_offset*base_i); @@ -7571,273 +7572,277 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species) //If there are evolutions find out which and print them 1 by 1 for (i = 0; i < times; i++) { - base_i = i; + base_i = i + depth_i; left = !left; switch (gEvolutionTable[species][i].method) { case EVO_FRIENDSHIP: targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); ConvertIntToDecimalStringN(gStringVar2, 220, STR_CONV_MODE_LEADING_ZEROS, 3); //friendship value - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_FRIENDSHIP_DAY: targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_DAY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_FRIENDSHIP_NIGHT: targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_NIGHT ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL: targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_TRADE: targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_TRADE_ITEM: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_ITEM ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM: item = gEvolutionTable[species][i].param; CopyItemName(item, gStringVar2); targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_ATK_GT_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_GT_DEF ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_ATK_EQ_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_EQ_DEF ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_ATK_LT_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon namee + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon namee StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_LT_DEF ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_SILCOON: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SILCOON ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_CASCOON: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_CASCOON ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_NINJASK: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NINJASK ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_SHEDINJA: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SHEDINJA ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_BEAUTY: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, 3); //beauty targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_BEAUTY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; #ifdef POKEMON_EXPANSION case EVO_LEVEL_FEMALE: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_FEMALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_MALE: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_MALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_NIGHT: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NIGHT ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_DAY: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DAY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_DUSK: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DUSK ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_HOLD_DAY: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_DAY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_HOLD_NIGHT: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_NIGHT ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_MOVE: StringCopy(gStringVar2, gMoveNames[gEvolutionTable[species][i].param]); targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_MOVE_TYPE: StringCopy(gStringVar2, gTypeNames[gEvolutionTable[species][i].param]); targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE_TYPE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_MAPSEC: StringCopy(gStringVar2, gRegionMapEntries[gEvolutionTable[species][i].param].name); targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MAPSEC ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_MALE: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_MALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_FEMALE: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_FEMALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_RAIN: //if (j == WEATHER_RAIN || j == WEATHER_RAIN_THUNDERSTORM || j == WEATHER_DOWNPOUR) targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_RAIN ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_SPECIFIC_MON_IN_PARTY: StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MON_IN_PARTY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_DARK_TYPE_MON_IN_PARTY: targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_TRADE_SPECIFIC_MON: StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_SPECIFIC_MON ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_SPECIFIC_MAP: mapHeader = Overworld_GetMapHeaderByGroupAndId(gEvolutionTable[species][i].param >> 8, gEvolutionTable[species][i].param & 0xFF); GetMapName(gStringVar2, mapHeader->regionMapSectionId, 0); targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x, base_y, base_y_offset, base_i); //evolution mon name + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MAP ); - PrintInfoScreenTextSmall(gStringVar4, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; #endif }//Switch end + + depth_i += PrintEvolutionTargetSpeciesAndMethod(taskId, targetSpecies, depth+1, base_i+1); }//For loop end + + return times; } static void Task_SwitchScreensFromEvolutionScreen(u8 taskId) { From 883995da1673a883c7d6ba10e38e2194b739a525 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 12 Jul 2021 12:30:28 +0200 Subject: [PATCH 33/88] shortened "human like" to "humane" to avoid clipping --- src/strings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strings.c b/src/strings.c index 5706ff4d2904..849bc1f630a0 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1877,7 +1877,7 @@ const u8 gText_Stats_eggGroup_FLYING[] = _("FLYING"); const u8 gText_Stats_eggGroup_FIELD[] = _("FIELD"); const u8 gText_Stats_eggGroup_FAIRY[] = _("FAIRY"); const u8 gText_Stats_eggGroup_GRASS[] = _("GRASS"); -const u8 gText_Stats_eggGroup_HUMAN_LIKE[] = _("HUMAN LIKE"); +const u8 gText_Stats_eggGroup_HUMAN_LIKE[] = _("HUMANE"); const u8 gText_Stats_eggGroup_WATER_3[] = _("WATER {CIRCLE_3}"); const u8 gText_Stats_eggGroup_MINERAL[] = _("MINERAL"); const u8 gText_Stats_eggGroup_AMORPHOUS[] = _("AMORPHOUS"); From 4989c6169d20e1e290b72256c42014dc88e68fc7 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Wed, 6 Oct 2021 16:39:10 +0200 Subject: [PATCH 34/88] fixed evo screen "dash overwriting text above" problem, thanks to trikop for showing me --- src/pokedex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokedex.c b/src/pokedex.c index 863578c0a849..686e40ddcfc3 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7521,7 +7521,7 @@ static void CreateCaughtBallEvolutionScreen(u16 targetSpecies, u8 x, u8 y, u16 u BlitBitmapToWindow(0, sCaughtBall_Gfx, x, y, 8, 16); else { - FillWindowPixelRect(0, PIXEL_FILL(0), x, y, 8, 16); + //FillWindowPixelRect(0, PIXEL_FILL(0), x, y, 8, 16); //not sure why this was even here PrintInfoScreenTextSmall(gText_OneDash, x+1, y); } } From 856403c532a75b62be614df0cda157b1428fbd44 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Wed, 6 Oct 2021 17:20:29 +0200 Subject: [PATCH 35/88] fixed the gray underlay in the list view, thanks to shadow300 for notifying me --- graphics/pokedex/HGSS_tileset_menu_list.png | Bin 1576 -> 1538 bytes src/pokedex.c | 12 +++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/graphics/pokedex/HGSS_tileset_menu_list.png b/graphics/pokedex/HGSS_tileset_menu_list.png index 12faa82764f50319d5961c00d6eeeeb50d579b80..9492805e848cb3d1a91405acb1330e5c9a2f8a69 100644 GIT binary patch delta 1474 zcmV;z1wHzx41x@h7#Roy0000E_XrjM000DMK}|sb0I`mI`%#mTdp>^!eMv+?RA_wf?s#77d|0tiQqC(;u<1i0J(@dy*V2%rkh6`g;|L3J+xt^vanfR7xV3tdz=Bj)}$ zM~I*TOgaElQjQVvQlNkDsiTG?IsmO!6-}>u2GE-7MVDuQ5Y7O!7kMgHXl&zE03#=Z z#u?uPcqHEfKu~#RYX?4vwKq+Wo-LVH0o0@E%qda;r@1B`|pHBhq53jirVLnu*6*Sk~

2Tf z&k|6=NcBUc>m&De?Q~Ky1O*<|? z{K|{c#{izxS#E#Q4gppD_dUln5_fI z`Lhl(0Qi40h}%m5jtPp+jT5G`ts#wMD;h_(8kZ6ADS(P^QnIQRqiDbQ0F`YmX|WZb zY1|P&>Pml@J2w78SL<<^9J$Vs2`N0A7mQBx$NRzY-fKl}j>?@chFNT?+-PL87md6K zdI`XmZe-^9jJi$(kLjX=X8kK*yP5I{40G_Dw@7el_1|9<31?x1h zF9H~upwU2UoBkocp|YlP7s7+#xEioycY0e4U^UQ(!CwI2%M2jh!+el^K0$dD`BpO> zKh%I;=L^75Gosz|$0_83w7p}37;6kvfV9;;gYd&xwhJ2Y|Jaoet-(A+1l3Sq5$aNq>TW`@5mWJpVLjQQEG~#a-k@z zZ(Xdq^{T^5s=F$~*4ds8fPU64~XxC3frZ>y^v} zE`X}3s^8U$j$IGHX2M|<>ukCLKqB6cVvso30D7v|k2TXirx4Sa${e{~$e(J(>`oK| z-vO;(%fU)&=0q*sEfe!6HA{2j@ zQLb6c^(O$p#4(W+Z7l()OPA^_3P9gFG*Ao*09}AX6ZK+gu2Awo^(2%;Qu2u|DF7uG zY<96_*YdQ^Foh6Vf1s=BsjeiFl23GrT1rqZ$p5baJC&hTS=D2^v=-Gp%GF7>-f476 z3s4qcxDWtiHE|CBcAB-8eF6Yr9EpF!wT@`CzL)v@zSu-SnNUY2RZ?va0UnOqcDEU8 z+5lb#P+L6!FseXB?BZG`^N>`Rcl0Kx)@=6@MUx0NwcM}aYL@=#7y{~iKsUI~{X`)R zr|zz&Vr{75jr)n>ZGhW};(Y+Pmnb%IqhTUgEL)r>g0%oRPXucLV3r7$1I!*0!Fqt7 cmHz<00ggq->&=e*tpET307*qoM6N<$f-^Fs-~a#s delta 1511 zcmVH411?l0H^Tq`02g#cSaefw zW^{L9a%BKVOhiylM<8}(av(DOV1ZP1_ zK>z@;j|==^1(7j6e*ghuOGiZir3doG000F{Nkl1ia7F`IZ4J10#U_PkIaz$q0B1 ze`Y$sa}L0~f0_Y;29Rm+5`cy{iE;^(=!Jc@?Xa&jLDF~|pd|tf;G`;?*ozf)2{3zr zy)Z_AodMh-z>kk@fSCY0704a}SdriDB&iMG(}0V{*8ugrb2!!W59++f0r*@d(H;9A zluT(nB~nRE0B4Fc{;**TOyeuN2e^Qp%M$R|)!>3Jf5^pzF=iV7IqU<9rCg3dK>z;+ zEQ(1S!%O-j0Cp3};-FYSqHrbp9O{0kQF>)}MF46KkiCxOkt<+v*=E}r$=e45`UFU; z_b>6*=P>Jel}84oUh+|@hVY4izJ`8)KJ*}f($`DmTYp8sraE0~08h#$08aMp60nGW0+6cLu}c8x&;;*0 zq#z)kAM*?>0Kg{b34kxZj9rH+AfQ~bL6(3^e*%mQU?=KMg-(rjjdZ)>4aswW#2j@N z3$Qh^53m&hBiTi_ab(ppKr6?5XfN$m`moi~6MioWqxzcHe|?905PHnp>97b8E4IS7 zl^cjX1PD##$MPKXaSRYOz*y!R2rrtmCgd9k0n8>K+qR|ScH2iSro4cZfc zf82zqf!HHXFvTFQc}bqICQ8&?5 zcyk6I!v&B!CCt=Gep?ldMoU~cJiHbrfT+g(c6~nonFC@b=3(akE&bO3UIH7#e+(FR z0ciY(0`41L_%h8qi}o>q2kM(bGx9J~%qtV^rAS-8HH|~R;i99wzyX{fm8py(+#z+H zUmbWH(5$;=2OxHT30R-K6c;X6QB`DrHe}d&K&%wjvR)?u&P~;VTqHTCxXOc+d#VT_ z{A9M%k_YT2%o52JX%K)jL52Die=5EW;ctvXF1M`!s6ueANP`lAGeJ475uw~ej2=#m z?O^kksN@`JL;%$>cMi~y4@?4trQ3+PI{*+j(Guo2<+Y#I`{qokz8*7C0-99K0h?(` z<1BAe$_1SzW6uD@bE>fvUA#iPsVLn1Q`4cJdwe<(u#vTbN^=m(H|Sd2BLW9t#|zx1_?`vGS%B9#p9szazA67b;1@C`yk~5WuxJ1P N002ovPDHLkV1fm*qoe=; diff --git a/src/pokedex.c b/src/pokedex.c index 686e40ddcfc3..107c4be78ee2 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -2627,6 +2627,16 @@ static void PrintMonDexNumAndName(u8 windowId, u8 fontId, const u8* str, u8 left AddTextPrinterParameterized4(windowId, fontId, left * 8, (top * 8) + 1, 0, 0, color, -1, str); } +static void PrintMonDexNumAndName_2(u8 windowId, u8 fontId, const u8* str, u8 left, u8 top) //HGSS_Ui offset for closer numer + text +{ + u8 color[3]; + + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_DYNAMIC_COLOR_6; + color[2] = TEXT_COLOR_LIGHT_GREY; + AddTextPrinterParameterized4(windowId, fontId, left * 8 - 3, (top * 8) + 1, 0, 0, color, -1, str); +} + // u16 ignored is passed but never used #define MON_LIST_X 2 static void CreateMonListEntry(u8 position, u16 b, u16 ignored) @@ -2748,7 +2758,7 @@ static u8 CreateMonName(u16 num, u8 left, u8 top) str = gSpeciesNames[num]; else str = sText_TenDashes; - PrintMonDexNumAndName(0, 7, str, left, top); + PrintMonDexNumAndName_2(0, 7, str, left, top); return StringLength(str); } From 6a3f3ab77ecd195a8df3c66d7559ca5ef8c4583e Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 11 Oct 2021 22:21:56 +0200 Subject: [PATCH 36/88] improved dynamicness, improved support for "tx_difficulty_challenges" --- src/pokedex.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 107c4be78ee2..a632d1f9601f 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4515,8 +4515,13 @@ static void PrintCurrentSpeciesTypeInfo(void) u8 type1, type2; //type icon(s) - type1 = gBaseStats[species].type1; - type2 = gBaseStats[species].type2; + #ifdef TX_RANDOM_TYPE + type1 = GetTypeBySpecies(species, 1); + type2 = GetTypeBySpecies(species, 2); + #else + type1 = gBaseStats[species].type1; + type2 = gBaseStats[species].type2; + #endif if (species == SPECIES_NONE) type1 = type2 = TYPE_MYSTERY; @@ -6827,6 +6832,8 @@ static void PrintStatsScreen_Left(u8 taskId) u8 abilities_x = 101; u8 abilities_y = 99; u8 ability0; + u8 ability1; + u8 abilityHidden; u8 differentEVs = 0; u8 EVs[6] = {gBaseStats[species].evYield_HP, gBaseStats[species].evYield_Speed, gBaseStats[species].evYield_Attack, gBaseStats[species].evYield_SpAttack, gBaseStats[species].evYield_Defense, gBaseStats[species].evYield_SpDefense}; @@ -7240,22 +7247,23 @@ static void PrintStatsScreen_Left(u8 taskId) //Abilitie(s) if (gTasks[taskId].data[5] == 0) { - ability0 = gBaseStats[species].abilities[0]; + ability0 = GetAbilityBySpecies(species, 0); //gBaseStats[species].abilities[0]; PrintInfoScreenTextSmallWhite(gAbilityNames[ability0], abilities_x, abilities_y); PrintInfoScreenTextSmall(gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); - if (gBaseStats[species].abilities[1] != ABILITY_NONE) + ability1 = GetAbilityBySpecies(species, 1); + if (ability1 != ABILITY_NONE) //(gBaseStats[species].abilities[1] != ABILITY_NONE) { - PrintInfoScreenTextSmallWhite(gAbilityNames[gBaseStats[species].abilities[1]], abilities_x, abilities_y + 30); - PrintInfoScreenTextSmall(gAbilityDescriptionPointers[gBaseStats[species].abilities[1]], abilities_x, abilities_y + 44); + PrintInfoScreenTextSmallWhite(gAbilityNames[ability1], abilities_x, abilities_y + 30); + PrintInfoScreenTextSmall(gAbilityDescriptionPointers[ability1], abilities_x, abilities_y + 44); } } #ifdef POKEMON_EXPANSION else //Hidden abilities { - ability0 = gBaseStats[species].abilities[2]; - PrintInfoScreenTextSmallWhite(gAbilityNames[ability0], abilities_x, abilities_y); - PrintInfoScreenTextSmall(gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); + abilityHidden = GetAbilityBySpecies(species, 2); + PrintInfoScreenTextSmallWhite(gAbilityNames[abilityHidden], abilities_x, abilities_y); + PrintInfoScreenTextSmall(gAbilityDescriptionPointers[abilityHidden], abilities_x, abilities_y + 14); } #endif From 32d0affdeaa7ed6e0546001d573283b38e6a9c47 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 11 Oct 2021 22:53:13 +0200 Subject: [PATCH 37/88] cleanup of evolutions page code --- src/pokedex.c | 136 +++----------------------------------------------- 1 file changed, 7 insertions(+), 129 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index a632d1f9601f..61bd77b15d54 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4515,7 +4515,7 @@ static void PrintCurrentSpeciesTypeInfo(void) u8 type1, type2; //type icon(s) - #ifdef TX_RANDOM_TYPE + #ifdef TX_DIFFICULTY_CHALLENGES_USED type1 = GetTypeBySpecies(species, 1); type2 = GetTypeBySpecies(species, 2); #else @@ -7592,270 +7592,148 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, { base_i = i + depth_i; left = !left; + + targetSpecies = gEvolutionTable[species][i].targetSpecies; + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name + switch (gEvolutionTable[species][i].method) { case EVO_FRIENDSHIP: - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); ConvertIntToDecimalStringN(gStringVar2, 220, STR_CONV_MODE_LEADING_ZEROS, 3); //friendship value - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_FRIENDSHIP_DAY: - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_DAY ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_FRIENDSHIP_NIGHT: - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_NIGHT ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL: - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_TRADE: - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_TRADE_ITEM: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_ITEM ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM: item = gEvolutionTable[species][i].param; CopyItemName(item, gStringVar2); - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_ATK_GT_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_GT_DEF ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_ATK_EQ_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_EQ_DEF ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_ATK_LT_DEF: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon namee StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_LT_DEF ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_SILCOON: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SILCOON ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_CASCOON: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_CASCOON ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_NINJASK: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NINJASK ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_SHEDINJA: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SHEDINJA ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_BEAUTY: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, 3); //beauty - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_BEAUTY ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; #ifdef POKEMON_EXPANSION case EVO_LEVEL_FEMALE: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_FEMALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_MALE: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_MALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_NIGHT: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NIGHT ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_DAY: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DAY ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_DUSK: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DUSK ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_HOLD_DAY: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_DAY ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_HOLD_NIGHT: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_NIGHT ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_MOVE: StringCopy(gStringVar2, gMoveNames[gEvolutionTable[species][i].param]); - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_MOVE_TYPE: StringCopy(gStringVar2, gTypeNames[gEvolutionTable[species][i].param]); - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE_TYPE ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_MAPSEC: StringCopy(gStringVar2, gRegionMapEntries[gEvolutionTable[species][i].param].name); - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_MAPSEC ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_MALE: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_MALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_ITEM_FEMALE: item = gEvolutionTable[species][i].param; //item CopyItemName(item, gStringVar2); //item - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_FEMALE ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_RAIN: //if (j == WEATHER_RAIN || j == WEATHER_RAIN_THUNDERSTORM || j == WEATHER_DOWNPOUR) - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_RAIN ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_SPECIFIC_MON_IN_PARTY: StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MON_IN_PARTY ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_LEVEL_DARK_TYPE_MON_IN_PARTY: - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_TRADE_SPECIFIC_MON: StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_SPECIFIC_MON ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; case EVO_SPECIFIC_MAP: mapHeader = Overworld_GetMapHeaderByGroupAndId(gEvolutionTable[species][i].param >> 8, gEvolutionTable[species][i].param & 0xFF); GetMapName(gStringVar2, mapHeader->regionMapSectionId, 0); - targetSpecies = gEvolutionTable[species][i].targetSpecies; - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MAP ); - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); break; #endif }//Switch end + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); //Print actual instructions depth_i += PrintEvolutionTargetSpeciesAndMethod(taskId, targetSpecies, depth+1, base_i+1); }//For loop end From dd011d517e89f8e9ae136d2fdf380f4713e1cf04 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 11 Oct 2021 23:00:54 +0200 Subject: [PATCH 38/88] improved "x_difficulty_challenges" compatibility --- src/pokedex.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pokedex.c b/src/pokedex.c index 61bd77b15d54..150728fad6bf 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7566,6 +7566,15 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, StringCopy(gStringVar1, gSpeciesNames[species]); + #ifdef TX_DIFFICULTY_CHALLENGES_USED + if (gSaveBlock1Ptr->txRandEvolutionMethodes) //tx_difficulty_challenges + { + species = GetEvolutionTargetSpeciesRandom(species, gSaveBlock1Ptr->txRandEvolutions, !gSaveBlock1Ptr->txRandChaos); + if (species == SPECIES_NONE) + return SPECIES_NONE; + } + #endif + //Calculate number of possible direct evolutions (e.g. Eevee has 5 but torchic has 1) for (i = 0; i < EVOS_PER_MON; i++) { From 11dd0ea78693e6c638801b26bd63cd40e951273b Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 11 Oct 2021 23:25:53 +0200 Subject: [PATCH 39/88] added support for randomized evolutions and evo methods --- src/pokedex.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pokedex.c b/src/pokedex.c index 150728fad6bf..a119fd4c0c66 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -46,6 +46,9 @@ #include "constants/party_menu.h" #include "constants/rgb.h" #include "constants/songs.h" +#ifdef TX_DIFFICULTY_CHALLENGES_USED + #include "tx_difficulty_challenges.h" +#endif enum { @@ -7603,6 +7606,10 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, left = !left; targetSpecies = gEvolutionTable[species][i].targetSpecies; + #ifdef TX_DIFFICULTY_CHALLENGES_USED + if (gSaveBlock1Ptr->txRandEvolutions && targetSpecies != SPECIES_NONE) //tx_difficulty_challenges + targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_OFFSET_EVOLUTION, TRUE, !gSaveBlock1Ptr->txRandChaos); + #endif CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name From 1eb33edf451a7319ed475bf07fa058672be84643 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 18 Oct 2021 21:48:02 +0200 Subject: [PATCH 40/88] fixed small problem with #ifdef not working for #include --- src/pokedex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokedex.c b/src/pokedex.c index a119fd4c0c66..01747c6c93d9 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -47,7 +47,7 @@ #include "constants/rgb.h" #include "constants/songs.h" #ifdef TX_DIFFICULTY_CHALLENGES_USED - #include "tx_difficulty_challenges.h" + //#include "tx_difficulty_challenges.h" #endif enum From e42929dec70de91cb467a4ac74b56de39988d6e6 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 24 Oct 2021 13:46:47 +0200 Subject: [PATCH 41/88] added comments for BE users, removed dead code, imrpoved compatibility --- src/pokedex.c | 133 ++++++++------------------------------------------ 1 file changed, 19 insertions(+), 114 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 01747c6c93d9..d2959ecd1a53 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -385,6 +385,11 @@ static void Task_SwitchScreensFromFormsScreen(u8 taskId); static void Task_ExitFormsScreen(u8 taskId); #endif +//COMPATIBILITY, delete if you are using a newer version +#define TEXT_COLOR_LIGHT_GRAY TEXT_COLOR_LIGHT_GREY +#define TEXT_COLOR_DARK_GRAY TEXT_COLOR_DARK_GREY +//COMPATIBILITY end + //HGSS_UI Physical Special Split icon for BattleEngine (rhh) #ifdef BATTLE_ENGINE static u8 ShowSplitIcon(u32 split); //Physical/Special Split from BE @@ -392,8 +397,12 @@ static void DestroySplitIcon(void); //Physical/Special Split from BE //Physical/Special Split from BE #define TAG_SPLIT_ICONS 30004 -// static const u16 sSplitIcons_Pal[] = INCBIN_U16("graphics/interface/split_icons.gbapal"); -// static const u32 sSplitIcons_Gfx[] = INCBIN_U32("graphics/interface/split_icons.4bpp.lz"); + +//UNCOMMENT THE FOLLOWING 2 LINES IF YOU ARE USING THE BATTLE EXPANSION !!!! + // static const u16 sSplitIcons_Pal[] = INCBIN_U16("graphics/interface/split_icons.gbapal"); + // static const u32 sSplitIcons_Gfx[] = INCBIN_U32("graphics/interface/split_icons.4bpp.lz"); +//UNCOMMENT THE PREVIOUS 2 LINES IF YOU ARE USING THE BATTLE EXPANSION !!!! + static const struct OamData sOamData_SplitIcons = { .size = SPRITE_SIZE(16x16), @@ -2626,7 +2635,7 @@ static void PrintMonDexNumAndName(u8 windowId, u8 fontId, const u8* str, u8 left color[0] = TEXT_COLOR_TRANSPARENT; color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_LIGHT_GREY; + color[2] = TEXT_COLOR_LIGHT_GRAY; AddTextPrinterParameterized4(windowId, fontId, left * 8, (top * 8) + 1, 0, 0, color, -1, str); } @@ -2636,7 +2645,7 @@ static void PrintMonDexNumAndName_2(u8 windowId, u8 fontId, const u8* str, u8 le color[0] = TEXT_COLOR_TRANSPARENT; color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_LIGHT_GREY; + color[2] = TEXT_COLOR_LIGHT_GRAY; AddTextPrinterParameterized4(windowId, fontId, left * 8 - 3, (top * 8) + 1, 0, 0, color, -1, str); } @@ -3101,30 +3110,6 @@ static void CreateInterfaceSprites(u8 page) gSprites[spriteId].vFlip = TRUE; CreateSprite(&sScrollBarSpriteTemplate, 8, 20, 0); - // Start button - // CreateSprite(&sInterfaceTextSpriteTemplate, 16, 120, 0); - // Menu text - // spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 48, 120, 0); - // StartSpriteAnim(&gSprites[spriteId], 3); - // Select button - // spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 16, 144, 0); - // StartSpriteAnim(&gSprites[spriteId], 2); - // gSprites[spriteId].data[2] = 0x80; - // Search text - // spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 48, 144, 0); - // StartSpriteAnim(&gSprites[spriteId], 1); - - // spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, 80, 2); - // gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; - // gSprites[spriteId].oam.matrixNum = 30; - // gSprites[spriteId].data[0] = 30; - // gSprites[spriteId].data[1] = 0; - - // spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, 80, 2); - // gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; - // gSprites[spriteId].oam.matrixNum = 31; - // gSprites[spriteId].data[0] = 31; - // gSprites[spriteId].data[1] = 128; if (!IsNationalPokedexEnabled() && page == PAGE_MAIN) { @@ -3488,7 +3473,7 @@ static void PrintInfoScreenText(const u8* str, u8 left, u8 top) u8 color[3]; color[0] = TEXT_COLOR_TRANSPARENT; color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_LIGHT_GREY; + color[2] = TEXT_COLOR_LIGHT_GRAY; AddTextPrinterParameterized4(0, 1, left, top, 0, 0, color, -1, str); } @@ -3506,7 +3491,7 @@ static void PrintInfoScreenTextSmall(const u8* str, u8 left, u8 top) u8 color[3]; color[0] = TEXT_COLOR_TRANSPARENT; color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_LIGHT_GREY; + color[2] = TEXT_COLOR_LIGHT_GRAY; AddTextPrinterParameterized4(0, 0, left, top, 0, 0, color, 0, str); } @@ -3656,15 +3641,6 @@ static void Task_LoadInfoScreen(u8 taskId) if (!gPaletteFade.active) { gMain.state++; - // if (gTasks[taskId].data[3] == 0) - // { - // StopCryAndClearCrySongs(); - // PlayCry2(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, 0x7D, 0xA); - // } - // else - // { - // gMain.state++; - // } } break; case 9: @@ -3718,63 +3694,6 @@ static void Task_HandleInfoScreenInput(u8 taskId) PlaySE(SE_PC_OFF); return; } - /* - if (JOY_NEW(A_BUTTON)) - { - switch (sPokedexView->selectedScreen) - { - case AREA_SCREEN: - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 16, RGB_BLACK); - sPokedexView->screenSwitchState = 1; - gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; - PlaySE(SE_PIN); - break; - case CRY_SCREEN: - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 2; - gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; - PlaySE(SE_PIN); - break; - case SIZE_SCREEN: - if (!sPokedexListItem->owned) - { - PlaySE(SE_FAILURE); - } - else - { - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 3; - gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; - PlaySE(SE_PIN); - } - break; - case CANCEL_SCREEN: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); - gTasks[taskId].func = Task_ExitInfoScreen; - PlaySE(SE_PC_OFF); - break; - } - return; - } - if (((JOY_NEW(DPAD_LEFT)) - || ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) - && sPokedexView->selectedScreen > 0) - { - sPokedexView->selectedScreen--; - HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); - PlaySE(SE_DEX_PAGE); - return; - } - if (((JOY_NEW(DPAD_RIGHT)) - || ((JOY_NEW(R_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) - && sPokedexView->selectedScreen < CANCEL_SCREEN) - { - sPokedexView->selectedScreen++; - HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); - PlaySE(SE_DEX_PAGE); - return; - } - */ if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) { @@ -3845,7 +3764,6 @@ static void Task_LoadAreaScreen(u8 taskId) break; case 1: LoadScreenSelectBarSubmenu(0xD); //HGSS_Ui - // HighlightSubmenuScreenSelectBarItem(0, 0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(13) | BGCNT_16COLOR | BGCNT_TXT256x256); gMain.state++; @@ -3906,8 +3824,6 @@ static void Task_LoadCryScreen(u8 taskId) break; case 1: LoadTilesetTilemapHGSS(CRY_SCREEN); - // DecompressAndLoadBgGfxUsingHeap(3, &gPokedexMenuRest_Gfx, 0x2000, 0, 0); - // CopyToBgTilemapBuffer(3, &gPokedexCryScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); PutWindowTilemap(WIN_VU_METER); @@ -3916,7 +3832,6 @@ static void Task_LoadCryScreen(u8 taskId) break; case 2: LoadScreenSelectBarMain(0xD); //HGSS_Ui - // HighlightSubmenuScreenSelectBarItem(1, 0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); gMain.state++; break; @@ -4101,15 +4016,12 @@ static void Task_LoadSizeScreen(u8 taskId) break; case 1: LoadTilesetTilemapHGSS(SIZE_SCREEN); - // DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenuRest_Gfx, 0x2000, 0, 0); - // CopyToBgTilemapBuffer(3, gPokedexSizeScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); gMain.state++; break; case 2: LoadScreenSelectBarMain(0xD); //HGSS_Ui - // HighlightSubmenuScreenSelectBarItem(2, 0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); gMain.state++; break; @@ -4222,7 +4134,6 @@ static void Task_SwitchScreensFromSizeScreen(u8 taskId) static void LoadScreenSelectBarMain(u16 unused) { - //CopyToBgTilemapBuffer(1, gPokedexScreenSelectBarMain_Tilemap, 0, 0); CopyToBgTilemapBuffer(1, gPokedexScreenSelectBarSubmenu_Tilemap_Clear, 0, 0); CopyBgTilemapBufferToVram(1); } @@ -4335,8 +4246,6 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) break; case 1: LoadTilesetTilemapHGSS(INFO_SCREEN); - // DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0); - // CopyToBgTilemapBuffer(3, gPokedexInfoScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); PutWindowTilemap(WIN_FOOTPRINT); @@ -4955,7 +4864,7 @@ static void PrintInfoSubMenuText(u8 windowId, const u8 *str, u8 left, u8 top) u8 color[3]; color[0] = TEXT_COLOR_TRANSPARENT; color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_LIGHT_GREY; + color[2] = TEXT_COLOR_LIGHT_GRAY; AddTextPrinterParameterized4(windowId, 1, left, top, 0, 0, color, -1, str); } @@ -5352,7 +5261,7 @@ static void PrintSearchText(const u8 *str, u32 x, u32 y) color[0] = TEXT_COLOR_TRANSPARENT; color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_DARK_GREY; + color[2] = TEXT_COLOR_DARK_GRAY; AddTextPrinterParameterized4(0, 1, x, y, 0, 0, color, -1, str); } @@ -6274,7 +6183,7 @@ static void LoadTilesetTilemapHGSS(u8 page) } //PokedexPlus HGSS_Ui Stats Page -static const u8 sStatsPageNavigationTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY}; +static const u8 sStatsPageNavigationTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY}; static void StatsPage_PrintAToggleUpdownMoves(void) { u8 x = 9; @@ -6312,8 +6221,6 @@ static void Task_LoadStatsScreen(u8 taskId) break; case 1: LoadTilesetTilemapHGSS(STATS_SCREEN); - // DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0); - // CopyToBgTilemapBuffer(3, gPokedexStatsScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); CopyWindowToVram(WIN_INFO, 3); @@ -7337,7 +7244,7 @@ static void DestroySplitIcon(void) #endif //PokedexPlus HGSS_Ui Evolution Page -static const u8 sEvoFormsPageNavigationTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY}; +static const u8 sEvoFormsPageNavigationTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY}; static void EvoFormsPage_PrintAToggleUpdownEvos(void) { u8 x = 9; @@ -8032,8 +7939,6 @@ static void Task_LoadFormsScreen(u8 taskId) break; case 1: LoadTilesetTilemapHGSS(FORMS_SCREEN); - // DecompressAndLoadBgGfxUsingHeap(3, gPokedexEvo_Gfx, 0x2000, 0, 0); - // CopyToBgTilemapBuffer(3, gPokedexFormsScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); CopyWindowToVram(WIN_INFO, 3); From 48c21df8ee7e5b3a8f57e013fd3667d165db48ba Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 24 Oct 2021 14:32:22 +0200 Subject: [PATCH 42/88] added special eevee handling for PE to show all possible evolution icons --- src/pokedex.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index d2959ecd1a53..57649cb7962d 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7419,8 +7419,9 @@ static void Task_HandleEvolutionScreenInput(u8 taskId) } } } -static void handleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u8 base_x, u8 base_y, u8 base_y_offset, u8 base_i) +static void HandleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u16 previousTargetSpecies, u8 base_x, u8 base_y, u8 base_y_offset, u8 base_i, bool8 isEevee) { + u8 maxI = 6; bool8 seen = GetSetPokedexFlag(SpeciesToNationalPokedexNum(targetSpecies), FLAG_GET_SEEN); if (seen || !HGSS_HIDE_UNSEEN_EVOLUTION_NAMES) @@ -7430,14 +7431,31 @@ static void handleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u8 base_x, u8 StringExpandPlaceholders(gStringVar3, gText_EVO_Name); //evolution mon name PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); //evolution mon name - if(base_i < 6) + //Print mon icon in the top row + if (isEevee) + { + maxI = 9; + if (targetSpecies == previousTargetSpecies) + return; + #ifdef POKEMON_EXPANSION + else if (targetSpecies == SPECIES_GLACEON) + base_i -= 1; + else if (targetSpecies == SPECIES_SYLVEON) + base_i -= 2; + #endif + } + + if(base_i < maxI) { LoadMonIconPalette(targetSpecies); //Loads pallete for current mon #ifndef POKEMON_EXPANSION gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 50 + 32*base_i, 31, 4, 0, TRUE); //Create pokemon sprite #endif #ifdef POKEMON_EXPANSION - gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 50 + 32*base_i, 31, 4, 0); //Create pokemon sprite + if (isEevee) + gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 45 + 26*base_i, 31, 4, 0); //Create pokemon sprite + else + gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 50 + 32*base_i, 31, 4, 0); //Create pokemon sprite #endif gSprites[gTasks[taskId].data[4+base_i]].oam.priority = 0; } @@ -7462,6 +7480,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, const struct MapHeader *mapHeader; #endif u16 targetSpecies = 0; + u16 previousTargetSpecies = 0; u16 item; @@ -7473,9 +7492,13 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 base_i = 0; u8 times = 0; u8 depth_x = 16; + bool8 isEevee = FALSE; StringCopy(gStringVar1, gSpeciesNames[species]); + if (species == SPECIES_EEVEE) + isEevee = TRUE; + #ifdef TX_DIFFICULTY_CHALLENGES_USED if (gSaveBlock1Ptr->txRandEvolutionMethodes) //tx_difficulty_challenges { @@ -7512,13 +7535,14 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, base_i = i + depth_i; left = !left; + previousTargetSpecies = targetSpecies; targetSpecies = gEvolutionTable[species][i].targetSpecies; #ifdef TX_DIFFICULTY_CHALLENGES_USED if (gSaveBlock1Ptr->txRandEvolutions && targetSpecies != SPECIES_NONE) //tx_difficulty_challenges targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_OFFSET_EVOLUTION, TRUE, !gSaveBlock1Ptr->txRandChaos); #endif CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - handleTargetSpeciesPrint(taskId, targetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i); //evolution mon name + HandleTargetSpeciesPrint(taskId, targetSpecies, previousTargetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i, isEevee); //evolution mon name switch (gEvolutionTable[species][i].method) { From 475bb8a624b095002da00152b5a5f2ea67c55804 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 24 Oct 2021 16:31:19 +0200 Subject: [PATCH 43/88] added preEvolutions to the EvoScreen! --- graphics/pokedex/HGSS_tilemap_evo_screen.bin | Bin 1344 -> 1344 bytes include/strings.h | 1 + src/pokedex.c | 108 +++++++++++++++++-- src/strings.c | 1 + 4 files changed, 102 insertions(+), 8 deletions(-) diff --git a/graphics/pokedex/HGSS_tilemap_evo_screen.bin b/graphics/pokedex/HGSS_tilemap_evo_screen.bin index e7407faf7628b66172d24557d59dc387a2914607..bf66d4046358737f3f19cd5a674edb9f041274ba 100644 GIT binary patch delta 42 xcmX@Wb%1L^2cz}Gg_0B3@l0GNHQ9q{$K(b^4t7@tHz0JKJdsg-^ESpVW&lOk4e0;? delta 60 zcmX@Wb%1L^2cylzg_0B3@l0GN#pp2cpy9+{d|-OA6(f{U#mL9*&fo@wu9GJ+s&C%L H*u@M0o2?WW diff --git a/include/strings.h b/include/strings.h index 920af7e7a639..032370e5b715 100644 --- a/include/strings.h +++ b/include/strings.h @@ -605,6 +605,7 @@ extern const u8 gText_Dex_OWN[]; extern const u8 gText_EVO_Buttons_PE[]; extern const u8 gText_EVO_Buttons_Decapped_PE[]; extern const u8 gText_EVO_Name[]; +extern const u8 gText_EVO_PreEvo[]; extern const u8 gText_EVO_FRIENDSHIP[]; extern const u8 gText_EVO_FRIENDSHIP_DAY[]; extern const u8 gText_EVO_FRIENDSHIP_NIGHT[]; diff --git a/src/pokedex.c b/src/pokedex.c index 57649cb7962d..43385e22dedf 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -214,6 +214,7 @@ struct PokedexView u8 numLevelUpMoves; //HGSS_Ui u8 numTMHMMoves; //HGSS_Ui u8 numTutorMoves; //HGSS_Ui + u8 numPreEvolutions; //HGSS_Ui u16 selectedMonSpriteId; s16 pokeBallRotationStep; s16 pokeBallRotationBackup; @@ -368,6 +369,7 @@ static void Task_HandleEvolutionScreenInput(u8 taskId); static void Task_SwitchScreensFromEvolutionScreen(u8 taskId); static void Task_ExitEvolutionScreen(u8 taskId); static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_i); +static u8 PrintPreEvolutions(u8 taskId, u16 species); //Stat bars on scrolling screens static void TryDestroyStatBars(void); static void TryDestroyStatBarsBg(void); @@ -7315,11 +7317,12 @@ static void Task_LoadEvolutionScreen(u8 taskId) //Icon FreeMonIconPalettes(); //Free space for new pallete LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon + PrintPreEvolutions(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); #ifndef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0, TRUE); //Create pokemon sprite + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0, TRUE); //Create pokemon sprite #endif #ifdef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0); //Create pokemon sprite EvoFormsPage_PrintAToggleUpdownEvos(); //HGSS_Ui Navigation buttons #endif gSprites[gTasks[taskId].data[4]].oam.priority = 0; @@ -7329,7 +7332,7 @@ static void Task_LoadEvolutionScreen(u8 taskId) case 4: //Print evo info and icons gTasks[taskId].data[3] = 0; - PrintEvolutionTargetSpeciesAndMethod(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, 0); + PrintEvolutionTargetSpeciesAndMethod(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, sPokedexView->numPreEvolutions); gMain.state++; break; case 5: @@ -7464,19 +7467,108 @@ static void CreateCaughtBallEvolutionScreen(u16 targetSpecies, u8 x, u8 y, u16 u { bool8 owned = GetSetPokedexFlag(SpeciesToNationalPokedexNum(targetSpecies), FLAG_GET_CAUGHT); if (owned) - BlitBitmapToWindow(0, sCaughtBall_Gfx, x, y, 8, 16); + BlitBitmapToWindow(0, sCaughtBall_Gfx, x, y-1, 8, 16); else { //FillWindowPixelRect(0, PIXEL_FILL(0), x, y, 8, 16); //not sure why this was even here - PrintInfoScreenTextSmall(gText_OneDash, x+1, y); + PrintInfoScreenTextSmall(gText_OneDash, x+1, y-1); + } +} +static void HandlePreEvolutionSpeciesPrint(u8 taskId, u16 preSpecies, u16 species, u8 base_x, u8 base_y, u8 base_y_offset, u8 base_i) +{ + bool8 seen = GetSetPokedexFlag(SpeciesToNationalPokedexNum(preSpecies), FLAG_GET_SEEN); + + StringCopy(gStringVar1, gSpeciesNames[species]); //evolution mon name + if (seen || !HGSS_HIDE_UNSEEN_EVOLUTION_NAMES) + StringCopy(gStringVar2, gSpeciesNames[preSpecies]); //evolution mon name + else + StringCopy(gStringVar2, gText_ThreeQuestionMarks); //show questionmarks instead of name + + StringExpandPlaceholders(gStringVar3, gText_EVO_PreEvo); //evolution mon name + PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); //evolution mon name + + if(base_i < 3) + { + LoadMonIconPalette(preSpecies); //Loads pallete for current mon + #ifndef POKEMON_EXPANSION + gTasks[taskId].data[4+base_i] = CreateMonIcon(preSpecies, SpriteCB_MonIcon, 18 + 32*base_i, 31, 4, 0, TRUE); //Create pokemon sprite + #endif + #ifdef POKEMON_EXPANSION + gTasks[taskId].data[4+base_i] = CreateMonIcon(preSpecies, SpriteCB_MonIcon, 18 + 32*base_i, 31, 4, 0); //Create pokemon sprite + #endif + gSprites[gTasks[taskId].data[4+base_i]].oam.priority = 0; + } +} + +static u8 PrintPreEvolutions(u8 taskId, u16 species) +{ + u16 i; + u16 j; + + u8 base_x = 13; + u8 base_x_offset = 54; + u8 base_y = 51; + u8 base_y_offset = 9; + u8 base_i = 0; + u8 depth_x = 16; + + u16 preEvolutionOne = 0; + u16 preEvolutionTwo = 0; + u8 numPreEvolutions = 0; + + //Calculate previous evolution + for (i = 0; i < NUM_SPECIES; i++) + { + for (j = 0; j < EVOS_PER_MON; j++) + { + if (gEvolutionTable[i][j].targetSpecies == species) + { + preEvolutionOne = i; + numPreEvolutions += 1; + break; + } + } } + + //Calculate if previous evolution also has a previous evolution + if (numPreEvolutions != 0) + { + for (i = 0; i < NUM_SPECIES; i++) + { + for (j = 0; j < EVOS_PER_MON; j++) + { + if (gEvolutionTable[i][j].targetSpecies == preEvolutionOne) + { + preEvolutionTwo = i; + numPreEvolutions += 1; + CreateCaughtBallEvolutionScreen(preEvolutionTwo, base_x - 9, base_y + base_y_offset*0, 0); + HandlePreEvolutionSpeciesPrint(taskId, preEvolutionTwo, preEvolutionOne, base_x, base_y, base_y_offset, 0); + break; + } + } + } + } + + //Print ball and name + if (preEvolutionOne != 0) + { + CreateCaughtBallEvolutionScreen(preEvolutionOne, base_x - 9, base_y + base_y_offset*(numPreEvolutions - 1), 0); + HandlePreEvolutionSpeciesPrint(taskId, preEvolutionOne, species, base_x, base_y, base_y_offset, numPreEvolutions - 1); + } + + //vertical line + FillWindowPixelRect(0, PIXEL_FILL(5), 33 + 32*numPreEvolutions, 18, 1, 32); //PIXEL_FILL(15) for black + + sPokedexView->numPreEvolutions = numPreEvolutions; + + return numPreEvolutions; } #define EVO_SCREEN_LVL_DIGITS 2 static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_i) { - int i; + u16 i; #ifdef POKEMON_EXPANSION - int j; + u16 j; const struct MapHeader *mapHeader; #endif u16 targetSpecies = 0; @@ -7526,7 +7618,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, if (times == 0 && depth == 0) { StringExpandPlaceholders(gStringVar4, gText_EVO_NONE); - PrintInfoScreenTextSmall(gStringVar4, base_x-7, base_y + base_y_offset*base_i); + PrintInfoScreenTextSmall(gStringVar4, base_x-7, base_y + base_y_offset*depth_i); } //If there are evolutions find out which and print them 1 by 1 diff --git a/src/strings.c b/src/strings.c index 849bc1f630a0..678e187c6c73 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1891,6 +1891,7 @@ const u8 gText_Dex_OWN[] = _("OWN"); const u8 gText_EVO_Buttons_PE[] = _("{A_BUTTON}FORMS"); const u8 gText_EVO_Buttons_Decapped_PE[] = _("{A_BUTTON}Forms"); const u8 gText_EVO_Name[] = _("{STR_VAR_3}:"); +const u8 gText_EVO_PreEvo[] = _("{STR_VAR_1} evolves from {STR_VAR_2}"); const u8 gText_EVO_FRIENDSHIP[] = _("LvlUp, high friendship"); const u8 gText_EVO_FRIENDSHIP_DAY[] = _("LvlUp, high friendship, day"); const u8 gText_EVO_FRIENDSHIP_NIGHT[] = _("Lvlup, high friendship, night"); From 347a17340220d68165a905a74e88cea2e72a0f5d Mon Sep 17 00:00:00 2001 From: Katelyn Gigante Date: Fri, 22 Oct 2021 10:36:55 +1100 Subject: [PATCH 44/88] Prevent text glitch if a pokemon has an unspecified custom evolution --- include/strings.h | 1 + src/pokedex.c | 3 +++ src/strings.c | 1 + 3 files changed, 5 insertions(+) diff --git a/include/strings.h b/include/strings.h index 032370e5b715..a1d0cd3ccbbc 100644 --- a/include/strings.h +++ b/include/strings.h @@ -638,6 +638,7 @@ extern const u8 gText_EVO_SPECIFIC_MON_IN_PARTY[]; extern const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[]; extern const u8 gText_EVO_TRADE_SPECIFIC_MON[]; extern const u8 gText_EVO_SPECIFIC_MAP[]; +extern const u8 gText_EVO_UNKNOWN[]; extern const u8 gText_EVO_NONE[]; extern const u8 gText_FORMS_Buttons_PE[]; diff --git a/src/pokedex.c b/src/pokedex.c index 43385e22dedf..1753427cd222 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7771,6 +7771,9 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MAP ); break; #endif + default: + StringExpandPlaceholders(gStringVar4, gText_EVO_UNKNOWN ); + break; }//Switch end PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); //Print actual instructions diff --git a/src/strings.c b/src/strings.c index 678e187c6c73..237ebb9d9aae 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1924,6 +1924,7 @@ const u8 gText_EVO_SPECIFIC_MON_IN_PARTY[] = _("LvlUp with {STR_VAR_2} const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[] = _("LvlUp with dark type in party"); const u8 gText_EVO_TRADE_SPECIFIC_MON[] = _("Traded for {STR_VAR_2}"); const u8 gText_EVO_SPECIFIC_MAP[] = _("LvlUp on {STR_VAR_2}"); +const u8 gText_EVO_UNKNOWN[] = _("Method unknown"); const u8 gText_EVO_NONE[] = _("{STR_VAR_1} has no evolution."); const u8 gText_FORMS_Buttons_PE[] = _("{A_BUTTON}EVOLUTIONS"); From d3911128f0f327d5b78369dd828444ad765e7758 Mon Sep 17 00:00:00 2001 From: Katelyn Gigante Date: Mon, 25 Oct 2021 13:25:56 +1100 Subject: [PATCH 45/88] Better compatibility --- src/pokedex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 1753427cd222..eea6cd88bdce 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -387,10 +387,10 @@ static void Task_SwitchScreensFromFormsScreen(u8 taskId); static void Task_ExitFormsScreen(u8 taskId); #endif -//COMPATIBILITY, delete if you are using a newer version +#ifndef TEXT_COLOR_LIGHT_GRAY // COMPATIBILITY #define TEXT_COLOR_LIGHT_GRAY TEXT_COLOR_LIGHT_GREY #define TEXT_COLOR_DARK_GRAY TEXT_COLOR_DARK_GREY -//COMPATIBILITY end +#endif //HGSS_UI Physical Special Split icon for BattleEngine (rhh) #ifdef BATTLE_ENGINE From a2eff37b3824787ab8b32eddf9418d9ac5041679 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Thu, 4 Nov 2021 17:53:12 +0100 Subject: [PATCH 46/88] added type icons to the "caught mon screen" --- src/pokedex.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 43385e22dedf..d271a7eb1b1f 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4247,6 +4247,9 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) } break; case 1: + sPokedexView = AllocZeroed(sizeof(struct PokedexView)); //for type icons + ResetPokedexView(sPokedexView); + LoadTilesetTilemapHGSS(INFO_SCREEN); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); @@ -4258,6 +4261,9 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) gTasks[taskId].tState++; break; case 2: + sPokedexView->typeIconSpriteIds[0] = 0xFF; + sPokedexView->typeIconSpriteIds[1] = 0xFF; + CreateTypeIconSprites(); gTasks[taskId].tState++; break; case 3: @@ -4300,6 +4306,8 @@ static void Task_HandleCaughtMonPageInput(u8 taskId) if (JOY_NEW(A_BUTTON | B_BUTTON)) { BeginNormalPaletteFade(0x0000FFFF, 0, 0, 16, RGB_BLACK); + SetSpriteInvisibility(0, TRUE); + SetSpriteInvisibility(1, TRUE); gSprites[gTasks[taskId].tMonSpriteId].callback = SpriteCB_SlideCaughtMonToCenter; gTasks[taskId].func = Task_ExitCaughtMonPage; } @@ -4421,13 +4429,17 @@ static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) sprite->pos1.y = y + 8; SetSpriteInvisibility(spriteArrayId, FALSE); } -static void PrintCurrentSpeciesTypeInfo(void) +static void PrintCurrentSpeciesTypeInfo(u8 newEntry, u16 species) { - u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); u32 i; u16 dexNum = SpeciesToNationalPokedexNum(species); u8 type1, type2; + if (!newEntry) + { + species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + dexNum = SpeciesToNationalPokedexNum(species); + } //type icon(s) #ifdef TX_DIFFICULTY_CHALLENGES_USED type1 = GetTypeBySpecies(species, 1); @@ -4472,7 +4484,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) { u8 str[16]; u8 str2[32]; - u16 natNum; + u16 species; const u8 *name; const u8 *category; const u8 *description; @@ -4485,9 +4497,9 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) value = num; ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); PrintInfoScreenTextWhite(str, 123, 17); //HGSS_Ui - natNum = NationalPokedexNumToSpecies(num); - if (natNum) - name = gSpeciesNames[natNum]; + species = NationalPokedexNumToSpecies(num); + if (species) + name = gSpeciesNames[species]; else name = sText_TenDashes2; PrintInfoScreenTextWhite(name, 157, 17); //HGSS_Ui @@ -4522,11 +4534,8 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) PrintInfoScreenText(description, GetStringCenterAlignXOffset(1, description, 0xF0), 93); //HGSS_Ui //Type Icon(s) //HGSS_Ui - if (owned && !newEntry) - { - description = gPokedexEntries[num].description; - PrintCurrentSpeciesTypeInfo(); //HGSS_Ui - } + if (owned) + PrintCurrentSpeciesTypeInfo(newEntry, species); //HGSS_Ui } static void PrintMonHeight(u16 height, u8 left, u8 top) From c1272f4e94bdf74facdfd358aa13c90bee605e1e Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Thu, 4 Nov 2021 20:40:58 +0100 Subject: [PATCH 47/88] fixed tilemap for PreEvo changes --- .../pokedex/HGSS_tilemap_evo_screen_PE.bin | Bin 1344 -> 1344 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/graphics/pokedex/HGSS_tilemap_evo_screen_PE.bin b/graphics/pokedex/HGSS_tilemap_evo_screen_PE.bin index 5cabb2e65b814c1f6157fea2adae0e6f45cef910..321af9d70703f440edfa4eb84ebd3aa9bd76cc80 100644 GIT binary patch delta 74 ucmX@Wb%1L^2cz}Gg_0B3@l0GNHQ9q{$K(b^4sBNkHy|X6+`O5wml*&Dr4gq9 delta 92 zcmX@Wb%1L^2cylzg_0B3@l0GN#pp2cpy9+{d|-OA6(f{U#mJ}a&fo@wu3!?x!UH#N IX6$7K03+xZ+yDRo From ebd6a7b29fac59df25ed68c62bba585bff2ed93e Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Wed, 10 Nov 2021 19:53:38 +0100 Subject: [PATCH 48/88] added split icons for better support of rhh's BattleEngine --- graphics/interface/split_icons.png | Bin 0 -> 5451 bytes src/pokedex.c | 6 ++---- 2 files changed, 2 insertions(+), 4 deletions(-) create mode 100644 graphics/interface/split_icons.png diff --git a/graphics/interface/split_icons.png b/graphics/interface/split_icons.png new file mode 100644 index 0000000000000000000000000000000000000000..1c7d63c9eb775ab15aefe3456b2ac3cb8c47ede7 GIT binary patch literal 5451 zcmV-R6}0M!P)T%~}000y3dQ@0+Qek%> zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3*tb|km4h5us}ZwZ)(WzBUvl1?m`cqpXUo6XV)LB`)jt28pU%en{r$y$Joxs! z2_G+bp3*Px6M4VKcb-qb-caKE{P_O7Df2x~eNXgp$@hdoSN1%3kE`#Af`6WO@9(C) z@9Xi)?Y#fDbr)~ld(iK{$3ihy;(Wmyzk>^w@AoQ!6@(f(KMUV|XkO1W9!GxbJdQut z&ZP8n@jf5@Ry*6@=fn3>7@OY%@^3YIpLgl!+T99$U6K2B+S;k^C&?@R5@S@oR# z++B~EN@erj)W@ydM;tgPWw>w4d=>srJTCXE@m0CSNyir59DGgVn)6iqxagMa?znw_ zPB&R%^xGGHdOv-*&(%dPHpXvQ-1$cIVSg8K5g7I&}P?)9dtTzNT;^p2A` z-tmVo^V5@m=j-!C=Lova+4|H8SgDPTx6-hPd}9Za{( zl^g7KJf|4R{lZqbeGVL#Y%~w(tt;z20VU$vVg?uJfXyx>mz^!%7w4#Br9YjO`w;!0 z11=@MoH_I+giLd)*R^?1araoC{PQ%_LL*Yhj7`Kad%@^K0$I!Wpo9rMxA@uCg@Xs@2x z>SFZjoO))PXDE`VYc8od%c)~@FmC75ai6{W)ww_In@RCM>YM*poil3P|Dtn7t$RE7 z$G-j0wbiepgxerZp=xTwf!I!*-Pi6%SfrKw%!`+>|7?4Iqfci`&_JUxW0Gpu2jQ)^wC1L+)H3edrNWkIp;b@ za#;6-o=f99zf+iVTn~rVh7rzboRs@L@X?uhxD(s(b)UXl_Y4o58a*#J*XE8C2>KnV z#R35007rAD*lng3b?)NJG1Ct&oc4N58`yCyetIe9O2>Gyl?>%uQn@Y25W=$M;ht)H{nn)2M%?XikWJ2VDr_*Cc2skUT?OKTjAR;aVw``kTk z*G4O29D7oq$6GCJ9PdgmcH{1Hb|9?A(NdY=&>Zh(3e_79sD8$NYGbT6MLs)bcqb;V zRLe}domuL|(T-u+au!RX(3Kh6+{G?#gQHtI28EWSJz=npZsd}}c40H@oEi|99;DI$ znqFk!23aJ)j*=V+i+S*tN?f{iw@&o;)`4W^rWj6ocbh-gt~A8bn;j-TEK^a}GX5-< zU}#ZGFu|ZEA%o<)ZCtg-z2U>i_}9gKRn;h;02_q1>Rij?``YK?xHaFC?FZa#;clQfMa*uqzrw%-ouLt-JI!Ahr%2Fa{nvXs6nJ;F(<901ji@i|q!l(}qpMXvLt7 zDV0vAX%(PI^w6B@)W}RD7aBg{!R_y8z*h`RD;s>5%VwP>p0KGzsOQeznYHwLG1E^@ zcV=wsV*%f(mfVB9(;ESFyT8-UK6fwEV>pVv7aOpzhI(a#f}lQ;@j(IPQ5KWqUbF}L znPEK+snB6ep2}zH2y*czb!ssX$FbWKRu^eAoCcs6VQ@g*LP^L=ZJOE547i$o$Ta}F z14|sQQCtwofXQ}k-i%SQKlGq4`>`?~@r{%mdd_sMj5Ai^N;ym#$1U5YTNX*d1Blm7 z9i>fVjOOTg&Wy4s-;Ukt#B0Uss^44UGBX7(hhBwVfjBf$;KF#^n8^AtIMxXk(U$@( z`ZN-9mz#H_5Cm_=42G$^6T%btffLf)Z8@P5>40J)dB&^>v+a({Mk0<~Bm2fuS8@~S z{En3`P(kNkm}%sJnfbsOiYKIXM52U^)WfK2ie0_NpsrU%LCrjs37KJwWJ6t)E*-O( zq_S`qhq-cs-CizZ_DKLt9g(5rJ$tFReK2!StC=J6zUxA`nAgw>-o%_X#Odg2U~Pqw z6#YOltZ}CF=tje8T)_-XJBOWiLA*T}7G@o0v{ck>S6Q-#1G+cq@G@t5h}^~p_3l0o zwDWU<4IhV|R%<5-2{D;;cB72p&c%PRGV`&tzqzt{auKyyqbCv`>y9PU3F}?qJ0F+- zdhxB3BB67{Eg@%+9&6FhJrN;b&u8%fcRJ359lbZzdSi`s^gmzs2u2mF1qyVD?{S<7 zbP>@J8$j_9V9{qr9CvEPfuMWCj1i*<1+a*P5a9eBRGVSj!$Labd1|ICE@LOxjwHWU zTxK})&Q%*8g%blt8wsXJIA_F{!p;osDK(?h`=DBjJD3Z@=44P0Gll){vHF;KrtW^R z&Ac;jXcs(*+M(Szw$(U6eV7!F)FmJ>X{+L||4ayg!F+h%bjQSL?hHzRnK~-9@VFI+ zI9U9I9!G=Q#$E>uJl*mxmNm9Ndk@28YXZx)J`5LN+%IEyNwAuU+;surltgV^7N??SOT0wWWczf#JNL) zGX&|3D~V$&0B430!4GcE5WVaT2%$^Z7Lel-z9c?&G<47gKa935-T;(fC73B(E}$Ha zj7B)7dYlHR0|Z3&S@8aDy9$`+RqPFb#n*hAHW=XAwq1<9RT%q9FFMb#K>;CH27FVab1>0FzhgCuJ;cV6tcU%PqK4h3*>T@zCUn5!4h@L~t> zkee{UEyqQe=rC!HOr!);K&xbKP6KMDgb|*C4~Y*zV&$8UA_5D87z-0oPB)?l{$K?U z3d}IQv5SBA!nn1})smnLA#=AiY7X$_;nNS8m88cNisocYjzSAb8h?+;!4Z=HXSNC* z%m;+*uf}+fA=D<=H4y-)8^Sr%PRJe5qy~EeXP;%y=`vUCT#sP$Sco0aDNQy7Rl`JX z^BPTaou+&ymL9iCT-b7h)bKi#Z&r0;EUu0z%glY|&~^ZqP3RgHkN0^Bg}0M7MhDLF za%aW?2?PZ@&JmMhW~^ztx}pQx07iq3*ui|=3{PiEJ~j_tfHQZzs+5VS-+=Oj zQxPcixeXp-_wapvO|C%qNj`?rBFa!MwU(i{#uzjZmkts1WX5SJRD%C7C?*%&jv;%z z+GcFQ_6pczwCQ>UF9p_M5J@EVA4VZ}l$aU<9_=KoEqpue`g)=}dEvOK+<$`5K1nay zv|eFERXs}-lvu!$owvsk}o2)BO z!kP$!-RDfAMrkQBy1!@)g$HI<{&k&Z@Y?_nz6?0yp0&l4EZl)6bh&Idxz6KS)WvI!z%@GC|Y8DzTYxCuUY!;*t}YmTPtJ@2FJyVJv_XsX}dNh+{}(C9#LZ1A26n*xvn#Uzv>o_8IsPQ_nQ(5TEBA4Ez(uF=lk+S_4f=Wpx`G z10WNOFv>(Yq9%z)?CfS{P-dwOya`wa)!v1+vu14=a#fT?n~?BTO|oc2;U=VML#ASaAtYOdNrSMX z?ZFnO@=dpO!t)Z4Wv`fF0UvwXZQR$i9=%_vOEELm_kNhQqnW!2=hA}W{Y5mS0Y@c- z!C`udsdBPc6hqk6CuoishnpxeswRx}C}yc>Egt=D%RUbMXD%O*48d{Ca@{W=xNd~t zr+qn=DF?B3Xb*NEy*qg*;pYnFn4)h*b_aioD^AQZO9Fc+?OoEh1>Mk4G(oY`3V0@@ z19|vC+JkejAhg6qZo@U^XNPdi#~NYYXO$YS^lTognkX;JT=-7T8Rcu}R8P)z8J@^^z=9SZ}*$NcM4&Ag&sTuYO_rRH(&G$e#g}&E>$Ai^tm0Y3vpnAf-g#aot=JCw4 zC5lbFLuWy`FH5a~KwSmIErB0Nb4Y&E)TT|&mVA>Jz1y9bPo#cE2O|464cJ`X)=QairW5t!6_|iiAnXtbT-Yr%KW}cPPNoN{g+HOVuKhItMpOjb+VVuiVr32x zUNi&lLB&_#8mymW3v}VVahM$d4zA2}nR3z)S>G_V;ok@vPznq^@YV~Sg;|5QCF5v0 zd(kBjxFZqm4MruHn&ssWVtkBm49R{s2VcB_lL_GMc<_{>746s@i2A-C!T{aygw=q1gHv9(I;{Gl*B!bkCUQSn97ND$oT9D zo;!M}z7-L$7)#!)z)#pmgpnXwZ6d^D!8fMzbQw?NJe~T;Qwk(VA_h*s2J8u0mT6cH z09>*dL1@F8D&GcalY--%EAt;Zb7#&e;%q#mHa>_B14fmKi9E+lPbjtx3ED&9eoy8WP>7s0ZO!(Sav_0$ zbluCuXo3fAw+$x&o+_w#ZbTvk?1EGdbO;6iSKaa<-dJBzoS~0NGH(uY2oPRzJx9Y$ zC(7do?{)f zt93j*v)&3eB0&G}4z|2fs;zy!5cG*2!a`JQC@sq*2}o%aX%=AgJLxlN2l2TkYes{S zbV9=A2oi+?i7%7VyB60NBOCEBZV^g`$(AbPw697@7;|khoQ*oruA^9dKSyFc3)gi& z9c)9pC`4EDFrAah$EriAM955lg%MC6rh!~Bi4}6TC)cWd769UVwlH_ek)q2$!AJ1u z^Lb2;YbhyV`aa+-^pd+n!^{3yHb^fx{xDFWlusL zUQ8eLWd>P)EEa^L;uegwP)lvQ;5H4^0XQ9bDYig<#UnC#aARb;xYUyH(`;tB@ov&F zfe9GSDPICfovc4SI7~k@_k0FQsG1*Juspnu$kz+P-ku$$Yivfoxu8?&-SfNeEu*zp zlNpS-T$Tmp;nBzA+2|bJ>93sBd_C*ele)cpS~L9BQ<|R_`tMH(Kx{tszM(=Yrl2Z8 zK1INyfO0nwlJ>_pNz8)?RPksZYd3w)eUww7LyamS67Qub72u=&Ziahp(7>BSrvC@b zB>vHF`t5!I001yhOjJdW@v-rNF~Kn@xuN+|L0004EOGiWihy@);00009a7bBm000tn000tn0p4aGcmMzZ z2XskIMF-*s9T6%H5}C=&EHf&l5a7feM{K zTei||1U))--xxx)cu@bVx^5l2S6F50i(3ih9R|*9a>8Do}jPE*cn%Me&-16 zpXerjY)j|_*n|R*0+CIO$+?*kJW;fakdp0)M4l0?bHVfSOf>QGBRc2LfB$FK&=sf| z6(E<^YGz Date: Sat, 27 Nov 2021 20:56:04 +0100 Subject: [PATCH 49/88] Reworked stats screen to use windows --- src/pokedex.c | 400 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 274 insertions(+), 126 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 64861df37786..4fce304294df 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -363,6 +363,7 @@ static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value, u32 owned static void PrintStatsScreen_DestroyMoveItemIcon(u8 taskId); static void PrintStatsScreen_MoveNameAndInfo(u8 taskId); static void PrintStatsScreen_Left(u8 taskId); +static void PrintStatsScreen_Abilities(u8 taskId); static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top); static void PrintInfoScreenTextSmall(const u8* str, u8 left, u8 top); static void PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top); @@ -1191,6 +1192,100 @@ static const struct WindowTemplate sInfoScreen_WindowTemplates[] = .paletteNum = 15, .baseBlock = 641, }, + + DUMMY_WIN_TEMPLATE +}; + +#define WIN_STATS_TOPBAR 0 +#define WIN_STATS_SIDEBAR 1 +#define WIN_STATS_NAME_GENDER 2 +#define WIN_STATS_LEFT 3 +#define WIN_STATS_NAVIGATION_BUTTONS 4 +#define WIN_STATS_MOVES 5 +#define WIN_STATS_ABILITIES 6 +#define WIN_STATS_LEFT_UNUSED 7 +static const struct WindowTemplate sStatsScreen_WindowTemplates[] = +{ + [WIN_STATS_TOPBAR] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 0, + .width = 30, + .height = 2, + .paletteNum = 0, + .baseBlock = 1, + }, + [WIN_STATS_SIDEBAR] = + { + .bg = 2, + .tilemapLeft = 30, + .tilemapTop = 0, + .width = 2, + .height = 20, + .paletteNum = 0, + .baseBlock = 1 + 60, + }, + [WIN_STATS_NAME_GENDER] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 2, + .width = 12, + .height = 4, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40, + }, + [WIN_STATS_LEFT] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 6, + .width = 12, + .height = 8, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48, + }, + [WIN_STATS_NAVIGATION_BUTTONS] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 18, + .width = 12, + .height = 2, + .paletteNum = 15, + .baseBlock = 1 + 60 + 40 + 48 + 96, + }, + [WIN_STATS_MOVES] = + { + .bg = 2, + .tilemapLeft = 12, + .tilemapTop = 2, + .width = 18, + .height = 10, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24, + }, + [WIN_STATS_ABILITIES] = + { + .bg = 2, + .tilemapLeft = 12, + .tilemapTop = 12, + .width = 18, + .height = 8, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 180, + }, + [WIN_STATS_LEFT_UNUSED] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 14, + .width = 12, + .height = 4, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 180 + 144, + }, DUMMY_WIN_TEMPLATE }; @@ -3502,6 +3597,25 @@ static void PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top) AddTextPrinterParameterized4(0, 0, left, top, 0, 0, color, 0, str); } +//Stats screen +static void PrintStatsScreenTextSmall(u8 windowId, const u8* str, u8 left, u8 top) +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_DYNAMIC_COLOR_6; + color[2] = TEXT_COLOR_LIGHT_GRAY; + + AddTextPrinterParameterized4(windowId, 0, left, top, 0, 0, color, 0, str); +} +static void PrintStatsScreenTextSmallWhite(u8 windowId, const u8* str, u8 left, u8 top) +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_COLOR_WHITE; + color[2] = TEXT_DYNAMIC_COLOR_6; + + AddTextPrinterParameterized4(windowId, 0, left, top, 0, 0, color, 0, str); +} #define tScrolling data[0] @@ -6201,12 +6315,12 @@ static void StatsPage_PrintAToggleUpdownMoves(void) u8 x = 9; u8 y = 0; if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons); + AddTextPrinterParameterized3(WIN_STATS_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons); else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons_Decapped); + AddTextPrinterParameterized3(WIN_STATS_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons_Decapped); // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) - PutWindowTilemap(WIN_NAVIGATION_BUTTONS); - CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); + PutWindowTilemap(WIN_STATS_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_STATS_NAVIGATION_BUTTONS, 3); } #define tMonSpriteId data[4] static void Task_LoadStatsScreen(u8 taskId) @@ -6233,12 +6347,38 @@ static void Task_LoadStatsScreen(u8 taskId) break; case 1: LoadTilesetTilemapHGSS(STATS_SCREEN); - FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); - PutWindowTilemap(WIN_INFO); - CopyWindowToVram(WIN_INFO, 3); - FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); - PutWindowTilemap(WIN_NAVIGATION_BUTTONS); - CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); + + FreeAllWindowBuffers(); + InitWindows(sStatsScreen_WindowTemplates); + + FillWindowPixelBuffer(WIN_STATS_TOPBAR, PIXEL_FILL(0)); + PutWindowTilemap(WIN_STATS_TOPBAR); + CopyWindowToVram(WIN_STATS_TOPBAR, 3); + + FillWindowPixelBuffer(WIN_STATS_NAME_GENDER, PIXEL_FILL(0)); + PutWindowTilemap(WIN_STATS_NAME_GENDER); + CopyWindowToVram(WIN_STATS_NAME_GENDER, 3); + + FillWindowPixelBuffer(WIN_STATS_LEFT, PIXEL_FILL(0)); + PutWindowTilemap(WIN_STATS_LEFT); + CopyWindowToVram(WIN_STATS_LEFT, 3); + + FillWindowPixelBuffer(WIN_STATS_NAVIGATION_BUTTONS, PIXEL_FILL(0)); + PutWindowTilemap(WIN_STATS_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_STATS_NAVIGATION_BUTTONS, 3); + + FillWindowPixelBuffer(WIN_STATS_MOVES, PIXEL_FILL(0)); + PutWindowTilemap(WIN_STATS_MOVES); + CopyWindowToVram(WIN_STATS_MOVES, 3); + + FillWindowPixelBuffer(WIN_STATS_ABILITIES, PIXEL_FILL(0)); + PutWindowTilemap(WIN_STATS_ABILITIES); + CopyWindowToVram(WIN_STATS_ABILITIES, 3); + + FillWindowPixelBuffer(WIN_STATS_LEFT_UNUSED, PIXEL_FILL(0)); + PutWindowTilemap(WIN_STATS_LEFT_UNUSED); + CopyWindowToVram(WIN_STATS_LEFT_UNUSED, 3); + CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(3); @@ -6291,6 +6431,7 @@ static void Task_LoadStatsScreen(u8 taskId) FillWindowPixelRect(0, PIXEL_FILL(0), 0, 48, 240, 130); PrintStatsScreen_NameGender(taskId, sPokedexListItem->dexNum, sPokedexView->dexMode == DEX_MODE_HOENN ? FALSE : TRUE, sPokedexListItem->owned, 0); PrintStatsScreen_Left(taskId); + PrintStatsScreen_Abilities(taskId); PrintStatsScreen_MoveNameAndInfo(taskId); if (!sPokedexListItem->owned) LoadPalette(gPlttBufferUnfaded + 1, 0x31, 0x1E); @@ -6365,9 +6506,17 @@ static void Task_HandleStatsScreenInput(u8 taskId) gTasks[taskId].data[5] = 1; else gTasks[taskId].data[5] = 0; - FillWindowPixelRect(0, PIXEL_FILL(0), 0, 48, 240, 130); + + FillWindowPixelBuffer(WIN_STATS_LEFT, PIXEL_FILL(0)); PrintStatsScreen_Left(taskId); + + #ifdef POKEMON_EXPANSION + FillWindowPixelBuffer(WIN_STATS_ABILITIES, PIXEL_FILL(0)); + PrintStatsScreen_Abilities(taskId) + #endif + PrintStatsScreen_DestroyMoveItemIcon(taskId); + FillWindowPixelBuffer(WIN_STATS_MOVES, PIXEL_FILL(0)); PrintStatsScreen_MoveNameAndInfo(taskId); } if (JOY_NEW(B_BUTTON)) @@ -6383,7 +6532,7 @@ static void Task_HandleStatsScreenInput(u8 taskId) { sPokedexView->moveSelected -= 1; PlaySE(SE_SELECT); - FillWindowPixelRect(0, PIXEL_FILL(0), 96, 16, 144, 80); + FillWindowPixelBuffer(WIN_STATS_MOVES, PIXEL_FILL(0)); PrintStatsScreen_DestroyMoveItemIcon(taskId); PrintStatsScreen_MoveNameAndInfo(taskId); } @@ -6391,7 +6540,7 @@ static void Task_HandleStatsScreenInput(u8 taskId) { sPokedexView->moveSelected = sPokedexView->moveSelected + 1; PlaySE(SE_SELECT); - FillWindowPixelRect(0, PIXEL_FILL(0), 96, 16, 144, 80); + FillWindowPixelBuffer(WIN_STATS_MOVES, PIXEL_FILL(0)); PrintStatsScreen_DestroyMoveItemIcon(taskId); PrintStatsScreen_MoveNameAndInfo(taskId); } @@ -6483,8 +6632,8 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) u16 move; u16 item; - u8 moves_x = 101; - u8 moves_y = 19; + u8 moves_x = 5; //101; + u8 moves_y = 3; //19; u8 level = 0; @@ -6499,7 +6648,7 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) move = sStatsMovesEgg[sPokedexView->moveSelected]; StringCopy(gStringVar3, gMoveNames[move]); StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); - PrintInfoScreenTextSmall(gText_ThreeDashes, moves_x + 113, moves_y + 9); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_ThreeDashes, moves_x + 113, moves_y + 9); item = ITEM_LUCKY_EGG; } else if (selected < (numEggMoves + numLevelUpMoves)) @@ -6520,8 +6669,8 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) } #endif ConvertIntToDecimalStringN(gStringVar1, level, STR_CONV_MODE_LEFT_ALIGN, 3); //Move learn lvl - PrintInfoScreenTextSmall(gText_Stats_MoveLevel, moves_x + 113, moves_y + 3); //Level text - PrintInfoScreenTextSmall(gStringVar1, moves_x + 113, moves_y + 14); //Print level + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_Stats_MoveLevel, moves_x + 113, moves_y + 3); //Level text + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar1, moves_x + 113, moves_y + 14); //Print level item = ITEM_EXP_SHARE; } else if (selected < (numEggMoves + numLevelUpMoves + numTMHMMoves)) @@ -6530,7 +6679,7 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) StringCopy(gStringVar3, gMoveNames[move]); StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); CopyItemName(sStatsMovesTMHM_ID[(selected-numEggMoves-numLevelUpMoves)], gStringVar1); //TM name - PrintInfoScreenTextSmall(gStringVar1, moves_x + 113, moves_y + 9); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar1, moves_x + 113, moves_y + 9); item = sStatsMovesTMHM_ID[(selected-numEggMoves-numLevelUpMoves)]; } else if (selected < (numEggMoves + numLevelUpMoves + numTMHMMoves + numTutorMoves)) @@ -6538,7 +6687,7 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) move = sStatsMovesTutor[sPokedexView->moveSelected - numEggMoves - numLevelUpMoves - numTMHMMoves]; StringCopy(gStringVar3, gMoveNames[move]); StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); - PrintInfoScreenTextSmall(gText_ThreeDashes, moves_x + 113, moves_y + 9); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_ThreeDashes, moves_x + 113, moves_y + 9); item = ITEM_TEACHY_TV; } else @@ -6550,11 +6699,11 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) //Move name and description StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 20); - PrintInfoScreenTextSmall(gStringVar3, moves_x, moves_y + 17); //Name + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar3, moves_x, moves_y + 17); //Name if (gTasks[taskId].data[5] == 0) - PrintInfoScreenTextSmall(gStringVar4, moves_x, moves_y + 34); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar4, moves_x, moves_y + 34); else - PrintInfoScreenTextSmall(gContestEffectDescriptionPointers[gContestMoves[move].effect], moves_x, moves_y + 34); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gContestEffectDescriptionPointers[gContestMoves[move].effect], moves_x, moves_y + 34); //Egg/TM/Level/Tutor Item Icon @@ -6567,29 +6716,29 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, (selected+1), STR_CONV_MODE_RIGHT_ALIGN, 3); ConvertIntToDecimalStringN(gStringVar2, total, STR_CONV_MODE_RIGHT_ALIGN, 3); StringExpandPlaceholders(gStringVar1, gText_Stats_MoveSelectedMax); - PrintInfoScreenTextSmallWhite(gStringVar1, moves_x-1, moves_y+1); + PrintStatsScreenTextSmallWhite(WIN_STATS_MOVES, gStringVar1, moves_x-1, moves_y+1); if (gTasks[taskId].data[5] == 0) { //Power - PrintInfoScreenTextSmall(gText_Power, moves_x + 3, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_Power, moves_x + 3, moves_y + 64); if (gBattleMoves[move].power < 2) StringCopy(gStringVar1, gText_ThreeDashes); else ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(gStringVar1, moves_x + 48, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar1, moves_x + 48, moves_y + 64); //Physical/Special Split from BE #ifdef BATTLE_ENGINE DestroySplitIcon(); ShowSplitIcon(GetBattleMoveSplit(move)); #endif //Accuracy - PrintInfoScreenTextSmall(gText_Accuracy2, moves_x + 69, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_Accuracy2, moves_x + 69, moves_y + 64); if (gBattleMoves[move].accuracy == 0) StringCopy(gStringVar1, gText_ThreeDashes); else ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].accuracy, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(gStringVar1, moves_x + 117, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar1, moves_x + 117, moves_y + 64); } else { @@ -6598,7 +6747,7 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) gSprites[sPokedexView->splitIconSpriteId].invisible = TRUE; #endif //Appeal - PrintInfoScreenTextSmall(gText_Appeal, moves_x + 3, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_Appeal, moves_x + 3, moves_y + 64); contest_appeal = 0; contest_effectValue = gContestEffects[gContestMoves[move].effect].appeal; if (contest_effectValue != 0xFF) @@ -6611,10 +6760,10 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, contest_appeal, STR_CONV_MODE_RIGHT_ALIGN, 1); StringCopy(gStringVar2, gText_PlusSymbol); StringAppend(gStringVar2, gStringVar1); - PrintInfoScreenTextSmall(gStringVar2, moves_x + 48, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar2, moves_x + 48, moves_y + 64); //Jam - PrintInfoScreenTextSmall(gText_Jam, moves_x + 69, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_Jam, moves_x + 69, moves_y + 64); contest_jam = 0; contest_effectValue = gContestEffects[gContestMoves[move].effect].jam; if (contest_effectValue != 0xFF) @@ -6627,18 +6776,18 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, contest_jam, STR_CONV_MODE_RIGHT_ALIGN, 1); StringCopy(gStringVar2, gText_Stats_Minus); StringAppend(gStringVar2, gStringVar1); - PrintInfoScreenTextSmall(gStringVar2, moves_x + 122, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar2, moves_x + 122, moves_y + 64); } //Draw move type icon if (gTasks[taskId].data[5] == 0) { - SetTypeIconPosAndPal(gBattleMoves[move].type, moves_x + 50, moves_y+1, 0); + SetTypeIconPosAndPal(gBattleMoves[move].type, moves_x + 146, moves_y + 17, 0); SetSpriteInvisibility(1, TRUE); } else { - SetTypeIconPosAndPal(NUMBER_OF_MON_TYPES + gContestMoves[move].contestCategory, moves_x + 50, moves_y+1, 1); + SetTypeIconPosAndPal(NUMBER_OF_MON_TYPES + gContestMoves[move].contestCategory, moves_x + 146, moves_y + 17, 1); SetSpriteInvisibility(0, TRUE); } } @@ -6655,15 +6804,13 @@ static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value, u32 owned const u8 *description; const u8 *strEVtype; - u8 gender_x, gender_y; + u8 base_x = 38; + u8 base_y = 0; - u8 base_i = 0; - u8 base_y_offset = 11; - u8 base_x = 8; - u8 base_y = 52; + u8 gender_x, gender_y; //Name - PrintInfoScreenTextSmall(gSpeciesNames[species], 38, 16); + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gSpeciesNames[species], base_x, base_y); //Number if (value == 0) @@ -6671,36 +6818,36 @@ static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value, u32 owned else value = num; ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); - PrintInfoScreenTextSmall(str, 38, 26); + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, str, base_x, base_y + 10); //Gender ratio //MON_GENDERLESS == 0xFF - gender_x = 38; - gender_y = 36; + gender_x = base_x; + gender_y = base_y + 20; switch (gBaseStats[species].genderRatio) { case 0: - PrintInfoScreenTextSmall(gText_Stats_Gender_0, gender_x, gender_y); + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_0, gender_x, gender_y); break; case 31: - PrintInfoScreenTextSmall(gText_Stats_Gender_12_5, gender_x, gender_y); + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_12_5, gender_x, gender_y); break; case 63: - PrintInfoScreenTextSmall(gText_Stats_Gender_25, gender_x, gender_y); + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_25, gender_x, gender_y); break; case 127: - PrintInfoScreenTextSmall(gText_Stats_Gender_50, gender_x, gender_y); + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_50, gender_x, gender_y); break; case 191: - PrintInfoScreenTextSmall(gText_Stats_Gender_75, gender_x, gender_y); + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_75, gender_x, gender_y); break; case 223: - PrintInfoScreenTextSmall(gText_Stats_Gender_87_5, gender_x, gender_y); + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_87_5, gender_x, gender_y); break; case 254: - PrintInfoScreenTextSmall(gText_Stats_Gender_100, gender_x, gender_y); + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_100, gender_x, gender_y); break; default: - PrintInfoScreenTextSmall(gText_ThreeDashes, gender_x, gender_y); + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_ThreeDashes, gender_x, gender_y); break; } } @@ -6745,66 +6892,54 @@ static void PrintStatsScreen_Left(u8 taskId) u8 base_x_second_row = 43; u8 base_y_offset = 11; u8 base_i = 0; - u8 base_y = 52; + u8 base_y = 5; u32 align_x; - u8 total_x = 93; + u8 total_x = 85; u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); u8 strEV[25]; u8 strBase[14]; - u8 abilities_x = 101; - u8 abilities_y = 99; - u8 ability0; - u8 ability1; - u8 abilityHidden; u8 differentEVs = 0; u8 EVs[6] = {gBaseStats[species].evYield_HP, gBaseStats[species].evYield_Speed, gBaseStats[species].evYield_Attack, gBaseStats[species].evYield_SpAttack, gBaseStats[species].evYield_Defense, gBaseStats[species].evYield_SpDefense}; - + u8 i; //Base stats if (gTasks[taskId].data[5] == 0) { - PrintInfoScreenTextSmall(gText_Stats_HP, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_HP, base_x, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseHP, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); - PrintInfoScreenTextSmall(gText_Stats_Speed, base_x+base_x_second_row, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Speed, base_x+base_x_second_row, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpeed, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); base_i++; - PrintInfoScreenTextSmall(gText_Stats_Attack, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Attack, base_x, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); - PrintInfoScreenTextSmall(gText_Stats_SpAttack, base_x+base_x_second_row, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_SpAttack, base_x+base_x_second_row, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); base_i++; - PrintInfoScreenTextSmall(gText_Stats_Defense, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Defense, base_x, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); - PrintInfoScreenTextSmall(gText_Stats_SpDefense, base_x+base_x_second_row, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_SpDefense, base_x+base_x_second_row, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); base_i++; } else //EV increases { //Count how many different EVs - if (EVs[0] > 0) //HP - differentEVs++; - if (EVs[1] > 0) //Speed - differentEVs++; - if (EVs[2] > 0) //Attack - differentEVs++; - if (EVs[3] > 0) //Special Attack - differentEVs++; - if (EVs[4] > 0) //Defense - differentEVs++; - if (EVs[5] > 0) //Special Defense - differentEVs++; + for (i = 0; i<6; i++) + { + if (EVs[i] > 0) //HP//Speed//Attack//Special Attack//Defense//Special Defense + differentEVs++; + } //If 1 or 2 EVs display with the same layout as the base stats if (differentEVs < 3) @@ -6819,7 +6954,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_HP); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 0); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } if (gBaseStats[species].evYield_Speed > 0) //Speed @@ -6830,7 +6965,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_Speed); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 1); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } if (gBaseStats[species].evYield_Attack > 0) //Attack @@ -6841,7 +6976,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_Attack); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 2); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } if (gBaseStats[species].evYield_SpAttack > 0) //Special Attack @@ -6852,7 +6987,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_SpAttack); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 3); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } if (gBaseStats[species].evYield_Defense > 0) //Defense @@ -6863,7 +6998,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_Defense); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 4); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } if (gBaseStats[species].evYield_SpDefense > 0) //Special Defense @@ -6874,7 +7009,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_SpDefense); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 5); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } } else //3 different EVs in 1 row @@ -6885,7 +7020,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_HP); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 0); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } @@ -6894,7 +7029,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_Speed); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 1); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } @@ -6903,7 +7038,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_Attack); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 2); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } @@ -6912,7 +7047,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_SpAttack); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 3); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } @@ -6921,7 +7056,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_Defense); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 4); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } @@ -6930,7 +7065,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(gStringVar1, gText_Stats_SpDefense); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 5); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintInfoScreenTextSmall(gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } } @@ -6941,23 +7076,23 @@ static void PrintStatsScreen_Left(u8 taskId) if (gTasks[taskId].data[5] == 0) { //Catch rate - PrintInfoScreenTextSmall(gText_Stats_CatchRate, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate, base_x, base_y + base_y_offset*base_i); if (gBaseStats[species].catchRate <= 10) - PrintInfoScreenTextSmall(gText_Stats_CatchRate_Legend, base_x + x_offset_column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Legend, base_x + x_offset_column, base_y + base_y_offset*base_i); else if (gBaseStats[species].catchRate <= 70) - PrintInfoScreenTextSmall(gText_Stats_CatchRate_VeryHard, base_x + x_offset_column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_VeryHard, base_x + x_offset_column, base_y + base_y_offset*base_i); else if (gBaseStats[species].catchRate <= 100) - PrintInfoScreenTextSmall(gText_Stats_CatchRate_Difficult, base_x + x_offset_column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Difficult, base_x + x_offset_column, base_y + base_y_offset*base_i); else if (gBaseStats[species].catchRate <= 150) - PrintInfoScreenTextSmall(gText_Stats_CatchRate_Medium, base_x + x_offset_column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Medium, base_x + x_offset_column, base_y + base_y_offset*base_i); else if (gBaseStats[species].catchRate <= 200) - PrintInfoScreenTextSmall(gText_Stats_CatchRate_Relaxed, base_x + x_offset_column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Relaxed, base_x + x_offset_column, base_y + base_y_offset*base_i); else - PrintInfoScreenTextSmall(gText_Stats_CatchRate_Easy, base_x + x_offset_column, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Easy, base_x + x_offset_column, base_y + base_y_offset*base_i); base_i++; //Growth rate - PrintInfoScreenTextSmall(gText_Stats_Growthrate, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Growthrate, base_x, base_y + base_y_offset*base_i); switch (gBaseStats[species].growthRate) { case GROWTH_MEDIUM_FAST: @@ -6982,18 +7117,18 @@ static void PrintStatsScreen_Left(u8 taskId) break; } align_x = GetStringRightAlignXOffset(0, strEV, total_x); - PrintInfoScreenTextSmall(strEV, align_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strEV, align_x, base_y + base_y_offset*base_i); } else { //Exp Yield - PrintInfoScreenTextSmall(gText_Stats_ExpYield, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_ExpYield, base_x, base_y + base_y_offset*base_i); ConvertIntToDecimalStringN(gStringVar1, gBaseStats[species].expYield, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintInfoScreenTextSmall(gStringVar1, base_x + base_x_offset, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar1, base_x + base_x_offset, base_y + base_y_offset*base_i); base_i++; //Friendship - PrintInfoScreenTextSmall(gText_Stats_Friendship, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Friendship, base_x, base_y + base_y_offset*base_i); switch (gBaseStats[species].friendship) { case 35: @@ -7016,18 +7151,18 @@ static void PrintStatsScreen_Left(u8 taskId) break; } align_x = GetStringRightAlignXOffset(0, strEV, total_x); - PrintInfoScreenTextSmall(strEV, align_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strEV, align_x, base_y + base_y_offset*base_i); base_i++; //Egg cycles if (gBaseStats[species].eggGroup1 == EGG_GROUP_UNDISCOVERED || gBaseStats[species].eggGroup2 == EGG_GROUP_UNDISCOVERED) //Species without eggs (legendaries etc) { - PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); - PrintInfoScreenTextSmall(gText_ThreeDashes, 78, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_ThreeDashes, 78, base_y + base_y_offset*base_i); } else { - PrintInfoScreenTextSmall(gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); if (gBaseStats[species].eggCycles <= 10) { StringCopy(strEV, gText_Stats_EggCycles_VeryFast); @@ -7048,7 +7183,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(strEV, gText_Stats_EggCycles_Slow); align_x = 67; } - PrintInfoScreenTextSmall(strEV, align_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strEV, align_x, base_y + base_y_offset*base_i); } base_i++; @@ -7154,42 +7289,51 @@ static void PrintStatsScreen_Left(u8 taskId) } StringExpandPlaceholders(gStringVar3, gText_Stats_eggGroup_Groups); align_x = GetStringRightAlignXOffset(0, gStringVar3, total_x); - PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x, base_y + base_y_offset*base_i); } else { align_x = GetStringRightAlignXOffset(0, gStringVar1, total_x); - PrintInfoScreenTextSmall(gStringVar1, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar1, base_x, base_y + base_y_offset*base_i); } base_i++; } - - +} +static void PrintStatsScreen_Abilities(u8 taskId) +{ + u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + u8 abilities_x = 5; + u8 abilities_y = 3; + u8 ability0; + u8 ability1; + u8 abilityHidden; //Abilitie(s) + #ifdef POKEMON_EXPANSION if (gTasks[taskId].data[5] == 0) - { + { + #endif ability0 = GetAbilityBySpecies(species, 0); //gBaseStats[species].abilities[0]; - PrintInfoScreenTextSmallWhite(gAbilityNames[ability0], abilities_x, abilities_y); - PrintInfoScreenTextSmall(gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); + PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability0], abilities_x, abilities_y); + PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); ability1 = GetAbilityBySpecies(species, 1); if (ability1 != ABILITY_NONE) //(gBaseStats[species].abilities[1] != ABILITY_NONE) { - PrintInfoScreenTextSmallWhite(gAbilityNames[ability1], abilities_x, abilities_y + 30); - PrintInfoScreenTextSmall(gAbilityDescriptionPointers[ability1], abilities_x, abilities_y + 44); - } + PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability1], abilities_x, abilities_y + 30); + PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[ability1], abilities_x, abilities_y + 44); + } + #ifdef POKEMON_EXPANSION } - #ifdef POKEMON_EXPANSION else //Hidden abilities { abilityHidden = GetAbilityBySpecies(species, 2); - PrintInfoScreenTextSmallWhite(gAbilityNames[abilityHidden], abilities_x, abilities_y); - PrintInfoScreenTextSmall(gAbilityDescriptionPointers[abilityHidden], abilities_x, abilities_y + 14); + PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[abilityHidden], abilities_x, abilities_y); + PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[abilityHidden], abilities_x, abilities_y + 14); } #endif - } + static void Task_SwitchScreensFromStatsScreen(u8 taskId) { if (!gPaletteFade.active) @@ -7205,12 +7349,16 @@ static void Task_SwitchScreensFromStatsScreen(u8 taskId) switch (sPokedexView->screenSwitchState) { case 1: + FreeAllWindowBuffers(); + InitWindows(sInfoScreen_WindowTemplates); gTasks[taskId].func = Task_LoadAreaScreen; break; case 2: gTasks[taskId].func = Task_LoadCryScreen; break; case 3: + FreeAllWindowBuffers(); + InitWindows(sInfoScreen_WindowTemplates); gTasks[taskId].func = Task_LoadEvolutionScreen; break; default: From 3acc0f4e9473be3a9940b1bf2f81571dd2beb7c6 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sat, 27 Nov 2021 23:04:09 +0100 Subject: [PATCH 50/88] further improved the windows, reworked a lot of code, massivly reduced the flickering on the stats page --- src/pokedex.c | 356 ++++++++++++++++++++++++++++---------------------- 1 file changed, 200 insertions(+), 156 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 4fce304294df..45c417aa8ee0 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -140,11 +140,8 @@ static EWRAM_DATA u16 sLastSelectedPokemon = 0; static EWRAM_DATA u8 sPokeBallRotation = 0; static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL; //Pokedex Plus HGSS_Ui -EWRAM_DATA static u16 sStatsMovesLevelUp[EGG_LVL_UP_MOVES_ARRAY_COUNT] = {0}; -EWRAM_DATA static u16 sStatsMovesEgg[EGG_MOVES_ARRAY_COUNT] = {0}; -EWRAM_DATA static u16 sStatsMovesTMHM[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; +EWRAM_DATA static u16 sStatsMoves[EGG_LVL_UP_MOVES_ARRAY_COUNT + EGG_MOVES_ARRAY_COUNT + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + TUTOR_MOVE_COUNT] = {0}; EWRAM_DATA static u16 sStatsMovesTMHM_ID[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; -EWRAM_DATA static u16 sStatsMovesTutor[TUTOR_MOVE_COUNT] = {0}; // This is written to, but never read. u8 gUnusedPokedexU8; @@ -205,7 +202,7 @@ struct PokedexView u16 monSpriteIds[MAX_MONS_ON_SCREEN]; u8 typeIconSpriteIds[2]; //HGSS_Ui u16 moveSelected; //HGSS_Ui - u8 moveMax; //HGSS_Ui + u8 movesTotal; //HGSS_Ui u8 statBarsSpriteId; //HGSS_Ui u8 statBarsBgSpriteId; //HGSS_Ui bool8 justScrolled; //HGSS_Ui @@ -359,9 +356,11 @@ static void Task_LoadStatsScreen(u8 taskId); static void Task_SwitchScreensFromStatsScreen(u8 taskId); static void Task_ExitStatsScreen(u8 taskId); static bool8 CalculateMoves(void); -static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry); +static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value); static void PrintStatsScreen_DestroyMoveItemIcon(u8 taskId); -static void PrintStatsScreen_MoveNameAndInfo(u8 taskId); +static void PrintStatsScreen_Moves_Top(u8 taskId); +static void PrintStatsScreen_Moves_Description(u8 taskId); +static void PrintStatsScreen_Moves_Bottom(u8 taskId); static void PrintStatsScreen_Left(u8 taskId); static void PrintStatsScreen_Abilities(u8 taskId); static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top); @@ -1201,9 +1200,12 @@ static const struct WindowTemplate sInfoScreen_WindowTemplates[] = #define WIN_STATS_NAME_GENDER 2 #define WIN_STATS_LEFT 3 #define WIN_STATS_NAVIGATION_BUTTONS 4 -#define WIN_STATS_MOVES 5 -#define WIN_STATS_ABILITIES 6 -#define WIN_STATS_LEFT_UNUSED 7 +#define WIN_STATS_MOVES_TOP 5 +#define WIN_STATS_MOVES_DESCRIPTION 7 +#define WIN_STATS_MOVES_BOTTOM 8 +#define WIN_STATS_ABILITIES 9 +#define WIN_STATS_LEFT_UNUSED 10 +#define WIN_STATS_END WIN_STATS_LEFT_UNUSED static const struct WindowTemplate sStatsScreen_WindowTemplates[] = { [WIN_STATS_TOPBAR] = @@ -1256,16 +1258,36 @@ static const struct WindowTemplate sStatsScreen_WindowTemplates[] = .paletteNum = 15, .baseBlock = 1 + 60 + 40 + 48 + 96, }, - [WIN_STATS_MOVES] = + [WIN_STATS_MOVES_TOP] = { .bg = 2, .tilemapLeft = 12, .tilemapTop = 2, .width = 18, - .height = 10, + .height = 4, .paletteNum = 0, .baseBlock = 1 + 60 + 40 + 48 + 96 + 24, }, + [WIN_STATS_MOVES_DESCRIPTION] = + { + .bg = 2, + .tilemapLeft = 12, + .tilemapTop = 6, + .width = 18, + .height = 4, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 72, + }, + [WIN_STATS_MOVES_BOTTOM] = + { + .bg = 2, + .tilemapLeft = 12, + .tilemapTop = 10, + .width = 18, + .height = 2, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 72 + 72, + }, [WIN_STATS_ABILITIES] = { .bg = 2, @@ -1274,7 +1296,7 @@ static const struct WindowTemplate sStatsScreen_WindowTemplates[] = .width = 18, .height = 8, .paletteNum = 0, - .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 180, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 72 + 72 + 36, }, [WIN_STATS_LEFT_UNUSED] = { @@ -1284,7 +1306,7 @@ static const struct WindowTemplate sStatsScreen_WindowTemplates[] = .width = 12, .height = 4, .paletteNum = 0, - .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 180 + 144, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 72 + 72 + 36 + 144, }, DUMMY_WIN_TEMPLATE }; @@ -6310,7 +6332,7 @@ static void LoadTilesetTilemapHGSS(u8 page) //PokedexPlus HGSS_Ui Stats Page static const u8 sStatsPageNavigationTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY}; -static void StatsPage_PrintAToggleUpdownMoves(void) +static void StatsPage_PrintNavigationButtons(void) { u8 x = 9; u8 y = 0; @@ -6322,6 +6344,20 @@ static void StatsPage_PrintAToggleUpdownMoves(void) PutWindowTilemap(WIN_STATS_NAVIGATION_BUTTONS); CopyWindowToVram(WIN_STATS_NAVIGATION_BUTTONS, 3); } +static void ResetStatsWindows(void) +{ + u8 i; + + FreeAllWindowBuffers(); + InitWindows(sStatsScreen_WindowTemplates); + //DeactivateAllTextPrinters(); + for (i = 0; i < WIN_STATS_END + 1; i++) + { + FillWindowPixelBuffer(i, PIXEL_FILL(0)); + PutWindowTilemap(i); + CopyWindowToVram(i, 3); + } +} #define tMonSpriteId data[4] static void Task_LoadStatsScreen(u8 taskId) { @@ -6348,36 +6384,7 @@ static void Task_LoadStatsScreen(u8 taskId) case 1: LoadTilesetTilemapHGSS(STATS_SCREEN); - FreeAllWindowBuffers(); - InitWindows(sStatsScreen_WindowTemplates); - - FillWindowPixelBuffer(WIN_STATS_TOPBAR, PIXEL_FILL(0)); - PutWindowTilemap(WIN_STATS_TOPBAR); - CopyWindowToVram(WIN_STATS_TOPBAR, 3); - - FillWindowPixelBuffer(WIN_STATS_NAME_GENDER, PIXEL_FILL(0)); - PutWindowTilemap(WIN_STATS_NAME_GENDER); - CopyWindowToVram(WIN_STATS_NAME_GENDER, 3); - - FillWindowPixelBuffer(WIN_STATS_LEFT, PIXEL_FILL(0)); - PutWindowTilemap(WIN_STATS_LEFT); - CopyWindowToVram(WIN_STATS_LEFT, 3); - - FillWindowPixelBuffer(WIN_STATS_NAVIGATION_BUTTONS, PIXEL_FILL(0)); - PutWindowTilemap(WIN_STATS_NAVIGATION_BUTTONS); - CopyWindowToVram(WIN_STATS_NAVIGATION_BUTTONS, 3); - - FillWindowPixelBuffer(WIN_STATS_MOVES, PIXEL_FILL(0)); - PutWindowTilemap(WIN_STATS_MOVES); - CopyWindowToVram(WIN_STATS_MOVES, 3); - - FillWindowPixelBuffer(WIN_STATS_ABILITIES, PIXEL_FILL(0)); - PutWindowTilemap(WIN_STATS_ABILITIES); - CopyWindowToVram(WIN_STATS_ABILITIES, 3); - - FillWindowPixelBuffer(WIN_STATS_LEFT_UNUSED, PIXEL_FILL(0)); - PutWindowTilemap(WIN_STATS_LEFT_UNUSED); - CopyWindowToVram(WIN_STATS_LEFT_UNUSED, 3); + ResetStatsWindows(); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); @@ -6403,7 +6410,7 @@ static void Task_LoadStatsScreen(u8 taskId) break; case 4: sPokedexView->moveSelected = 0; - sPokedexView->moveMax = 0; + sPokedexView->movesTotal = 0; sPokedexView->numEggMoves = 0; sPokedexView->numLevelUpMoves = 0; sPokedexView->numTMHMMoves = 0; @@ -6428,14 +6435,15 @@ static void Task_LoadStatsScreen(u8 taskId) break; case 6: gTasks[taskId].data[5] = 0; - FillWindowPixelRect(0, PIXEL_FILL(0), 0, 48, 240, 130); - PrintStatsScreen_NameGender(taskId, sPokedexListItem->dexNum, sPokedexView->dexMode == DEX_MODE_HOENN ? FALSE : TRUE, sPokedexListItem->owned, 0); + PrintStatsScreen_NameGender(taskId, sPokedexListItem->dexNum, sPokedexView->dexMode == DEX_MODE_HOENN ? FALSE : TRUE); PrintStatsScreen_Left(taskId); PrintStatsScreen_Abilities(taskId); - PrintStatsScreen_MoveNameAndInfo(taskId); + PrintStatsScreen_Moves_Top(taskId); + PrintStatsScreen_Moves_Description(taskId); + PrintStatsScreen_Moves_Bottom(taskId); if (!sPokedexListItem->owned) LoadPalette(gPlttBufferUnfaded + 1, 0x31, 0x1E); - StatsPage_PrintAToggleUpdownMoves(); //gText_Stats_Buttons + StatsPage_PrintNavigationButtons(); //gText_Stats_Buttons gMain.state++; break; case 7: @@ -6510,14 +6518,16 @@ static void Task_HandleStatsScreenInput(u8 taskId) FillWindowPixelBuffer(WIN_STATS_LEFT, PIXEL_FILL(0)); PrintStatsScreen_Left(taskId); + FillWindowPixelBuffer(WIN_STATS_MOVES_DESCRIPTION, PIXEL_FILL(0)); + PrintStatsScreen_Moves_Description(taskId); + + FillWindowPixelBuffer(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0)); + PrintStatsScreen_Moves_Bottom(taskId); + #ifdef POKEMON_EXPANSION FillWindowPixelBuffer(WIN_STATS_ABILITIES, PIXEL_FILL(0)); PrintStatsScreen_Abilities(taskId) #endif - - PrintStatsScreen_DestroyMoveItemIcon(taskId); - FillWindowPixelBuffer(WIN_STATS_MOVES, PIXEL_FILL(0)); - PrintStatsScreen_MoveNameAndInfo(taskId); } if (JOY_NEW(B_BUTTON)) { @@ -6532,17 +6542,29 @@ static void Task_HandleStatsScreenInput(u8 taskId) { sPokedexView->moveSelected -= 1; PlaySE(SE_SELECT); - FillWindowPixelBuffer(WIN_STATS_MOVES, PIXEL_FILL(0)); + FillWindowPixelBuffer(WIN_STATS_MOVES_TOP, PIXEL_FILL(0)); PrintStatsScreen_DestroyMoveItemIcon(taskId); - PrintStatsScreen_MoveNameAndInfo(taskId); + PrintStatsScreen_Moves_Top(taskId); + + FillWindowPixelBuffer(WIN_STATS_MOVES_DESCRIPTION, PIXEL_FILL(0)); + PrintStatsScreen_Moves_Description(taskId); + + FillWindowPixelBuffer(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0)); + PrintStatsScreen_Moves_Bottom(taskId); } - if (JOY_REPEAT(DPAD_DOWN) && sPokedexView->moveSelected < sPokedexView->moveMax -1 ) + if (JOY_REPEAT(DPAD_DOWN) && sPokedexView->moveSelected < sPokedexView->movesTotal -1 ) { sPokedexView->moveSelected = sPokedexView->moveSelected + 1; PlaySE(SE_SELECT); - FillWindowPixelBuffer(WIN_STATS_MOVES, PIXEL_FILL(0)); + FillWindowPixelBuffer(WIN_STATS_MOVES_TOP, PIXEL_FILL(0)); PrintStatsScreen_DestroyMoveItemIcon(taskId); - PrintStatsScreen_MoveNameAndInfo(taskId); + PrintStatsScreen_Moves_Top(taskId); + + FillWindowPixelBuffer(WIN_STATS_MOVES_DESCRIPTION, PIXEL_FILL(0)); + PrintStatsScreen_Moves_Description(taskId); + + FillWindowPixelBuffer(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0)); + PrintStatsScreen_Moves_Bottom(taskId); } //Switch screens @@ -6579,23 +6601,32 @@ static void PrintStatsScreen_DestroyMoveItemIcon(u8 taskId) } static bool8 CalculateMoves(void) { - //Moves u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); - u8 numEggMoves = GetEggMovesSpecies(species, sStatsMovesEgg); - u8 numLevelUpMoves = GetLevelUpMovesBySpecies(species, sStatsMovesLevelUp); - u8 numTMHMMoves; + + u16 statsMovesEgg[EGG_MOVES_ARRAY_COUNT] = {0}; + u16 statsMovesLevelUp[EGG_LVL_UP_MOVES_ARRAY_COUNT] = {0}; + u16 statsMovesTMHM[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; + u16 statsMovesTutor[TUTOR_MOVE_COUNT] = {0}; + + u8 numEggMoves = GetEggMovesSpecies(species, statsMovesEgg); + u8 numLevelUpMoves = GetLevelUpMovesBySpecies(species, statsMovesLevelUp); + u8 numTMHMMoves = 0; u8 numTutorMoves = 0; - u16 movestotal; + u16 movesTotal = 0; u8 i,j; - // sTutorLearnsets - for (i=0; imoveMax = movestotal; + // sTutorLearnsets + for (i=0; i < TUTOR_MOVE_COUNT; i++) + { + if (CanLearnTutorMove(species, i)) //if (sTutorLearnsets[species] & (1 << i)) + { + sStatsMoves[movesTotal] = gTutorMoves[i]; + numTutorMoves++; + movesTotal++; + } + } + sPokedexView->movesTotal = movesTotal; sPokedexView->numEggMoves = numEggMoves; sPokedexView->numLevelUpMoves = numLevelUpMoves; sPokedexView->numTMHMMoves = numTMHMMoves; @@ -6619,44 +6660,56 @@ static bool8 CalculateMoves(void) return TRUE; } -static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) +static void PrintStatsScreen_Moves_Top(u8 taskId) { u8 numEggMoves = sPokedexView->numEggMoves; u8 numLevelUpMoves = sPokedexView->numLevelUpMoves; u8 numTMHMMoves = sPokedexView->numTMHMMoves; u8 numTutorMoves = sPokedexView->numTutorMoves; - - u8 selected = sPokedexView->moveSelected; - u8 total = sPokedexView->moveMax; - + u8 selected = sPokedexView->moveSelected; + u8 movesTotal = sPokedexView->movesTotal; + u8 level; + u8 moves_x = 5; + u8 moves_y = 3; u16 move; u16 item; + + u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); - u8 moves_x = 5; //101; - u8 moves_y = 3; //19; + //Move + move = sStatsMoves[selected]; - u8 level = 0; + //Moves selected from move max + ConvertIntToDecimalStringN(gStringVar1, (selected+1), STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar2, movesTotal, STR_CONV_MODE_RIGHT_ALIGN, 3); + StringExpandPlaceholders(gStringVar1, gText_Stats_MoveSelectedMax); + PrintStatsScreenTextSmallWhite(WIN_STATS_MOVES_TOP, gStringVar1, moves_x-1, moves_y+1); - u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + //Move name + StringCopy(gStringVar3, gMoveNames[move]); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 20); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gStringVar3, moves_x, moves_y + 17); - //Contest - u8 contest_i, contest_effectValue, contest_appeal, contest_jam; + //Draw move type icon + if (gTasks[taskId].data[5] == 0) + { + SetTypeIconPosAndPal(gBattleMoves[move].type, moves_x + 146, moves_y + 17, 0); + SetSpriteInvisibility(1, TRUE); + } + else + { + SetTypeIconPosAndPal(NUMBER_OF_MON_TYPES + gContestMoves[move].contestCategory, moves_x + 146, moves_y + 17, 1); + SetSpriteInvisibility(0, TRUE); + } //Calculate and retrieve correct move from the arrays if (selected < numEggMoves) { - move = sStatsMovesEgg[sPokedexView->moveSelected]; - StringCopy(gStringVar3, gMoveNames[move]); - StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_ThreeDashes, moves_x + 113, moves_y + 9); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gText_ThreeDashes, moves_x + 113, moves_y + 9); item = ITEM_LUCKY_EGG; } else if (selected < (numEggMoves + numLevelUpMoves)) - { - move = sStatsMovesLevelUp[sPokedexView->moveSelected - numEggMoves]; - StringCopy(gStringVar3, gMoveNames[move]); - StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); - + { #if defined (BATTLE_ENGINE) || defined (POKEMON_EXPANSION) level = gLevelUpLearnsets[species][(selected-numEggMoves)].level; #else @@ -6669,25 +6722,19 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) } #endif ConvertIntToDecimalStringN(gStringVar1, level, STR_CONV_MODE_LEFT_ALIGN, 3); //Move learn lvl - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_Stats_MoveLevel, moves_x + 113, moves_y + 3); //Level text - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar1, moves_x + 113, moves_y + 14); //Print level + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gText_Stats_MoveLevel, moves_x + 113, moves_y + 3); //Level text + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gStringVar1, moves_x + 113, moves_y + 14); //Print level item = ITEM_EXP_SHARE; } else if (selected < (numEggMoves + numLevelUpMoves + numTMHMMoves)) { - move = sStatsMovesTMHM[sPokedexView->moveSelected - numEggMoves - numLevelUpMoves]; - StringCopy(gStringVar3, gMoveNames[move]); - StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); CopyItemName(sStatsMovesTMHM_ID[(selected-numEggMoves-numLevelUpMoves)], gStringVar1); //TM name - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar1, moves_x + 113, moves_y + 9); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gStringVar1, moves_x + 113, moves_y + 9); item = sStatsMovesTMHM_ID[(selected-numEggMoves-numLevelUpMoves)]; } else if (selected < (numEggMoves + numLevelUpMoves + numTMHMMoves + numTutorMoves)) { - move = sStatsMovesTutor[sPokedexView->moveSelected - numEggMoves - numLevelUpMoves - numTMHMMoves]; - StringCopy(gStringVar3, gMoveNames[move]); - StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_ThreeDashes, moves_x + 113, moves_y + 9); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gText_ThreeDashes, moves_x + 113, moves_y + 9); item = ITEM_TEACHY_TV; } else @@ -6696,103 +6743,100 @@ static void PrintStatsScreen_MoveNameAndInfo(u8 taskId) item = ITEM_MASTER_BALL; } - - //Move name and description - StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 20); - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar3, moves_x, moves_y + 17); //Name - if (gTasks[taskId].data[5] == 0) - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar4, moves_x, moves_y + 34); - else - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gContestEffectDescriptionPointers[gContestMoves[move].effect], moves_x, moves_y + 34); - - //Egg/TM/Level/Tutor Item Icon gTasks[taskId].data[3] = AddItemIconSprite(ITEM_TAG, ITEM_TAG, item); gSprites[gTasks[taskId].data[3]].x2 = 203; gSprites[gTasks[taskId].data[3]].y2 = 39; gSprites[gTasks[taskId].data[3]].oam.priority = 0; - //Moves selected from move max - ConvertIntToDecimalStringN(gStringVar1, (selected+1), STR_CONV_MODE_RIGHT_ALIGN, 3); - ConvertIntToDecimalStringN(gStringVar2, total, STR_CONV_MODE_RIGHT_ALIGN, 3); - StringExpandPlaceholders(gStringVar1, gText_Stats_MoveSelectedMax); - PrintStatsScreenTextSmallWhite(WIN_STATS_MOVES, gStringVar1, moves_x-1, moves_y+1); +} +static void PrintStatsScreen_Moves_Description(u8 taskId) +{ + u8 selected = sPokedexView->moveSelected; + u16 move; + u8 moves_x = 5; + u8 moves_y = 5; + //Move + move = sStatsMoves[selected]; + + //Move description + if (gTasks[taskId].data[5] == 0) + { + StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_DESCRIPTION, gStringVar4, moves_x, moves_y); + } + else + { + StringCopy(gStringVar4, gContestEffectDescriptionPointers[gContestMoves[move].effect]); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_DESCRIPTION, gStringVar4, moves_x, moves_y); + } +} +static void PrintStatsScreen_Moves_Bottom(u8 taskId) +{ + u8 selected = sPokedexView->moveSelected; + u16 move; + u8 moves_x = 5; + u8 moves_y = 3; + //Contest + u8 contest_effectValue; + u8 contest_appeal = 0; + u8 contest_jam = 0; + + //Move + move = sStatsMoves[selected]; + + //Power + Accuracy if (gTasks[taskId].data[5] == 0) { //Power - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_Power, moves_x + 3, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Power, moves_x + 3, moves_y); if (gBattleMoves[move].power < 2) StringCopy(gStringVar1, gText_ThreeDashes); else ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar1, moves_x + 48, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar1, moves_x + 48, moves_y); //Physical/Special Split from BE #ifdef BATTLE_ENGINE DestroySplitIcon(); ShowSplitIcon(GetBattleMoveSplit(move)); #endif //Accuracy - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_Accuracy2, moves_x + 69, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Accuracy2, moves_x + 69, moves_y); if (gBattleMoves[move].accuracy == 0) StringCopy(gStringVar1, gText_ThreeDashes); else ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].accuracy, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar1, moves_x + 117, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar1, moves_x + 117, moves_y); } - else + else //Appeal + Jam { #ifdef BATTLE_ENGINE DestroySplitIcon(); gSprites[sPokedexView->splitIconSpriteId].invisible = TRUE; #endif //Appeal - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_Appeal, moves_x + 3, moves_y + 64); - contest_appeal = 0; + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Appeal, moves_x + 3, moves_y); contest_effectValue = gContestEffects[gContestMoves[move].effect].appeal; if (contest_effectValue != 0xFF) - contest_effectValue /= 10; - for (contest_i = 0; contest_i < 8; contest_i++) - { - if (contest_effectValue != 0xFF && contest_i < contest_effectValue) - contest_appeal += 1; - } + contest_appeal = contest_effectValue / 10; ConvertIntToDecimalStringN(gStringVar1, contest_appeal, STR_CONV_MODE_RIGHT_ALIGN, 1); StringCopy(gStringVar2, gText_PlusSymbol); StringAppend(gStringVar2, gStringVar1); - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar2, moves_x + 48, moves_y + 64); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar2, moves_x + 48, moves_y); //Jam - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gText_Jam, moves_x + 69, moves_y + 64); - contest_jam = 0; + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Jam, moves_x + 69, moves_y); contest_effectValue = gContestEffects[gContestMoves[move].effect].jam; if (contest_effectValue != 0xFF) - contest_effectValue /= 10; - for (contest_i = 0; contest_i < 8; contest_i++) - { - if (contest_effectValue != 0xFF && contest_i < contest_effectValue) - contest_jam += 1; - } + contest_jam = contest_effectValue / 10; ConvertIntToDecimalStringN(gStringVar1, contest_jam, STR_CONV_MODE_RIGHT_ALIGN, 1); StringCopy(gStringVar2, gText_Stats_Minus); StringAppend(gStringVar2, gStringVar1); - PrintStatsScreenTextSmall(WIN_STATS_MOVES, gStringVar2, moves_x + 122, moves_y + 64); - } - - //Draw move type icon - if (gTasks[taskId].data[5] == 0) - { - SetTypeIconPosAndPal(gBattleMoves[move].type, moves_x + 146, moves_y + 17, 0); - SetSpriteInvisibility(1, TRUE); - } - else - { - SetTypeIconPosAndPal(NUMBER_OF_MON_TYPES + gContestMoves[move].contestCategory, moves_x + 146, moves_y + 17, 1); - SetSpriteInvisibility(0, TRUE); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar2, moves_x + 122, moves_y); } } -// u32 value is re-used, but passed as a bool that's TRUE if national dex is enabled -static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value, u32 owned, u32 newEntry) //HGSS_Ui +static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value) { u8 str[16]; u8 str2[32]; From 499fe6b2e5795e4e6889c49c16e846ca55f36523 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 28 Nov 2021 13:18:41 +0100 Subject: [PATCH 51/88] small improvements --- src/pokedex.c | 85 +++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 45c417aa8ee0..6950e03622e3 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -140,7 +140,8 @@ static EWRAM_DATA u16 sLastSelectedPokemon = 0; static EWRAM_DATA u8 sPokeBallRotation = 0; static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL; //Pokedex Plus HGSS_Ui -EWRAM_DATA static u16 sStatsMoves[EGG_LVL_UP_MOVES_ARRAY_COUNT + EGG_MOVES_ARRAY_COUNT + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + TUTOR_MOVE_COUNT] = {0}; +#define MOVES_COUNT_TOTAL (EGG_LVL_UP_MOVES_ARRAY_COUNT + EGG_MOVES_ARRAY_COUNT + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + TUTOR_MOVE_COUNT) +EWRAM_DATA static u16 sStatsMoves[MOVES_COUNT_TOTAL] = {0}; EWRAM_DATA static u16 sStatsMovesTMHM_ID[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; // This is written to, but never read. @@ -6340,7 +6341,7 @@ static void StatsPage_PrintNavigationButtons(void) AddTextPrinterParameterized3(WIN_STATS_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons); else AddTextPrinterParameterized3(WIN_STATS_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons_Decapped); - // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) + PutWindowTilemap(WIN_STATS_NAVIGATION_BUTTONS); CopyWindowToVram(WIN_STATS_NAVIGATION_BUTTONS, 3); } @@ -6350,7 +6351,7 @@ static void ResetStatsWindows(void) FreeAllWindowBuffers(); InitWindows(sStatsScreen_WindowTemplates); - //DeactivateAllTextPrinters(); + for (i = 0; i < WIN_STATS_END + 1; i++) { FillWindowPixelBuffer(i, PIXEL_FILL(0)); @@ -6506,7 +6507,6 @@ static void FreeStatsScreenWindowAndBgBuffers(void) } static void Task_HandleStatsScreenInput(u8 taskId) { - // gTasks[taskId].data[5] = 0; if (JOY_NEW(A_BUTTON)) { PlaySE(SE_DEX_PAGE); @@ -6576,7 +6576,6 @@ static void Task_HandleStatsScreenInput(u8 taskId) gTasks[taskId].func = Task_SwitchScreensFromStatsScreen; PlaySE(SE_PIN); } - if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) { if (!sPokedexListItem->owned) @@ -6641,7 +6640,7 @@ static bool8 CalculateMoves(void) } } - // sTutorLearnsets + //Tutor moves for (i=0; i < TUTOR_MOVE_COUNT; i++) { if (CanLearnTutorMove(species, i)) //if (sTutorLearnsets[species] & (1 << i)) @@ -6652,11 +6651,11 @@ static bool8 CalculateMoves(void) } } - sPokedexView->movesTotal = movesTotal; sPokedexView->numEggMoves = numEggMoves; sPokedexView->numLevelUpMoves = numLevelUpMoves; sPokedexView->numTMHMMoves = numTMHMMoves; sPokedexView->numTutorMoves = numTutorMoves; + sPokedexView->movesTotal = movesTotal; return TRUE; } @@ -6666,8 +6665,8 @@ static void PrintStatsScreen_Moves_Top(u8 taskId) u8 numLevelUpMoves = sPokedexView->numLevelUpMoves; u8 numTMHMMoves = sPokedexView->numTMHMMoves; u8 numTutorMoves = sPokedexView->numTutorMoves; - u8 selected = sPokedexView->moveSelected; u8 movesTotal = sPokedexView->movesTotal; + u8 selected = sPokedexView->moveSelected; u8 level; u8 moves_x = 5; u8 moves_y = 3; @@ -6774,10 +6773,10 @@ static void PrintStatsScreen_Moves_Description(u8 taskId) } static void PrintStatsScreen_Moves_Bottom(u8 taskId) { + u8 moves_x = 8; + u8 moves_y = 3; u8 selected = sPokedexView->moveSelected; u16 move; - u8 moves_x = 5; - u8 moves_y = 3; //Contest u8 contest_effectValue; u8 contest_appeal = 0; @@ -6790,24 +6789,24 @@ static void PrintStatsScreen_Moves_Bottom(u8 taskId) if (gTasks[taskId].data[5] == 0) { //Power - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Power, moves_x + 3, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Power, moves_x, moves_y); if (gBattleMoves[move].power < 2) StringCopy(gStringVar1, gText_ThreeDashes); else ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar1, moves_x + 48, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar1, moves_x + 45, moves_y); //Physical/Special Split from BE #ifdef BATTLE_ENGINE DestroySplitIcon(); ShowSplitIcon(GetBattleMoveSplit(move)); #endif //Accuracy - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Accuracy2, moves_x + 69, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Accuracy2, moves_x + 66, moves_y); if (gBattleMoves[move].accuracy == 0) StringCopy(gStringVar1, gText_ThreeDashes); else ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].accuracy, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar1, moves_x + 117, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar1, moves_x + 114, moves_y); } else //Appeal + Jam { @@ -6816,24 +6815,24 @@ static void PrintStatsScreen_Moves_Bottom(u8 taskId) gSprites[sPokedexView->splitIconSpriteId].invisible = TRUE; #endif //Appeal - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Appeal, moves_x + 3, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Appeal, moves_x, moves_y); contest_effectValue = gContestEffects[gContestMoves[move].effect].appeal; if (contest_effectValue != 0xFF) contest_appeal = contest_effectValue / 10; ConvertIntToDecimalStringN(gStringVar1, contest_appeal, STR_CONV_MODE_RIGHT_ALIGN, 1); StringCopy(gStringVar2, gText_PlusSymbol); StringAppend(gStringVar2, gStringVar1); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar2, moves_x + 48, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar2, moves_x + 45, moves_y); //Jam - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Jam, moves_x + 69, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Jam, moves_x + 66, moves_y); contest_effectValue = gContestEffects[gContestMoves[move].effect].jam; if (contest_effectValue != 0xFF) contest_jam = contest_effectValue / 10; ConvertIntToDecimalStringN(gStringVar1, contest_jam, STR_CONV_MODE_RIGHT_ALIGN, 1); StringCopy(gStringVar2, gText_Stats_Minus); StringAppend(gStringVar2, gStringVar1); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar2, moves_x + 122, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar2, moves_x + 119, moves_y); } } static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value) @@ -6850,7 +6849,6 @@ static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value) u8 base_x = 38; u8 base_y = 0; - u8 gender_x, gender_y; //Name @@ -6938,7 +6936,7 @@ static void PrintStatsScreen_Left(u8 taskId) u8 base_i = 0; u8 base_y = 5; u32 align_x; - u8 total_x = 85; + u8 total_x = 93; u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); u8 strEV[25]; u8 strBase[14]; @@ -6989,8 +6987,8 @@ static void PrintStatsScreen_Left(u8 taskId) if (differentEVs < 3) { differentEVs = 0; - - if (gBaseStats[species].evYield_HP > 0) //HP + //HP + if (gBaseStats[species].evYield_HP > 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); @@ -7000,8 +6998,8 @@ static void PrintStatsScreen_Left(u8 taskId) StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } - - if (gBaseStats[species].evYield_Speed > 0) //Speed + //Speed + if (gBaseStats[species].evYield_Speed > 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); @@ -7011,8 +7009,8 @@ static void PrintStatsScreen_Left(u8 taskId) StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } - - if (gBaseStats[species].evYield_Attack > 0) //Attack + //Attack + if (gBaseStats[species].evYield_Attack > 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); @@ -7022,8 +7020,8 @@ static void PrintStatsScreen_Left(u8 taskId) StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } - - if (gBaseStats[species].evYield_SpAttack > 0) //Special Attack + //Special Attack + if (gBaseStats[species].evYield_SpAttack > 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); @@ -7033,8 +7031,8 @@ static void PrintStatsScreen_Left(u8 taskId) StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } - - if (gBaseStats[species].evYield_Defense > 0) //Defense + //Defense + if (gBaseStats[species].evYield_Defense > 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); @@ -7044,8 +7042,8 @@ static void PrintStatsScreen_Left(u8 taskId) StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } - - if (gBaseStats[species].evYield_SpDefense > 0) //Special Defense + //Special Defense + if (gBaseStats[species].evYield_SpDefense > 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); @@ -7059,7 +7057,8 @@ static void PrintStatsScreen_Left(u8 taskId) else //3 different EVs in 1 row { column = 0; - if (gBaseStats[species].evYield_HP > 0) //HP + //HP + if (gBaseStats[species].evYield_HP > 0) { StringCopy(gStringVar1, gText_Stats_HP); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 0); @@ -7067,8 +7066,8 @@ static void PrintStatsScreen_Left(u8 taskId) PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } - - if (gBaseStats[species].evYield_Speed > 0) //Speed + //Speed + if (gBaseStats[species].evYield_Speed > 0) { StringCopy(gStringVar1, gText_Stats_Speed); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 1); @@ -7076,8 +7075,8 @@ static void PrintStatsScreen_Left(u8 taskId) PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } - - if (gBaseStats[species].evYield_Attack > 0) //Attack + //Attack + if (gBaseStats[species].evYield_Attack > 0) { StringCopy(gStringVar1, gText_Stats_Attack); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 2); @@ -7085,8 +7084,8 @@ static void PrintStatsScreen_Left(u8 taskId) PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } - - if (gBaseStats[species].evYield_SpAttack > 0) //Special Attack + //Special Attack + if (gBaseStats[species].evYield_SpAttack > 0) { StringCopy(gStringVar1, gText_Stats_SpAttack); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 3); @@ -7094,8 +7093,8 @@ static void PrintStatsScreen_Left(u8 taskId) PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } - - if (gBaseStats[species].evYield_Defense > 0) //Defense + //Defense + if (gBaseStats[species].evYield_Defense > 0) { StringCopy(gStringVar1, gText_Stats_Defense); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 4); @@ -7103,8 +7102,8 @@ static void PrintStatsScreen_Left(u8 taskId) PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } - - if (gBaseStats[species].evYield_SpDefense > 0) //Special Defense + //Special Defense + if (gBaseStats[species].evYield_SpDefense > 0) { StringCopy(gStringVar1, gText_Stats_SpDefense); PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 5); From 50d6cf29a678f4209363bb608e77aff1667df2ca Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 11:01:34 +0100 Subject: [PATCH 52/88] changed abilities to u16 for the rhh expansions, thanks to @AsparagusEduardo --- src/pokedex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 6950e03622e3..06bed13e6b79 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7347,9 +7347,9 @@ static void PrintStatsScreen_Abilities(u8 taskId) u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); u8 abilities_x = 5; u8 abilities_y = 3; - u8 ability0; - u8 ability1; - u8 abilityHidden; + u16 ability0; + u16 ability1; + u16 abilityHidden; //Abilitie(s) #ifdef POKEMON_EXPANSION From 026150dbff6b20b493a85d5ef9c17ecf70f5c1bc Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sat, 18 Dec 2021 13:06:20 +0100 Subject: [PATCH 53/88] now used EWRAM struct instead of accessing gBaseStats as often --- src/pokedex.c | 192 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 131 insertions(+), 61 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 06bed13e6b79..597ac7b7265c 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -188,6 +188,36 @@ struct PokedexListItem u16 owned:1; }; +//HGSS_Ui +struct PokemonStats +{ + u16 species; + u8 genderRatio; + u8 baseHP; + u8 baseSpeed; + u8 baseAttack; + u8 baseSpAttack; + u8 baseDefense; + u8 baseSpDefense; + u8 differentEVs; + u8 evYield_HP; + u8 evYield_Speed; + u8 evYield_Attack; + u8 evYield_SpAttack; + u8 evYield_Defense; + u8 evYield_SpDefense; + u8 catchRate; + u8 growthRate; + u8 eggGroup1; + u8 eggGroup2; + u8 eggCycles; + u8 expYield; + u8 friendship; + u16 ability0; + u16 ability1; + u16 abilityHidden; +}; + struct PokedexView { struct PokedexListItem pokedexList[NATIONAL_DEX_COUNT + 1]; @@ -215,6 +245,7 @@ struct PokedexView u8 numTMHMMoves; //HGSS_Ui u8 numTutorMoves; //HGSS_Ui u8 numPreEvolutions; //HGSS_Ui + struct PokemonStats sPokemonStats; //HGSS_Ui u16 selectedMonSpriteId; u16 pokeBallRotationStep; u16 pokeBallRotationBackup; @@ -6359,6 +6390,48 @@ static void ResetStatsWindows(void) CopyWindowToVram(i, 3); } } +static void SaveMonDataInStruct(void) +{ + u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + u8 EVs[6] = {gBaseStats[species].evYield_HP, gBaseStats[species].evYield_Speed, gBaseStats[species].evYield_Attack, gBaseStats[species].evYield_SpAttack, gBaseStats[species].evYield_Defense, gBaseStats[species].evYield_SpDefense}; + u8 differentEVs; + u8 i; + + //Count how many different EVs + for (i = 0; i<6; i++) + { + if (EVs[i] > 0) //HP//Speed//Attack//Special Attack//Defense//Special Defense + differentEVs++; + } + + sPokedexView->sPokemonStats.species = species; + sPokedexView->sPokemonStats.genderRatio = gBaseStats[species].genderRatio; + sPokedexView->sPokemonStats.baseHP = gBaseStats[species].baseHP; + sPokedexView->sPokemonStats.baseSpeed = gBaseStats[species].baseSpeed; + sPokedexView->sPokemonStats.baseAttack = gBaseStats[species].baseAttack; + sPokedexView->sPokemonStats.baseSpAttack = gBaseStats[species].baseSpAttack; + sPokedexView->sPokemonStats.baseDefense = gBaseStats[species].baseDefense; + sPokedexView->sPokemonStats.baseSpDefense = gBaseStats[species].baseSpDefense; + sPokedexView->sPokemonStats.differentEVs = differentEVs; + sPokedexView->sPokemonStats.evYield_HP = EVs[0]; + sPokedexView->sPokemonStats.evYield_Speed = EVs[1]; + sPokedexView->sPokemonStats.evYield_Attack = EVs[2]; + sPokedexView->sPokemonStats.evYield_SpAttack = EVs[3]; + sPokedexView->sPokemonStats.evYield_Defense = EVs[4]; + sPokedexView->sPokemonStats.evYield_SpDefense = EVs[5]; + sPokedexView->sPokemonStats.catchRate = gBaseStats[species].catchRate; + sPokedexView->sPokemonStats.growthRate = gBaseStats[species].growthRate; + sPokedexView->sPokemonStats.eggGroup1 = gBaseStats[species].eggGroup1; + sPokedexView->sPokemonStats.eggGroup2 = gBaseStats[species].eggGroup2; + sPokedexView->sPokemonStats.eggCycles = gBaseStats[species].eggCycles; + sPokedexView->sPokemonStats.expYield = gBaseStats[species].expYield; + sPokedexView->sPokemonStats.friendship = gBaseStats[species].friendship; + sPokedexView->sPokemonStats.ability0 = GetAbilityBySpecies(species, 0); + sPokedexView->sPokemonStats.ability1 = GetAbilityBySpecies(species, 1); + #ifdef POKEMON_EXPANSION + sPokedexView->sPokemonStats.abilityHidden = GetAbilityBySpecies(species, 2); + #endif +} #define tMonSpriteId data[4] static void Task_LoadStatsScreen(u8 taskId) { @@ -6410,6 +6483,7 @@ static void Task_LoadStatsScreen(u8 taskId) gMain.state++; break; case 4: + SaveMonDataInStruct(); sPokedexView->moveSelected = 0; sPokedexView->movesTotal = 0; sPokedexView->numEggMoves = 0; @@ -6865,7 +6939,7 @@ static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value) //Gender ratio //MON_GENDERLESS == 0xFF gender_x = base_x; gender_y = base_y + 20; - switch (gBaseStats[species].genderRatio) + switch (sPokedexView->sPokemonStats.genderRatio) { case 0: PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_0, gender_x, gender_y); @@ -6907,9 +6981,9 @@ static u8 PrintMonStatsToggle_DifferentEVsRow(u8 differentEVs) else return 1; } -static u8* PrintMonStatsToggle_EV_Arrows(u8 *dest, u8 EVs[], u8 position) +static u8* PrintMonStatsToggle_EV_Arrows(u8 *dest, u8 value) { - switch (EVs[position]) + switch (value) { case 1: StringCopy(dest, gText_Stats_EV_Plus1); @@ -6940,116 +7014,109 @@ static void PrintStatsScreen_Left(u8 taskId) u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); u8 strEV[25]; u8 strBase[14]; + u8 EVs[6] = {sPokedexView->sPokemonStats.evYield_HP, sPokedexView->sPokemonStats.evYield_Speed, sPokedexView->sPokemonStats.evYield_Attack, sPokedexView->sPokemonStats.evYield_SpAttack, sPokedexView->sPokemonStats.evYield_Defense, sPokedexView->sPokemonStats.evYield_SpDefense}; u8 differentEVs = 0; - u8 EVs[6] = {gBaseStats[species].evYield_HP, gBaseStats[species].evYield_Speed, gBaseStats[species].evYield_Attack, gBaseStats[species].evYield_SpAttack, gBaseStats[species].evYield_Defense, gBaseStats[species].evYield_SpDefense}; u8 i; //Base stats if (gTasks[taskId].data[5] == 0) { PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_HP, base_x, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseHP, STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseHP, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Speed, base_x+base_x_second_row, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpeed, STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseSpeed, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); base_i++; PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Attack, base_x, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_SpAttack, base_x+base_x_second_row, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseSpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); base_i++; PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Defense, base_x, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_SpDefense, base_x+base_x_second_row, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, gBaseStats[species].baseSpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseSpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); base_i++; } else //EV increases { - //Count how many different EVs - for (i = 0; i<6; i++) - { - if (EVs[i] > 0) //HP//Speed//Attack//Special Attack//Defense//Special Defense - differentEVs++; - } - //If 1 or 2 EVs display with the same layout as the base stats - if (differentEVs < 3) + if (sPokedexView->sPokemonStats.differentEVs < 3) { differentEVs = 0; //HP - if (gBaseStats[species].evYield_HP > 0) + if (EVs[0] > 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); StringCopy(gStringVar1, gText_Stats_HP); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 0); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[0]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } //Speed - if (gBaseStats[species].evYield_Speed > 0) + if (EVs[1]> 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); StringCopy(gStringVar1, gText_Stats_Speed); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 1); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[1]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } //Attack - if (gBaseStats[species].evYield_Attack > 0) + if (EVs[2] > 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); StringCopy(gStringVar1, gText_Stats_Attack); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 2); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[2]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } //Special Attack - if (gBaseStats[species].evYield_SpAttack > 0) + if (EVs[3] > 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); StringCopy(gStringVar1, gText_Stats_SpAttack); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 3); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[3]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } //Defense - if (gBaseStats[species].evYield_Defense > 0) + if (EVs[4] > 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); StringCopy(gStringVar1, gText_Stats_Defense); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 4); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[4]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } //Special Defense - if (gBaseStats[species].evYield_SpDefense > 0) + if (EVs[5] > 0) { differentEVs++; column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); StringCopy(gStringVar1, gText_Stats_SpDefense); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 5); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[5]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); } @@ -7058,55 +7125,55 @@ static void PrintStatsScreen_Left(u8 taskId) { column = 0; //HP - if (gBaseStats[species].evYield_HP > 0) + if (EVs[0] > 0) { StringCopy(gStringVar1, gText_Stats_HP); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 0); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[0]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } //Speed - if (gBaseStats[species].evYield_Speed > 0) + if (EVs[1] > 0) { StringCopy(gStringVar1, gText_Stats_Speed); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 1); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[1]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } //Attack - if (gBaseStats[species].evYield_Attack > 0) + if (EVs[2] > 0) { StringCopy(gStringVar1, gText_Stats_Attack); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 2); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[2]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } //Special Attack - if (gBaseStats[species].evYield_SpAttack > 0) + if (EVs[3] > 0) { StringCopy(gStringVar1, gText_Stats_SpAttack); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 3); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[3]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } //Defense - if (gBaseStats[species].evYield_Defense > 0) + if (EVs[4] > 0) { StringCopy(gStringVar1, gText_Stats_Defense); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 4); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[4]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; } //Special Defense - if (gBaseStats[species].evYield_SpDefense > 0) + if (EVs[5] > 0) { StringCopy(gStringVar1, gText_Stats_SpDefense); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs, 5); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[5]); StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); column++; @@ -7118,17 +7185,20 @@ static void PrintStatsScreen_Left(u8 taskId) //TOGGLE-------------------------------------- if (gTasks[taskId].data[5] == 0) { + u32 catchRate = sPokedexView->sPokemonStats.catchRate; + u32 growthRate = sPokedexView->sPokemonStats.growthRate; + //Catch rate PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate, base_x, base_y + base_y_offset*base_i); - if (gBaseStats[species].catchRate <= 10) + if (catchRate <= 10) PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Legend, base_x + x_offset_column, base_y + base_y_offset*base_i); - else if (gBaseStats[species].catchRate <= 70) + else if (catchRate <= 70) PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_VeryHard, base_x + x_offset_column, base_y + base_y_offset*base_i); - else if (gBaseStats[species].catchRate <= 100) + else if (catchRate <= 100) PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Difficult, base_x + x_offset_column, base_y + base_y_offset*base_i); - else if (gBaseStats[species].catchRate <= 150) + else if (catchRate <= 150) PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Medium, base_x + x_offset_column, base_y + base_y_offset*base_i); - else if (gBaseStats[species].catchRate <= 200) + else if (catchRate <= 200) PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Relaxed, base_x + x_offset_column, base_y + base_y_offset*base_i); else PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Easy, base_x + x_offset_column, base_y + base_y_offset*base_i); @@ -7136,7 +7206,7 @@ static void PrintStatsScreen_Left(u8 taskId) //Growth rate PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Growthrate, base_x, base_y + base_y_offset*base_i); - switch (gBaseStats[species].growthRate) + switch (growthRate) { case GROWTH_MEDIUM_FAST: StringCopy(strEV, gText_Stats_MEDIUM_FAST); @@ -7166,13 +7236,13 @@ static void PrintStatsScreen_Left(u8 taskId) { //Exp Yield PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_ExpYield, base_x, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(gStringVar1, gBaseStats[species].expYield, STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar1, sPokedexView->sPokemonStats.expYield, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar1, base_x + base_x_offset, base_y + base_y_offset*base_i); base_i++; //Friendship PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Friendship, base_x, base_y + base_y_offset*base_i); - switch (gBaseStats[species].friendship) + switch (sPokedexView->sPokemonStats.friendship) { case 35: StringCopy(strEV, gText_Stats_Friendship_BigAnger); @@ -7190,7 +7260,7 @@ static void PrintStatsScreen_Left(u8 taskId) StringCopy(strEV, gText_Stats_Friendship_BigSmile); break; default: - ConvertIntToDecimalStringN(strEV, gBaseStats[species].friendship, STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(strEV, sPokedexView->sPokemonStats.friendship, STR_CONV_MODE_RIGHT_ALIGN, 3); break; } align_x = GetStringRightAlignXOffset(0, strEV, total_x); @@ -7198,7 +7268,7 @@ static void PrintStatsScreen_Left(u8 taskId) base_i++; //Egg cycles - if (gBaseStats[species].eggGroup1 == EGG_GROUP_UNDISCOVERED || gBaseStats[species].eggGroup2 == EGG_GROUP_UNDISCOVERED) //Species without eggs (legendaries etc) + if (sPokedexView->sPokemonStats.eggGroup1 == EGG_GROUP_UNDISCOVERED || sPokedexView->sPokemonStats.eggGroup2 == EGG_GROUP_UNDISCOVERED) //Species without eggs (legendaries etc) { PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_ThreeDashes, 78, base_y + base_y_offset*base_i); @@ -7206,17 +7276,17 @@ static void PrintStatsScreen_Left(u8 taskId) else { PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); - if (gBaseStats[species].eggCycles <= 10) + if (sPokedexView->sPokemonStats.eggCycles <= 10) { StringCopy(strEV, gText_Stats_EggCycles_VeryFast); align_x = 76; } - else if (gBaseStats[species].eggCycles <= 20) + else if (sPokedexView->sPokemonStats.eggCycles <= 20) { StringCopy(strEV, gText_Stats_EggCycles_Fast); align_x = 85; } - else if (gBaseStats[species].eggCycles <= 30) + else if (sPokedexView->sPokemonStats.eggCycles <= 30) { StringCopy(strEV, gText_Stats_EggCycles_Normal); align_x = 76; @@ -7231,7 +7301,7 @@ static void PrintStatsScreen_Left(u8 taskId) base_i++; //Egg group 1 - switch (gBaseStats[species].eggGroup1) + switch (sPokedexView->sPokemonStats.eggGroup1) { case EGG_GROUP_MONSTER : StringCopy(gStringVar1, gText_Stats_eggGroup_MONSTER); @@ -7280,9 +7350,9 @@ static void PrintStatsScreen_Left(u8 taskId) break; } //Egg group 2 - if (gBaseStats[species].eggGroup1 != gBaseStats[species].eggGroup2) + if (sPokedexView->sPokemonStats.eggGroup1 != sPokedexView->sPokemonStats.eggGroup2) { - switch (gBaseStats[species].eggGroup2) + switch (sPokedexView->sPokemonStats.eggGroup2) { case EGG_GROUP_MONSTER : StringCopy(gStringVar2, gText_Stats_eggGroup_MONSTER); @@ -7356,11 +7426,11 @@ static void PrintStatsScreen_Abilities(u8 taskId) if (gTasks[taskId].data[5] == 0) { #endif - ability0 = GetAbilityBySpecies(species, 0); //gBaseStats[species].abilities[0]; + ability0 = sPokedexView->sPokemonStats.ability0; //GetAbilityBySpecies(species, 0); //gBaseStats[species].abilities[0]; PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability0], abilities_x, abilities_y); PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); - ability1 = GetAbilityBySpecies(species, 1); + ability1 = sPokedexView->sPokemonStats.ability1; //GetAbilityBySpecies(species, 1); if (ability1 != ABILITY_NONE) //(gBaseStats[species].abilities[1] != ABILITY_NONE) { PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability1], abilities_x, abilities_y + 30); @@ -7370,7 +7440,7 @@ static void PrintStatsScreen_Abilities(u8 taskId) } else //Hidden abilities { - abilityHidden = GetAbilityBySpecies(species, 2); + abilityHidden = sPokedexView->sPokemonStats.abilityHidden; //GetAbilityBySpecies(species, 2); PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[abilityHidden], abilities_x, abilities_y); PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[abilityHidden], abilities_x, abilities_y + 14); } From 02ff9b4db1643abee70703ff16937cece1344201 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sat, 18 Dec 2021 13:18:23 +0100 Subject: [PATCH 54/88] only redraws move power/accuracy on contest switch --- src/pokedex.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 597ac7b7265c..a31a79066f24 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -392,6 +392,7 @@ static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value); static void PrintStatsScreen_DestroyMoveItemIcon(u8 taskId); static void PrintStatsScreen_Moves_Top(u8 taskId); static void PrintStatsScreen_Moves_Description(u8 taskId); +static void PrintStatsScreen_Moves_BottomText(u8 taskId); static void PrintStatsScreen_Moves_Bottom(u8 taskId); static void PrintStatsScreen_Left(u8 taskId); static void PrintStatsScreen_Abilities(u8 taskId); @@ -6515,6 +6516,7 @@ static void Task_LoadStatsScreen(u8 taskId) PrintStatsScreen_Abilities(taskId); PrintStatsScreen_Moves_Top(taskId); PrintStatsScreen_Moves_Description(taskId); + PrintStatsScreen_Moves_BottomText(taskId); PrintStatsScreen_Moves_Bottom(taskId); if (!sPokedexListItem->owned) LoadPalette(gPlttBufferUnfaded + 1, 0x31, 0x1E); @@ -6596,6 +6598,7 @@ static void Task_HandleStatsScreenInput(u8 taskId) PrintStatsScreen_Moves_Description(taskId); FillWindowPixelBuffer(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0)); + PrintStatsScreen_Moves_BottomText(taskId); PrintStatsScreen_Moves_Bottom(taskId); #ifdef POKEMON_EXPANSION @@ -6623,7 +6626,8 @@ static void Task_HandleStatsScreenInput(u8 taskId) FillWindowPixelBuffer(WIN_STATS_MOVES_DESCRIPTION, PIXEL_FILL(0)); PrintStatsScreen_Moves_Description(taskId); - FillWindowPixelBuffer(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0)); + FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 50, 0, 20, 16); + FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 120, 0, 20, 16); PrintStatsScreen_Moves_Bottom(taskId); } if (JOY_REPEAT(DPAD_DOWN) && sPokedexView->moveSelected < sPokedexView->movesTotal -1 ) @@ -6637,7 +6641,8 @@ static void Task_HandleStatsScreenInput(u8 taskId) FillWindowPixelBuffer(WIN_STATS_MOVES_DESCRIPTION, PIXEL_FILL(0)); PrintStatsScreen_Moves_Description(taskId); - FillWindowPixelBuffer(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0)); + FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 50, 0, 20, 16); + FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 120, 0, 20, 16); PrintStatsScreen_Moves_Bottom(taskId); } @@ -6845,6 +6850,21 @@ static void PrintStatsScreen_Moves_Description(u8 taskId) PrintStatsScreenTextSmall(WIN_STATS_MOVES_DESCRIPTION, gStringVar4, moves_x, moves_y); } } +static void PrintStatsScreen_Moves_BottomText(u8 taskId) +{ + u8 moves_x = 8; + u8 moves_y = 3; + if (gTasks[taskId].data[5] == 0) + { + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Power, moves_x, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Accuracy2, moves_x + 66, moves_y); + } + else + { + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Appeal, moves_x, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Jam, moves_x + 66, moves_y); + } +} static void PrintStatsScreen_Moves_Bottom(u8 taskId) { u8 moves_x = 8; @@ -6863,7 +6883,6 @@ static void PrintStatsScreen_Moves_Bottom(u8 taskId) if (gTasks[taskId].data[5] == 0) { //Power - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Power, moves_x, moves_y); if (gBattleMoves[move].power < 2) StringCopy(gStringVar1, gText_ThreeDashes); else @@ -6875,7 +6894,6 @@ static void PrintStatsScreen_Moves_Bottom(u8 taskId) ShowSplitIcon(GetBattleMoveSplit(move)); #endif //Accuracy - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Accuracy2, moves_x + 66, moves_y); if (gBattleMoves[move].accuracy == 0) StringCopy(gStringVar1, gText_ThreeDashes); else @@ -6889,7 +6907,6 @@ static void PrintStatsScreen_Moves_Bottom(u8 taskId) gSprites[sPokedexView->splitIconSpriteId].invisible = TRUE; #endif //Appeal - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Appeal, moves_x, moves_y); contest_effectValue = gContestEffects[gContestMoves[move].effect].appeal; if (contest_effectValue != 0xFF) contest_appeal = contest_effectValue / 10; @@ -6899,7 +6916,6 @@ static void PrintStatsScreen_Moves_Bottom(u8 taskId) PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar2, moves_x + 45, moves_y); //Jam - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Jam, moves_x + 66, moves_y); contest_effectValue = gContestEffects[gContestMoves[move].effect].jam; if (contest_effectValue != 0xFF) contest_jam = contest_effectValue / 10; From f4f3058266f3d51e1eaa43bd81692d0d98bcbbe0 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 21 Dec 2021 05:45:32 -0300 Subject: [PATCH 55/88] Update pokedex.c --- src/pokedex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokedex.c b/src/pokedex.c index a31a79066f24..d9979059ffb7 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -6603,7 +6603,7 @@ static void Task_HandleStatsScreenInput(u8 taskId) #ifdef POKEMON_EXPANSION FillWindowPixelBuffer(WIN_STATS_ABILITIES, PIXEL_FILL(0)); - PrintStatsScreen_Abilities(taskId) + PrintStatsScreen_Abilities(taskId); #endif } if (JOY_NEW(B_BUTTON)) From 9446ad112ac661b0a7024c5533af3195ec05e04b Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 3 Jan 2022 16:48:50 +0100 Subject: [PATCH 56/88] added the ability to directly open evolutions from the EVO page --- graphics/pokedex/HGSS_tilemap_evo_screen.bin | Bin 1344 -> 1344 bytes .../pokedex/HGSS_tilemap_evo_screen_PE.bin | Bin 1344 -> 1344 bytes .../pokedex/HGSS_tilemap_forms_screen.bin | Bin 1344 -> 1344 bytes graphics/pokedex/HGSS_tileset_menu2.png | Bin 847 -> 838 bytes include/reset_rtc_screen.h | 3 + include/strings.h | 2 + src/pokedex.c | 167 +++++++++++++++--- src/reset_rtc_screen.c | 4 +- src/strings.c | 6 +- 9 files changed, 153 insertions(+), 29 deletions(-) mode change 100644 => 100755 graphics/pokedex/HGSS_tilemap_evo_screen.bin mode change 100644 => 100755 graphics/pokedex/HGSS_tilemap_evo_screen_PE.bin mode change 100644 => 100755 graphics/pokedex/HGSS_tilemap_forms_screen.bin diff --git a/graphics/pokedex/HGSS_tilemap_evo_screen.bin b/graphics/pokedex/HGSS_tilemap_evo_screen.bin old mode 100644 new mode 100755 index bf66d4046358737f3f19cd5a674edb9f041274ba..0533b53843342e23d6a1c6b989561a1c6adc2e53 GIT binary patch delta 158 zcmX@Wb%1L^$HZkK6W8&85!=RHrz>% delta 154 zcmX@Wb%1L^2cz}Gg_08|NNn77in-pK!JEMgh+(7;m`#ZEWdH#`27e$Xj|3aQz%ZGU K)qJu5D;og8b{i7_ diff --git a/graphics/pokedex/HGSS_tilemap_evo_screen_PE.bin b/graphics/pokedex/HGSS_tilemap_evo_screen_PE.bin old mode 100644 new mode 100755 index 321af9d70703f440edfa4eb84ebd3aa9bd76cc80..42403380711f43d4f82b5b0074e9217069d925e3 GIT binary patch delta 194 zcmX@Wb%1L^$HZkK6W8&85!=LFx8&Uz@WRcT8P77+dop+tfZhx~489D0K!{5EGk`z< gLm)#C5aK3-8A2FB8Nz@Nodjy1%*tv#S%8%d0H!k~NB{r; delta 182 zcmX@Wb%1L^2cz}Gg_08|NKD*yYjPhW8#cUo2jdB*`VfXt6d1-3&fvq~4TOY9Uj`6} gWQbyj20|Da!w}2h&)^4ygh`Q delta 165 zcmX@Wb%1L_10!buLm(IiO+LtIxOo@j0jBz31`r5g2t|Qm4B-qB4BkM9pY&ny1?!Jw gh+>EaLKqpt5X<1t;0J^RNG1lq$&9S_lLc7W0H`V*pa1{> diff --git a/graphics/pokedex/HGSS_tileset_menu2.png b/graphics/pokedex/HGSS_tileset_menu2.png index 7c271984cbc2a7dba805a4509f726ded6387e6bb..0c8d85aaabe6628fde2f40ee946bccf1ed53ec69 100644 GIT binary patch delta 665 zcmV;K0%rZs2F3=EDhlQS0}mTEPRz|;ku;NkYDq*vRCt`VltGT8Fc3w31#4#3oFPJU zgIu81$~rqFPJmdkoSXorj>!UL$c3gHp+x5Tg90$?gKh2Bb7Qj5e z2k6G4Xz1|Vvy0R!BucCZ7`ZaA^k z007Pc@NM00sC}$i|1!W-bI^N^aTnz>C#`QACT;|ATvTs1G;FqhqHI{y@TGu z+neF$H{*SPT9->h`iiOz(O2vG5I?ha3>~MJCukIP%rB4swO;ol1N7kmGr;!t`Kw=| zz@I4vnDnh00jJ3y5SzRJic<Ii_?`lTI&bBJzRz%>I* z-v{Kne;xoXKB@i!$gNu*?cggwYF#zj^MHS;z74%FFl#sf00000?Yy6FiHmhmmvWr2GA;#n-V|=RscX3Mq0q3IKc)$rmefTwl4Q14UEhL-`Vnj^jE6gO7RIH9zL0-|pafE7^#{fs}J%-9W5GNh7o85O|J z?ZDBB07QsRMTSiF4L}S>-JYtMo-rc6Gfr{h_N=4_!pNjSR+ z$F*cO=Oq{8um-G5^SPbd1$bY7WBjgT@EB9|FPqy3{3rm&m@(+SeXtH@SA z2e@S$74T&M*L#4o0USAbD9ZYL`~+SA*536ifZX26#}xknwqX_qXi54Ft^fc407*qo IM6N<$g6F(8CIA2c diff --git a/include/reset_rtc_screen.h b/include/reset_rtc_screen.h index 5807dec99213..f8904063b70b 100644 --- a/include/reset_rtc_screen.h +++ b/include/reset_rtc_screen.h @@ -1,6 +1,9 @@ #ifndef GUARD_RESET_RTC_SCREEN_H #define GUARD_RESET_RTC_SCREEN_H +extern const struct SpritePalette sSpritePalette_Arrow; +extern const struct SpriteTemplate sSpriteTemplate_Arrow; + void CB2_InitResetRtcScreen(void); #endif // GUARD_RESET_RTC_SCREEN_H diff --git a/include/strings.h b/include/strings.h index 92625d29bbad..ac83efbb858e 100644 --- a/include/strings.h +++ b/include/strings.h @@ -603,6 +603,8 @@ extern const u8 gText_Stats_eggGroup_UNDISCOVERED[]; extern const u8 gText_Dex_SEEN[]; extern const u8 gText_Dex_OWN[]; +extern const u8 gText_EVO_Buttons[]; +extern const u8 gText_EVO_Buttons_Decapped[]; extern const u8 gText_EVO_Buttons_PE[]; extern const u8 gText_EVO_Buttons_Decapped_PE[]; extern const u8 gText_EVO_Name[]; diff --git a/src/pokedex.c b/src/pokedex.c index a31a79066f24..adc6b465afba 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -29,6 +29,7 @@ #ifdef POKEMON_EXPANSION #include "region_map.h" #endif +#include "reset_rtc_screen.h" #include "scanline_effect.h" #include "shop.h" #include "sound.h" @@ -218,6 +219,17 @@ struct PokemonStats u16 abilityHidden; }; +struct EvoScreenData +{ + bool8 fromEvoPage; + u8 numAllEvolutions; + u16 targetSpecies[10]; + u8 numSeen; + bool8 seen[10]; + u8 menuPos; + u8 arrowSpriteId; +}; + struct PokedexView { struct PokedexListItem pokedexList[NATIONAL_DEX_COUNT + 1]; @@ -246,6 +258,7 @@ struct PokedexView u8 numTutorMoves; //HGSS_Ui u8 numPreEvolutions; //HGSS_Ui struct PokemonStats sPokemonStats; //HGSS_Ui + struct EvoScreenData sEvoScreenData; //HGSS_Ui u16 selectedMonSpriteId; u16 pokeBallRotationStep; u16 pokeBallRotationBackup; @@ -1219,7 +1232,7 @@ static const struct WindowTemplate sInfoScreen_WindowTemplates[] = .bg = 2, .tilemapLeft = 0, .tilemapTop = 18, - .width = 12, + .width = 20, .height = 2, .paletteNum = 15, .baseBlock = 641, @@ -2066,6 +2079,7 @@ static void CB2_Pokedex(void) void Task_OpenPokedexMainPage(u8 taskId) { sPokedexView->isSearchResults = FALSE; + sPokedexView->sEvoScreenData.fromEvoPage = FALSE; if (LoadPokedexListPage(PAGE_MAIN)) gTasks[taskId].func = Task_HandlePokedexInput; } @@ -3143,6 +3157,9 @@ static bool8 TryDoInfoScreenScroll(void) u16 nextPokemon; u16 selectedPokemon = sPokedexView->selectedPokemon; + if (sPokedexView->sEvoScreenData.fromEvoPage) + return FALSE; + if (JOY_NEW(DPAD_UP) && selectedPokemon) { nextPokemon = selectedPokemon; @@ -7534,29 +7551,64 @@ static void DestroySplitIcon(void) //PokedexPlus HGSS_Ui Evolution Page static const u8 sEvoFormsPageNavigationTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY}; -static void EvoFormsPage_PrintAToggleUpdownEvos(void) +static void EvoFormsPage_PrintNavigationButtons(void) { - u8 x = 9; + u8 x = 6; u8 y = 0; - if (sPokedexView->selectedScreen == EVO_SCREEN) - { - if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_PE); - else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped_PE); - } - else if (sPokedexView->selectedScreen == FORMS_SCREEN) - { + #ifdef POKEMON_EXPANSION + if (sPokedexView->selectedScreen == EVO_SCREEN) + { + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_PE); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped_PE); + } + else if (sPokedexView->selectedScreen == FORMS_SCREEN) + { + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_PE); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Decapped_PE); + } + #else if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_PE); + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons); else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Decapped_PE); - } + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped); + #endif // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) PutWindowTilemap(WIN_NAVIGATION_BUTTONS); CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); } +static void ResetEvoScreenDataStruct(void) +{ + u8 i; + sPokedexView->sEvoScreenData.numAllEvolutions = 0; + sPokedexView->sEvoScreenData.numSeen = 0; + sPokedexView->sEvoScreenData.menuPos = 0; + for (i = 0; i < 10; i++) + { + sPokedexView->sEvoScreenData.targetSpecies[i] = 0; + sPokedexView->sEvoScreenData.seen[i] = 0; + } + +} +static void GetSeenFlagTargetSpecies(void) +{ + u8 i; + u16 species; + for (i = 0; i < sPokedexView->sEvoScreenData.numAllEvolutions; i++) + { + species = sPokedexView->sEvoScreenData.targetSpecies[i]; + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN)) + { + sPokedexView->sEvoScreenData.seen[i] = TRUE; + sPokedexView->sEvoScreenData.numSeen += 1; + } + + } +} static void Task_LoadEvolutionScreen(u8 taskId) { switch (gMain.state) @@ -7601,17 +7653,17 @@ static void Task_LoadEvolutionScreen(u8 taskId) if (gTasks[taskId].data[1] == 0) { sPokedexView->selectedScreen = EVO_SCREEN; + ResetEvoScreenDataStruct(); //Icon FreeMonIconPalettes(); //Free space for new pallete LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon PrintPreEvolutions(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); - #ifndef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0, TRUE); //Create pokemon sprite - #endif #ifdef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0); //Create pokemon sprite - EvoFormsPage_PrintAToggleUpdownEvos(); //HGSS_Ui Navigation buttons + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0); //Create pokemon sprite + #else + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0, TRUE); //Create pokemon sprite #endif + EvoFormsPage_PrintNavigationButtons(); //HGSS_Ui Navigation buttons gSprites[gTasks[taskId].data[4]].oam.priority = 0; } gMain.state++; @@ -7620,6 +7672,13 @@ static void Task_LoadEvolutionScreen(u8 taskId) //Print evo info and icons gTasks[taskId].data[3] = 0; PrintEvolutionTargetSpeciesAndMethod(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, sPokedexView->numPreEvolutions); + LoadSpritePalette(&sSpritePalette_Arrow); + GetSeenFlagTargetSpecies(); + if (sPokedexView->sEvoScreenData.numAllEvolutions != 0 && sPokedexView->sEvoScreenData.numSeen != 0) + { + sPokedexView->sEvoScreenData.arrowSpriteId = CreateSprite(&sSpriteTemplate_Arrow, 7, 58, 0); + gSprites[sPokedexView->sEvoScreenData.arrowSpriteId].animNum = 2; + } gMain.state++; break; case 5: @@ -7667,7 +7726,7 @@ static void Task_HandleEvolutionScreenInput(u8 taskId) { //Switch to forms screen, Pokemon Expansion only (rhh) #ifdef POKEMON_EXPANSION - if (JOY_NEW(A_BUTTON)) + if (JOY_NEW(START_BUTTON)) { sPokedexView->selectedScreen = FORMS_SCREEN; BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); @@ -7677,6 +7736,52 @@ static void Task_HandleEvolutionScreenInput(u8 taskId) } #endif + if (sPokedexView->sEvoScreenData.numAllEvolutions != 0 && sPokedexView->sEvoScreenData.numSeen != 0) + { + u8 i; + u8 base_y = 58; + u8 base_y_offset = 9; + u8 pos = sPokedexView->sEvoScreenData.menuPos; + u8 max = sPokedexView->sEvoScreenData.numAllEvolutions; + if (JOY_NEW(DPAD_DOWN)) + { + while (TRUE) + { + pos += 1; + if (pos >= max) + pos = 0; + + if (sPokedexView->sEvoScreenData.seen[pos] == TRUE) + break; + } + gSprites[sPokedexView->sEvoScreenData.arrowSpriteId].y = base_y + base_y_offset * pos; + sPokedexView->sEvoScreenData.menuPos = pos; + } + else if (JOY_NEW(DPAD_UP)) + { + if (sPokedexView->sEvoScreenData.menuPos == 0) + sPokedexView->sEvoScreenData.menuPos = sPokedexView->sEvoScreenData.numAllEvolutions - 1; + else + sPokedexView->sEvoScreenData.menuPos -= 1; + + gSprites[sPokedexView->sEvoScreenData.arrowSpriteId].y = base_y + base_y_offset * sPokedexView->sEvoScreenData.menuPos; + } + + if (JOY_NEW(A_BUTTON)) + { + u16 targetSpecies = sPokedexView->sEvoScreenData.targetSpecies[sPokedexView->sEvoScreenData.menuPos]; + u16 dexNum = SpeciesToNationalPokedexNum(targetSpecies); + sPokedexListItem->dexNum = dexNum; + sPokedexListItem->seen = GetSetPokedexFlag(dexNum, FLAG_GET_SEEN); + sPokedexListItem->owned = GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT); + + sPokedexView->sEvoScreenData.fromEvoPage = TRUE; + PlaySE(SE_PIN); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_LoadInfoScreenWaitForFade; + } + } + //Exit to overview if (JOY_NEW(B_BUTTON)) { @@ -7792,7 +7897,7 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) u16 i; u16 j; - u8 base_x = 13; + u8 base_x = 13+8; u8 base_x_offset = 54; u8 base_y = 51; u8 base_y_offset = 9; @@ -7843,10 +7948,21 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) HandlePreEvolutionSpeciesPrint(taskId, preEvolutionOne, species, base_x, base_y, base_y_offset, numPreEvolutions - 1); } + if (preEvolutionTwo != 0) + { + sPokedexView->sEvoScreenData.targetSpecies[0] = preEvolutionTwo; + sPokedexView->sEvoScreenData.targetSpecies[1] = preEvolutionOne; + } + else if (preEvolutionOne != 0) + { + sPokedexView->sEvoScreenData.targetSpecies[0] = preEvolutionOne; + } + //vertical line FillWindowPixelRect(0, PIXEL_FILL(5), 33 + 32*numPreEvolutions, 18, 1, 32); //PIXEL_FILL(15) for black sPokedexView->numPreEvolutions = numPreEvolutions; + sPokedexView->sEvoScreenData.numAllEvolutions += numPreEvolutions; return numPreEvolutions; } @@ -7864,7 +7980,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u16 item; bool8 left = TRUE; - u8 base_x = 13; + u8 base_x = 13+8; u8 base_x_offset = 54; u8 base_y = 51; u8 base_y_offset = 9; @@ -7905,7 +8021,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, if (times == 0 && depth == 0) { StringExpandPlaceholders(gStringVar4, gText_EVO_NONE); - PrintInfoScreenTextSmall(gStringVar4, base_x-7, base_y + base_y_offset*depth_i); + PrintInfoScreenTextSmall(gStringVar4, base_x-7-7, base_y + base_y_offset*depth_i); } //If there are evolutions find out which and print them 1 by 1 @@ -7916,6 +8032,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, previousTargetSpecies = targetSpecies; targetSpecies = gEvolutionTable[species][i].targetSpecies; + sPokedexView->sEvoScreenData.targetSpecies[sPokedexView->sEvoScreenData.numAllEvolutions++] = targetSpecies; #ifdef TX_DIFFICULTY_CHALLENGES_USED if (gSaveBlock1Ptr->txRandEvolutions && targetSpecies != SPECIES_NONE) //tx_difficulty_challenges targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_OFFSET_EVOLUTION, TRUE, !gSaveBlock1Ptr->txRandChaos); @@ -8370,7 +8487,7 @@ static void Task_LoadFormsScreen(u8 taskId) gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite gSprites[gTasks[taskId].data[4]].oam.priority = 0; } - EvoFormsPage_PrintAToggleUpdownEvos(); //HGSS_Ui Navigation buttons + EvoFormsPage_PrintNavigationButtons(); //HGSS_Ui Navigation buttons gMain.state++; break; case 4: diff --git a/src/reset_rtc_screen.c b/src/reset_rtc_screen.c index 25e3a7330201..34c388969df1 100644 --- a/src/reset_rtc_screen.c +++ b/src/reset_rtc_screen.c @@ -181,7 +181,7 @@ static const struct SpriteFrameImage sPicTable_Arrow[] = obj_frame_tiles(sArrowRight_Gfx) }; -static const struct SpritePalette sSpritePalette_Arrow = +const struct SpritePalette sSpritePalette_Arrow = { sArrow_Pal, PALTAG_ARROW }; @@ -217,7 +217,7 @@ static const union AnimCmd *const sAnims_Arrow[] = [ARROW_RIGHT] = sAnim_Arrow_Right, }; -static const struct SpriteTemplate sSpriteTemplate_Arrow = +const struct SpriteTemplate sSpriteTemplate_Arrow = { .tileTag = TAG_NONE, .paletteTag = PALTAG_ARROW, diff --git a/src/strings.c b/src/strings.c index caba16cb283a..43e10546111c 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1890,8 +1890,10 @@ const u8 gText_Stats_eggGroup_UNDISCOVERED[]= _("---"); const u8 gText_Dex_SEEN[] = _("SEEN"); const u8 gText_Dex_OWN[] = _("OWN"); -const u8 gText_EVO_Buttons_PE[] = _("{A_BUTTON}FORMS"); -const u8 gText_EVO_Buttons_Decapped_PE[] = _("{A_BUTTON}Forms"); +const u8 gText_EVO_Buttons[] = _("{DPAD_UPDOWN}EVOs {A_BUTTON}CHECK"); +const u8 gText_EVO_Buttons_Decapped[] = _("{DPAD_UPDOWN}Evos {A_BUTTON}Check"); +const u8 gText_EVO_Buttons_PE[] = _("{DPAD_UPDOWN}EVOs {A_BUTTON}CHECK {START_BUTTON}FORMS"); +const u8 gText_EVO_Buttons_Decapped_PE[] = _("{DPAD_UPDOWN}Evos {A_BUTTON}Check {START_BUTTON}Froms"); const u8 gText_EVO_Name[] = _("{STR_VAR_3}:"); const u8 gText_EVO_PreEvo[] = _("{STR_VAR_1} evolves from {STR_VAR_2}"); const u8 gText_EVO_FRIENDSHIP[] = _("LvlUp, high friendship"); From b2601f043baa4a0dfa45643f1b00db48572c713e Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 3 Jan 2022 21:38:59 +0100 Subject: [PATCH 57/88] added the ability to check out all data (base stats, moves, abilities etc) for the forms implmeneted in the RHH pokemon_expansion --- include/strings.h | 3 + src/pokedex.c | 284 +++++++++++++++++++++++++++++++++++++--------- src/strings.c | 9 +- 3 files changed, 240 insertions(+), 56 deletions(-) diff --git a/include/strings.h b/include/strings.h index ac83efbb858e..250e4710f4b5 100644 --- a/include/strings.h +++ b/include/strings.h @@ -609,6 +609,7 @@ extern const u8 gText_EVO_Buttons_PE[]; extern const u8 gText_EVO_Buttons_Decapped_PE[]; extern const u8 gText_EVO_Name[]; extern const u8 gText_EVO_PreEvo[]; +extern const u8 gText_EVO_PreEvo_PE_Mega[]; extern const u8 gText_EVO_FRIENDSHIP[]; extern const u8 gText_EVO_FRIENDSHIP_DAY[]; extern const u8 gText_EVO_FRIENDSHIP_NIGHT[]; @@ -646,6 +647,8 @@ extern const u8 gText_EVO_NONE[]; extern const u8 gText_FORMS_Buttons_PE[]; extern const u8 gText_FORMS_Buttons_Decapped_PE[]; +extern const u8 gText_FORMS_Buttons_Submenu_PE[]; +extern const u8 gText_FORMS_Buttons_Submenu_Decapped_PE[]; extern const u8 gText_FORMS_NONE[]; diff --git a/src/pokedex.c b/src/pokedex.c index 30003bccdf04..060878416117 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -228,7 +228,21 @@ struct EvoScreenData bool8 seen[10]; u8 menuPos; u8 arrowSpriteId; + #ifdef POKEMON_EXPANSION + bool8 isMega; + #endif +}; + +#ifdef POKEMON_EXPANSION +struct FromScreenData +{ + u8 numForms; + u16 formIds[30]; + bool8 inSubmenu; + u8 menuPos; + u8 arrowSpriteId; }; +#endif struct PokedexView { @@ -259,6 +273,10 @@ struct PokedexView u8 numPreEvolutions; //HGSS_Ui struct PokemonStats sPokemonStats; //HGSS_Ui struct EvoScreenData sEvoScreenData; //HGSS_Ui + #ifdef POKEMON_EXPANSION + struct FromScreenData sFormScreenData; //HGSS_Ui + #endif + u16 formSpecies; u16 selectedMonSpriteId; u16 pokeBallRotationStep; u16 pokeBallRotationBackup; @@ -395,6 +413,7 @@ static void CreateTypeIconSprites(void); #define HGSS_DECAPPED 0 //0 false, 1 true #define HGSS_DARK_MODE 0 //0 false, 1 true #define HGSS_HIDE_UNSEEN_EVOLUTION_NAMES 0 //0 false, 1 true +static u16 NationalPokedexNumToSpeciesHGSS(u16 nationalNum); static void LoadTilesetTilemapHGSS(u8 page); static void Task_HandleStatsScreenInput(u8 taskId); static void Task_LoadStatsScreen(u8 taskId); @@ -2079,7 +2098,10 @@ static void CB2_Pokedex(void) void Task_OpenPokedexMainPage(u8 taskId) { sPokedexView->isSearchResults = FALSE; + #ifdef POKEMON_EXPANSION sPokedexView->sEvoScreenData.fromEvoPage = FALSE; + sPokedexView->formSpecies = 0; + #endif if (LoadPokedexListPage(PAGE_MAIN)) gTasks[taskId].func = Task_HandlePokedexInput; } @@ -2299,6 +2321,10 @@ static void Task_ClosePokedex(u8 taskId) static void Task_OpenSearchResults(u8 taskId) { sPokedexView->isSearchResults = TRUE; + #ifdef POKEMON_EXPANSION + sPokedexView->sEvoScreenData.fromEvoPage = FALSE; + sPokedexView->formSpecies = 0; + #endif if (LoadPokedexListPage(PAGE_SEARCH_RESULTS)) gTasks[taskId].func = Task_HandleSearchResultsInput; } @@ -3958,7 +3984,7 @@ static void Task_LoadAreaScreen(u8 taskId) gMain.state++; break; case 2: - ShowPokedexAreaScreen(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), &sPokedexView->screenSwitchState); + ShowPokedexAreaScreen(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), &sPokedexView->screenSwitchState); SetVBlankCallback(gPokedexVBlankCB); sPokedexView->screenSwitchState = 0; gMain.state = 0; @@ -4108,7 +4134,7 @@ static void Task_HandleCryScreenInput(u8 taskId) if (JOY_NEW(A_BUTTON)) { LoadPlayArrowPalette(TRUE); - CryScreenPlayButton(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); + CryScreenPlayButton(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); return; } else if (!gPaletteFade.active) @@ -4485,7 +4511,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) case 6: if (!gPaletteFade.active) { - PlayCry_Normal(NationalPokedexNumToSpecies(dexNum), 0); + PlayCry_Normal(NationalPokedexNumToSpeciesHGSS(dexNum), 0); gTasks[taskId].tPalTimer = 0; gTasks[taskId].func = Task_HandleCaughtMonPageInput; } @@ -4629,7 +4655,7 @@ static void PrintCurrentSpeciesTypeInfo(u8 newEntry, u16 species) if (!newEntry) { - species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); dexNum = SpeciesToNationalPokedexNum(species); } //type icon(s) @@ -4689,7 +4715,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) value = num; ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); PrintInfoScreenTextWhite(str, 123, 17); //HGSS_Ui - species = NationalPokedexNumToSpecies(num); + species = NationalPokedexNumToSpeciesHGSS(num); if (species) name = gSpeciesNames[species]; else @@ -5083,7 +5109,7 @@ static u8 PrintCryScreenSpeciesName(u8 windowId, u16 num, u8 left, u8 top) for (i = 0; i < ARRAY_COUNT(str); i++) str[i] = EOS; - num = NationalPokedexNumToSpecies(num); + num = NationalPokedexNumToSpeciesHGSS(num); switch (num) { default: @@ -6326,6 +6352,23 @@ static void ClearSearchParameterBoxText(void) //PokedexPlus HGSS_Ui +static u16 NationalPokedexNumToSpeciesHGSS(u16 nationalNum) +{ + u16 species; + + if (!nationalNum) + return 0; + + #ifndef POKEMON_EXPANSION + return NationalPokedexNumToSpecies(nationalNum); + #else + if (sPokedexView->formSpecies != 0) + return sPokedexView->formSpecies; + else + return NationalPokedexNumToSpecies(nationalNum); + #endif +} + static void LoadTilesetTilemapHGSS(u8 page) { switch (page) @@ -6410,7 +6453,7 @@ static void ResetStatsWindows(void) } static void SaveMonDataInStruct(void) { - u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); u8 EVs[6] = {gBaseStats[species].evYield_HP, gBaseStats[species].evYield_Speed, gBaseStats[species].evYield_Attack, gBaseStats[species].evYield_SpAttack, gBaseStats[species].evYield_Defense, gBaseStats[species].evYield_SpDefense}; u8 differentEVs; u8 i; @@ -6515,12 +6558,12 @@ static void Task_LoadStatsScreen(u8 taskId) { //Icon FreeMonIconPalettes(); //Free space for new pallete - LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon + LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon #ifndef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0, TRUE); //Create pokemon sprite + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0, TRUE); //Create pokemon sprite #endif #ifdef POKEMON_EXPANSION - gTasks[taskId].data[6] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite + gTasks[taskId].data[6] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite #endif gSprites[gTasks[taskId].data[4]].oam.priority = 0; } @@ -6696,7 +6739,7 @@ static void PrintStatsScreen_DestroyMoveItemIcon(u8 taskId) } static bool8 CalculateMoves(void) { - u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); u16 statsMovesEgg[EGG_MOVES_ARRAY_COUNT] = {0}; u16 statsMovesLevelUp[EGG_LVL_UP_MOVES_ARRAY_COUNT] = {0}; @@ -6769,7 +6812,7 @@ static void PrintStatsScreen_Moves_Top(u8 taskId) u16 move; u16 item; - u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); //Move move = sStatsMoves[selected]; @@ -6947,7 +6990,7 @@ static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value) u8 str[16]; u8 str2[32]; u8 strEV[25]; - u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); u16 natNum; u8 evVal; const u8 *category; @@ -7044,7 +7087,6 @@ static void PrintStatsScreen_Left(u8 taskId) u8 base_y = 5; u32 align_x; u8 total_x = 93; - u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); u8 strEV[25]; u8 strBase[14]; u8 EVs[6] = {sPokedexView->sPokemonStats.evYield_HP, sPokedexView->sPokemonStats.evYield_Speed, sPokedexView->sPokemonStats.evYield_Attack, sPokedexView->sPokemonStats.evYield_SpAttack, sPokedexView->sPokemonStats.evYield_Defense, sPokedexView->sPokemonStats.evYield_SpDefense}; @@ -7447,7 +7489,7 @@ static void PrintStatsScreen_Left(u8 taskId) } static void PrintStatsScreen_Abilities(u8 taskId) { - u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum); + u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); u8 abilities_x = 5; u8 abilities_y = 3; u16 ability0; @@ -7459,12 +7501,12 @@ static void PrintStatsScreen_Abilities(u8 taskId) if (gTasks[taskId].data[5] == 0) { #endif - ability0 = sPokedexView->sPokemonStats.ability0; //GetAbilityBySpecies(species, 0); //gBaseStats[species].abilities[0]; + ability0 = sPokedexView->sPokemonStats.ability0; PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability0], abilities_x, abilities_y); PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); - ability1 = sPokedexView->sPokemonStats.ability1; //GetAbilityBySpecies(species, 1); - if (ability1 != ABILITY_NONE) //(gBaseStats[species].abilities[1] != ABILITY_NONE) + ability1 = sPokedexView->sPokemonStats.ability1; + if (ability1 != ABILITY_NONE && ability1 != ability0) { PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability1], abilities_x, abilities_y + 30); PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[ability1], abilities_x, abilities_y + 44); @@ -7473,7 +7515,7 @@ static void PrintStatsScreen_Abilities(u8 taskId) } else //Hidden abilities { - abilityHidden = sPokedexView->sPokemonStats.abilityHidden; //GetAbilityBySpecies(species, 2); + abilityHidden = sPokedexView->sPokemonStats.abilityHidden; PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[abilityHidden], abilities_x, abilities_y); PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[abilityHidden], abilities_x, abilities_y + 14); } @@ -7556,6 +7598,8 @@ static void EvoFormsPage_PrintNavigationButtons(void) u8 x = 6; u8 y = 0; + FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); + #ifdef POKEMON_EXPANSION if (sPokedexView->selectedScreen == EVO_SCREEN) { @@ -7566,10 +7610,20 @@ static void EvoFormsPage_PrintNavigationButtons(void) } else if (sPokedexView->selectedScreen == FORMS_SCREEN) { - if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_PE); + if (sPokedexView->sFormScreenData.inSubmenu) + { + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Submenu_PE); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Submenu_Decapped_PE); + } else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Decapped_PE); + { + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_PE); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Decapped_PE); + } } #else if (!HGSS_DECAPPED) @@ -7656,12 +7710,12 @@ static void Task_LoadEvolutionScreen(u8 taskId) ResetEvoScreenDataStruct(); //Icon FreeMonIconPalettes(); //Free space for new pallete - LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon - PrintPreEvolutions(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); + LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon + PrintPreEvolutions(taskId, NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); #ifdef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0); //Create pokemon sprite + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0); //Create pokemon sprite #else - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0, TRUE); //Create pokemon sprite + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0, TRUE); //Create pokemon sprite #endif EvoFormsPage_PrintNavigationButtons(); //HGSS_Ui Navigation buttons gSprites[gTasks[taskId].data[4]].oam.priority = 0; @@ -7671,7 +7725,7 @@ static void Task_LoadEvolutionScreen(u8 taskId) case 4: //Print evo info and icons gTasks[taskId].data[3] = 0; - PrintEvolutionTargetSpeciesAndMethod(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, sPokedexView->numPreEvolutions); + PrintEvolutionTargetSpeciesAndMethod(taskId, NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), 0, sPokedexView->numPreEvolutions); LoadSpritePalette(&sSpritePalette_Arrow); GetSeenFlagTargetSpecies(); if (sPokedexView->sEvoScreenData.numAllEvolutions != 0 && sPokedexView->sEvoScreenData.numSeen != 0) @@ -7775,6 +7829,13 @@ static void Task_HandleEvolutionScreenInput(u8 taskId) sPokedexListItem->seen = GetSetPokedexFlag(dexNum, FLAG_GET_SEEN); sPokedexListItem->owned = GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT); + #ifdef POKEMON_EXPANSION + if (gFormSpeciesIdTables[targetSpecies] != NULL) + sPokedexView->formSpecies = targetSpecies; + else + sPokedexView->formSpecies = 0; + #endif + sPokedexView->sEvoScreenData.fromEvoPage = TRUE; PlaySE(SE_PIN); BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); @@ -7871,12 +7932,25 @@ static void HandlePreEvolutionSpeciesPrint(u8 taskId, u16 preSpecies, u16 specie bool8 seen = GetSetPokedexFlag(SpeciesToNationalPokedexNum(preSpecies), FLAG_GET_SEEN); StringCopy(gStringVar1, gSpeciesNames[species]); //evolution mon name - if (seen || !HGSS_HIDE_UNSEEN_EVOLUTION_NAMES) - StringCopy(gStringVar2, gSpeciesNames[preSpecies]); //evolution mon name + + #ifdef POKEMON_EXPANSION + if (sPokedexView->sEvoScreenData.isMega) + StringExpandPlaceholders(gStringVar3, gText_EVO_PreEvo_PE_Mega); else - StringCopy(gStringVar2, gText_ThreeQuestionMarks); //show questionmarks instead of name + { + #endif + + if (seen || !HGSS_HIDE_UNSEEN_EVOLUTION_NAMES) + StringCopy(gStringVar2, gSpeciesNames[preSpecies]); //evolution mon name + else + StringCopy(gStringVar2, gText_ThreeQuestionMarks); //show questionmarks instead of name + + StringExpandPlaceholders(gStringVar3, gText_EVO_PreEvo); //evolution mon name + + #ifdef POKEMON_EXPANSION + } + #endif - StringExpandPlaceholders(gStringVar3, gText_EVO_PreEvo); //evolution mon name PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); //evolution mon name if(base_i < 3) @@ -7898,7 +7972,6 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) u16 j; u8 base_x = 13+8; - u8 base_x_offset = 54; u8 base_y = 51; u8 base_y_offset = 9; u8 base_i = 0; @@ -7908,6 +7981,11 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) u16 preEvolutionTwo = 0; u8 numPreEvolutions = 0; + #ifdef POKEMON_EXPANSION + bool8 isMega = FALSE; + sPokedexView->sEvoScreenData.isMega = FALSE; + #endif + //Calculate previous evolution for (i = 0; i < NUM_SPECIES; i++) { @@ -7917,11 +7995,31 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) { preEvolutionOne = i; numPreEvolutions += 1; + #ifdef POKEMON_EXPANSION + if (gEvolutionTable[i][j].method == EVO_MEGA_EVOLUTION) + { + CopyItemName(gEvolutionTable[i][j].param, gStringVar2); //item + isMega = TRUE; + } + #endif break; } } } + #ifdef POKEMON_EXPANSION + if (isMega) + { + sPokedexView->numPreEvolutions = numPreEvolutions; + sPokedexView->sEvoScreenData.numAllEvolutions += numPreEvolutions; + sPokedexView->sEvoScreenData.isMega = isMega; + + CreateCaughtBallEvolutionScreen(preEvolutionOne, base_x - 9 - 8, base_y + base_y_offset*(numPreEvolutions - 1), 0); + HandlePreEvolutionSpeciesPrint(taskId, preEvolutionOne, species, base_x - 8, base_y, base_y_offset, numPreEvolutions - 1); + return numPreEvolutions; + } + #endif + //Calculate if previous evolution also has a previous evolution if (numPreEvolutions != 0) { @@ -7959,7 +8057,7 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) } //vertical line - FillWindowPixelRect(0, PIXEL_FILL(5), 33 + 32*numPreEvolutions, 18, 1, 32); //PIXEL_FILL(15) for black + //FillWindowPixelRect(0, PIXEL_FILL(5), 33 + 32*numPreEvolutions, 18, 1, 32); //PIXEL_FILL(15) for black sPokedexView->numPreEvolutions = numPreEvolutions; sPokedexView->sEvoScreenData.numAllEvolutions += numPreEvolutions; @@ -7981,7 +8079,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, bool8 left = TRUE; u8 base_x = 13+8; - u8 base_x_offset = 54; + u8 base_x_offset = 54+8; u8 base_y = 51; u8 base_y_offset = 9; u8 base_i = 0; @@ -7989,6 +8087,11 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_x = 16; bool8 isEevee = FALSE; + #ifdef POKEMON_EXPANSION + if (sPokedexView->sEvoScreenData.isMega) + return 0; + #endif + StringCopy(gStringVar1, gSpeciesNames[species]); if (species == SPECIES_EEVEE) @@ -8483,17 +8586,19 @@ static void Task_LoadFormsScreen(u8 taskId) { //Icon FreeMonIconPalettes(); //Free space for new pallete - LoadMonIconPalette(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); //Loads pallete for current mon - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite + LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite gSprites[gTasks[taskId].data[4]].oam.priority = 0; } EvoFormsPage_PrintNavigationButtons(); //HGSS_Ui Navigation buttons + sPokedexView->sFormScreenData.menuPos = 1; gMain.state++; break; case 4: //Print form icons gTasks[taskId].data[3] = 0; - PrintForms(taskId, NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); + PrintForms(taskId, NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); + LoadSpritePalette(&sSpritePalette_Arrow); gMain.state++; break; case 5: @@ -8539,29 +8644,100 @@ static void Task_LoadFormsScreen(u8 taskId) } static void Task_HandleFormsScreenInput(u8 taskId) { - if (JOY_NEW(A_BUTTON)) + u8 base_x = 5; + u8 base_y = 34; + u8 offset_x = 34; + u8 offset_y = 34; + if (!sPokedexView->sFormScreenData.inSubmenu) { - sPokedexView->selectedScreen = EVO_SCREEN; - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 1; - gTasks[taskId].func = Task_SwitchScreensFromFormsScreen; - PlaySE(SE_PIN); - } - + if (JOY_NEW(A_BUTTON)) + { + sPokedexView->sFormScreenData.inSubmenu = TRUE; + sPokedexView->sFormScreenData.arrowSpriteId = CreateSprite(&gSpriteTemplate_Arrow, base_x + offset_x, base_y, 0); + gSprites[sPokedexView->sFormScreenData.arrowSpriteId].animNum = 2; + EvoFormsPage_PrintNavigationButtons(); + } - //Exit to overview - if (JOY_NEW(B_BUTTON)) - { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); - gTasks[taskId].func = Task_ExitFormsScreen; - PlaySE(SE_PC_OFF); - return; + if (JOY_NEW(START_BUTTON)) + { + sPokedexView->selectedScreen = EVO_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromFormsScreen; + PlaySE(SE_PIN); + } + + //Exit to overview + if (JOY_NEW(B_BUTTON)) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_ExitFormsScreen; + PlaySE(SE_PC_OFF); + return; + } } + else //inSubmenu + { + u8 row = 0; + u8 column = 0; + u8 menuPos = sPokedexView->sFormScreenData.menuPos; + //Grid navigation + if (JOY_NEW(DPAD_RIGHT)) + menuPos += 1; + else if (JOY_NEW(DPAD_LEFT)) + menuPos -= 1; + else if (JOY_NEW(DPAD_DOWN)) + menuPos += 7; + else if (JOY_NEW(DPAD_UP)) + { + if (menuPos > 7) + menuPos -= 7; + else + menuPos = 1; + } + + if (menuPos <= 0) + menuPos = 1; + else if (menuPos >= sPokedexView->sFormScreenData.numForms) + menuPos = sPokedexView->sFormScreenData.numForms; + + row = menuPos / 7; + column = menuPos % 7; + gSprites[sPokedexView->sFormScreenData.arrowSpriteId].x = base_x + offset_x * column; + gSprites[sPokedexView->sFormScreenData.arrowSpriteId].y = base_y + offset_y * row; + + sPokedexView->sFormScreenData.menuPos = menuPos; + + + if (JOY_NEW(A_BUTTON)) + { + u8 formId = sPokedexView->sFormScreenData.formIds[menuPos]; + u16 formSpecies = GetFormSpeciesId(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), formId); + if (formSpecies == GetFormSpeciesId(formSpecies, 0)) + sPokedexView->formSpecies = 0; + else + sPokedexView->formSpecies = formSpecies; + + sPokedexView->sEvoScreenData.fromEvoPage = TRUE; + sPokedexView->sFormScreenData.inSubmenu = FALSE; + PlaySE(SE_PIN); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_LoadInfoScreenWaitForFade; + } + + if (JOY_NEW(B_BUTTON)) + { + DestroySprite(&gSprites[sPokedexView->sFormScreenData.arrowSpriteId]); + sPokedexView->sFormScreenData.inSubmenu = FALSE; + EvoFormsPage_PrintNavigationButtons(); + } + } } #define FORM_SPECIES_END (0xffff) static void PrintForms(u8 taskId, u16 species) { - int i; + u8 i; + u8 j = 1; u16 speciesForm; @@ -8588,6 +8764,7 @@ static void PrintForms(u8 taskId, u16 species) continue; else { + sPokedexView->sFormScreenData.formIds[j++] = i; times += 1; LoadMonIconPalette(speciesForm); //Loads pallete for current mon if (times < 7) @@ -8602,6 +8779,7 @@ static void PrintForms(u8 taskId, u16 species) } } gTasks[taskId].data[3] = times; + sPokedexView->sFormScreenData.numForms = times; //If there are no forms print text if (times == 0) diff --git a/src/strings.c b/src/strings.c index 43e10546111c..4fc2048ac9f7 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1892,10 +1892,11 @@ const u8 gText_Dex_OWN[] = _("OWN"); const u8 gText_EVO_Buttons[] = _("{DPAD_UPDOWN}EVOs {A_BUTTON}CHECK"); const u8 gText_EVO_Buttons_Decapped[] = _("{DPAD_UPDOWN}Evos {A_BUTTON}Check"); -const u8 gText_EVO_Buttons_PE[] = _("{DPAD_UPDOWN}EVOs {A_BUTTON}CHECK {START_BUTTON}FORMS"); +const u8 gText_EVO_Buttons_PE[] = _("{DPAD_UPDOWN}EVOs {A_BUTTON}CHECK {START_BUTTON}FORMs"); const u8 gText_EVO_Buttons_Decapped_PE[] = _("{DPAD_UPDOWN}Evos {A_BUTTON}Check {START_BUTTON}Froms"); const u8 gText_EVO_Name[] = _("{STR_VAR_3}:"); const u8 gText_EVO_PreEvo[] = _("{STR_VAR_1} evolves from {STR_VAR_2}"); +const u8 gText_EVO_PreEvo_PE_Mega[] = _("{STR_VAR_1} mega evolves with {STR_VAR_2}"); const u8 gText_EVO_FRIENDSHIP[] = _("LvlUp, high friendship"); const u8 gText_EVO_FRIENDSHIP_DAY[] = _("LvlUp, high friendship, day"); const u8 gText_EVO_FRIENDSHIP_NIGHT[] = _("Lvlup, high friendship, night"); @@ -1931,6 +1932,8 @@ const u8 gText_EVO_SPECIFIC_MAP[] = _("LvlUp on {STR_VAR_2}"); const u8 gText_EVO_UNKNOWN[] = _("Method unknown"); const u8 gText_EVO_NONE[] = _("{STR_VAR_1} has no evolution."); -const u8 gText_FORMS_Buttons_PE[] = _("{A_BUTTON}EVOLUTIONS"); -const u8 gText_FORMS_Buttons_Decapped_PE[] = _("{A_BUTTON}Evolutions"); +const u8 gText_FORMS_Buttons_PE[] = _("{A_BUTTON}FORM MODE {START_BUTTON}EVOs"); +const u8 gText_FORMS_Buttons_Decapped_PE[] = _("{START_BUTTON}Evos"); +const u8 gText_FORMS_Buttons_Submenu_PE[] = _("{DPAD_NONE}FORMs {A_BUTTON}CHECK {START_BUTTON}EVOs"); +const u8 gText_FORMS_Buttons_Submenu_Decapped_PE[] = _("{START_BUTTON}Evos"); const u8 gText_FORMS_NONE[] = _("{STR_VAR_1} has no alternate forms."); From 868d51d4d2c3dee90c291c2d41d9850293ca4450 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 3 Jan 2022 22:40:22 +0100 Subject: [PATCH 58/88] fixed a potential bug --- src/pokedex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 060878416117..41048cdc6671 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -141,7 +141,7 @@ static EWRAM_DATA u16 sLastSelectedPokemon = 0; static EWRAM_DATA u8 sPokeBallRotation = 0; static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL; //Pokedex Plus HGSS_Ui -#define MOVES_COUNT_TOTAL (EGG_LVL_UP_MOVES_ARRAY_COUNT + EGG_MOVES_ARRAY_COUNT + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + TUTOR_MOVE_COUNT) +#define MOVES_COUNT_TOTAL (EGG_MOVES_ARRAY_COUNT + MAX_LEVEL_UP_MOVES + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + TUTOR_MOVE_COUNT) EWRAM_DATA static u16 sStatsMoves[MOVES_COUNT_TOTAL] = {0}; EWRAM_DATA static u16 sStatsMovesTMHM_ID[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; @@ -6742,7 +6742,7 @@ static bool8 CalculateMoves(void) u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); u16 statsMovesEgg[EGG_MOVES_ARRAY_COUNT] = {0}; - u16 statsMovesLevelUp[EGG_LVL_UP_MOVES_ARRAY_COUNT] = {0}; + u16 statsMovesLevelUp[MAX_LEVEL_UP_MOVES] = {0}; u16 statsMovesTMHM[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; u16 statsMovesTutor[TUTOR_MOVE_COUNT] = {0}; From 1626db9b0595640f443463b2c56b3fd7974e06a5 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 3 Jan 2022 22:42:25 +0100 Subject: [PATCH 59/88] fixed unown forms page for unown forms (base form worked before) --- src/pokedex.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pokedex.c b/src/pokedex.c index 41048cdc6671..29c1a32ae954 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -8752,6 +8752,9 @@ static void PrintForms(u8 taskId, u16 species) if (species == SPECIES_UNOWN) y_offset_icons = 8; + + if (GetFormSpeciesId(species, 0) == SPECIES_UNOWN) + y_offset_icons = 8; StringCopy(gStringVar1, gSpeciesNames[species]); From a81841d436aabf91da1f2b4456334a8727fbe0f5 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 15 Feb 2022 16:22:56 -0300 Subject: [PATCH 60/88] Update pokedex.c --- src/pokedex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pokedex.c b/src/pokedex.c index 29c1a32ae954..a9bd1fa017d3 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -28,6 +28,7 @@ #include "pokemon_summary_screen.h" #ifdef POKEMON_EXPANSION #include "region_map.h" +#include "pokemon.h" #endif #include "reset_rtc_screen.h" #include "scanline_effect.h" From a305e09fbd4eec6ae20b36ca2171311c9ae85fe6 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 14 Mar 2022 10:19:03 +0100 Subject: [PATCH 61/88] small fix preventing selection sprites if no forms exist --- src/pokedex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokedex.c b/src/pokedex.c index a9bd1fa017d3..bf53e5d2b369 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -8651,7 +8651,7 @@ static void Task_HandleFormsScreenInput(u8 taskId) u8 offset_y = 34; if (!sPokedexView->sFormScreenData.inSubmenu) { - if (JOY_NEW(A_BUTTON)) + if (JOY_NEW(A_BUTTON) && sPokedexView->sFormScreenData.numForms != 0) { sPokedexView->sFormScreenData.inSubmenu = TRUE; sPokedexView->sFormScreenData.arrowSpriteId = CreateSprite(&gSpriteTemplate_Arrow, base_x + offset_x, base_y, 0); From edc46a992047b73770aca9114a629082a31cab75 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sat, 16 Apr 2022 23:14:49 +0200 Subject: [PATCH 62/88] changes for new tx_randomizer_and_challenges --- src/pokedex.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index bf53e5d2b369..213a812478bc 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -48,8 +48,8 @@ #include "constants/party_menu.h" #include "constants/rgb.h" #include "constants/songs.h" -#ifdef TX_DIFFICULTY_CHALLENGES_USED - //#include "tx_difficulty_challenges.h" +#ifdef TX_RANDOMIZER_AND_CHALLENGES + //#include "tx_randomizer_and_challenges.h" #endif enum @@ -4660,7 +4660,7 @@ static void PrintCurrentSpeciesTypeInfo(u8 newEntry, u16 species) dexNum = SpeciesToNationalPokedexNum(species); } //type icon(s) - #ifdef TX_DIFFICULTY_CHALLENGES_USED + #ifdef TX_RANDOMIZER_AND_CHALLENGES type1 = GetTypeBySpecies(species, 1); type2 = GetTypeBySpecies(species, 2); #else @@ -8098,10 +8098,10 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, if (species == SPECIES_EEVEE) isEevee = TRUE; - #ifdef TX_DIFFICULTY_CHALLENGES_USED - if (gSaveBlock1Ptr->txRandEvolutionMethodes) //tx_difficulty_challenges + #ifdef TX_RANDOMIZER_AND_CHALLENGES + if (gSaveBlock1Ptr->tx_Random_EvolutionMethodes) //tx_randomizer_and_challenges { - species = GetEvolutionTargetSpeciesRandom(species, gSaveBlock1Ptr->txRandEvolutions, !gSaveBlock1Ptr->txRandChaos); + species = GetEvolutionTargetSpeciesRandom(species, gSaveBlock1Ptr->tx_Random_Evolutions, !gSaveBlock1Ptr->tx_Random_Chaos); if (species == SPECIES_NONE) return SPECIES_NONE; } @@ -8137,9 +8137,9 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, previousTargetSpecies = targetSpecies; targetSpecies = gEvolutionTable[species][i].targetSpecies; sPokedexView->sEvoScreenData.targetSpecies[sPokedexView->sEvoScreenData.numAllEvolutions++] = targetSpecies; - #ifdef TX_DIFFICULTY_CHALLENGES_USED - if (gSaveBlock1Ptr->txRandEvolutions && targetSpecies != SPECIES_NONE) //tx_difficulty_challenges - targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_OFFSET_EVOLUTION, TRUE, !gSaveBlock1Ptr->txRandChaos); + #ifdef TX_RANDOMIZER_AND_CHALLENGES + if (gSaveBlock1Ptr->tx_Random_Evolutions && targetSpecies != SPECIES_NONE) //tx_randomizer_and_challenges + targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_OFFSET_EVOLUTION, TRUE, !gSaveBlock1Ptr->tx_Random_Chaos); #endif CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); HandleTargetSpeciesPrint(taskId, targetSpecies, previousTargetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i, isEevee); //evolution mon name From 509b92bbfd36549c75a795c876c418ceac3ba8bf Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 17 Apr 2022 00:58:37 +0200 Subject: [PATCH 63/88] saves the gba from calculating randomized preEvolutions --- src/pokedex.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pokedex.c b/src/pokedex.c index 86a3ef3ae4be..6a228550f513 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7982,6 +7982,11 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) u16 preEvolutionTwo = 0; u8 numPreEvolutions = 0; + #ifdef TX_RANDOMIZER_AND_CHALLENGES + if (gSaveBlock1Ptr->tx_Random_Evolutions || gSaveBlock1Ptr->tx_Random_EvolutionMethodes) + return 0; + #endif + #ifdef POKEMON_EXPANSION bool8 isMega = FALSE; sPokedexView->sEvoScreenData.isMega = FALSE; From 5bb3e783877adbcc97de38c8cc44951c767dcea3 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 17 Apr 2022 17:05:27 +0200 Subject: [PATCH 64/88] more tx_randomizer_and_challenges compatibility --- src/pokedex.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 06bed13e6b79..417d0f634b8d 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7717,6 +7717,11 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) u16 preEvolutionTwo = 0; u8 numPreEvolutions = 0; + #ifdef TX_RANDOMIZER_AND_CHALLENGES + if (gSaveBlock1Ptr->tx_Random_Evolutions || gSaveBlock1Ptr->tx_Random_EvolutionMethods) + return 0; + #endif + //Calculate previous evolution for (i = 0; i < NUM_SPECIES; i++) { @@ -7792,13 +7797,11 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, if (species == SPECIES_EEVEE) isEevee = TRUE; - #ifdef TX_DIFFICULTY_CHALLENGES_USED - if (gSaveBlock1Ptr->txRandEvolutionMethodes) //tx_difficulty_challenges - { - species = GetEvolutionTargetSpeciesRandom(species, gSaveBlock1Ptr->txRandEvolutions, !gSaveBlock1Ptr->txRandChaos); - if (species == SPECIES_NONE) - return SPECIES_NONE; - } + #ifdef TX_RANDOMIZER_AND_CHALLENGES + if (EvolutionBlockedByEvoLimit(species)) //No Evos already previously checked + species = SPECIES_NONE; + else if (gSaveBlock1Ptr->tx_Random_EvolutionMethods) + species = GetSpeciesRandomSeeded(species, TX_RANDOM_T_EVO_METH); #endif //Calculate number of possible direct evolutions (e.g. Eevee has 5 but torchic has 1) @@ -7832,7 +7835,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, targetSpecies = gEvolutionTable[species][i].targetSpecies; #ifdef TX_DIFFICULTY_CHALLENGES_USED if (gSaveBlock1Ptr->txRandEvolutions && targetSpecies != SPECIES_NONE) //tx_difficulty_challenges - targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_OFFSET_EVOLUTION, TRUE, !gSaveBlock1Ptr->txRandChaos); + targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_T_EVO); #endif CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); HandleTargetSpeciesPrint(taskId, targetSpecies, previousTargetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i, isEevee); //evolution mon name From 59fea06badaf640b4428ab9c2a2598b8e2ad61d9 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 25 Apr 2022 11:19:13 -0400 Subject: [PATCH 65/88] =?UTF-8?q?Fixed=20compile=20when=20using=20both=20P?= =?UTF-8?q?ok=C3=A9mon=20expansion=20and=20randomizer/challenges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pokedex.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index d61a8e685337..4b881d094f28 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -7982,15 +7982,16 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) u16 preEvolutionTwo = 0; u8 numPreEvolutions = 0; + #ifdef POKEMON_EXPANSION + bool8 isMega = FALSE; + sPokedexView->sEvoScreenData.isMega = FALSE; + #endif + #ifdef TX_RANDOMIZER_AND_CHALLENGES if (gSaveBlock1Ptr->tx_Random_Evolutions || gSaveBlock1Ptr->tx_Random_EvolutionMethods) return 0; #endif - #ifdef POKEMON_EXPANSION - bool8 isMega = FALSE; - sPokedexView->sEvoScreenData.isMega = FALSE; - #endif //Calculate previous evolution for (i = 0; i < NUM_SPECIES; i++) From 6684ec96eabb140cebb8845dcb93973c30246064 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 7 May 2022 22:46:40 -0400 Subject: [PATCH 66/88] Fixed dex showing incorrect moves when using PE and BE --- src/pokedex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokedex.c b/src/pokedex.c index 4b881d094f28..0588d1ce7bce 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -5277,7 +5277,7 @@ bool8 SpeciesCanLearnLvlUpMove(u16 species, u16 move) //Move search PokedexPlus #if defined (BATTLE_ENGINE) || defined (POKEMON_EXPANSION) for (j = 0; j < MAX_LEVEL_UP_MOVES && gLevelUpLearnsets[species][j].move != LEVEL_UP_END; j++) { - if (move == (gLevelUpLearnsets[species][j].move & LEVEL_UP_MOVE_ID)) + if (move == (gLevelUpLearnsets[species][j].move)) { return TRUE; } From 6b217bbfcf6d13860d677d9dd0b24239b943312c Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 15 May 2022 00:13:29 +0200 Subject: [PATCH 67/88] fixes sprites on form pages not respecting the form (correct branch this time), credits @AsparagusEduardo --- src/pokedex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokedex.c b/src/pokedex.c index 0588d1ce7bce..a7ba0e9e784b 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -5261,7 +5261,7 @@ static u32 GetPokedexMonPersonality(u16 species) u16 CreateMonSpriteFromNationalDexNumber(u16 nationalNum, s16 x, s16 y, u16 paletteSlot) { - nationalNum = NationalPokedexNumToSpecies(nationalNum); + nationalNum = NationalPokedexNumToSpeciesHGSS(nationalNum); return CreateMonPicSprite_HandleDeoxys(nationalNum, SHINY_ODDS, GetPokedexMonPersonality(nationalNum), TRUE, x, y, paletteSlot, TAG_NONE); } From 675957c24ace17038ee373b1ae0930f6c1b36a29 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 15 May 2022 00:41:35 +0200 Subject: [PATCH 68/88] new caught mon page should now show proper form in PE --- include/pokedex.h | 2 +- src/battle_script_commands.c | 2 +- src/pokedex.c | 24 ++++++++++++++++++------ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/include/pokedex.h b/include/pokedex.h index 36a48da1e540..c1a1c0800db9 100644 --- a/include/pokedex.h +++ b/include/pokedex.h @@ -35,7 +35,7 @@ void ResetPokedex(void); u16 GetPokedexHeightWeight(u16 dexNum, u8 data); u16 GetNationalPokedexCount(u8); u16 GetHoennPokedexCount(u8); -u8 DisplayCaughtMonDexPage(u16 dexNum, u32 otId, u32 personality); +u8 DisplayCaughtMonDexPage(u16 species, u32 otId, u32 personality); s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId); u16 CreateMonSpriteFromNationalDexNumber(u16, s16, s16, u16); bool16 HasAllHoennMons(void); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3c8bbfdee42e..338d203b154d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9979,7 +9979,7 @@ static void Cmd_displaydexinfo(void) if (!gPaletteFade.active) { FreeAllWindowBuffers(); - gBattleCommunication[TASK_ID] = DisplayCaughtMonDexPage(SpeciesToNationalPokedexNum(species), + gBattleCommunication[TASK_ID] = DisplayCaughtMonDexPage(species, gBattleMons[gBattlerTarget].otId, gBattleMons[gBattlerTarget].personality); gBattleCommunication[0]++; diff --git a/src/pokedex.c b/src/pokedex.c index a7ba0e9e784b..d4cd78e1f171 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4421,7 +4421,7 @@ static void HighlightSubmenuScreenSelectBarItem(u8 a, u16 b) } #define tState data[0] -#define tDexNum data[1] +#define tSpecies data[1] #define tPalTimer data[2] #define tMonSpriteId data[3] #define tOtIdLo data[12] @@ -4429,12 +4429,12 @@ static void HighlightSubmenuScreenSelectBarItem(u8 a, u16 b) #define tPersonalityLo data[14] #define tPersonalityHi data[15] -u8 DisplayCaughtMonDexPage(u16 dexNum, u32 otId, u32 personality) +u8 DisplayCaughtMonDexPage(u16 species, u32 otId, u32 personality) { u8 taskId = CreateTask(Task_DisplayCaughtMonDexPage, 0); gTasks[taskId].tState = 0; - gTasks[taskId].tDexNum = dexNum; + gTasks[taskId].tSpecies = species; gTasks[taskId].tOtIdLo = otId; gTasks[taskId].tOtIdHi = otId >> 16; gTasks[taskId].tPersonalityLo = personality; @@ -4445,7 +4445,8 @@ u8 DisplayCaughtMonDexPage(u16 dexNum, u32 otId, u32 personality) static void Task_DisplayCaughtMonDexPage(u8 taskId) { u8 spriteId; - u16 dexNum = gTasks[taskId].tDexNum; + u16 species = gTasks[taskId].tSpecies; + u16 dexNum = SpeciesToNationalPokedexNum(species); switch (gTasks[taskId].tState) { @@ -4469,11 +4470,18 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) sPokedexView = AllocZeroed(sizeof(struct PokedexView)); //for type icons ResetPokedexView(sPokedexView); + #ifdef POKEMON_EXPANSION + if (gFormSpeciesIdTables[species] != NULL) + sPokedexView->formSpecies = species; + else + sPokedexView->formSpecies = 0; + #endif + LoadTilesetTilemapHGSS(INFO_SCREEN); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); PutWindowTilemap(WIN_FOOTPRINT); - DrawFootprint(WIN_FOOTPRINT, gTasks[taskId].tDexNum); + DrawFootprint(WIN_FOOTPRINT, dexNum); CopyWindowToVram(WIN_FOOTPRINT, COPYWIN_GFX); ResetPaletteFade(); LoadPokedexBgPalette(FALSE); @@ -4567,7 +4575,7 @@ static void Task_ExitCaughtMonPage(u8 taskId) if (buffer) Free(buffer); - species = NationalPokedexNumToSpecies(gTasks[taskId].tDexNum); + species = gTasks[taskId].tSpecies; otId = ((u16)gTasks[taskId].tOtIdHi << 16) | (u16)gTasks[taskId].tOtIdLo; personality = ((u16)gTasks[taskId].tPersonalityHi << 16) | (u16)gTasks[taskId].tPersonalityLo; paletteNum = gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum; @@ -5262,7 +5270,11 @@ static u32 GetPokedexMonPersonality(u16 species) u16 CreateMonSpriteFromNationalDexNumber(u16 nationalNum, s16 x, s16 y, u16 paletteSlot) { nationalNum = NationalPokedexNumToSpeciesHGSS(nationalNum); + #ifndef POKEMON_EXPANSION return CreateMonPicSprite_HandleDeoxys(nationalNum, SHINY_ODDS, GetPokedexMonPersonality(nationalNum), TRUE, x, y, paletteSlot, TAG_NONE); + #else + return CreateMonPicSprite(nationalNum, SHINY_ODDS, GetPokedexMonPersonality(nationalNum), TRUE, x, y, paletteSlot, TAG_NONE); + #endif } static u16 CreateSizeScreenTrainerPic(u16 species, s16 x, s16 y, s8 paletteSlot) From a8da254fcff5a790a4b3b38c07264e9f2613f3c8 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 15 May 2022 01:17:45 +0200 Subject: [PATCH 69/88] new caught pokemon forms (PE) now show the proper gender based sprite, credits @AsparagusEduardo --- src/pokedex.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pokedex.c b/src/pokedex.c index d4cd78e1f171..41b5c13cd394 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4501,7 +4501,11 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) gTasks[taskId].tState++; break; case 4: + #ifndef POKEMON_EXPANSION spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, MON_PAGE_X, MON_PAGE_Y, 0); + #else + spriteId = CreateMonPicSprite(species, 0, ((u16)gTasks[taskId].tPersonalityHi << 16) | (u16)gTasks[taskId].tPersonalityLo, TRUE, MON_PAGE_X, MON_PAGE_Y, 0, TAG_NONE); + #endif gSprites[spriteId].oam.priority = 0; BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(gPokedexVBlankCB); From 5ff1dcec9dc627cf03784807ae2418725574aa1c Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 15 May 2022 15:53:48 +0200 Subject: [PATCH 70/88] improved BE compatibility, credits @AsparagusEduardo --- src/battle_script_commands.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 338d203b154d..6526bcc7dca3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9979,9 +9979,15 @@ static void Cmd_displaydexinfo(void) if (!gPaletteFade.active) { FreeAllWindowBuffers(); + #ifndef BATTLE_ENGINE gBattleCommunication[TASK_ID] = DisplayCaughtMonDexPage(species, gBattleMons[gBattlerTarget].otId, gBattleMons[gBattlerTarget].personality); + #else + gBattleCommunication[TASK_ID] = DisplayCaughtMonDexPage(species, + gBattleMons[GetCatchingBattler()].otId, + gBattleMons[GetCatchingBattler()].personality); + #endif gBattleCommunication[0]++; } break; From b21c3205a53434d6f22584a6a9a4ac432008d414 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 16 May 2022 00:10:08 +0200 Subject: [PATCH 71/88] tiny reformat --- src/pokedex.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 41b5c13cd394..88b854b6ebbf 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -5422,7 +5422,7 @@ static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 t tutorMoveId = 0xFF; for (i = 0; i < TUTOR_MOVE_COUNT; i++) { - if(move == gTutorMoves[i]) + if (move == gTutorMoves[i]) { tutorMoveId = i; break; @@ -5432,7 +5432,7 @@ static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 t tmMoveId = 0xFF; for (i = 0; i < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; i++) { - if(move == ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + i)) + if (move == ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + i)) { tmMoveId = (ITEM_TM01_FOCUS_PUNCH + i); break; @@ -5451,21 +5451,21 @@ static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 t continue; } //TMHM - if(CanSpeciesLearnTMHM(species, tmMoveId)) + if (CanSpeciesLearnTMHM(species, tmMoveId)) { sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; resultsCount++; continue; } //Tutor - if(CanLearnTutorMove(species, tutorMoveId)) + if (CanLearnTutorMove(species, tutorMoveId)) { sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; resultsCount++; continue; } //EGGs - if(SpeciesCanLearnEggMove(species, move)) + if (SpeciesCanLearnEggMove(species, move)) { sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; resultsCount++; @@ -6567,7 +6567,7 @@ static void Task_LoadStatsScreen(u8 taskId) sPokedexView->numEggMoves = 0; sPokedexView->numLevelUpMoves = 0; sPokedexView->numTMHMMoves = 0; - if(CalculateMoves()) + if (CalculateMoves()) gMain.state++; break; case 5: @@ -6787,7 +6787,7 @@ static bool8 CalculateMoves(void) //TMHM moves for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) { - if(CanSpeciesLearnTMHM(species, j)) + if (CanSpeciesLearnTMHM(species, j)) { sStatsMoves[movesTotal] = ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + j); movesTotal++; @@ -7894,7 +7894,7 @@ static void Task_HandleEvolutionScreenInput(u8 taskId) } static void HandleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u16 previousTargetSpecies, u8 base_x, u8 base_y, u8 base_y_offset, u8 base_i, bool8 isEevee) { - u8 maxI = 6; + u8 iterations = 6; bool8 seen = GetSetPokedexFlag(SpeciesToNationalPokedexNum(targetSpecies), FLAG_GET_SEEN); if (seen || !HGSS_HIDE_UNSEEN_EVOLUTION_NAMES) @@ -7907,7 +7907,7 @@ static void HandleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u16 previousT //Print mon icon in the top row if (isEevee) { - maxI = 9; + iterations = 9; if (targetSpecies == previousTargetSpecies) return; #ifdef POKEMON_EXPANSION @@ -7918,7 +7918,7 @@ static void HandleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u16 previousT #endif } - if(base_i < maxI) + if (base_i < iterations) { LoadMonIconPalette(targetSpecies); //Loads pallete for current mon #ifndef POKEMON_EXPANSION @@ -7970,7 +7970,7 @@ static void HandlePreEvolutionSpeciesPrint(u8 taskId, u16 preSpecies, u16 specie PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); //evolution mon name - if(base_i < 3) + if (base_i < 3) { LoadMonIconPalette(preSpecies); //Loads pallete for current mon #ifndef POKEMON_EXPANSION @@ -8131,11 +8131,11 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, for (i = 0; i < EVOS_PER_MON; i++) { #ifndef POKEMON_EXPANSION - if(gEvolutionTable[species][i].method != 0) + if (gEvolutionTable[species][i].method != 0) times += 1; #endif #ifdef POKEMON_EXPANSION - if(gEvolutionTable[species][i].method != 0 && gEvolutionTable[species][i].method != EVO_MEGA_EVOLUTION) + if (gEvolutionTable[species][i].method != 0 && gEvolutionTable[species][i].method != EVO_MEGA_EVOLUTION) times += 1; #endif } From 19b8ec185f05c9309194bbf8d200922cc6a5f0f1 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 16 May 2022 00:59:54 +0200 Subject: [PATCH 72/88] should fix not beeing able to select evo on base evo --- src/pokedex.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 88b854b6ebbf..eb2a9ed7e3a5 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -8031,16 +8031,16 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) } #ifdef POKEMON_EXPANSION - if (isMega) - { - sPokedexView->numPreEvolutions = numPreEvolutions; - sPokedexView->sEvoScreenData.numAllEvolutions += numPreEvolutions; - sPokedexView->sEvoScreenData.isMega = isMega; + if (isMega) + { + sPokedexView->numPreEvolutions = numPreEvolutions; + sPokedexView->sEvoScreenData.numAllEvolutions += numPreEvolutions; + sPokedexView->sEvoScreenData.isMega = isMega; - CreateCaughtBallEvolutionScreen(preEvolutionOne, base_x - 9 - 8, base_y + base_y_offset*(numPreEvolutions - 1), 0); - HandlePreEvolutionSpeciesPrint(taskId, preEvolutionOne, species, base_x - 8, base_y, base_y_offset, numPreEvolutions - 1); - return numPreEvolutions; - } + CreateCaughtBallEvolutionScreen(preEvolutionOne, base_x - 9 - 8, base_y + base_y_offset*(numPreEvolutions - 1), 0); + HandlePreEvolutionSpeciesPrint(taskId, preEvolutionOne, species, base_x - 8, base_y, base_y_offset, numPreEvolutions - 1); + return numPreEvolutions; + } #endif //Calculate if previous evolution also has a previous evolution @@ -8111,8 +8111,8 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, bool8 isEevee = FALSE; #ifdef POKEMON_EXPANSION - if (sPokedexView->sEvoScreenData.isMega) - return 0; + if (sPokedexView->sEvoScreenData.isMega) + return 0; #endif StringCopy(gStringVar1, gSpeciesNames[species]); @@ -8140,6 +8140,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, #endif } gTasks[taskId].data[3] = times; + sPokedexView->sEvoScreenData.numAllEvolutions += times; //If there are no evolutions print text if (times == 0 && depth == 0) @@ -8156,6 +8157,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, previousTargetSpecies = targetSpecies; targetSpecies = gEvolutionTable[species][i].targetSpecies; + sPokedexView->sEvoScreenData.targetSpecies[base_i] = targetSpecies; #ifdef TX_DIFFICULTY_CHALLENGES_USED if (gSaveBlock1Ptr->txRandEvolutions && targetSpecies != SPECIES_NONE) //tx_difficulty_challenges targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_T_EVO); From d8f399e4873bb688dba1669940a5ae4484f136a3 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 16 May 2022 20:39:32 +0200 Subject: [PATCH 73/88] improved PokemonExpansion compatibility for Megas that dont have their own moveset, credits @aarant --- src/pokedex.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index eb2a9ed7e3a5..621b3c251050 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -5443,6 +5443,12 @@ static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 t { species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum); + #ifdef POKEMON_EXPANSION + // Mega pokemon don't have distinct learnsets from their base form; so use base species for calculation + if (species >= SPECIES_VENUSAUR_MEGA && species <= SPECIES_GROUDON_PRIMAL) + species = GetFormSpeciesId(species, 0); + #endif + //LevelUp if (SpeciesCanLearnLvlUpMove(species, move)) { @@ -6763,13 +6769,23 @@ static bool8 CalculateMoves(void) u16 statsMovesTMHM[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; u16 statsMovesTutor[TUTOR_MOVE_COUNT] = {0}; - u8 numEggMoves = GetEggMovesSpecies(species, statsMovesEgg); - u8 numLevelUpMoves = GetLevelUpMovesBySpecies(species, statsMovesLevelUp); + u8 numEggMoves = 0; + u8 numLevelUpMoves = 0; u8 numTMHMMoves = 0; u8 numTutorMoves = 0; u16 movesTotal = 0; u8 i,j; + #ifdef POKEMON_EXPANSION + // Mega pokemon don't have distinct learnsets from their base form; so use base species for calculation + if (species >= SPECIES_VENUSAUR_MEGA && species <= SPECIES_GROUDON_PRIMAL) + species = GetFormSpeciesId(species, 0); + #endif + + //Calculate amount of Egg and LevelUp moves + numEggMoves = GetEggMovesSpecies(species, statsMovesEgg); + numLevelUpMoves = GetLevelUpMovesBySpecies(species, statsMovesLevelUp); + //Egg moves for (i=0; i < numEggMoves; i++) { From 53603f60e721501fec7fe6c895a60eea12f22293 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sat, 21 May 2022 12:56:31 +0200 Subject: [PATCH 74/88] GetSpeciesRandomSeeded with addtional param --- src/pokedex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 621b3c251050..77034ac7f361 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -8140,7 +8140,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, if (EvolutionBlockedByEvoLimit(species)) //No Evos already previously checked species = SPECIES_NONE; else if (gSaveBlock1Ptr->tx_Random_EvolutionMethods) - species = GetSpeciesRandomSeeded(species, TX_RANDOM_T_EVO_METH); + species = GetSpeciesRandomSeeded(species, TX_RANDOM_T_EVO_METH, 0); #endif //Calculate number of possible direct evolutions (e.g. Eevee has 5 but torchic has 1) @@ -8176,7 +8176,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, sPokedexView->sEvoScreenData.targetSpecies[base_i] = targetSpecies; #ifdef TX_DIFFICULTY_CHALLENGES_USED if (gSaveBlock1Ptr->txRandEvolutions && targetSpecies != SPECIES_NONE) //tx_difficulty_challenges - targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_T_EVO); + targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_T_EVO, 0); #endif CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); HandleTargetSpeciesPrint(taskId, targetSpecies, previousTargetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i, isEevee); //evolution mon name From 207fcec5990f38d39d176c159bf1497c19b38b45 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 25 Mar 2023 14:50:15 +0100 Subject: [PATCH 75/88] fixes teachable moves change from rhh --- include/party_menu.h | 4 ++ src/party_menu.c | 5 +++ src/pokedex.c | 96 ++++++++++++++------------------------------ 3 files changed, 39 insertions(+), 66 deletions(-) diff --git a/include/party_menu.h b/include/party_menu.h index 3a51ace84d11..edb029b01105 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -90,6 +90,10 @@ void BufferMoveDeleterNicknameAndMove(void); void GetNumMovesSelectedMonHas(void); void MoveDeleterChooseMoveToForget(void); +#ifndef BATTLE_ENGINE bool8 CanLearnTutorMove(u16, u8); +#else +u16 GetTMHMMoves(u16 position); +#endif #endif // GUARD_PARTY_MENU_H diff --git a/src/party_menu.c b/src/party_menu.c index b9cbe673938f..71d259b5d63c 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -6424,3 +6424,8 @@ void IsLastMonThatKnowsSurf(void) gSpecialVar_Result = TRUE; } } + +u16 GetTMHMMoves(u16 position) +{ + return sTMHMMoves[position]; +} diff --git a/src/pokedex.c b/src/pokedex.c index fbd6a4b805e4..01b3c2f4ad28 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -142,7 +142,11 @@ static EWRAM_DATA u16 sLastSelectedPokemon = 0; static EWRAM_DATA u8 sPokeBallRotation = 0; static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL; //Pokedex Plus HGSS_Ui +#ifndef BATTLE_ENGINE #define MOVES_COUNT_TOTAL (EGG_MOVES_ARRAY_COUNT + MAX_LEVEL_UP_MOVES + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + TUTOR_MOVE_COUNT) +#else +#define MOVES_COUNT_TOTAL (EGG_MOVES_ARRAY_COUNT + MAX_LEVEL_UP_MOVES + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + 20) +#endif EWRAM_DATA static u16 sStatsMoves[MOVES_COUNT_TOTAL] = {0}; EWRAM_DATA static u16 sStatsMovesTMHM_ID[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; @@ -5417,72 +5421,6 @@ static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 t sPokedexView->pokemonListCount = resultsCount; } - // Search by move - if (move != 0xFFFF) - { - //Calc tutor move ID - tutorMoveId = 0xFF; - for (i = 0; i < TUTOR_MOVE_COUNT; i++) - { - if (move == gTutorMoves[i]) - { - tutorMoveId = i; - break; - } - } - //Calc tm move ID - tmMoveId = 0xFF; - for (i = 0; i < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; i++) - { - if (move == ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + i)) - { - tmMoveId = (ITEM_TM01_FOCUS_PUNCH + i); - break; - } - } - - for (i = 0, resultsCount = 0; i < sPokedexView->pokemonListCount; i++) - { - species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum); - - #ifdef POKEMON_EXPANSION - // Mega pokemon don't have distinct learnsets from their base form; so use base species for calculation - if (species >= SPECIES_VENUSAUR_MEGA && species <= SPECIES_GROUDON_PRIMAL) - species = GetFormSpeciesId(species, 0); - #endif - - //LevelUp - if (SpeciesCanLearnLvlUpMove(species, move)) - { - sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; - resultsCount++; - continue; - } - //TMHM - if (CanSpeciesLearnTMHM(species, tmMoveId)) - { - sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; - resultsCount++; - continue; - } - //Tutor - if (CanLearnTutorMove(species, tutorMoveId)) - { - sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; - resultsCount++; - continue; - } - //EGGs - if (SpeciesCanLearnEggMove(species, move)) - { - sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; - resultsCount++; - continue; - } - } - sPokedexView->pokemonListCount = resultsCount; - } - if (sPokedexView->pokemonListCount != 0) { for (i = sPokedexView->pokemonListCount; i < NATIONAL_DEX_COUNT; i++) @@ -6769,7 +6707,11 @@ static bool8 CalculateMoves(void) u16 statsMovesEgg[EGG_MOVES_ARRAY_COUNT] = {0}; u16 statsMovesLevelUp[MAX_LEVEL_UP_MOVES] = {0}; u16 statsMovesTMHM[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; + #ifndef BATTLE_ENGINE u16 statsMovesTutor[TUTOR_MOVE_COUNT] = {0}; + #else + u16 move; + #endif u8 numEggMoves = 0; u8 numLevelUpMoves = 0; @@ -6802,6 +6744,7 @@ static bool8 CalculateMoves(void) movesTotal++; } + #ifndef BATTLE_ENGINE //TMHM moves for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) { @@ -6824,6 +6767,27 @@ static bool8 CalculateMoves(void) movesTotal++; } } + #else + for (i = 0; gTeachableLearnsets[species][i] != MOVE_UNAVAILABLE; i++) + { + move = gTeachableLearnsets[species][i]; + for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) + { + if (GetTMHMMoves(j) == move) + { + sStatsMovesTMHM_ID[numTMHMMoves] = (ITEM_TM01_FOCUS_PUNCH + j); + numTMHMMoves++; + break; + } + } + if (j >= NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES) + numTutorMoves++; + + sStatsMoves[movesTotal] = move; + movesTotal++; + } + + #endif sPokedexView->numEggMoves = numEggMoves; sPokedexView->numLevelUpMoves = numLevelUpMoves; From bc2c3e1d49a1ab8de251a806a039b019269af21e Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 27 Mar 2023 11:28:28 +0200 Subject: [PATCH 76/88] Moved all HGSS pokedex code into its own file - reordered all hgss code - cleanup needed! - restored the vanilla dex --- graphics/pokedex/bg_national.pal | 99 + graphics/pokedex/cry_screen.bin | Bin 0 -> 1280 bytes .../pokedex/{ => hgss}/HGSS_SelectBar.bin | Bin .../{ => hgss}/HGSS_SelectBar_clear.bin | Bin .../{ => hgss}/HGSS_palette_default.pal | 0 .../{ => hgss}/HGSS_palette_default_dark.pal | 0 .../{ => hgss}/HGSS_palette_national.pal | 0 .../{ => hgss}/HGSS_palette_national_dark.pal | 0 .../{ => hgss}/HGSS_palette_search_menu.pal | 0 .../HGSS_palette_search_menu_dark.pal | 0 .../HGSS_palette_search_results.pal | 0 .../HGSS_palette_search_results_dark.pal | 0 .../{ => hgss}/HGSS_tilemap_cry_screen.bin | Bin .../{ => hgss}/HGSS_tilemap_evo_screen.bin | Bin .../{ => hgss}/HGSS_tilemap_evo_screen_PE.bin | Bin .../{ => hgss}/HGSS_tilemap_forms_screen.bin | Bin .../{ => hgss}/HGSS_tilemap_info_screen.bin | Bin .../{ => hgss}/HGSS_tilemap_list_screen.bin | Bin .../HGSS_tilemap_list_screen_underlay.bin | Bin .../HGSS_tilemap_search_screen_hoenn.bin | Bin .../HGSS_tilemap_search_screen_national.bin | Bin .../{ => hgss}/HGSS_tilemap_size_screen.bin | Bin .../{ => hgss}/HGSS_tilemap_start_menu.bin | Bin ...HGSS_tilemap_start_menu_search_results.bin | Bin .../{ => hgss}/HGSS_tilemap_stats_screen.bin | Bin .../{ => hgss}/HGSS_tileset_interface.png | Bin .../HGSS_tileset_interface_DECA.png | Bin .../pokedex/{ => hgss}/HGSS_tileset_menu1.png | Bin .../pokedex/{ => hgss}/HGSS_tileset_menu2.png | Bin .../pokedex/{ => hgss}/HGSS_tileset_menu3.png | Bin .../{ => hgss}/HGSS_tileset_menu_list.png | Bin .../HGSS_tileset_menu_list_DECA.png | Bin .../{ => hgss}/HGSS_tileset_menu_search.png | Bin .../HGSS_tileset_menu_search_DECA.png | Bin .../pokedex/{ => hgss}/RES_HGSS_palette.pal | 0 graphics/pokedex/{ => hgss}/stat_bars.png | Bin graphics/pokedex/info_screen.bin | Bin 0 -> 1280 bytes graphics/pokedex/interface.png | Bin 0 -> 1044 bytes graphics/pokedex/list.bin | Bin 0 -> 1280 bytes graphics/pokedex/list_underlay.bin | Bin 0 -> 1280 bytes graphics/pokedex/menu.png | Bin 0 -> 2045 bytes graphics/pokedex/screen_select_bar_main.bin | Bin 0 -> 192 bytes .../pokedex/screen_select_bar_submenu.bin | Bin 0 -> 192 bytes graphics/pokedex/search_menu.pal | 67 + graphics/pokedex/search_menu.png | Bin 0 -> 1116 bytes graphics/pokedex/search_menu_hoenn.bin | Bin 0 -> 1280 bytes graphics/pokedex/search_menu_national.bin | Bin 0 -> 1280 bytes graphics/pokedex/search_results_bg.pal | 99 + graphics/pokedex/size_screen.bin | Bin 0 -> 1280 bytes graphics/pokedex/start_menu_main.bin | Bin 0 -> 768 bytes .../pokedex/start_menu_search_results.bin | Bin 0 -> 768 bytes include/graphics.h | 85 +- include/pokedex_plus_hgss.h | 11 + src/graphics.c | 88 +- src/pokedex.c | 3942 +------- src/pokedex_plus_hgss.c | 8784 +++++++++++++++++ sym_ewram.txt | 1 + 57 files changed, 9541 insertions(+), 3635 deletions(-) create mode 100644 graphics/pokedex/bg_national.pal create mode 100644 graphics/pokedex/cry_screen.bin rename graphics/pokedex/{ => hgss}/HGSS_SelectBar.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_SelectBar_clear.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_palette_default.pal (100%) rename graphics/pokedex/{ => hgss}/HGSS_palette_default_dark.pal (100%) rename graphics/pokedex/{ => hgss}/HGSS_palette_national.pal (100%) rename graphics/pokedex/{ => hgss}/HGSS_palette_national_dark.pal (100%) rename graphics/pokedex/{ => hgss}/HGSS_palette_search_menu.pal (100%) rename graphics/pokedex/{ => hgss}/HGSS_palette_search_menu_dark.pal (100%) rename graphics/pokedex/{ => hgss}/HGSS_palette_search_results.pal (100%) rename graphics/pokedex/{ => hgss}/HGSS_palette_search_results_dark.pal (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_cry_screen.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_evo_screen.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_evo_screen_PE.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_forms_screen.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_info_screen.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_list_screen.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_list_screen_underlay.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_search_screen_hoenn.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_search_screen_national.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_size_screen.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_start_menu.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_start_menu_search_results.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tilemap_stats_screen.bin (100%) rename graphics/pokedex/{ => hgss}/HGSS_tileset_interface.png (100%) rename graphics/pokedex/{ => hgss}/HGSS_tileset_interface_DECA.png (100%) rename graphics/pokedex/{ => hgss}/HGSS_tileset_menu1.png (100%) rename graphics/pokedex/{ => hgss}/HGSS_tileset_menu2.png (100%) rename graphics/pokedex/{ => hgss}/HGSS_tileset_menu3.png (100%) rename graphics/pokedex/{ => hgss}/HGSS_tileset_menu_list.png (100%) rename graphics/pokedex/{ => hgss}/HGSS_tileset_menu_list_DECA.png (100%) rename graphics/pokedex/{ => hgss}/HGSS_tileset_menu_search.png (100%) rename graphics/pokedex/{ => hgss}/HGSS_tileset_menu_search_DECA.png (100%) rename graphics/pokedex/{ => hgss}/RES_HGSS_palette.pal (100%) rename graphics/pokedex/{ => hgss}/stat_bars.png (100%) create mode 100644 graphics/pokedex/info_screen.bin create mode 100644 graphics/pokedex/interface.png create mode 100644 graphics/pokedex/list.bin create mode 100644 graphics/pokedex/list_underlay.bin create mode 100644 graphics/pokedex/menu.png create mode 100644 graphics/pokedex/screen_select_bar_main.bin create mode 100644 graphics/pokedex/screen_select_bar_submenu.bin create mode 100644 graphics/pokedex/search_menu.pal create mode 100644 graphics/pokedex/search_menu.png create mode 100644 graphics/pokedex/search_menu_hoenn.bin create mode 100644 graphics/pokedex/search_menu_national.bin create mode 100644 graphics/pokedex/search_results_bg.pal create mode 100644 graphics/pokedex/size_screen.bin create mode 100644 graphics/pokedex/start_menu_main.bin create mode 100644 graphics/pokedex/start_menu_search_results.bin create mode 100644 include/pokedex_plus_hgss.h create mode 100644 src/pokedex_plus_hgss.c diff --git a/graphics/pokedex/bg_national.pal b/graphics/pokedex/bg_national.pal new file mode 100644 index 000000000000..ea8f2bc64cfd --- /dev/null +++ b/graphics/pokedex/bg_national.pal @@ -0,0 +1,99 @@ +JASC-PAL +0100 +96 +123 131 0 +255 255 255 +222 222 222 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +164 164 164 +41 57 65 +255 255 255 +238 246 57 +255 0 189 +123 164 115 +74 115 65 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +164 164 164 +41 57 65 +255 255 255 +238 246 57 +255 0 189 +123 164 115 +74 115 65 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +164 164 164 +41 57 65 +255 255 255 +238 246 57 +255 0 189 +180 205 246 +49 139 255 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +255 238 0 +255 189 0 +255 115 0 +98 98 115 +41 57 65 +164 164 164 +41 57 65 +255 255 255 +238 246 57 +255 0 189 +123 164 115 +74 115 65 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +164 164 164 +41 57 65 +255 255 255 +238 246 57 +189 0 0 +74 148 180 +8 90 131 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +164 164 164 +41 57 65 +255 255 255 +238 246 57 +255 0 189 +180 205 246 +49 139 255 +189 156 90 +0 0 0 diff --git a/graphics/pokedex/cry_screen.bin b/graphics/pokedex/cry_screen.bin new file mode 100644 index 0000000000000000000000000000000000000000..6a72a88bc4bf21b1913ec74f3b1c54f16fc476de GIT binary patch literal 1280 zcmZP+U?dwd00H^B83iEv<#{;B0P-9#{roKV8Df#(eHJDLB*?-9l4n7M_gVOXE{E99 z&w{KQ#75H1zy#DE%fiNh3S&q0;|;$|fh>Vefv$j+0jmPY3BO8#DuI~-vjTPo>;mgY ejXe+#5r6V591NsGd8qqAXsyfW-H=D```Is`Aj23qMs9AvtnSaWsh`1UL(;ZN`9aIKUZs6#a93T literal 0 HcmV?d00001 diff --git a/graphics/pokedex/interface.png b/graphics/pokedex/interface.png new file mode 100644 index 0000000000000000000000000000000000000000..529914813499a91842f1832feda77864a89c0f4a GIT binary patch literal 1044 zcmV+v1nc{WP)KgCM<}S^xk5SrGW^000A@ zNklE(is5*h}e}?&R50JB@(zk)KTtsS#XD~pTK~RX92=+5YK2g*f zf=Vo0zQ4b>_khUdZ~S8l=TRmAZ#Nu)c;0TT;s7a#iUF)3Dh{AXakr~f052^bWZ z;yEht3*tTXI|f&kEf@0R?d{hFHgFGkC~chEXm2xv3G&Q<$9W!9;thEa$J=?xj|#-w z1dxrB0j)9s$EtBGHrNaQ2of(Jczk5~5`hdUb5W=$IfPs*A{Uto0b(s713mK-0kwbu zL8?TqZa^X+Q1y~hO-KMT0Boa*LG=P^l)Qi%%{A#WJ&94|fJ7|xAIq1`lTYPG`}6#u zUOl9PEk6wK{NQiLm=3GPvDo0uP~dyzM-Dkr#{~WfkZR6|sZ0Qs9mtshDIG}sy#v(k z$UW^qkSeeOaRihHC6xdeBoKj9rSP9Qnmey*vOd1bKY}xYdgx2b5 zwgaR!^+mox7XArX*o@x_%)~B%x&qS-5>u}8IHU~$+kkcG#(C&MU7|u8jcM|t4N93c z(%QJX0yKNYxyqhDwtQN^(=0y)q^tmB1!x8+G*D;@X#jtf{9^#0@i4ta8yH|Y?Am1j zmvv?_dw&;aDqK=;CDdOi)5wxoX>;ad=3qEPfgBvrl)p`vCz*(SNi zfDTYxk^(iS22=x7!>eEeKmg>s4hmZ4V=P~F$nT$SANa1Owd@W+GYd{Y@cV^J8b1A+ zL2MIhT0P*nzJPf#v>hK^8`^2n`9zDu^?ir&@QJbUa6YkFj+lBwY*LG+1^tlfD-X60 zRxMhU%T!hW!?L6~53b$@0gNYTXW5q%i$hcLIQT4V2Cqji2Q1I9qyw%3xEkQ70O$ZZpcE<~C~MYNmYH6a=hhzusd27R#|COco)Y3Psp z1&n?Bb$$io^&1$kAHn?J*QuhjKHb*+=jvmhAC>uR>~+8E+Z|lZ-<)OJ@8maOy!lla QuU~}m`uux*|Ng!C2cR)2X#fBK literal 0 HcmV?d00001 diff --git a/graphics/pokedex/menu.png b/graphics/pokedex/menu.png new file mode 100644 index 0000000000000000000000000000000000000000..fea195312c06171e1717ec26aca2933805ea317f GIT binary patch literal 2045 zcmVKgCM<}S^xk5SrGW^000Mw zNkll*O6vwr+b7|O~Y6Q^gAwc^Hf-2dHqQfcBz#)UV*hZ&B$do0627Bbd zv1`W+UNm?sGSDzQ2#5e3^bHC`2%5nV*!O?$?s!L?RMPI!rxSfV@_xGa?!Cu5y4NEq zNfMGjNM4mE)G{n5B)Eol`tujssFZSD+7mkG6HQ_PiKZLA8R`f?Q?q`heSp?cfKr(Q zC=v^xW(J@w0Qf2--=Fld?98chrph5shPWapcP`3aG0QUa44Uz*sw*b_w z3J|DZ?~mJnY}OeNs*rrwMui_qScSV}hg6?;T|Huey%q9V{?IXbg1+3pd4<0s2T;KQ z@I^QJx;wo-(v2=YsfPu>*aE1eVrX?6L!A!ri%}K+q#MGTT2N5YrW>8=~&;bmrE)>V2vAS`fzIqDA!z2sR4@{>Ky_~jT>(5 z&-@#J3f;T*0sOsP!~tZ6O~7JZx0FjV5q<_13jl1E#ab_naU6h7m%0YrX#B!0>7hda zEXY3|7?A)=jH2{}0gE!G!g8@;gWIKE2Y|JF;(!}Wt`E4W2pUWR*+9qrK$jXt<5=IW z_00kw-v$e9#Q+}d%8w4F?lK_3Gw8wjKmflxz`N?})_bGF7C>SF@9wA9+X!!_F=+tq zsp)z=ep|exl8ZB7h3Um`?j7 zSbSIjRA2yXH{ubf007%PXY^3Ou0-$p95dd4?2cR=nT0Qz2kbShXIAc|vvnaV?e zeHu+XVHFer_=W(h1_LOUOx?VGY5=5+HjS9qM#Knogg`dHKoQHc9DrFtvmxP3jUm8$ zrgGo|=%sCm*M@eGH3kD<};NWZ%Q0D^^iuAkU(*`g|1b_|)=aLOYg=Riz z0!AYNfIt95<8uSJ3;`w|%th}_z~IONUWf`NwKekrY~TZw1EdBpz-vifsaQV<@bk@F0iT7xxa)0lGcjpSjnd3^0DsS_SjV zWqFd6=K07g)vf@oPku!m`ackmsQ?h&FBGl?c_QVtaBfxjGYeFR?-y*#+|(shke&VK z;;#JyH}W%9*79@0>c&EwRM^|PUqBXZYxFw0K7Nbd%>QmxnGbLXCX6<5kPdm zKs9OMR{^T_g8(3VrucpVslm3RD83p6baQ1Nu=jri*u}P=Sh@jz`hioLpV~SB-WveV ziUn}EXh{j)5+S7zHV#-TP`w6V=r*hwVEou*1-nEbA0#f<)h58Lk9yx`J!AqC^vXoT z2+w6@>n2Jpz$F7#A>)Uu1!xa|{cj!x(AOC8j;8gd28=lUIe>Z8k6@P61H3l?%qIMz z2FzfC6h<@vHXoM$!3d1{hxB}q|Asn%%?L{I+9WlVrV6HdsI>#+)&?e}uofyey2w&t z2S8r_(NQV@@XBDM&`KrZ2Z0J4@rZk=AS0NS0a{U%TO~vRx`RYj=n61CaCr1kfQf^{ b#HjEOB!6_L#;B%&00000NkvXXu0mjfTJeaY literal 0 HcmV?d00001 diff --git a/graphics/pokedex/screen_select_bar_main.bin b/graphics/pokedex/screen_select_bar_main.bin new file mode 100644 index 0000000000000000000000000000000000000000..154ed7196270686efe1e9b4e047c9fa21f5fb832 GIT binary patch literal 192 zcmbWwM+yQ_0E1zV@~MMe=UK3q<=EgY#|Ga27Cr}0U;+vMA|#@&p(#t9LQ7jmSFfVJ zfuWH+QQ_$1?Bc4(qFPcEj7?0m$n3|beWLjET+t?BS`=N literal 0 HcmV?d00001 diff --git a/graphics/pokedex/search_menu.pal b/graphics/pokedex/search_menu.pal new file mode 100644 index 000000000000..b6142eb3f7b0 --- /dev/null +++ b/graphics/pokedex/search_menu.pal @@ -0,0 +1,67 @@ +JASC-PAL +0100 +64 +123 131 0 +0 0 0 +172 172 172 +255 255 255 +255 255 255 +98 98 115 +57 57 57 +123 115 74 +156 230 0 +57 115 0 +255 172 0 +131 32 32 +82 189 90 +24 131 32 +255 32 32 +0 0 0 +123 131 0 +0 0 0 +172 172 172 +255 255 255 +255 255 255 +98 98 115 +57 57 57 +123 115 74 +41 115 0 +32 49 32 +180 106 0 +16 0 0 +82 189 90 +24 131 32 +0 0 0 +0 0 0 +123 131 0 +0 0 0 +172 172 172 +172 172 172 +172 172 172 +98 98 115 +57 57 57 +123 115 74 +32 49 32 +32 32 32 +74 32 32 +32 32 32 +82 189 90 +24 131 32 +255 32 32 +0 0 0 +123 131 0 +0 0 0 +172 172 172 +172 172 172 +172 172 172 +98 98 115 +57 57 57 +123 115 74 +32 49 32 +32 32 32 +74 32 32 +32 32 32 +82 189 90 +24 131 32 +0 0 0 +0 0 0 diff --git a/graphics/pokedex/search_menu.png b/graphics/pokedex/search_menu.png new file mode 100644 index 0000000000000000000000000000000000000000..755c2d35d1ec9c59b153a6c10f587692a5e36556 GIT binary patch literal 1116 zcmV-i1f%Yzi!(w5XSvZLdP@<7eZr^zCnbdKsz=sAQaNlNdvhX9q3h)xMvcw1n{OT zT{0wI@&N94$A6L{8*0)sCClXLr~63WS(^>4hh;DWyBS&WoqC^mEc-kRe0aOLx#n-W ze=`hjU>Wc{1i*)NfFDJ)8Q`jLepj#wU@D=w3O1Ked~*O|p8;Hd3SrIxAyWE2BjGwr zfInIGF-iD$KyiQ#1D($TW)dQxAK6L3eRjrQsO8>SpvN`QqSFDKAI{#70mI%H(dM~z&C1b_+#uwTo5Hu#O_ zz&ASrh@1e{VkQD$N9vOwRVpXJEJ?8W)=99r@e=s)$&a>U0JOpiYPkdK=1gy;cqWCfe{PcjexjzqpLI?nCD@qyTihu{WO`mE6078|r zR1zm4Wdy|Br%m6c+_%{EW>h1JqSR70jii&-6F|3%iQmTD$HoUPB@O^e%aRCnqbfO) zu=Tel0M9{g@GI2_0#pDXjH(psBp~KK0J|I$V14d0K!`>WKs$hYy@}<^xFTSp1WI4q zjUw3W;l%H_2m}e1^WPX7R-w{L z*L>6(mH@AJ-BRDuPV}#MZ_fn}SeN@t7T*!yY94TRnAlU_uX=ol0xz;tZFsd^(tDy0 zfQQHFz^~_FX~viP0O;@LdH&Qd<^FPC0&srF1Q5vlvccZxrWha;uJDn#!f=$pcS&Sf zsriy5lp4DpCww#xcBXou8!iguJO@;$6eZ$)pp&O8`LVGzT># zAYK5341k)V_khaFngFC6O(G;{jzQ}Hs7L~ULQ*<63lf^KgmOUw*AgjR7&AbFWUple z)bto$g#LzJb$pTaP;p0000068GnTxgc`a zb6nsOSGdLvj&O_91r!b8f%wi5jQ3(;9cYNRzU--rkp74wpyy7jYH?WB9kgmF&e>FAD5t4}00i466+&OMZZZ9O5uX9R2fL;3Ai}?C2lm7{@um zNzI?lmuF$?e}$`D<2p;4Ka(%d!q$HcbF5_@>ovc=2b;f*?d)JDyEMPP2b+Hvd)UVT z4pAk{B=7$gceuv`9v$;$r+%C4*I%0J)2xag;@+wp*2SPva P-#-YwmkXHQdnfb`qW9iAzmCl&vv3$`R=l%$o2#Q&&Tx(k zT;dAXIK&Z-ae~vZpTH!hFpU{xL@q>FZ+OQCKJkTbJmLw@c)@GfuVVw7*uu6UU&U(H zu$Fa9vp0r%=CWrZz35;kyV%VhrkEdtGUWT%&jAi{$kIQ{InHx|i!i$|L+N3BrNcy_doK=R|yMz R*K?!!rE*l#0>_oV`5(znjZOdn literal 0 HcmV?d00001 diff --git a/graphics/pokedex/search_results_bg.pal b/graphics/pokedex/search_results_bg.pal new file mode 100644 index 000000000000..41196a26984a --- /dev/null +++ b/graphics/pokedex/search_results_bg.pal @@ -0,0 +1,99 @@ +JASC-PAL +0100 +96 +123 131 0 +255 255 255 +222 222 222 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +98 98 115 +49 49 65 +255 255 255 +238 246 57 +255 0 189 +123 148 32 +41 82 0 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +98 98 115 +49 49 65 +255 255 255 +238 246 57 +255 0 189 +123 148 32 +41 82 0 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +98 98 115 +49 49 65 +255 255 255 +238 246 57 +255 0 189 +180 205 246 +49 139 255 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +255 238 0 +255 189 0 +255 115 0 +98 98 115 +41 57 65 +98 98 115 +49 49 65 +255 255 255 +238 246 57 +255 0 189 +123 148 32 +41 82 0 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +98 98 115 +49 49 65 +255 255 255 +238 246 57 +180 0 0 +74 148 180 +8 90 131 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +98 98 115 +49 49 65 +255 255 255 +238 246 57 +180 0 0 +180 205 246 +49 139 255 +189 156 90 +0 0 0 diff --git a/graphics/pokedex/size_screen.bin b/graphics/pokedex/size_screen.bin new file mode 100644 index 0000000000000000000000000000000000000000..283aa518c50e371e53fe27d97b6effc19aa89977 GIT binary patch literal 1280 zcmeH_K@No=3BdteDP=F~jQN&}u_4d?xZ^K~mw6^sY#~OQOEs@^9MEmNaO{uo0uijGOrFwKZb^

0VkD`O5gQSC`gQSC`gQT|@dW)eq6M8cN2AxdaUblCS+1a$T zunkArr3[i] = 0; } +#define HGSS_DEX TRUE + void CB2_OpenPokedex(void) { + if (HGSS_DEX) + { + CB2_OpenPokedexPlusHGSS(); + return; + } + switch (gMain.state) { case 0: @@ -2104,10 +1663,6 @@ static void CB2_Pokedex(void) void Task_OpenPokedexMainPage(u8 taskId) { sPokedexView->isSearchResults = FALSE; - #ifdef POKEMON_EXPANSION - sPokedexView->sEvoScreenData.fromEvoPage = FALSE; - sPokedexView->formSpecies = 0; - #endif if (LoadPokedexListPage(PAGE_MAIN)) gTasks[taskId].func = Task_HandlePokedexInput; } @@ -2121,17 +1676,11 @@ static void Task_HandlePokedexInput(u8 taskId) if (sPokedexView->menuY) { sPokedexView->menuY -= 8; - if (sPokedexView->menuIsOpen == FALSE && sPokedexView->menuY == 8) //HGSS_Ui - { - CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); - CreateStatBarsBg(); - } } else { if (JOY_NEW(A_BUTTON) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen) { - TryDestroyStatBars(); //HGSS_Ui UpdateSelectedMonSpriteId(); BeginNormalPaletteFade(~(1 << (gSprites[sPokedexView->selectedMonSpriteId].oam.paletteNum + 16)), 0, 0, 0x10, RGB_BLACK); gSprites[sPokedexView->selectedMonSpriteId].callback = SpriteCB_MoveMonForInfoScreen; @@ -2141,8 +1690,6 @@ static void Task_HandlePokedexInput(u8 taskId) } else if (JOY_NEW(START_BUTTON)) { - TryDestroyStatBars(); //HGSS_Ui - TryDestroyStatBarsBg(); //HGSS_Ui sPokedexView->menuY = 0; sPokedexView->menuIsOpen = TRUE; sPokedexView->menuCursorPos = 0; @@ -2165,7 +1712,6 @@ static void Task_HandlePokedexInput(u8 taskId) } else if (JOY_NEW(B_BUTTON)) { - TryDestroyStatBars(); //HGSS_Ui BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ClosePokedex; PlaySE(SE_PC_OFF); @@ -2176,15 +1722,12 @@ static void Task_HandlePokedexInput(u8 taskId) sPokedexView->selectedPokemon = TryDoPokedexScroll(sPokedexView->selectedPokemon, 0xE); if (sPokedexView->scrollTimer) gTasks[taskId].func = Task_WaitForScroll; - else if (!sPokedexView->scrollTimer && !sPokedexView->scrollSpeed &&sPokedexView->justScrolled) //HGSS_Ui - CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui } } } static void Task_WaitForScroll(u8 taskId) { - TryDestroyStatBars(); //HGSS_Ui if (UpdateDexListScroll(sPokedexView->scrollDirection, sPokedexView->scrollMonIncrement, sPokedexView->maxScrollTimer)) gTasks[taskId].func = Task_HandlePokedexInput; } @@ -2283,8 +1826,6 @@ static void Task_WaitForExitSearch(u8 taskId) if (!gTasks[gTasks[taskId].tLoadScreenTaskId].isActive) { ClearMonSprites(); - TryDestroyStatBars(); //HGSS_Ui - TryDestroyStatBarsBg(); //HGSS_Ui // Search produced results if (sPokedexView->screenSwitchState != 0) @@ -2327,10 +1868,6 @@ static void Task_ClosePokedex(u8 taskId) static void Task_OpenSearchResults(u8 taskId) { sPokedexView->isSearchResults = TRUE; - #ifdef POKEMON_EXPANSION - sPokedexView->sEvoScreenData.fromEvoPage = FALSE; - sPokedexView->formSpecies = 0; - #endif if (LoadPokedexListPage(PAGE_SEARCH_RESULTS)) gTasks[taskId].func = Task_HandleSearchResultsInput; } @@ -2342,11 +1879,6 @@ static void Task_HandleSearchResultsInput(u8 taskId) if (sPokedexView->menuY) { sPokedexView->menuY -= 8; - if (sPokedexView->menuIsOpen == FALSE && sPokedexView->menuY == 8) //HGSS_Ui - { - CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); - CreateStatBarsBg(); - } } else { @@ -2354,7 +1886,6 @@ static void Task_HandleSearchResultsInput(u8 taskId) { u32 a; - TryDestroyStatBars(); //HGSS_Ui UpdateSelectedMonSpriteId(); a = (1 << (gSprites[sPokedexView->selectedMonSpriteId].oam.paletteNum + 16)); gSprites[sPokedexView->selectedMonSpriteId].callback = SpriteCB_MoveMonForInfoScreen; @@ -2365,8 +1896,6 @@ static void Task_HandleSearchResultsInput(u8 taskId) } else if (JOY_NEW(START_BUTTON)) { - TryDestroyStatBars(); //HGSS_Ui - TryDestroyStatBarsBg(); //HGSS_Ui sPokedexView->menuY = 0; sPokedexView->menuIsOpen = TRUE; sPokedexView->menuCursorPos = 0; @@ -2384,7 +1913,6 @@ static void Task_HandleSearchResultsInput(u8 taskId) } else if (JOY_NEW(B_BUTTON)) { - TryDestroyStatBars(); //HGSS_Ui BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ReturnToPokedexFromSearchResults; PlaySE(SE_PC_OFF); @@ -2395,15 +1923,12 @@ static void Task_HandleSearchResultsInput(u8 taskId) sPokedexView->selectedPokemon = TryDoPokedexScroll(sPokedexView->selectedPokemon, 0xE); if (sPokedexView->scrollTimer) gTasks[taskId].func = Task_WaitForSearchResultsScroll; - else if (!sPokedexView->scrollTimer && !sPokedexView->scrollSpeed && sPokedexView->justScrolled) //HGSS_Ui - CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui } } } static void Task_WaitForSearchResultsScroll(u8 taskId) { - TryDestroyStatBars(); //HGSS_Ui if (UpdateDexListScroll(sPokedexView->scrollDirection, sPokedexView->scrollMonIncrement, sPokedexView->maxScrollTimer)) gTasks[taskId].func = Task_HandleSearchResultsInput; } @@ -2550,12 +2075,9 @@ static bool8 LoadPokedexListPage(u8 page) SetBgTilemapBuffer(2, AllocZeroed(BG_SCREEN_SIZE)); SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE)); SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE)); - if (!HGSS_DECAPPED) - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenuList_Gfx, 0x2000, 0, 0); - else - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenuList_DECA_Gfx, 0x2000, 0, 0); - CopyToBgTilemapBuffer(1, gPokedexScreenList_Tilemap, 0, 0); - CopyToBgTilemapBuffer(3, gPokedexScreenListUnderlay_Tilemap, 0, 0); + DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(1, gPokedexList_Tilemap, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexListUnderlay_Tilemap, 0, 0); if (page == PAGE_MAIN) CopyToBgTilemapBuffer(0, gPokedexStartMenuMain_Tilemap, 0, 0x280); else @@ -2576,9 +2098,8 @@ static bool8 LoadPokedexListPage(u8 page) ResetSpriteData(); FreeAllSpritePalettes(); gReservedSpritePaletteCount = 8; - LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[HGSS_DECAPPED]); + LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[0]); LoadSpritePalettes(sInterfaceSpritePalette); - LoadSpritePalettes(sStatBarSpritePal); //HGSS_Ui CreateInterfaceSprites(page); gMain.state++; break; @@ -2589,10 +2110,6 @@ static bool8 LoadPokedexListPage(u8 page) if (page == PAGE_MAIN) CreatePokedexList(sPokedexView->dexMode, sPokedexView->dexOrder); CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); - sPokedexView->statBarsSpriteId = 0xFF; //HGSS_Ui stat bars - CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui stat bars - sPokedexView->statBarsBgSpriteId = 0xFF; //HGSS_Ui stat bars background - CreateStatBarsBg(); //HGSS_Ui stat bars background sPokedexView->menuIsOpen = FALSE; sPokedexView->menuY = 0; CopyBgTilemapBufferToVram(0); @@ -2636,27 +2153,13 @@ static bool8 LoadPokedexListPage(u8 page) static void LoadPokedexBgPalette(bool8 isSearchResults) { - if (!HGSS_DARK_MODE) - { - if (isSearchResults == TRUE) - LoadPalette(gPokedexSearchResults_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); - else if (!IsNationalPokedexEnabled()) - LoadPalette(gPokedexDefault_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); - else - LoadPalette(gPokedexNational_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); - LoadPalette(GetOverworldTextboxPalettePtr(), 0xF0, 32); - } + if (isSearchResults == TRUE) + LoadPalette(gPokedexSearchResults_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); + else if (!IsNationalPokedexEnabled()) + LoadPalette(gPokedexBgHoenn_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); else - { - if (isSearchResults == TRUE) - LoadPalette(gPokedexSearchResults_dark_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); - else if (!IsNationalPokedexEnabled()) - LoadPalette(gPokedexDefault_dark_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); - else - LoadPalette(gPokedexNational_dark_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); - LoadPalette(GetOverworldTextboxPalettePtr(), 0xF0, 32); - } - + LoadPalette(gPokedexBgNational_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); + LoadPalette(GetOverworldTextboxPalettePtr(), BG_PLTT_ID(15), PLTT_SIZE_4BPP); } static void FreeWindowAndBgBuffers(void) @@ -2834,18 +2337,7 @@ static void PrintMonDexNumAndName(u8 windowId, u8 fontId, const u8 *str, u8 left AddTextPrinterParameterized4(windowId, fontId, left * 8, (top * 8) + 1, 0, 0, color, TEXT_SKIP_DRAW, str); } -static void PrintMonDexNumAndName_2(u8 windowId, u8 fontId, const u8* str, u8 left, u8 top) //HGSS_Ui offset for closer numer + text -{ - u8 color[3]; - - color[0] = TEXT_COLOR_TRANSPARENT; - color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_LIGHT_GRAY; - AddTextPrinterParameterized4(windowId, fontId, left * 8 - 3, (top * 8) + 1, 0, 0, color, -1, str); -} - // u16 ignored is passed but never used -#define MON_LIST_X 2 static void CreateMonListEntry(u8 position, u16 b, u16 ignored) { s16 entryNum; @@ -2861,22 +2353,22 @@ static void CreateMonListEntry(u8 position, u16 b, u16 ignored) { if (entryNum < 0 || entryNum >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[entryNum].dexNum == 0xFFFF) { - ClearMonListEntry(MON_LIST_X, i * 2, ignored); + ClearMonListEntry(17, i * 2, ignored); } else { - ClearMonListEntry(MON_LIST_X, i * 2, ignored); + ClearMonListEntry(17, i * 2, ignored); if (sPokedexView->pokedexList[entryNum].seen) { - CreateMonDexNum(entryNum, MON_LIST_X+1, i * 2, ignored); - CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, MON_LIST_X, i * 2, ignored); - CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, MON_LIST_X+5, i * 2); + CreateMonDexNum(entryNum, 0x12, i * 2, ignored); + CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, 0x11, i * 2, ignored); + CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, 0x16, i * 2); } else { - CreateMonDexNum(entryNum, MON_LIST_X+1, i * 2, ignored); - CreateCaughtBall(FALSE, MON_LIST_X, i * 2, ignored); - CreateMonName(0, MON_LIST_X+5, i * 2); + CreateMonDexNum(entryNum, 0x12, i * 2, ignored); + CreateCaughtBall(FALSE, 0x11, i * 2, ignored); + CreateMonName(0, 0x16, i * 2); } } entryNum++; @@ -2886,22 +2378,22 @@ static void CreateMonListEntry(u8 position, u16 b, u16 ignored) entryNum = b - 5; if (entryNum < 0 || entryNum >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[entryNum].dexNum == 0xFFFF) { - ClearMonListEntry(MON_LIST_X, sPokedexView->listVOffset * 2, ignored); + ClearMonListEntry(17, sPokedexView->listVOffset * 2, ignored); } else { - ClearMonListEntry(MON_LIST_X, sPokedexView->listVOffset * 2, ignored); + ClearMonListEntry(17, sPokedexView->listVOffset * 2, ignored); if (sPokedexView->pokedexList[entryNum].seen) { - CreateMonDexNum(entryNum, MON_LIST_X+1, sPokedexView->listVOffset * 2, ignored); - CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, MON_LIST_X, sPokedexView->listVOffset * 2, ignored); - CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, MON_LIST_X+5, sPokedexView->listVOffset * 2); + CreateMonDexNum(entryNum, 18, sPokedexView->listVOffset * 2, ignored); + CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, 0x11, sPokedexView->listVOffset * 2, ignored); + CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, 0x16, sPokedexView->listVOffset * 2); } else { - CreateMonDexNum(entryNum, MON_LIST_X+1, sPokedexView->listVOffset * 2, ignored); - CreateCaughtBall(FALSE, MON_LIST_X, sPokedexView->listVOffset * 2, ignored); - CreateMonName(0, MON_LIST_X+5, sPokedexView->listVOffset * 2); + CreateMonDexNum(entryNum, 18, sPokedexView->listVOffset * 2, ignored); + CreateCaughtBall(FALSE, 17, sPokedexView->listVOffset * 2, ignored); + CreateMonName(0, 0x16, sPokedexView->listVOffset * 2); } } break; @@ -2911,21 +2403,21 @@ static void CreateMonListEntry(u8 position, u16 b, u16 ignored) if (vOffset >= LIST_SCROLL_STEP) vOffset -= LIST_SCROLL_STEP; if (entryNum < 0 || entryNum >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[entryNum].dexNum == 0xFFFF) - ClearMonListEntry(MON_LIST_X, vOffset * 2, ignored); + ClearMonListEntry(17, vOffset * 2, ignored); else { - ClearMonListEntry(MON_LIST_X, vOffset * 2, ignored); + ClearMonListEntry(17, vOffset * 2, ignored); if (sPokedexView->pokedexList[entryNum].seen) { - CreateMonDexNum(entryNum, MON_LIST_X+1, vOffset * 2, ignored); - CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, MON_LIST_X, vOffset * 2, ignored); - CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, MON_LIST_X+5, vOffset * 2); + CreateMonDexNum(entryNum, 18, vOffset * 2, ignored); + CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, 0x11, vOffset * 2, ignored); + CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, 0x16, vOffset * 2); } else { - CreateMonDexNum(entryNum, MON_LIST_X+1, vOffset * 2, ignored); - CreateCaughtBall(FALSE, MON_LIST_X, vOffset * 2, ignored); - CreateMonName(0, MON_LIST_X+5, vOffset * 2); + CreateMonDexNum(entryNum, 18, vOffset * 2, ignored); + CreateCaughtBall(FALSE, 0x11, vOffset * 2, ignored); + CreateMonName(0, 0x16, vOffset * 2); } } break; @@ -2965,7 +2457,7 @@ static u8 CreateMonName(u16 num, u8 left, u8 top) str = gSpeciesNames[num]; else str = sText_TenDashes; - PrintMonDexNumAndName_2(0, FONT_NARROW, str, left, top); + PrintMonDexNumAndName(0, FONT_NARROW, str, left, top); return StringLength(str); } @@ -2991,7 +2483,7 @@ static void CreateMonSpritesAtPos(u16 selectedMon, u16 ignored) dexNum = GetPokemonSpriteToDisplay(selectedMon - 1); if (dexNum != 0xFFFF) { - spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); + spriteId = CreatePokedexMonSprite(dexNum, 0x60, 0x50); gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; gSprites[spriteId].data[5] = -32; } @@ -3000,7 +2492,7 @@ static void CreateMonSpritesAtPos(u16 selectedMon, u16 ignored) dexNum = GetPokemonSpriteToDisplay(selectedMon); if (dexNum != 0xFFFF) { - spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); + spriteId = CreatePokedexMonSprite(dexNum, 0x60, 0x50); gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; gSprites[spriteId].data[5] = 0; } @@ -3009,7 +2501,7 @@ static void CreateMonSpritesAtPos(u16 selectedMon, u16 ignored) dexNum = GetPokemonSpriteToDisplay(selectedMon + 1); if (dexNum != 0xFFFF) { - spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); + spriteId = CreatePokedexMonSprite(dexNum, 0x60, 0x50); gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; gSprites[spriteId].data[5] = 32; } @@ -3075,7 +2567,7 @@ static void CreateScrollingPokemonSprite(u8 direction, u16 selectedMon) dexNum = GetPokemonSpriteToDisplay(selectedMon - 1); if (dexNum != 0xFFFF) { - spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); + spriteId = CreatePokedexMonSprite(dexNum, 0x60, 0x50); gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; gSprites[spriteId].data[5] = -64; } @@ -3088,7 +2580,7 @@ static void CreateScrollingPokemonSprite(u8 direction, u16 selectedMon) dexNum = GetPokemonSpriteToDisplay(selectedMon + 1); if (dexNum != 0xFFFF) { - spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); + spriteId = CreatePokedexMonSprite(dexNum, 0x60, 0x50); gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; gSprites[spriteId].data[5] = 64; } @@ -3115,7 +2607,6 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) selectedMon = GetNextPosition(1, selectedMon, 0, sPokedexView->pokemonListCount - 1); CreateScrollingPokemonSprite(1, selectedMon); CreateMonListEntry(1, selectedMon, ignored); - sPokedexView->justScrolled = TRUE; //HGSS_Ui PlaySE(SE_DEX_SCROLL); } else if (JOY_HELD(DPAD_DOWN) && (selectedMon < sPokedexView->pokemonListCount - 1)) @@ -3124,7 +2615,6 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) selectedMon = GetNextPosition(0, selectedMon, 0, sPokedexView->pokemonListCount - 1); CreateScrollingPokemonSprite(2, selectedMon); CreateMonListEntry(2, selectedMon, ignored); - sPokedexView->justScrolled = TRUE; //HGSS_Ui PlaySE(SE_DEX_SCROLL); } else if (JOY_NEW(DPAD_LEFT) && (selectedMon > 0)) @@ -3136,7 +2626,6 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) sPokedexView->pokeBallRotation += 16 * (selectedMon - startingPos); ClearMonSprites(); CreateMonSpritesAtPos(selectedMon, 0xE); - sPokedexView->justScrolled = TRUE; //HGSS_Ui PlaySE(SE_DEX_PAGE); } else if (JOY_NEW(DPAD_RIGHT) && (selectedMon < sPokedexView->pokemonListCount - 1)) @@ -3147,7 +2636,6 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) sPokedexView->pokeBallRotation += 16 * (selectedMon - startingPos); ClearMonSprites(); CreateMonSpritesAtPos(selectedMon, 0xE); - sPokedexView->justScrolled = TRUE; //HGSS_Ui PlaySE(SE_DEX_PAGE); } @@ -3189,9 +2677,6 @@ static bool8 TryDoInfoScreenScroll(void) u16 nextPokemon; u16 selectedPokemon = sPokedexView->selectedPokemon; - if (sPokedexView->sEvoScreenData.fromEvoPage) - return FALSE; - if (JOY_NEW(DPAD_UP) && selectedPokemon) { nextPokemon = selectedPokemon; @@ -3290,201 +2775,221 @@ static u32 CreatePokedexMonSprite(u16 num, s16 x, s16 y) #define sIsDownArrow data[1] -#define LIST_RIGHT_SIDE_TEXT_X 204 -#define LIST_RIGHT_SIDE_TEXT_X_OFFSET 12 -#define LIST_RIGHT_SIDE_TEXT_Y_OFFSET 13 static void CreateInterfaceSprites(u8 page) { u8 spriteId; u16 digitNum; - u8 color[3]; - bool32 drawNextDigit; // Scroll arrows - spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 10, 4, 0); + spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 184, 4, 0); gSprites[spriteId].sIsDownArrow = FALSE; - spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 10, 156, 0); + spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 184, DISPLAY_HEIGHT - 4, 0); gSprites[spriteId].sIsDownArrow = TRUE; gSprites[spriteId].vFlip = TRUE; - CreateSprite(&sScrollBarSpriteTemplate, 8, 20, 0); - - if (!IsNationalPokedexEnabled() && page == PAGE_MAIN) - { - // Hoenn text - CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 40 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); - // Hoenn seen - CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); - // Hoenn own - spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 7, 1); - StartSpriteAnim(&gSprites[spriteId], 1); - - // Hoenn seen value - 100s - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = sPokedexView->seenCount / 100; - StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; + CreateSprite(&sScrollBarSpriteTemplate, 230, 20, 0); + // Start button + CreateSprite(&sInterfaceTextSpriteTemplate, 16, 120, 0); + // Menu text + spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 48, 120, 0); + StartSpriteAnim(&gSprites[spriteId], 3); + // Select button + spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 16, DISPLAY_HEIGHT - 16, 0); + StartSpriteAnim(&gSprites[spriteId], 2); + gSprites[spriteId].data[2] = 0x80; + // Search text + spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 48, DISPLAY_HEIGHT - 16, 0); + StartSpriteAnim(&gSprites[spriteId], 1); + + spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, DISPLAY_HEIGHT / 2, 2); + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 30; + gSprites[spriteId].data[0] = 30; + gSprites[spriteId].data[1] = 0; + + spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, DISPLAY_HEIGHT / 2, 2); + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 31; + gSprites[spriteId].data[0] = 31; + gSprites[spriteId].data[1] = 128; + + if (page == PAGE_MAIN) + { + bool32 drawNextDigit; + + if (!IsNationalPokedexEnabled()) + { + // Seen text + CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 40, 1); + // Own text + spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 72, 1); + StartSpriteAnim(&gSprites[spriteId], 1); - // Hoenn seen value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->seenCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) + // Seen value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 24, 48, 1); + digitNum = sPokedexView->seenCount / 100; StartSpriteAnim(&gSprites[spriteId], digitNum); - else - gSprites[spriteId].invisible = TRUE; + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; + + // Seen value - 10s + spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 32, 48, 1); + digitNum = (sPokedexView->seenCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; - // Hoenn seen value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->seenCount % 100) % 10; - StartSpriteAnim(&gSprites[spriteId], digitNum); + // Seen value - 1s + spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 40, 48, 1); + digitNum = (sPokedexView->seenCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + // Owned value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 24, 80, 1); + digitNum = sPokedexView->ownCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; - // Hoenn owned value - 100s - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = sPokedexView->ownCount / 100; - StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; + // Owned value - 10s + spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 32, 80, 1); + digitNum = (sPokedexView->ownCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; - // Hoenn owned value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->ownCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) + // Owned value - 1s + spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 40, 80, 1); + digitNum = (sPokedexView->ownCount % 100) % 10; StartSpriteAnim(&gSprites[spriteId], digitNum); + } else - gSprites[spriteId].invisible = TRUE; - - // Hoenn owned value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->ownCount % 100) % 10; - StartSpriteAnim(&gSprites[spriteId], digitNum); - } - else if (page == PAGE_MAIN) - { - u16 seenOwnedCount; - - // Hoenn text - CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 40 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); - // Hoenn seen - CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); - // Hoenn own - spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 7, 1); - StartSpriteAnim(&gSprites[spriteId], 1); - - // National text - spriteId = CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 73 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); - StartSpriteAnim(&gSprites[spriteId], 1); - // National seen - CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); - // National own - spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); - StartSpriteAnim(&gSprites[spriteId], 1); - - // Hoenn seen value - 100s - seenOwnedCount = GetHoennPokedexCount(FLAG_GET_SEEN); - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = seenOwnedCount / 100; - StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; + { + u16 seenOwnedCount; + + // Seen text + CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 40, 1); + // Own text + spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, 32, 76, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + + // Hoenn text (seen) + CreateSprite(&sHoennNationalTextSpriteTemplate, 17, 45, 1); + + // National text (seen) + spriteId = CreateSprite(&sHoennNationalTextSpriteTemplate, 17, 55, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + + // Hoenn text (own) + CreateSprite(&sHoennNationalTextSpriteTemplate, 17, 81, 1); - // Hoenn seen value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (seenOwnedCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) + // National text (own) + spriteId = CreateSprite(&sHoennNationalTextSpriteTemplate, 17, 91, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + + // Hoenn seen value - 100s + seenOwnedCount = GetHoennPokedexCount(FLAG_GET_SEEN); + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 40, 45, 1); + digitNum = seenOwnedCount / 100; StartSpriteAnim(&gSprites[spriteId], digitNum); - else - gSprites[spriteId].invisible = TRUE; - - // Hoenn seen value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (seenOwnedCount % 100) % 10; - StartSpriteAnim(&gSprites[spriteId], digitNum); - - seenOwnedCount = GetHoennPokedexCount(FLAG_GET_CAUGHT); - // Hoenn owned value - 100s - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = seenOwnedCount / 100; - StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; - // Hoenn owned value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (seenOwnedCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) + // Hoenn seen value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 48, 45, 1); + digitNum = (seenOwnedCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn seen value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 56, 45, 1); + digitNum = (seenOwnedCount % 100) % 10; StartSpriteAnim(&gSprites[spriteId], digitNum); - else - gSprites[spriteId].invisible = TRUE; - - // Hoenn owned value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (seenOwnedCount % 100) % 10; - StartSpriteAnim(&gSprites[spriteId], digitNum); - - //**************************** - // National seen value - 100s - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = sPokedexView->seenCount / 100; - StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; - // National seen value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->seenCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) + // National seen value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 40, 55, 1); + digitNum = sPokedexView->seenCount / 100; StartSpriteAnim(&gSprites[spriteId], digitNum); - else - gSprites[spriteId].invisible = TRUE; - - // National seen value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->seenCount % 100) % 10; - StartSpriteAnim(&gSprites[spriteId], digitNum); - - // National owned value - 100s - drawNextDigit = FALSE; - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = sPokedexView->ownCount / 100; - StartSpriteAnim(&gSprites[spriteId], digitNum); - if (digitNum != 0) - drawNextDigit = TRUE; - else - gSprites[spriteId].invisible = TRUE; + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; + + // National seen value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 48, 55, 1); + digitNum = (sPokedexView->seenCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; - // National owned value - 10s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->ownCount % 100) / 10; - if (digitNum != 0 || drawNextDigit) + // National seen value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 56, 55, 1); + digitNum = (sPokedexView->seenCount % 100) % 10; StartSpriteAnim(&gSprites[spriteId], digitNum); - else - gSprites[spriteId].invisible = TRUE; - // National owned value - 1s - spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); - digitNum = (sPokedexView->ownCount % 100) % 10; - StartSpriteAnim(&gSprites[spriteId], digitNum); - } + seenOwnedCount = GetHoennPokedexCount(FLAG_GET_CAUGHT); - if (page == PAGE_MAIN) - { + // Hoenn owned value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 40, 81, 1); + digitNum = seenOwnedCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn owned value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 48, 81, 1); + digitNum = (seenOwnedCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn owned value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 56, 81, 1); + digitNum = (seenOwnedCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + + // National owned value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 40, 91, 1); + digitNum = sPokedexView->ownCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; + + // National owned value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 48, 91, 1); + digitNum = (sPokedexView->ownCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // National owned value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, 56, 91, 1); + digitNum = (sPokedexView->ownCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + } spriteId = CreateSprite(&sDexListStartMenuCursorSpriteTemplate, 136, 96, 1); gSprites[spriteId].invisible = TRUE; } @@ -3502,7 +3007,7 @@ static void SpriteCB_EndMoveMonForInfoScreen(struct Sprite *sprite) static void SpriteCB_SeenOwnInfo(struct Sprite *sprite) { - if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + if (sPokedexView->currentPage != PAGE_MAIN) DestroySprite(sprite); } @@ -3514,15 +3019,15 @@ void SpriteCB_MoveMonForInfoScreen(struct Sprite *sprite) sprite->y2 = 0; if (sprite->x != MON_PAGE_X || sprite->y != MON_PAGE_Y) { - if (sprite->x > 48) - sprite->x -= 4; - if (sprite->x < 48) - sprite->x = 48; + if (sprite->x > MON_PAGE_X) + sprite->x--; + if (sprite->x < MON_PAGE_X) + sprite->x++; - if (sprite->y > 56) - sprite->y -= 4; - if (sprite->y < 56) - sprite->y = 56; + if (sprite->y > MON_PAGE_Y) + sprite->y--; + if (sprite->y < MON_PAGE_Y) + sprite->y++; } else { @@ -3672,64 +3177,17 @@ static void PrintInfoScreenText(const u8 *str, u8 left, u8 top) color[1] = TEXT_DYNAMIC_COLOR_6; color[2] = TEXT_COLOR_LIGHT_GRAY; - AddTextPrinterParameterized4(0, 1, left, top, 0, 0, color, -1, str); -} -static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top) //HGSS_Ui -{ - u8 color[3]; - color[0] = TEXT_COLOR_TRANSPARENT; - color[1] = TEXT_COLOR_WHITE; - color[2] = TEXT_DYNAMIC_COLOR_6; - AddTextPrinterParameterized4(0, FONT_NORMAL, left, top, 0, 0, color, TEXT_SKIP_DRAW, str); } -static void PrintInfoScreenTextSmall(const u8* str, u8 left, u8 top) -{ - u8 color[3]; - color[0] = TEXT_COLOR_TRANSPARENT; - color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_LIGHT_GRAY; - AddTextPrinterParameterized4(0, 0, left, top, 0, 0, color, 0, str); -} -static void PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top) -{ - u8 color[3]; - color[0] = TEXT_COLOR_TRANSPARENT; - color[1] = TEXT_COLOR_WHITE; - color[2] = TEXT_DYNAMIC_COLOR_6; +#define tScrolling data[0] +#define tMonSpriteDone data[1] +#define tBgLoaded data[2] +#define tSkipCry data[3] +#define tMonSpriteId data[4] +#define tTrainerSpriteId data[5] - AddTextPrinterParameterized4(0, 0, left, top, 0, 0, color, 0, str); -} -//Stats screen -static void PrintStatsScreenTextSmall(u8 windowId, const u8* str, u8 left, u8 top) -{ - u8 color[3]; - color[0] = TEXT_COLOR_TRANSPARENT; - color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_LIGHT_GRAY; - - AddTextPrinterParameterized4(windowId, 0, left, top, 0, 0, color, 0, str); -} -static void PrintStatsScreenTextSmallWhite(u8 windowId, const u8* str, u8 left, u8 top) -{ - u8 color[3]; - color[0] = TEXT_COLOR_TRANSPARENT; - color[1] = TEXT_COLOR_WHITE; - color[2] = TEXT_DYNAMIC_COLOR_6; - - AddTextPrinterParameterized4(windowId, 0, left, top, 0, 0, color, 0, str); -} - - -#define tScrolling data[0] -#define tMonSpriteDone data[1] -#define tBgLoaded data[2] -#define tSkipCry data[3] -#define tMonSpriteId data[4] -#define tTrainerSpriteId data[5] - -static u8 LoadInfoScreen(struct PokedexListItem *item, u8 monSpriteId) +static u8 LoadInfoScreen(struct PokedexListItem *item, u8 monSpriteId) { u8 taskId; @@ -3794,9 +3252,8 @@ static void Task_LoadInfoScreen(u8 taskId) } break; case 1: - LoadTilesetTilemapHGSS(INFO_SCREEN); - // DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0); - // CopyToBgTilemapBuffer(3, gPokedexInfoScreen_Tilemap, 0, 0); + DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexInfoScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); PutWindowTilemap(WIN_FOOTPRINT); @@ -3806,14 +3263,11 @@ static void Task_LoadInfoScreen(u8 taskId) break; case 2: LoadScreenSelectBarMain(0xD); - // HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); + HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); gMain.state++; break; case 3: - sPokedexView->typeIconSpriteIds[0] = 0xFF; - sPokedexView->typeIconSpriteIds[1] = 0xFF; - CreateTypeIconSprites(); gMain.state++; break; case 4: @@ -3862,11 +3316,20 @@ static void Task_LoadInfoScreen(u8 taskId) if (!gPaletteFade.active) { gMain.state++; + if (!gTasks[taskId].tSkipCry) + { + StopCryAndClearCrySongs(); + PlayCry_NormalNoDucking(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, CRY_VOLUME_RS, CRY_PRIORITY_NORMAL); + } + else + { + gMain.state++; + } } break; case 9: - // if (!IsCryPlayingOrClearCrySongs()) - gMain.state++; + if (!IsCryPlayingOrClearCrySongs()) + gMain.state++; break; case 10: gTasks[taskId].tScrolling = FALSE; @@ -3915,16 +3378,61 @@ static void Task_HandleInfoScreenInput(u8 taskId) PlaySE(SE_PC_OFF); return; } - - if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) + if (JOY_NEW(A_BUTTON)) { - sPokedexView->selectedScreen = AREA_SCREEN; - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 1; - gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; - PlaySE(SE_PIN); + switch (sPokedexView->selectedScreen) + { + case AREA_SCREEN: + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 16, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; + PlaySE(SE_PIN); + break; + case CRY_SCREEN: + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 2; + gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; + PlaySE(SE_PIN); + break; + case SIZE_SCREEN: + if (!sPokedexListItem->owned) + { + PlaySE(SE_FAILURE); + } + else + { + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 3; + gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; + PlaySE(SE_PIN); + } + break; + case CANCEL_SCREEN: + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].func = Task_ExitInfoScreen; + PlaySE(SE_PC_OFF); + break; + } + return; + } + if ((JOY_NEW(DPAD_LEFT) + || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + && sPokedexView->selectedScreen > 0) + { + sPokedexView->selectedScreen--; + HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); + PlaySE(SE_DEX_PAGE); + return; + } + if ((JOY_NEW(DPAD_RIGHT) + || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + && sPokedexView->selectedScreen < CANCEL_SCREEN) + { + sPokedexView->selectedScreen++; + HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); + PlaySE(SE_DEX_PAGE); + return; } - } static void Task_SwitchScreensFromInfoScreen(u8 taskId) @@ -3984,13 +3492,14 @@ static void Task_LoadAreaScreen(u8 taskId) } break; case 1: - LoadScreenSelectBarSubmenu(0xD); //HGSS_Ui + LoadScreenSelectBarSubmenu(0xD); + HighlightSubmenuScreenSelectBarItem(0, 0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(13) | BGCNT_16COLOR | BGCNT_TXT256x256); gMain.state++; break; case 2: - ShowPokedexAreaScreen(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), &sPokedexView->screenSwitchState); + ShowPokedexAreaScreen(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), &sPokedexView->screenSwitchState); SetVBlankCallback(gPokedexVBlankCB); sPokedexView->screenSwitchState = 0; gMain.state = 0; @@ -4017,10 +3526,7 @@ static void Task_SwitchScreensFromAreaScreen(u8 taskId) gTasks[taskId].func = Task_LoadInfoScreen; break; case 2: - if (!sPokedexListItem->owned) - PlaySE(SE_FAILURE); - else - gTasks[taskId].func = Task_LoadStatsScreen; + gTasks[taskId].func = Task_LoadCryScreen; break; } } @@ -4044,7 +3550,8 @@ static void Task_LoadCryScreen(u8 taskId) } break; case 1: - LoadTilesetTilemapHGSS(CRY_SCREEN); + DecompressAndLoadBgGfxUsingHeap(3, &gPokedexMenu_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, &gPokedexCryScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); PutWindowTilemap(WIN_VU_METER); @@ -4052,7 +3559,8 @@ static void Task_LoadCryScreen(u8 taskId) gMain.state++; break; case 2: - LoadScreenSelectBarMain(0xD); //HGSS_Ui + LoadScreenSelectBarSubmenu(0xD); + HighlightSubmenuScreenSelectBarItem(1, 0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); gMain.state++; break; @@ -4140,7 +3648,7 @@ static void Task_HandleCryScreenInput(u8 taskId) if (JOY_NEW(A_BUTTON)) { LoadPlayArrowPalette(TRUE); - CryScreenPlayButton(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); + CryScreenPlayButton(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); return; } else if (!gPaletteFade.active) @@ -4197,7 +3705,7 @@ static void Task_SwitchScreensFromCryScreen(u8 taskId) gTasks[taskId].func = Task_LoadInfoScreen; break; case 2: - gTasks[taskId].func = Task_LoadEvolutionScreen; + gTasks[taskId].func = Task_LoadAreaScreen; break; case 3: gTasks[taskId].func = Task_LoadSizeScreen; @@ -4236,13 +3744,15 @@ static void Task_LoadSizeScreen(u8 taskId) } break; case 1: - LoadTilesetTilemapHGSS(SIZE_SCREEN); + DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexSizeScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); gMain.state++; break; case 2: - LoadScreenSelectBarMain(0xD); //HGSS_Ui + LoadScreenSelectBarSubmenu(0xD); + HighlightSubmenuScreenSelectBarItem(2, 0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); gMain.state++; break; @@ -4360,17 +3870,15 @@ static void Task_SwitchScreensFromSizeScreen(u8 taskId) static void LoadScreenSelectBarMain(u16 unused) { - CopyToBgTilemapBuffer(1, gPokedexScreenSelectBarSubmenu_Tilemap_Clear, 0, 0); - CopyBgTilemapBufferToVram(1); + CopyToBgTilemapBuffer(1, gPokedexScreenSelectBarMain_Tilemap, 0, 0); } static void LoadScreenSelectBarSubmenu(u16 unused) { CopyToBgTilemapBuffer(1, gPokedexScreenSelectBarSubmenu_Tilemap, 0, 0); - CopyBgTilemapBufferToVram(1); } -static void HighlightScreenSelectBarItem(u8 selectedScreen, u16 unused) //HGSS_Ui +static void HighlightScreenSelectBarItem(u8 selectedScreen, u16 unused) { u8 i; u8 j; @@ -4426,7 +3934,7 @@ static void HighlightSubmenuScreenSelectBarItem(u8 a, u16 b) } #define tState data[0] -#define tSpecies data[1] +#define tDexNum data[1] #define tPalTimer data[2] #define tMonSpriteId data[3] #define tOtIdLo data[12] @@ -4434,12 +3942,12 @@ static void HighlightSubmenuScreenSelectBarItem(u8 a, u16 b) #define tPersonalityLo data[14] #define tPersonalityHi data[15] -u8 DisplayCaughtMonDexPage(u16 species, u32 otId, u32 personality) +u8 DisplayCaughtMonDexPage(u16 dexNum, u32 otId, u32 personality) { u8 taskId = CreateTask(Task_DisplayCaughtMonDexPage, 0); gTasks[taskId].tState = 0; - gTasks[taskId].tSpecies = species; + gTasks[taskId].tDexNum = dexNum; gTasks[taskId].tOtIdLo = otId; gTasks[taskId].tOtIdHi = otId >> 16; gTasks[taskId].tPersonalityLo = personality; @@ -4450,8 +3958,7 @@ u8 DisplayCaughtMonDexPage(u16 species, u32 otId, u32 personality) static void Task_DisplayCaughtMonDexPage(u8 taskId) { u8 spriteId; - u16 species = gTasks[taskId].tSpecies; - u16 dexNum = SpeciesToNationalPokedexNum(species); + u16 dexNum = gTasks[taskId].tDexNum; switch (gTasks[taskId].tState) { @@ -4472,30 +3979,18 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) } break; case 1: - sPokedexView = AllocZeroed(sizeof(struct PokedexView)); //for type icons - ResetPokedexView(sPokedexView); - - #ifdef POKEMON_EXPANSION - if (gFormSpeciesIdTables[species] != NULL) - sPokedexView->formSpecies = species; - else - sPokedexView->formSpecies = 0; - #endif - - LoadTilesetTilemapHGSS(INFO_SCREEN); + DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexInfoScreen_Tilemap, 0, 0); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); PutWindowTilemap(WIN_FOOTPRINT); - DrawFootprint(WIN_FOOTPRINT, dexNum); + DrawFootprint(WIN_FOOTPRINT, gTasks[taskId].tDexNum); CopyWindowToVram(WIN_FOOTPRINT, COPYWIN_GFX); ResetPaletteFade(); LoadPokedexBgPalette(FALSE); gTasks[taskId].tState++; break; case 2: - sPokedexView->typeIconSpriteIds[0] = 0xFF; - sPokedexView->typeIconSpriteIds[1] = 0xFF; - CreateTypeIconSprites(); gTasks[taskId].tState++; break; case 3: @@ -4506,11 +4001,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) gTasks[taskId].tState++; break; case 4: - #ifndef POKEMON_EXPANSION spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, MON_PAGE_X, MON_PAGE_Y, 0); - #else - spriteId = CreateMonPicSprite(species, 0, ((u16)gTasks[taskId].tPersonalityHi << 16) | (u16)gTasks[taskId].tPersonalityLo, TRUE, MON_PAGE_X, MON_PAGE_Y, 0, TAG_NONE); - #endif gSprites[spriteId].oam.priority = 0; BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(gPokedexVBlankCB); @@ -4529,7 +4020,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) case 6: if (!gPaletteFade.active) { - PlayCry_Normal(NationalPokedexNumToSpeciesHGSS(dexNum), 0); + PlayCry_Normal(NationalPokedexNumToSpecies(dexNum), 0); gTasks[taskId].tPalTimer = 0; gTasks[taskId].func = Task_HandleCaughtMonPageInput; } @@ -4542,25 +4033,17 @@ static void Task_HandleCaughtMonPageInput(u8 taskId) if (JOY_NEW(A_BUTTON | B_BUTTON)) { BeginNormalPaletteFade(PALETTES_BG, 0, 0, 16, RGB_BLACK); - SetSpriteInvisibility(0, TRUE); - SetSpriteInvisibility(1, TRUE); gSprites[gTasks[taskId].tMonSpriteId].callback = SpriteCB_SlideCaughtMonToCenter; gTasks[taskId].func = Task_ExitCaughtMonPage; } // Flicker caught screen color else if (++gTasks[taskId].tPalTimer & 16) { - if (!HGSS_DARK_MODE) - LoadPalette(gPokedexDefault_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); - else - LoadPalette(gPokedexDefault_dark_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); + LoadPalette(gPokedexBgHoenn_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); } else { - if (!HGSS_DARK_MODE) - LoadPalette(gPokedexDefault_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); - else - LoadPalette(gPokedexDefault_dark_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); + LoadPalette(gPokedexCaughtScreen_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); } } @@ -4584,7 +4067,7 @@ static void Task_ExitCaughtMonPage(u8 taskId) if (buffer) Free(buffer); - species = gTasks[taskId].tSpecies; + species = NationalPokedexNumToSpecies(gTasks[taskId].tDexNum); otId = ((u16)gTasks[taskId].tOtIdHi << 16) | (u16)gTasks[taskId].tOtIdLo; personality = ((u16)gTasks[taskId].tPersonalityHi << 16) | (u16)gTasks[taskId].tPersonalityLo; paletteNum = gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum; @@ -4616,129 +4099,30 @@ static void SpriteCB_SlideCaughtMonToCenter(struct Sprite *sprite) #undef tPersonalityLo #undef tPersonalityHi -//Type Icon -static void SetSpriteInvisibility(u8 spriteArrayId, bool8 invisible) -{ - gSprites[sPokedexView->typeIconSpriteIds[spriteArrayId]].invisible = invisible; -} -// different from pokemon_summary_screen -#define TYPE_ICON_PAL_NUM_0 13 -#define TYPE_ICON_PAL_NUM_1 14 -#define TYPE_ICON_PAL_NUM_2 15 -static const u8 sMoveTypeToOamPaletteNum[NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT] = -{ - [TYPE_NORMAL] = TYPE_ICON_PAL_NUM_0, - [TYPE_FIGHTING] = TYPE_ICON_PAL_NUM_0, - [TYPE_FLYING] = TYPE_ICON_PAL_NUM_1, - [TYPE_POISON] = TYPE_ICON_PAL_NUM_1, - [TYPE_GROUND] = TYPE_ICON_PAL_NUM_0, - [TYPE_ROCK] = TYPE_ICON_PAL_NUM_0, - [TYPE_BUG] = TYPE_ICON_PAL_NUM_2, - [TYPE_GHOST] = TYPE_ICON_PAL_NUM_1, - [TYPE_STEEL] = TYPE_ICON_PAL_NUM_0, - [TYPE_MYSTERY] = TYPE_ICON_PAL_NUM_2, - [TYPE_FIRE] = TYPE_ICON_PAL_NUM_0, - [TYPE_WATER] = TYPE_ICON_PAL_NUM_1, - [TYPE_GRASS] = TYPE_ICON_PAL_NUM_2, - [TYPE_ELECTRIC] = TYPE_ICON_PAL_NUM_0, - [TYPE_PSYCHIC] = TYPE_ICON_PAL_NUM_1, - [TYPE_ICE] = TYPE_ICON_PAL_NUM_1, - [TYPE_DRAGON] = TYPE_ICON_PAL_NUM_2, - [TYPE_DARK] = TYPE_ICON_PAL_NUM_0, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_COOL] = TYPE_ICON_PAL_NUM_0, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_BEAUTY] = TYPE_ICON_PAL_NUM_1, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_CUTE] = TYPE_ICON_PAL_NUM_1, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_SMART] = TYPE_ICON_PAL_NUM_2, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_TOUGH] = TYPE_ICON_PAL_NUM_0, - #ifdef TYPE_FAIRY - [TYPE_FAIRY] = TYPE_ICON_PAL_NUM_1, //based on battle_engine - #endif -}; -static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) -{ - struct Sprite *sprite; - - sprite = &gSprites[sPokedexView->typeIconSpriteIds[spriteArrayId]]; - StartSpriteAnim(sprite, typeId); - sprite->oam.paletteNum = sMoveTypeToOamPaletteNum[typeId]; - sprite->x = x + 16; - sprite->y = y + 8; - SetSpriteInvisibility(spriteArrayId, FALSE); -} -static void PrintCurrentSpeciesTypeInfo(u8 newEntry, u16 species) -{ - u32 i; - u16 dexNum = SpeciesToNationalPokedexNum(species); - u8 type1, type2; - - if (!newEntry) - { - species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); - dexNum = SpeciesToNationalPokedexNum(species); - } - //type icon(s) - #ifdef TX_RANDOMIZER_AND_CHALLENGES - type1 = GetTypeBySpecies(species, 1); - type2 = GetTypeBySpecies(species, 2); - #else - type1 = gSpeciesInfo[species].types[0]; - type2 = gSpeciesInfo[species].types[1]; - #endif - if (species == SPECIES_NONE) - type1 = type2 = TYPE_MYSTERY; - - if (type1 == type2) - { - SetTypeIconPosAndPal(type1, 147, 48, 0); - SetSpriteInvisibility(1, TRUE); - } - else - { - SetTypeIconPosAndPal(type1, 147, 48, 0); - SetTypeIconPosAndPal(type2, 147 + 33, 48, 1); - } - -} -static void CreateTypeIconSprites(void) -{ - u8 i; - - LoadCompressedSpriteSheet(&sSpriteSheet_MoveTypes); - LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); - for (i = 0; i < 2; i++) - { - if (sPokedexView->typeIconSpriteIds[i] == 0xFF) - sPokedexView->typeIconSpriteIds[i] = CreateSprite(&sSpriteTemplate_MoveTypes, 10, 10, 2); - - SetSpriteInvisibility(i, TRUE); - } -} - - // u32 value is re-used, but passed as a bool that's TRUE if national dex is enabled static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) { u8 str[16]; u8 str2[32]; - u16 species; + u16 natNum; const u8 *name; const u8 *category; const u8 *description; - // if (newEntry) - // PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(1, gText_PokedexRegistration, 0xF0), 0); + if (newEntry) + PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(FONT_NORMAL, gText_PokedexRegistration, 0xF0), 0); if (value == 0) value = NationalToHoennOrder(num); else value = num; ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); - PrintInfoScreenTextWhite(str, 123, 17); //HGSS_Ui - species = NationalPokedexNumToSpeciesHGSS(num); - if (species) - name = gSpeciesNames[species]; + PrintInfoScreenText(str, 0x60, 0x19); + natNum = NationalPokedexNumToSpecies(num); + if (natNum) + name = gSpeciesNames[natNum]; else name = sText_TenDashes2; - PrintInfoScreenTextWhite(name, 157, 17); //HGSS_Ui + PrintInfoScreenText(name, 0x84, 0x19); if (owned) { CopyMonCategoryText(num, str2); @@ -4748,30 +4132,24 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) { category = gText_5MarksPokemon; } - PrintInfoScreenText(category, 123, 31); //HGSS_Ui - PrintInfoScreenText(gText_HTHeight, 155, 64); //HGSS_Ui - PrintInfoScreenText(gText_WTWeight, 155, 77); //HGSS_Ui + PrintInfoScreenText(category, 0x64, 0x29); + PrintInfoScreenText(gText_HTHeight, 0x60, 0x39); + PrintInfoScreenText(gText_WTWeight, 0x60, 0x49); if (owned) { - PrintMonHeight(gPokedexEntries[num].height, 180, 64); //HGSS_Ui - PrintMonWeight(gPokedexEntries[num].weight, 180, 77); //HGSS_Ui + PrintMonHeight(gPokedexEntries[num].height, 0x81, 0x39); + PrintMonWeight(gPokedexEntries[num].weight, 0x81, 0x49); } else { - PrintInfoScreenText(gText_UnkHeight, 180, 64); //HGSS_Ui - PrintInfoScreenText(gText_UnkWeight, 180, 77); //HGSS_Ui + PrintInfoScreenText(gText_UnkHeight, 0x81, 0x39); + PrintInfoScreenText(gText_UnkWeight, 0x81, 0x49); } if (owned) - { description = gPokedexEntries[num].description; - } else description = sExpandedPlaceholder_PokedexDescription; - PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, 0xF0), 93); //HGSS_Ui - - //Type Icon(s) //HGSS_Ui - if (owned) - PrintCurrentSpeciesTypeInfo(newEntry, species); //HGSS_Ui + PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, 0xF0), 0x5F); } static void PrintMonHeight(u16 height, u8 left, u8 top) @@ -5127,7 +4505,7 @@ static u8 PrintCryScreenSpeciesName(u8 windowId, u16 num, u8 left, u8 top) for (i = 0; i < ARRAY_COUNT(str); i++) str[i] = EOS; - num = NationalPokedexNumToSpeciesHGSS(num); + num = NationalPokedexNumToSpecies(num); switch (num) { default: @@ -5279,12 +4657,8 @@ static u32 GetPokedexMonPersonality(u16 species) u16 CreateMonSpriteFromNationalDexNumber(u16 nationalNum, s16 x, s16 y, u16 paletteSlot) { - nationalNum = NationalPokedexNumToSpeciesHGSS(nationalNum); - #ifndef POKEMON_EXPANSION + nationalNum = NationalPokedexNumToSpecies(nationalNum); return CreateMonPicSprite_HandleDeoxys(nationalNum, SHINY_ODDS, GetPokedexMonPersonality(nationalNum), TRUE, x, y, paletteSlot, TAG_NONE); - #else - return CreateMonPicSprite(nationalNum, SHINY_ODDS, GetPokedexMonPersonality(nationalNum), TRUE, x, y, paletteSlot, TAG_NONE); - #endif } static u16 CreateSizeScreenTrainerPic(u16 species, s16 x, s16 y, s8 paletteSlot) @@ -5292,41 +4666,13 @@ static u16 CreateSizeScreenTrainerPic(u16 species, s16 x, s16 y, s8 paletteSlot) return CreateTrainerPicSprite(species, TRUE, x, y, paletteSlot, TAG_NONE); } - -bool8 SpeciesCanLearnLvlUpMove(u16 species, u16 move) //Move search PokedexPlus HGSS_Ui -{ - u16 j; - #if defined (BATTLE_ENGINE) || defined (POKEMON_EXPANSION) - for (j = 0; j < MAX_LEVEL_UP_MOVES && gLevelUpLearnsets[species][j].move != LEVEL_UP_END; j++) - { - if (move == (gLevelUpLearnsets[species][j].move)) - { - return TRUE; - } - } - #else - for (j = 0; j < MAX_LEVEL_UP_MOVES && gLevelUpLearnsets[species][j] != LEVEL_UP_END; j++) - { - if (move == (gLevelUpLearnsets[species][j] & LEVEL_UP_MOVE_ID)) - { - return TRUE; - } - } - #endif - return FALSE; -} - - static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 type1, u8 type2) { u16 species; - u16 i,j; + u16 i; u16 resultsCount; u8 types[2]; - u8 tutorMoveId, tmMoveId; //PokedexPlus HGSS_Ui - u16 move = 0xFFFF; - CreatePokedexList(dexMode, order); for (i = 0, resultsCount = 0; i < NATIONAL_DEX_COUNT; i++) @@ -5493,25 +4839,19 @@ static void Task_LoadSearchMenu(u8 taskId) InitWindows(sSearchMenu_WindowTemplate); DeactivateAllTextPrinters(); PutWindowTilemap(0); - if (!HGSS_DECAPPED) - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenuSearch_Gfx, 0x2000, 0, 0); - else - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenuSearch_DECA_Gfx, 0x2000, 0, 0); + DecompressAndLoadBgGfxUsingHeap(3, gPokedexSearchMenu_Gfx, 0x2000, 0, 0); + if (!IsNationalPokedexEnabled()) - CopyToBgTilemapBuffer(3, gPokedexScreenSearchHoenn_Tilemap, 0, 0); - else - CopyToBgTilemapBuffer(3, gPokedexScreenSearchNational_Tilemap, 0, 0); - if (!HGSS_DARK_MODE) - LoadPalette(gPokedexMenuSearch_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(4 * 16 - 1)); + CopyToBgTilemapBuffer(3, gPokedexSearchMenuHoenn_Tilemap, 0, 0); else - LoadPalette(gPokedexMenuSearch_dark_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(4 * 16 - 1)); + CopyToBgTilemapBuffer(3, gPokedexSearchMenuNational_Tilemap, 0, 0); + LoadPalette(gPokedexSearchMenu_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(4 * 16 - 1)); gMain.state = 1; } break; case 1: - LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[HGSS_DECAPPED]); + LoadCompressedSpriteSheet(sInterfaceSpriteSheet); LoadSpritePalettes(sInterfaceSpritePalette); - LoadSpritePalettes(sStatBarSpritePal); //HGSS_Ui CreateSearchParameterScrollArrows(taskId); for (i = 0; i < NUM_TASK_DATA; i++) gTasks[taskId].data[i] = 0; @@ -5526,8 +4866,6 @@ static void Task_LoadSearchMenu(u8 taskId) break; case 2: BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); - sPokedexView->statBarsSpriteId = 0xFF; //HGSS_Ui - CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui gMain.state++; break; case 3: @@ -6310,2531 +5648,3 @@ static void ClearSearchParameterBoxText(void) { ClearSearchMenuRect(144, 8, 96, 96); } - - - - -//PokedexPlus HGSS_Ui -static u16 NationalPokedexNumToSpeciesHGSS(u16 nationalNum) -{ - u16 species; - - if (!nationalNum) - return 0; - - #ifndef POKEMON_EXPANSION - return NationalPokedexNumToSpecies(nationalNum); - #else - if (sPokedexView->formSpecies != 0) - return sPokedexView->formSpecies; - else - return NationalPokedexNumToSpecies(nationalNum); - #endif -} - -static void LoadTilesetTilemapHGSS(u8 page) -{ - switch (page) - { - case INFO_SCREEN: - if (!HGSS_DECAPPED) - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_1_Gfx, 0x2000, 0, 0); - else - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_1_Gfx, 0x2000, 0, 0); - CopyToBgTilemapBuffer(3, gPokedexScreenInfo_Tilemap, 0, 0); - break; - case STATS_SCREEN: - if (!HGSS_DECAPPED) - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_1_Gfx, 0x2000, 0, 0); - else - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_1_Gfx, 0x2000, 0, 0); - CopyToBgTilemapBuffer(3, gPokedexScreenStats_Tilemap, 0, 0); - break; - case EVO_SCREEN: - if (!HGSS_DECAPPED) - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_2_Gfx, 0x2000, 0, 0); - else - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_2_Gfx, 0x2000, 0, 0); - #ifndef POKEMON_EXPANSION - CopyToBgTilemapBuffer(3, gPokedexScreenEvolution_Tilemap, 0, 0); - #endif - #ifdef POKEMON_EXPANSION - CopyToBgTilemapBuffer(3, gPokedexScreenEvolution_Tilemap_PE, 0, 0); - #endif - break; - case FORMS_SCREEN: //Pokemonexpansion only (rhh) - if (!HGSS_DECAPPED) - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_2_Gfx, 0x2000, 0, 0); - else - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_2_Gfx, 0x2000, 0, 0); - CopyToBgTilemapBuffer(3, gPokedexScreenForms_Tilemap, 0, 0); - break; - case CRY_SCREEN: - if (!HGSS_DECAPPED) - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_3_Gfx, 0x2000, 0, 0); - else - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_3_Gfx, 0x2000, 0, 0); - CopyToBgTilemapBuffer(3, gPokedexScreenCry_Tilemap, 0, 0); - break; - case SIZE_SCREEN: - if (!HGSS_DECAPPED) - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_3_Gfx, 0x2000, 0, 0); - else - DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_3_Gfx, 0x2000, 0, 0); - CopyToBgTilemapBuffer(3, gPokedexScreenSize_Tilemap, 0, 0); - break; - } -} - -//PokedexPlus HGSS_Ui Stats Page -static const u8 sStatsPageNavigationTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY}; -static void StatsPage_PrintNavigationButtons(void) -{ - u8 x = 9; - u8 y = 0; - if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_STATS_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons); - else - AddTextPrinterParameterized3(WIN_STATS_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons_Decapped); - - PutWindowTilemap(WIN_STATS_NAVIGATION_BUTTONS); - CopyWindowToVram(WIN_STATS_NAVIGATION_BUTTONS, 3); -} -static void ResetStatsWindows(void) -{ - u8 i; - - FreeAllWindowBuffers(); - InitWindows(sStatsScreen_WindowTemplates); - - for (i = 0; i < WIN_STATS_END + 1; i++) - { - FillWindowPixelBuffer(i, PIXEL_FILL(0)); - PutWindowTilemap(i); - CopyWindowToVram(i, 3); - } -} -static void SaveMonDataInStruct(void) -{ - u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); - u8 EVs[6] = {gSpeciesInfo[species].evYield_HP, gSpeciesInfo[species].evYield_Speed, gSpeciesInfo[species].evYield_Attack, gSpeciesInfo[species].evYield_SpAttack, gSpeciesInfo[species].evYield_Defense, gSpeciesInfo[species].evYield_SpDefense}; - u8 differentEVs; - u8 i; - - //Count how many different EVs - for (i = 0; i<6; i++) - { - if (EVs[i] > 0) //HP//Speed//Attack//Special Attack//Defense//Special Defense - differentEVs++; - } - - sPokedexView->sPokemonStats.species = species; - sPokedexView->sPokemonStats.genderRatio = gSpeciesInfo[species].genderRatio; - sPokedexView->sPokemonStats.baseHP = gSpeciesInfo[species].baseHP; - sPokedexView->sPokemonStats.baseSpeed = gSpeciesInfo[species].baseSpeed; - sPokedexView->sPokemonStats.baseAttack = gSpeciesInfo[species].baseAttack; - sPokedexView->sPokemonStats.baseSpAttack = gSpeciesInfo[species].baseSpAttack; - sPokedexView->sPokemonStats.baseDefense = gSpeciesInfo[species].baseDefense; - sPokedexView->sPokemonStats.baseSpDefense = gSpeciesInfo[species].baseSpDefense; - sPokedexView->sPokemonStats.differentEVs = differentEVs; - sPokedexView->sPokemonStats.evYield_HP = EVs[0]; - sPokedexView->sPokemonStats.evYield_Speed = EVs[1]; - sPokedexView->sPokemonStats.evYield_Attack = EVs[2]; - sPokedexView->sPokemonStats.evYield_SpAttack = EVs[3]; - sPokedexView->sPokemonStats.evYield_Defense = EVs[4]; - sPokedexView->sPokemonStats.evYield_SpDefense = EVs[5]; - sPokedexView->sPokemonStats.catchRate = gSpeciesInfo[species].catchRate; - sPokedexView->sPokemonStats.growthRate = gSpeciesInfo[species].growthRate; - sPokedexView->sPokemonStats.eggGroup1 = gSpeciesInfo[species].eggGroups[0]; - sPokedexView->sPokemonStats.eggGroup2 = gSpeciesInfo[species].eggGroups[1]; - sPokedexView->sPokemonStats.eggCycles = gSpeciesInfo[species].eggCycles; - sPokedexView->sPokemonStats.expYield = gSpeciesInfo[species].expYield; - sPokedexView->sPokemonStats.friendship = gSpeciesInfo[species].friendship; - sPokedexView->sPokemonStats.ability0 = GetAbilityBySpecies(species, 0); - sPokedexView->sPokemonStats.ability1 = GetAbilityBySpecies(species, 1); - #ifdef POKEMON_EXPANSION - sPokedexView->sPokemonStats.abilityHidden = GetAbilityBySpecies(species, 2); - #endif -} -#define tMonSpriteId data[4] -static void Task_LoadStatsScreen(u8 taskId) -{ - switch (gMain.state) - { - case 0: - default: - if (!gPaletteFade.active) - { - u16 r2; - - sPokedexView->currentPage = STATS_SCREEN; - gPokedexVBlankCB = gMain.vblankCallback; - SetVBlankCallback(NULL); - r2 = 0; - if (gTasks[taskId].data[1] != 0) - r2 += DISPCNT_OBJ_ON; - if (gTasks[taskId].data[2] != 0) - r2 |= DISPCNT_BG1_ON; - ResetOtherVideoRegisters(r2); - gMain.state = 1; - } - break; - case 1: - LoadTilesetTilemapHGSS(STATS_SCREEN); - - ResetStatsWindows(); - - CopyBgTilemapBufferToVram(1); - CopyBgTilemapBufferToVram(2); - CopyBgTilemapBufferToVram(3); - gMain.state++; - break; - case 2: - LoadScreenSelectBarMain(0xD); - LoadPokedexBgPalette(sPokedexView->isSearchResults); - gMain.state++; - break; - case 3: - sPokedexView->typeIconSpriteIds[0] = 0xFF; - sPokedexView->typeIconSpriteIds[1] = 0xFF; - CreateTypeIconSprites(); - #ifdef BATTLE_ENGINE - sPokedexView->splitIconSpriteId = 0xFF; //Physical/Special Split from BE - LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); //Physical/Special Split from BE - LoadCompressedSpriteSheet(&sSpriteSheet_SplitIcons); //Physical/Special Split from BE - LoadSpritePalette(&sSpritePal_SplitIcons); //Physical/Special Split from BE - #endif - gMain.state++; - break; - case 4: - SaveMonDataInStruct(); - sPokedexView->moveSelected = 0; - sPokedexView->movesTotal = 0; - sPokedexView->numEggMoves = 0; - sPokedexView->numLevelUpMoves = 0; - sPokedexView->numTMHMMoves = 0; - if (CalculateMoves()) - gMain.state++; - break; - case 5: - if (gTasks[taskId].data[1] == 0) - { - //Icon - FreeMonIconPalettes(); //Free space for new pallete - LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon - #ifndef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0, TRUE); //Create pokemon sprite - #endif - #ifdef POKEMON_EXPANSION - gTasks[taskId].data[6] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite - #endif - gSprites[gTasks[taskId].data[4]].oam.priority = 0; - } - gMain.state++; - break; - case 6: - gTasks[taskId].data[5] = 0; - PrintStatsScreen_NameGender(taskId, sPokedexListItem->dexNum, sPokedexView->dexMode == DEX_MODE_HOENN ? FALSE : TRUE); - PrintStatsScreen_Left(taskId); - PrintStatsScreen_Abilities(taskId); - PrintStatsScreen_Moves_Top(taskId); - PrintStatsScreen_Moves_Description(taskId); - PrintStatsScreen_Moves_BottomText(taskId); - PrintStatsScreen_Moves_Bottom(taskId); - if (!sPokedexListItem->owned) - LoadPalette(gPlttBufferUnfaded + 1, 0x31, 0x1E); - StatsPage_PrintNavigationButtons(); //gText_Stats_Buttons - gMain.state++; - break; - case 7: - { - u32 preservedPalettes = 0; - - if (gTasks[taskId].data[2] != 0) - preservedPalettes = 0x14; // each bit represents a palette index - if (gTasks[taskId].data[1] != 0) - preservedPalettes |= (1 << (gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum + 16)); - BeginNormalPaletteFade(~preservedPalettes, 0, 16, 0, RGB_BLACK); - SetVBlankCallback(gPokedexVBlankCB); - gMain.state++; - } - break; - case 8: - SetGpuReg(REG_OFFSET_BLDCNT, 0); - SetGpuReg(REG_OFFSET_BLDALPHA, 0); - SetGpuReg(REG_OFFSET_BLDY, 0); - SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); - HideBg(0); - ShowBg(1); - ShowBg(2); - ShowBg(3); - gMain.state++; - break; - case 9: - if (!gPaletteFade.active) - gMain.state++; - break; - case 10: - gMain.state++; - break; - case 11: - gTasks[taskId].data[0] = 0; - gTasks[taskId].data[1] = 0; - gTasks[taskId].data[2] = 1; - gTasks[taskId].func = Task_HandleStatsScreenInput; - gMain.state = 0; - break; - } -} -static void FreeStatsScreenWindowAndBgBuffers(void) -{ - void *tilemapBuffer; - - FreeAllWindowBuffers(); - tilemapBuffer = GetBgTilemapBuffer(0); - if (tilemapBuffer) - Free(tilemapBuffer); - tilemapBuffer = GetBgTilemapBuffer(1); - if (tilemapBuffer) - Free(tilemapBuffer); - tilemapBuffer = GetBgTilemapBuffer(2); - if (tilemapBuffer) - Free(tilemapBuffer); - tilemapBuffer = GetBgTilemapBuffer(3); - if (tilemapBuffer) - Free(tilemapBuffer); -} -static void Task_HandleStatsScreenInput(u8 taskId) -{ - if (JOY_NEW(A_BUTTON)) - { - PlaySE(SE_DEX_PAGE); - if (gTasks[taskId].data[5] == 0) - gTasks[taskId].data[5] = 1; - else - gTasks[taskId].data[5] = 0; - - FillWindowPixelBuffer(WIN_STATS_LEFT, PIXEL_FILL(0)); - PrintStatsScreen_Left(taskId); - - FillWindowPixelBuffer(WIN_STATS_MOVES_DESCRIPTION, PIXEL_FILL(0)); - PrintStatsScreen_Moves_Description(taskId); - - FillWindowPixelBuffer(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0)); - PrintStatsScreen_Moves_BottomText(taskId); - PrintStatsScreen_Moves_Bottom(taskId); - - #ifdef POKEMON_EXPANSION - FillWindowPixelBuffer(WIN_STATS_ABILITIES, PIXEL_FILL(0)); - PrintStatsScreen_Abilities(taskId); - #endif - } - if (JOY_NEW(B_BUTTON)) - { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); - gTasks[taskId].func = Task_ExitStatsScreen; - PlaySE(SE_PC_OFF); - return; - } - - //Change moves - if (JOY_REPEAT(DPAD_UP) && sPokedexView->moveSelected > 0) - { - sPokedexView->moveSelected -= 1; - PlaySE(SE_SELECT); - FillWindowPixelBuffer(WIN_STATS_MOVES_TOP, PIXEL_FILL(0)); - PrintStatsScreen_DestroyMoveItemIcon(taskId); - PrintStatsScreen_Moves_Top(taskId); - - FillWindowPixelBuffer(WIN_STATS_MOVES_DESCRIPTION, PIXEL_FILL(0)); - PrintStatsScreen_Moves_Description(taskId); - - FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 50, 0, 20, 16); - FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 120, 0, 20, 16); - PrintStatsScreen_Moves_Bottom(taskId); - } - if (JOY_REPEAT(DPAD_DOWN) && sPokedexView->moveSelected < sPokedexView->movesTotal -1 ) - { - sPokedexView->moveSelected = sPokedexView->moveSelected + 1; - PlaySE(SE_SELECT); - FillWindowPixelBuffer(WIN_STATS_MOVES_TOP, PIXEL_FILL(0)); - PrintStatsScreen_DestroyMoveItemIcon(taskId); - PrintStatsScreen_Moves_Top(taskId); - - FillWindowPixelBuffer(WIN_STATS_MOVES_DESCRIPTION, PIXEL_FILL(0)); - PrintStatsScreen_Moves_Description(taskId); - - FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 50, 0, 20, 16); - FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 120, 0, 20, 16); - PrintStatsScreen_Moves_Bottom(taskId); - } - - //Switch screens - if ((JOY_NEW(DPAD_LEFT) || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) - { - sPokedexView->selectedScreen = INFO_SCREEN; - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 1; - gTasks[taskId].func = Task_SwitchScreensFromStatsScreen; - PlaySE(SE_PIN); - } - if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) - { - if (!sPokedexListItem->owned) - PlaySE(SE_FAILURE); - else - { - sPokedexView->selectedScreen = EVO_SCREEN; - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 3; - gTasks[taskId].func = Task_SwitchScreensFromStatsScreen; - PlaySE(SE_PIN); - } - } -} -#define ITEM_TAG 0xFDF3 -static void PrintStatsScreen_DestroyMoveItemIcon(u8 taskId) -{ - FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon - FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon - FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon - DestroySprite(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon -} -static bool8 CalculateMoves(void) -{ - u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); - - u16 statsMovesEgg[EGG_MOVES_ARRAY_COUNT] = {0}; - u16 statsMovesLevelUp[MAX_LEVEL_UP_MOVES] = {0}; - u16 statsMovesTMHM[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; - #ifndef BATTLE_ENGINE - u16 statsMovesTutor[TUTOR_MOVE_COUNT] = {0}; - #else - u16 move; - #endif - - u8 numEggMoves = 0; - u8 numLevelUpMoves = 0; - u8 numTMHMMoves = 0; - u8 numTutorMoves = 0; - u16 movesTotal = 0; - u8 i,j; - - #ifdef POKEMON_EXPANSION - // Mega pokemon don't have distinct learnsets from their base form; so use base species for calculation - if (species >= SPECIES_VENUSAUR_MEGA && species <= SPECIES_GROUDON_PRIMAL) - species = GetFormSpeciesId(species, 0); - #endif - - //Calculate amount of Egg and LevelUp moves - numEggMoves = GetEggMovesSpecies(species, statsMovesEgg); - numLevelUpMoves = GetLevelUpMovesBySpecies(species, statsMovesLevelUp); - - //Egg moves - for (i=0; i < numEggMoves; i++) - { - sStatsMoves[movesTotal] = statsMovesEgg[i]; - movesTotal++; - } - - //Level up moves - for (i=0; i < numLevelUpMoves; i++) - { - sStatsMoves[movesTotal] = statsMovesLevelUp[i]; - movesTotal++; - } - - #ifndef BATTLE_ENGINE - //TMHM moves - for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) - { - if (CanSpeciesLearnTMHM(species, j)) - { - sStatsMoves[movesTotal] = ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + j); - movesTotal++; - sStatsMovesTMHM_ID[numTMHMMoves] = (ITEM_TM01_FOCUS_PUNCH + j); - numTMHMMoves++; - } - } - - //Tutor moves - for (i=0; i < TUTOR_MOVE_COUNT; i++) - { - if (CanLearnTutorMove(species, i)) //if (sTutorLearnsets[species] & (1 << i)) - { - sStatsMoves[movesTotal] = gTutorMoves[i]; - numTutorMoves++; - movesTotal++; - } - } - #else - for (i = 0; gTeachableLearnsets[species][i] != MOVE_UNAVAILABLE; i++) - { - move = gTeachableLearnsets[species][i]; - for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) - { - if (GetTMHMMoves(j) == move) - { - sStatsMovesTMHM_ID[numTMHMMoves] = (ITEM_TM01_FOCUS_PUNCH + j); - numTMHMMoves++; - break; - } - } - if (j >= NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES) - numTutorMoves++; - - sStatsMoves[movesTotal] = move; - movesTotal++; - } - - #endif - - sPokedexView->numEggMoves = numEggMoves; - sPokedexView->numLevelUpMoves = numLevelUpMoves; - sPokedexView->numTMHMMoves = numTMHMMoves; - sPokedexView->numTutorMoves = numTutorMoves; - sPokedexView->movesTotal = movesTotal; - - return TRUE; -} -static void PrintStatsScreen_Moves_Top(u8 taskId) -{ - u8 numEggMoves = sPokedexView->numEggMoves; - u8 numLevelUpMoves = sPokedexView->numLevelUpMoves; - u8 numTMHMMoves = sPokedexView->numTMHMMoves; - u8 numTutorMoves = sPokedexView->numTutorMoves; - u8 movesTotal = sPokedexView->movesTotal; - u8 selected = sPokedexView->moveSelected; - u8 level; - u8 moves_x = 5; - u8 moves_y = 3; - u16 move; - u16 item; - - u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); - - //Move - move = sStatsMoves[selected]; - - //Moves selected from move max - ConvertIntToDecimalStringN(gStringVar1, (selected+1), STR_CONV_MODE_RIGHT_ALIGN, 3); - ConvertIntToDecimalStringN(gStringVar2, movesTotal, STR_CONV_MODE_RIGHT_ALIGN, 3); - StringExpandPlaceholders(gStringVar1, gText_Stats_MoveSelectedMax); - PrintStatsScreenTextSmallWhite(WIN_STATS_MOVES_TOP, gStringVar1, moves_x-1, moves_y+1); - - //Move name - StringCopy(gStringVar3, gMoveNames[move]); - StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 20); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gStringVar3, moves_x, moves_y + 17); - - //Draw move type icon - if (gTasks[taskId].data[5] == 0) - { - SetTypeIconPosAndPal(gBattleMoves[move].type, moves_x + 146, moves_y + 17, 0); - SetSpriteInvisibility(1, TRUE); - } - else - { - SetTypeIconPosAndPal(NUMBER_OF_MON_TYPES + gContestMoves[move].contestCategory, moves_x + 146, moves_y + 17, 1); - SetSpriteInvisibility(0, TRUE); - } - - //Calculate and retrieve correct move from the arrays - if (selected < numEggMoves) - { - PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gText_ThreeDashes, moves_x + 113, moves_y + 9); - item = ITEM_LUCKY_EGG; - } - else if (selected < (numEggMoves + numLevelUpMoves)) - { - #if defined (BATTLE_ENGINE) || defined (POKEMON_EXPANSION) - level = gLevelUpLearnsets[species][(selected-numEggMoves)].level; - #else - //Calculate level of the move - while (((gLevelUpLearnsets[species][(selected-numEggMoves)] & LEVEL_UP_MOVE_LV) != (level << 9)) && level < 0xFF) - { - level++; - if (gLevelUpLearnsets[species][(selected-numEggMoves)] == LEVEL_UP_END) - level = 0xFF; - } - #endif - ConvertIntToDecimalStringN(gStringVar1, level, STR_CONV_MODE_LEFT_ALIGN, 3); //Move learn lvl - PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gText_Stats_MoveLevel, moves_x + 113, moves_y + 3); //Level text - PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gStringVar1, moves_x + 113, moves_y + 14); //Print level - item = ITEM_EXP_SHARE; - } - else if (selected < (numEggMoves + numLevelUpMoves + numTMHMMoves)) - { - CopyItemName(sStatsMovesTMHM_ID[(selected-numEggMoves-numLevelUpMoves)], gStringVar1); //TM name - PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gStringVar1, moves_x + 113, moves_y + 9); - item = sStatsMovesTMHM_ID[(selected-numEggMoves-numLevelUpMoves)]; - } - else if (selected < (numEggMoves + numLevelUpMoves + numTMHMMoves + numTutorMoves)) - { - PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gText_ThreeDashes, moves_x + 113, moves_y + 9); - item = ITEM_TEACHY_TV; - } - else - { - StringCopy(gStringVar4, gText_CommunicationError); - item = ITEM_MASTER_BALL; - } - - //Egg/TM/Level/Tutor Item Icon - gTasks[taskId].data[3] = AddItemIconSprite(ITEM_TAG, ITEM_TAG, item); - gSprites[gTasks[taskId].data[3]].x2 = 203; - gSprites[gTasks[taskId].data[3]].y2 = 39; - gSprites[gTasks[taskId].data[3]].oam.priority = 0; - -} -static void PrintStatsScreen_Moves_Description(u8 taskId) -{ - u8 selected = sPokedexView->moveSelected; - u16 move; - u8 moves_x = 5; - u8 moves_y = 5; - - //Move - move = sStatsMoves[selected]; - - //Move description - if (gTasks[taskId].data[5] == 0) - { - StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_DESCRIPTION, gStringVar4, moves_x, moves_y); - } - else - { - StringCopy(gStringVar4, gContestEffectDescriptionPointers[gContestMoves[move].effect]); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_DESCRIPTION, gStringVar4, moves_x, moves_y); - } -} -static void PrintStatsScreen_Moves_BottomText(u8 taskId) -{ - u8 moves_x = 8; - u8 moves_y = 3; - if (gTasks[taskId].data[5] == 0) - { - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Power, moves_x, moves_y); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Accuracy2, moves_x + 66, moves_y); - } - else - { - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Appeal, moves_x, moves_y); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Jam, moves_x + 66, moves_y); - } -} -static void PrintStatsScreen_Moves_Bottom(u8 taskId) -{ - u8 moves_x = 8; - u8 moves_y = 3; - u8 selected = sPokedexView->moveSelected; - u16 move; - //Contest - u8 contest_effectValue; - u8 contest_appeal = 0; - u8 contest_jam = 0; - - //Move - move = sStatsMoves[selected]; - - //Power + Accuracy - if (gTasks[taskId].data[5] == 0) - { - //Power - if (gBattleMoves[move].power < 2) - StringCopy(gStringVar1, gText_ThreeDashes); - else - ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar1, moves_x + 45, moves_y); - //Physical/Special Split from BE - #ifdef BATTLE_ENGINE - DestroySplitIcon(); - ShowSplitIcon(GetBattleMoveSplit(move)); - #endif - //Accuracy - if (gBattleMoves[move].accuracy == 0) - StringCopy(gStringVar1, gText_ThreeDashes); - else - ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].accuracy, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar1, moves_x + 114, moves_y); - } - else //Appeal + Jam - { - #ifdef BATTLE_ENGINE - DestroySplitIcon(); - gSprites[sPokedexView->splitIconSpriteId].invisible = TRUE; - #endif - //Appeal - contest_effectValue = gContestEffects[gContestMoves[move].effect].appeal; - if (contest_effectValue != 0xFF) - contest_appeal = contest_effectValue / 10; - ConvertIntToDecimalStringN(gStringVar1, contest_appeal, STR_CONV_MODE_RIGHT_ALIGN, 1); - StringCopy(gStringVar2, gText_PlusSymbol); - StringAppend(gStringVar2, gStringVar1); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar2, moves_x + 45, moves_y); - - //Jam - contest_effectValue = gContestEffects[gContestMoves[move].effect].jam; - if (contest_effectValue != 0xFF) - contest_jam = contest_effectValue / 10; - ConvertIntToDecimalStringN(gStringVar1, contest_jam, STR_CONV_MODE_RIGHT_ALIGN, 1); - StringCopy(gStringVar2, gText_Stats_Minus); - StringAppend(gStringVar2, gStringVar1); - PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar2, moves_x + 119, moves_y); - } -} -static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value) -{ - u8 str[16]; - u8 str2[32]; - u8 strEV[25]; - u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); - u16 natNum; - u8 evVal; - const u8 *category; - const u8 *description; - const u8 *strEVtype; - - u8 base_x = 38; - u8 base_y = 0; - u8 gender_x, gender_y; - - //Name - PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gSpeciesNames[species], base_x, base_y); - - //Number - if (value == 0) - value = NationalToHoennOrder(num); - else - value = num; - ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); - PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, str, base_x, base_y + 10); - - //Gender ratio //MON_GENDERLESS == 0xFF - gender_x = base_x; - gender_y = base_y + 20; - switch (sPokedexView->sPokemonStats.genderRatio) - { - case 0: - PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_0, gender_x, gender_y); - break; - case 31: - PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_12_5, gender_x, gender_y); - break; - case 63: - PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_25, gender_x, gender_y); - break; - case 127: - PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_50, gender_x, gender_y); - break; - case 191: - PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_75, gender_x, gender_y); - break; - case 223: - PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_87_5, gender_x, gender_y); - break; - case 254: - PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_100, gender_x, gender_y); - break; - default: - PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_ThreeDashes, gender_x, gender_y); - break; - } -} -static u8 PrintMonStatsToggle_DifferentEVsColumn(u8 differentEVs) -{ - if (differentEVs == 1 || differentEVs == 3) - return 0; - else - return 1; -} -static u8 PrintMonStatsToggle_DifferentEVsRow(u8 differentEVs) -{ - if (differentEVs == 1 || differentEVs == 2) - return 0; - else - return 1; -} -static u8* PrintMonStatsToggle_EV_Arrows(u8 *dest, u8 value) -{ - switch (value) - { - case 1: - StringCopy(dest, gText_Stats_EV_Plus1); - break; - case 2: - StringCopy(dest, gText_Stats_EV_Plus2); - break; - case 3: - StringCopy(dest, gText_Stats_EV_Plus3); - break; - } - return dest; -} -static void PrintStatsScreen_Left(u8 taskId) -{ - u8 base_x = 8; - u8 x_offset_column = 43; - u8 x_offset_value = 26; - u8 column = 0; - u8 base_x_offset = 70; - u8 base_x_first_row = 23; - u8 base_x_second_row = 43; - u8 base_y_offset = 11; - u8 base_i = 0; - u8 base_y = 5; - u32 align_x; - u8 total_x = 93; - u8 strEV[25]; - u8 strBase[14]; - u8 EVs[6] = {sPokedexView->sPokemonStats.evYield_HP, sPokedexView->sPokemonStats.evYield_Speed, sPokedexView->sPokemonStats.evYield_Attack, sPokedexView->sPokemonStats.evYield_SpAttack, sPokedexView->sPokemonStats.evYield_Defense, sPokedexView->sPokemonStats.evYield_SpDefense}; - u8 differentEVs = 0; - u8 i; - - //Base stats - if (gTasks[taskId].data[5] == 0) - { - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_HP, base_x, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseHP, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); - - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Speed, base_x+base_x_second_row, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseSpeed, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); - - base_i++; - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Attack, base_x, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); - - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_SpAttack, base_x+base_x_second_row, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseSpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); - - base_i++; - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Defense, base_x, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); - - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_SpDefense, base_x+base_x_second_row, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseSpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); - base_i++; - } - else //EV increases - { - //If 1 or 2 EVs display with the same layout as the base stats - if (sPokedexView->sPokemonStats.differentEVs < 3) - { - differentEVs = 0; - //HP - if (EVs[0] > 0) - { - differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - StringCopy(gStringVar1, gText_Stats_HP); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[0]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - } - //Speed - if (EVs[1]> 0) - { - differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - StringCopy(gStringVar1, gText_Stats_Speed); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[1]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - } - //Attack - if (EVs[2] > 0) - { - differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - StringCopy(gStringVar1, gText_Stats_Attack); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[2]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - } - //Special Attack - if (EVs[3] > 0) - { - differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - StringCopy(gStringVar1, gText_Stats_SpAttack); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[3]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - } - //Defense - if (EVs[4] > 0) - { - differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - StringCopy(gStringVar1, gText_Stats_Defense); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[4]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - } - //Special Defense - if (EVs[5] > 0) - { - differentEVs++; - column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); - base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); - StringCopy(gStringVar1, gText_Stats_SpDefense); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[5]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); - } - } - else //3 different EVs in 1 row - { - column = 0; - //HP - if (EVs[0] > 0) - { - StringCopy(gStringVar1, gText_Stats_HP); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[0]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); - column++; - } - //Speed - if (EVs[1] > 0) - { - StringCopy(gStringVar1, gText_Stats_Speed); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[1]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); - column++; - } - //Attack - if (EVs[2] > 0) - { - StringCopy(gStringVar1, gText_Stats_Attack); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[2]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); - column++; - } - //Special Attack - if (EVs[3] > 0) - { - StringCopy(gStringVar1, gText_Stats_SpAttack); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[3]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); - column++; - } - //Defense - if (EVs[4] > 0) - { - StringCopy(gStringVar1, gText_Stats_Defense); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[4]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); - column++; - } - //Special Defense - if (EVs[5] > 0) - { - StringCopy(gStringVar1, gText_Stats_SpDefense); - PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[5]); - StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); - column++; - } - } - base_i++; - } - - //TOGGLE-------------------------------------- - if (gTasks[taskId].data[5] == 0) - { - u32 catchRate = sPokedexView->sPokemonStats.catchRate; - u32 growthRate = sPokedexView->sPokemonStats.growthRate; - - //Catch rate - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate, base_x, base_y + base_y_offset*base_i); - if (catchRate <= 10) - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Legend, base_x + x_offset_column, base_y + base_y_offset*base_i); - else if (catchRate <= 70) - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_VeryHard, base_x + x_offset_column, base_y + base_y_offset*base_i); - else if (catchRate <= 100) - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Difficult, base_x + x_offset_column, base_y + base_y_offset*base_i); - else if (catchRate <= 150) - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Medium, base_x + x_offset_column, base_y + base_y_offset*base_i); - else if (catchRate <= 200) - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Relaxed, base_x + x_offset_column, base_y + base_y_offset*base_i); - else - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Easy, base_x + x_offset_column, base_y + base_y_offset*base_i); - base_i++; - - //Growth rate - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Growthrate, base_x, base_y + base_y_offset*base_i); - switch (growthRate) - { - case GROWTH_MEDIUM_FAST: - StringCopy(strEV, gText_Stats_MEDIUM_FAST); - break; - case GROWTH_ERRATIC: - StringCopy(strEV, gText_Stats_ERRATIC); - break; - case GROWTH_FLUCTUATING: - StringCopy(strEV, gText_Stats_FLUCTUATING); - break; - case GROWTH_MEDIUM_SLOW: - StringCopy(strEV, gText_Stats_MEDIUM_SLOW); - break; - case GROWTH_FAST: - StringCopy(strEV, gText_Stats_FAST); - break; - case GROWTH_SLOW: - StringCopy(strEV, gText_Stats_SLOW); - break; - default: - break; - } - align_x = GetStringRightAlignXOffset(0, strEV, total_x); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, strEV, align_x, base_y + base_y_offset*base_i); - } - else - { - //Exp Yield - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_ExpYield, base_x, base_y + base_y_offset*base_i); - ConvertIntToDecimalStringN(gStringVar1, sPokedexView->sPokemonStats.expYield, STR_CONV_MODE_RIGHT_ALIGN, 3); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar1, base_x + base_x_offset, base_y + base_y_offset*base_i); - base_i++; - - //Friendship - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Friendship, base_x, base_y + base_y_offset*base_i); - switch (sPokedexView->sPokemonStats.friendship) - { - case 35: - StringCopy(strEV, gText_Stats_Friendship_BigAnger); - break; - case 70: - StringCopy(strEV, gText_Stats_Friendship_Neutral); - break; - case 90: - StringCopy(strEV, gText_Stats_Friendship_Happy); - break; - case 100: - StringCopy(strEV, gText_Stats_Friendship_Happy); - break; - case 140: - StringCopy(strEV, gText_Stats_Friendship_BigSmile); - break; - default: - ConvertIntToDecimalStringN(strEV, sPokedexView->sPokemonStats.friendship, STR_CONV_MODE_RIGHT_ALIGN, 3); - break; - } - align_x = GetStringRightAlignXOffset(0, strEV, total_x); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, strEV, align_x, base_y + base_y_offset*base_i); - base_i++; - - //Egg cycles - if (sPokedexView->sPokemonStats.eggGroup1 == EGG_GROUP_UNDISCOVERED || sPokedexView->sPokemonStats.eggGroup2 == EGG_GROUP_UNDISCOVERED) //Species without eggs (legendaries etc) - { - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_ThreeDashes, 78, base_y + base_y_offset*base_i); - } - else - { - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); - if (sPokedexView->sPokemonStats.eggCycles <= 10) - { - StringCopy(strEV, gText_Stats_EggCycles_VeryFast); - align_x = 76; - } - else if (sPokedexView->sPokemonStats.eggCycles <= 20) - { - StringCopy(strEV, gText_Stats_EggCycles_Fast); - align_x = 85; - } - else if (sPokedexView->sPokemonStats.eggCycles <= 30) - { - StringCopy(strEV, gText_Stats_EggCycles_Normal); - align_x = 76; - } - else - { - StringCopy(strEV, gText_Stats_EggCycles_Slow); - align_x = 67; - } - PrintStatsScreenTextSmall(WIN_STATS_LEFT, strEV, align_x, base_y + base_y_offset*base_i); - } - base_i++; - - //Egg group 1 - switch (sPokedexView->sPokemonStats.eggGroup1) - { - case EGG_GROUP_MONSTER : - StringCopy(gStringVar1, gText_Stats_eggGroup_MONSTER); - break; - case EGG_GROUP_WATER_1 : - StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_1); - break; - case EGG_GROUP_BUG : - StringCopy(gStringVar1, gText_Stats_eggGroup_BUG); - break; - case EGG_GROUP_FLYING : - StringCopy(gStringVar1, gText_Stats_eggGroup_FLYING); - break; - case EGG_GROUP_FIELD : - StringCopy(gStringVar1, gText_Stats_eggGroup_FIELD); - break; - case EGG_GROUP_FAIRY : - StringCopy(gStringVar1, gText_Stats_eggGroup_FAIRY); - break; - case EGG_GROUP_GRASS : - StringCopy(gStringVar1, gText_Stats_eggGroup_GRASS); - break; - case EGG_GROUP_HUMAN_LIKE : - StringCopy(gStringVar1, gText_Stats_eggGroup_HUMAN_LIKE); - break; - case EGG_GROUP_WATER_3 : - StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_3); - break; - case EGG_GROUP_MINERAL : - StringCopy(gStringVar1, gText_Stats_eggGroup_MINERAL); - break; - case EGG_GROUP_AMORPHOUS : - StringCopy(gStringVar1, gText_Stats_eggGroup_AMORPHOUS); - break; - case EGG_GROUP_WATER_2 : - StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_2); - break; - case EGG_GROUP_DITTO : - StringCopy(gStringVar1, gText_Stats_eggGroup_DITTO); - break; - case EGG_GROUP_DRAGON : - StringCopy(gStringVar1, gText_Stats_eggGroup_DRAGON); - break; - case EGG_GROUP_UNDISCOVERED: - StringCopy(gStringVar1, gText_Stats_eggGroup_UNDISCOVERED); - break; - } - //Egg group 2 - if (sPokedexView->sPokemonStats.eggGroup1 != sPokedexView->sPokemonStats.eggGroup2) - { - switch (sPokedexView->sPokemonStats.eggGroup2) - { - case EGG_GROUP_MONSTER : - StringCopy(gStringVar2, gText_Stats_eggGroup_MONSTER); - break; - case EGG_GROUP_WATER_1 : - StringCopy(gStringVar2, gText_Stats_eggGroup_WATER_1); - break; - case EGG_GROUP_BUG : - StringCopy(gStringVar2, gText_Stats_eggGroup_BUG); - break; - case EGG_GROUP_FLYING : - StringCopy(gStringVar2, gText_Stats_eggGroup_FLYING); - break; - case EGG_GROUP_FIELD : - StringCopy(gStringVar2, gText_Stats_eggGroup_FIELD); - break; - case EGG_GROUP_FAIRY : - StringCopy(gStringVar2, gText_Stats_eggGroup_FAIRY); - break; - case EGG_GROUP_GRASS : - StringCopy(gStringVar2, gText_Stats_eggGroup_GRASS); - break; - case EGG_GROUP_HUMAN_LIKE : - StringCopy(gStringVar2, gText_Stats_eggGroup_HUMAN_LIKE); - break; - case EGG_GROUP_WATER_3 : - StringCopy(gStringVar2, gText_Stats_eggGroup_WATER_3); - break; - case EGG_GROUP_MINERAL : - StringCopy(gStringVar2, gText_Stats_eggGroup_MINERAL); - break; - case EGG_GROUP_AMORPHOUS : - StringCopy(gStringVar2, gText_Stats_eggGroup_AMORPHOUS); - break; - case EGG_GROUP_WATER_2 : - StringCopy(gStringVar2, gText_Stats_eggGroup_WATER_2); - break; - case EGG_GROUP_DITTO : - StringCopy(gStringVar2, gText_Stats_eggGroup_DITTO); - break; - case EGG_GROUP_DRAGON : - StringCopy(gStringVar2, gText_Stats_eggGroup_DRAGON); - break; - case EGG_GROUP_UNDISCOVERED: - StringCopy(gStringVar2, gText_Stats_eggGroup_UNDISCOVERED); - break; - } - StringExpandPlaceholders(gStringVar3, gText_Stats_eggGroup_Groups); - align_x = GetStringRightAlignXOffset(0, gStringVar3, total_x); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x, base_y + base_y_offset*base_i); - } - else - { - align_x = GetStringRightAlignXOffset(0, gStringVar1, total_x); - PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar1, base_x, base_y + base_y_offset*base_i); - } - base_i++; - } -} -static void PrintStatsScreen_Abilities(u8 taskId) -{ - u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); - u8 abilities_x = 5; - u8 abilities_y = 3; - u16 ability0; - u16 ability1; - u16 abilityHidden; - - //Abilitie(s) - #ifdef POKEMON_EXPANSION - if (gTasks[taskId].data[5] == 0) - { - #endif - ability0 = sPokedexView->sPokemonStats.ability0; - PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability0], abilities_x, abilities_y); - PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); - - ability1 = sPokedexView->sPokemonStats.ability1; - if (ability1 != ABILITY_NONE && ability1 != ability0) - { - PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability1], abilities_x, abilities_y + 30); - PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[ability1], abilities_x, abilities_y + 44); - } - #ifdef POKEMON_EXPANSION - } - else //Hidden abilities - { - abilityHidden = sPokedexView->sPokemonStats.abilityHidden; - PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[abilityHidden], abilities_x, abilities_y); - PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[abilityHidden], abilities_x, abilities_y + 14); - } - #endif -} - -static void Task_SwitchScreensFromStatsScreen(u8 taskId) -{ - if (!gPaletteFade.active) - { - FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon - FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon - FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon - DestroySprite(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon - FreeMonIconPalettes(); //Destroy pokemon icon sprite - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite - - FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); - switch (sPokedexView->screenSwitchState) - { - case 1: - FreeAllWindowBuffers(); - InitWindows(sInfoScreen_WindowTemplates); - gTasks[taskId].func = Task_LoadAreaScreen; - break; - case 2: - gTasks[taskId].func = Task_LoadCryScreen; - break; - case 3: - FreeAllWindowBuffers(); - InitWindows(sInfoScreen_WindowTemplates); - gTasks[taskId].func = Task_LoadEvolutionScreen; - break; - default: - gTasks[taskId].func = Task_LoadInfoScreen; - break; - } - } -} -static void Task_ExitStatsScreen(u8 taskId) -{ - if (!gPaletteFade.active) - { - FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon - FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon - FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon - DestroySprite(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon - FreeMonIconPalettes(); //Destroy pokemon icon sprite - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite - - FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); - FreeInfoScreenWindowAndBgBuffers(); - DestroyTask(taskId); - } -} - -//Physical/Special Split from BE -#ifdef BATTLE_ENGINE -static u8 ShowSplitIcon(u32 split) -{ - if (sPokedexView->splitIconSpriteId == 0xFF) - sPokedexView->splitIconSpriteId = CreateSprite(&sSpriteTemplate_SplitIcons, 139, 90, 0); - - gSprites[sPokedexView->splitIconSpriteId].invisible = FALSE; - StartSpriteAnim(&gSprites[sPokedexView->splitIconSpriteId], split); - return sPokedexView->splitIconSpriteId; -} -static void DestroySplitIcon(void) -{ - if (sPokedexView->splitIconSpriteId != 0xFF) - DestroySprite(&gSprites[sPokedexView->splitIconSpriteId]); - sPokedexView->splitIconSpriteId = 0xFF; -} -#endif - -//PokedexPlus HGSS_Ui Evolution Page -static const u8 sEvoFormsPageNavigationTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY}; -static void EvoFormsPage_PrintNavigationButtons(void) -{ - u8 x = 6; - u8 y = 0; - - FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); - - #ifdef POKEMON_EXPANSION - if (sPokedexView->selectedScreen == EVO_SCREEN) - { - if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_PE); - else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped_PE); - } - else if (sPokedexView->selectedScreen == FORMS_SCREEN) - { - if (sPokedexView->sFormScreenData.inSubmenu) - { - if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Submenu_PE); - else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Submenu_Decapped_PE); - } - else - { - if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_PE); - else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Decapped_PE); - } - } - #else - if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons); - else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped); - #endif - // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) - PutWindowTilemap(WIN_NAVIGATION_BUTTONS); - CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); -} -static void ResetEvoScreenDataStruct(void) -{ - u8 i; - sPokedexView->sEvoScreenData.numAllEvolutions = 0; - sPokedexView->sEvoScreenData.numSeen = 0; - sPokedexView->sEvoScreenData.menuPos = 0; - for (i = 0; i < 10; i++) - { - sPokedexView->sEvoScreenData.targetSpecies[i] = 0; - sPokedexView->sEvoScreenData.seen[i] = 0; - } - -} -static void GetSeenFlagTargetSpecies(void) -{ - u8 i; - u16 species; - for (i = 0; i < sPokedexView->sEvoScreenData.numAllEvolutions; i++) - { - species = sPokedexView->sEvoScreenData.targetSpecies[i]; - if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN)) - { - sPokedexView->sEvoScreenData.seen[i] = TRUE; - sPokedexView->sEvoScreenData.numSeen += 1; - } - - } -} -static void Task_LoadEvolutionScreen(u8 taskId) -{ - switch (gMain.state) - { - case 0: - default: - if (!gPaletteFade.active) - { - u16 r2; - - sPokedexView->currentPage = EVO_SCREEN; - gPokedexVBlankCB = gMain.vblankCallback; - SetVBlankCallback(NULL); - r2 = 0; - if (gTasks[taskId].data[1] != 0) - r2 += DISPCNT_OBJ_ON; - if (gTasks[taskId].data[2] != 0) - r2 |= DISPCNT_BG1_ON; - ResetOtherVideoRegisters(r2); - gMain.state = 1; - } - break; - case 1: - LoadTilesetTilemapHGSS(EVO_SCREEN); - FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); - PutWindowTilemap(WIN_INFO); - CopyWindowToVram(WIN_INFO, 3); - FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); - PutWindowTilemap(WIN_NAVIGATION_BUTTONS); - CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); - CopyBgTilemapBufferToVram(1); - CopyBgTilemapBufferToVram(2); - CopyBgTilemapBufferToVram(3); - gMain.state++; - break; - case 2: - LoadScreenSelectBarMain(0xD); - LoadPokedexBgPalette(sPokedexView->isSearchResults); - gMain.state++; - break; - case 3: - if (gTasks[taskId].data[1] == 0) - { - sPokedexView->selectedScreen = EVO_SCREEN; - ResetEvoScreenDataStruct(); - //Icon - FreeMonIconPalettes(); //Free space for new pallete - LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon - PrintPreEvolutions(taskId, NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); - #ifdef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0); //Create pokemon sprite - #else - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0, TRUE); //Create pokemon sprite - #endif - EvoFormsPage_PrintNavigationButtons(); //HGSS_Ui Navigation buttons - gSprites[gTasks[taskId].data[4]].oam.priority = 0; - } - gMain.state++; - break; - case 4: - //Print evo info and icons - gTasks[taskId].data[3] = 0; - PrintEvolutionTargetSpeciesAndMethod(taskId, NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), 0, sPokedexView->numPreEvolutions); - LoadSpritePalette(&sSpritePalette_Arrow); - GetSeenFlagTargetSpecies(); - if (sPokedexView->sEvoScreenData.numAllEvolutions != 0 && sPokedexView->sEvoScreenData.numSeen != 0) - { - sPokedexView->sEvoScreenData.arrowSpriteId = CreateSprite(&sSpriteTemplate_Arrow, 7, 58, 0); - gSprites[sPokedexView->sEvoScreenData.arrowSpriteId].animNum = 2; - } - gMain.state++; - break; - case 5: - { - u32 preservedPalettes = 0; - - if (gTasks[taskId].data[2] != 0) - preservedPalettes = 0x14; // each bit represents a palette index - if (gTasks[taskId].data[1] != 0) - preservedPalettes |= (1 << (gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum + 16)); - BeginNormalPaletteFade(~preservedPalettes, 0, 16, 0, RGB_BLACK); - SetVBlankCallback(gPokedexVBlankCB); - gMain.state++; - } - break; - case 6: - SetGpuReg(REG_OFFSET_BLDCNT, 0); - SetGpuReg(REG_OFFSET_BLDALPHA, 0); - SetGpuReg(REG_OFFSET_BLDY, 0); - SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); - HideBg(0); - ShowBg(1); - ShowBg(2); - ShowBg(3); - gMain.state++; - break; - case 7: - if (!gPaletteFade.active) - gMain.state++; - break; - case 8: - gMain.state++; - break; - case 9: - sPokedexView->screenSwitchState = 0; - gTasks[taskId].data[0] = 0; - gTasks[taskId].data[1] = 0; - gTasks[taskId].data[2] = 1; - gTasks[taskId].func = Task_HandleEvolutionScreenInput; - gMain.state = 0; - break; - } -} -static void Task_HandleEvolutionScreenInput(u8 taskId) -{ - //Switch to forms screen, Pokemon Expansion only (rhh) - #ifdef POKEMON_EXPANSION - if (JOY_NEW(START_BUTTON)) - { - sPokedexView->selectedScreen = FORMS_SCREEN; - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 3; - gTasks[taskId].func = Task_SwitchScreensFromEvolutionScreen; - PlaySE(SE_PIN); - } - #endif - - if (sPokedexView->sEvoScreenData.numAllEvolutions != 0 && sPokedexView->sEvoScreenData.numSeen != 0) - { - u8 i; - u8 base_y = 58; - u8 base_y_offset = 9; - u8 pos = sPokedexView->sEvoScreenData.menuPos; - u8 max = sPokedexView->sEvoScreenData.numAllEvolutions; - if (JOY_NEW(DPAD_DOWN)) - { - while (TRUE) - { - pos += 1; - if (pos >= max) - pos = 0; - - if (sPokedexView->sEvoScreenData.seen[pos] == TRUE) - break; - } - gSprites[sPokedexView->sEvoScreenData.arrowSpriteId].y = base_y + base_y_offset * pos; - sPokedexView->sEvoScreenData.menuPos = pos; - } - else if (JOY_NEW(DPAD_UP)) - { - if (sPokedexView->sEvoScreenData.menuPos == 0) - sPokedexView->sEvoScreenData.menuPos = sPokedexView->sEvoScreenData.numAllEvolutions - 1; - else - sPokedexView->sEvoScreenData.menuPos -= 1; - - gSprites[sPokedexView->sEvoScreenData.arrowSpriteId].y = base_y + base_y_offset * sPokedexView->sEvoScreenData.menuPos; - } - - if (JOY_NEW(A_BUTTON)) - { - u16 targetSpecies = sPokedexView->sEvoScreenData.targetSpecies[sPokedexView->sEvoScreenData.menuPos]; - u16 dexNum = SpeciesToNationalPokedexNum(targetSpecies); - sPokedexListItem->dexNum = dexNum; - sPokedexListItem->seen = GetSetPokedexFlag(dexNum, FLAG_GET_SEEN); - sPokedexListItem->owned = GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT); - - #ifdef POKEMON_EXPANSION - if (gFormSpeciesIdTables[targetSpecies] != NULL) - sPokedexView->formSpecies = targetSpecies; - else - sPokedexView->formSpecies = 0; - #endif - - sPokedexView->sEvoScreenData.fromEvoPage = TRUE; - PlaySE(SE_PIN); - BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); - gTasks[taskId].func = Task_LoadInfoScreenWaitForFade; - } - } - - //Exit to overview - if (JOY_NEW(B_BUTTON)) - { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); - gTasks[taskId].func = Task_ExitEvolutionScreen; - PlaySE(SE_PC_OFF); - return; - } - - //Switch screens - if ((JOY_NEW(DPAD_LEFT) || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) - { - sPokedexView->selectedScreen = STATS_SCREEN; - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 1; - gTasks[taskId].func = Task_SwitchScreensFromEvolutionScreen; - PlaySE(SE_PIN); - } - if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) - { - if (!sPokedexListItem->owned) - PlaySE(SE_FAILURE); - else - { - sPokedexView->selectedScreen = CRY_SCREEN; - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 2; - gTasks[taskId].func = Task_SwitchScreensFromEvolutionScreen; - PlaySE(SE_PIN); - } - } -} -static void HandleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u16 previousTargetSpecies, u8 base_x, u8 base_y, u8 base_y_offset, u8 base_i, bool8 isEevee) -{ - u8 iterations = 6; - bool8 seen = GetSetPokedexFlag(SpeciesToNationalPokedexNum(targetSpecies), FLAG_GET_SEEN); - - if (seen || !HGSS_HIDE_UNSEEN_EVOLUTION_NAMES) - StringCopy(gStringVar3, gSpeciesNames[targetSpecies]); //evolution mon name - else - StringCopy(gStringVar3, gText_ThreeQuestionMarks); //show questionmarks instead of name - StringExpandPlaceholders(gStringVar3, gText_EVO_Name); //evolution mon name - PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); //evolution mon name - - //Print mon icon in the top row - if (isEevee) - { - iterations = 9; - if (targetSpecies == previousTargetSpecies) - return; - #ifdef POKEMON_EXPANSION - else if (targetSpecies == SPECIES_GLACEON) - base_i -= 1; - else if (targetSpecies == SPECIES_SYLVEON) - base_i -= 2; - #endif - } - - if (base_i < iterations) - { - LoadMonIconPalette(targetSpecies); //Loads pallete for current mon - #ifndef POKEMON_EXPANSION - gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 50 + 32*base_i, 31, 4, 0, TRUE); //Create pokemon sprite - #endif - #ifdef POKEMON_EXPANSION - if (isEevee) - gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 45 + 26*base_i, 31, 4, 0); //Create pokemon sprite - else - gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 50 + 32*base_i, 31, 4, 0); //Create pokemon sprite - #endif - gSprites[gTasks[taskId].data[4+base_i]].oam.priority = 0; - } -} -static void CreateCaughtBallEvolutionScreen(u16 targetSpecies, u8 x, u8 y, u16 unused) -{ - bool8 owned = GetSetPokedexFlag(SpeciesToNationalPokedexNum(targetSpecies), FLAG_GET_CAUGHT); - if (owned) - BlitBitmapToWindow(0, sCaughtBall_Gfx, x, y-1, 8, 16); - else - { - //FillWindowPixelRect(0, PIXEL_FILL(0), x, y, 8, 16); //not sure why this was even here - PrintInfoScreenTextSmall(gText_OneDash, x+1, y-1); - } -} -static void HandlePreEvolutionSpeciesPrint(u8 taskId, u16 preSpecies, u16 species, u8 base_x, u8 base_y, u8 base_y_offset, u8 base_i) -{ - bool8 seen = GetSetPokedexFlag(SpeciesToNationalPokedexNum(preSpecies), FLAG_GET_SEEN); - - StringCopy(gStringVar1, gSpeciesNames[species]); //evolution mon name - - #ifdef POKEMON_EXPANSION - if (sPokedexView->sEvoScreenData.isMega) - StringExpandPlaceholders(gStringVar3, gText_EVO_PreEvo_PE_Mega); - else - { - #endif - - if (seen || !HGSS_HIDE_UNSEEN_EVOLUTION_NAMES) - StringCopy(gStringVar2, gSpeciesNames[preSpecies]); //evolution mon name - else - StringCopy(gStringVar2, gText_ThreeQuestionMarks); //show questionmarks instead of name - - StringExpandPlaceholders(gStringVar3, gText_EVO_PreEvo); //evolution mon name - - #ifdef POKEMON_EXPANSION - } - #endif - - PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); //evolution mon name - - if (base_i < 3) - { - LoadMonIconPalette(preSpecies); //Loads pallete for current mon - #ifndef POKEMON_EXPANSION - gTasks[taskId].data[4+base_i] = CreateMonIcon(preSpecies, SpriteCB_MonIcon, 18 + 32*base_i, 31, 4, 0, TRUE); //Create pokemon sprite - #endif - #ifdef POKEMON_EXPANSION - gTasks[taskId].data[4+base_i] = CreateMonIcon(preSpecies, SpriteCB_MonIcon, 18 + 32*base_i, 31, 4, 0); //Create pokemon sprite - #endif - gSprites[gTasks[taskId].data[4+base_i]].oam.priority = 0; - } -} - -static u8 PrintPreEvolutions(u8 taskId, u16 species) -{ - u16 i; - u16 j; - - u8 base_x = 13+8; - u8 base_y = 51; - u8 base_y_offset = 9; - u8 base_i = 0; - u8 depth_x = 16; - - u16 preEvolutionOne = 0; - u16 preEvolutionTwo = 0; - u8 numPreEvolutions = 0; - - #ifdef POKEMON_EXPANSION - bool8 isMega = FALSE; - sPokedexView->sEvoScreenData.isMega = FALSE; - #endif - - #ifdef TX_RANDOMIZER_AND_CHALLENGES - if (gSaveBlock1Ptr->tx_Random_Evolutions || gSaveBlock1Ptr->tx_Random_EvolutionMethods) - return 0; - #endif - - - //Calculate previous evolution - for (i = 0; i < NUM_SPECIES; i++) - { - for (j = 0; j < EVOS_PER_MON; j++) - { - if (gEvolutionTable[i][j].targetSpecies == species) - { - preEvolutionOne = i; - numPreEvolutions += 1; - #ifdef POKEMON_EXPANSION - if (gEvolutionTable[i][j].method == EVO_MEGA_EVOLUTION) - { - CopyItemName(gEvolutionTable[i][j].param, gStringVar2); //item - isMega = TRUE; - } - #endif - break; - } - } - } - - #ifdef POKEMON_EXPANSION - if (isMega) - { - sPokedexView->numPreEvolutions = numPreEvolutions; - sPokedexView->sEvoScreenData.numAllEvolutions += numPreEvolutions; - sPokedexView->sEvoScreenData.isMega = isMega; - - CreateCaughtBallEvolutionScreen(preEvolutionOne, base_x - 9 - 8, base_y + base_y_offset*(numPreEvolutions - 1), 0); - HandlePreEvolutionSpeciesPrint(taskId, preEvolutionOne, species, base_x - 8, base_y, base_y_offset, numPreEvolutions - 1); - return numPreEvolutions; - } - #endif - - //Calculate if previous evolution also has a previous evolution - if (numPreEvolutions != 0) - { - for (i = 0; i < NUM_SPECIES; i++) - { - for (j = 0; j < EVOS_PER_MON; j++) - { - if (gEvolutionTable[i][j].targetSpecies == preEvolutionOne) - { - preEvolutionTwo = i; - numPreEvolutions += 1; - CreateCaughtBallEvolutionScreen(preEvolutionTwo, base_x - 9, base_y + base_y_offset*0, 0); - HandlePreEvolutionSpeciesPrint(taskId, preEvolutionTwo, preEvolutionOne, base_x, base_y, base_y_offset, 0); - break; - } - } - } - } - - //Print ball and name - if (preEvolutionOne != 0) - { - CreateCaughtBallEvolutionScreen(preEvolutionOne, base_x - 9, base_y + base_y_offset*(numPreEvolutions - 1), 0); - HandlePreEvolutionSpeciesPrint(taskId, preEvolutionOne, species, base_x, base_y, base_y_offset, numPreEvolutions - 1); - } - - if (preEvolutionTwo != 0) - { - sPokedexView->sEvoScreenData.targetSpecies[0] = preEvolutionTwo; - sPokedexView->sEvoScreenData.targetSpecies[1] = preEvolutionOne; - } - else if (preEvolutionOne != 0) - { - sPokedexView->sEvoScreenData.targetSpecies[0] = preEvolutionOne; - } - - //vertical line - //FillWindowPixelRect(0, PIXEL_FILL(5), 33 + 32*numPreEvolutions, 18, 1, 32); //PIXEL_FILL(15) for black - - sPokedexView->numPreEvolutions = numPreEvolutions; - sPokedexView->sEvoScreenData.numAllEvolutions += numPreEvolutions; - - return numPreEvolutions; -} -#define EVO_SCREEN_LVL_DIGITS 2 -static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_i) -{ - u16 i; - #ifdef POKEMON_EXPANSION - u16 j; - const struct MapHeader *mapHeader; - #endif - u16 targetSpecies = 0; - u16 previousTargetSpecies = 0; - - u16 item; - - bool8 left = TRUE; - u8 base_x = 13+8; - u8 base_x_offset = 54+8; - u8 base_y = 51; - u8 base_y_offset = 9; - u8 base_i = 0; - u8 times = 0; - u8 depth_x = 16; - bool8 isEevee = FALSE; - - #ifdef POKEMON_EXPANSION - if (sPokedexView->sEvoScreenData.isMega) - return 0; - #endif - - StringCopy(gStringVar1, gSpeciesNames[species]); - - if (species == SPECIES_EEVEE) - isEevee = TRUE; - - #ifdef TX_RANDOMIZER_AND_CHALLENGES - if (EvolutionBlockedByEvoLimit(species)) //No Evos already previously checked - species = SPECIES_NONE; - else if (gSaveBlock1Ptr->tx_Random_EvolutionMethods) - species = GetSpeciesRandomSeeded(species, TX_RANDOM_T_EVO_METH, 0); - #endif - - //Calculate number of possible direct evolutions (e.g. Eevee has 5 but torchic has 1) - for (i = 0; i < EVOS_PER_MON; i++) - { - #ifndef POKEMON_EXPANSION - if (gEvolutionTable[species][i].method != 0) - times += 1; - #endif - #ifdef POKEMON_EXPANSION - if (gEvolutionTable[species][i].method != 0 && gEvolutionTable[species][i].method != EVO_MEGA_EVOLUTION) - times += 1; - #endif - } - gTasks[taskId].data[3] = times; - sPokedexView->sEvoScreenData.numAllEvolutions += times; - - //If there are no evolutions print text - if (times == 0 && depth == 0) - { - StringExpandPlaceholders(gStringVar4, gText_EVO_NONE); - PrintInfoScreenTextSmall(gStringVar4, base_x-7-7, base_y + base_y_offset*depth_i); - } - - //If there are evolutions find out which and print them 1 by 1 - for (i = 0; i < times; i++) - { - base_i = i + depth_i; - left = !left; - - previousTargetSpecies = targetSpecies; - targetSpecies = gEvolutionTable[species][i].targetSpecies; - sPokedexView->sEvoScreenData.targetSpecies[base_i] = targetSpecies; - #ifdef TX_DIFFICULTY_CHALLENGES_USED - if (gSaveBlock1Ptr->txRandEvolutions && targetSpecies != SPECIES_NONE) //tx_difficulty_challenges - targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_T_EVO, 0); - #endif - CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); - HandleTargetSpeciesPrint(taskId, targetSpecies, previousTargetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i, isEevee); //evolution mon name - - switch (gEvolutionTable[species][i].method) - { - case EVO_FRIENDSHIP: - ConvertIntToDecimalStringN(gStringVar2, 220, STR_CONV_MODE_LEADING_ZEROS, 3); //friendship value - StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP ); - break; - case EVO_FRIENDSHIP_DAY: - StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_DAY ); - break; - case EVO_FRIENDSHIP_NIGHT: - StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_NIGHT ); - break; - case EVO_LEVEL: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL ); - break; - case EVO_TRADE: - StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE ); - break; - case EVO_TRADE_ITEM: - item = gEvolutionTable[species][i].param; //item - CopyItemName(item, gStringVar2); //item - StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_ITEM ); - break; - case EVO_ITEM: - item = gEvolutionTable[species][i].param; - CopyItemName(item, gStringVar2); - StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM ); - break; - case EVO_LEVEL_ATK_GT_DEF: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_GT_DEF ); - break; - case EVO_LEVEL_ATK_EQ_DEF: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_EQ_DEF ); - break; - case EVO_LEVEL_ATK_LT_DEF: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_LT_DEF ); - break; - case EVO_LEVEL_SILCOON: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SILCOON ); - break; - case EVO_LEVEL_CASCOON: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_CASCOON ); - break; - case EVO_LEVEL_NINJASK: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NINJASK ); - break; - case EVO_LEVEL_SHEDINJA: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SHEDINJA ); - break; - case EVO_BEAUTY: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, 3); //beauty - StringExpandPlaceholders(gStringVar4, gText_EVO_BEAUTY ); - break; - #ifdef POKEMON_EXPANSION - case EVO_LEVEL_FEMALE: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_FEMALE ); - break; - case EVO_LEVEL_MALE: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_MALE ); - break; - case EVO_LEVEL_NIGHT: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NIGHT ); - break; - case EVO_LEVEL_DAY: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DAY ); - break; - case EVO_LEVEL_DUSK: - ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DUSK ); - break; - case EVO_ITEM_HOLD_DAY: - item = gEvolutionTable[species][i].param; //item - CopyItemName(item, gStringVar2); //item - StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_DAY ); - break; - case EVO_ITEM_HOLD_NIGHT: - item = gEvolutionTable[species][i].param; //item - CopyItemName(item, gStringVar2); //item - StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_NIGHT ); - break; - case EVO_MOVE: - StringCopy(gStringVar2, gMoveNames[gEvolutionTable[species][i].param]); - StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE ); - break; - case EVO_MOVE_TYPE: - StringCopy(gStringVar2, gTypeNames[gEvolutionTable[species][i].param]); - StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE_TYPE ); - break; - case EVO_MAPSEC: - StringCopy(gStringVar2, gRegionMapEntries[gEvolutionTable[species][i].param].name); - StringExpandPlaceholders(gStringVar4, gText_EVO_MAPSEC ); - break; - case EVO_ITEM_MALE: - item = gEvolutionTable[species][i].param; //item - CopyItemName(item, gStringVar2); //item - StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_MALE ); - break; - case EVO_ITEM_FEMALE: - item = gEvolutionTable[species][i].param; //item - CopyItemName(item, gStringVar2); //item - StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_FEMALE ); - break; - case EVO_LEVEL_RAIN: - //if (j == WEATHER_RAIN || j == WEATHER_RAIN_THUNDERSTORM || j == WEATHER_DOWNPOUR) - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_RAIN ); - break; - case EVO_SPECIFIC_MON_IN_PARTY: - StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name - StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MON_IN_PARTY ); - break; - case EVO_LEVEL_DARK_TYPE_MON_IN_PARTY: - StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY ); - break; - case EVO_TRADE_SPECIFIC_MON: - StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name - StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_SPECIFIC_MON ); - break; - case EVO_SPECIFIC_MAP: - mapHeader = Overworld_GetMapHeaderByGroupAndId(gEvolutionTable[species][i].param >> 8, gEvolutionTable[species][i].param & 0xFF); - GetMapName(gStringVar2, mapHeader->regionMapSectionId, 0); - StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MAP ); - break; - #endif - default: - StringExpandPlaceholders(gStringVar4, gText_EVO_UNKNOWN ); - break; - }//Switch end - PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); //Print actual instructions - - depth_i += PrintEvolutionTargetSpeciesAndMethod(taskId, targetSpecies, depth+1, base_i+1); - }//For loop end - - return times; -} -static void Task_SwitchScreensFromEvolutionScreen(u8 taskId) -{ - u8 i; - if (!gPaletteFade.active) - { - FreeMonIconPalettes(); //Destroy pokemon icon sprite - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite - for (i = 1; i <= gTasks[taskId].data[3]; i++) - { - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite - } - FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); - - switch (sPokedexView->screenSwitchState) - { - case 1: - gTasks[taskId].func = Task_LoadStatsScreen; - break; - case 2: - gTasks[taskId].func = Task_LoadCryScreen; - break; - #ifdef POKEMON_EXPANSION - case 3: - gTasks[taskId].func = Task_LoadFormsScreen; - break; - #endif - default: - gTasks[taskId].func = Task_LoadInfoScreen; - break; - } - } -} -static void Task_ExitEvolutionScreen(u8 taskId) -{ - u8 i; - if (!gPaletteFade.active) - { - FreeMonIconPalettes(); //Destroy pokemon icon sprite - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite - for (i = 1; i <= gTasks[taskId].data[3]; i++) - { - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite - } - FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); - - FreeInfoScreenWindowAndBgBuffers(); - DestroyTask(taskId); - } -} - -//Stat bars on main screen, code by DizzyEgg, idea by Jaizu -#define PIXEL_COORDS_TO_OFFSET(x, y)( \ -/*Add tiles by X*/ \ -((y / 8) * 32 * 8) \ -/*Add tiles by X*/ \ -+ ((x / 8) * 32) \ -/*Add pixels by Y*/ \ -+ ((((y) - ((y / 8) * 8))) * 4) \ -/*Add pixels by X*/ \ -+ ((((x) - ((x / 8) * 8)) / 2))) - -static inline void WritePixel(u8 *dst, u32 x, u32 y, u32 value) -{ - if (x & 1) - { - dst[PIXEL_COORDS_TO_OFFSET(x, y)] &= ~0xF0; - dst[PIXEL_COORDS_TO_OFFSET(x, y)] |= (value << 4); - } - else - { - dst[PIXEL_COORDS_TO_OFFSET(x, y)] &= ~0xF; - dst[PIXEL_COORDS_TO_OFFSET(x, y)] |= (value); - } -} -#define STAT_BAR_X_OFFSET 10 -static void CreateStatBar(u8 *dst, u32 y, u32 width) -{ - u32 i, color; - - switch (width) - { - case 0 ... 5: - color = COLOR_WORST; - break; - case 6 ... 15: - color = COLOR_BAD; - break; - case 16 ... 25: - color = COLOR_AVERAGE; - break; - case 26 ... 31: - color = COLOR_GOOD; - break; - case 32 ... 37: - color = COLOR_VERY_GOOD; - break; - default: - color = COLOR_BEST; - break; - } - - // white pixes left side - WritePixel(dst, STAT_BAR_X_OFFSET, y + 0, COLOR_ID_BAR_WHITE); - WritePixel(dst, STAT_BAR_X_OFFSET, y + 1, COLOR_ID_BAR_WHITE); - WritePixel(dst, STAT_BAR_X_OFFSET, y + 2, COLOR_ID_BAR_WHITE); - WritePixel(dst, STAT_BAR_X_OFFSET, y + 3, COLOR_ID_BAR_WHITE); - WritePixel(dst, STAT_BAR_X_OFFSET, y + 4, COLOR_ID_BAR_WHITE); - - // white pixels right side - WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 0, COLOR_ID_BAR_WHITE); - WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 1, COLOR_ID_BAR_WHITE); - WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 2, COLOR_ID_BAR_WHITE); - WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 3, COLOR_ID_BAR_WHITE); - WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 4, COLOR_ID_BAR_WHITE); - - // Fill - for (i = 1; i < width - 1; i++) - { - WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 0, COLOR_ID_BAR_WHITE); - WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 1, COLOR_ID_FILL_SHADOW + color * 2); - WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 2, COLOR_ID_FILL + color * 2); - WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 3, COLOR_ID_FILL + color * 2); - WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 4, COLOR_ID_BAR_WHITE); - } -} -static const u8 sBaseStatOffsets[] = -{ - offsetof(struct SpeciesInfo, baseHP), - offsetof(struct SpeciesInfo, baseAttack), - offsetof(struct SpeciesInfo, baseDefense), - offsetof(struct SpeciesInfo, baseSpAttack), - offsetof(struct SpeciesInfo, baseSpDefense), - offsetof(struct SpeciesInfo, baseSpeed), -}; -static void TryDestroyStatBars(void) -{ - if (sPokedexView->statBarsSpriteId != 0xFF) - { - FreeSpriteTilesByTag(TAG_STAT_BAR); - //FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsSpriteId]); - DestroySprite(&gSprites[sPokedexView->statBarsSpriteId]); - sPokedexView->statBarsSpriteId = 0xFF; - } -} -static void TryDestroyStatBarsBg(void) -{ - if (sPokedexView->statBarsBgSpriteId != 0xFF) - { - FreeSpriteTilesByTag(TAG_STAT_BAR_BG); - //FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsBgSpriteId]); - DestroySprite(&gSprites[sPokedexView->statBarsBgSpriteId]); - sPokedexView->statBarsBgSpriteId = 0xFF; - } -} -static void CreateStatBars(struct PokedexListItem *dexMon) -{ - u8 offset_x = 184; //Moves the complete stat box left/right - u8 offset_y = 16; //Moves the complete stat box up/down - TryDestroyStatBars(); - - sPokedexView->justScrolled = FALSE; - - - if (dexMon->owned) // Show filed bars - { - u8 i; - u32 width, statValue; - u8 *gfx = Alloc(64 * 64); - static const u8 sBarsYOffset[] = {3, 13, 23, 33, 43, 53}; - struct SpriteSheet sheet = {gfx, 64 * 64, TAG_STAT_BAR}; - u32 species = NationalPokedexNumToSpecies(dexMon->dexNum); - - memcpy(gfx, sStatBarsGfx, sizeof(sStatBarsGfx)); - for (i = 0; i < NUM_STATS; i++) - { - statValue = *((u8*)(&gSpeciesInfo[species]) + sBaseStatOffsets[i]); - if (statValue <= 100) - { - width = statValue / 3; - if (width >= 33) - width -= 1; - } - else - width = (100 / 3) + ((statValue - 100) / 14); - - if (width > 39) // Max pixels - width = 39; - if (width < 3) - width = 3; - - CreateStatBar(gfx, sBarsYOffset[i], width); - } - - LoadSpriteSheet(&sheet); - Free(gfx); - } - else if (dexMon->seen) // Just HP/ATK/DEF - { - static const struct SpriteSheet sheet = {sStatBarsGfx, 64 * 64, TAG_STAT_BAR}; - - LoadSpriteSheet(&sheet); - } - else // neither seen nor owned - { - return; - } - sPokedexView->statBarsSpriteId = CreateSprite(&sStatBarSpriteTemplate, 36+offset_x, 107+offset_y, 10); -} -static void CreateStatBarsBg(void) //HGSS_Ui stat bars background text -{ - static const struct SpriteSheet sheetStatBarsBg = {sStatBarsGfx, 64 * 64, TAG_STAT_BAR_BG}; - u8 offset_x = 184; //Moves the complete stat box left/right - u8 offset_y = 16; //Moves the complete stat box up/down - - TryDestroyStatBarsBg(); - - LoadSpriteSheet(&sheetStatBarsBg); - sPokedexView->statBarsBgSpriteId = CreateSprite(&sStatBarBgSpriteTemplate, 36+offset_x, 107+offset_y, 0); -} -// Hack to destroy sprites when a pokemon data is being loaded in -static bool32 IsMonInfoBeingLoaded(void) -{ - return (gSprites[sPokedexView->selectedMonSpriteId].callback == SpriteCB_MoveMonForInfoScreen); -} -static void SpriteCB_StatBars(struct Sprite *sprite) -{ - if (IsMonInfoBeingLoaded()) - sprite->invisible = TRUE; - if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) - { - FreeSpriteTilesByTag(TAG_STAT_BAR); - FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsSpriteId]); - DestroySprite(&gSprites[sPokedexView->statBarsSpriteId]); - sPokedexView->statBarsSpriteId = 0xFF; - } -} -static void SpriteCB_StatBarsBg(struct Sprite *sprite) -{ - if (IsMonInfoBeingLoaded()) - sprite->invisible = TRUE; - if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) - { - FreeSpriteTilesByTag(TAG_STAT_BAR_BG); - FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsBgSpriteId]); - DestroySprite(&gSprites[sPokedexView->statBarsBgSpriteId]); - sPokedexView->statBarsBgSpriteId = 0xFF; - } -} - - -//PokedexPlus HGSS_Ui Forms Page PokemonExpansion form rhh only -#ifdef POKEMON_EXPANSION -static void Task_LoadFormsScreen(u8 taskId) -{ - switch (gMain.state) - { - case 0: - default: - if (!gPaletteFade.active) - { - u16 r2; - - sPokedexView->currentPage = FORMS_SCREEN; - gPokedexVBlankCB = gMain.vblankCallback; - SetVBlankCallback(NULL); - r2 = 0; - if (gTasks[taskId].data[1] != 0) - r2 += DISPCNT_OBJ_ON; - if (gTasks[taskId].data[2] != 0) - r2 |= DISPCNT_BG1_ON; - ResetOtherVideoRegisters(r2); - gMain.state = 1; - } - break; - case 1: - LoadTilesetTilemapHGSS(FORMS_SCREEN); - FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); - PutWindowTilemap(WIN_INFO); - CopyWindowToVram(WIN_INFO, 3); - FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); - PutWindowTilemap(WIN_NAVIGATION_BUTTONS); - CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); - CopyBgTilemapBufferToVram(1); - CopyBgTilemapBufferToVram(2); - CopyBgTilemapBufferToVram(3); - gMain.state++; - break; - case 2: - LoadScreenSelectBarMain(0xD); - LoadPokedexBgPalette(sPokedexView->isSearchResults); - gMain.state++; - break; - case 3: - if (gTasks[taskId].data[1] == 0) - { - //Icon - FreeMonIconPalettes(); //Free space for new pallete - LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite - gSprites[gTasks[taskId].data[4]].oam.priority = 0; - } - EvoFormsPage_PrintNavigationButtons(); //HGSS_Ui Navigation buttons - sPokedexView->sFormScreenData.menuPos = 1; - gMain.state++; - break; - case 4: - //Print form icons - gTasks[taskId].data[3] = 0; - PrintForms(taskId, NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); - LoadSpritePalette(&sSpritePalette_Arrow); - gMain.state++; - break; - case 5: - { - u32 preservedPalettes = 0; - - if (gTasks[taskId].data[2] != 0) - preservedPalettes = 0x14; // each bit represents a palette index - if (gTasks[taskId].data[1] != 0) - preservedPalettes |= (1 << (gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum + 16)); - BeginNormalPaletteFade(~preservedPalettes, 0, 16, 0, RGB_BLACK); - SetVBlankCallback(gPokedexVBlankCB); - gMain.state++; - } - break; - case 6: - SetGpuReg(REG_OFFSET_BLDCNT, 0); - SetGpuReg(REG_OFFSET_BLDALPHA, 0); - SetGpuReg(REG_OFFSET_BLDY, 0); - SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); - HideBg(0); - ShowBg(1); - ShowBg(2); - ShowBg(3); - gMain.state++; - break; - case 7: - if (!gPaletteFade.active) - gMain.state++; - break; - case 8: - gMain.state++; - break; - case 9: - sPokedexView->screenSwitchState = 0; - gTasks[taskId].data[0] = 0; - gTasks[taskId].data[1] = 0; - gTasks[taskId].data[2] = 1; - gTasks[taskId].func = Task_HandleFormsScreenInput; - gMain.state = 0; - break; - } -} -static void Task_HandleFormsScreenInput(u8 taskId) -{ - u8 base_x = 5; - u8 base_y = 34; - u8 offset_x = 34; - u8 offset_y = 34; - if (!sPokedexView->sFormScreenData.inSubmenu) - { - if (JOY_NEW(A_BUTTON) && sPokedexView->sFormScreenData.numForms != 0) - { - sPokedexView->sFormScreenData.inSubmenu = TRUE; - sPokedexView->sFormScreenData.arrowSpriteId = CreateSprite(&gSpriteTemplate_Arrow, base_x + offset_x, base_y, 0); - gSprites[sPokedexView->sFormScreenData.arrowSpriteId].animNum = 2; - EvoFormsPage_PrintNavigationButtons(); - } - - if (JOY_NEW(START_BUTTON)) - { - sPokedexView->selectedScreen = EVO_SCREEN; - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); - sPokedexView->screenSwitchState = 1; - gTasks[taskId].func = Task_SwitchScreensFromFormsScreen; - PlaySE(SE_PIN); - } - - //Exit to overview - if (JOY_NEW(B_BUTTON)) - { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); - gTasks[taskId].func = Task_ExitFormsScreen; - PlaySE(SE_PC_OFF); - return; - } - } - else //inSubmenu - { - u8 row = 0; - u8 column = 0; - u8 menuPos = sPokedexView->sFormScreenData.menuPos; - //Grid navigation - if (JOY_NEW(DPAD_RIGHT)) - menuPos += 1; - else if (JOY_NEW(DPAD_LEFT)) - menuPos -= 1; - else if (JOY_NEW(DPAD_DOWN)) - menuPos += 7; - else if (JOY_NEW(DPAD_UP)) - { - if (menuPos > 7) - menuPos -= 7; - else - menuPos = 1; - } - - if (menuPos <= 0) - menuPos = 1; - else if (menuPos >= sPokedexView->sFormScreenData.numForms) - menuPos = sPokedexView->sFormScreenData.numForms; - - row = menuPos / 7; - column = menuPos % 7; - gSprites[sPokedexView->sFormScreenData.arrowSpriteId].x = base_x + offset_x * column; - gSprites[sPokedexView->sFormScreenData.arrowSpriteId].y = base_y + offset_y * row; - - sPokedexView->sFormScreenData.menuPos = menuPos; - - - if (JOY_NEW(A_BUTTON)) - { - u8 formId = sPokedexView->sFormScreenData.formIds[menuPos]; - u16 formSpecies = GetFormSpeciesId(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), formId); - if (formSpecies == GetFormSpeciesId(formSpecies, 0)) - sPokedexView->formSpecies = 0; - else - sPokedexView->formSpecies = formSpecies; - - sPokedexView->sEvoScreenData.fromEvoPage = TRUE; - sPokedexView->sFormScreenData.inSubmenu = FALSE; - PlaySE(SE_PIN); - BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); - gTasks[taskId].func = Task_LoadInfoScreenWaitForFade; - } - - if (JOY_NEW(B_BUTTON)) - { - DestroySprite(&gSprites[sPokedexView->sFormScreenData.arrowSpriteId]); - sPokedexView->sFormScreenData.inSubmenu = FALSE; - EvoFormsPage_PrintNavigationButtons(); - } - } -} -#define FORM_SPECIES_END (0xffff) -static void PrintForms(u8 taskId, u16 species) -{ - u8 i; - u8 j = 1; - u16 speciesForm; - - - bool8 left = TRUE; - u8 base_x = 5; - u8 base_x_offset = 54; - u8 base_y = 52; - u8 base_y_offset = 9; - u8 base_i = 0; - u8 times = 0; - u8 y_offset_icons = 0; //For unown only - - if (species == SPECIES_UNOWN) - y_offset_icons = 8; - - if (GetFormSpeciesId(species, 0) == SPECIES_UNOWN) - y_offset_icons = 8; - - StringCopy(gStringVar1, gSpeciesNames[species]); - - for (i=0; i < 30; i++) - { - speciesForm = GetFormSpeciesId(species, i); - if (speciesForm == FORM_SPECIES_END) - break; - else if (speciesForm == species) - continue; - else - { - sPokedexView->sFormScreenData.formIds[j++] = i; - times += 1; - LoadMonIconPalette(speciesForm); //Loads pallete for current mon - if (times < 7) - gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 52 + 34*(times-1), 31, 4, 0); //Create pokemon sprite - else if (times < 14) - gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-7), 70 - y_offset_icons, 4, 0); //Create pokemon sprite - else if (times < 21) - gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-14), 104 - y_offset_icons, 4, 0); //Create pokemon sprite - else - gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-21), 138 - y_offset_icons, 4, 0); //Create pokemon sprite - gSprites[gTasks[taskId].data[4+times]].oam.priority = 0; - } - } - gTasks[taskId].data[3] = times; - sPokedexView->sFormScreenData.numForms = times; - - //If there are no forms print text - if (times == 0) - { - StringExpandPlaceholders(gStringVar4, gText_FORMS_NONE); - PrintInfoScreenTextSmall(gStringVar4, base_x, base_y + base_y_offset*times); - } -} -static void Task_SwitchScreensFromFormsScreen(u8 taskId) -{ - u8 i; - if (!gPaletteFade.active) - { - FreeMonIconPalettes(); //Destroy pokemon icon sprite - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite - for (i = 1; i <= gTasks[taskId].data[3]; i++) - { - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite - } - FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); - - switch (sPokedexView->screenSwitchState) - { - case 1: - gTasks[taskId].func = Task_LoadEvolutionScreen; - break; - default: - gTasks[taskId].func = Task_LoadInfoScreen; - break; - } - } -} -static void Task_ExitFormsScreen(u8 taskId) -{ - u8 i; - if (!gPaletteFade.active) - { - FreeMonIconPalettes(); //Destroy pokemon icon sprite - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite - for (i = 1; i <= gTasks[taskId].data[3]; i++) - { - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite - } - FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); - - FreeInfoScreenWindowAndBgBuffers(); - DestroyTask(taskId); - } -} -#endif - diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c new file mode 100644 index 000000000000..6f8750bf468c --- /dev/null +++ b/src/pokedex_plus_hgss.c @@ -0,0 +1,8784 @@ +#include "global.h" +#include "battle_main.h" +#ifdef BATTLE_ENGINE +#include "battle_util.h" +#endif +#include "bg.h" +#include "contest_effect.h" +#include "data.h" +#include "daycare.h" +#include "decompress.h" +#include "event_data.h" +#include "gpu_regs.h" +#include "graphics.h" +#include "international_string_util.h" +#include "item.h" +#include "item_icon.h" +#include "main.h" +#include "malloc.h" +#include "menu.h" +#include "m4a.h" +#include "overworld.h" +#include "palette.h" +#include "party_menu.h" +#include "pokedex.h" +#include "pokedex_plus_hgss.h" +#include "pokedex_area_screen.h" +#include "pokedex_cry_screen.h" +#include "pokemon_icon.h" +#include "pokemon_summary_screen.h" +#ifdef POKEMON_EXPANSION +#include "region_map.h" +#include "pokemon.h" +#endif +#include "reset_rtc_screen.h" +#include "scanline_effect.h" +#include "shop.h" +#include "sound.h" +#include "sprite.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "text_window.h" +#include "trainer_pokemon_sprites.h" +#include "trig.h" +#include "window.h" +#include "constants/abilities.h" +#include "constants/items.h" +#include "constants/moves.h" +#include "constants/party_menu.h" +#include "constants/rgb.h" +#include "constants/songs.h" +#ifdef TX_RANDOMIZER_AND_CHALLENGES + //#include "tx_randomizer_and_challenges.h" +#endif + + +enum +{ + PAGE_MAIN, + PAGE_INFO, + PAGE_SEARCH, + PAGE_SEARCH_RESULTS, + PAGE_UNK, + PAGE_AREA, + PAGE_CRY, + PAGE_SIZE +}; + +enum +{ + INFO_SCREEN, + STATS_SCREEN, + EVO_SCREEN, + FORMS_SCREEN, //Pokemonexpansion only (rhh) + AREA_SCREEN, + CRY_SCREEN, + SIZE_SCREEN, + CANCEL_SCREEN, + SCREEN_COUNT +}; + +enum +{ + SEARCH_NAME, + SEARCH_COLOR, + SEARCH_TYPE_LEFT, + SEARCH_TYPE_RIGHT, + SEARCH_ORDER, + SEARCH_MODE, + SEARCH_OK, + SEARCH_COUNT +}; + +enum +{ + SEARCH_TOPBAR_SEARCH, + SEARCH_TOPBAR_SHIFT, + SEARCH_TOPBAR_CANCEL, + SEARCH_TOPBAR_COUNT +}; + +enum +{ + ORDER_NUMERICAL, + ORDER_ALPHABETICAL, + ORDER_HEAVIEST, + ORDER_LIGHTEST, + ORDER_TALLEST, + ORDER_SMALLEST +}; + +enum +{ + NAME_ABC = 1, + NAME_DEF, + NAME_GHI, + NAME_JKL, + NAME_MNO, + NAME_PQR, + NAME_STU, + NAME_VWX, + NAME_YZ, +}; + + +extern const u8 *const gMonFootprintTable[]; +extern const u16 gPokedexOrder_Alphabetical[]; +extern const u16 gPokedexOrder_Height[]; +extern const u16 gPokedexOrder_Weight[]; +extern const struct Evolution gEvolutionTable[][EVOS_PER_MON]; +extern const struct PokedexEntry gPokedexEntries[]; + + +static const u8 sText_No000[] = _("{NO}000"); +static const u8 sCaughtBall_Gfx[] = INCBIN_U8("graphics/pokedex/caught_ball.4bpp"); +static const u8 sText_TenDashes[] = _("----------"); +ALIGNED(4) static const u8 sExpandedPlaceholder_PokedexDescription[] = _(""); +static const u16 sSizeScreenSilhouette_Pal[] = INCBIN_U16("graphics/pokedex/size_silhouette.gbapal"); +static const u8 sText_TenDashes2[] = _("----------"); + + +#define SCROLLING_MON_X 146 +#define HGSS_DECAPPED 0 //0 false, 1 true +#define HGSS_DARK_MODE 0 //0 false, 1 true +#define HGSS_HIDE_UNSEEN_EVOLUTION_NAMES 0 //0 false, 1 true + + + +// For scrolling search parameter +#define MAX_SEARCH_PARAM_ON_SCREEN 6 +#define MAX_SEARCH_PARAM_CURSOR_POS (MAX_SEARCH_PARAM_ON_SCREEN - 1) + +#define MAX_MONS_ON_SCREEN 4 + +#define LIST_SCROLL_STEP 16 + +#define POKEBALL_ROTATION_TOP 64 +#define POKEBALL_ROTATION_BOTTOM (POKEBALL_ROTATION_TOP - 16) + +// Coordinates of the Pokémon sprite on its page (info/cry screens) +#define MON_PAGE_X 48 +#define MON_PAGE_Y 56 + + + + + +static EWRAM_DATA struct PokedexView *sPokedexView = NULL; +static EWRAM_DATA u16 sLastSelectedPokemon = 0; +static EWRAM_DATA u8 sPokeBallRotation = 0; +static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL; +//Pokedex Plus HGSS_Ui +#ifndef BATTLE_ENGINE +#define MOVES_COUNT_TOTAL (EGG_MOVES_ARRAY_COUNT + MAX_LEVEL_UP_MOVES + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + TUTOR_MOVE_COUNT) +#else +#define MOVES_COUNT_TOTAL (EGG_MOVES_ARRAY_COUNT + MAX_LEVEL_UP_MOVES + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + 20) +#endif +EWRAM_DATA static u16 sStatsMoves[MOVES_COUNT_TOTAL] = {0}; +EWRAM_DATA static u16 sStatsMovesTMHM_ID[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; + + + + + + + + + + + + +struct SearchOptionText +{ + const u8 *description; + const u8 *title; +}; + +struct SearchOption +{ + const struct SearchOptionText *texts; + u8 taskDataCursorPos; + u8 taskDataScrollOffset; + u16 numOptions; +}; + +struct SearchMenuTopBarItem +{ + const u8 *description; + u8 highlightX; + u8 highlightY; + u8 highlightWidth; +}; + +struct SearchMenuItem +{ + const u8 *description; + u8 titleBgX; + u8 titleBgY; + u8 titleBgWidth; + u8 selectionBgX; + u8 selectionBgY; + u8 selectionBgWidth; +}; + +struct PokedexListItem +{ + u16 dexNum; + u16 seen:1; + u16 owned:1; +}; + + + + + + + + + + + +//HGSS_Ui +struct PokemonStats +{ + u16 species; + u8 genderRatio; + u8 baseHP; + u8 baseSpeed; + u8 baseAttack; + u8 baseSpAttack; + u8 baseDefense; + u8 baseSpDefense; + u8 differentEVs; + u8 evYield_HP; + u8 evYield_Speed; + u8 evYield_Attack; + u8 evYield_SpAttack; + u8 evYield_Defense; + u8 evYield_SpDefense; + u8 catchRate; + u8 growthRate; + u8 eggGroup1; + u8 eggGroup2; + u8 eggCycles; + u8 expYield; + u8 friendship; + u16 ability0; + u16 ability1; + u16 abilityHidden; +}; + +struct EvoScreenData +{ + bool8 fromEvoPage; + u8 numAllEvolutions; + u16 targetSpecies[10]; + u8 numSeen; + bool8 seen[10]; + u8 menuPos; + u8 arrowSpriteId; + #ifdef POKEMON_EXPANSION + bool8 isMega; + #endif +}; + +#ifdef POKEMON_EXPANSION +struct FromScreenData +{ + u8 numForms; + u16 formIds[30]; + bool8 inSubmenu; + u8 menuPos; + u8 arrowSpriteId; +}; +#endif + +struct PokedexView +{ + struct PokedexListItem pokedexList[NATIONAL_DEX_COUNT + 1]; + u16 pokemonListCount; + u16 selectedPokemon; + u16 selectedPokemonBackup; + u16 dexMode; + u16 dexModeBackup; + u16 dexOrder; + u16 dexOrderBackup; + u16 seenCount; + u16 ownCount; + u16 monSpriteIds[MAX_MONS_ON_SCREEN]; + u8 typeIconSpriteIds[2]; //HGSS_Ui + u16 moveSelected; //HGSS_Ui + u8 movesTotal; //HGSS_Ui + u8 statBarsSpriteId; //HGSS_Ui + u8 statBarsBgSpriteId; //HGSS_Ui + bool8 justScrolled; //HGSS_Ui + #ifdef BATTLE_ENGINE + u8 splitIconSpriteId; //HGSS_Ui Physical/Special Split from BE + #endif + u8 numEggMoves; //HGSS_Ui + u8 numLevelUpMoves; //HGSS_Ui + u8 numTMHMMoves; //HGSS_Ui + u8 numTutorMoves; //HGSS_Ui + u8 numPreEvolutions; //HGSS_Ui + struct PokemonStats sPokemonStats; //HGSS_Ui + struct EvoScreenData sEvoScreenData; //HGSS_Ui + #ifdef POKEMON_EXPANSION + struct FromScreenData sFormScreenData; //HGSS_Ui + #endif + u16 formSpecies; + u16 selectedMonSpriteId; + u16 pokeBallRotationStep; + u16 pokeBallRotationBackup; + u8 pokeBallRotation; + u8 initialVOffset; + u8 scrollTimer; + u8 scrollDirection; + s16 listVOffset; + s16 listMovingVOffset; + u16 scrollMonIncrement; + u16 maxScrollTimer; + u16 scrollSpeed; + u16 unkArr1[4]; // Cleared, never read + u8 filler[8]; + u8 currentPage; + u8 currentPageBackup; + bool8 isSearchResults:1; + u8 selectedScreen; + u8 screenSwitchState; + u8 menuIsOpen; + u16 menuCursorPos; + s16 menuY; //Menu Y position (inverted because we use REG_BG0VOFS for this) + u8 unkArr2[8]; // Cleared, never read + u8 unkArr3[8]; // Cleared, never read +}; + + + + + + + + + + + + + + + + + +static void ResetPokedexView(struct PokedexView *pokedexView); +static void VBlankCB_Pokedex(void); +static void CB2_Pokedex(void); +static void Task_OpenPokedexMainPage(u8); +static void Task_HandlePokedexInput(u8); +static void Task_WaitForScroll(u8); +static void Task_HandlePokedexStartMenuInput(u8); +static void Task_OpenInfoScreenAfterMonMovement(u8); +static void Task_WaitForExitInfoScreen(u8); +static void Task_WaitForExitSearch(u8); +static void Task_ClosePokedex(u8); +static void Task_OpenSearchResults(u8); +static void Task_HandleSearchResultsInput(u8); +static void Task_WaitForSearchResultsScroll(u8); +static void Task_HandleSearchResultsStartMenuInput(u8); +static void Task_OpenSearchResultsInfoScreenAfterMonMovement(u8); +static void Task_WaitForExitSearchResultsInfoScreen(u8); +static void Task_ReturnToPokedexFromSearchResults(u8); +static void Task_ClosePokedexFromSearchResultsStartMenu(u8); +static bool8 LoadPokedexListPage(u8); +static void LoadPokedexBgPalette(bool8); +static void FreeWindowAndBgBuffers(void); +static void CreatePokedexList(u8, u8); +static void CreateMonDexNum(u16, u8, u8, u16); +static void CreateCaughtBall(u16, u8, u8, u16); +static u8 CreateMonName(u16, u8, u8); +static void ClearMonListEntry(u8 x, u8 y, u16 unused); +static void CreateMonSpritesAtPos(u16, u16); +static bool8 UpdateDexListScroll(u8, u8, u8); +static u16 TryDoPokedexScroll(u16, u16); +static void UpdateSelectedMonSpriteId(void); +static bool8 TryDoInfoScreenScroll(void); +static u8 ClearMonSprites(void); +static u16 GetPokemonSpriteToDisplay(u16); +static u32 CreatePokedexMonSprite(u16, s16, s16); +static void CreateInterfaceSprites(u8); +static void SpriteCB_MoveMonForInfoScreen(struct Sprite *sprite); +static void SpriteCB_Scrollbar(struct Sprite *sprite); +static void SpriteCB_ScrollArrow(struct Sprite *sprite); +static void SpriteCB_DexListInterfaceText(struct Sprite *sprite); +static void SpriteCB_RotatingPokeBall(struct Sprite *sprite); +static void SpriteCB_SeenOwnInfo(struct Sprite *sprite); +static void SpriteCB_DexListStartMenuCursor(struct Sprite *sprite); +static void SpriteCB_PokedexListMonSprite(struct Sprite *sprite); +static u8 LoadInfoScreen(struct PokedexListItem *, u8 monSpriteId); +static bool8 IsInfoScreenScrolling(u8); +static u8 StartInfoScreenScroll(struct PokedexListItem *, u8); +static void Task_LoadInfoScreen(u8); +static void Task_HandleInfoScreenInput(u8); +static void Task_SwitchScreensFromInfoScreen(u8); +static void Task_LoadInfoScreenWaitForFade(u8); +static void Task_ExitInfoScreen(u8); +static void Task_LoadAreaScreen(u8); +static void Task_WaitForAreaScreenInput(u8 taskId); +static void Task_SwitchScreensFromAreaScreen(u8); +static void Task_LoadCryScreen(u8); +static void Task_HandleCryScreenInput(u8); +static void Task_SwitchScreensFromCryScreen(u8); +static void LoadPlayArrowPalette(bool8); +static void Task_LoadSizeScreen(u8); +static void Task_HandleSizeScreenInput(u8); +static void Task_SwitchScreensFromSizeScreen(u8); +static void LoadScreenSelectBarMain(u16); +static void LoadScreenSelectBarSubmenu(u16); +static void HighlightScreenSelectBarItem(u8, u16); +static void HighlightSubmenuScreenSelectBarItem(u8, u16); +static void Task_DisplayCaughtMonDexPage(u8); +static void Task_HandleCaughtMonPageInput(u8); +static void Task_ExitCaughtMonPage(u8); +static void SpriteCB_SlideCaughtMonToCenter(struct Sprite *sprite); +static void PrintMonInfo(u32 num, u32, u32 owned, u32 newEntry); +static void PrintMonHeight(u16 height, u8 left, u8 top); +static void PrintMonWeight(u16 weight, u8 left, u8 top); +static void ResetOtherVideoRegisters(u16); +static u8 PrintCryScreenSpeciesName(u8, u16, u8, u8); +static void PrintDecimalNum(u8 windowId, u16 num, u8 left, u8 top); +static void DrawFootprint(u8 windowId, u16 dexNum); +static u16 CreateSizeScreenTrainerPic(u16, s16, s16, s8); +static u16 GetNextPosition(u8, u16, u16, u16); +static u8 LoadSearchMenu(void); +static void Task_LoadSearchMenu(u8); +static void Task_SwitchToSearchMenuTopBar(u8); +static void Task_HandleSearchTopBarInput(u8); +static void Task_SwitchToSearchMenu(u8); +static void Task_HandleSearchMenuInput(u8); +static void Task_StartPokedexSearch(u8); +static void Task_WaitAndCompleteSearch(u8); +static void Task_SearchCompleteWaitForInput(u8); +static void Task_SelectSearchMenuItem(u8); +static void Task_HandleSearchParameterInput(u8); +static void Task_ExitSearch(u8); +static void Task_ExitSearchWaitForFade(u8); +static void HighlightSelectedSearchTopBarItem(u8); +static void HighlightSelectedSearchMenuItem(u8, u8); +static void PrintSelectedSearchParameters(u8); +static void DrawOrEraseSearchParameterBox(bool8); +static void PrintSearchParameterText(u8); +static u8 GetSearchModeSelection(u8 taskId, u8 option); +static void SetDefaultSearchModeAndOrder(u8); +static void CreateSearchParameterScrollArrows(u8); +static void EraseAndPrintSearchTextBox(const u8 *); +static void EraseSelectorArrow(u32); +static void PrintSelectorArrow(u32); +static void PrintSearchParameterTitle(u32, const u8 *); +static void ClearSearchParameterBoxText(void); +static void SetSpriteInvisibility(u8 spriteArrayId, bool8 invisible); +static void CreateTypeIconSprites(void); +static void SetSearchRectHighlight(u8 flags, u8 x, u8 y, u8 width); +static void PrintInfoSubMenuText(u8 windowId, const u8 *str, u8 left, u8 top); + + + + + + + + + +//Stats screen HGSS_Ui + +static void LoadTilesetTilemapHGSS(u8 page); +static void Task_HandleStatsScreenInput(u8 taskId); +static void Task_LoadStatsScreen(u8 taskId); +static void Task_SwitchScreensFromStatsScreen(u8 taskId); +static void Task_ExitStatsScreen(u8 taskId); +static bool8 CalculateMoves(void); +static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value); +static void PrintStatsScreen_DestroyMoveItemIcon(u8 taskId); +static void PrintStatsScreen_Moves_Top(u8 taskId); +static void PrintStatsScreen_Moves_Description(u8 taskId); +static void PrintStatsScreen_Moves_BottomText(u8 taskId); +static void PrintStatsScreen_Moves_Bottom(u8 taskId); +static void PrintStatsScreen_Left(u8 taskId); +static void PrintStatsScreen_Abilities(u8 taskId); +static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top); +static void PrintInfoScreenTextSmall(const u8* str, u8 left, u8 top); +static void PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top); +static void Task_LoadEvolutionScreen(u8 taskId); +static void Task_HandleEvolutionScreenInput(u8 taskId); +static void Task_SwitchScreensFromEvolutionScreen(u8 taskId); +static void Task_ExitEvolutionScreen(u8 taskId); +static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_i); +static u8 PrintPreEvolutions(u8 taskId, u16 species); +//Stat bars on scrolling screens +static void TryDestroyStatBars(void); +static void TryDestroyStatBarsBg(void); +static void CreateStatBars(struct PokedexListItem *dexMon); +static void CreateStatBarsBg(void); +static void SpriteCB_StatBars(struct Sprite *sprite); +static void SpriteCB_StatBarsBg(struct Sprite *sprite); + +//HGSS_UI Forms screen for PokemonExpansion (rhh) +#ifdef POKEMON_EXPANSION +static void Task_LoadFormsScreen(u8 taskId); +static void Task_HandleFormsScreenInput(u8 taskId); +static void PrintForms(u8 taskId, u16 species); +static void Task_SwitchScreensFromFormsScreen(u8 taskId); +static void Task_ExitFormsScreen(u8 taskId); +#endif + +//HGSS_UI Physical Special Split icon for BattleEngine (rhh) +#ifdef BATTLE_ENGINE +static u8 ShowSplitIcon(u32 split); //Physical/Special Split from BE +static void DestroySplitIcon(void); //Physical/Special Split from BE + +//Physical/Special Split from BE +#define TAG_SPLIT_ICONS 30004 + +static const u16 sSplitIcons_Pal[] = INCBIN_U16("graphics/interface/split_icons.gbapal"); +static const u32 sSplitIcons_Gfx[] = INCBIN_U32("graphics/interface/split_icons.4bpp.lz"); + +static const struct OamData sOamData_SplitIcons = +{ + .size = SPRITE_SIZE(16x16), + .shape = SPRITE_SHAPE(16x16), + .priority = 0, +}; +static const struct CompressedSpriteSheet sSpriteSheet_SplitIcons = +{ + .data = sSplitIcons_Gfx, + .size = 16*16*3/2, + .tag = TAG_SPLIT_ICONS, +}; +static const struct SpritePalette sSpritePal_SplitIcons = +{ + .data = sSplitIcons_Pal, + .tag = TAG_SPLIT_ICONS +}; +static const union AnimCmd sSpriteAnim_SplitIcon0[] = +{ + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; +static const union AnimCmd sSpriteAnim_SplitIcon1[] = +{ + ANIMCMD_FRAME(4, 0), + ANIMCMD_END +}; +static const union AnimCmd sSpriteAnim_SplitIcon2[] = +{ + ANIMCMD_FRAME(8, 0), + ANIMCMD_END +}; +static const union AnimCmd *const sSpriteAnimTable_SplitIcons[] = +{ + sSpriteAnim_SplitIcon0, + sSpriteAnim_SplitIcon1, + sSpriteAnim_SplitIcon2, +}; +static const struct SpriteTemplate sSpriteTemplate_SplitIcons = +{ + .tileTag = TAG_SPLIT_ICONS, + .paletteTag = TAG_SPLIT_ICONS, + .oam = &sOamData_SplitIcons, + .anims = sSpriteAnimTable_SplitIcons, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; +#endif + +//HGSS_Ui Stat bars by DizzyEgg +#define TAG_STAT_BAR 4097 +#define TAG_STAT_BAR_BG 4098 +static const struct OamData sOamData_StatBar = +{ + .y = 160, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(64x64), + .size = SPRITE_SIZE(64x64), +}; +static const struct OamData sOamData_StatBarBg = +{ + .y = 160, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(64x64), + .size = SPRITE_SIZE(64x64), +}; +static const struct SpriteTemplate sStatBarSpriteTemplate = +{ + .tileTag = TAG_STAT_BAR, + .paletteTag = TAG_STAT_BAR, + .oam = &sOamData_StatBar, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_StatBars, +}; +static const struct SpriteTemplate sStatBarBgSpriteTemplate = +{ + .tileTag = TAG_STAT_BAR_BG, + .paletteTag = TAG_STAT_BAR_BG, + .oam = &sOamData_StatBarBg, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_StatBarsBg, +}; +enum +{ + COLOR_ID_ALPHA, + COLOR_ID_BAR_WHITE, + // These are repeated 6 times + COLOR_ID_FILL, + COLOR_ID_FILL_SHADOW, + COLOR_ID_FONT = 14, + COLOR_ID_FONT_SHADOW = 15, +}; +enum +{ + COLOR_BEST, // Light blue + COLOR_VERY_GOOD, // Green + COLOR_GOOD, // Light Green + COLOR_AVERAGE, // Yellow + COLOR_BAD, // Orange + COLOR_WORST, // Red +}; +static const u8 sStatBarsGfx[] = INCBIN_U8("graphics/pokedex/hgss/stat_bars.4bpp"); +static const u16 sStatBarPalette[16] = { + [COLOR_ID_ALPHA] = RGB(0, 0, 10), + [COLOR_ID_BAR_WHITE] = RGB_WHITE, + + [COLOR_ID_FILL + COLOR_BEST * 2] = RGB(2, 25, 25), + [COLOR_ID_FILL_SHADOW + COLOR_BEST * 2] = RGB(13, 27, 27), + + [COLOR_ID_FILL + COLOR_VERY_GOOD * 2] = RGB(11, 25, 2), + [COLOR_ID_FILL_SHADOW + COLOR_VERY_GOOD * 2] = RGB(19, 27, 13), + + [COLOR_ID_FILL + COLOR_GOOD * 2] = RGB(22, 25, 2), + [COLOR_ID_FILL_SHADOW + COLOR_GOOD * 2] = RGB(26, 27, 13), + + [COLOR_ID_FILL + COLOR_AVERAGE * 2] = RGB(25, 22, 2), + [COLOR_ID_FILL_SHADOW + COLOR_AVERAGE * 2] = RGB(27, 26, 13), + + [COLOR_ID_FILL + COLOR_BAD * 2] = RGB(25, 17, 2), + [COLOR_ID_FILL_SHADOW + COLOR_BAD * 2] = RGB(27, 22, 13), + + [COLOR_ID_FILL + COLOR_WORST * 2] = RGB(25, 4, 2), + [COLOR_ID_FILL_SHADOW + COLOR_WORST * 2] = RGB(27, 15, 13), + + [COLOR_ID_FONT] = RGB_BLACK, + [COLOR_ID_FONT_SHADOW] = RGB(22, 22, 22), +}; +static const struct SpritePalette sStatBarSpritePal[] = //{sStatBarPalette, TAG_STAT_BAR}; +{ + {sStatBarPalette, TAG_STAT_BAR}, + {sStatBarPalette, TAG_STAT_BAR_BG}, + {0} +}; + + + + + + + + + + + + + + + + + +static const struct OamData sOamData_ScrollBar = +{ + .y = DISPLAY_HEIGHT, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(8x8), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(8x8), + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_ScrollArrow = +{ + .y = DISPLAY_HEIGHT, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(16x8), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(16x8), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_InterfaceText = +{ + .y = DISPLAY_HEIGHT, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(32x16), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(32x16), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_RotatingPokeBall = +{ + .y = DISPLAY_HEIGHT, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_WINDOW, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(32x32), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(32x32), + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_SeenOwnText = +{ + .y = DISPLAY_HEIGHT, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(64x32), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(64x32), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_Dex8x16 = +{ + .y = DISPLAY_HEIGHT, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(8x16), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(8x16), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AnimCmd sSpriteAnim_ScrollBar[] = +{ + ANIMCMD_FRAME(3, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_ScrollArrow[] = +{ + ANIMCMD_FRAME(1, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_RotatingPokeBall[] = +{ + ANIMCMD_FRAME(16, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_StartButton[] = +{ + ANIMCMD_FRAME(48, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_SearchText[] = +{ + ANIMCMD_FRAME(40, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_SelectButton[] = +{ + ANIMCMD_FRAME(32, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_MenuText[] = +{ + ANIMCMD_FRAME(56, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_SeenText[] = +{ + ANIMCMD_FRAME(64, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_OwnText[] = +{ + ANIMCMD_FRAME(96, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_HoennText[] = +{ + ANIMCMD_FRAME(160, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_NationalText[] = +{ + ANIMCMD_FRAME(168, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_HoennSeenOwnDigit0[] = +{ + ANIMCMD_FRAME(128, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_HoennSeenOwnDigit1[] = +{ + ANIMCMD_FRAME(130, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_HoennSeenOwnDigit2[] = +{ + ANIMCMD_FRAME(132, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_HoennSeenOwnDigit3[] = +{ + ANIMCMD_FRAME(134, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_HoennSeenOwnDigit4[] = +{ + ANIMCMD_FRAME(136, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_HoennSeenOwnDigit5[] = +{ + ANIMCMD_FRAME(138, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_HoennSeenOwnDigit6[] = +{ + ANIMCMD_FRAME(140, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_HoennSeenOwnDigit7[] = +{ + ANIMCMD_FRAME(142, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_HoennSeenOwnDigit8[] = +{ + ANIMCMD_FRAME(144, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_HoennSeenOwnDigit9[] = +{ + ANIMCMD_FRAME(146, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_NationalSeenOwnDigit0[] = +{ + ANIMCMD_FRAME(176, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_NationalSeenOwnDigit1[] = +{ + ANIMCMD_FRAME(178, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_NationalSeenOwnDigit2[] = +{ + ANIMCMD_FRAME(180, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_NationalSeenOwnDigit3[] = +{ + ANIMCMD_FRAME(182, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_NationalSeenOwnDigit4[] = +{ + ANIMCMD_FRAME(184, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_NationalSeenOwnDigit5[] = +{ + ANIMCMD_FRAME(186, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_NationalSeenOwnDigit6[] = +{ + ANIMCMD_FRAME(188, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_NationalSeenOwnDigit7[] = +{ + ANIMCMD_FRAME(190, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_NationalSeenOwnDigit8[] = +{ + ANIMCMD_FRAME(192, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_NationalSeenOwnDigit9[] = +{ + ANIMCMD_FRAME(194, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_DexListStartMenuCursor[] = +{ + ANIMCMD_FRAME(4, 30), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_ScrollBar[] = +{ + sSpriteAnim_ScrollBar +}; + +static const union AnimCmd *const sSpriteAnimTable_ScrollArrow[] = +{ + sSpriteAnim_ScrollArrow +}; + +static const union AnimCmd *const sSpriteAnimTable_RotatingPokeBall[] = +{ + sSpriteAnim_RotatingPokeBall +}; + +static const union AnimCmd *const sSpriteAnimTable_InterfaceText[] = +{ + sSpriteAnim_StartButton, + sSpriteAnim_SearchText, + sSpriteAnim_SelectButton, + sSpriteAnim_MenuText +}; + +static const union AnimCmd *const sSpriteAnimTable_SeenOwnText[] = +{ + sSpriteAnim_SeenText, + sSpriteAnim_OwnText +}; + +static const union AnimCmd *const sSpriteAnimTable_HoennNationalText[] = +{ + sSpriteAnim_HoennText, + sSpriteAnim_NationalText +}; + +static const union AnimCmd *const sSpriteAnimTable_HoennSeenOwnNumber[] = +{ + sSpriteAnim_HoennSeenOwnDigit0, + sSpriteAnim_HoennSeenOwnDigit1, + sSpriteAnim_HoennSeenOwnDigit2, + sSpriteAnim_HoennSeenOwnDigit3, + sSpriteAnim_HoennSeenOwnDigit4, + sSpriteAnim_HoennSeenOwnDigit5, + sSpriteAnim_HoennSeenOwnDigit6, + sSpriteAnim_HoennSeenOwnDigit7, + sSpriteAnim_HoennSeenOwnDigit8, + sSpriteAnim_HoennSeenOwnDigit9 +}; + +static const union AnimCmd *const sSpriteAnimTable_NationalSeenOwnNumber[] = +{ + sSpriteAnim_NationalSeenOwnDigit0, + sSpriteAnim_NationalSeenOwnDigit1, + sSpriteAnim_NationalSeenOwnDigit2, + sSpriteAnim_NationalSeenOwnDigit3, + sSpriteAnim_NationalSeenOwnDigit4, + sSpriteAnim_NationalSeenOwnDigit5, + sSpriteAnim_NationalSeenOwnDigit6, + sSpriteAnim_NationalSeenOwnDigit7, + sSpriteAnim_NationalSeenOwnDigit8, + sSpriteAnim_NationalSeenOwnDigit9 +}; + +static const union AnimCmd *const sSpriteAnimTable_DexListStartMenuCursor[] = +{ + sSpriteAnim_DexListStartMenuCursor +}; + +#define TAG_DEX_INTERFACE 4096 // Tile and pal tag used for all interface sprites. + +static const struct SpriteTemplate sScrollBarSpriteTemplate = +{ + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, + .oam = &sOamData_ScrollBar, + .anims = sSpriteAnimTable_ScrollBar, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_Scrollbar, +}; + +static const struct SpriteTemplate sScrollArrowSpriteTemplate = +{ + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, + .oam = &sOamData_ScrollArrow, + .anims = sSpriteAnimTable_ScrollArrow, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_ScrollArrow, +}; + +static const struct SpriteTemplate sInterfaceTextSpriteTemplate = +{ + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, + .oam = &sOamData_InterfaceText, + .anims = sSpriteAnimTable_InterfaceText, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_DexListInterfaceText, +}; + +static const struct SpriteTemplate sRotatingPokeBallSpriteTemplate = +{ + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, + .oam = &sOamData_RotatingPokeBall, + .anims = sSpriteAnimTable_RotatingPokeBall, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_RotatingPokeBall, +}; + +static const struct SpriteTemplate sSeenOwnTextSpriteTemplate = +{ + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, + .oam = &sOamData_SeenOwnText, + .anims = sSpriteAnimTable_SeenOwnText, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_SeenOwnInfo, +}; + +static const struct SpriteTemplate sHoennNationalTextSpriteTemplate = +{ + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, + .oam = &sOamData_InterfaceText, + .anims = sSpriteAnimTable_HoennNationalText, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_SeenOwnInfo, +}; + +static const struct SpriteTemplate sHoennDexSeenOwnNumberSpriteTemplate = +{ + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, + .oam = &sOamData_Dex8x16, + .anims = sSpriteAnimTable_HoennSeenOwnNumber, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_SeenOwnInfo, +}; + +static const struct SpriteTemplate sNationalDexSeenOwnNumberSpriteTemplate = +{ + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, + .oam = &sOamData_Dex8x16, + .anims = sSpriteAnimTable_NationalSeenOwnNumber, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_SeenOwnInfo, +}; + +static const struct SpriteTemplate sDexListStartMenuCursorSpriteTemplate = +{ + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, + .oam = &sOamData_Dex8x16, + .anims = sSpriteAnimTable_DexListStartMenuCursor, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_DexListStartMenuCursor, +}; + +static const struct CompressedSpriteSheet sInterfaceSpriteSheet[] = +{ + {gPokedexPlusHGSS_Interface_Gfx, 0x2000, TAG_DEX_INTERFACE}, + {gPokedexPlusHGSS_Interface_DECA_Gfx, 0x2000, TAG_DEX_INTERFACE}, + {0} +}; + +static const struct SpritePalette sInterfaceSpritePalette[] = +{ + {gPokedexPlusHGSS_Default_Pal, TAG_DEX_INTERFACE}, + {0} +}; + +// By scroll speed. Last element of each unused +static const u8 sScrollMonIncrements[] = {4, 8, 16, 32, 32}; +static const u8 sScrollTimers[] = {8, 4, 2, 1, 1}; + + + + + + + + + + + + + + + + + + + +static const struct BgTemplate sPokedex_BgTemplate[] = +{ + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 12, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 13, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 2, + .mapBaseIndex = 14, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 0, + .mapBaseIndex = 15, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + } +}; + +static const struct WindowTemplate sPokemonList_WindowTemplate[] = +{ + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 0, + .width = 32, + .height = 32, + .paletteNum = 0, + .baseBlock = 1, + }, + DUMMY_WIN_TEMPLATE +}; + + + + + + + + + + + + + + + +static const struct BgTemplate sInfoScreen_BgTemplate[] = +{ + { + .bg = 0, + .charBaseIndex = 2, + .mapBaseIndex = 12, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 13, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 2, + .mapBaseIndex = 14, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 0, + .mapBaseIndex = 15, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + } +}; + +#define WIN_INFO 0 +#define WIN_FOOTPRINT 1 +#define WIN_CRY_WAVE 2 +#define WIN_VU_METER 3 +#define WIN_NAVIGATION_BUTTONS 4 + +static const struct WindowTemplate sInfoScreen_WindowTemplates[] = +{ + [WIN_INFO] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 0, + .width = 32, + .height = 20, + .paletteNum = 0, + .baseBlock = 1, + }, + [WIN_FOOTPRINT] = + { + .bg = 2, + .tilemapLeft = 15, //HGSSS_Ui + .tilemapTop = 7, //HGSSS_Ui + .width = 2, + .height = 2, + .paletteNum = 15, + .baseBlock = 641, + }, + [WIN_CRY_WAVE] = + { + .bg = 0, + .tilemapLeft = 0, + .tilemapTop = 12, + .width = 32, + .height = 7, + .paletteNum = 8, + .baseBlock = 645, + }, + [WIN_VU_METER] = + { + .bg = 2, + .tilemapLeft = 18, + .tilemapTop = 3, + .width = 10, + .height = 8, + .paletteNum = 9, + .baseBlock = 869, + }, + [WIN_NAVIGATION_BUTTONS] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 18, + .width = 20, + .height = 2, + .paletteNum = 15, + .baseBlock = 641, + }, + + DUMMY_WIN_TEMPLATE +}; + +#define WIN_STATS_TOPBAR 0 +#define WIN_STATS_SIDEBAR 1 +#define WIN_STATS_NAME_GENDER 2 +#define WIN_STATS_LEFT 3 +#define WIN_STATS_NAVIGATION_BUTTONS 4 +#define WIN_STATS_MOVES_TOP 5 +#define WIN_STATS_MOVES_DESCRIPTION 7 +#define WIN_STATS_MOVES_BOTTOM 8 +#define WIN_STATS_ABILITIES 9 +#define WIN_STATS_LEFT_UNUSED 10 +#define WIN_STATS_END WIN_STATS_LEFT_UNUSED +static const struct WindowTemplate sStatsScreen_WindowTemplates[] = +{ + [WIN_STATS_TOPBAR] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 0, + .width = 30, + .height = 2, + .paletteNum = 0, + .baseBlock = 1, + }, + [WIN_STATS_SIDEBAR] = + { + .bg = 2, + .tilemapLeft = 30, + .tilemapTop = 0, + .width = 2, + .height = 20, + .paletteNum = 0, + .baseBlock = 1 + 60, + }, + [WIN_STATS_NAME_GENDER] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 2, + .width = 12, + .height = 4, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40, + }, + [WIN_STATS_LEFT] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 6, + .width = 12, + .height = 8, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48, + }, + [WIN_STATS_NAVIGATION_BUTTONS] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 18, + .width = 12, + .height = 2, + .paletteNum = 15, + .baseBlock = 1 + 60 + 40 + 48 + 96, + }, + [WIN_STATS_MOVES_TOP] = + { + .bg = 2, + .tilemapLeft = 12, + .tilemapTop = 2, + .width = 18, + .height = 4, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24, + }, + [WIN_STATS_MOVES_DESCRIPTION] = + { + .bg = 2, + .tilemapLeft = 12, + .tilemapTop = 6, + .width = 18, + .height = 4, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 72, + }, + [WIN_STATS_MOVES_BOTTOM] = + { + .bg = 2, + .tilemapLeft = 12, + .tilemapTop = 10, + .width = 18, + .height = 2, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 72 + 72, + }, + [WIN_STATS_ABILITIES] = + { + .bg = 2, + .tilemapLeft = 12, + .tilemapTop = 12, + .width = 18, + .height = 8, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 72 + 72 + 36, + }, + [WIN_STATS_LEFT_UNUSED] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 14, + .width = 12, + .height = 4, + .paletteNum = 0, + .baseBlock = 1 + 60 + 40 + 48 + 96 + 24 + 72 + 72 + 36 + 144, + }, + DUMMY_WIN_TEMPLATE +}; + +static const struct BgTemplate sNewEntryInfoScreen_BgTemplate[] = +{ + { + .bg = 2, + .charBaseIndex = 2, + .mapBaseIndex = 14, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 1, + .mapBaseIndex = 15, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + }, +}; + +static const struct WindowTemplate sNewEntryInfoScreen_WindowTemplates[] = +{ + [WIN_INFO] = + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 0, + .width = 32, + .height = 20, + .paletteNum = 0, + .baseBlock = 1, + }, + [WIN_FOOTPRINT] = + { + .bg = 2, + .tilemapLeft = 15, //HGSSS_Ui + .tilemapTop = 7, //HGSSS_Ui + .width = 2, + .height = 2, + .paletteNum = 15, + .baseBlock = 641, + }, + DUMMY_WIN_TEMPLATE +}; + + + + + + + + + +// First character in range followed by number of characters in range for upper and lowercase +static const u8 sLetterSearchRanges[][4] = +{ + {}, // Name not specified, shouldn't be reached + [NAME_ABC] = {CHAR_A, 3, CHAR_a, 3}, + [NAME_DEF] = {CHAR_D, 3, CHAR_d, 3}, + [NAME_GHI] = {CHAR_G, 3, CHAR_g, 3}, + [NAME_JKL] = {CHAR_J, 3, CHAR_j, 3}, + [NAME_MNO] = {CHAR_M, 3, CHAR_m, 3}, + [NAME_PQR] = {CHAR_P, 3, CHAR_p, 3}, + [NAME_STU] = {CHAR_S, 3, CHAR_s, 3}, + [NAME_VWX] = {CHAR_V, 3, CHAR_v, 3}, + [NAME_YZ] = {CHAR_Y, 2, CHAR_y, 2}, +}; + +#define LETTER_IN_RANGE_UPPER(letter, range) \ + ((letter) >= sLetterSearchRanges[range][0] \ + && (letter) < sLetterSearchRanges[range][0] + sLetterSearchRanges[range][1]) \ + +#define LETTER_IN_RANGE_LOWER(letter, range) \ + ((letter) >= sLetterSearchRanges[range][2] \ + && (letter) < sLetterSearchRanges[range][2] + sLetterSearchRanges[range][3]) \ + +static const struct SearchMenuTopBarItem sSearchMenuTopBarItems[SEARCH_TOPBAR_COUNT] = +{ + [SEARCH_TOPBAR_SEARCH] = + { + .description = gText_SearchForPkmnBasedOnParameters, + .highlightX = 0, + .highlightY = 0, + .highlightWidth = 5, + }, + [SEARCH_TOPBAR_SHIFT] = + { + .description = gText_SwitchPokedexListings, + .highlightX = 6, + .highlightY = 0, + .highlightWidth = 5, + }, + [SEARCH_TOPBAR_CANCEL] = + { + .description = gText_ReturnToPokedex, + .highlightX = 12, + .highlightY = 0, + .highlightWidth = 5, + }, +}; + +static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = +{ + [SEARCH_NAME] = + { + .description = gText_ListByFirstLetter, + .titleBgX = 0, + .titleBgY = 2, + .titleBgWidth = 5, + .selectionBgX = 5, + .selectionBgY = 2, + .selectionBgWidth = 12, + }, + [SEARCH_COLOR] = + { + .description = gText_ListByBodyColor, + .titleBgX = 0, + .titleBgY = 4, + .titleBgWidth = 5, + .selectionBgX = 5, + .selectionBgY = 4, + .selectionBgWidth = 12, + }, + [SEARCH_TYPE_LEFT] = + { + .description = gText_ListByType, + .titleBgX = 0, + .titleBgY = 6, + .titleBgWidth = 5, + .selectionBgX = 5, + .selectionBgY = 6, + .selectionBgWidth = 6, + }, + [SEARCH_TYPE_RIGHT] = + { + .description = gText_ListByType, + .titleBgX = 0, + .titleBgY = 6, + .titleBgWidth = 5, + .selectionBgX = 11, + .selectionBgY = 6, + .selectionBgWidth = 6, + }, + [SEARCH_ORDER] = + { + .description = gText_SelectPokedexListingMode, + .titleBgX = 0, + .titleBgY = 8, + .titleBgWidth = 5, + .selectionBgX = 5, + .selectionBgY = 8, + .selectionBgWidth = 12, + }, + [SEARCH_MODE] = + { + .description = gText_SelectPokedexMode, + .titleBgX = 0, + .titleBgY = 10, + .titleBgWidth = 5, + .selectionBgX = 5, + .selectionBgY = 10, + .selectionBgWidth = 12, + }, + [SEARCH_OK] = + { + .description = gText_ExecuteSearchSwitch, + .titleBgX = 0, + .titleBgY = 12, + .titleBgWidth = 5, + .selectionBgX = 0, + .selectionBgY = 0, + .selectionBgWidth = 0, + }, +}; + +// Left, Right, Up, Down +static const u8 sSearchMovementMap_SearchNatDex[SEARCH_COUNT][4] = +{ + [SEARCH_NAME] = + { + 0xFF, + 0xFF, + 0xFF, + SEARCH_COLOR + }, + [SEARCH_COLOR] = + { + 0xFF, + 0xFF, + SEARCH_NAME, + SEARCH_TYPE_LEFT + }, + [SEARCH_TYPE_LEFT] = + { + 0xFF, + SEARCH_TYPE_RIGHT, + SEARCH_COLOR, + SEARCH_ORDER + }, + [SEARCH_TYPE_RIGHT] = + { SEARCH_TYPE_LEFT, + 0xFF, + SEARCH_COLOR, + SEARCH_ORDER + }, + [SEARCH_ORDER] = + { + 0xFF, + 0xFF, + SEARCH_TYPE_LEFT, + SEARCH_MODE + }, + [SEARCH_MODE] = + { + 0xFF, + 0xFF, + SEARCH_ORDER, + SEARCH_OK + }, + [SEARCH_OK] = + { + 0xFF, + 0xFF, + SEARCH_MODE, + 0xFF + }, +}; + +// Left, Right, Up, Down +static const u8 sSearchMovementMap_ShiftNatDex[SEARCH_COUNT][4] = +{ + [SEARCH_NAME] = + { + 0xFF, + 0xFF, + 0xFF, + 0xFF + }, + [SEARCH_COLOR] = + { + 0xFF, + 0xFF, + 0xFF, + 0xFF + }, + [SEARCH_TYPE_LEFT] = + { + 0xFF, + 0xFF, + 0xFF, + 0xFF + }, + [SEARCH_TYPE_RIGHT] = + { + 0xFF, + 0xFF, + 0xFF, + 0xFF + }, + [SEARCH_ORDER] = + { + 0xFF, + 0xFF, + 0xFF, + SEARCH_MODE + }, + [SEARCH_MODE] = + { + 0xFF, + 0xFF, + SEARCH_ORDER, + SEARCH_OK + }, + [SEARCH_OK] = + { + 0xFF, + 0xFF, + SEARCH_MODE, + 0xFF + }, +}; + +// Left, Right, Up, Down +static const u8 sSearchMovementMap_SearchHoennDex[SEARCH_COUNT][4] = +{ + [SEARCH_NAME] = + { + 0xFF, + 0xFF, + 0xFF, + SEARCH_COLOR + }, + [SEARCH_COLOR] = + { + 0xFF, + 0xFF, + SEARCH_NAME, + SEARCH_TYPE_LEFT + }, + [SEARCH_TYPE_LEFT] = + { + 0xFF, + SEARCH_TYPE_RIGHT, + SEARCH_COLOR, + SEARCH_ORDER + }, + [SEARCH_TYPE_RIGHT] = + { SEARCH_TYPE_LEFT, + 0xFF, + SEARCH_COLOR, + SEARCH_ORDER + }, + [SEARCH_ORDER] = + { + 0xFF, + 0xFF, + SEARCH_TYPE_LEFT, + SEARCH_OK + }, + [SEARCH_MODE] = + { + 0xFF, + 0xFF, + 0xFF, + 0xFF + }, + [SEARCH_OK] = + { + 0xFF, + 0xFF, + SEARCH_ORDER, + 0xFF + }, +}; + +// Left, Right, Up, Down +static const u8 sSearchMovementMap_ShiftHoennDex[SEARCH_COUNT][4] = +{ + [SEARCH_NAME] = + { + 0xFF, + 0xFF, + 0xFF, + 0xFF + }, + [SEARCH_COLOR] = + { + 0xFF, + 0xFF, + 0xFF, + 0xFF + }, + [SEARCH_TYPE_LEFT] = + { + 0xFF, + 0xFF, + 0xFF, + 0xFF + }, + [SEARCH_TYPE_RIGHT] = + { + 0xFF, + 0xFF, + 0xFF, + 0xFF + }, + [SEARCH_ORDER] = + { + 0xFF, + 0xFF, + 0xFF, + SEARCH_OK + }, + [SEARCH_MODE] = + { + 0xFF, + 0xFF, + 0xFF, + 0xFF + }, + [SEARCH_OK] = + { + 0xFF, + 0xFF, + SEARCH_ORDER, + 0xFF + }, +}; + +static const struct SearchOptionText sDexModeOptions[] = +{ + [DEX_MODE_HOENN] = {gText_DexHoennDescription, gText_DexHoennTitle}, + [DEX_MODE_NATIONAL] = {gText_DexNatDescription, gText_DexNatTitle}, + {}, +}; + +static const struct SearchOptionText sDexOrderOptions[] = +{ + [ORDER_NUMERICAL] = {gText_DexSortNumericalDescription, gText_DexSortNumericalTitle}, + [ORDER_ALPHABETICAL] = {gText_DexSortAtoZDescription, gText_DexSortAtoZTitle}, + [ORDER_HEAVIEST] = {gText_DexSortHeaviestDescription, gText_DexSortHeaviestTitle}, + [ORDER_LIGHTEST] = {gText_DexSortLightestDescription, gText_DexSortLightestTitle}, + [ORDER_TALLEST] = {gText_DexSortTallestDescription, gText_DexSortTallestTitle}, + [ORDER_SMALLEST] = {gText_DexSortSmallestDescription, gText_DexSortSmallestTitle}, + {}, +}; + +static const struct SearchOptionText sDexSearchNameOptions[] = +{ + {gText_DexEmptyString, gText_DexSearchDontSpecify}, + [NAME_ABC] = {gText_DexEmptyString, gText_DexSearchAlphaABC}, + [NAME_DEF] = {gText_DexEmptyString, gText_DexSearchAlphaDEF}, + [NAME_GHI] = {gText_DexEmptyString, gText_DexSearchAlphaGHI}, + [NAME_JKL] = {gText_DexEmptyString, gText_DexSearchAlphaJKL}, + [NAME_MNO] = {gText_DexEmptyString, gText_DexSearchAlphaMNO}, + [NAME_PQR] = {gText_DexEmptyString, gText_DexSearchAlphaPQR}, + [NAME_STU] = {gText_DexEmptyString, gText_DexSearchAlphaSTU}, + [NAME_VWX] = {gText_DexEmptyString, gText_DexSearchAlphaVWX}, + [NAME_YZ] = {gText_DexEmptyString, gText_DexSearchAlphaYZ}, + {}, +}; + +static const struct SearchOptionText sDexSearchColorOptions[] = +{ + {gText_DexEmptyString, gText_DexSearchDontSpecify}, + [BODY_COLOR_RED + 1] = {gText_DexEmptyString, gText_DexSearchColorRed}, + [BODY_COLOR_BLUE + 1] = {gText_DexEmptyString, gText_DexSearchColorBlue}, + [BODY_COLOR_YELLOW + 1] = {gText_DexEmptyString, gText_DexSearchColorYellow}, + [BODY_COLOR_GREEN + 1] = {gText_DexEmptyString, gText_DexSearchColorGreen}, + [BODY_COLOR_BLACK + 1] = {gText_DexEmptyString, gText_DexSearchColorBlack}, + [BODY_COLOR_BROWN + 1] = {gText_DexEmptyString, gText_DexSearchColorBrown}, + [BODY_COLOR_PURPLE + 1] = {gText_DexEmptyString, gText_DexSearchColorPurple}, + [BODY_COLOR_GRAY + 1] = {gText_DexEmptyString, gText_DexSearchColorGray}, + [BODY_COLOR_WHITE + 1] = {gText_DexEmptyString, gText_DexSearchColorWhite}, + [BODY_COLOR_PINK + 1] = {gText_DexEmptyString, gText_DexSearchColorPink}, + {}, +}; + +static const struct SearchOptionText sDexSearchTypeOptions[NUMBER_OF_MON_TYPES + 1] = // + 2 for "None" and terminator, - 1 for Mystery +{ + {gText_DexEmptyString, gText_DexSearchTypeNone}, + {gText_DexEmptyString, gTypeNames[TYPE_NORMAL]}, + {gText_DexEmptyString, gTypeNames[TYPE_FIGHTING]}, + {gText_DexEmptyString, gTypeNames[TYPE_FLYING]}, + {gText_DexEmptyString, gTypeNames[TYPE_POISON]}, + {gText_DexEmptyString, gTypeNames[TYPE_GROUND]}, + {gText_DexEmptyString, gTypeNames[TYPE_ROCK]}, + {gText_DexEmptyString, gTypeNames[TYPE_BUG]}, + {gText_DexEmptyString, gTypeNames[TYPE_GHOST]}, + {gText_DexEmptyString, gTypeNames[TYPE_STEEL]}, + {gText_DexEmptyString, gTypeNames[TYPE_FIRE]}, + {gText_DexEmptyString, gTypeNames[TYPE_WATER]}, + {gText_DexEmptyString, gTypeNames[TYPE_GRASS]}, + {gText_DexEmptyString, gTypeNames[TYPE_ELECTRIC]}, + {gText_DexEmptyString, gTypeNames[TYPE_PSYCHIC]}, + {gText_DexEmptyString, gTypeNames[TYPE_ICE]}, + {gText_DexEmptyString, gTypeNames[TYPE_DRAGON]}, + {gText_DexEmptyString, gTypeNames[TYPE_DARK]}, + #ifdef BATTLE_ENGINE + {gText_DexEmptyString, gTypeNames[TYPE_FAIRY]}, + #endif + {}, +}; + +static const u8 sPokedexModes[] = {DEX_MODE_HOENN, DEX_MODE_NATIONAL}; +static const u8 sOrderOptions[] = +{ + ORDER_NUMERICAL, + ORDER_ALPHABETICAL, + ORDER_HEAVIEST, + ORDER_LIGHTEST, + ORDER_TALLEST, + ORDER_SMALLEST, +}; + +static const u8 sDexSearchTypeIds[NUMBER_OF_MON_TYPES] = +{ + TYPE_NONE, + TYPE_NORMAL, + TYPE_FIGHTING, + TYPE_FLYING, + TYPE_POISON, + TYPE_GROUND, + TYPE_ROCK, + TYPE_BUG, + TYPE_GHOST, + TYPE_STEEL, + TYPE_FIRE, + TYPE_WATER, + TYPE_GRASS, + TYPE_ELECTRIC, + TYPE_PSYCHIC, + TYPE_ICE, + TYPE_DRAGON, + TYPE_DARK, + #ifdef BATTLE_ENGINE + TYPE_FAIRY, + #endif +}; + +// Number pairs are the task data for tracking the cursor pos and scroll offset of each option list +// See task data defines above Task_LoadSearchMenu +static const struct SearchOption sSearchOptions[] = +{ + [SEARCH_NAME] = {sDexSearchNameOptions, 6, 7, ARRAY_COUNT(sDexSearchNameOptions) - 1}, + [SEARCH_COLOR] = {sDexSearchColorOptions, 8, 9, ARRAY_COUNT(sDexSearchColorOptions) - 1}, + [SEARCH_TYPE_LEFT] = {sDexSearchTypeOptions, 10, 11, ARRAY_COUNT(sDexSearchTypeOptions) - 1}, + [SEARCH_TYPE_RIGHT] = {sDexSearchTypeOptions, 12, 13, ARRAY_COUNT(sDexSearchTypeOptions) - 1}, + [SEARCH_ORDER] = {sDexOrderOptions, 4, 5, ARRAY_COUNT(sDexOrderOptions) - 1}, + [SEARCH_MODE] = {sDexModeOptions, 2, 3, ARRAY_COUNT(sDexModeOptions) - 1}, +}; + +static const struct BgTemplate sSearchMenu_BgTemplate[] = +{ + { + .bg = 0, + .charBaseIndex = 2, + .mapBaseIndex = 12, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 13, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 2, + .mapBaseIndex = 14, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 0, + .mapBaseIndex = 15, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + } +}; + +static const struct WindowTemplate sSearchMenu_WindowTemplate[] = +{ + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 0, + .width = 32, + .height = 20, + .paletteNum = 0, + .baseBlock = 0x0001, + }, + DUMMY_WIN_TEMPLATE +}; + + +//************************************ +//* * +//* MAIN * +//* * +//************************************ +void CB2_OpenPokedexPlusHGSS(void) +{ + switch (gMain.state) + { + case 0: + default: + SetVBlankCallback(NULL); + ResetOtherVideoRegisters(0); + DmaFillLarge16(3, 0, (u8 *)VRAM, VRAM_SIZE, 0x1000); + DmaClear32(3, OAM, OAM_SIZE); + DmaClear16(3, PLTT, PLTT_SIZE); + gMain.state = 1; + break; + case 1: + ScanlineEffect_Stop(); + ResetTasks(); + ResetSpriteData(); + ResetPaletteFade(); + FreeAllSpritePalettes(); + gReservedSpritePaletteCount = 8; + ResetAllPicSprites(); + gMain.state++; + break; + case 2: + sPokedexView = AllocZeroed(sizeof(struct PokedexView)); + ResetPokedexView(sPokedexView); + CreateTask(Task_OpenPokedexMainPage, 0); + sPokedexView->dexMode = gSaveBlock2Ptr->pokedex.mode; + if (!IsNationalPokedexEnabled()) + sPokedexView->dexMode = DEX_MODE_HOENN; + sPokedexView->dexOrder = gSaveBlock2Ptr->pokedex.order; + sPokedexView->selectedPokemon = sLastSelectedPokemon; + sPokedexView->pokeBallRotation = sPokeBallRotation; + sPokedexView->selectedScreen = AREA_SCREEN; + if (!IsNationalPokedexEnabled()) + { + sPokedexView->seenCount = GetHoennPokedexCount(FLAG_GET_SEEN); + sPokedexView->ownCount = GetHoennPokedexCount(FLAG_GET_CAUGHT); + } + else + { + sPokedexView->seenCount = GetNationalPokedexCount(FLAG_GET_SEEN); + sPokedexView->ownCount = GetNationalPokedexCount(FLAG_GET_CAUGHT); + } + sPokedexView->initialVOffset = 8; + gMain.state++; + break; + case 3: + EnableInterrupts(1); + SetVBlankCallback(VBlankCB_Pokedex); + SetMainCallback2(CB2_Pokedex); + CreatePokedexList(sPokedexView->dexMode, sPokedexView->dexOrder); + m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x80); + break; + } +} + +static void ResetPokedexView(struct PokedexView *pokedexView) +{ + u16 i; + + for (i = 0; i < NATIONAL_DEX_COUNT; i++) + { + pokedexView->pokedexList[i].dexNum = 0xFFFF; + pokedexView->pokedexList[i].seen = FALSE; + pokedexView->pokedexList[i].owned = FALSE; + } + pokedexView->pokedexList[NATIONAL_DEX_COUNT].dexNum = 0; + pokedexView->pokedexList[NATIONAL_DEX_COUNT].seen = FALSE; + pokedexView->pokedexList[NATIONAL_DEX_COUNT].owned = FALSE; + pokedexView->pokemonListCount = 0; + pokedexView->selectedPokemon = 0; + pokedexView->selectedPokemonBackup = 0; + pokedexView->dexMode = DEX_MODE_HOENN; + pokedexView->dexModeBackup = DEX_MODE_HOENN; + pokedexView->dexOrder = ORDER_NUMERICAL; + pokedexView->dexOrderBackup = ORDER_NUMERICAL; + pokedexView->seenCount = 0; + pokedexView->ownCount = 0; + for (i = 0; i < MAX_MONS_ON_SCREEN; i++) + pokedexView->monSpriteIds[i] = 0xFFFF; + pokedexView->pokeBallRotationStep = 0; + pokedexView->pokeBallRotationBackup = 0; + pokedexView->pokeBallRotation = 0; + pokedexView->initialVOffset = 0; + pokedexView->scrollTimer = 0; + pokedexView->scrollDirection = 0; + pokedexView->listVOffset = 0; + pokedexView->listMovingVOffset = 0; + pokedexView->scrollMonIncrement = 0; + pokedexView->maxScrollTimer = 0; + pokedexView->scrollSpeed = 0; + for (i = 0; i < ARRAY_COUNT(pokedexView->unkArr1); i++) + pokedexView->unkArr1[i] = 0; + pokedexView->currentPage = PAGE_MAIN; + pokedexView->currentPageBackup = PAGE_MAIN; + pokedexView->isSearchResults = FALSE; + pokedexView->selectedScreen = AREA_SCREEN; + pokedexView->screenSwitchState = 0; + pokedexView->menuIsOpen = 0; + pokedexView->menuCursorPos = 0; + pokedexView->menuY = 0; + for (i = 0; i < ARRAY_COUNT(pokedexView->unkArr2); i++) + pokedexView->unkArr2[i] = 0; + for (i = 0; i < ARRAY_COUNT(pokedexView->unkArr3); i++) + pokedexView->unkArr3[i] = 0; +} + +static void VBlankCB_Pokedex(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +static void CB2_Pokedex(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +void Task_OpenPokedexMainPage(u8 taskId) +{ + sPokedexView->isSearchResults = FALSE; + #ifdef POKEMON_EXPANSION + sPokedexView->sEvoScreenData.fromEvoPage = FALSE; + sPokedexView->formSpecies = 0; + #endif + if (LoadPokedexListPage(PAGE_MAIN)) + gTasks[taskId].func = Task_HandlePokedexInput; +} + +#define tLoadScreenTaskId data[0] + +static void Task_HandlePokedexInput(u8 taskId) +{ + SetGpuReg(REG_OFFSET_BG0VOFS, sPokedexView->menuY); + + if (sPokedexView->menuY) + { + sPokedexView->menuY -= 8; + if (sPokedexView->menuIsOpen == FALSE && sPokedexView->menuY == 8) //HGSS_Ui + { + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); + CreateStatBarsBg(); + } + } + else + { + if (JOY_NEW(A_BUTTON) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen) + { + TryDestroyStatBars(); //HGSS_Ui + UpdateSelectedMonSpriteId(); + BeginNormalPaletteFade(~(1 << (gSprites[sPokedexView->selectedMonSpriteId].oam.paletteNum + 16)), 0, 0, 0x10, RGB_BLACK); + gSprites[sPokedexView->selectedMonSpriteId].callback = SpriteCB_MoveMonForInfoScreen; + gTasks[taskId].func = Task_OpenInfoScreenAfterMonMovement; + PlaySE(SE_PIN); + FreeWindowAndBgBuffers(); + } + else if (JOY_NEW(START_BUTTON)) + { + TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBarsBg(); //HGSS_Ui + sPokedexView->menuY = 0; + sPokedexView->menuIsOpen = TRUE; + sPokedexView->menuCursorPos = 0; + gTasks[taskId].func = Task_HandlePokedexStartMenuInput; + PlaySE(SE_SELECT); + } + else if (JOY_NEW(SELECT_BUTTON)) + { + PlaySE(SE_SELECT); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].tLoadScreenTaskId = LoadSearchMenu(); + sPokedexView->screenSwitchState = 0; + sPokedexView->pokeBallRotationBackup = sPokedexView->pokeBallRotation; + sPokedexView->selectedPokemonBackup = sPokedexView->selectedPokemon; + sPokedexView->dexModeBackup = sPokedexView->dexMode; + sPokedexView->dexOrderBackup = sPokedexView->dexOrder; + gTasks[taskId].func = Task_WaitForExitSearch; + PlaySE(SE_PC_LOGIN); + FreeWindowAndBgBuffers(); + } + else if (JOY_NEW(B_BUTTON)) + { + TryDestroyStatBars(); //HGSS_Ui + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].func = Task_ClosePokedex; + PlaySE(SE_PC_OFF); + } + else + { + //Handle D-pad + sPokedexView->selectedPokemon = TryDoPokedexScroll(sPokedexView->selectedPokemon, 0xE); + if (sPokedexView->scrollTimer) + gTasks[taskId].func = Task_WaitForScroll; + else if (!sPokedexView->scrollTimer && !sPokedexView->scrollSpeed &&sPokedexView->justScrolled) //HGSS_Ui + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui + } + } +} + +static void Task_WaitForScroll(u8 taskId) +{ + TryDestroyStatBars(); //HGSS_Ui + if (UpdateDexListScroll(sPokedexView->scrollDirection, sPokedexView->scrollMonIncrement, sPokedexView->maxScrollTimer)) + gTasks[taskId].func = Task_HandlePokedexInput; +} + +static void Task_HandlePokedexStartMenuInput(u8 taskId) +{ + SetGpuReg(REG_OFFSET_BG0VOFS, sPokedexView->menuY); + + //If menu is not open, slide it up, on screen + if (sPokedexView->menuY != 80) + { + sPokedexView->menuY += 8; + } + else + { + if (JOY_NEW(A_BUTTON)) + { + switch (sPokedexView->menuCursorPos) + { + case 0: //BACK TO LIST + default: + gMain.newKeys |= START_BUTTON; //Exit menu + break; + case 1: //LIST TOP + sPokedexView->selectedPokemon = 0; + sPokedexView->pokeBallRotation = POKEBALL_ROTATION_TOP; + ClearMonSprites(); + CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); + gMain.newKeys |= START_BUTTON; //Exit menu + break; + case 2: //LIST BOTTOM + sPokedexView->selectedPokemon = sPokedexView->pokemonListCount - 1; + sPokedexView->pokeBallRotation = sPokedexView->pokemonListCount * 16 + POKEBALL_ROTATION_BOTTOM; + ClearMonSprites(); + CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); + gMain.newKeys |= START_BUTTON; //Exit menu + break; + case 3: //CLOSE POKEDEX + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].func = Task_ClosePokedex; + PlaySE(SE_PC_OFF); + break; + } + } + + //Exit menu when Start or B is pressed + if (JOY_NEW(START_BUTTON | B_BUTTON)) + { + sPokedexView->menuIsOpen = FALSE; + gTasks[taskId].func = Task_HandlePokedexInput; + PlaySE(SE_SELECT); + } + else if (JOY_REPEAT(DPAD_UP) && sPokedexView->menuCursorPos != 0) + { + sPokedexView->menuCursorPos--; + PlaySE(SE_SELECT); + } + else if (JOY_REPEAT(DPAD_DOWN) && sPokedexView->menuCursorPos < 3) + { + sPokedexView->menuCursorPos++; + PlaySE(SE_SELECT); + } + } +} + +// Opening the info screen from list view. Pokémon sprite is moving to its new position, wait for it to arrive +static void Task_OpenInfoScreenAfterMonMovement(u8 taskId) +{ + if (gSprites[sPokedexView->selectedMonSpriteId].x == MON_PAGE_X && gSprites[sPokedexView->selectedMonSpriteId].y == MON_PAGE_Y) + { + sPokedexView->currentPageBackup = sPokedexView->currentPage; + gTasks[taskId].tLoadScreenTaskId = LoadInfoScreen(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], sPokedexView->selectedMonSpriteId); + gTasks[taskId].func = Task_WaitForExitInfoScreen; + } +} + +static void Task_WaitForExitInfoScreen(u8 taskId) +{ + if (gTasks[gTasks[taskId].tLoadScreenTaskId].isActive) + { + // While active, handle scroll input + if (sPokedexView->currentPage == PAGE_INFO && !IsInfoScreenScrolling(gTasks[taskId].tLoadScreenTaskId) && TryDoInfoScreenScroll()) + StartInfoScreenScroll(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], gTasks[taskId].tLoadScreenTaskId); + } + else + { + // Exiting, back to list view + sLastSelectedPokemon = sPokedexView->selectedPokemon; + sPokeBallRotation = sPokedexView->pokeBallRotation; + gTasks[taskId].func = Task_OpenPokedexMainPage; + } +} + + +static void Task_ClosePokedex(u8 taskId) +{ + if (!gPaletteFade.active) + { + gSaveBlock2Ptr->pokedex.mode = sPokedexView->dexMode; + if (!IsNationalPokedexEnabled()) + gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN; + gSaveBlock2Ptr->pokedex.order = sPokedexView->dexOrder; + ClearMonSprites(); + FreeWindowAndBgBuffers(); + DestroyTask(taskId); + SetMainCallback2(CB2_ReturnToFieldWithOpenMenu); + m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100); + Free(sPokedexView); + } +} + +static void LoadPokedexBgPalette(bool8 isSearchResults) +{ + if (!HGSS_DARK_MODE) + { + if (isSearchResults == TRUE) + LoadPalette(gPokedexPlusHGSS_SearchResults_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); + else if (!IsNationalPokedexEnabled()) + LoadPalette(gPokedexPlusHGSS_Default_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); + else + LoadPalette(gPokedexPlusHGSS_National_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); + LoadPalette(GetOverworldTextboxPalettePtr(), 0xF0, 32); + } + else + { + if (isSearchResults == TRUE) + LoadPalette(gPokedexPlusHGSS_SearchResults_dark_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); + else if (!IsNationalPokedexEnabled()) + LoadPalette(gPokedexPlusHGSS_Default_dark_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); + else + LoadPalette(gPokedexPlusHGSS_National_dark_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1)); + LoadPalette(GetOverworldTextboxPalettePtr(), 0xF0, 32); + } + +} + + +//************************************ +//* * +//* Main scrolling list screen * +//* * +//************************************ + +// For loading main pokedex page or pokedex search results +static bool8 LoadPokedexListPage(u8 page) +{ + switch (gMain.state) + { + case 0: + default: + if (gPaletteFade.active) + return 0; + SetVBlankCallback(NULL); + sPokedexView->currentPage = page; + ResetOtherVideoRegisters(0); + SetGpuReg(REG_OFFSET_BG2VOFS, sPokedexView->initialVOffset); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, sPokedex_BgTemplate, ARRAY_COUNT(sPokedex_BgTemplate)); + SetBgTilemapBuffer(3, AllocZeroed(BG_SCREEN_SIZE)); + SetBgTilemapBuffer(2, AllocZeroed(BG_SCREEN_SIZE)); + SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE)); + SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE)); + if (!HGSS_DECAPPED) + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_MenuList_Gfx, 0x2000, 0, 0); + else + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_MenuList_DECA_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(1, gPokedexPlusHGSS_ScreenList_Tilemap, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenListUnderlay_Tilemap, 0, 0); + if (page == PAGE_MAIN) + CopyToBgTilemapBuffer(0, gPokedexPlusHGSS_StartMenuMain_Tilemap, 0, 0x280); + else + CopyToBgTilemapBuffer(0, gPokedexPlusHGSS_StartMenuSearchResults_Tilemap, 0, 0x280); + ResetPaletteFade(); + if (page == PAGE_MAIN) + sPokedexView->isSearchResults = FALSE; + else + sPokedexView->isSearchResults = TRUE; + LoadPokedexBgPalette(sPokedexView->isSearchResults); + InitWindows(sPokemonList_WindowTemplate); + DeactivateAllTextPrinters(); + PutWindowTilemap(0); + CopyWindowToVram(0, COPYWIN_FULL); + gMain.state = 1; + break; + case 1: + ResetSpriteData(); + FreeAllSpritePalettes(); + gReservedSpritePaletteCount = 8; + LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[HGSS_DECAPPED]); + LoadSpritePalettes(sInterfaceSpritePalette); + LoadSpritePalettes(sStatBarSpritePal); //HGSS_Ui + CreateInterfaceSprites(page); + gMain.state++; + break; + case 2: + gMain.state++; + break; + case 3: + if (page == PAGE_MAIN) + CreatePokedexList(sPokedexView->dexMode, sPokedexView->dexOrder); + CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); + sPokedexView->statBarsSpriteId = 0xFF; //HGSS_Ui stat bars + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui stat bars + sPokedexView->statBarsBgSpriteId = 0xFF; //HGSS_Ui stat bars background + CreateStatBarsBg(); //HGSS_Ui stat bars background + sPokedexView->menuIsOpen = FALSE; + sPokedexView->menuY = 0; + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + gMain.state++; + break; + case 4: + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); + SetVBlankCallback(VBlankCB_Pokedex); + gMain.state++; + break; + case 5: + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_ALL | WININ_WIN1_ALL); + SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_ALL | WINOUT_WINOBJ_BG0 | WINOUT_WINOBJ_BG2 | WINOUT_WINOBJ_BG3 | WINOUT_WINOBJ_OBJ); + SetGpuReg(REG_OFFSET_WIN0H, 0); + SetGpuReg(REG_OFFSET_WIN0V, 0); + SetGpuReg(REG_OFFSET_WIN1H, 0); + SetGpuReg(REG_OFFSET_WIN1V, 0); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON | DISPCNT_OBJWIN_ON); + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 6: + if (!gPaletteFade.active) + { + gMain.state = 0; + return TRUE; + } + break; + } + return FALSE; +} + +static void CreatePokedexList(u8 dexMode, u8 order) +{ + u16 vars[3]; //I have no idea why three regular variables are stored in an array, but whatever. +#define temp_dexCount vars[0] +#define temp_isHoennDex vars[1] +#define temp_dexNum vars[2] + s16 i; + + sPokedexView->pokemonListCount = 0; + + switch (dexMode) + { + default: + case DEX_MODE_HOENN: + temp_dexCount = HOENN_DEX_COUNT; + temp_isHoennDex = TRUE; + break; + case DEX_MODE_NATIONAL: + if (IsNationalPokedexEnabled()) + { + temp_dexCount = NATIONAL_DEX_COUNT; + temp_isHoennDex = FALSE; + } + else + { + temp_dexCount = HOENN_DEX_COUNT; + temp_isHoennDex = TRUE; + } + break; + } + + switch (order) + { + case ORDER_NUMERICAL: + if (temp_isHoennDex) + { + for (i = 0; i < temp_dexCount; i++) + { + temp_dexNum = HoennToNationalOrder(i + 1); + sPokedexView->pokedexList[i].dexNum = temp_dexNum; + sPokedexView->pokedexList[i].seen = GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN); + sPokedexView->pokedexList[i].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT); + if (sPokedexView->pokedexList[i].seen) + sPokedexView->pokemonListCount = i + 1; + } + } + else + { + s16 r5, r10; + for (i = 0, r5 = 0, r10 = 0; i < temp_dexCount; i++) + { + temp_dexNum = i + 1; + if (GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN)) + r10 = 1; + if (r10) + { + sPokedexView->pokedexList[r5].dexNum = temp_dexNum; + sPokedexView->pokedexList[r5].seen = GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN); + sPokedexView->pokedexList[r5].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT); + if (sPokedexView->pokedexList[r5].seen) + sPokedexView->pokemonListCount = r5 + 1; + r5++; + } + } + } + break; + case ORDER_ALPHABETICAL: + for (i = 0; i < NUM_SPECIES - 1; i++) + { + temp_dexNum = gPokedexOrder_Alphabetical[i]; + + if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN)) + { + sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT); + sPokedexView->pokemonListCount++; + } + } + break; + case ORDER_HEAVIEST: + for (i = NATIONAL_DEX_COUNT - 1; i >= 0; i--) + { + temp_dexNum = gPokedexOrder_Weight[i]; + + if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT)) + { + sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE; + sPokedexView->pokemonListCount++; + } + } + break; + case ORDER_LIGHTEST: + for (i = 0; i < NATIONAL_DEX_COUNT; i++) + { + temp_dexNum = gPokedexOrder_Weight[i]; + + if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT)) + { + sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE; + sPokedexView->pokemonListCount++; + } + } + break; + case ORDER_TALLEST: + for (i = NATIONAL_DEX_COUNT - 1; i >= 0; i--) + { + temp_dexNum = gPokedexOrder_Height[i]; + + if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT)) + { + sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE; + sPokedexView->pokemonListCount++; + } + } + break; + case ORDER_SMALLEST: + for (i = 0; i < NATIONAL_DEX_COUNT; i++) + { + temp_dexNum = gPokedexOrder_Height[i]; + + if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT)) + { + sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE; + sPokedexView->pokemonListCount++; + } + } + break; + } + + for (i = sPokedexView->pokemonListCount; i < NATIONAL_DEX_COUNT; i++) + { + sPokedexView->pokedexList[i].dexNum = 0xFFFF; + sPokedexView->pokedexList[i].seen = FALSE; + sPokedexView->pokedexList[i].owned = FALSE; + } +} + +static void PrintMonDexNumAndName(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top) +{ + u8 color[3]; + + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_DYNAMIC_COLOR_6; + color[2] = TEXT_COLOR_LIGHT_GRAY; + AddTextPrinterParameterized4(windowId, fontId, left * 8, (top * 8) + 1, 0, 0, color, TEXT_SKIP_DRAW, str); +} + +static void PrintMonDexNumAndName_2(u8 windowId, u8 fontId, const u8* str, u8 left, u8 top) //HGSS_Ui offset for closer numer + text +{ + u8 color[3]; + + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_DYNAMIC_COLOR_6; + color[2] = TEXT_COLOR_LIGHT_GRAY; + AddTextPrinterParameterized4(windowId, fontId, left * 8 - 3, (top * 8) + 1, 0, 0, color, -1, str); +} + +// u16 ignored is passed but never used +#define MON_LIST_X 2 +static void CreateMonListEntry(u8 position, u16 b, u16 ignored) +{ + s16 entryNum; + u16 i; + u16 vOffset; + + switch (position) + { + case 0: // Initial + default: + entryNum = b - 5; + for (i = 0; i <= 10; i++) + { + if (entryNum < 0 || entryNum >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[entryNum].dexNum == 0xFFFF) + { + ClearMonListEntry(MON_LIST_X, i * 2, ignored); + } + else + { + ClearMonListEntry(MON_LIST_X, i * 2, ignored); + if (sPokedexView->pokedexList[entryNum].seen) + { + CreateMonDexNum(entryNum, MON_LIST_X+1, i * 2, ignored); + CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, MON_LIST_X, i * 2, ignored); + CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, MON_LIST_X+5, i * 2); + } + else + { + CreateMonDexNum(entryNum, MON_LIST_X+1, i * 2, ignored); + CreateCaughtBall(FALSE, MON_LIST_X, i * 2, ignored); + CreateMonName(0, MON_LIST_X+5, i * 2); + } + } + entryNum++; + } + break; + case 1: // Up + entryNum = b - 5; + if (entryNum < 0 || entryNum >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[entryNum].dexNum == 0xFFFF) + { + ClearMonListEntry(MON_LIST_X, sPokedexView->listVOffset * 2, ignored); + } + else + { + ClearMonListEntry(MON_LIST_X, sPokedexView->listVOffset * 2, ignored); + if (sPokedexView->pokedexList[entryNum].seen) + { + CreateMonDexNum(entryNum, MON_LIST_X+1, sPokedexView->listVOffset * 2, ignored); + CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, MON_LIST_X, sPokedexView->listVOffset * 2, ignored); + CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, MON_LIST_X+5, sPokedexView->listVOffset * 2); + } + else + { + CreateMonDexNum(entryNum, MON_LIST_X+1, sPokedexView->listVOffset * 2, ignored); + CreateCaughtBall(FALSE, MON_LIST_X, sPokedexView->listVOffset * 2, ignored); + CreateMonName(0, MON_LIST_X+5, sPokedexView->listVOffset * 2); + } + } + break; + case 2: // Down + entryNum = b + 5; + vOffset = sPokedexView->listVOffset + 10; + if (vOffset >= LIST_SCROLL_STEP) + vOffset -= LIST_SCROLL_STEP; + if (entryNum < 0 || entryNum >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[entryNum].dexNum == 0xFFFF) + ClearMonListEntry(MON_LIST_X, vOffset * 2, ignored); + else + { + ClearMonListEntry(MON_LIST_X, vOffset * 2, ignored); + if (sPokedexView->pokedexList[entryNum].seen) + { + CreateMonDexNum(entryNum, MON_LIST_X+1, vOffset * 2, ignored); + CreateCaughtBall(sPokedexView->pokedexList[entryNum].owned, MON_LIST_X, vOffset * 2, ignored); + CreateMonName(sPokedexView->pokedexList[entryNum].dexNum, MON_LIST_X+5, vOffset * 2); + } + else + { + CreateMonDexNum(entryNum, MON_LIST_X+1, vOffset * 2, ignored); + CreateCaughtBall(FALSE, MON_LIST_X, vOffset * 2, ignored); + CreateMonName(0, MON_LIST_X+5, vOffset * 2); + } + } + break; + } + CopyWindowToVram(0, COPYWIN_GFX); +} + +static void CreateMonDexNum(u16 entryNum, u8 left, u8 top, u16 unused) +{ + u8 text[6]; + u16 dexNum; + + memcpy(text, sText_No000, ARRAY_COUNT(text)); + dexNum = sPokedexView->pokedexList[entryNum].dexNum; + if (sPokedexView->dexMode == DEX_MODE_HOENN) + dexNum = NationalToHoennOrder(dexNum); + text[2] = CHAR_0 + dexNum / 100; + text[3] = CHAR_0 + (dexNum % 100) / 10; + text[4] = CHAR_0 + (dexNum % 100) % 10; + PrintMonDexNumAndName(0, FONT_NARROW, text, left, top); +} + +static void CreateCaughtBall(bool16 owned, u8 x, u8 y, u16 unused) +{ + if (owned) + BlitBitmapToWindow(0, sCaughtBall_Gfx, x * 8, y * 8, 8, 16); + else + FillWindowPixelRect(0, PIXEL_FILL(0), x * 8, y * 8, 8, 16); +} + +static u8 CreateMonName(u16 num, u8 left, u8 top) +{ + const u8 *str; + + num = NationalPokedexNumToSpecies(num); + if (num) + str = gSpeciesNames[num]; + else + str = sText_TenDashes; + PrintMonDexNumAndName_2(0, FONT_NARROW, str, left, top); + return StringLength(str); +} + +static void ClearMonListEntry(u8 x, u8 y, u16 unused) +{ + FillWindowPixelRect(0, PIXEL_FILL(0), x * 8, y * 8, 0x60, 16); +} + +// u16 ignored is passed but never used +static void CreateMonSpritesAtPos(u16 selectedMon, u16 ignored) +{ + u8 i; + u16 dexNum; + u8 spriteId; + + gPaletteFade.bufferTransferDisabled = TRUE; + + for (i = 0; i < MAX_MONS_ON_SCREEN; i++) + sPokedexView->monSpriteIds[i] = 0xFFFF; + sPokedexView->selectedMonSpriteId = 0xFFFF; + + // Create top mon sprite + dexNum = GetPokemonSpriteToDisplay(selectedMon - 1); + if (dexNum != 0xFFFF) + { + spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); + gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; + gSprites[spriteId].data[5] = -32; + } + + // Create mid mon sprite + dexNum = GetPokemonSpriteToDisplay(selectedMon); + if (dexNum != 0xFFFF) + { + spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); + gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; + gSprites[spriteId].data[5] = 0; + } + + // Create bottom mon sprite + dexNum = GetPokemonSpriteToDisplay(selectedMon + 1); + if (dexNum != 0xFFFF) + { + spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); + gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; + gSprites[spriteId].data[5] = 32; + } + + CreateMonListEntry(0, selectedMon, ignored); + SetGpuReg(REG_OFFSET_BG2VOFS, sPokedexView->initialVOffset); + + sPokedexView->listVOffset = 0; + sPokedexView->listMovingVOffset = 0; + + gPaletteFade.bufferTransferDisabled = FALSE; +} + +static bool8 UpdateDexListScroll(u8 direction, u8 monMoveIncrement, u8 scrollTimerMax) +{ + u16 i; + u8 step; + + if (sPokedexView->scrollTimer) + { + sPokedexView->scrollTimer--; + switch (direction) + { + case 1: // Up + for (i = 0; i < MAX_MONS_ON_SCREEN; i++) + { + if (sPokedexView->monSpriteIds[i] != 0xFFFF) + gSprites[sPokedexView->monSpriteIds[i]].data[5] += monMoveIncrement; + } + step = LIST_SCROLL_STEP * (scrollTimerMax - sPokedexView->scrollTimer) / scrollTimerMax; + SetGpuReg(REG_OFFSET_BG2VOFS, sPokedexView->initialVOffset + sPokedexView->listMovingVOffset * LIST_SCROLL_STEP - step); + sPokedexView->pokeBallRotation -= sPokedexView->pokeBallRotationStep; + break; + case 2: // Down + for (i = 0; i < MAX_MONS_ON_SCREEN; i++) + { + if (sPokedexView->monSpriteIds[i] != 0xFFFF) + gSprites[sPokedexView->monSpriteIds[i]].data[5] -= monMoveIncrement; + } + step = LIST_SCROLL_STEP * (scrollTimerMax - sPokedexView->scrollTimer) / scrollTimerMax; + SetGpuReg(REG_OFFSET_BG2VOFS, sPokedexView->initialVOffset + sPokedexView->listMovingVOffset * LIST_SCROLL_STEP + step); + sPokedexView->pokeBallRotation += sPokedexView->pokeBallRotationStep; + break; + } + return FALSE; + } + else + { + SetGpuReg(REG_OFFSET_BG2VOFS, sPokedexView->initialVOffset + sPokedexView->listVOffset * LIST_SCROLL_STEP); + return TRUE; + } +} + +static void CreateScrollingPokemonSprite(u8 direction, u16 selectedMon) +{ + u16 dexNum; + u8 spriteId; + + sPokedexView->listMovingVOffset = sPokedexView->listVOffset; + switch (direction) + { + case 1: // up + dexNum = GetPokemonSpriteToDisplay(selectedMon - 1); + if (dexNum != 0xFFFF) + { + spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); + gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; + gSprites[spriteId].data[5] = -64; + } + if (sPokedexView->listVOffset > 0) + sPokedexView->listVOffset--; + else + sPokedexView->listVOffset = LIST_SCROLL_STEP - 1; + break; + case 2: // down + dexNum = GetPokemonSpriteToDisplay(selectedMon + 1); + if (dexNum != 0xFFFF) + { + spriteId = CreatePokedexMonSprite(dexNum, SCROLLING_MON_X, 0x50); + gSprites[spriteId].callback = SpriteCB_PokedexListMonSprite; + gSprites[spriteId].data[5] = 64; + } + if (sPokedexView->listVOffset < LIST_SCROLL_STEP - 1) + sPokedexView->listVOffset++; + else + sPokedexView->listVOffset = 0; + break; + } +} + +// u16 ignored is passed but never used +static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) +{ + u8 scrollTimer; + u8 scrollMonIncrement; + u8 i; + u16 startingPos; + u8 scrollDir = 0; + + if (JOY_HELD(DPAD_UP) && (selectedMon > 0)) + { + scrollDir = 1; + selectedMon = GetNextPosition(1, selectedMon, 0, sPokedexView->pokemonListCount - 1); + CreateScrollingPokemonSprite(1, selectedMon); + CreateMonListEntry(1, selectedMon, ignored); + sPokedexView->justScrolled = TRUE; //HGSS_Ui + PlaySE(SE_DEX_SCROLL); + } + else if (JOY_HELD(DPAD_DOWN) && (selectedMon < sPokedexView->pokemonListCount - 1)) + { + scrollDir = 2; + selectedMon = GetNextPosition(0, selectedMon, 0, sPokedexView->pokemonListCount - 1); + CreateScrollingPokemonSprite(2, selectedMon); + CreateMonListEntry(2, selectedMon, ignored); + sPokedexView->justScrolled = TRUE; //HGSS_Ui + PlaySE(SE_DEX_SCROLL); + } + else if (JOY_NEW(DPAD_LEFT) && (selectedMon > 0)) + { + startingPos = selectedMon; + + for (i = 0; i < 7; i++) + selectedMon = GetNextPosition(1, selectedMon, 0, sPokedexView->pokemonListCount - 1); + sPokedexView->pokeBallRotation += 16 * (selectedMon - startingPos); + ClearMonSprites(); + CreateMonSpritesAtPos(selectedMon, 0xE); + sPokedexView->justScrolled = TRUE; //HGSS_Ui + PlaySE(SE_DEX_PAGE); + } + else if (JOY_NEW(DPAD_RIGHT) && (selectedMon < sPokedexView->pokemonListCount - 1)) + { + startingPos = selectedMon; + for (i = 0; i < 7; i++) + selectedMon = GetNextPosition(0, selectedMon, 0, sPokedexView->pokemonListCount - 1); + sPokedexView->pokeBallRotation += 16 * (selectedMon - startingPos); + ClearMonSprites(); + CreateMonSpritesAtPos(selectedMon, 0xE); + sPokedexView->justScrolled = TRUE; //HGSS_Ui + PlaySE(SE_DEX_PAGE); + } + + if (scrollDir == 0) + { + // Left/right input just snaps up/down, no scrolling + sPokedexView->scrollSpeed = 0; + return selectedMon; + } + + scrollMonIncrement = sScrollMonIncrements[sPokedexView->scrollSpeed / 4]; + scrollTimer = sScrollTimers[sPokedexView->scrollSpeed / 4]; + sPokedexView->scrollTimer = scrollTimer; + sPokedexView->maxScrollTimer = scrollTimer; + sPokedexView->scrollMonIncrement = scrollMonIncrement; + sPokedexView->scrollDirection = scrollDir; + sPokedexView->pokeBallRotationStep = scrollMonIncrement / 2; + UpdateDexListScroll(sPokedexView->scrollDirection, sPokedexView->scrollMonIncrement, sPokedexView->maxScrollTimer); + if (sPokedexView->scrollSpeed < 12) + sPokedexView->scrollSpeed++; + return selectedMon; +} + +static void UpdateSelectedMonSpriteId(void) +{ + u16 i; + + for (i = 0; i < MAX_MONS_ON_SCREEN; i++) + { + u16 spriteId = sPokedexView->monSpriteIds[i]; + + if (gSprites[spriteId].x2 == 0 && gSprites[spriteId].y2 == 0 && spriteId != 0xFFFF) + sPokedexView->selectedMonSpriteId = spriteId; + } +} + +static bool8 TryDoInfoScreenScroll(void) +{ + u16 nextPokemon; + u16 selectedPokemon = sPokedexView->selectedPokemon; + + if (sPokedexView->sEvoScreenData.fromEvoPage) + return FALSE; + + if (JOY_NEW(DPAD_UP) && selectedPokemon) + { + nextPokemon = selectedPokemon; + while (nextPokemon != 0) + { + nextPokemon = GetNextPosition(1, nextPokemon, 0, sPokedexView->pokemonListCount - 1); + + if (sPokedexView->pokedexList[nextPokemon].seen) + { + selectedPokemon = nextPokemon; + break; + } + } + + if (sPokedexView->selectedPokemon == selectedPokemon) + return FALSE; + else + { + sPokedexView->selectedPokemon = selectedPokemon; + sPokedexView->pokeBallRotation -= 16; + return TRUE; + } + } + else if (JOY_NEW(DPAD_DOWN) && selectedPokemon < sPokedexView->pokemonListCount - 1) + { + nextPokemon = selectedPokemon; + while (nextPokemon < sPokedexView->pokemonListCount - 1) + { + nextPokemon = GetNextPosition(0, nextPokemon, 0, sPokedexView->pokemonListCount - 1); + + if (sPokedexView->pokedexList[nextPokemon].seen) + { + selectedPokemon = nextPokemon; + break; + } + } + + if (sPokedexView->selectedPokemon == selectedPokemon) + return FALSE; + else + { + sPokedexView->selectedPokemon = selectedPokemon; + sPokedexView->pokeBallRotation += 16; + return TRUE; + } + } + return FALSE; +} + +static u8 ClearMonSprites(void) +{ + u16 i; + + for (i = 0; i < MAX_MONS_ON_SCREEN; i++) + { + if (sPokedexView->monSpriteIds[i] != 0xFFFF) + { + FreeAndDestroyMonPicSprite(sPokedexView->monSpriteIds[i]); + sPokedexView->monSpriteIds[i] = 0xFFFF; + } + } + return FALSE; +} + +static u16 GetPokemonSpriteToDisplay(u16 species) +{ + if (species >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[species].dexNum == 0xFFFF) + return 0xFFFF; + else if (sPokedexView->pokedexList[species].seen) + return sPokedexView->pokedexList[species].dexNum; + else + return 0; +} + +static u32 CreatePokedexMonSprite(u16 num, s16 x, s16 y) +{ + u8 i; + + for (i = 0; i < MAX_MONS_ON_SCREEN; i++) + { + if (sPokedexView->monSpriteIds[i] == 0xFFFF) + { + u8 spriteId = CreateMonSpriteFromNationalDexNumber(num, x, y, i); + + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.priority = 3; + gSprites[spriteId].data[0] = 0; + gSprites[spriteId].data[1] = i; + gSprites[spriteId].data[2] = NationalPokedexNumToSpecies(num); + sPokedexView->monSpriteIds[i] = spriteId; + return spriteId; + } + } + return 0xFFFF; +} + +#define sIsDownArrow data[1] +#define LIST_RIGHT_SIDE_TEXT_X 204 +#define LIST_RIGHT_SIDE_TEXT_X_OFFSET 12 +#define LIST_RIGHT_SIDE_TEXT_Y_OFFSET 13 +static void CreateInterfaceSprites(u8 page) +{ + u8 spriteId; + u16 digitNum; + u8 color[3]; + bool32 drawNextDigit; + + // Scroll arrows + spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 10, 4, 0); + gSprites[spriteId].sIsDownArrow = FALSE; + spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 10, 156, 0); + gSprites[spriteId].sIsDownArrow = TRUE; + gSprites[spriteId].vFlip = TRUE; + + CreateSprite(&sScrollBarSpriteTemplate, 8, 20, 0); + + if (!IsNationalPokedexEnabled() && page == PAGE_MAIN) + { + // Hoenn text + CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 40 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); + // Hoenn seen + CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); + // Hoenn own + spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 7, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + + // Hoenn seen value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = sPokedexView->seenCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn seen value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->seenCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn seen value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->seenCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + + + // Hoenn owned value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = sPokedexView->ownCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn owned value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->ownCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn owned value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->ownCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + } + else if (page == PAGE_MAIN) + { + u16 seenOwnedCount; + + // Hoenn text + CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 40 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); + // Hoenn seen + CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); + // Hoenn own + spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 7, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + + // National text + spriteId = CreateSprite(&sHoennNationalTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 73 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET - 6, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + // National seen + CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); + // National own + spriteId = CreateSprite(&sSeenOwnTextSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET + 6, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + + // Hoenn seen value - 100s + seenOwnedCount = GetHoennPokedexCount(FLAG_GET_SEEN); + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = seenOwnedCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn seen value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (seenOwnedCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn seen value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 45 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (seenOwnedCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + + seenOwnedCount = GetHoennPokedexCount(FLAG_GET_CAUGHT); + // Hoenn owned value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = seenOwnedCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn owned value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (seenOwnedCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // Hoenn owned value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 55 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (seenOwnedCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + + //**************************** + // National seen value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = sPokedexView->seenCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; + + // National seen value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->seenCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // National seen value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 78 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->seenCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + + // National owned value - 100s + drawNextDigit = FALSE; + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = sPokedexView->ownCount / 100; + StartSpriteAnim(&gSprites[spriteId], digitNum); + if (digitNum != 0) + drawNextDigit = TRUE; + else + gSprites[spriteId].invisible = TRUE; + + // National owned value - 10s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 8, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->ownCount % 100) / 10; + if (digitNum != 0 || drawNextDigit) + StartSpriteAnim(&gSprites[spriteId], digitNum); + else + gSprites[spriteId].invisible = TRUE; + + // National owned value - 1s + spriteId = CreateSprite(&sNationalDexSeenOwnNumberSpriteTemplate, LIST_RIGHT_SIDE_TEXT_X + LIST_RIGHT_SIDE_TEXT_X_OFFSET + 16, 88 - LIST_RIGHT_SIDE_TEXT_Y_OFFSET, 1); + digitNum = (sPokedexView->ownCount % 100) % 10; + StartSpriteAnim(&gSprites[spriteId], digitNum); + } + + if (page == PAGE_MAIN) + { + spriteId = CreateSprite(&sDexListStartMenuCursorSpriteTemplate, 136, 96, 1); + gSprites[spriteId].invisible = TRUE; + } + else // PAGE_SEARCH_RESULTS + { + spriteId = CreateSprite(&sDexListStartMenuCursorSpriteTemplate, 136, 80, 1); + gSprites[spriteId].invisible = TRUE; + } +} + +static void SpriteCB_EndMoveMonForInfoScreen(struct Sprite *sprite) +{ + // Once mon is done moving there's nothing left to do +} + +static void SpriteCB_SeenOwnInfo(struct Sprite *sprite) +{ + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + DestroySprite(sprite); +} + +void SpriteCB_MoveMonForInfoScreen(struct Sprite *sprite) +{ + sprite->oam.priority = 0; + sprite->oam.affineMode = ST_OAM_AFFINE_OFF; + sprite->x2 = 0; + sprite->y2 = 0; + if (sprite->x != MON_PAGE_X || sprite->y != MON_PAGE_Y) + { + if (sprite->x > 48) + sprite->x -= 4; + if (sprite->x < 48) + sprite->x = 48; + + if (sprite->y > 56) + sprite->y -= 4; + if (sprite->y < 56) + sprite->y = 56; + } + else + { + sprite->callback = SpriteCB_EndMoveMonForInfoScreen; + } +} + +static void SpriteCB_PokedexListMonSprite(struct Sprite *sprite) +{ + u8 monId = sprite->data[1]; + + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + { + FreeAndDestroyMonPicSprite(sPokedexView->monSpriteIds[monId]); + sPokedexView->monSpriteIds[monId] = 0xFFFF; + } + else + { + u32 var; + sprite->y2 = gSineTable[(u8)sprite->data[5]] * 76 / 256; + var = SAFE_DIV(0x10000, gSineTable[sprite->data[5] + 64]); + if (var > 0xFFFF) + var = 0xFFFF; + SetOamMatrix(sprite->data[1] + 1, 0x100, 0, 0, var); + sprite->oam.matrixNum = monId + 1; + + if (sprite->data[5] > -64 && sprite->data[5] < 64) + { + sprite->invisible = FALSE; + sprite->data[0] = 1; + } + else + { + sprite->invisible = TRUE; + } + + if ((sprite->data[5] <= -64 || sprite->data[5] >= 64) && sprite->data[0] != 0) + { + FreeAndDestroyMonPicSprite(sPokedexView->monSpriteIds[monId]); + sPokedexView->monSpriteIds[monId] = 0xFFFF; + } + } +} + +static void SpriteCB_Scrollbar(struct Sprite *sprite) +{ + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + DestroySprite(sprite); + else + sprite->y2 = sPokedexView->selectedPokemon * 120 / (sPokedexView->pokemonListCount - 1); +} + +static void SpriteCB_ScrollArrow(struct Sprite *sprite) +{ + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + { + DestroySprite(sprite); + } + else + { + u8 r0; + + if (sprite->sIsDownArrow) + { + if (sPokedexView->selectedPokemon == sPokedexView->pokemonListCount - 1) + sprite->invisible = TRUE; + else + sprite->invisible = FALSE; + r0 = sprite->data[2]; + } + else + { + if (sPokedexView->selectedPokemon == 0) + sprite->invisible = TRUE; + else + sprite->invisible = FALSE; + r0 = sprite->data[2] - 128; + } + sprite->y2 = gSineTable[r0] / 64; + sprite->data[2] = sprite->data[2] + 8; + if (sPokedexView->menuIsOpen == FALSE && sPokedexView->menuY == 0 && sprite->invisible == FALSE) + sprite->invisible = FALSE; + else + sprite->invisible = TRUE; + } +} + +static void SpriteCB_DexListInterfaceText(struct Sprite *sprite) +{ + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + DestroySprite(sprite); +} + +static void SpriteCB_RotatingPokeBall(struct Sprite *sprite) +{ + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + { + DestroySprite(sprite); + } + else + { + u8 val; + s16 r3; + s16 r0; + + val = sPokedexView->pokeBallRotation + sprite->data[1]; + r3 = gSineTable[val]; + r0 = gSineTable[val + 64]; + SetOamMatrix(sprite->data[0], r0, r3, -r3, r0); + + val = sPokedexView->pokeBallRotation + (sprite->data[1] + 64); + r3 = gSineTable[val]; + r0 = gSineTable[val + 64]; + sprite->x2 = r0 * 40 / 256; + sprite->y2 = r3 * 40 / 256; + } +} + +static void SpriteCB_DexListStartMenuCursor(struct Sprite *sprite) +{ + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + { + DestroySprite(sprite); + } + else + { + u16 r1 = sPokedexView->currentPage == PAGE_MAIN ? 80 : 96; + + if (sPokedexView->menuIsOpen && sPokedexView->menuY == r1) + { + sprite->invisible = FALSE; + sprite->y2 = sPokedexView->menuCursorPos * 16; + sprite->x2 = gSineTable[(u8)sprite->data[2]] / 64; + sprite->data[2] += 8; + } + else + { + sprite->invisible = TRUE; + } + } +} + + + +//************************************ +//* * +//* STATS BARS * +//* * +//************************************ + +//Stat bars on main screen, code by DizzyEgg, idea by Jaizu +#define PIXEL_COORDS_TO_OFFSET(x, y)( \ +/*Add tiles by X*/ \ +((y / 8) * 32 * 8) \ +/*Add tiles by X*/ \ ++ ((x / 8) * 32) \ +/*Add pixels by Y*/ \ ++ ((((y) - ((y / 8) * 8))) * 4) \ +/*Add pixels by X*/ \ ++ ((((x) - ((x / 8) * 8)) / 2))) + +static inline void WritePixel(u8 *dst, u32 x, u32 y, u32 value) +{ + if (x & 1) + { + dst[PIXEL_COORDS_TO_OFFSET(x, y)] &= ~0xF0; + dst[PIXEL_COORDS_TO_OFFSET(x, y)] |= (value << 4); + } + else + { + dst[PIXEL_COORDS_TO_OFFSET(x, y)] &= ~0xF; + dst[PIXEL_COORDS_TO_OFFSET(x, y)] |= (value); + } +} +#define STAT_BAR_X_OFFSET 10 +static void CreateStatBar(u8 *dst, u32 y, u32 width) +{ + u32 i, color; + + switch (width) + { + case 0 ... 5: + color = COLOR_WORST; + break; + case 6 ... 15: + color = COLOR_BAD; + break; + case 16 ... 25: + color = COLOR_AVERAGE; + break; + case 26 ... 31: + color = COLOR_GOOD; + break; + case 32 ... 37: + color = COLOR_VERY_GOOD; + break; + default: + color = COLOR_BEST; + break; + } + + // white pixes left side + WritePixel(dst, STAT_BAR_X_OFFSET, y + 0, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET, y + 1, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET, y + 2, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET, y + 3, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET, y + 4, COLOR_ID_BAR_WHITE); + + // white pixels right side + WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 0, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 1, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 2, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 3, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET + width - 1, y + 4, COLOR_ID_BAR_WHITE); + + // Fill + for (i = 1; i < width - 1; i++) + { + WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 0, COLOR_ID_BAR_WHITE); + WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 1, COLOR_ID_FILL_SHADOW + color * 2); + WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 2, COLOR_ID_FILL + color * 2); + WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 3, COLOR_ID_FILL + color * 2); + WritePixel(dst, STAT_BAR_X_OFFSET + i, y + 4, COLOR_ID_BAR_WHITE); + } +} +static const u8 sBaseStatOffsets[] = +{ + offsetof(struct SpeciesInfo, baseHP), + offsetof(struct SpeciesInfo, baseAttack), + offsetof(struct SpeciesInfo, baseDefense), + offsetof(struct SpeciesInfo, baseSpAttack), + offsetof(struct SpeciesInfo, baseSpDefense), + offsetof(struct SpeciesInfo, baseSpeed), +}; +static void TryDestroyStatBars(void) +{ + if (sPokedexView->statBarsSpriteId != 0xFF) + { + FreeSpriteTilesByTag(TAG_STAT_BAR); + //FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsSpriteId]); + DestroySprite(&gSprites[sPokedexView->statBarsSpriteId]); + sPokedexView->statBarsSpriteId = 0xFF; + } +} +static void TryDestroyStatBarsBg(void) +{ + if (sPokedexView->statBarsBgSpriteId != 0xFF) + { + FreeSpriteTilesByTag(TAG_STAT_BAR_BG); + //FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsBgSpriteId]); + DestroySprite(&gSprites[sPokedexView->statBarsBgSpriteId]); + sPokedexView->statBarsBgSpriteId = 0xFF; + } +} +static void CreateStatBars(struct PokedexListItem *dexMon) +{ + u8 offset_x = 184; //Moves the complete stat box left/right + u8 offset_y = 16; //Moves the complete stat box up/down + TryDestroyStatBars(); + + sPokedexView->justScrolled = FALSE; + + + if (dexMon->owned) // Show filed bars + { + u8 i; + u32 width, statValue; + u8 *gfx = Alloc(64 * 64); + static const u8 sBarsYOffset[] = {3, 13, 23, 33, 43, 53}; + struct SpriteSheet sheet = {gfx, 64 * 64, TAG_STAT_BAR}; + u32 species = NationalPokedexNumToSpecies(dexMon->dexNum); + + memcpy(gfx, sStatBarsGfx, sizeof(sStatBarsGfx)); + for (i = 0; i < NUM_STATS; i++) + { + statValue = *((u8*)(&gSpeciesInfo[species]) + sBaseStatOffsets[i]); + if (statValue <= 100) + { + width = statValue / 3; + if (width >= 33) + width -= 1; + } + else + width = (100 / 3) + ((statValue - 100) / 14); + + if (width > 39) // Max pixels + width = 39; + if (width < 3) + width = 3; + + CreateStatBar(gfx, sBarsYOffset[i], width); + } + + LoadSpriteSheet(&sheet); + Free(gfx); + } + else if (dexMon->seen) // Just HP/ATK/DEF + { + static const struct SpriteSheet sheet = {sStatBarsGfx, 64 * 64, TAG_STAT_BAR}; + + LoadSpriteSheet(&sheet); + } + else // neither seen nor owned + { + return; + } + sPokedexView->statBarsSpriteId = CreateSprite(&sStatBarSpriteTemplate, 36+offset_x, 107+offset_y, 10); +} +static void CreateStatBarsBg(void) //HGSS_Ui stat bars background text +{ + static const struct SpriteSheet sheetStatBarsBg = {sStatBarsGfx, 64 * 64, TAG_STAT_BAR_BG}; + u8 offset_x = 184; //Moves the complete stat box left/right + u8 offset_y = 16; //Moves the complete stat box up/down + + TryDestroyStatBarsBg(); + + LoadSpriteSheet(&sheetStatBarsBg); + sPokedexView->statBarsBgSpriteId = CreateSprite(&sStatBarBgSpriteTemplate, 36+offset_x, 107+offset_y, 0); +} +// Hack to destroy sprites when a pokemon data is being loaded in +static bool32 IsMonInfoBeingLoaded(void) +{ + return (gSprites[sPokedexView->selectedMonSpriteId].callback == SpriteCB_MoveMonForInfoScreen); +} +static void SpriteCB_StatBars(struct Sprite *sprite) +{ + if (IsMonInfoBeingLoaded()) + sprite->invisible = TRUE; + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + { + FreeSpriteTilesByTag(TAG_STAT_BAR); + FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsSpriteId]); + DestroySprite(&gSprites[sPokedexView->statBarsSpriteId]); + sPokedexView->statBarsSpriteId = 0xFF; + } +} +static void SpriteCB_StatBarsBg(struct Sprite *sprite) +{ + if (IsMonInfoBeingLoaded()) + sprite->invisible = TRUE; + if (sPokedexView->currentPage != PAGE_MAIN && sPokedexView->currentPage != PAGE_SEARCH_RESULTS) + { + FreeSpriteTilesByTag(TAG_STAT_BAR_BG); + FreeSpriteOamMatrix(&gSprites[sPokedexView->statBarsBgSpriteId]); + DestroySprite(&gSprites[sPokedexView->statBarsBgSpriteId]); + sPokedexView->statBarsBgSpriteId = 0xFF; + } +} + + + +//************************************ +//* * +//* Info screen * +//* * +//************************************ +#define tScrolling data[0] +#define tMonSpriteDone data[1] +#define tBgLoaded data[2] +#define tSkipCry data[3] +#define tMonSpriteId data[4] +#define tTrainerSpriteId data[5] + +static u8 LoadInfoScreen(struct PokedexListItem *item, u8 monSpriteId) +{ + u8 taskId; + + sPokedexListItem = item; + taskId = CreateTask(Task_LoadInfoScreen, 0); + gTasks[taskId].tScrolling = FALSE; + gTasks[taskId].tMonSpriteDone = TRUE; // Already has sprite from list view + gTasks[taskId].tBgLoaded = FALSE; + gTasks[taskId].tSkipCry = FALSE; + gTasks[taskId].tMonSpriteId = monSpriteId; + gTasks[taskId].tTrainerSpriteId = SPRITE_NONE; + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, sInfoScreen_BgTemplate, ARRAY_COUNT(sInfoScreen_BgTemplate)); + SetBgTilemapBuffer(3, AllocZeroed(BG_SCREEN_SIZE)); + SetBgTilemapBuffer(2, AllocZeroed(BG_SCREEN_SIZE)); + SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE)); + SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE)); + InitWindows(sInfoScreen_WindowTemplates); + DeactivateAllTextPrinters(); + + return taskId; +} + +static bool8 IsInfoScreenScrolling(u8 taskId) +{ + if (!gTasks[taskId].tScrolling && gTasks[taskId].func == Task_HandleInfoScreenInput) + return FALSE; + else + return TRUE; +} + +static u8 StartInfoScreenScroll(struct PokedexListItem *item, u8 taskId) +{ + sPokedexListItem = item; + gTasks[taskId].tScrolling = TRUE; + gTasks[taskId].tMonSpriteDone = FALSE; + gTasks[taskId].tBgLoaded = FALSE; + gTasks[taskId].tSkipCry = FALSE; + return taskId; +} + +static void Task_LoadInfoScreen(u8 taskId) +{ + switch (gMain.state) + { + case 0: + default: + if (!gPaletteFade.active) + { + u16 r2; + + sPokedexView->currentPage = PAGE_INFO; + gPokedexVBlankCB = gMain.vblankCallback; + SetVBlankCallback(NULL); + r2 = 0; + if (gTasks[taskId].tMonSpriteDone) + r2 += DISPCNT_OBJ_ON; + if (gTasks[taskId].tBgLoaded) + r2 |= DISPCNT_BG1_ON; + ResetOtherVideoRegisters(r2); + gMain.state = 1; + } + break; + case 1: + LoadTilesetTilemapHGSS(INFO_SCREEN); + // DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0); + // CopyToBgTilemapBuffer(3, gPokedexInfoScreen_Tilemap, 0, 0); + FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); + PutWindowTilemap(WIN_INFO); + PutWindowTilemap(WIN_FOOTPRINT); + DrawFootprint(WIN_FOOTPRINT, sPokedexListItem->dexNum); + CopyWindowToVram(WIN_FOOTPRINT, COPYWIN_GFX); + gMain.state++; + break; + case 2: + LoadScreenSelectBarMain(0xD); + // HighlightScreenSelectBarItem(sPokedexView->selectedScreen, 0xD); + LoadPokedexBgPalette(sPokedexView->isSearchResults); + gMain.state++; + break; + case 3: + sPokedexView->typeIconSpriteIds[0] = 0xFF; + sPokedexView->typeIconSpriteIds[1] = 0xFF; + CreateTypeIconSprites(); + gMain.state++; + break; + case 4: + PrintMonInfo(sPokedexListItem->dexNum, sPokedexView->dexMode == DEX_MODE_HOENN ? FALSE : TRUE, sPokedexListItem->owned, 0); + if (!sPokedexListItem->owned) + LoadPalette(gPlttBufferUnfaded + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(16 - 1)); + CopyWindowToVram(WIN_INFO, COPYWIN_FULL); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + gMain.state++; + break; + case 5: + if (!gTasks[taskId].tMonSpriteDone) + { + gTasks[taskId].tMonSpriteId = (u16)CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, MON_PAGE_X, MON_PAGE_Y, 0); + gSprites[gTasks[taskId].tMonSpriteId].oam.priority = 0; + } + gMain.state++; + break; + case 6: + { + u32 preservedPalettes = 0; + + if (gTasks[taskId].tBgLoaded) + preservedPalettes = 0x14; // each bit represents a palette index + if (gTasks[taskId].tMonSpriteDone) + preservedPalettes |= (1 << (gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum + 16)); + BeginNormalPaletteFade(~preservedPalettes, 0, 16, 0, RGB_BLACK); + SetVBlankCallback(gPokedexVBlankCB); + gMain.state++; + } + break; + case 7: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + HideBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 8: + if (!gPaletteFade.active) + { + gMain.state++; + } + break; + case 9: + // if (!IsCryPlayingOrClearCrySongs()) + gMain.state++; + break; + case 10: + gTasks[taskId].tScrolling = FALSE; + gTasks[taskId].tMonSpriteDone = FALSE; // Reload next time screen comes up + gTasks[taskId].tBgLoaded = TRUE; + gTasks[taskId].tSkipCry = TRUE; + gTasks[taskId].func = Task_HandleInfoScreenInput; + gMain.state = 0; + break; + } +} + +static void FreeInfoScreenWindowAndBgBuffers(void) +{ + void *tilemapBuffer; + + FreeAllWindowBuffers(); + tilemapBuffer = GetBgTilemapBuffer(0); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(1); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(2); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(3); + if (tilemapBuffer) + Free(tilemapBuffer); +} + +static void Task_HandleInfoScreenInput(u8 taskId) +{ + if (gTasks[taskId].tScrolling) + { + // Scroll up/down + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_LoadInfoScreenWaitForFade; + PlaySE(SE_DEX_SCROLL); + return; + } + if (JOY_NEW(B_BUTTON)) + { + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_ExitInfoScreen; + PlaySE(SE_PC_OFF); + return; + } + + if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) + { + sPokedexView->selectedScreen = AREA_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; + PlaySE(SE_PIN); + } + +} + +static void Task_SwitchScreensFromInfoScreen(u8 taskId) +{ + if (!gPaletteFade.active) + { + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + switch (sPokedexView->screenSwitchState) + { + case 1: + default: + gTasks[taskId].func = Task_LoadAreaScreen; + break; + case 2: + gTasks[taskId].func = Task_LoadCryScreen; + break; + case 3: + gTasks[taskId].func = Task_LoadSizeScreen; + break; + } + } +} + +static void Task_LoadInfoScreenWaitForFade(u8 taskId) +{ + if (!gPaletteFade.active) + { + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + gTasks[taskId].func = Task_LoadInfoScreen; + } +} + +static void Task_ExitInfoScreen(u8 taskId) +{ + if (!gPaletteFade.active) + { + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + FreeInfoScreenWindowAndBgBuffers(); + DestroyTask(taskId); + } +} + +#undef tMonSpriteId + +//************************************ +//* * +//* Area screen * +//* * +//************************************ +static void Task_LoadAreaScreen(u8 taskId) +{ + switch (gMain.state) + { + case 0: + default: + if (!gPaletteFade.active) + { + sPokedexView->currentPage = PAGE_AREA; + gPokedexVBlankCB = gMain.vblankCallback; + SetVBlankCallback(NULL); + ResetOtherVideoRegisters(DISPCNT_BG1_ON); + sPokedexView->selectedScreen = AREA_SCREEN; + gMain.state = 1; + } + break; + case 1: + LoadScreenSelectBarSubmenu(0xD); //HGSS_Ui + LoadPokedexBgPalette(sPokedexView->isSearchResults); + SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(13) | BGCNT_16COLOR | BGCNT_TXT256x256); + gMain.state++; + break; + case 2: + ShowPokedexAreaScreen(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), &sPokedexView->screenSwitchState); + SetVBlankCallback(gPokedexVBlankCB); + sPokedexView->screenSwitchState = 0; + gMain.state = 0; + gTasks[taskId].func = Task_WaitForAreaScreenInput; + break; + } +} + +static void Task_WaitForAreaScreenInput(u8 taskId) +{ +// See Task_HandlePokedexAreaScreenInput() in pokedex_area_screen.c + if (sPokedexView->screenSwitchState != 0) + gTasks[taskId].func = Task_SwitchScreensFromAreaScreen; +} + +static void Task_SwitchScreensFromAreaScreen(u8 taskId) +{ + if (!gPaletteFade.active) + { + switch (sPokedexView->screenSwitchState) + { + case 1: + default: + gTasks[taskId].func = Task_LoadInfoScreen; + break; + case 2: + if (!sPokedexListItem->owned) + PlaySE(SE_FAILURE); + else + gTasks[taskId].func = Task_LoadStatsScreen; + break; + } + } +} + + + +//************************************ +//* * +//* Select bar * +//* * +//************************************ +static void LoadScreenSelectBarMain(u16 unused) +{ + CopyToBgTilemapBuffer(1, gPokedexPlusHGSS_ScreenSelectBarSubmenu_Tilemap_Clear, 0, 0); + CopyBgTilemapBufferToVram(1); +} + +static void LoadScreenSelectBarSubmenu(u16 unused) +{ + CopyToBgTilemapBuffer(1, gPokedexPlusHGSS_ScreenSelectBarSubmenu_Tilemap, 0, 0); + CopyBgTilemapBufferToVram(1); +} + +static void HighlightScreenSelectBarItem(u8 selectedScreen, u16 unused) //HGSS_Ui +{ + u8 i; + u8 j; + u16 *ptr = GetBgTilemapBuffer(1); + + for (i = 0; i < SCREEN_COUNT; i++) + { + u8 row = (i * 7) + 1; + u16 newPalette; + + do + { + newPalette = 0x4000; + if (i == selectedScreen) + newPalette = 0x2000; + } while (0); + + for (j = 0; j < 7; j++) + { + ptr[row + j] = (ptr[row + j] % 0x1000) | newPalette; + ptr[row + j + 0x20] = (ptr[row + j + 0x20] % 0x1000) | newPalette; + } + } + CopyBgTilemapBufferToVram(1); +} + +static void HighlightSubmenuScreenSelectBarItem(u8 a, u16 b) +{ + u8 i; + u8 j; + u16 *ptr = GetBgTilemapBuffer(1); + + for (i = 0; i < 4; i++) + { + u8 row = i * 7 + 1; + u32 newPalette; + + do + { + if (i == a || i == 3) + newPalette = 0x2000; + else + newPalette = 0x4000; + } while (0); + + for (j = 0; j < 7; j++) + { + ptr[row + j] = (ptr[row + j] % 0x1000) | newPalette; + ptr[row + j + 0x20] = (ptr[row + j + 0x20] % 0x1000) | newPalette; + } + } + CopyBgTilemapBufferToVram(1); +} + + + +//************************************ +//* * +//* CAUGHT MON * +//* * +//************************************ +#define tState data[0] +#define tSpecies data[1] +#define tPalTimer data[2] +#define tMonSpriteId data[3] +#define tOtIdLo data[12] +#define tOtIdHi data[13] +#define tPersonalityLo data[14] +#define tPersonalityHi data[15] + +static void Task_DisplayCaughtMonDexPage(u8 taskId) +{ + u8 spriteId; + u16 species = gTasks[taskId].tSpecies; + u16 dexNum = SpeciesToNationalPokedexNum(species); + + switch (gTasks[taskId].tState) + { + case 0: + default: + if (!gPaletteFade.active) + { + gPokedexVBlankCB = gMain.vblankCallback; + SetVBlankCallback(NULL); + ResetOtherVideoRegisters(DISPCNT_BG0_ON); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, sNewEntryInfoScreen_BgTemplate, ARRAY_COUNT(sNewEntryInfoScreen_BgTemplate)); + SetBgTilemapBuffer(3, AllocZeroed(BG_SCREEN_SIZE)); + SetBgTilemapBuffer(2, AllocZeroed(BG_SCREEN_SIZE)); + InitWindows(sNewEntryInfoScreen_WindowTemplates); + DeactivateAllTextPrinters(); + gTasks[taskId].tState = 1; + } + break; + case 1: + sPokedexView = AllocZeroed(sizeof(struct PokedexView)); //for type icons + ResetPokedexView(sPokedexView); + + #ifdef POKEMON_EXPANSION + if (gFormSpeciesIdTables[species] != NULL) + sPokedexView->formSpecies = species; + else + sPokedexView->formSpecies = 0; + #endif + + LoadTilesetTilemapHGSS(INFO_SCREEN); + FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); + PutWindowTilemap(WIN_INFO); + PutWindowTilemap(WIN_FOOTPRINT); + DrawFootprint(WIN_FOOTPRINT, dexNum); + CopyWindowToVram(WIN_FOOTPRINT, COPYWIN_GFX); + ResetPaletteFade(); + LoadPokedexBgPalette(FALSE); + gTasks[taskId].tState++; + break; + case 2: + sPokedexView->typeIconSpriteIds[0] = 0xFF; + sPokedexView->typeIconSpriteIds[1] = 0xFF; + CreateTypeIconSprites(); + gTasks[taskId].tState++; + break; + case 3: + PrintMonInfo(dexNum, IsNationalPokedexEnabled(), 1, 1); + CopyWindowToVram(WIN_INFO, COPYWIN_FULL); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + gTasks[taskId].tState++; + break; + case 4: + #ifndef POKEMON_EXPANSION + spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, MON_PAGE_X, MON_PAGE_Y, 0); + #else + spriteId = CreateMonPicSprite(species, 0, ((u16)gTasks[taskId].tPersonalityHi << 16) | (u16)gTasks[taskId].tPersonalityLo, TRUE, MON_PAGE_X, MON_PAGE_Y, 0, TAG_NONE); + #endif + gSprites[spriteId].oam.priority = 0; + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); + SetVBlankCallback(gPokedexVBlankCB); + gTasks[taskId].tMonSpriteId = spriteId; + gTasks[taskId].tState++; + break; + case 5: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + ShowBg(2); + ShowBg(3); + gTasks[taskId].tState++; + break; + case 6: + if (!gPaletteFade.active) + { + PlayCry_Normal(NationalPokedexNumToSpeciesHGSS(dexNum), 0); + gTasks[taskId].tPalTimer = 0; + gTasks[taskId].func = Task_HandleCaughtMonPageInput; + } + break; + } +} + +static void Task_HandleCaughtMonPageInput(u8 taskId) +{ + if (JOY_NEW(A_BUTTON | B_BUTTON)) + { + BeginNormalPaletteFade(PALETTES_BG, 0, 0, 16, RGB_BLACK); + SetSpriteInvisibility(0, TRUE); + SetSpriteInvisibility(1, TRUE); + gSprites[gTasks[taskId].tMonSpriteId].callback = SpriteCB_SlideCaughtMonToCenter; + gTasks[taskId].func = Task_ExitCaughtMonPage; + } + // Flicker caught screen color + else if (++gTasks[taskId].tPalTimer & 16) + { + if (!HGSS_DARK_MODE) + LoadPalette(gPokedexPlusHGSS_Default_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); + else + LoadPalette(gPokedexPlusHGSS_Default_dark_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); + } + else + { + if (!HGSS_DARK_MODE) + LoadPalette(gPokedexPlusHGSS_Default_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); + else + LoadPalette(gPokedexPlusHGSS_Default_dark_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); + } +} + +static void Task_ExitCaughtMonPage(u8 taskId) +{ + if (!gPaletteFade.active) + { + u16 species; + u32 otId; + u32 personality; + u8 paletteNum; + const u32 *lzPaletteData; + void *buffer; + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + FreeAllWindowBuffers(); + buffer = GetBgTilemapBuffer(2); + if (buffer) + Free(buffer); + buffer = GetBgTilemapBuffer(3); + if (buffer) + Free(buffer); + + species = gTasks[taskId].tSpecies; + otId = ((u16)gTasks[taskId].tOtIdHi << 16) | (u16)gTasks[taskId].tOtIdLo; + personality = ((u16)gTasks[taskId].tPersonalityHi << 16) | (u16)gTasks[taskId].tPersonalityLo; + paletteNum = gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum; + lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality); + LoadCompressedPalette(lzPaletteData, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP); + DestroyTask(taskId); + } +} + +static void SpriteCB_SlideCaughtMonToCenter(struct Sprite *sprite) +{ + if (sprite->x < 0x78) + sprite->x += 2; + if (sprite->x > 0x78) + sprite->x -= 2; + + if (sprite->y < 0x50) + sprite->y += 1; + if (sprite->y > 0x50) + sprite->y -= 1; +} + +#undef tState +#undef tDexNum +#undef tPalTimer +#undef tMonSpriteId +#undef tOtIdLo +#undef tOtIdHi +#undef tPersonalityLo +#undef tPersonalityHi + + + + + + + +//************************************ +//* * +//* Print data * +//* * +//************************************ +static void PrintInfoScreenText(const u8 *str, u8 left, u8 top) +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_DYNAMIC_COLOR_6; + color[2] = TEXT_COLOR_LIGHT_GRAY; + + AddTextPrinterParameterized4(0, 1, left, top, 0, 0, color, -1, str); +} +static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top) //HGSS_Ui +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_COLOR_WHITE; + color[2] = TEXT_DYNAMIC_COLOR_6; + + AddTextPrinterParameterized4(0, FONT_NORMAL, left, top, 0, 0, color, TEXT_SKIP_DRAW, str); +} +static void PrintInfoScreenTextSmall(const u8* str, u8 left, u8 top) +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_DYNAMIC_COLOR_6; + color[2] = TEXT_COLOR_LIGHT_GRAY; + + AddTextPrinterParameterized4(0, 0, left, top, 0, 0, color, 0, str); +} +static void PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top) +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_COLOR_WHITE; + color[2] = TEXT_DYNAMIC_COLOR_6; + + AddTextPrinterParameterized4(0, 0, left, top, 0, 0, color, 0, str); +} +//Stats screen +static void PrintStatsScreenTextSmall(u8 windowId, const u8* str, u8 left, u8 top) +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_DYNAMIC_COLOR_6; + color[2] = TEXT_COLOR_LIGHT_GRAY; + + AddTextPrinterParameterized4(windowId, 0, left, top, 0, 0, color, 0, str); +} +static void PrintStatsScreenTextSmallWhite(u8 windowId, const u8* str, u8 left, u8 top) +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_COLOR_WHITE; + color[2] = TEXT_DYNAMIC_COLOR_6; + + AddTextPrinterParameterized4(windowId, 0, left, top, 0, 0, color, 0, str); +} + +//Type Icon +static void SetSpriteInvisibility(u8 spriteArrayId, bool8 invisible) +{ + gSprites[sPokedexView->typeIconSpriteIds[spriteArrayId]].invisible = invisible; +} +// different from pokemon_summary_screen +#define TYPE_ICON_PAL_NUM_0 13 +#define TYPE_ICON_PAL_NUM_1 14 +#define TYPE_ICON_PAL_NUM_2 15 +static const u8 sMoveTypeToOamPaletteNum[NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT] = +{ + [TYPE_NORMAL] = TYPE_ICON_PAL_NUM_0, + [TYPE_FIGHTING] = TYPE_ICON_PAL_NUM_0, + [TYPE_FLYING] = TYPE_ICON_PAL_NUM_1, + [TYPE_POISON] = TYPE_ICON_PAL_NUM_1, + [TYPE_GROUND] = TYPE_ICON_PAL_NUM_0, + [TYPE_ROCK] = TYPE_ICON_PAL_NUM_0, + [TYPE_BUG] = TYPE_ICON_PAL_NUM_2, + [TYPE_GHOST] = TYPE_ICON_PAL_NUM_1, + [TYPE_STEEL] = TYPE_ICON_PAL_NUM_0, + [TYPE_MYSTERY] = TYPE_ICON_PAL_NUM_2, + [TYPE_FIRE] = TYPE_ICON_PAL_NUM_0, + [TYPE_WATER] = TYPE_ICON_PAL_NUM_1, + [TYPE_GRASS] = TYPE_ICON_PAL_NUM_2, + [TYPE_ELECTRIC] = TYPE_ICON_PAL_NUM_0, + [TYPE_PSYCHIC] = TYPE_ICON_PAL_NUM_1, + [TYPE_ICE] = TYPE_ICON_PAL_NUM_1, + [TYPE_DRAGON] = TYPE_ICON_PAL_NUM_2, + [TYPE_DARK] = TYPE_ICON_PAL_NUM_0, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_COOL] = TYPE_ICON_PAL_NUM_0, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_BEAUTY] = TYPE_ICON_PAL_NUM_1, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_CUTE] = TYPE_ICON_PAL_NUM_1, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_SMART] = TYPE_ICON_PAL_NUM_2, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_TOUGH] = TYPE_ICON_PAL_NUM_0, + #ifdef TYPE_FAIRY + [TYPE_FAIRY] = TYPE_ICON_PAL_NUM_1, //based on battle_engine + #endif +}; +static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) +{ + struct Sprite *sprite; + + sprite = &gSprites[sPokedexView->typeIconSpriteIds[spriteArrayId]]; + StartSpriteAnim(sprite, typeId); + sprite->oam.paletteNum = sMoveTypeToOamPaletteNum[typeId]; + sprite->x = x + 16; + sprite->y = y + 8; + SetSpriteInvisibility(spriteArrayId, FALSE); +} +static void PrintCurrentSpeciesTypeInfo(u8 newEntry, u16 species) +{ + u32 i; + u16 dexNum = SpeciesToNationalPokedexNum(species); + u8 type1, type2; + + if (!newEntry) + { + species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); + dexNum = SpeciesToNationalPokedexNum(species); + } + //type icon(s) + #ifdef TX_RANDOMIZER_AND_CHALLENGES + type1 = GetTypeBySpecies(species, 1); + type2 = GetTypeBySpecies(species, 2); + #else + type1 = gSpeciesInfo[species].types[0]; + type2 = gSpeciesInfo[species].types[1]; + #endif + if (species == SPECIES_NONE) + type1 = type2 = TYPE_MYSTERY; + + if (type1 == type2) + { + SetTypeIconPosAndPal(type1, 147, 48, 0); + SetSpriteInvisibility(1, TRUE); + } + else + { + SetTypeIconPosAndPal(type1, 147, 48, 0); + SetTypeIconPosAndPal(type2, 147 + 33, 48, 1); + } + +} +static void CreateTypeIconSprites(void) +{ + u8 i; + + LoadCompressedSpriteSheet(&sSpriteSheet_MoveTypes); + LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); + for (i = 0; i < 2; i++) + { + if (sPokedexView->typeIconSpriteIds[i] == 0xFF) + sPokedexView->typeIconSpriteIds[i] = CreateSprite(&sSpriteTemplate_MoveTypes, 10, 10, 2); + + SetSpriteInvisibility(i, TRUE); + } +} + +// u32 value is re-used, but passed as a bool that's TRUE if national dex is enabled +static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) +{ + u8 str[16]; + u8 str2[32]; + u16 species; + const u8 *name; + const u8 *category; + const u8 *description; + + // if (newEntry) + // PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(1, gText_PokedexRegistration, 0xF0), 0); + if (value == 0) + value = NationalToHoennOrder(num); + else + value = num; + ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); + PrintInfoScreenTextWhite(str, 123, 17); //HGSS_Ui + species = NationalPokedexNumToSpeciesHGSS(num); + if (species) + name = gSpeciesNames[species]; + else + name = sText_TenDashes2; + PrintInfoScreenTextWhite(name, 157, 17); //HGSS_Ui + if (owned) + { + CopyMonCategoryText(num, str2); + category = str2; + } + else + { + category = gText_5MarksPokemon; + } + PrintInfoScreenText(category, 123, 31); //HGSS_Ui + PrintInfoScreenText(gText_HTHeight, 155, 64); //HGSS_Ui + PrintInfoScreenText(gText_WTWeight, 155, 77); //HGSS_Ui + if (owned) + { + PrintMonHeight(gPokedexEntries[num].height, 180, 64); //HGSS_Ui + PrintMonWeight(gPokedexEntries[num].weight, 180, 77); //HGSS_Ui + } + else + { + PrintInfoScreenText(gText_UnkHeight, 180, 64); //HGSS_Ui + PrintInfoScreenText(gText_UnkWeight, 180, 77); //HGSS_Ui + } + if (owned) + { + description = gPokedexEntries[num].description; + } + else + description = sExpandedPlaceholder_PokedexDescription; + PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, 0xF0), 93); //HGSS_Ui + + //Type Icon(s) //HGSS_Ui + if (owned) + PrintCurrentSpeciesTypeInfo(newEntry, species); //HGSS_Ui +} + +static void PrintMonHeight(u16 height, u8 left, u8 top) +{ + u8 buffer[16]; + u32 inches, feet; + u8 i = 0; + + inches = (height * 10000) / 254; + if (inches % 10 >= 5) + inches += 10; + feet = inches / 120; + inches = (inches - (feet * 120)) / 10; + + buffer[i++] = EXT_CTRL_CODE_BEGIN; + buffer[i++] = EXT_CTRL_CODE_CLEAR_TO; + if (feet / 10 == 0) + { + buffer[i++] = 18; + buffer[i++] = feet + CHAR_0; + } + else + { + buffer[i++] = 12; + buffer[i++] = feet / 10 + CHAR_0; + buffer[i++] = (feet % 10) + CHAR_0; + } + buffer[i++] = CHAR_SGL_QUOTE_RIGHT; + buffer[i++] = (inches / 10) + CHAR_0; + buffer[i++] = (inches % 10) + CHAR_0; + buffer[i++] = CHAR_DBL_QUOTE_RIGHT; + buffer[i++] = EOS; + PrintInfoScreenText(buffer, left, top); +} + +static void PrintMonWeight(u16 weight, u8 left, u8 top) +{ + u8 buffer[16]; + bool8 output; + u8 i; + u32 lbs = (weight * 100000) / 4536; + + if (lbs % 10u >= 5) + lbs += 10; + i = 0; + output = FALSE; + + if ((buffer[i] = (lbs / 100000) + CHAR_0) == CHAR_0 && !output) + { + buffer[i++] = CHAR_SPACER; + } + else + { + output = TRUE; + i++; + } + + lbs %= 100000; + if ((buffer[i] = (lbs / 10000) + CHAR_0) == CHAR_0 && !output) + { + buffer[i++] = CHAR_SPACER; + } + else + { + output = TRUE; + i++; + } + + lbs %= 10000; + if ((buffer[i] = (lbs / 1000) + CHAR_0) == CHAR_0 && !output) + { + buffer[i++] = CHAR_SPACER; + } + else + { + output = TRUE; + i++; + } + + lbs %= 1000; + buffer[i++] = (lbs / 100) + CHAR_0; + lbs %= 100; + buffer[i++] = CHAR_PERIOD; + buffer[i++] = (lbs / 10) + CHAR_0; + buffer[i++] = CHAR_SPACE; + buffer[i++] = CHAR_l; + buffer[i++] = CHAR_b; + buffer[i++] = CHAR_s; + buffer[i++] = CHAR_PERIOD; + buffer[i++] = EOS; + PrintInfoScreenText(buffer, left, top); +} + +// Unused in the English version, used to print height/weight in versions which use metric system. +static void PrintDecimalNum(u8 windowId, u16 num, u8 left, u8 top) +{ + u8 str[6]; + bool8 outputted = FALSE; + u8 result; + + result = num / 1000; + if (result == 0) + { + str[0] = CHAR_SPACER; + outputted = FALSE; + } + else + { + str[0] = CHAR_0 + result; + outputted = TRUE; + } + + result = (num % 1000) / 100; + if (result == 0 && !outputted) + { + str[1] = CHAR_SPACER; + outputted = FALSE; + } + else + { + str[1] = CHAR_0 + result; + outputted = TRUE; + } + + str[2] = CHAR_0 + ((num % 1000) % 100) / 10; + str[3] = CHAR_DEC_SEPARATOR; + str[4] = CHAR_0 + ((num % 1000) % 100) % 10; + str[5] = EOS; + PrintInfoSubMenuText(windowId, str, left, top); +} + +static void DrawFootprint(u8 windowId, u16 dexNum) +{ + u8 footprint[32 * 4]; + const u8 * footprintGfx = gMonFootprintTable[NationalPokedexNumToSpecies(dexNum)]; + u16 tileIdx = 0; + u16 i, j; + + for (i = 0; i < 32; i++) + { + u8 tile = footprintGfx[i]; + for (j = 0; j < 4; j++) + { + u8 value = ((tile >> (2 * j)) & 1 ? 2 : 0); + if (tile & (2 << (2 * j))) + value |= 0x20; + footprint[tileIdx] = value; + tileIdx++; + } + } + CopyToWindowPixelBuffer(windowId, footprint, sizeof(footprint), 0); +} + +static void PrintInfoSubMenuText(u8 windowId, const u8 *str, u8 left, u8 top) +{ + u8 color[3]; + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_DYNAMIC_COLOR_6; + color[2] = TEXT_COLOR_LIGHT_GRAY; + + AddTextPrinterParameterized4(windowId, FONT_NORMAL, left, top, 0, 0, color, TEXT_SKIP_DRAW, str); +} + +static u8 PrintCryScreenSpeciesName(u8 windowId, u16 num, u8 left, u8 top) +{ + u8 str[POKEMON_NAME_LENGTH + 1]; + u8 i; + + for (i = 0; i < ARRAY_COUNT(str); i++) + str[i] = EOS; + num = NationalPokedexNumToSpeciesHGSS(num); + switch (num) + { + default: + for (i = 0; gSpeciesNames[num][i] != EOS && i < POKEMON_NAME_LENGTH; i++) + str[i] = gSpeciesNames[num][i]; + break; + case 0: + for (i = 0; i < 5; i++) + str[i] = CHAR_HYPHEN; + break; + } + PrintInfoSubMenuText(windowId, str, left, top); + return i; +} + +static u16 CreateSizeScreenTrainerPic(u16 species, s16 x, s16 y, s8 paletteSlot) +{ + return CreateTrainerPicSprite(species, TRUE, x, y, paletteSlot, TAG_NONE); +} + + +//************************************ +//* * +//* Helper functions * +//* * +//************************************ + +static void ResetOtherVideoRegisters(u16 regBits) +{ + if (!(regBits & DISPCNT_BG0_ON)) + { + ClearGpuRegBits(0, DISPCNT_BG0_ON); + SetGpuReg(REG_OFFSET_BG0CNT, 0); + SetGpuReg(REG_OFFSET_BG0HOFS, 0); + SetGpuReg(REG_OFFSET_BG0VOFS, 0); + } + if (!(regBits & DISPCNT_BG1_ON)) + { + ClearGpuRegBits(0, DISPCNT_BG1_ON); + SetGpuReg(REG_OFFSET_BG1CNT, 0); + SetGpuReg(REG_OFFSET_BG1HOFS, 0); + SetGpuReg(REG_OFFSET_BG1VOFS, 0); + } + if (!(regBits & DISPCNT_BG2_ON)) + { + ClearGpuRegBits(0, DISPCNT_BG2_ON); + SetGpuReg(REG_OFFSET_BG2CNT, 0); + SetGpuReg(REG_OFFSET_BG2HOFS, 0); + SetGpuReg(REG_OFFSET_BG2VOFS, 0); + } + if (!(regBits & DISPCNT_BG3_ON)) + { + ClearGpuRegBits(0, DISPCNT_BG3_ON); + SetGpuReg(REG_OFFSET_BG3CNT, 0); + SetGpuReg(REG_OFFSET_BG3HOFS, 0); + SetGpuReg(REG_OFFSET_BG3VOFS, 0); + } + if (!(regBits & DISPCNT_OBJ_ON)) + { + ClearGpuRegBits(0, DISPCNT_OBJ_ON); + ResetSpriteData(); + FreeAllSpritePalettes(); + gReservedSpritePaletteCount = 8; + } +} + +static void FreeWindowAndBgBuffers(void) +{ + void *tilemapBuffer; + + FreeAllWindowBuffers(); + tilemapBuffer = GetBgTilemapBuffer(0); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(1); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(2); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(3); + if (tilemapBuffer) + Free(tilemapBuffer); +} + +static u16 GetNextPosition(u8 direction, u16 position, u16 min, u16 max) +{ + switch (direction) + { + case 1: // Up/Left + if (position > min) + position--; + break; + case 0: // Down/Right + if (position < max) + position++; + break; + case 3: // Up/Left with loop (unused) + if (position > min) + position--; + else + position = max; + break; + case 2: // Down/Right with loop (unused) + if (position < max) + position++; + else + position = min; + break; + } + return position; +} + +// Unown and Spinda use the personality of the first seen individual of that species +// All others use personality 0 +static u32 GetPokedexMonPersonality(u16 species) +{ + if (species == SPECIES_UNOWN || species == SPECIES_SPINDA) + { + if (species == SPECIES_UNOWN) + return gSaveBlock2Ptr->pokedex.unownPersonality; + else + return gSaveBlock2Ptr->pokedex.spindaPersonality; + } + else + { + return 0; + } +} + + + +//************************************ +//* * +//* HGSS * +//* * +//************************************ +u16 NationalPokedexNumToSpeciesHGSS(u16 nationalNum) +{ + u16 species; + + if (!nationalNum) + return 0; + + #ifndef POKEMON_EXPANSION + return NationalPokedexNumToSpecies(nationalNum); + #else + if (sPokedexView->formSpecies != 0) + return sPokedexView->formSpecies; + else + return NationalPokedexNumToSpecies(nationalNum); + #endif +} + +static void LoadTilesetTilemapHGSS(u8 page) +{ + switch (page) + { + case INFO_SCREEN: + if (!HGSS_DECAPPED) + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_1_Gfx, 0x2000, 0, 0); + else + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_1_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenInfo_Tilemap, 0, 0); + break; + case STATS_SCREEN: + if (!HGSS_DECAPPED) + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_1_Gfx, 0x2000, 0, 0); + else + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_1_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenStats_Tilemap, 0, 0); + break; + case EVO_SCREEN: + if (!HGSS_DECAPPED) + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_2_Gfx, 0x2000, 0, 0); + else + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_2_Gfx, 0x2000, 0, 0); + #ifndef POKEMON_EXPANSION + CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenEvolution_Tilemap, 0, 0); + #endif + #ifdef POKEMON_EXPANSION + CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenEvolution_Tilemap_PE, 0, 0); + #endif + break; + case FORMS_SCREEN: //Pokemonexpansion only (rhh) + if (!HGSS_DECAPPED) + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_2_Gfx, 0x2000, 0, 0); + else + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_2_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenForms_Tilemap, 0, 0); + break; + case CRY_SCREEN: + if (!HGSS_DECAPPED) + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_3_Gfx, 0x2000, 0, 0); + else + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_3_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenCry_Tilemap, 0, 0); + break; + case SIZE_SCREEN: + if (!HGSS_DECAPPED) + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_3_Gfx, 0x2000, 0, 0); + else + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_3_Gfx, 0x2000, 0, 0); + CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenSize_Tilemap, 0, 0); + break; + } +} + +//Physical/Special Split from BE +#ifdef BATTLE_ENGINE +static u8 ShowSplitIcon(u32 split) +{ + if (sPokedexView->splitIconSpriteId == 0xFF) + sPokedexView->splitIconSpriteId = CreateSprite(&sSpriteTemplate_SplitIcons, 139, 90, 0); + + gSprites[sPokedexView->splitIconSpriteId].invisible = FALSE; + StartSpriteAnim(&gSprites[sPokedexView->splitIconSpriteId], split); + return sPokedexView->splitIconSpriteId; +} +static void DestroySplitIcon(void) +{ + if (sPokedexView->splitIconSpriteId != 0xFF) + DestroySprite(&gSprites[sPokedexView->splitIconSpriteId]); + sPokedexView->splitIconSpriteId = 0xFF; +} +#endif + + + +//************************************ +//* * +//* STATS * +//* * +//************************************ +static const u8 sStatsPageNavigationTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY}; + +static void StatsPage_PrintNavigationButtons(void) +{ + u8 x = 9; + u8 y = 0; + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_STATS_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons); + else + AddTextPrinterParameterized3(WIN_STATS_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_Stats_Buttons_Decapped); + + PutWindowTilemap(WIN_STATS_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_STATS_NAVIGATION_BUTTONS, 3); +} + +static void ResetStatsWindows(void) +{ + u8 i; + + FreeAllWindowBuffers(); + InitWindows(sStatsScreen_WindowTemplates); + + for (i = 0; i < WIN_STATS_END + 1; i++) + { + FillWindowPixelBuffer(i, PIXEL_FILL(0)); + PutWindowTilemap(i); + CopyWindowToVram(i, 3); + } +} + +static void SaveMonDataInStruct(void) +{ + u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); + u8 EVs[6] = {gSpeciesInfo[species].evYield_HP, gSpeciesInfo[species].evYield_Speed, gSpeciesInfo[species].evYield_Attack, gSpeciesInfo[species].evYield_SpAttack, gSpeciesInfo[species].evYield_Defense, gSpeciesInfo[species].evYield_SpDefense}; + u8 differentEVs; + u8 i; + + //Count how many different EVs + for (i = 0; i<6; i++) + { + if (EVs[i] > 0) //HP//Speed//Attack//Special Attack//Defense//Special Defense + differentEVs++; + } + + sPokedexView->sPokemonStats.species = species; + sPokedexView->sPokemonStats.genderRatio = gSpeciesInfo[species].genderRatio; + sPokedexView->sPokemonStats.baseHP = gSpeciesInfo[species].baseHP; + sPokedexView->sPokemonStats.baseSpeed = gSpeciesInfo[species].baseSpeed; + sPokedexView->sPokemonStats.baseAttack = gSpeciesInfo[species].baseAttack; + sPokedexView->sPokemonStats.baseSpAttack = gSpeciesInfo[species].baseSpAttack; + sPokedexView->sPokemonStats.baseDefense = gSpeciesInfo[species].baseDefense; + sPokedexView->sPokemonStats.baseSpDefense = gSpeciesInfo[species].baseSpDefense; + sPokedexView->sPokemonStats.differentEVs = differentEVs; + sPokedexView->sPokemonStats.evYield_HP = EVs[0]; + sPokedexView->sPokemonStats.evYield_Speed = EVs[1]; + sPokedexView->sPokemonStats.evYield_Attack = EVs[2]; + sPokedexView->sPokemonStats.evYield_SpAttack = EVs[3]; + sPokedexView->sPokemonStats.evYield_Defense = EVs[4]; + sPokedexView->sPokemonStats.evYield_SpDefense = EVs[5]; + sPokedexView->sPokemonStats.catchRate = gSpeciesInfo[species].catchRate; + sPokedexView->sPokemonStats.growthRate = gSpeciesInfo[species].growthRate; + sPokedexView->sPokemonStats.eggGroup1 = gSpeciesInfo[species].eggGroups[0]; + sPokedexView->sPokemonStats.eggGroup2 = gSpeciesInfo[species].eggGroups[1]; + sPokedexView->sPokemonStats.eggCycles = gSpeciesInfo[species].eggCycles; + sPokedexView->sPokemonStats.expYield = gSpeciesInfo[species].expYield; + sPokedexView->sPokemonStats.friendship = gSpeciesInfo[species].friendship; + sPokedexView->sPokemonStats.ability0 = GetAbilityBySpecies(species, 0); + sPokedexView->sPokemonStats.ability1 = GetAbilityBySpecies(species, 1); + #ifdef POKEMON_EXPANSION + sPokedexView->sPokemonStats.abilityHidden = GetAbilityBySpecies(species, 2); + #endif +} + +#define tMonSpriteId data[4] + +static void Task_LoadStatsScreen(u8 taskId) +{ + switch (gMain.state) + { + case 0: + default: + if (!gPaletteFade.active) + { + u16 r2; + + sPokedexView->currentPage = STATS_SCREEN; + gPokedexVBlankCB = gMain.vblankCallback; + SetVBlankCallback(NULL); + r2 = 0; + if (gTasks[taskId].data[1] != 0) + r2 += DISPCNT_OBJ_ON; + if (gTasks[taskId].data[2] != 0) + r2 |= DISPCNT_BG1_ON; + ResetOtherVideoRegisters(r2); + gMain.state = 1; + } + break; + case 1: + LoadTilesetTilemapHGSS(STATS_SCREEN); + + ResetStatsWindows(); + + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + gMain.state++; + break; + case 2: + LoadScreenSelectBarMain(0xD); + LoadPokedexBgPalette(sPokedexView->isSearchResults); + gMain.state++; + break; + case 3: + sPokedexView->typeIconSpriteIds[0] = 0xFF; + sPokedexView->typeIconSpriteIds[1] = 0xFF; + CreateTypeIconSprites(); + #ifdef BATTLE_ENGINE + sPokedexView->splitIconSpriteId = 0xFF; //Physical/Special Split from BE + LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); //Physical/Special Split from BE + LoadCompressedSpriteSheet(&sSpriteSheet_SplitIcons); //Physical/Special Split from BE + LoadSpritePalette(&sSpritePal_SplitIcons); //Physical/Special Split from BE + #endif + gMain.state++; + break; + case 4: + SaveMonDataInStruct(); + sPokedexView->moveSelected = 0; + sPokedexView->movesTotal = 0; + sPokedexView->numEggMoves = 0; + sPokedexView->numLevelUpMoves = 0; + sPokedexView->numTMHMMoves = 0; + if (CalculateMoves()) + gMain.state++; + break; + case 5: + if (gTasks[taskId].data[1] == 0) + { + //Icon + FreeMonIconPalettes(); //Free space for new pallete + LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon + #ifndef POKEMON_EXPANSION + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0, TRUE); //Create pokemon sprite + #endif + #ifdef POKEMON_EXPANSION + gTasks[taskId].data[6] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite + #endif + gSprites[gTasks[taskId].data[4]].oam.priority = 0; + } + gMain.state++; + break; + case 6: + gTasks[taskId].data[5] = 0; + PrintStatsScreen_NameGender(taskId, sPokedexListItem->dexNum, sPokedexView->dexMode == DEX_MODE_HOENN ? FALSE : TRUE); + PrintStatsScreen_Left(taskId); + PrintStatsScreen_Abilities(taskId); + PrintStatsScreen_Moves_Top(taskId); + PrintStatsScreen_Moves_Description(taskId); + PrintStatsScreen_Moves_BottomText(taskId); + PrintStatsScreen_Moves_Bottom(taskId); + if (!sPokedexListItem->owned) + LoadPalette(gPlttBufferUnfaded + 1, 0x31, 0x1E); + StatsPage_PrintNavigationButtons(); //gText_Stats_Buttons + gMain.state++; + break; + case 7: + { + u32 preservedPalettes = 0; + + if (gTasks[taskId].data[2] != 0) + preservedPalettes = 0x14; // each bit represents a palette index + if (gTasks[taskId].data[1] != 0) + preservedPalettes |= (1 << (gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum + 16)); + BeginNormalPaletteFade(~preservedPalettes, 0, 16, 0, RGB_BLACK); + SetVBlankCallback(gPokedexVBlankCB); + gMain.state++; + } + break; + case 8: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + HideBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 9: + if (!gPaletteFade.active) + gMain.state++; + break; + case 10: + gMain.state++; + break; + case 11: + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 1; + gTasks[taskId].func = Task_HandleStatsScreenInput; + gMain.state = 0; + break; + } +} + +static void FreeStatsScreenWindowAndBgBuffers(void) +{ + void *tilemapBuffer; + + FreeAllWindowBuffers(); + tilemapBuffer = GetBgTilemapBuffer(0); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(1); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(2); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(3); + if (tilemapBuffer) + Free(tilemapBuffer); +} + +static void Task_HandleStatsScreenInput(u8 taskId) +{ + if (JOY_NEW(A_BUTTON)) + { + PlaySE(SE_DEX_PAGE); + if (gTasks[taskId].data[5] == 0) + gTasks[taskId].data[5] = 1; + else + gTasks[taskId].data[5] = 0; + + FillWindowPixelBuffer(WIN_STATS_LEFT, PIXEL_FILL(0)); + PrintStatsScreen_Left(taskId); + + FillWindowPixelBuffer(WIN_STATS_MOVES_DESCRIPTION, PIXEL_FILL(0)); + PrintStatsScreen_Moves_Description(taskId); + + FillWindowPixelBuffer(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0)); + PrintStatsScreen_Moves_BottomText(taskId); + PrintStatsScreen_Moves_Bottom(taskId); + + #ifdef POKEMON_EXPANSION + FillWindowPixelBuffer(WIN_STATS_ABILITIES, PIXEL_FILL(0)); + PrintStatsScreen_Abilities(taskId); + #endif + } + if (JOY_NEW(B_BUTTON)) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_ExitStatsScreen; + PlaySE(SE_PC_OFF); + return; + } + + //Change moves + if (JOY_REPEAT(DPAD_UP) && sPokedexView->moveSelected > 0) + { + sPokedexView->moveSelected -= 1; + PlaySE(SE_SELECT); + FillWindowPixelBuffer(WIN_STATS_MOVES_TOP, PIXEL_FILL(0)); + PrintStatsScreen_DestroyMoveItemIcon(taskId); + PrintStatsScreen_Moves_Top(taskId); + + FillWindowPixelBuffer(WIN_STATS_MOVES_DESCRIPTION, PIXEL_FILL(0)); + PrintStatsScreen_Moves_Description(taskId); + + FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 50, 0, 20, 16); + FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 120, 0, 20, 16); + PrintStatsScreen_Moves_Bottom(taskId); + } + if (JOY_REPEAT(DPAD_DOWN) && sPokedexView->moveSelected < sPokedexView->movesTotal -1 ) + { + sPokedexView->moveSelected = sPokedexView->moveSelected + 1; + PlaySE(SE_SELECT); + FillWindowPixelBuffer(WIN_STATS_MOVES_TOP, PIXEL_FILL(0)); + PrintStatsScreen_DestroyMoveItemIcon(taskId); + PrintStatsScreen_Moves_Top(taskId); + + FillWindowPixelBuffer(WIN_STATS_MOVES_DESCRIPTION, PIXEL_FILL(0)); + PrintStatsScreen_Moves_Description(taskId); + + FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 50, 0, 20, 16); + FillWindowPixelRect(WIN_STATS_MOVES_BOTTOM, PIXEL_FILL(0), 120, 0, 20, 16); + PrintStatsScreen_Moves_Bottom(taskId); + } + + //Switch screens + if ((JOY_NEW(DPAD_LEFT) || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) + { + sPokedexView->selectedScreen = INFO_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromStatsScreen; + PlaySE(SE_PIN); + } + if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) + { + if (!sPokedexListItem->owned) + PlaySE(SE_FAILURE); + else + { + sPokedexView->selectedScreen = EVO_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 3; + gTasks[taskId].func = Task_SwitchScreensFromStatsScreen; + PlaySE(SE_PIN); + } + } +} + +#define ITEM_TAG 0xFDF3 + +static void PrintStatsScreen_DestroyMoveItemIcon(u8 taskId) +{ + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon +} + +static bool8 CalculateMoves(void) +{ + u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); + + u16 statsMovesEgg[EGG_MOVES_ARRAY_COUNT] = {0}; + u16 statsMovesLevelUp[MAX_LEVEL_UP_MOVES] = {0}; + u16 statsMovesTMHM[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; + #ifndef BATTLE_ENGINE + u16 statsMovesTutor[TUTOR_MOVE_COUNT] = {0}; + #else + u16 move; + #endif + + u8 numEggMoves = 0; + u8 numLevelUpMoves = 0; + u8 numTMHMMoves = 0; + u8 numTutorMoves = 0; + u16 movesTotal = 0; + u8 i,j; + + #ifdef POKEMON_EXPANSION + // Mega pokemon don't have distinct learnsets from their base form; so use base species for calculation + if (species >= SPECIES_VENUSAUR_MEGA && species <= SPECIES_GROUDON_PRIMAL) + species = GetFormSpeciesId(species, 0); + #endif + + //Calculate amount of Egg and LevelUp moves + numEggMoves = GetEggMovesSpecies(species, statsMovesEgg); + numLevelUpMoves = GetLevelUpMovesBySpecies(species, statsMovesLevelUp); + + //Egg moves + for (i=0; i < numEggMoves; i++) + { + sStatsMoves[movesTotal] = statsMovesEgg[i]; + movesTotal++; + } + + //Level up moves + for (i=0; i < numLevelUpMoves; i++) + { + sStatsMoves[movesTotal] = statsMovesLevelUp[i]; + movesTotal++; + } + + #ifndef BATTLE_ENGINE + //TMHM moves + for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) + { + if (CanSpeciesLearnTMHM(species, j)) + { + sStatsMoves[movesTotal] = ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + j); + movesTotal++; + sStatsMovesTMHM_ID[numTMHMMoves] = (ITEM_TM01_FOCUS_PUNCH + j); + numTMHMMoves++; + } + } + + //Tutor moves + for (i=0; i < TUTOR_MOVE_COUNT; i++) + { + if (CanLearnTutorMove(species, i)) //if (sTutorLearnsets[species] & (1 << i)) + { + sStatsMoves[movesTotal] = gTutorMoves[i]; + numTutorMoves++; + movesTotal++; + } + } + #else + for (i = 0; gTeachableLearnsets[species][i] != MOVE_UNAVAILABLE; i++) + { + move = gTeachableLearnsets[species][i]; + for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) + { + if (GetTMHMMoves(j) == move) + { + sStatsMovesTMHM_ID[numTMHMMoves] = (ITEM_TM01_FOCUS_PUNCH + j); + numTMHMMoves++; + break; + } + } + if (j >= NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES) + numTutorMoves++; + + sStatsMoves[movesTotal] = move; + movesTotal++; + } + + #endif + + sPokedexView->numEggMoves = numEggMoves; + sPokedexView->numLevelUpMoves = numLevelUpMoves; + sPokedexView->numTMHMMoves = numTMHMMoves; + sPokedexView->numTutorMoves = numTutorMoves; + sPokedexView->movesTotal = movesTotal; + + return TRUE; +} + +static void PrintStatsScreen_Moves_Top(u8 taskId) +{ + u8 numEggMoves = sPokedexView->numEggMoves; + u8 numLevelUpMoves = sPokedexView->numLevelUpMoves; + u8 numTMHMMoves = sPokedexView->numTMHMMoves; + u8 numTutorMoves = sPokedexView->numTutorMoves; + u8 movesTotal = sPokedexView->movesTotal; + u8 selected = sPokedexView->moveSelected; + u8 level; + u8 moves_x = 5; + u8 moves_y = 3; + u16 move; + u16 item; + + u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); + + //Move + move = sStatsMoves[selected]; + + //Moves selected from move max + ConvertIntToDecimalStringN(gStringVar1, (selected+1), STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar2, movesTotal, STR_CONV_MODE_RIGHT_ALIGN, 3); + StringExpandPlaceholders(gStringVar1, gText_Stats_MoveSelectedMax); + PrintStatsScreenTextSmallWhite(WIN_STATS_MOVES_TOP, gStringVar1, moves_x-1, moves_y+1); + + //Move name + StringCopy(gStringVar3, gMoveNames[move]); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 20); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gStringVar3, moves_x, moves_y + 17); + + //Draw move type icon + if (gTasks[taskId].data[5] == 0) + { + SetTypeIconPosAndPal(gBattleMoves[move].type, moves_x + 146, moves_y + 17, 0); + SetSpriteInvisibility(1, TRUE); + } + else + { + SetTypeIconPosAndPal(NUMBER_OF_MON_TYPES + gContestMoves[move].contestCategory, moves_x + 146, moves_y + 17, 1); + SetSpriteInvisibility(0, TRUE); + } + + //Calculate and retrieve correct move from the arrays + if (selected < numEggMoves) + { + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gText_ThreeDashes, moves_x + 113, moves_y + 9); + item = ITEM_LUCKY_EGG; + } + else if (selected < (numEggMoves + numLevelUpMoves)) + { + #if defined (BATTLE_ENGINE) || defined (POKEMON_EXPANSION) + level = gLevelUpLearnsets[species][(selected-numEggMoves)].level; + #else + //Calculate level of the move + while (((gLevelUpLearnsets[species][(selected-numEggMoves)] & LEVEL_UP_MOVE_LV) != (level << 9)) && level < 0xFF) + { + level++; + if (gLevelUpLearnsets[species][(selected-numEggMoves)] == LEVEL_UP_END) + level = 0xFF; + } + #endif + ConvertIntToDecimalStringN(gStringVar1, level, STR_CONV_MODE_LEFT_ALIGN, 3); //Move learn lvl + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gText_Stats_MoveLevel, moves_x + 113, moves_y + 3); //Level text + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gStringVar1, moves_x + 113, moves_y + 14); //Print level + item = ITEM_EXP_SHARE; + } + else if (selected < (numEggMoves + numLevelUpMoves + numTMHMMoves)) + { + CopyItemName(sStatsMovesTMHM_ID[(selected-numEggMoves-numLevelUpMoves)], gStringVar1); //TM name + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gStringVar1, moves_x + 113, moves_y + 9); + item = sStatsMovesTMHM_ID[(selected-numEggMoves-numLevelUpMoves)]; + } + else if (selected < (numEggMoves + numLevelUpMoves + numTMHMMoves + numTutorMoves)) + { + PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gText_ThreeDashes, moves_x + 113, moves_y + 9); + item = ITEM_TEACHY_TV; + } + else + { + StringCopy(gStringVar4, gText_CommunicationError); + item = ITEM_MASTER_BALL; + } + + //Egg/TM/Level/Tutor Item Icon + gTasks[taskId].data[3] = AddItemIconSprite(ITEM_TAG, ITEM_TAG, item); + gSprites[gTasks[taskId].data[3]].x2 = 203; + gSprites[gTasks[taskId].data[3]].y2 = 39; + gSprites[gTasks[taskId].data[3]].oam.priority = 0; + +} + +static void PrintStatsScreen_Moves_Description(u8 taskId) +{ + u8 selected = sPokedexView->moveSelected; + u16 move; + u8 moves_x = 5; + u8 moves_y = 5; + + //Move + move = sStatsMoves[selected]; + + //Move description + if (gTasks[taskId].data[5] == 0) + { + StringCopy(gStringVar4, gMoveDescriptionPointers[(move - 1)]); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_DESCRIPTION, gStringVar4, moves_x, moves_y); + } + else + { + StringCopy(gStringVar4, gContestEffectDescriptionPointers[gContestMoves[move].effect]); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_DESCRIPTION, gStringVar4, moves_x, moves_y); + } +} + +static void PrintStatsScreen_Moves_BottomText(u8 taskId) +{ + u8 moves_x = 8; + u8 moves_y = 3; + if (gTasks[taskId].data[5] == 0) + { + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Power, moves_x, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Accuracy2, moves_x + 66, moves_y); + } + else + { + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Appeal, moves_x, moves_y); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gText_Jam, moves_x + 66, moves_y); + } +} + +static void PrintStatsScreen_Moves_Bottom(u8 taskId) +{ + u8 moves_x = 8; + u8 moves_y = 3; + u8 selected = sPokedexView->moveSelected; + u16 move; + //Contest + u8 contest_effectValue; + u8 contest_appeal = 0; + u8 contest_jam = 0; + + //Move + move = sStatsMoves[selected]; + + //Power + Accuracy + if (gTasks[taskId].data[5] == 0) + { + //Power + if (gBattleMoves[move].power < 2) + StringCopy(gStringVar1, gText_ThreeDashes); + else + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar1, moves_x + 45, moves_y); + //Physical/Special Split from BE + #ifdef BATTLE_ENGINE + DestroySplitIcon(); + ShowSplitIcon(GetBattleMoveSplit(move)); + #endif + //Accuracy + if (gBattleMoves[move].accuracy == 0) + StringCopy(gStringVar1, gText_ThreeDashes); + else + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].accuracy, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar1, moves_x + 114, moves_y); + } + else //Appeal + Jam + { + #ifdef BATTLE_ENGINE + DestroySplitIcon(); + gSprites[sPokedexView->splitIconSpriteId].invisible = TRUE; + #endif + //Appeal + contest_effectValue = gContestEffects[gContestMoves[move].effect].appeal; + if (contest_effectValue != 0xFF) + contest_appeal = contest_effectValue / 10; + ConvertIntToDecimalStringN(gStringVar1, contest_appeal, STR_CONV_MODE_RIGHT_ALIGN, 1); + StringCopy(gStringVar2, gText_PlusSymbol); + StringAppend(gStringVar2, gStringVar1); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar2, moves_x + 45, moves_y); + + //Jam + contest_effectValue = gContestEffects[gContestMoves[move].effect].jam; + if (contest_effectValue != 0xFF) + contest_jam = contest_effectValue / 10; + ConvertIntToDecimalStringN(gStringVar1, contest_jam, STR_CONV_MODE_RIGHT_ALIGN, 1); + StringCopy(gStringVar2, gText_Stats_Minus); + StringAppend(gStringVar2, gStringVar1); + PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar2, moves_x + 119, moves_y); + } +} + +static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value) +{ + u8 str[16]; + u8 str2[32]; + u8 strEV[25]; + u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); + u16 natNum; + u8 evVal; + const u8 *category; + const u8 *description; + const u8 *strEVtype; + + u8 base_x = 38; + u8 base_y = 0; + u8 gender_x, gender_y; + + //Name + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gSpeciesNames[species], base_x, base_y); + + //Number + if (value == 0) + value = NationalToHoennOrder(num); + else + value = num; + ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, str, base_x, base_y + 10); + + //Gender ratio //MON_GENDERLESS == 0xFF + gender_x = base_x; + gender_y = base_y + 20; + switch (sPokedexView->sPokemonStats.genderRatio) + { + case 0: + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_0, gender_x, gender_y); + break; + case 31: + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_12_5, gender_x, gender_y); + break; + case 63: + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_25, gender_x, gender_y); + break; + case 127: + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_50, gender_x, gender_y); + break; + case 191: + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_75, gender_x, gender_y); + break; + case 223: + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_87_5, gender_x, gender_y); + break; + case 254: + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_Stats_Gender_100, gender_x, gender_y); + break; + default: + PrintStatsScreenTextSmall(WIN_STATS_NAME_GENDER, gText_ThreeDashes, gender_x, gender_y); + break; + } +} + +static u8 PrintMonStatsToggle_DifferentEVsColumn(u8 differentEVs) +{ + if (differentEVs == 1 || differentEVs == 3) + return 0; + else + return 1; +} + +static u8 PrintMonStatsToggle_DifferentEVsRow(u8 differentEVs) +{ + if (differentEVs == 1 || differentEVs == 2) + return 0; + else + return 1; +} + +static u8* PrintMonStatsToggle_EV_Arrows(u8 *dest, u8 value) +{ + switch (value) + { + case 1: + StringCopy(dest, gText_Stats_EV_Plus1); + break; + case 2: + StringCopy(dest, gText_Stats_EV_Plus2); + break; + case 3: + StringCopy(dest, gText_Stats_EV_Plus3); + break; + } + return dest; +} + +static void PrintStatsScreen_Left(u8 taskId) +{ + u8 base_x = 8; + u8 x_offset_column = 43; + u8 x_offset_value = 26; + u8 column = 0; + u8 base_x_offset = 70; + u8 base_x_first_row = 23; + u8 base_x_second_row = 43; + u8 base_y_offset = 11; + u8 base_i = 0; + u8 base_y = 5; + u32 align_x; + u8 total_x = 93; + u8 strEV[25]; + u8 strBase[14]; + u8 EVs[6] = {sPokedexView->sPokemonStats.evYield_HP, sPokedexView->sPokemonStats.evYield_Speed, sPokedexView->sPokemonStats.evYield_Attack, sPokedexView->sPokemonStats.evYield_SpAttack, sPokedexView->sPokemonStats.evYield_Defense, sPokedexView->sPokemonStats.evYield_SpDefense}; + u8 differentEVs = 0; + u8 i; + + //Base stats + if (gTasks[taskId].data[5] == 0) + { + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_HP, base_x, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseHP, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); + + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Speed, base_x+base_x_second_row, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseSpeed, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); + + base_i++; + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Attack, base_x, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); + + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_SpAttack, base_x+base_x_second_row, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseSpAttack, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); + + base_i++; + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Defense, base_x, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_first_row, base_y + base_y_offset*base_i); + + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_SpDefense, base_x+base_x_second_row, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(strBase, sPokedexView->sPokemonStats.baseSpDefense, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strBase, base_x+base_x_offset, base_y + base_y_offset*base_i); + base_i++; + } + else //EV increases + { + //If 1 or 2 EVs display with the same layout as the base stats + if (sPokedexView->sPokemonStats.differentEVs < 3) + { + differentEVs = 0; + //HP + if (EVs[0] > 0) + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + StringCopy(gStringVar1, gText_Stats_HP); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[0]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + } + //Speed + if (EVs[1]> 0) + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + StringCopy(gStringVar1, gText_Stats_Speed); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[1]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + } + //Attack + if (EVs[2] > 0) + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + StringCopy(gStringVar1, gText_Stats_Attack); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[2]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + } + //Special Attack + if (EVs[3] > 0) + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + StringCopy(gStringVar1, gText_Stats_SpAttack); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[3]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + } + //Defense + if (EVs[4] > 0) + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + StringCopy(gStringVar1, gText_Stats_Defense); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[4]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + } + //Special Defense + if (EVs[5] > 0) + { + differentEVs++; + column = PrintMonStatsToggle_DifferentEVsColumn(differentEVs); + base_i = PrintMonStatsToggle_DifferentEVsRow(differentEVs); + StringCopy(gStringVar1, gText_Stats_SpDefense); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[5]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + x_offset_column*column, base_y + base_y_offset*base_i); + } + } + else //3 different EVs in 1 row + { + column = 0; + //HP + if (EVs[0] > 0) + { + StringCopy(gStringVar1, gText_Stats_HP); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[0]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + column++; + } + //Speed + if (EVs[1] > 0) + { + StringCopy(gStringVar1, gText_Stats_Speed); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[1]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + column++; + } + //Attack + if (EVs[2] > 0) + { + StringCopy(gStringVar1, gText_Stats_Attack); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[2]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + column++; + } + //Special Attack + if (EVs[3] > 0) + { + StringCopy(gStringVar1, gText_Stats_SpAttack); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[3]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + column++; + } + //Defense + if (EVs[4] > 0) + { + StringCopy(gStringVar1, gText_Stats_Defense); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[4]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + column++; + } + //Special Defense + if (EVs[5] > 0) + { + StringCopy(gStringVar1, gText_Stats_SpDefense); + PrintMonStatsToggle_EV_Arrows(gStringVar2, EVs[5]); + StringExpandPlaceholders(gStringVar3, gText_Stats_EvStr1Str2); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x + 29*column, base_y + base_y_offset*base_i); + column++; + } + } + base_i++; + } + + //TOGGLE-------------------------------------- + if (gTasks[taskId].data[5] == 0) + { + u32 catchRate = sPokedexView->sPokemonStats.catchRate; + u32 growthRate = sPokedexView->sPokemonStats.growthRate; + + //Catch rate + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate, base_x, base_y + base_y_offset*base_i); + if (catchRate <= 10) + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Legend, base_x + x_offset_column, base_y + base_y_offset*base_i); + else if (catchRate <= 70) + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_VeryHard, base_x + x_offset_column, base_y + base_y_offset*base_i); + else if (catchRate <= 100) + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Difficult, base_x + x_offset_column, base_y + base_y_offset*base_i); + else if (catchRate <= 150) + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Medium, base_x + x_offset_column, base_y + base_y_offset*base_i); + else if (catchRate <= 200) + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Relaxed, base_x + x_offset_column, base_y + base_y_offset*base_i); + else + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_CatchRate_Easy, base_x + x_offset_column, base_y + base_y_offset*base_i); + base_i++; + + //Growth rate + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Growthrate, base_x, base_y + base_y_offset*base_i); + switch (growthRate) + { + case GROWTH_MEDIUM_FAST: + StringCopy(strEV, gText_Stats_MEDIUM_FAST); + break; + case GROWTH_ERRATIC: + StringCopy(strEV, gText_Stats_ERRATIC); + break; + case GROWTH_FLUCTUATING: + StringCopy(strEV, gText_Stats_FLUCTUATING); + break; + case GROWTH_MEDIUM_SLOW: + StringCopy(strEV, gText_Stats_MEDIUM_SLOW); + break; + case GROWTH_FAST: + StringCopy(strEV, gText_Stats_FAST); + break; + case GROWTH_SLOW: + StringCopy(strEV, gText_Stats_SLOW); + break; + default: + break; + } + align_x = GetStringRightAlignXOffset(0, strEV, total_x); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strEV, align_x, base_y + base_y_offset*base_i); + } + else + { + //Exp Yield + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_ExpYield, base_x, base_y + base_y_offset*base_i); + ConvertIntToDecimalStringN(gStringVar1, sPokedexView->sPokemonStats.expYield, STR_CONV_MODE_RIGHT_ALIGN, 3); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar1, base_x + base_x_offset, base_y + base_y_offset*base_i); + base_i++; + + //Friendship + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_Friendship, base_x, base_y + base_y_offset*base_i); + switch (sPokedexView->sPokemonStats.friendship) + { + case 35: + StringCopy(strEV, gText_Stats_Friendship_BigAnger); + break; + case 70: + StringCopy(strEV, gText_Stats_Friendship_Neutral); + break; + case 90: + StringCopy(strEV, gText_Stats_Friendship_Happy); + break; + case 100: + StringCopy(strEV, gText_Stats_Friendship_Happy); + break; + case 140: + StringCopy(strEV, gText_Stats_Friendship_BigSmile); + break; + default: + ConvertIntToDecimalStringN(strEV, sPokedexView->sPokemonStats.friendship, STR_CONV_MODE_RIGHT_ALIGN, 3); + break; + } + align_x = GetStringRightAlignXOffset(0, strEV, total_x); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strEV, align_x, base_y + base_y_offset*base_i); + base_i++; + + //Egg cycles + if (sPokedexView->sPokemonStats.eggGroup1 == EGG_GROUP_UNDISCOVERED || sPokedexView->sPokemonStats.eggGroup2 == EGG_GROUP_UNDISCOVERED) //Species without eggs (legendaries etc) + { + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_ThreeDashes, 78, base_y + base_y_offset*base_i); + } + else + { + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); + if (sPokedexView->sPokemonStats.eggCycles <= 10) + { + StringCopy(strEV, gText_Stats_EggCycles_VeryFast); + align_x = 76; + } + else if (sPokedexView->sPokemonStats.eggCycles <= 20) + { + StringCopy(strEV, gText_Stats_EggCycles_Fast); + align_x = 85; + } + else if (sPokedexView->sPokemonStats.eggCycles <= 30) + { + StringCopy(strEV, gText_Stats_EggCycles_Normal); + align_x = 76; + } + else + { + StringCopy(strEV, gText_Stats_EggCycles_Slow); + align_x = 67; + } + PrintStatsScreenTextSmall(WIN_STATS_LEFT, strEV, align_x, base_y + base_y_offset*base_i); + } + base_i++; + + //Egg group 1 + switch (sPokedexView->sPokemonStats.eggGroup1) + { + case EGG_GROUP_MONSTER : + StringCopy(gStringVar1, gText_Stats_eggGroup_MONSTER); + break; + case EGG_GROUP_WATER_1 : + StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_1); + break; + case EGG_GROUP_BUG : + StringCopy(gStringVar1, gText_Stats_eggGroup_BUG); + break; + case EGG_GROUP_FLYING : + StringCopy(gStringVar1, gText_Stats_eggGroup_FLYING); + break; + case EGG_GROUP_FIELD : + StringCopy(gStringVar1, gText_Stats_eggGroup_FIELD); + break; + case EGG_GROUP_FAIRY : + StringCopy(gStringVar1, gText_Stats_eggGroup_FAIRY); + break; + case EGG_GROUP_GRASS : + StringCopy(gStringVar1, gText_Stats_eggGroup_GRASS); + break; + case EGG_GROUP_HUMAN_LIKE : + StringCopy(gStringVar1, gText_Stats_eggGroup_HUMAN_LIKE); + break; + case EGG_GROUP_WATER_3 : + StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_3); + break; + case EGG_GROUP_MINERAL : + StringCopy(gStringVar1, gText_Stats_eggGroup_MINERAL); + break; + case EGG_GROUP_AMORPHOUS : + StringCopy(gStringVar1, gText_Stats_eggGroup_AMORPHOUS); + break; + case EGG_GROUP_WATER_2 : + StringCopy(gStringVar1, gText_Stats_eggGroup_WATER_2); + break; + case EGG_GROUP_DITTO : + StringCopy(gStringVar1, gText_Stats_eggGroup_DITTO); + break; + case EGG_GROUP_DRAGON : + StringCopy(gStringVar1, gText_Stats_eggGroup_DRAGON); + break; + case EGG_GROUP_UNDISCOVERED: + StringCopy(gStringVar1, gText_Stats_eggGroup_UNDISCOVERED); + break; + } + //Egg group 2 + if (sPokedexView->sPokemonStats.eggGroup1 != sPokedexView->sPokemonStats.eggGroup2) + { + switch (sPokedexView->sPokemonStats.eggGroup2) + { + case EGG_GROUP_MONSTER : + StringCopy(gStringVar2, gText_Stats_eggGroup_MONSTER); + break; + case EGG_GROUP_WATER_1 : + StringCopy(gStringVar2, gText_Stats_eggGroup_WATER_1); + break; + case EGG_GROUP_BUG : + StringCopy(gStringVar2, gText_Stats_eggGroup_BUG); + break; + case EGG_GROUP_FLYING : + StringCopy(gStringVar2, gText_Stats_eggGroup_FLYING); + break; + case EGG_GROUP_FIELD : + StringCopy(gStringVar2, gText_Stats_eggGroup_FIELD); + break; + case EGG_GROUP_FAIRY : + StringCopy(gStringVar2, gText_Stats_eggGroup_FAIRY); + break; + case EGG_GROUP_GRASS : + StringCopy(gStringVar2, gText_Stats_eggGroup_GRASS); + break; + case EGG_GROUP_HUMAN_LIKE : + StringCopy(gStringVar2, gText_Stats_eggGroup_HUMAN_LIKE); + break; + case EGG_GROUP_WATER_3 : + StringCopy(gStringVar2, gText_Stats_eggGroup_WATER_3); + break; + case EGG_GROUP_MINERAL : + StringCopy(gStringVar2, gText_Stats_eggGroup_MINERAL); + break; + case EGG_GROUP_AMORPHOUS : + StringCopy(gStringVar2, gText_Stats_eggGroup_AMORPHOUS); + break; + case EGG_GROUP_WATER_2 : + StringCopy(gStringVar2, gText_Stats_eggGroup_WATER_2); + break; + case EGG_GROUP_DITTO : + StringCopy(gStringVar2, gText_Stats_eggGroup_DITTO); + break; + case EGG_GROUP_DRAGON : + StringCopy(gStringVar2, gText_Stats_eggGroup_DRAGON); + break; + case EGG_GROUP_UNDISCOVERED: + StringCopy(gStringVar2, gText_Stats_eggGroup_UNDISCOVERED); + break; + } + StringExpandPlaceholders(gStringVar3, gText_Stats_eggGroup_Groups); + align_x = GetStringRightAlignXOffset(0, gStringVar3, total_x); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar3, base_x, base_y + base_y_offset*base_i); + } + else + { + align_x = GetStringRightAlignXOffset(0, gStringVar1, total_x); + PrintStatsScreenTextSmall(WIN_STATS_LEFT, gStringVar1, base_x, base_y + base_y_offset*base_i); + } + base_i++; + } +} + +static void PrintStatsScreen_Abilities(u8 taskId) +{ + u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum); + u8 abilities_x = 5; + u8 abilities_y = 3; + u16 ability0; + u16 ability1; + u16 abilityHidden; + + //Abilitie(s) + #ifdef POKEMON_EXPANSION + if (gTasks[taskId].data[5] == 0) + { + #endif + ability0 = sPokedexView->sPokemonStats.ability0; + PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability0], abilities_x, abilities_y); + PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); + + ability1 = sPokedexView->sPokemonStats.ability1; + if (ability1 != ABILITY_NONE && ability1 != ability0) + { + PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability1], abilities_x, abilities_y + 30); + PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[ability1], abilities_x, abilities_y + 44); + } + #ifdef POKEMON_EXPANSION + } + else //Hidden abilities + { + abilityHidden = sPokedexView->sPokemonStats.abilityHidden; + PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[abilityHidden], abilities_x, abilities_y); + PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[abilityHidden], abilities_x, abilities_y + 14); + } + #endif +} + +static void Task_SwitchScreensFromStatsScreen(u8 taskId) +{ + if (!gPaletteFade.active) + { + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + switch (sPokedexView->screenSwitchState) + { + case 1: + FreeAllWindowBuffers(); + InitWindows(sInfoScreen_WindowTemplates); + gTasks[taskId].func = Task_LoadAreaScreen; + break; + case 2: + gTasks[taskId].func = Task_LoadCryScreen; + break; + case 3: + FreeAllWindowBuffers(); + InitWindows(sInfoScreen_WindowTemplates); + gTasks[taskId].func = Task_LoadEvolutionScreen; + break; + default: + gTasks[taskId].func = Task_LoadInfoScreen; + break; + } + } +} + +static void Task_ExitStatsScreen(u8 taskId) +{ + if (!gPaletteFade.active) + { + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].data[3]]); //Destroy item icon + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + FreeInfoScreenWindowAndBgBuffers(); + DestroyTask(taskId); + } +} + + +//************************************ +//* * +//* EVOS * +//* * +//************************************ +static const u8 sEvoFormsPageNavigationTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY}; + +static void EvoFormsPage_PrintNavigationButtons(void) +{ + u8 x = 6; + u8 y = 0; + + FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); + + #ifdef POKEMON_EXPANSION + if (sPokedexView->selectedScreen == EVO_SCREEN) + { + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_PE); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped_PE); + } + else if (sPokedexView->selectedScreen == FORMS_SCREEN) + { + if (sPokedexView->sFormScreenData.inSubmenu) + { + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Submenu_PE); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Submenu_Decapped_PE); + } + else + { + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_PE); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Decapped_PE); + } + } + #else + if (!HGSS_DECAPPED) + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons); + else + AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped); + #endif + // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) + PutWindowTilemap(WIN_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); +} + +static void ResetEvoScreenDataStruct(void) +{ + u8 i; + sPokedexView->sEvoScreenData.numAllEvolutions = 0; + sPokedexView->sEvoScreenData.numSeen = 0; + sPokedexView->sEvoScreenData.menuPos = 0; + for (i = 0; i < 10; i++) + { + sPokedexView->sEvoScreenData.targetSpecies[i] = 0; + sPokedexView->sEvoScreenData.seen[i] = 0; + } + +} + +static void GetSeenFlagTargetSpecies(void) +{ + u8 i; + u16 species; + for (i = 0; i < sPokedexView->sEvoScreenData.numAllEvolutions; i++) + { + species = sPokedexView->sEvoScreenData.targetSpecies[i]; + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN)) + { + sPokedexView->sEvoScreenData.seen[i] = TRUE; + sPokedexView->sEvoScreenData.numSeen += 1; + } + + } +} + +static void Task_LoadEvolutionScreen(u8 taskId) +{ + switch (gMain.state) + { + case 0: + default: + if (!gPaletteFade.active) + { + u16 r2; + + sPokedexView->currentPage = EVO_SCREEN; + gPokedexVBlankCB = gMain.vblankCallback; + SetVBlankCallback(NULL); + r2 = 0; + if (gTasks[taskId].data[1] != 0) + r2 += DISPCNT_OBJ_ON; + if (gTasks[taskId].data[2] != 0) + r2 |= DISPCNT_BG1_ON; + ResetOtherVideoRegisters(r2); + gMain.state = 1; + } + break; + case 1: + LoadTilesetTilemapHGSS(EVO_SCREEN); + FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); + PutWindowTilemap(WIN_INFO); + CopyWindowToVram(WIN_INFO, 3); + FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); + PutWindowTilemap(WIN_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + gMain.state++; + break; + case 2: + LoadScreenSelectBarMain(0xD); + LoadPokedexBgPalette(sPokedexView->isSearchResults); + gMain.state++; + break; + case 3: + if (gTasks[taskId].data[1] == 0) + { + sPokedexView->selectedScreen = EVO_SCREEN; + ResetEvoScreenDataStruct(); + //Icon + FreeMonIconPalettes(); //Free space for new pallete + LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon + PrintPreEvolutions(taskId, NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); + #ifdef POKEMON_EXPANSION + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0); //Create pokemon sprite + #else + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0, TRUE); //Create pokemon sprite + #endif + EvoFormsPage_PrintNavigationButtons(); //HGSS_Ui Navigation buttons + gSprites[gTasks[taskId].data[4]].oam.priority = 0; + } + gMain.state++; + break; + case 4: + //Print evo info and icons + gTasks[taskId].data[3] = 0; + PrintEvolutionTargetSpeciesAndMethod(taskId, NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), 0, sPokedexView->numPreEvolutions); + LoadSpritePalette(&sSpritePalette_Arrow); + GetSeenFlagTargetSpecies(); + if (sPokedexView->sEvoScreenData.numAllEvolutions != 0 && sPokedexView->sEvoScreenData.numSeen != 0) + { + sPokedexView->sEvoScreenData.arrowSpriteId = CreateSprite(&sSpriteTemplate_Arrow, 7, 58, 0); + gSprites[sPokedexView->sEvoScreenData.arrowSpriteId].animNum = 2; + } + gMain.state++; + break; + case 5: + { + u32 preservedPalettes = 0; + + if (gTasks[taskId].data[2] != 0) + preservedPalettes = 0x14; // each bit represents a palette index + if (gTasks[taskId].data[1] != 0) + preservedPalettes |= (1 << (gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum + 16)); + BeginNormalPaletteFade(~preservedPalettes, 0, 16, 0, RGB_BLACK); + SetVBlankCallback(gPokedexVBlankCB); + gMain.state++; + } + break; + case 6: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + HideBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 7: + if (!gPaletteFade.active) + gMain.state++; + break; + case 8: + gMain.state++; + break; + case 9: + sPokedexView->screenSwitchState = 0; + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 1; + gTasks[taskId].func = Task_HandleEvolutionScreenInput; + gMain.state = 0; + break; + } +} + +static void Task_HandleEvolutionScreenInput(u8 taskId) +{ + //Switch to forms screen, Pokemon Expansion only (rhh) + #ifdef POKEMON_EXPANSION + if (JOY_NEW(START_BUTTON)) + { + sPokedexView->selectedScreen = FORMS_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 3; + gTasks[taskId].func = Task_SwitchScreensFromEvolutionScreen; + PlaySE(SE_PIN); + } + #endif + + if (sPokedexView->sEvoScreenData.numAllEvolutions != 0 && sPokedexView->sEvoScreenData.numSeen != 0) + { + u8 i; + u8 base_y = 58; + u8 base_y_offset = 9; + u8 pos = sPokedexView->sEvoScreenData.menuPos; + u8 max = sPokedexView->sEvoScreenData.numAllEvolutions; + if (JOY_NEW(DPAD_DOWN)) + { + while (TRUE) + { + pos += 1; + if (pos >= max) + pos = 0; + + if (sPokedexView->sEvoScreenData.seen[pos] == TRUE) + break; + } + gSprites[sPokedexView->sEvoScreenData.arrowSpriteId].y = base_y + base_y_offset * pos; + sPokedexView->sEvoScreenData.menuPos = pos; + } + else if (JOY_NEW(DPAD_UP)) + { + if (sPokedexView->sEvoScreenData.menuPos == 0) + sPokedexView->sEvoScreenData.menuPos = sPokedexView->sEvoScreenData.numAllEvolutions - 1; + else + sPokedexView->sEvoScreenData.menuPos -= 1; + + gSprites[sPokedexView->sEvoScreenData.arrowSpriteId].y = base_y + base_y_offset * sPokedexView->sEvoScreenData.menuPos; + } + + if (JOY_NEW(A_BUTTON)) + { + u16 targetSpecies = sPokedexView->sEvoScreenData.targetSpecies[sPokedexView->sEvoScreenData.menuPos]; + u16 dexNum = SpeciesToNationalPokedexNum(targetSpecies); + sPokedexListItem->dexNum = dexNum; + sPokedexListItem->seen = GetSetPokedexFlag(dexNum, FLAG_GET_SEEN); + sPokedexListItem->owned = GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT); + + #ifdef POKEMON_EXPANSION + if (gFormSpeciesIdTables[targetSpecies] != NULL) + sPokedexView->formSpecies = targetSpecies; + else + sPokedexView->formSpecies = 0; + #endif + + sPokedexView->sEvoScreenData.fromEvoPage = TRUE; + PlaySE(SE_PIN); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_LoadInfoScreenWaitForFade; + } + } + + //Exit to overview + if (JOY_NEW(B_BUTTON)) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_ExitEvolutionScreen; + PlaySE(SE_PC_OFF); + return; + } + + //Switch screens + if ((JOY_NEW(DPAD_LEFT) || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) + { + sPokedexView->selectedScreen = STATS_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromEvolutionScreen; + PlaySE(SE_PIN); + } + if ((JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))) + { + if (!sPokedexListItem->owned) + PlaySE(SE_FAILURE); + else + { + sPokedexView->selectedScreen = CRY_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 2; + gTasks[taskId].func = Task_SwitchScreensFromEvolutionScreen; + PlaySE(SE_PIN); + } + } +} + +static void HandleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u16 previousTargetSpecies, u8 base_x, u8 base_y, u8 base_y_offset, u8 base_i, bool8 isEevee) +{ + u8 iterations = 6; + bool8 seen = GetSetPokedexFlag(SpeciesToNationalPokedexNum(targetSpecies), FLAG_GET_SEEN); + + if (seen || !HGSS_HIDE_UNSEEN_EVOLUTION_NAMES) + StringCopy(gStringVar3, gSpeciesNames[targetSpecies]); //evolution mon name + else + StringCopy(gStringVar3, gText_ThreeQuestionMarks); //show questionmarks instead of name + StringExpandPlaceholders(gStringVar3, gText_EVO_Name); //evolution mon name + PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); //evolution mon name + + //Print mon icon in the top row + if (isEevee) + { + iterations = 9; + if (targetSpecies == previousTargetSpecies) + return; + #ifdef POKEMON_EXPANSION + else if (targetSpecies == SPECIES_GLACEON) + base_i -= 1; + else if (targetSpecies == SPECIES_SYLVEON) + base_i -= 2; + #endif + } + + if (base_i < iterations) + { + LoadMonIconPalette(targetSpecies); //Loads pallete for current mon + #ifndef POKEMON_EXPANSION + gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 50 + 32*base_i, 31, 4, 0, TRUE); //Create pokemon sprite + #endif + #ifdef POKEMON_EXPANSION + if (isEevee) + gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 45 + 26*base_i, 31, 4, 0); //Create pokemon sprite + else + gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 50 + 32*base_i, 31, 4, 0); //Create pokemon sprite + #endif + gSprites[gTasks[taskId].data[4+base_i]].oam.priority = 0; + } +} + +static void CreateCaughtBallEvolutionScreen(u16 targetSpecies, u8 x, u8 y, u16 unused) +{ + bool8 owned = GetSetPokedexFlag(SpeciesToNationalPokedexNum(targetSpecies), FLAG_GET_CAUGHT); + if (owned) + BlitBitmapToWindow(0, sCaughtBall_Gfx, x, y-1, 8, 16); + else + { + //FillWindowPixelRect(0, PIXEL_FILL(0), x, y, 8, 16); //not sure why this was even here + PrintInfoScreenTextSmall(gText_OneDash, x+1, y-1); + } +} + +static void HandlePreEvolutionSpeciesPrint(u8 taskId, u16 preSpecies, u16 species, u8 base_x, u8 base_y, u8 base_y_offset, u8 base_i) +{ + bool8 seen = GetSetPokedexFlag(SpeciesToNationalPokedexNum(preSpecies), FLAG_GET_SEEN); + + StringCopy(gStringVar1, gSpeciesNames[species]); //evolution mon name + + #ifdef POKEMON_EXPANSION + if (sPokedexView->sEvoScreenData.isMega) + StringExpandPlaceholders(gStringVar3, gText_EVO_PreEvo_PE_Mega); + else + { + #endif + + if (seen || !HGSS_HIDE_UNSEEN_EVOLUTION_NAMES) + StringCopy(gStringVar2, gSpeciesNames[preSpecies]); //evolution mon name + else + StringCopy(gStringVar2, gText_ThreeQuestionMarks); //show questionmarks instead of name + + StringExpandPlaceholders(gStringVar3, gText_EVO_PreEvo); //evolution mon name + + #ifdef POKEMON_EXPANSION + } + #endif + + PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); //evolution mon name + + if (base_i < 3) + { + LoadMonIconPalette(preSpecies); //Loads pallete for current mon + #ifndef POKEMON_EXPANSION + gTasks[taskId].data[4+base_i] = CreateMonIcon(preSpecies, SpriteCB_MonIcon, 18 + 32*base_i, 31, 4, 0, TRUE); //Create pokemon sprite + #endif + #ifdef POKEMON_EXPANSION + gTasks[taskId].data[4+base_i] = CreateMonIcon(preSpecies, SpriteCB_MonIcon, 18 + 32*base_i, 31, 4, 0); //Create pokemon sprite + #endif + gSprites[gTasks[taskId].data[4+base_i]].oam.priority = 0; + } +} + +static u8 PrintPreEvolutions(u8 taskId, u16 species) +{ + u16 i; + u16 j; + + u8 base_x = 13+8; + u8 base_y = 51; + u8 base_y_offset = 9; + u8 base_i = 0; + u8 depth_x = 16; + + u16 preEvolutionOne = 0; + u16 preEvolutionTwo = 0; + u8 numPreEvolutions = 0; + + #ifdef POKEMON_EXPANSION + bool8 isMega = FALSE; + sPokedexView->sEvoScreenData.isMega = FALSE; + #endif + + #ifdef TX_RANDOMIZER_AND_CHALLENGES + if (gSaveBlock1Ptr->tx_Random_Evolutions || gSaveBlock1Ptr->tx_Random_EvolutionMethods) + return 0; + #endif + + + //Calculate previous evolution + for (i = 0; i < NUM_SPECIES; i++) + { + for (j = 0; j < EVOS_PER_MON; j++) + { + if (gEvolutionTable[i][j].targetSpecies == species) + { + preEvolutionOne = i; + numPreEvolutions += 1; + #ifdef POKEMON_EXPANSION + if (gEvolutionTable[i][j].method == EVO_MEGA_EVOLUTION) + { + CopyItemName(gEvolutionTable[i][j].param, gStringVar2); //item + isMega = TRUE; + } + #endif + break; + } + } + } + + #ifdef POKEMON_EXPANSION + if (isMega) + { + sPokedexView->numPreEvolutions = numPreEvolutions; + sPokedexView->sEvoScreenData.numAllEvolutions += numPreEvolutions; + sPokedexView->sEvoScreenData.isMega = isMega; + + CreateCaughtBallEvolutionScreen(preEvolutionOne, base_x - 9 - 8, base_y + base_y_offset*(numPreEvolutions - 1), 0); + HandlePreEvolutionSpeciesPrint(taskId, preEvolutionOne, species, base_x - 8, base_y, base_y_offset, numPreEvolutions - 1); + return numPreEvolutions; + } + #endif + + //Calculate if previous evolution also has a previous evolution + if (numPreEvolutions != 0) + { + for (i = 0; i < NUM_SPECIES; i++) + { + for (j = 0; j < EVOS_PER_MON; j++) + { + if (gEvolutionTable[i][j].targetSpecies == preEvolutionOne) + { + preEvolutionTwo = i; + numPreEvolutions += 1; + CreateCaughtBallEvolutionScreen(preEvolutionTwo, base_x - 9, base_y + base_y_offset*0, 0); + HandlePreEvolutionSpeciesPrint(taskId, preEvolutionTwo, preEvolutionOne, base_x, base_y, base_y_offset, 0); + break; + } + } + } + } + + //Print ball and name + if (preEvolutionOne != 0) + { + CreateCaughtBallEvolutionScreen(preEvolutionOne, base_x - 9, base_y + base_y_offset*(numPreEvolutions - 1), 0); + HandlePreEvolutionSpeciesPrint(taskId, preEvolutionOne, species, base_x, base_y, base_y_offset, numPreEvolutions - 1); + } + + if (preEvolutionTwo != 0) + { + sPokedexView->sEvoScreenData.targetSpecies[0] = preEvolutionTwo; + sPokedexView->sEvoScreenData.targetSpecies[1] = preEvolutionOne; + } + else if (preEvolutionOne != 0) + { + sPokedexView->sEvoScreenData.targetSpecies[0] = preEvolutionOne; + } + + //vertical line + //FillWindowPixelRect(0, PIXEL_FILL(5), 33 + 32*numPreEvolutions, 18, 1, 32); //PIXEL_FILL(15) for black + + sPokedexView->numPreEvolutions = numPreEvolutions; + sPokedexView->sEvoScreenData.numAllEvolutions += numPreEvolutions; + + return numPreEvolutions; +} + +#define EVO_SCREEN_LVL_DIGITS 2 + +static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_i) +{ + u16 i; + #ifdef POKEMON_EXPANSION + u16 j; + const struct MapHeader *mapHeader; + #endif + u16 targetSpecies = 0; + u16 previousTargetSpecies = 0; + + u16 item; + + bool8 left = TRUE; + u8 base_x = 13+8; + u8 base_x_offset = 54+8; + u8 base_y = 51; + u8 base_y_offset = 9; + u8 base_i = 0; + u8 times = 0; + u8 depth_x = 16; + bool8 isEevee = FALSE; + + #ifdef POKEMON_EXPANSION + if (sPokedexView->sEvoScreenData.isMega) + return 0; + #endif + + StringCopy(gStringVar1, gSpeciesNames[species]); + + if (species == SPECIES_EEVEE) + isEevee = TRUE; + + #ifdef TX_RANDOMIZER_AND_CHALLENGES + if (EvolutionBlockedByEvoLimit(species)) //No Evos already previously checked + species = SPECIES_NONE; + else if (gSaveBlock1Ptr->tx_Random_EvolutionMethods) + species = GetSpeciesRandomSeeded(species, TX_RANDOM_T_EVO_METH, 0); + #endif + + //Calculate number of possible direct evolutions (e.g. Eevee has 5 but torchic has 1) + for (i = 0; i < EVOS_PER_MON; i++) + { + #ifndef POKEMON_EXPANSION + if (gEvolutionTable[species][i].method != 0) + times += 1; + #endif + #ifdef POKEMON_EXPANSION + if (gEvolutionTable[species][i].method != 0 && gEvolutionTable[species][i].method != EVO_MEGA_EVOLUTION) + times += 1; + #endif + } + gTasks[taskId].data[3] = times; + sPokedexView->sEvoScreenData.numAllEvolutions += times; + + //If there are no evolutions print text + if (times == 0 && depth == 0) + { + StringExpandPlaceholders(gStringVar4, gText_EVO_NONE); + PrintInfoScreenTextSmall(gStringVar4, base_x-7-7, base_y + base_y_offset*depth_i); + } + + //If there are evolutions find out which and print them 1 by 1 + for (i = 0; i < times; i++) + { + base_i = i + depth_i; + left = !left; + + previousTargetSpecies = targetSpecies; + targetSpecies = gEvolutionTable[species][i].targetSpecies; + sPokedexView->sEvoScreenData.targetSpecies[base_i] = targetSpecies; + #ifdef TX_DIFFICULTY_CHALLENGES_USED + if (gSaveBlock1Ptr->txRandEvolutions && targetSpecies != SPECIES_NONE) //tx_difficulty_challenges + targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_T_EVO, 0); + #endif + CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); + HandleTargetSpeciesPrint(taskId, targetSpecies, previousTargetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i, isEevee); //evolution mon name + + switch (gEvolutionTable[species][i].method) + { + case EVO_FRIENDSHIP: + ConvertIntToDecimalStringN(gStringVar2, 220, STR_CONV_MODE_LEADING_ZEROS, 3); //friendship value + StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP ); + break; + case EVO_FRIENDSHIP_DAY: + StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_DAY ); + break; + case EVO_FRIENDSHIP_NIGHT: + StringExpandPlaceholders(gStringVar4, gText_EVO_FRIENDSHIP_NIGHT ); + break; + case EVO_LEVEL: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL ); + break; + case EVO_TRADE: + StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE ); + break; + case EVO_TRADE_ITEM: + item = gEvolutionTable[species][i].param; //item + CopyItemName(item, gStringVar2); //item + StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_ITEM ); + break; + case EVO_ITEM: + item = gEvolutionTable[species][i].param; + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM ); + break; + case EVO_LEVEL_ATK_GT_DEF: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_GT_DEF ); + break; + case EVO_LEVEL_ATK_EQ_DEF: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_EQ_DEF ); + break; + case EVO_LEVEL_ATK_LT_DEF: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_ATK_LT_DEF ); + break; + case EVO_LEVEL_SILCOON: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SILCOON ); + break; + case EVO_LEVEL_CASCOON: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_CASCOON ); + break; + case EVO_LEVEL_NINJASK: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NINJASK ); + break; + case EVO_LEVEL_SHEDINJA: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_SHEDINJA ); + break; + case EVO_BEAUTY: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, 3); //beauty + StringExpandPlaceholders(gStringVar4, gText_EVO_BEAUTY ); + break; + #ifdef POKEMON_EXPANSION + case EVO_LEVEL_FEMALE: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_FEMALE ); + break; + case EVO_LEVEL_MALE: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_MALE ); + break; + case EVO_LEVEL_NIGHT: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NIGHT ); + break; + case EVO_LEVEL_DAY: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DAY ); + break; + case EVO_LEVEL_DUSK: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DUSK ); + break; + case EVO_ITEM_HOLD_DAY: + item = gEvolutionTable[species][i].param; //item + CopyItemName(item, gStringVar2); //item + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_DAY ); + break; + case EVO_ITEM_HOLD_NIGHT: + item = gEvolutionTable[species][i].param; //item + CopyItemName(item, gStringVar2); //item + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD_NIGHT ); + break; + case EVO_MOVE: + StringCopy(gStringVar2, gMoveNames[gEvolutionTable[species][i].param]); + StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE ); + break; + case EVO_MOVE_TYPE: + StringCopy(gStringVar2, gTypeNames[gEvolutionTable[species][i].param]); + StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE_TYPE ); + break; + case EVO_MAPSEC: + StringCopy(gStringVar2, gRegionMapEntries[gEvolutionTable[species][i].param].name); + StringExpandPlaceholders(gStringVar4, gText_EVO_MAPSEC ); + break; + case EVO_ITEM_MALE: + item = gEvolutionTable[species][i].param; //item + CopyItemName(item, gStringVar2); //item + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_MALE ); + break; + case EVO_ITEM_FEMALE: + item = gEvolutionTable[species][i].param; //item + CopyItemName(item, gStringVar2); //item + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_FEMALE ); + break; + case EVO_LEVEL_RAIN: + //if (j == WEATHER_RAIN || j == WEATHER_RAIN_THUNDERSTORM || j == WEATHER_DOWNPOUR) + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_RAIN ); + break; + case EVO_SPECIFIC_MON_IN_PARTY: + StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MON_IN_PARTY ); + break; + case EVO_LEVEL_DARK_TYPE_MON_IN_PARTY: + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY ); + break; + case EVO_TRADE_SPECIFIC_MON: + StringCopy(gStringVar2, gSpeciesNames[gEvolutionTable[species][i].param]); //mon name + StringExpandPlaceholders(gStringVar4, gText_EVO_TRADE_SPECIFIC_MON ); + break; + case EVO_SPECIFIC_MAP: + mapHeader = Overworld_GetMapHeaderByGroupAndId(gEvolutionTable[species][i].param >> 8, gEvolutionTable[species][i].param & 0xFF); + GetMapName(gStringVar2, mapHeader->regionMapSectionId, 0); + StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MAP ); + break; + #endif + default: + StringExpandPlaceholders(gStringVar4, gText_EVO_UNKNOWN ); + break; + }//Switch end + PrintInfoScreenTextSmall(gStringVar4, base_x + depth_x*depth+base_x_offset, base_y + base_y_offset*base_i); //Print actual instructions + + depth_i += PrintEvolutionTargetSpeciesAndMethod(taskId, targetSpecies, depth+1, base_i+1); + }//For loop end + + return times; +} + +static void Task_SwitchScreensFromEvolutionScreen(u8 taskId) +{ + u8 i; + if (!gPaletteFade.active) + { + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + for (i = 1; i <= gTasks[taskId].data[3]; i++) + { + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite + } + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + + switch (sPokedexView->screenSwitchState) + { + case 1: + gTasks[taskId].func = Task_LoadStatsScreen; + break; + case 2: + gTasks[taskId].func = Task_LoadCryScreen; + break; + #ifdef POKEMON_EXPANSION + case 3: + gTasks[taskId].func = Task_LoadFormsScreen; + break; + #endif + default: + gTasks[taskId].func = Task_LoadInfoScreen; + break; + } + } +} + +static void Task_ExitEvolutionScreen(u8 taskId) +{ + u8 i; + if (!gPaletteFade.active) + { + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + for (i = 1; i <= gTasks[taskId].data[3]; i++) + { + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite + } + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + + FreeInfoScreenWindowAndBgBuffers(); + DestroyTask(taskId); + } +} + + + +//************************************ +//* * +//* FORMS * +//* * +//************************************ +#ifdef POKEMON_EXPANSION +static void Task_LoadFormsScreen(u8 taskId) +{ + switch (gMain.state) + { + case 0: + default: + if (!gPaletteFade.active) + { + u16 r2; + + sPokedexView->currentPage = FORMS_SCREEN; + gPokedexVBlankCB = gMain.vblankCallback; + SetVBlankCallback(NULL); + r2 = 0; + if (gTasks[taskId].data[1] != 0) + r2 += DISPCNT_OBJ_ON; + if (gTasks[taskId].data[2] != 0) + r2 |= DISPCNT_BG1_ON; + ResetOtherVideoRegisters(r2); + gMain.state = 1; + } + break; + case 1: + LoadTilesetTilemapHGSS(FORMS_SCREEN); + FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); + PutWindowTilemap(WIN_INFO); + CopyWindowToVram(WIN_INFO, 3); + FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); + PutWindowTilemap(WIN_NAVIGATION_BUTTONS); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + gMain.state++; + break; + case 2: + LoadScreenSelectBarMain(0xD); + LoadPokedexBgPalette(sPokedexView->isSearchResults); + gMain.state++; + break; + case 3: + if (gTasks[taskId].data[1] == 0) + { + //Icon + FreeMonIconPalettes(); //Free space for new pallete + LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite + gSprites[gTasks[taskId].data[4]].oam.priority = 0; + } + EvoFormsPage_PrintNavigationButtons(); //HGSS_Ui Navigation buttons + sPokedexView->sFormScreenData.menuPos = 1; + gMain.state++; + break; + case 4: + //Print form icons + gTasks[taskId].data[3] = 0; + PrintForms(taskId, NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); + LoadSpritePalette(&sSpritePalette_Arrow); + gMain.state++; + break; + case 5: + { + u32 preservedPalettes = 0; + + if (gTasks[taskId].data[2] != 0) + preservedPalettes = 0x14; // each bit represents a palette index + if (gTasks[taskId].data[1] != 0) + preservedPalettes |= (1 << (gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum + 16)); + BeginNormalPaletteFade(~preservedPalettes, 0, 16, 0, RGB_BLACK); + SetVBlankCallback(gPokedexVBlankCB); + gMain.state++; + } + break; + case 6: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + HideBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 7: + if (!gPaletteFade.active) + gMain.state++; + break; + case 8: + gMain.state++; + break; + case 9: + sPokedexView->screenSwitchState = 0; + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 1; + gTasks[taskId].func = Task_HandleFormsScreenInput; + gMain.state = 0; + break; + } +} + +static void Task_HandleFormsScreenInput(u8 taskId) +{ + u8 base_x = 5; + u8 base_y = 34; + u8 offset_x = 34; + u8 offset_y = 34; + if (!sPokedexView->sFormScreenData.inSubmenu) + { + if (JOY_NEW(A_BUTTON) && sPokedexView->sFormScreenData.numForms != 0) + { + sPokedexView->sFormScreenData.inSubmenu = TRUE; + sPokedexView->sFormScreenData.arrowSpriteId = CreateSprite(&gSpriteTemplate_Arrow, base_x + offset_x, base_y, 0); + gSprites[sPokedexView->sFormScreenData.arrowSpriteId].animNum = 2; + EvoFormsPage_PrintNavigationButtons(); + } + + if (JOY_NEW(START_BUTTON)) + { + sPokedexView->selectedScreen = EVO_SCREEN; + BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromFormsScreen; + PlaySE(SE_PIN); + } + + //Exit to overview + if (JOY_NEW(B_BUTTON)) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_ExitFormsScreen; + PlaySE(SE_PC_OFF); + return; + } + } + else //inSubmenu + { + u8 row = 0; + u8 column = 0; + u8 menuPos = sPokedexView->sFormScreenData.menuPos; + //Grid navigation + if (JOY_NEW(DPAD_RIGHT)) + menuPos += 1; + else if (JOY_NEW(DPAD_LEFT)) + menuPos -= 1; + else if (JOY_NEW(DPAD_DOWN)) + menuPos += 7; + else if (JOY_NEW(DPAD_UP)) + { + if (menuPos > 7) + menuPos -= 7; + else + menuPos = 1; + } + + if (menuPos <= 0) + menuPos = 1; + else if (menuPos >= sPokedexView->sFormScreenData.numForms) + menuPos = sPokedexView->sFormScreenData.numForms; + + row = menuPos / 7; + column = menuPos % 7; + gSprites[sPokedexView->sFormScreenData.arrowSpriteId].x = base_x + offset_x * column; + gSprites[sPokedexView->sFormScreenData.arrowSpriteId].y = base_y + offset_y * row; + + sPokedexView->sFormScreenData.menuPos = menuPos; + + + if (JOY_NEW(A_BUTTON)) + { + u8 formId = sPokedexView->sFormScreenData.formIds[menuPos]; + u16 formSpecies = GetFormSpeciesId(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), formId); + if (formSpecies == GetFormSpeciesId(formSpecies, 0)) + sPokedexView->formSpecies = 0; + else + sPokedexView->formSpecies = formSpecies; + + sPokedexView->sEvoScreenData.fromEvoPage = TRUE; + sPokedexView->sFormScreenData.inSubmenu = FALSE; + PlaySE(SE_PIN); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_LoadInfoScreenWaitForFade; + } + + if (JOY_NEW(B_BUTTON)) + { + DestroySprite(&gSprites[sPokedexView->sFormScreenData.arrowSpriteId]); + sPokedexView->sFormScreenData.inSubmenu = FALSE; + EvoFormsPage_PrintNavigationButtons(); + } + } +} + +#define FORM_SPECIES_END (0xffff) + +static void PrintForms(u8 taskId, u16 species) +{ + u8 i; + u8 j = 1; + u16 speciesForm; + + + bool8 left = TRUE; + u8 base_x = 5; + u8 base_x_offset = 54; + u8 base_y = 52; + u8 base_y_offset = 9; + u8 base_i = 0; + u8 times = 0; + u8 y_offset_icons = 0; //For unown only + + if (species == SPECIES_UNOWN) + y_offset_icons = 8; + + if (GetFormSpeciesId(species, 0) == SPECIES_UNOWN) + y_offset_icons = 8; + + StringCopy(gStringVar1, gSpeciesNames[species]); + + for (i=0; i < 30; i++) + { + speciesForm = GetFormSpeciesId(species, i); + if (speciesForm == FORM_SPECIES_END) + break; + else if (speciesForm == species) + continue; + else + { + sPokedexView->sFormScreenData.formIds[j++] = i; + times += 1; + LoadMonIconPalette(speciesForm); //Loads pallete for current mon + if (times < 7) + gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 52 + 34*(times-1), 31, 4, 0); //Create pokemon sprite + else if (times < 14) + gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-7), 70 - y_offset_icons, 4, 0); //Create pokemon sprite + else if (times < 21) + gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-14), 104 - y_offset_icons, 4, 0); //Create pokemon sprite + else + gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-21), 138 - y_offset_icons, 4, 0); //Create pokemon sprite + gSprites[gTasks[taskId].data[4+times]].oam.priority = 0; + } + } + gTasks[taskId].data[3] = times; + sPokedexView->sFormScreenData.numForms = times; + + //If there are no forms print text + if (times == 0) + { + StringExpandPlaceholders(gStringVar4, gText_FORMS_NONE); + PrintInfoScreenTextSmall(gStringVar4, base_x, base_y + base_y_offset*times); + } +} + +static void Task_SwitchScreensFromFormsScreen(u8 taskId) +{ + u8 i; + if (!gPaletteFade.active) + { + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + for (i = 1; i <= gTasks[taskId].data[3]; i++) + { + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite + } + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + + switch (sPokedexView->screenSwitchState) + { + case 1: + gTasks[taskId].func = Task_LoadEvolutionScreen; + break; + default: + gTasks[taskId].func = Task_LoadInfoScreen; + break; + } + } +} + +static void Task_ExitFormsScreen(u8 taskId) +{ + u8 i; + if (!gPaletteFade.active) + { + FreeMonIconPalettes(); //Destroy pokemon icon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4]]); //Destroy pokemon icon sprite + for (i = 1; i <= gTasks[taskId].data[3]; i++) + { + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[4+i]]); //Destroy pokemon icon sprite + } + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + + FreeInfoScreenWindowAndBgBuffers(); + DestroyTask(taskId); + } +} +#endif + +#undef tMonSpriteId + + +//************************************ +//* * +//* Cry screen * +//* * +//************************************ +#define tScrolling data[0] +#define tMonSpriteDone data[1] +#define tBgLoaded data[2] +#define tSkipCry data[3] +#define tMonSpriteId data[4] +#define tTrainerSpriteId data[5] + +static void Task_LoadCryScreen(u8 taskId) +{ + switch (gMain.state) + { + case 0: + default: + if (!gPaletteFade.active) + { + m4aMPlayStop(&gMPlayInfo_BGM); + sPokedexView->currentPage = PAGE_CRY; + gPokedexVBlankCB = gMain.vblankCallback; + SetVBlankCallback(NULL); + ResetOtherVideoRegisters(DISPCNT_BG1_ON); + sPokedexView->selectedScreen = CRY_SCREEN; + gMain.state = 1; + } + break; + case 1: + LoadTilesetTilemapHGSS(CRY_SCREEN); + FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); + PutWindowTilemap(WIN_INFO); + PutWindowTilemap(WIN_VU_METER); + PutWindowTilemap(WIN_CRY_WAVE); + gMain.state++; + break; + case 2: + LoadScreenSelectBarMain(0xD); //HGSS_Ui + LoadPokedexBgPalette(sPokedexView->isSearchResults); + gMain.state++; + break; + case 3: + ResetPaletteFade(); + gMain.state++; + break; + case 4: + PrintInfoScreenText(gText_CryOf, 82, 33); + PrintCryScreenSpeciesName(0, sPokedexListItem->dexNum, 82, 49); + gMain.state++; + break; + case 5: + gTasks[taskId].tMonSpriteId = CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, MON_PAGE_X, MON_PAGE_Y, 0); + gSprites[gTasks[taskId].tMonSpriteId].oam.priority = 0; + gDexCryScreenState = 0; + gMain.state++; + break; + case 6: + { + struct CryScreenWindow waveformWindow; + + waveformWindow.unk0 = 0x4020; + waveformWindow.unk2 = 31; + waveformWindow.paletteNo = 8; + waveformWindow.yPos = 30; + waveformWindow.xPos = 12; + if (LoadCryWaveformWindow(&waveformWindow, 2)) + { + gMain.state++; + gDexCryScreenState = 0; + } + } + break; + case 7: + { + struct CryScreenWindow cryMeter; + + cryMeter.paletteNo = 9; + cryMeter.xPos = 18; + cryMeter.yPos = 3; + if (LoadCryMeter(&cryMeter, 3)) + gMain.state++; + CopyWindowToVram(WIN_VU_METER, COPYWIN_GFX); + CopyWindowToVram(WIN_INFO, COPYWIN_FULL); + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + } + break; + case 8: + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0x10, 0, RGB_BLACK); + SetVBlankCallback(gPokedexVBlankCB); + gMain.state++; + break; + case 9: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 10: + sPokedexView->screenSwitchState = 0; + gMain.state = 0; + gTasks[taskId].func = Task_HandleCryScreenInput; + break; + } +} + +static void Task_HandleCryScreenInput(u8 taskId) +{ + UpdateCryWaveformWindow(2); + + if (IsCryPlaying()) + LoadPlayArrowPalette(TRUE); + else + LoadPlayArrowPalette(FALSE); + + if (JOY_NEW(A_BUTTON)) + { + LoadPlayArrowPalette(TRUE); + CryScreenPlayButton(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); + return; + } + else if (!gPaletteFade.active) + { + if (JOY_NEW(B_BUTTON)) + { + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); + m4aMPlayContinue(&gMPlayInfo_BGM); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromCryScreen; + PlaySE(SE_PC_OFF); + return; + } + if (JOY_NEW(DPAD_LEFT) + || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + { + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); + m4aMPlayContinue(&gMPlayInfo_BGM); + sPokedexView->screenSwitchState = 2; + gTasks[taskId].func = Task_SwitchScreensFromCryScreen; + PlaySE(SE_DEX_PAGE); + return; + } + if (JOY_NEW(DPAD_RIGHT) + || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + { + if (!sPokedexListItem->owned) + { + PlaySE(SE_FAILURE); + } + else + { + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); + m4aMPlayContinue(&gMPlayInfo_BGM); + sPokedexView->screenSwitchState = 3; + gTasks[taskId].func = Task_SwitchScreensFromCryScreen; + PlaySE(SE_DEX_PAGE); + } + return; + } + } +} + +static void Task_SwitchScreensFromCryScreen(u8 taskId) +{ + if (!gPaletteFade.active) + { + FreeCryScreen(); + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + switch (sPokedexView->screenSwitchState) + { + default: + case 1: + gTasks[taskId].func = Task_LoadInfoScreen; + break; + case 2: + gTasks[taskId].func = Task_LoadEvolutionScreen; + break; + case 3: + gTasks[taskId].func = Task_LoadSizeScreen; + break; + } + } +} + + + +//************************************ +//* * +//* Size screen * +//* * +//************************************ +static void Task_LoadSizeScreen(u8 taskId) +{ + u8 spriteId; + + switch (gMain.state) + { + default: + case 0: + if (!gPaletteFade.active) + { + sPokedexView->currentPage = PAGE_SIZE; + gPokedexVBlankCB = gMain.vblankCallback; + SetVBlankCallback(NULL); + ResetOtherVideoRegisters(DISPCNT_BG1_ON); + sPokedexView->selectedScreen = SIZE_SCREEN; + gMain.state = 1; + } + break; + case 1: + LoadTilesetTilemapHGSS(SIZE_SCREEN); + FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); + PutWindowTilemap(WIN_INFO); + gMain.state++; + break; + case 2: + LoadScreenSelectBarMain(0xD); //HGSS_Ui + LoadPokedexBgPalette(sPokedexView->isSearchResults); + gMain.state++; + break; + case 3: + { + u8 string[64]; + + StringCopy(string, gText_SizeComparedTo); + StringAppend(string, gSaveBlock2Ptr->playerName); + PrintInfoScreenText(string, GetStringCenterAlignXOffset(FONT_NORMAL, string, 0xF0), 0x79); + gMain.state++; + } + break; + case 4: + ResetPaletteFade(); + gMain.state++; + break; + case 5: + spriteId = CreateSizeScreenTrainerPic(PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender), 152, 56, 0); + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 1; + gSprites[spriteId].oam.priority = 0; + gSprites[spriteId].y2 = gPokedexEntries[sPokedexListItem->dexNum].trainerOffset; + SetOamMatrix(1, gPokedexEntries[sPokedexListItem->dexNum].trainerScale, 0, 0, gPokedexEntries[sPokedexListItem->dexNum].trainerScale); + LoadPalette(sSizeScreenSilhouette_Pal, OBJ_PLTT_ID2(gSprites[spriteId].oam.paletteNum), PLTT_SIZE_4BPP); + gTasks[taskId].tTrainerSpriteId = spriteId; + gMain.state++; + break; + case 6: + spriteId = CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 88, 56, 1); + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 2; + gSprites[spriteId].oam.priority = 0; + gSprites[spriteId].y2 = gPokedexEntries[sPokedexListItem->dexNum].pokemonOffset; + SetOamMatrix(2, gPokedexEntries[sPokedexListItem->dexNum].pokemonScale, 0, 0, gPokedexEntries[sPokedexListItem->dexNum].pokemonScale); + LoadPalette(sSizeScreenSilhouette_Pal, OBJ_PLTT_ID2(gSprites[spriteId].oam.paletteNum), PLTT_SIZE_4BPP); + gTasks[taskId].tMonSpriteId = spriteId; + CopyWindowToVram(WIN_INFO, COPYWIN_FULL); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + gMain.state++; + break; + case 7: + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0x10, 0, RGB_BLACK); + SetVBlankCallback(gPokedexVBlankCB); + gMain.state++; + break; + case 8: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + HideBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 9: + if (!gPaletteFade.active) + { + sPokedexView->screenSwitchState = 0; + gMain.state = 0; + gTasks[taskId].func = Task_HandleSizeScreenInput; + } + break; + } +} + +static void LoadPlayArrowPalette(bool8 cryPlaying) +{ + u16 color; + + if (cryPlaying) + color = RGB(18, 28, 0); + else + color = RGB(15, 21, 0); + LoadPalette(&color, BG_PLTT_ID(5) + 13, PLTT_SIZEOF(1)); +} + +static void Task_HandleSizeScreenInput(u8 taskId) +{ + if (JOY_NEW(B_BUTTON)) + { + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 1; + gTasks[taskId].func = Task_SwitchScreensFromSizeScreen; + PlaySE(SE_PC_OFF); + } + else if (JOY_NEW(DPAD_LEFT) + || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + { + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); + sPokedexView->screenSwitchState = 2; + gTasks[taskId].func = Task_SwitchScreensFromSizeScreen; + PlaySE(SE_DEX_PAGE); + } +} + +static void Task_SwitchScreensFromSizeScreen(u8 taskId) +{ + if (!gPaletteFade.active) + { + FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId); + FreeAndDestroyTrainerPicSprite(gTasks[taskId].tTrainerSpriteId); + switch (sPokedexView->screenSwitchState) + { + default: + case 1: + gTasks[taskId].func = Task_LoadInfoScreen; + break; + case 2: + gTasks[taskId].func = Task_LoadCryScreen; + break; + } + } +} + +#undef tScrolling +#undef tMonSpriteDone +#undef tBgLoaded +#undef tSkipCry +#undef tMonSpriteId +#undef tTrainerSpriteId + + + +//************************************ +//* * +//* Search Screen * +//* * +//************************************ +static void Task_WaitForExitSearch(u8 taskId) +{ + if (!gTasks[gTasks[taskId].tLoadScreenTaskId].isActive) + { + ClearMonSprites(); + TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBarsBg(); //HGSS_Ui + + // Search produced results + if (sPokedexView->screenSwitchState != 0) + { + sPokedexView->selectedPokemon = 0; + sPokedexView->pokeBallRotation = POKEBALL_ROTATION_TOP; + gTasks[taskId].func = Task_OpenSearchResults; + } + // Search didn't produce results + else + { + sPokedexView->pokeBallRotation = sPokedexView->pokeBallRotationBackup; + sPokedexView->selectedPokemon = sPokedexView->selectedPokemonBackup; + sPokedexView->dexMode = sPokedexView->dexModeBackup; + if (!IsNationalPokedexEnabled()) + sPokedexView->dexMode = DEX_MODE_HOENN; + sPokedexView->dexOrder = sPokedexView->dexOrderBackup; + gTasks[taskId].func = Task_OpenPokedexMainPage; + } + } +} + +static void Task_OpenSearchResults(u8 taskId) +{ + sPokedexView->isSearchResults = TRUE; + #ifdef POKEMON_EXPANSION + sPokedexView->sEvoScreenData.fromEvoPage = FALSE; + sPokedexView->formSpecies = 0; + #endif + if (LoadPokedexListPage(PAGE_SEARCH_RESULTS)) + gTasks[taskId].func = Task_HandleSearchResultsInput; +} + +static void Task_HandleSearchResultsInput(u8 taskId) +{ + SetGpuReg(REG_OFFSET_BG0VOFS, sPokedexView->menuY); + + if (sPokedexView->menuY) + { + sPokedexView->menuY -= 8; + if (sPokedexView->menuIsOpen == FALSE && sPokedexView->menuY == 8) //HGSS_Ui + { + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); + CreateStatBarsBg(); + } + } + else + { + if (JOY_NEW(A_BUTTON) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen) + { + u32 a; + + TryDestroyStatBars(); //HGSS_Ui + UpdateSelectedMonSpriteId(); + a = (1 << (gSprites[sPokedexView->selectedMonSpriteId].oam.paletteNum + 16)); + gSprites[sPokedexView->selectedMonSpriteId].callback = SpriteCB_MoveMonForInfoScreen; + BeginNormalPaletteFade(~a, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].func = Task_OpenSearchResultsInfoScreenAfterMonMovement; + PlaySE(SE_PIN); + FreeWindowAndBgBuffers(); + } + else if (JOY_NEW(START_BUTTON)) + { + TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBarsBg(); //HGSS_Ui + sPokedexView->menuY = 0; + sPokedexView->menuIsOpen = TRUE; + sPokedexView->menuCursorPos = 0; + gTasks[taskId].func = Task_HandleSearchResultsStartMenuInput; + PlaySE(SE_SELECT); + } + else if (JOY_NEW(SELECT_BUTTON)) + { + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].tLoadScreenTaskId = LoadSearchMenu(); + sPokedexView->screenSwitchState = 0; + gTasks[taskId].func = Task_WaitForExitSearch; + PlaySE(SE_PC_LOGIN); + FreeWindowAndBgBuffers(); + } + else if (JOY_NEW(B_BUTTON)) + { + TryDestroyStatBars(); //HGSS_Ui + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].func = Task_ReturnToPokedexFromSearchResults; + PlaySE(SE_PC_OFF); + } + else + { + //Handle D-pad + sPokedexView->selectedPokemon = TryDoPokedexScroll(sPokedexView->selectedPokemon, 0xE); + if (sPokedexView->scrollTimer) + gTasks[taskId].func = Task_WaitForSearchResultsScroll; + else if (!sPokedexView->scrollTimer && !sPokedexView->scrollSpeed && sPokedexView->justScrolled) //HGSS_Ui + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui + } + } +} + +static void Task_WaitForSearchResultsScroll(u8 taskId) +{ + TryDestroyStatBars(); //HGSS_Ui + if (UpdateDexListScroll(sPokedexView->scrollDirection, sPokedexView->scrollMonIncrement, sPokedexView->maxScrollTimer)) + gTasks[taskId].func = Task_HandleSearchResultsInput; +} + +static void Task_HandleSearchResultsStartMenuInput(u8 taskId) +{ + SetGpuReg(REG_OFFSET_BG0VOFS, sPokedexView->menuY); + + if (sPokedexView->menuY != 96) + { + sPokedexView->menuY += 8; + } + else + { + if (JOY_NEW(A_BUTTON)) + { + switch (sPokedexView->menuCursorPos) + { + case 0: //BACK TO LIST + default: + gMain.newKeys |= START_BUTTON; + break; + case 1: //LIST TOP + sPokedexView->selectedPokemon = 0; + sPokedexView->pokeBallRotation = POKEBALL_ROTATION_TOP; + ClearMonSprites(); + CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); + gMain.newKeys |= START_BUTTON; + break; + case 2: //LIST BOTTOM + sPokedexView->selectedPokemon = sPokedexView->pokemonListCount - 1; + sPokedexView->pokeBallRotation = sPokedexView->pokemonListCount * 16 + POKEBALL_ROTATION_BOTTOM; + ClearMonSprites(); + CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); + gMain.newKeys |= START_BUTTON; + break; + case 3: //BACK TO POKEDEX + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].func = Task_ReturnToPokedexFromSearchResults; + PlaySE(SE_TRUCK_DOOR); + break; + case 4: //CLOSE POKEDEX + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].func = Task_ClosePokedexFromSearchResultsStartMenu; + PlaySE(SE_PC_OFF); + break; + } + } + + //Exit menu when Start or B is pressed + if (JOY_NEW(START_BUTTON | B_BUTTON)) + { + sPokedexView->menuIsOpen = FALSE; + gTasks[taskId].func = Task_HandleSearchResultsInput; + PlaySE(SE_SELECT); + } + else if (JOY_REPEAT(DPAD_UP) && sPokedexView->menuCursorPos) + { + sPokedexView->menuCursorPos--; + PlaySE(SE_SELECT); + } + else if (JOY_REPEAT(DPAD_DOWN) && sPokedexView->menuCursorPos < 4) + { + sPokedexView->menuCursorPos++; + PlaySE(SE_SELECT); + } + } +} + +static void Task_OpenSearchResultsInfoScreenAfterMonMovement(u8 taskId) +{ + if (gSprites[sPokedexView->selectedMonSpriteId].x == MON_PAGE_X && gSprites[sPokedexView->selectedMonSpriteId].y == MON_PAGE_Y) + { + sPokedexView->currentPageBackup = sPokedexView->currentPage; + gTasks[taskId].tLoadScreenTaskId = LoadInfoScreen(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], sPokedexView->selectedMonSpriteId); + sPokedexView->selectedMonSpriteId = -1; + gTasks[taskId].func = Task_WaitForExitSearchResultsInfoScreen; + } +} + +static void Task_WaitForExitSearchResultsInfoScreen(u8 taskId) +{ + if (gTasks[gTasks[taskId].tLoadScreenTaskId].isActive) + { + // While active, handle scroll input + if (sPokedexView->currentPage == PAGE_INFO && !IsInfoScreenScrolling(gTasks[taskId].tLoadScreenTaskId) && TryDoInfoScreenScroll()) + StartInfoScreenScroll(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], gTasks[taskId].tLoadScreenTaskId); + } + else + { + // Exiting, back to search results + gTasks[taskId].func = Task_OpenSearchResults; + } +} + +static void Task_ReturnToPokedexFromSearchResults(u8 taskId) +{ + if (!gPaletteFade.active) + { + sPokedexView->pokeBallRotation = sPokedexView->pokeBallRotationBackup; + sPokedexView->selectedPokemon = sPokedexView->selectedPokemonBackup; + sPokedexView->dexMode = sPokedexView->dexModeBackup; + if (!IsNationalPokedexEnabled()) + sPokedexView->dexMode = DEX_MODE_HOENN; + sPokedexView->dexOrder = sPokedexView->dexOrderBackup; + gTasks[taskId].func = Task_OpenPokedexMainPage; + ClearMonSprites(); + FreeWindowAndBgBuffers(); + } +} + +static void Task_ClosePokedexFromSearchResultsStartMenu(u8 taskId) +{ + if (!gPaletteFade.active) + { + sPokedexView->pokeBallRotation = sPokedexView->pokeBallRotationBackup; + sPokedexView->selectedPokemon = sPokedexView->selectedPokemonBackup; + sPokedexView->dexMode = sPokedexView->dexModeBackup; + if (!IsNationalPokedexEnabled()) + sPokedexView->dexMode = DEX_MODE_HOENN; + sPokedexView->dexOrder = sPokedexView->dexOrderBackup; + gTasks[taskId].func = Task_ClosePokedex; + } +} + +#undef tLoadScreenTaskId + + +//************************************ +//* * +//* Search code * +//* * +//************************************ +static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 type1, u8 type2) +{ + u16 species; + u16 i,j; + u16 resultsCount; + u8 types[2]; + + CreatePokedexList(dexMode, order); + + for (i = 0, resultsCount = 0; i < NATIONAL_DEX_COUNT; i++) + { + if (sPokedexView->pokedexList[i].seen) + { + sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; + resultsCount++; + } + } + sPokedexView->pokemonListCount = resultsCount; + + // Search by name + if (abcGroup != 0xFF) + { + for (i = 0, resultsCount = 0; i < sPokedexView->pokemonListCount; i++) + { + u8 firstLetter; + + species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum); + firstLetter = gSpeciesNames[species][0]; + if (LETTER_IN_RANGE_UPPER(firstLetter, abcGroup) || LETTER_IN_RANGE_LOWER(firstLetter, abcGroup)) + { + sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; + resultsCount++; + } + } + sPokedexView->pokemonListCount = resultsCount; + } + + // Search by body color + if (bodyColor != 0xFF) + { + for (i = 0, resultsCount = 0; i < sPokedexView->pokemonListCount; i++) + { + species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum); + + if (bodyColor == gSpeciesInfo[species].bodyColor) + { + sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; + resultsCount++; + } + } + sPokedexView->pokemonListCount = resultsCount; + } + + // Search by type + if (type1 != TYPE_NONE || type2 != TYPE_NONE) + { + if (type1 == TYPE_NONE) + { + type1 = type2; + type2 = TYPE_NONE; + } + + if (type2 == TYPE_NONE) + { + for (i = 0, resultsCount = 0; i < sPokedexView->pokemonListCount; i++) + { + if (sPokedexView->pokedexList[i].owned) + { + species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum); + + types[0] = gSpeciesInfo[species].types[0]; + types[1] = gSpeciesInfo[species].types[1]; + if (types[0] == type1 || types[1] == type1) + { + sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; + resultsCount++; + } + } + } + } + else + { + for (i = 0, resultsCount = 0; i < sPokedexView->pokemonListCount; i++) + { + if (sPokedexView->pokedexList[i].owned) + { + species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum); + + types[0] = gSpeciesInfo[species].types[0]; + types[1] = gSpeciesInfo[species].types[1]; + if ((types[0] == type1 && types[1] == type2) || (types[0] == type2 && types[1] == type1)) + { + sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; + resultsCount++; + } + } + } + } + sPokedexView->pokemonListCount = resultsCount; + } + + if (sPokedexView->pokemonListCount != 0) + { + for (i = sPokedexView->pokemonListCount; i < NATIONAL_DEX_COUNT; i++) + { + sPokedexView->pokedexList[i].dexNum = 0xFFFF; + sPokedexView->pokedexList[i].seen = FALSE; + sPokedexView->pokedexList[i].owned = FALSE; + } + } + + return resultsCount; +} + +static u8 LoadSearchMenu(void) +{ + return CreateTask(Task_LoadSearchMenu, 0); +} + +static void PrintSearchText(const u8 *str, u32 x, u32 y) +{ + u8 color[3]; + + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_DYNAMIC_COLOR_6; + color[2] = TEXT_COLOR_DARK_GRAY; + AddTextPrinterParameterized4(0, FONT_NORMAL, x, y, 0, 0, color, TEXT_SKIP_DRAW, str); +} + +static void ClearSearchMenuRect(u32 x, u32 y, u32 width, u32 height) +{ + FillWindowPixelRect(0, PIXEL_FILL(0), x, y, width, height); +} + +// Search task data +#define tTopBarItem data[0] +#define tMenuItem data[1] +#define tCursorPos_Mode data[2] +#define tScrollOffset_Mode data[3] +#define tCursorPos_Order data[4] +#define tScrollOffset_Order data[5] +#define tCursorPos_Name data[6] +#define tScrollOffset_Name data[7] +#define tCursorPos_Color data[8] +#define tScrollOffset_Color data[9] +#define tCursorPos_TypeLeft data[10] +#define tScrollOffset_TypeLeft data[11] +#define tCursorPos_TypeRight data[12] +#define tScrollOffset_TypeRight data[13] +#define tCursorPos data[14] +#define tScrollOffset data[15] + +static void Task_LoadSearchMenu(u8 taskId) +{ + u16 i; + + switch (gMain.state) + { + default: + case 0: + if (!gPaletteFade.active) + { + sPokedexView->currentPage = PAGE_SEARCH; + ResetOtherVideoRegisters(0); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, sSearchMenu_BgTemplate, ARRAY_COUNT(sSearchMenu_BgTemplate)); + SetBgTilemapBuffer(3, AllocZeroed(BG_SCREEN_SIZE)); + SetBgTilemapBuffer(2, AllocZeroed(BG_SCREEN_SIZE)); + SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE)); + SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE)); + InitWindows(sSearchMenu_WindowTemplate); + DeactivateAllTextPrinters(); + PutWindowTilemap(0); + if (!HGSS_DECAPPED) + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_MenuSearch_Gfx, 0x2000, 0, 0); + else + DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_MenuSearch_DECA_Gfx, 0x2000, 0, 0); + if (!IsNationalPokedexEnabled()) + CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenSearchHoenn_Tilemap, 0, 0); + else + CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenSearchNational_Tilemap, 0, 0); + if (!HGSS_DARK_MODE) + LoadPalette(gPokedexPlusHGSS_MenuSearch_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(4 * 16 - 1)); + else + LoadPalette(gPokedexPlusHGSS_MenuSearch_dark_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(4 * 16 - 1)); + gMain.state = 1; + } + break; + case 1: + LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[HGSS_DECAPPED]); + LoadSpritePalettes(sInterfaceSpritePalette); + LoadSpritePalettes(sStatBarSpritePal); //HGSS_Ui + CreateSearchParameterScrollArrows(taskId); + for (i = 0; i < NUM_TASK_DATA; i++) + gTasks[taskId].data[i] = 0; + SetDefaultSearchModeAndOrder(taskId); + HighlightSelectedSearchTopBarItem(SEARCH_TOPBAR_SEARCH); + PrintSelectedSearchParameters(taskId); + CopyWindowToVram(0, COPYWIN_FULL); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + gMain.state++; + break; + case 2: + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); + sPokedexView->statBarsSpriteId = 0xFF; //HGSS_Ui + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui + gMain.state++; + break; + case 3: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + HideBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 4: + if (!gPaletteFade.active) + { + gTasks[taskId].func = Task_SwitchToSearchMenuTopBar; + gMain.state = 0; + } + break; + } +} + +static void FreeSearchWindowAndBgBuffers(void) +{ + void *tilemapBuffer; + + FreeAllWindowBuffers(); + tilemapBuffer = GetBgTilemapBuffer(0); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(1); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(2); + if (tilemapBuffer) + Free(tilemapBuffer); + tilemapBuffer = GetBgTilemapBuffer(3); + if (tilemapBuffer) + Free(tilemapBuffer); +} + +static void Task_SwitchToSearchMenuTopBar(u8 taskId) +{ + HighlightSelectedSearchTopBarItem(gTasks[taskId].tTopBarItem); + PrintSelectedSearchParameters(taskId); + CopyWindowToVram(0, COPYWIN_GFX); + CopyBgTilemapBufferToVram(3); + gTasks[taskId].func = Task_HandleSearchTopBarInput; +} + +static void Task_HandleSearchTopBarInput(u8 taskId) +{ + if (JOY_NEW(B_BUTTON)) + { + PlaySE(SE_PC_OFF); + gTasks[taskId].func = Task_ExitSearch; + return; + } + if (JOY_NEW(A_BUTTON)) + { + switch (gTasks[taskId].tTopBarItem) + { + case SEARCH_TOPBAR_SEARCH: + PlaySE(SE_PIN); + gTasks[taskId].tMenuItem = SEARCH_NAME; + gTasks[taskId].func = Task_SwitchToSearchMenu; + break; + case SEARCH_TOPBAR_SHIFT: + PlaySE(SE_PIN); + gTasks[taskId].tMenuItem = SEARCH_ORDER; + gTasks[taskId].func = Task_SwitchToSearchMenu; + break; + case SEARCH_TOPBAR_CANCEL: + PlaySE(SE_PC_OFF); + gTasks[taskId].func = Task_ExitSearch; + break; + } + return; + } + if (JOY_NEW(DPAD_LEFT) && gTasks[taskId].tTopBarItem > SEARCH_TOPBAR_SEARCH) + { + PlaySE(SE_DEX_PAGE); + gTasks[taskId].tTopBarItem--; + HighlightSelectedSearchTopBarItem(gTasks[taskId].tTopBarItem); + CopyWindowToVram(0, COPYWIN_GFX); + CopyBgTilemapBufferToVram(3); + } + if (JOY_NEW(DPAD_RIGHT) && gTasks[taskId].tTopBarItem < SEARCH_TOPBAR_CANCEL) + { + PlaySE(SE_DEX_PAGE); + gTasks[taskId].tTopBarItem++; + HighlightSelectedSearchTopBarItem(gTasks[taskId].tTopBarItem); + CopyWindowToVram(0, COPYWIN_GFX); + CopyBgTilemapBufferToVram(3); + } +} + +static void Task_SwitchToSearchMenu(u8 taskId) +{ + HighlightSelectedSearchMenuItem(gTasks[taskId].tTopBarItem, gTasks[taskId].tMenuItem); + PrintSelectedSearchParameters(taskId); + CopyWindowToVram(0, COPYWIN_GFX); + CopyBgTilemapBufferToVram(3); + gTasks[taskId].func = Task_HandleSearchMenuInput; +} + +// Input for main search menu +static void Task_HandleSearchMenuInput(u8 taskId) +{ + const u8 (*movementMap)[4]; + + if (gTasks[taskId].tTopBarItem != SEARCH_TOPBAR_SEARCH) + { + if (!IsNationalPokedexEnabled()) + movementMap = sSearchMovementMap_ShiftHoennDex; + else + movementMap = sSearchMovementMap_ShiftNatDex; + } + else + { + if (!IsNationalPokedexEnabled()) + movementMap = sSearchMovementMap_SearchHoennDex; + else + movementMap = sSearchMovementMap_SearchNatDex; + } + + if (JOY_NEW(B_BUTTON)) + { + PlaySE(SE_BALL); + SetDefaultSearchModeAndOrder(taskId); + gTasks[taskId].func = Task_SwitchToSearchMenuTopBar; + return; + } + if (JOY_NEW(A_BUTTON)) + { + if (gTasks[taskId].tMenuItem == SEARCH_OK) + { + if (gTasks[taskId].tTopBarItem != SEARCH_TOPBAR_SEARCH) + { + sPokeBallRotation = POKEBALL_ROTATION_TOP; + sPokedexView->pokeBallRotationBackup = POKEBALL_ROTATION_TOP; + sLastSelectedPokemon = 0; + sPokedexView->selectedPokemonBackup = 0; + gSaveBlock2Ptr->pokedex.mode = GetSearchModeSelection(taskId, SEARCH_MODE); + if (!IsNationalPokedexEnabled()) + gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN; + sPokedexView->dexModeBackup = gSaveBlock2Ptr->pokedex.mode; + gSaveBlock2Ptr->pokedex.order = GetSearchModeSelection(taskId, SEARCH_ORDER); + sPokedexView->dexOrderBackup = gSaveBlock2Ptr->pokedex.order; + PlaySE(SE_PC_OFF); + gTasks[taskId].func = Task_ExitSearch; + } + else + { + EraseAndPrintSearchTextBox(gText_SearchingPleaseWait); + gTasks[taskId].func = Task_StartPokedexSearch; + PlaySE(SE_DEX_SEARCH); + CopyWindowToVram(0, COPYWIN_GFX); + } + } + else + { + PlaySE(SE_PIN); + gTasks[taskId].func = Task_SelectSearchMenuItem; + } + return; + } + + if (JOY_NEW(DPAD_LEFT) && movementMap[gTasks[taskId].tMenuItem][0] != 0xFF) + { + PlaySE(SE_SELECT); + gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][0]; + HighlightSelectedSearchMenuItem(gTasks[taskId].tTopBarItem, gTasks[taskId].tMenuItem); + CopyWindowToVram(0, COPYWIN_GFX); + CopyBgTilemapBufferToVram(3); + } + if (JOY_NEW(DPAD_RIGHT) && movementMap[gTasks[taskId].tMenuItem][1] != 0xFF) + { + PlaySE(SE_SELECT); + gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][1]; + HighlightSelectedSearchMenuItem(gTasks[taskId].tTopBarItem, gTasks[taskId].tMenuItem); + CopyWindowToVram(0, COPYWIN_GFX); + CopyBgTilemapBufferToVram(3); + } + if (JOY_NEW(DPAD_UP) && movementMap[gTasks[taskId].tMenuItem][2] != 0xFF) + { + PlaySE(SE_SELECT); + gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][2]; + HighlightSelectedSearchMenuItem(gTasks[taskId].tTopBarItem, gTasks[taskId].tMenuItem); + CopyWindowToVram(0, COPYWIN_GFX); + CopyBgTilemapBufferToVram(3); + } + if (JOY_NEW(DPAD_DOWN) && movementMap[gTasks[taskId].tMenuItem][3] != 0xFF) + { + PlaySE(SE_SELECT); + gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][3]; + HighlightSelectedSearchMenuItem(gTasks[taskId].tTopBarItem, gTasks[taskId].tMenuItem); + CopyWindowToVram(0, COPYWIN_GFX); + CopyBgTilemapBufferToVram(3); + } +} + +static void Task_StartPokedexSearch(u8 taskId) +{ + u8 dexMode = GetSearchModeSelection(taskId, SEARCH_MODE); + u8 order = GetSearchModeSelection(taskId, SEARCH_ORDER); + u8 abcGroup = GetSearchModeSelection(taskId, SEARCH_NAME); + u8 bodyColor = GetSearchModeSelection(taskId, SEARCH_COLOR); + u8 type1 = GetSearchModeSelection(taskId, SEARCH_TYPE_LEFT); + u8 type2 = GetSearchModeSelection(taskId, SEARCH_TYPE_RIGHT); + + DoPokedexSearch(dexMode, order, abcGroup, bodyColor, type1, type2); + gTasks[taskId].func = Task_WaitAndCompleteSearch; +} + +static void Task_WaitAndCompleteSearch(u8 taskId) +{ + if (!IsSEPlaying()) + { + if (sPokedexView->pokemonListCount != 0) + { + PlaySE(SE_SUCCESS); + EraseAndPrintSearchTextBox(gText_SearchCompleted); + } + else + { + PlaySE(SE_FAILURE); + EraseAndPrintSearchTextBox(gText_NoMatchingPkmnWereFound); + } + gTasks[taskId].func = Task_SearchCompleteWaitForInput; + CopyWindowToVram(0, COPYWIN_GFX); + } +} + +static void Task_SearchCompleteWaitForInput(u8 taskId) +{ + if (JOY_NEW(A_BUTTON)) + { + if (sPokedexView->pokemonListCount != 0) + { + // Return to dex list and show search results + sPokedexView->screenSwitchState = 1; + sPokedexView->dexMode = GetSearchModeSelection(taskId, SEARCH_MODE); + sPokedexView->dexOrder = GetSearchModeSelection(taskId, SEARCH_ORDER); + gTasks[taskId].func = Task_ExitSearch; + PlaySE(SE_PC_OFF); + } + else + { + gTasks[taskId].func = Task_SwitchToSearchMenu; + PlaySE(SE_BALL); + } + } +} + +static void Task_SelectSearchMenuItem(u8 taskId) +{ + u8 menuItem; + u16 *cursorPos; + u16 *scrollOffset; + + DrawOrEraseSearchParameterBox(FALSE); + menuItem = gTasks[taskId].tMenuItem; + cursorPos = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataCursorPos]; + scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset]; + gTasks[taskId].tCursorPos = *cursorPos; + gTasks[taskId].tScrollOffset = *scrollOffset; + PrintSearchParameterText(taskId); + PrintSelectorArrow(*cursorPos); + gTasks[taskId].func = Task_HandleSearchParameterInput; + CopyWindowToVram(0, COPYWIN_GFX); + CopyBgTilemapBufferToVram(3); +} + +// Input for scrolling parameter box in right column +static void Task_HandleSearchParameterInput(u8 taskId) +{ + u8 menuItem; + const struct SearchOptionText *texts; + u16 *cursorPos; + u16 *scrollOffset; + u16 maxOption; + bool8 moved; + + menuItem = gTasks[taskId].tMenuItem; + texts = sSearchOptions[menuItem].texts; + cursorPos = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataCursorPos]; + scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset]; + maxOption = sSearchOptions[menuItem].numOptions - 1; + if (JOY_NEW(A_BUTTON)) + { + PlaySE(SE_PIN); + ClearSearchParameterBoxText(); + DrawOrEraseSearchParameterBox(TRUE); + gTasks[taskId].func = Task_SwitchToSearchMenu; + CopyWindowToVram(0, COPYWIN_GFX); + CopyBgTilemapBufferToVram(3); + return; + } + if (JOY_NEW(B_BUTTON)) + { + PlaySE(SE_BALL); + ClearSearchParameterBoxText(); + DrawOrEraseSearchParameterBox(TRUE); + *cursorPos = gTasks[taskId].tCursorPos; + *scrollOffset = gTasks[taskId].tScrollOffset; + gTasks[taskId].func = Task_SwitchToSearchMenu; + CopyWindowToVram(0, COPYWIN_GFX); + CopyBgTilemapBufferToVram(3); + return; + } + moved = FALSE; + if (JOY_REPEAT(DPAD_UP)) + { + if (*cursorPos != 0) + { + // Move cursor up + EraseSelectorArrow(*cursorPos); + (*cursorPos)--; + PrintSelectorArrow(*cursorPos); + moved = TRUE; + } + else if (*scrollOffset != 0) + { + // Scroll up + (*scrollOffset)--; + PrintSearchParameterText(taskId); + PrintSelectorArrow(*cursorPos); + moved = TRUE; + } + if (moved) + { + PlaySE(SE_SELECT); + EraseAndPrintSearchTextBox(texts[*cursorPos + *scrollOffset].description); + CopyWindowToVram(0, COPYWIN_GFX); + } + return; + } + if (JOY_REPEAT(DPAD_DOWN)) + { + if (*cursorPos < MAX_SEARCH_PARAM_CURSOR_POS && *cursorPos < maxOption) + { + // Move cursor down + EraseSelectorArrow(*cursorPos); + (*cursorPos)++; + PrintSelectorArrow(*cursorPos); + moved = TRUE; + } + else if (maxOption > MAX_SEARCH_PARAM_CURSOR_POS && *scrollOffset < maxOption - MAX_SEARCH_PARAM_CURSOR_POS) + { + // Scroll down + (*scrollOffset)++; + PrintSearchParameterText(taskId); + PrintSelectorArrow(5); + moved = TRUE; + } + if (moved) + { + PlaySE(SE_SELECT); + EraseAndPrintSearchTextBox(texts[*cursorPos + *scrollOffset].description); + CopyWindowToVram(0, COPYWIN_GFX); + } + return; + } +} + +static void Task_ExitSearch(u8 taskId) +{ + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = Task_ExitSearchWaitForFade; +} + +static void Task_ExitSearchWaitForFade(u8 taskId) +{ + if (!gPaletteFade.active) + { + FreeSearchWindowAndBgBuffers(); + DestroyTask(taskId); + } +} + +static void SetSearchRectHighlight(u8 flags, u8 x, u8 y, u8 width) +{ + u16 i; + u16 temp; //should be a pointer, but does not match as one + u32 ptr = (u32)GetBgTilemapBuffer(3); //same as above + + for (i = 0; i < width; i++) + { + temp = *(u16 *)(ptr + (y + 0) * 64 + (x + i) * 2); + temp &= 0x0fff; + temp |= (flags << 12); + *(u16 *)(ptr + (y + 0) * 64 + (x + i) * 2) = temp; + + temp = *(u16 *)(ptr + (y + 1) * 64 + (x + i) * 2); + temp &= 0x0fff; + temp |= (flags << 12); + *(u16 *)(ptr + (y + 1) * 64 + (x + i) * 2) = temp; + } +} + + +#define SEARCH_BG_SEARCH SEARCH_TOPBAR_SEARCH +#define SEARCH_BG_SHIFT SEARCH_TOPBAR_SHIFT +#define SEARCH_BG_CANCEL SEARCH_TOPBAR_CANCEL +#define SEARCH_BG_NAME (SEARCH_NAME + SEARCH_TOPBAR_COUNT) +#define SEARCH_BG_COLOR (SEARCH_COLOR + SEARCH_TOPBAR_COUNT) +#define SEARCH_BG_TYPE_SELECTION_LEFT (SEARCH_TYPE_LEFT + SEARCH_TOPBAR_COUNT) +#define SEARCH_BG_TYPE_SELECTION_RIGHT (SEARCH_TYPE_RIGHT + SEARCH_TOPBAR_COUNT) +#define SEARCH_BG_ORDER (SEARCH_ORDER + SEARCH_TOPBAR_COUNT) +#define SEARCH_BG_MODE (SEARCH_MODE + SEARCH_TOPBAR_COUNT) +#define SEARCH_BG_OK (SEARCH_OK + SEARCH_TOPBAR_COUNT) +#define SEARCH_BG_TYPE_TITLE (SEARCH_COUNT + SEARCH_TOPBAR_COUNT) + +static void DrawSearchMenuItemBgHighlight(u8 searchBg, bool8 unselected, bool8 disabled) +{ + u8 highlightFlags = (unselected & 1) | ((disabled & 1) << 1); + + switch (searchBg) + { + case SEARCH_BG_SEARCH: + case SEARCH_BG_SHIFT: + case SEARCH_BG_CANCEL: + SetSearchRectHighlight(highlightFlags, sSearchMenuTopBarItems[searchBg].highlightX, sSearchMenuTopBarItems[searchBg].highlightY, sSearchMenuTopBarItems[searchBg].highlightWidth); + break; + case SEARCH_BG_NAME: + case SEARCH_BG_COLOR: + case SEARCH_BG_ORDER: + case SEARCH_BG_MODE: + SetSearchRectHighlight(highlightFlags, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].titleBgX, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].titleBgY, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].titleBgWidth); + // fall through, draw selectionBg for above + case SEARCH_BG_TYPE_SELECTION_LEFT: + case SEARCH_BG_TYPE_SELECTION_RIGHT: + SetSearchRectHighlight(highlightFlags, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].selectionBgX, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].selectionBgY, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].selectionBgWidth); + break; + case SEARCH_BG_TYPE_TITLE: + SetSearchRectHighlight(highlightFlags, sSearchMenuItems[SEARCH_TYPE_LEFT].titleBgX, sSearchMenuItems[SEARCH_TYPE_LEFT].titleBgY, sSearchMenuItems[SEARCH_TYPE_LEFT].titleBgWidth); + break; + case SEARCH_BG_OK: + if (!IsNationalPokedexEnabled()) + SetSearchRectHighlight(highlightFlags, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].titleBgX, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].titleBgY - 2, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].titleBgWidth); + else + SetSearchRectHighlight(highlightFlags, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].titleBgX, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].titleBgY, sSearchMenuItems[searchBg - SEARCH_TOPBAR_COUNT].titleBgWidth); + break; + } +} + +static void SetInitialSearchMenuBgHighlights(u8 topBarItem) +{ + switch (topBarItem) + { + case SEARCH_TOPBAR_SEARCH: + DrawSearchMenuItemBgHighlight(SEARCH_BG_SEARCH, FALSE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_SHIFT, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_CANCEL, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_NAME, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_COLOR, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_TITLE, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_SELECTION_LEFT, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_SELECTION_RIGHT, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_ORDER, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_MODE, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_OK, TRUE, FALSE); + break; + case SEARCH_TOPBAR_SHIFT: + DrawSearchMenuItemBgHighlight(SEARCH_BG_SEARCH, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_SHIFT, FALSE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_CANCEL, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_NAME, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_COLOR, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_TITLE, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_SELECTION_LEFT, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_SELECTION_RIGHT, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_ORDER, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_MODE, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_OK, TRUE, FALSE); + break; + case SEARCH_TOPBAR_CANCEL: + DrawSearchMenuItemBgHighlight(SEARCH_BG_SEARCH, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_SHIFT, TRUE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_CANCEL, FALSE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_NAME, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_COLOR, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_TITLE, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_SELECTION_LEFT, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_SELECTION_RIGHT, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_ORDER, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_MODE, TRUE, TRUE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_OK, TRUE, TRUE); + break; + } +} + +static void HighlightSelectedSearchTopBarItem(u8 topBarItem) +{ + SetInitialSearchMenuBgHighlights(topBarItem); + EraseAndPrintSearchTextBox(sSearchMenuTopBarItems[topBarItem].description); +} + +static void HighlightSelectedSearchMenuItem(u8 topBarItem, u8 menuItem) +{ + SetInitialSearchMenuBgHighlights(topBarItem); + switch (menuItem) + { + case SEARCH_NAME: + DrawSearchMenuItemBgHighlight(SEARCH_BG_NAME, FALSE, FALSE); + break; + case SEARCH_COLOR: + DrawSearchMenuItemBgHighlight(SEARCH_BG_COLOR, FALSE, FALSE); + break; + case SEARCH_TYPE_LEFT: + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_TITLE, FALSE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_SELECTION_LEFT, FALSE, FALSE); + break; + case SEARCH_TYPE_RIGHT: + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_TITLE, FALSE, FALSE); + DrawSearchMenuItemBgHighlight(SEARCH_BG_TYPE_SELECTION_RIGHT, FALSE, FALSE); + break; + case SEARCH_ORDER: + DrawSearchMenuItemBgHighlight(SEARCH_BG_ORDER, FALSE, FALSE); + break; + case SEARCH_MODE: + DrawSearchMenuItemBgHighlight(SEARCH_BG_MODE, FALSE, FALSE); + break; + case SEARCH_OK: + DrawSearchMenuItemBgHighlight(SEARCH_BG_OK, FALSE, FALSE); + break; + } + EraseAndPrintSearchTextBox(sSearchMenuItems[menuItem].description); +} + +// Prints the currently selected search parameters in the search menu selection boxes +static void PrintSelectedSearchParameters(u8 taskId) +{ + u16 searchParamId; + + ClearSearchMenuRect(40, 16, 96, 80); + + searchParamId = gTasks[taskId].tCursorPos_Name + gTasks[taskId].tScrollOffset_Name; + PrintSearchText(sDexSearchNameOptions[searchParamId].title, 0x2D, 0x11); + + searchParamId = gTasks[taskId].tCursorPos_Color + gTasks[taskId].tScrollOffset_Color; + PrintSearchText(sDexSearchColorOptions[searchParamId].title, 0x2D, 0x21); + + searchParamId = gTasks[taskId].tCursorPos_TypeLeft + gTasks[taskId].tScrollOffset_TypeLeft; + PrintSearchText(sDexSearchTypeOptions[searchParamId].title, 0x2D, 0x31); + + searchParamId = gTasks[taskId].tCursorPos_TypeRight + gTasks[taskId].tScrollOffset_TypeRight; + PrintSearchText(sDexSearchTypeOptions[searchParamId].title, 0x5D, 0x31); + + searchParamId = gTasks[taskId].tCursorPos_Order + gTasks[taskId].tScrollOffset_Order; + PrintSearchText(sDexOrderOptions[searchParamId].title, 0x2D, 0x41); + + if (IsNationalPokedexEnabled()) + { + searchParamId = gTasks[taskId].tCursorPos_Mode + gTasks[taskId].tScrollOffset_Mode; + PrintSearchText(sDexModeOptions[searchParamId].title, 0x2D, 0x51); + } +} + +static void DrawOrEraseSearchParameterBox(bool8 erase) +{ + u16 i; + u16 j; + u16 *ptr = GetBgTilemapBuffer(3); + + if (!erase) + { + *(ptr + 0x11) = 0xC0B; + for (i = 0x12; i < 0x1F; i++) + *(ptr + i) = 0x80D; + for (j = 1; j < 13; j++) + { + *(ptr + 0x11 + j * 32) = 0x40A; + for (i = 0x12; i < 0x1F; i++) + *(ptr + j * 32 + i) = 2; + } + *(ptr + 0x1B1) = 0x40B; + for (i = 0x12; i < 0x1F; i++) + *(ptr + 0x1A0 + i) = 0xD; + } + else + { + for (j = 0; j < 14; j++) + { + for (i = 0x11; i < 0x1E; i++) + { + *(ptr + j * 32 + i) = 0x4F; + } + } + } +} + +// Prints the currently viewable search parameter titles in the right-hand text box +// and the currently selected search parameter description in the bottom text box +static void PrintSearchParameterText(u8 taskId) +{ + const struct SearchOptionText *texts = sSearchOptions[gTasks[taskId].tMenuItem].texts; + const u16 *cursorPos = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataCursorPos]; + const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataScrollOffset]; + u16 i; + u16 j; + + ClearSearchParameterBoxText(); + + for (i = 0, j = *scrollOffset; i < MAX_SEARCH_PARAM_ON_SCREEN && texts[j].title != NULL; i++, j++) + PrintSearchParameterTitle(i, texts[j].title); + + EraseAndPrintSearchTextBox(texts[*cursorPos + *scrollOffset].description); +} + +static u8 GetSearchModeSelection(u8 taskId, u8 option) +{ + const u16 *cursorPos = &gTasks[taskId].data[sSearchOptions[option].taskDataCursorPos]; + const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[option].taskDataScrollOffset]; + u16 id = *cursorPos + *scrollOffset; + + switch (option) + { + default: + return 0; + case SEARCH_MODE: + return sPokedexModes[id]; + case SEARCH_ORDER: + return sOrderOptions[id]; + case SEARCH_NAME: + if (id == 0) + return 0xFF; + else + return id; + case SEARCH_COLOR: + if (id == 0) + return 0xFF; + else + return id - 1; + case SEARCH_TYPE_LEFT: + case SEARCH_TYPE_RIGHT: + return sDexSearchTypeIds[id]; + } +} + +static void SetDefaultSearchModeAndOrder(u8 taskId) +{ + u16 selected; + + switch (sPokedexView->dexModeBackup) + { + default: + case DEX_MODE_HOENN: + selected = DEX_MODE_HOENN; + break; + case DEX_MODE_NATIONAL: + selected = DEX_MODE_NATIONAL; + break; + } + gTasks[taskId].tCursorPos_Mode = selected; + + switch (sPokedexView->dexOrderBackup) + { + default: + case ORDER_NUMERICAL: + selected = ORDER_NUMERICAL; + break; + case ORDER_ALPHABETICAL: + selected = ORDER_ALPHABETICAL; + break; + case ORDER_HEAVIEST: + selected = ORDER_HEAVIEST; + break; + case ORDER_LIGHTEST: + selected = ORDER_LIGHTEST; + break; + case ORDER_TALLEST: + selected = ORDER_TALLEST; + break; + case ORDER_SMALLEST: + selected = ORDER_SMALLEST; + break; + } + gTasks[taskId].tCursorPos_Order = selected; +} + +static bool8 SearchParamCantScrollUp(u8 taskId) +{ + u8 menuItem = gTasks[taskId].tMenuItem; + const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset]; + u16 lastOption = sSearchOptions[menuItem].numOptions - 1; + + if (lastOption > MAX_SEARCH_PARAM_CURSOR_POS && *scrollOffset != 0) + return FALSE; + else + return TRUE; +} + +static bool8 SearchParamCantScrollDown(u8 taskId) +{ + u8 menuItem = gTasks[taskId].tMenuItem; + const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset]; + u16 lastOption = sSearchOptions[menuItem].numOptions - 1; + + if (lastOption > MAX_SEARCH_PARAM_CURSOR_POS && *scrollOffset < lastOption - MAX_SEARCH_PARAM_CURSOR_POS) + return FALSE; + else + return TRUE; +} + +#define sTaskId data[0] + +static void SpriteCB_SearchParameterScrollArrow(struct Sprite *sprite) +{ + if (gTasks[sprite->sTaskId].func == Task_HandleSearchParameterInput) + { + u8 val; + + if (sprite->sIsDownArrow) + { + if (SearchParamCantScrollDown(sprite->sTaskId)) + sprite->invisible = TRUE; + else + sprite->invisible = FALSE; + } + else + { + if (SearchParamCantScrollUp(sprite->sTaskId)) + sprite->invisible = TRUE; + else + sprite->invisible = FALSE; + } + val = sprite->data[2] + sprite->sIsDownArrow * 128; + sprite->y2 = gSineTable[val] / 128; + sprite->data[2] += 8; + } + else + { + sprite->invisible = TRUE; + } +} + +static void CreateSearchParameterScrollArrows(u8 taskId) +{ + u8 spriteId; + + spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 184, 4, 0); + gSprites[spriteId].sTaskId = taskId; + gSprites[spriteId].sIsDownArrow = FALSE; + gSprites[spriteId].callback = SpriteCB_SearchParameterScrollArrow; + + spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 184, 108, 0); + gSprites[spriteId].sTaskId = taskId; + gSprites[spriteId].sIsDownArrow = TRUE; + gSprites[spriteId].vFlip = TRUE; + gSprites[spriteId].callback = SpriteCB_SearchParameterScrollArrow; +} + +#undef sTaskId +#undef sIsDownArrow + +static void EraseAndPrintSearchTextBox(const u8 *str) +{ + ClearSearchMenuRect(8, 120, 224, 32); + PrintSearchText(str, 8, 121); +} + +static void EraseSelectorArrow(u32 y) +{ + ClearSearchMenuRect(144, y * 16 + 8, 8, 16); +} + +static void PrintSelectorArrow(u32 y) +{ + PrintSearchText(gText_SelectorArrow, 144, y * 16 + 9); +} + +static void PrintSearchParameterTitle(u32 y, const u8 *str) +{ + PrintSearchText(str, 152, y * 16 + 9); +} + +static void ClearSearchParameterBoxText(void) +{ + ClearSearchMenuRect(144, 8, 96, 96); +} \ No newline at end of file diff --git a/sym_ewram.txt b/sym_ewram.txt index 414b7a3b235c..c70211050505 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -148,3 +148,4 @@ .include "src/faraway_island.o" .include "src/trainer_hill.o" .include "src/rayquaza_scene.o" + .include "src/pokedex_plus_hgss.o" From cc273ed2c496967cddfc5aabc9f90409f208b27d Mon Sep 17 00:00:00 2001 From: Aaghat Date: Fri, 8 Sep 2023 19:25:01 +0530 Subject: [PATCH 77/88] Clean Up --- include/party_menu.h | 2 +- src/party_menu.c | 4 +- src/pokedex_plus_hgss.c | 316 ++++------------------------------------ 3 files changed, 35 insertions(+), 287 deletions(-) diff --git a/include/party_menu.h b/include/party_menu.h index 0b05bbd0bdb7..ab12d76c5e10 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -97,7 +97,7 @@ void BufferMoveDeleterNicknameAndMove(void); void GetNumMovesSelectedMonHas(void); void MoveDeleterChooseMoveToForget(void); #if POKEDEX_PLUS_HGSS == TRUE -u16 GetTMHMMoves(u16 position); +u16 GetTMHMMoves(u16 item); #endif #endif // GUARD_PARTY_MENU_H diff --git a/src/party_menu.c b/src/party_menu.c index 6cee23e75b83..3cc84587cbbd 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -6965,7 +6965,7 @@ void IsLastMonThatKnowsSurf(void) } } -u16 GetTMHMMoves(u16 position) +u16 GetTMHMMoves(u16 item) { - return sTMHMMoves[position]; + return (ItemId_GetPocket(item) == POCKET_TM_HM) ? gItems[item].secondaryId : MOVE_NONE; } diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index a76726de93eb..61185fdff229 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -1,8 +1,6 @@ #include "global.h" #include "battle_main.h" -#ifdef BATTLE_ENGINE #include "battle_util.h" -#endif #include "bg.h" #include "contest_effect.h" #include "data.h" @@ -27,10 +25,8 @@ #include "pokedex_cry_screen.h" #include "pokemon_icon.h" #include "pokemon_summary_screen.h" -#ifdef POKEMON_EXPANSION #include "region_map.h" #include "pokemon.h" -#endif #include "reset_rtc_screen.h" #include "scanline_effect.h" #include "shop.h" @@ -44,15 +40,14 @@ #include "trig.h" #include "window.h" #include "constants/abilities.h" +#include "constants/form_change_types.h" #include "constants/items.h" #include "constants/moves.h" #include "constants/party_menu.h" #include "constants/rgb.h" #include "constants/songs.h" -#ifdef TX_RANDOMIZER_AND_CHALLENGES - //#include "tx_randomizer_and_challenges.h" -#endif +#if POKEDEX_PLUS_HGSS == TRUE enum { @@ -71,7 +66,7 @@ enum INFO_SCREEN, STATS_SCREEN, EVO_SCREEN, - FORMS_SCREEN, //Pokemonexpansion only (rhh) + FORMS_SCREEN, AREA_SCREEN, CRY_SCREEN, SIZE_SCREEN, @@ -144,8 +139,6 @@ static const u8 sText_TenDashes2[] = _("----------"); #define HGSS_DARK_MODE 0 //0 false, 1 true #define HGSS_HIDE_UNSEEN_EVOLUTION_NAMES 0 //0 false, 1 true - - // For scrolling search parameter #define MAX_SEARCH_PARAM_ON_SCREEN 6 #define MAX_SEARCH_PARAM_CURSOR_POS (MAX_SEARCH_PARAM_ON_SCREEN - 1) @@ -161,34 +154,16 @@ static const u8 sText_TenDashes2[] = _("----------"); #define MON_PAGE_X 48 #define MON_PAGE_Y 56 - - - - static EWRAM_DATA struct PokedexView *sPokedexView = NULL; static EWRAM_DATA u16 sLastSelectedPokemon = 0; static EWRAM_DATA u8 sPokeBallRotation = 0; static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL; //Pokedex Plus HGSS_Ui -#ifndef BATTLE_ENGINE -#define MOVES_COUNT_TOTAL (EGG_MOVES_ARRAY_COUNT + MAX_LEVEL_UP_MOVES + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + TUTOR_MOVE_COUNT) -#else #define MOVES_COUNT_TOTAL (EGG_MOVES_ARRAY_COUNT + MAX_LEVEL_UP_MOVES + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + 20) -#endif EWRAM_DATA static u16 sStatsMoves[MOVES_COUNT_TOTAL] = {0}; EWRAM_DATA static u16 sStatsMovesTMHM_ID[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; - - - - - - - - - - struct SearchOptionText { const u8 *description; @@ -229,16 +204,6 @@ struct PokedexListItem u16 owned:1; }; - - - - - - - - - - //HGSS_Ui struct PokemonStats { @@ -278,12 +243,9 @@ struct EvoScreenData bool8 seen[10]; u8 menuPos; u8 arrowSpriteId; - #ifdef POKEMON_EXPANSION bool8 isMega; - #endif }; -#ifdef POKEMON_EXPANSION struct FromScreenData { u8 numForms; @@ -292,7 +254,6 @@ struct FromScreenData u8 menuPos; u8 arrowSpriteId; }; -#endif struct PokedexView { @@ -313,9 +274,7 @@ struct PokedexView u8 statBarsSpriteId; //HGSS_Ui u8 statBarsBgSpriteId; //HGSS_Ui bool8 justScrolled; //HGSS_Ui - #ifdef BATTLE_ENGINE - u8 splitIconSpriteId; //HGSS_Ui Physical/Special Split from BE - #endif + u8 splitIconSpriteId; //HGSS_Ui Physical/Special Split u8 numEggMoves; //HGSS_Ui u8 numLevelUpMoves; //HGSS_Ui u8 numTMHMMoves; //HGSS_Ui @@ -323,9 +282,7 @@ struct PokedexView u8 numPreEvolutions; //HGSS_Ui struct PokemonStats sPokemonStats; //HGSS_Ui struct EvoScreenData sEvoScreenData; //HGSS_Ui - #ifdef POKEMON_EXPANSION struct FromScreenData sFormScreenData; //HGSS_Ui - #endif u16 formSpecies; u16 selectedMonSpriteId; u16 pokeBallRotationStep; @@ -353,22 +310,6 @@ struct PokedexView u8 unkArr3[8]; // Cleared, never read }; - - - - - - - - - - - - - - - - static void ResetPokedexView(struct PokedexView *pokedexView); static void VBlankCB_Pokedex(void); static void CB2_Pokedex(void); @@ -479,14 +420,6 @@ static void CreateTypeIconSprites(void); static void SetSearchRectHighlight(u8 flags, u8 x, u8 y, u8 width); static void PrintInfoSubMenuText(u8 windowId, const u8 *str, u8 left, u8 top); - - - - - - - - //Stats screen HGSS_Ui static void LoadTilesetTilemapHGSS(u8 page); @@ -520,17 +453,14 @@ static void CreateStatBarsBg(void); static void SpriteCB_StatBars(struct Sprite *sprite); static void SpriteCB_StatBarsBg(struct Sprite *sprite); -//HGSS_UI Forms screen for PokemonExpansion (rhh) -#ifdef POKEMON_EXPANSION +//HGSS_UI Forms screen static void Task_LoadFormsScreen(u8 taskId); static void Task_HandleFormsScreenInput(u8 taskId); static void PrintForms(u8 taskId, u16 species); static void Task_SwitchScreensFromFormsScreen(u8 taskId); static void Task_ExitFormsScreen(u8 taskId); -#endif -//HGSS_UI Physical Special Split icon for BattleEngine (rhh) -#ifdef BATTLE_ENGINE +//HGSS_UI Physical Special Split icon static u8 ShowSplitIcon(u32 split); //Physical/Special Split from BE static void DestroySplitIcon(void); //Physical/Special Split from BE @@ -588,7 +518,6 @@ static const struct SpriteTemplate sSpriteTemplate_SplitIcons = .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; -#endif //HGSS_Ui Stat bars by DizzyEgg #define TAG_STAT_BAR 4097 @@ -683,22 +612,6 @@ static const struct SpritePalette sStatBarSpritePal[] = //{sStatBarPalette, TAG_ {0} }; - - - - - - - - - - - - - - - - static const struct OamData sOamData_ScrollBar = { .y = DISPLAY_HEIGHT, @@ -1179,24 +1092,6 @@ static const struct SpritePalette sInterfaceSpritePalette[] = static const u8 sScrollMonIncrements[] = {4, 8, 16, 32, 32}; static const u8 sScrollTimers[] = {8, 4, 2, 1, 1}; - - - - - - - - - - - - - - - - - - static const struct BgTemplate sPokedex_BgTemplate[] = { { @@ -1251,20 +1146,6 @@ static const struct WindowTemplate sPokemonList_WindowTemplate[] = DUMMY_WIN_TEMPLATE }; - - - - - - - - - - - - - - static const struct BgTemplate sInfoScreen_BgTemplate[] = { { @@ -1530,14 +1411,6 @@ static const struct WindowTemplate sNewEntryInfoScreen_WindowTemplates[] = DUMMY_WIN_TEMPLATE }; - - - - - - - - // First character in range followed by number of characters in range for upper and lowercase static const u8 sLetterSearchRanges[][4] = { @@ -1943,9 +1816,7 @@ static const struct SearchOptionText sDexSearchTypeOptions[NUMBER_OF_MON_TYPES + {gText_DexEmptyString, gTypeNames[TYPE_ICE]}, {gText_DexEmptyString, gTypeNames[TYPE_DRAGON]}, {gText_DexEmptyString, gTypeNames[TYPE_DARK]}, - #ifdef BATTLE_ENGINE {gText_DexEmptyString, gTypeNames[TYPE_FAIRY]}, - #endif {}, }; @@ -1980,9 +1851,7 @@ static const u8 sDexSearchTypeIds[NUMBER_OF_MON_TYPES] = TYPE_ICE, TYPE_DRAGON, TYPE_DARK, - #ifdef BATTLE_ENGINE TYPE_FAIRY, - #endif }; // Number pairs are the task data for tracking the cursor pos and scroll offset of each option list @@ -2183,10 +2052,8 @@ static void CB2_Pokedex(void) void Task_OpenPokedexMainPage(u8 taskId) { sPokedexView->isSearchResults = FALSE; - #ifdef POKEMON_EXPANSION sPokedexView->sEvoScreenData.fromEvoPage = FALSE; sPokedexView->formSpecies = 0; - #endif if (LoadPokedexListPage(PAGE_MAIN)) gTasks[taskId].func = Task_HandlePokedexInput; } @@ -4139,12 +4006,10 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) sPokedexView = AllocZeroed(sizeof(struct PokedexView)); //for type icons ResetPokedexView(sPokedexView); - #ifdef POKEMON_EXPANSION if (gFormSpeciesIdTables[species] != NULL) sPokedexView->formSpecies = species; else sPokedexView->formSpecies = 0; - #endif LoadTilesetTilemapHGSS(INFO_SCREEN); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); @@ -4170,11 +4035,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) gTasks[taskId].tState++; break; case 4: - #ifndef POKEMON_EXPANSION spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, MON_PAGE_X, MON_PAGE_Y, 0); - #else - spriteId = CreateMonPicSprite(species, 0, ((u16)gTasks[taskId].tPersonalityHi << 16) | (u16)gTasks[taskId].tPersonalityLo, TRUE, MON_PAGE_X, MON_PAGE_Y, 0, TAG_NONE); - #endif gSprites[spriteId].oam.priority = 0; BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(gPokedexVBlankCB); @@ -4376,14 +4237,12 @@ static const u8 sMoveTypeToOamPaletteNum[NUMBER_OF_MON_TYPES + CONTEST_CATEGORIE [TYPE_ICE] = TYPE_ICON_PAL_NUM_1, [TYPE_DRAGON] = TYPE_ICON_PAL_NUM_2, [TYPE_DARK] = TYPE_ICON_PAL_NUM_0, + [TYPE_FAIRY] = TYPE_ICON_PAL_NUM_1, [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_COOL] = TYPE_ICON_PAL_NUM_0, [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_BEAUTY] = TYPE_ICON_PAL_NUM_1, [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_CUTE] = TYPE_ICON_PAL_NUM_1, [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_SMART] = TYPE_ICON_PAL_NUM_2, [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_TOUGH] = TYPE_ICON_PAL_NUM_0, - #ifdef TYPE_FAIRY - [TYPE_FAIRY] = TYPE_ICON_PAL_NUM_1, //based on battle_engine - #endif }; static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) { @@ -4817,14 +4676,10 @@ u16 NationalPokedexNumToSpeciesHGSS(u16 nationalNum) if (!nationalNum) return 0; - #ifndef POKEMON_EXPANSION - return NationalPokedexNumToSpecies(nationalNum); - #else if (sPokedexView->formSpecies != 0) return sPokedexView->formSpecies; else return NationalPokedexNumToSpecies(nationalNum); - #endif } static void LoadTilesetTilemapHGSS(u8 page) @@ -4850,14 +4705,9 @@ static void LoadTilesetTilemapHGSS(u8 page) DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_2_Gfx, 0x2000, 0, 0); else DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_2_Gfx, 0x2000, 0, 0); - #ifndef POKEMON_EXPANSION - CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenEvolution_Tilemap, 0, 0); - #endif - #ifdef POKEMON_EXPANSION CopyToBgTilemapBuffer(3, gPokedexPlusHGSS_ScreenEvolution_Tilemap_PE, 0, 0); - #endif break; - case FORMS_SCREEN: //Pokemonexpansion only (rhh) + case FORMS_SCREEN: if (!HGSS_DECAPPED) DecompressAndLoadBgGfxUsingHeap(3, gPokedexPlusHGSS_Menu_2_Gfx, 0x2000, 0, 0); else @@ -4881,8 +4731,7 @@ static void LoadTilesetTilemapHGSS(u8 page) } } -//Physical/Special Split from BE -#ifdef BATTLE_ENGINE +//Physical/Special Split static u8 ShowSplitIcon(u32 split) { if (sPokedexView->splitIconSpriteId == 0xFF) @@ -4898,9 +4747,6 @@ static void DestroySplitIcon(void) DestroySprite(&gSprites[sPokedexView->splitIconSpriteId]); sPokedexView->splitIconSpriteId = 0xFF; } -#endif - - //************************************ //* * @@ -4975,9 +4821,7 @@ static void SaveMonDataInStruct(void) sPokedexView->sPokemonStats.friendship = gSpeciesInfo[species].friendship; sPokedexView->sPokemonStats.ability0 = GetAbilityBySpecies(species, 0); sPokedexView->sPokemonStats.ability1 = GetAbilityBySpecies(species, 1); - #ifdef POKEMON_EXPANSION sPokedexView->sPokemonStats.abilityHidden = GetAbilityBySpecies(species, 2); - #endif } #define tMonSpriteId data[4] @@ -5023,12 +4867,10 @@ static void Task_LoadStatsScreen(u8 taskId) sPokedexView->typeIconSpriteIds[0] = 0xFF; sPokedexView->typeIconSpriteIds[1] = 0xFF; CreateTypeIconSprites(); - #ifdef BATTLE_ENGINE - sPokedexView->splitIconSpriteId = 0xFF; //Physical/Special Split from BE - LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); //Physical/Special Split from BE - LoadCompressedSpriteSheet(&sSpriteSheet_SplitIcons); //Physical/Special Split from BE - LoadSpritePalette(&sSpritePal_SplitIcons); //Physical/Special Split from BE - #endif + sPokedexView->splitIconSpriteId = 0xFF; //Physical/Special Split + LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); //Physical/Special Split + LoadCompressedSpriteSheet(&sSpriteSheet_SplitIcons); //Physical/Special Split + LoadSpritePalette(&sSpritePal_SplitIcons); //Physical/Special Split gMain.state++; break; case 4: @@ -5047,12 +4889,7 @@ static void Task_LoadStatsScreen(u8 taskId) //Icon FreeMonIconPalettes(); //Free space for new pallete LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon - #ifndef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0, TRUE); //Create pokemon sprite - #endif - #ifdef POKEMON_EXPANSION - gTasks[taskId].data[6] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite - #endif + gTasks[taskId].data[6] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite gSprites[gTasks[taskId].data[4]].oam.priority = 0; } gMain.state++; @@ -5151,10 +4988,8 @@ static void Task_HandleStatsScreenInput(u8 taskId) PrintStatsScreen_Moves_BottomText(taskId); PrintStatsScreen_Moves_Bottom(taskId); - #ifdef POKEMON_EXPANSION FillWindowPixelBuffer(WIN_STATS_ABILITIES, PIXEL_FILL(0)); PrintStatsScreen_Abilities(taskId); - #endif } if (JOY_NEW(B_BUTTON)) { @@ -5275,7 +5110,7 @@ static bool8 CalculateMoves(void) { if (GetTMHMMoves(j) == move) { - sStatsMovesTMHM_ID[numTMHMMoves] = (ITEM_TM01_FOCUS_PUNCH + j); + sStatsMovesTMHM_ID[numTMHMMoves] = (ITEM_TM01 + j); numTMHMMoves++; break; } @@ -5346,17 +5181,7 @@ static void PrintStatsScreen_Moves_Top(u8 taskId) } else if (selected < (numEggMoves + numLevelUpMoves)) { - #if defined (BATTLE_ENGINE) || defined (POKEMON_EXPANSION) - level = gLevelUpLearnsets[species][(selected-numEggMoves)].level; - #else - //Calculate level of the move - while (((gLevelUpLearnsets[species][(selected-numEggMoves)] & LEVEL_UP_MOVE_LV) != (level << 9)) && level < 0xFF) - { - level++; - if (gLevelUpLearnsets[species][(selected-numEggMoves)] == LEVEL_UP_END) - level = 0xFF; - } - #endif + level = gLevelUpLearnsets[species][(selected-numEggMoves)].level; ConvertIntToDecimalStringN(gStringVar1, level, STR_CONV_MODE_LEFT_ALIGN, 3); //Move learn lvl PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gText_Stats_MoveLevel, moves_x + 113, moves_y + 3); //Level text PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gStringVar1, moves_x + 113, moves_y + 14); //Print level @@ -5449,11 +5274,9 @@ static void PrintStatsScreen_Moves_Bottom(u8 taskId) else ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintStatsScreenTextSmall(WIN_STATS_MOVES_BOTTOM, gStringVar1, moves_x + 45, moves_y); - //Physical/Special Split from BE - #ifdef BATTLE_ENGINE + //Physical/Special Split DestroySplitIcon(); ShowSplitIcon(GetBattleMoveSplit(move)); - #endif //Accuracy if (gBattleMoves[move].accuracy == 0) StringCopy(gStringVar1, gText_ThreeDashes); @@ -5463,10 +5286,8 @@ static void PrintStatsScreen_Moves_Bottom(u8 taskId) } else //Appeal + Jam { - #ifdef BATTLE_ENGINE DestroySplitIcon(); gSprites[sPokedexView->splitIconSpriteId].invisible = TRUE; - #endif //Appeal contest_effectValue = gContestEffects[gContestMoves[move].effect].appeal; if (contest_effectValue != 0xFF) @@ -6004,10 +5825,9 @@ static void PrintStatsScreen_Abilities(u8 taskId) u16 abilityHidden; //Abilitie(s) - #ifdef POKEMON_EXPANSION + if (gTasks[taskId].data[5] == 0) { - #endif ability0 = sPokedexView->sPokemonStats.ability0; PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability0], abilities_x, abilities_y); PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[ability0], abilities_x, abilities_y + 14); @@ -6018,7 +5838,6 @@ static void PrintStatsScreen_Abilities(u8 taskId) PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[ability1], abilities_x, abilities_y + 30); PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[ability1], abilities_x, abilities_y + 44); } - #ifdef POKEMON_EXPANSION } else //Hidden abilities { @@ -6026,7 +5845,6 @@ static void PrintStatsScreen_Abilities(u8 taskId) PrintStatsScreenTextSmallWhite(WIN_STATS_ABILITIES, gAbilityNames[abilityHidden], abilities_x, abilities_y); PrintStatsScreenTextSmall(WIN_STATS_ABILITIES, gAbilityDescriptionPointers[abilityHidden], abilities_x, abilities_y + 14); } - #endif } static void Task_SwitchScreensFromStatsScreen(u8 taskId) @@ -6095,7 +5913,6 @@ static void EvoFormsPage_PrintNavigationButtons(void) FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); - #ifdef POKEMON_EXPANSION if (sPokedexView->selectedScreen == EVO_SCREEN) { if (!HGSS_DECAPPED) @@ -6120,12 +5937,7 @@ static void EvoFormsPage_PrintNavigationButtons(void) AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x, y, sStatsPageNavigationTextColor, 0, gText_FORMS_Buttons_Decapped_PE); } } - #else - if (!HGSS_DECAPPED) - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons); - else - AddTextPrinterParameterized3(WIN_NAVIGATION_BUTTONS, 0, x+9, y, sStatsPageNavigationTextColor, 0, gText_EVO_Buttons_Decapped); - #endif + // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) PutWindowTilemap(WIN_NAVIGATION_BUTTONS); CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); @@ -6210,11 +6022,7 @@ static void Task_LoadEvolutionScreen(u8 taskId) FreeMonIconPalettes(); //Free space for new pallete LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon PrintPreEvolutions(taskId, NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); - #ifdef POKEMON_EXPANSION - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0); //Create pokemon sprite - #else - gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0, TRUE); //Create pokemon sprite - #endif + gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0); //Create pokemon sprite EvoFormsPage_PrintNavigationButtons(); //HGSS_Ui Navigation buttons gSprites[gTasks[taskId].data[4]].oam.priority = 0; } @@ -6228,7 +6036,7 @@ static void Task_LoadEvolutionScreen(u8 taskId) GetSeenFlagTargetSpecies(); if (sPokedexView->sEvoScreenData.numAllEvolutions != 0 && sPokedexView->sEvoScreenData.numSeen != 0) { - sPokedexView->sEvoScreenData.arrowSpriteId = CreateSprite(&sSpriteTemplate_Arrow, 7, 58, 0); + sPokedexView->sEvoScreenData.arrowSpriteId = CreateSprite(&gSpriteTemplate_Arrow, 7, 58, 0); gSprites[sPokedexView->sEvoScreenData.arrowSpriteId].animNum = 2; } gMain.state++; @@ -6278,7 +6086,6 @@ static void Task_LoadEvolutionScreen(u8 taskId) static void Task_HandleEvolutionScreenInput(u8 taskId) { //Switch to forms screen, Pokemon Expansion only (rhh) - #ifdef POKEMON_EXPANSION if (JOY_NEW(START_BUTTON)) { sPokedexView->selectedScreen = FORMS_SCREEN; @@ -6287,7 +6094,6 @@ static void Task_HandleEvolutionScreenInput(u8 taskId) gTasks[taskId].func = Task_SwitchScreensFromEvolutionScreen; PlaySE(SE_PIN); } - #endif if (sPokedexView->sEvoScreenData.numAllEvolutions != 0 && sPokedexView->sEvoScreenData.numSeen != 0) { @@ -6328,12 +6134,10 @@ static void Task_HandleEvolutionScreenInput(u8 taskId) sPokedexListItem->seen = GetSetPokedexFlag(dexNum, FLAG_GET_SEEN); sPokedexListItem->owned = GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT); - #ifdef POKEMON_EXPANSION if (gFormSpeciesIdTables[targetSpecies] != NULL) sPokedexView->formSpecies = targetSpecies; else sPokedexView->formSpecies = 0; - #endif sPokedexView->sEvoScreenData.fromEvoPage = TRUE; PlaySE(SE_PIN); @@ -6393,26 +6197,19 @@ static void HandleTargetSpeciesPrint(u8 taskId, u16 targetSpecies, u16 previousT iterations = 9; if (targetSpecies == previousTargetSpecies) return; - #ifdef POKEMON_EXPANSION else if (targetSpecies == SPECIES_GLACEON) base_i -= 1; else if (targetSpecies == SPECIES_SYLVEON) base_i -= 2; - #endif } if (base_i < iterations) { LoadMonIconPalette(targetSpecies); //Loads pallete for current mon - #ifndef POKEMON_EXPANSION - gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 50 + 32*base_i, 31, 4, 0, TRUE); //Create pokemon sprite - #endif - #ifdef POKEMON_EXPANSION if (isEevee) gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 45 + 26*base_i, 31, 4, 0); //Create pokemon sprite else gTasks[taskId].data[4+base_i] = CreateMonIcon(targetSpecies, SpriteCB_MonIcon, 50 + 32*base_i, 31, 4, 0); //Create pokemon sprite - #endif gSprites[gTasks[taskId].data[4+base_i]].oam.priority = 0; } } @@ -6435,12 +6232,10 @@ static void HandlePreEvolutionSpeciesPrint(u8 taskId, u16 preSpecies, u16 specie StringCopy(gStringVar1, gSpeciesNames[species]); //evolution mon name - #ifdef POKEMON_EXPANSION if (sPokedexView->sEvoScreenData.isMega) StringExpandPlaceholders(gStringVar3, gText_EVO_PreEvo_PE_Mega); else { - #endif if (seen || !HGSS_HIDE_UNSEEN_EVOLUTION_NAMES) StringCopy(gStringVar2, gSpeciesNames[preSpecies]); //evolution mon name @@ -6449,21 +6244,14 @@ static void HandlePreEvolutionSpeciesPrint(u8 taskId, u16 preSpecies, u16 specie StringExpandPlaceholders(gStringVar3, gText_EVO_PreEvo); //evolution mon name - #ifdef POKEMON_EXPANSION } - #endif PrintInfoScreenTextSmall(gStringVar3, base_x, base_y + base_y_offset*base_i); //evolution mon name if (base_i < 3) { LoadMonIconPalette(preSpecies); //Loads pallete for current mon - #ifndef POKEMON_EXPANSION - gTasks[taskId].data[4+base_i] = CreateMonIcon(preSpecies, SpriteCB_MonIcon, 18 + 32*base_i, 31, 4, 0, TRUE); //Create pokemon sprite - #endif - #ifdef POKEMON_EXPANSION - gTasks[taskId].data[4+base_i] = CreateMonIcon(preSpecies, SpriteCB_MonIcon, 18 + 32*base_i, 31, 4, 0); //Create pokemon sprite - #endif + gTasks[taskId].data[4+base_i] = CreateMonIcon(preSpecies, SpriteCB_MonIcon, 18 + 32*base_i, 31, 4, 0); //Create pokemon sprite gSprites[gTasks[taskId].data[4+base_i]].oam.priority = 0; } } @@ -6483,16 +6271,8 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) u16 preEvolutionTwo = 0; u8 numPreEvolutions = 0; - #ifdef POKEMON_EXPANSION bool8 isMega = FALSE; sPokedexView->sEvoScreenData.isMega = FALSE; - #endif - - #ifdef TX_RANDOMIZER_AND_CHALLENGES - if (gSaveBlock1Ptr->tx_Random_Evolutions || gSaveBlock1Ptr->tx_Random_EvolutionMethods) - return 0; - #endif - //Calculate previous evolution for (i = 0; i < NUM_SPECIES; i++) @@ -6503,19 +6283,16 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) { preEvolutionOne = i; numPreEvolutions += 1; - #ifdef POKEMON_EXPANSION - if (gEvolutionTable[i][j].method == EVO_MEGA_EVOLUTION) + if (gFormChangeTablePointers[species]->method == FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM) { - CopyItemName(gEvolutionTable[i][j].param, gStringVar2); //item + CopyItemName(gFormChangeTablePointers[species]->param1, gStringVar2); //item isMega = TRUE; } - #endif break; } } } - #ifdef POKEMON_EXPANSION if (isMega) { sPokedexView->numPreEvolutions = numPreEvolutions; @@ -6526,7 +6303,6 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) HandlePreEvolutionSpeciesPrint(taskId, preEvolutionOne, species, base_x - 8, base_y, base_y_offset, numPreEvolutions - 1); return numPreEvolutions; } - #endif //Calculate if previous evolution also has a previous evolution if (numPreEvolutions != 0) @@ -6578,10 +6354,8 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_i) { u16 i; - #ifdef POKEMON_EXPANSION u16 j; const struct MapHeader *mapHeader; - #endif u16 targetSpecies = 0; u16 previousTargetSpecies = 0; @@ -6597,34 +6371,19 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_x = 16; bool8 isEevee = FALSE; - #ifdef POKEMON_EXPANSION if (sPokedexView->sEvoScreenData.isMega) return 0; - #endif StringCopy(gStringVar1, gSpeciesNames[species]); if (species == SPECIES_EEVEE) isEevee = TRUE; - #ifdef TX_RANDOMIZER_AND_CHALLENGES - if (EvolutionBlockedByEvoLimit(species)) //No Evos already previously checked - species = SPECIES_NONE; - else if (gSaveBlock1Ptr->tx_Random_EvolutionMethods) - species = GetSpeciesRandomSeeded(species, TX_RANDOM_T_EVO_METH, 0); - #endif - //Calculate number of possible direct evolutions (e.g. Eevee has 5 but torchic has 1) for (i = 0; i < EVOS_PER_MON; i++) { - #ifndef POKEMON_EXPANSION - if (gEvolutionTable[species][i].method != 0) - times += 1; - #endif - #ifdef POKEMON_EXPANSION - if (gEvolutionTable[species][i].method != 0 && gEvolutionTable[species][i].method != EVO_MEGA_EVOLUTION) - times += 1; - #endif + if (gEvolutionTable[species][i].method != 0) + times += 1; } gTasks[taskId].data[3] = times; sPokedexView->sEvoScreenData.numAllEvolutions += times; @@ -6645,10 +6404,6 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, previousTargetSpecies = targetSpecies; targetSpecies = gEvolutionTable[species][i].targetSpecies; sPokedexView->sEvoScreenData.targetSpecies[base_i] = targetSpecies; - #ifdef TX_DIFFICULTY_CHALLENGES_USED - if (gSaveBlock1Ptr->txRandEvolutions && targetSpecies != SPECIES_NONE) //tx_difficulty_challenges - targetSpecies = GetSpeciesRandomSeeded(targetSpecies, TX_RANDOM_T_EVO, 0); - #endif CreateCaughtBallEvolutionScreen(targetSpecies, base_x + depth_x*depth-9, base_y + base_y_offset*base_i, 0); HandleTargetSpeciesPrint(taskId, targetSpecies, previousTargetSpecies, base_x + depth_x*depth, base_y, base_y_offset, base_i, isEevee); //evolution mon name @@ -6713,7 +6468,6 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, 3); //beauty StringExpandPlaceholders(gStringVar4, gText_EVO_BEAUTY ); break; - #ifdef POKEMON_EXPANSION case EVO_LEVEL_FEMALE: ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_FEMALE ); @@ -6748,7 +6502,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, StringCopy(gStringVar2, gMoveNames[gEvolutionTable[species][i].param]); StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE ); break; - case EVO_MOVE_TYPE: + case EVO_FRIENDSHIP_MOVE_TYPE: StringCopy(gStringVar2, gTypeNames[gEvolutionTable[species][i].param]); StringExpandPlaceholders(gStringVar4, gText_EVO_MOVE_TYPE ); break; @@ -6786,7 +6540,6 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, GetMapName(gStringVar2, mapHeader->regionMapSectionId, 0); StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MAP ); break; - #endif default: StringExpandPlaceholders(gStringVar4, gText_EVO_UNKNOWN ); break; @@ -6820,11 +6573,9 @@ static void Task_SwitchScreensFromEvolutionScreen(u8 taskId) case 2: gTasks[taskId].func = Task_LoadCryScreen; break; - #ifdef POKEMON_EXPANSION - case 3: + case 3: gTasks[taskId].func = Task_LoadFormsScreen; break; - #endif default: gTasks[taskId].func = Task_LoadInfoScreen; break; @@ -6851,13 +6602,12 @@ static void Task_ExitEvolutionScreen(u8 taskId) } - //************************************ //* * //* FORMS * //* * //************************************ -#ifdef POKEMON_EXPANSION + static void Task_LoadFormsScreen(u8 taskId) { switch (gMain.state) @@ -7154,7 +6904,6 @@ static void Task_ExitFormsScreen(u8 taskId) DestroyTask(taskId); } } -#endif #undef tMonSpriteId @@ -7352,7 +7101,6 @@ static void Task_SwitchScreensFromCryScreen(u8 taskId) } - //************************************ //* * //* Size screen * @@ -7549,10 +7297,8 @@ static void Task_WaitForExitSearch(u8 taskId) static void Task_OpenSearchResults(u8 taskId) { sPokedexView->isSearchResults = TRUE; - #ifdef POKEMON_EXPANSION sPokedexView->sEvoScreenData.fromEvoPage = FALSE; sPokedexView->formSpecies = 0; - #endif if (LoadPokedexListPage(PAGE_SEARCH_RESULTS)) gTasks[taskId].func = Task_HandleSearchResultsInput; } @@ -8749,4 +8495,6 @@ static void PrintSearchParameterTitle(u32 y, const u8 *str) static void ClearSearchParameterBoxText(void) { ClearSearchMenuRect(144, 8, 96, 96); -} \ No newline at end of file +} + +#endif From e8f56d5c687d543ee180fc903701e14953f18211 Mon Sep 17 00:00:00 2001 From: Aaghat Date: Fri, 8 Sep 2023 19:26:29 +0530 Subject: [PATCH 78/88] use rare candy instead of exp share --- src/pokedex_plus_hgss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index 61185fdff229..da6b25642dad 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -5185,7 +5185,7 @@ static void PrintStatsScreen_Moves_Top(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, level, STR_CONV_MODE_LEFT_ALIGN, 3); //Move learn lvl PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gText_Stats_MoveLevel, moves_x + 113, moves_y + 3); //Level text PrintStatsScreenTextSmall(WIN_STATS_MOVES_TOP, gStringVar1, moves_x + 113, moves_y + 14); //Print level - item = ITEM_EXP_SHARE; + item = ITEM_RARE_CANDY; } else if (selected < (numEggMoves + numLevelUpMoves + numTMHMMoves)) { From 7832a43544ea5b5441b3ccb011a04d36e936f4a4 Mon Sep 17 00:00:00 2001 From: Aaghat Date: Fri, 8 Sep 2023 21:47:43 +0530 Subject: [PATCH 79/88] Minor fixes --- include/party_menu.h | 3 --- src/party_menu.c | 5 ----- src/pokedex_plus_hgss.c | 4 ++-- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/include/party_menu.h b/include/party_menu.h index ab12d76c5e10..38139cc9622b 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -96,8 +96,5 @@ void MoveDeleterForgetMove(void); void BufferMoveDeleterNicknameAndMove(void); void GetNumMovesSelectedMonHas(void); void MoveDeleterChooseMoveToForget(void); -#if POKEDEX_PLUS_HGSS == TRUE -u16 GetTMHMMoves(u16 item); -#endif #endif // GUARD_PARTY_MENU_H diff --git a/src/party_menu.c b/src/party_menu.c index 3cc84587cbbd..2b7256628201 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -6964,8 +6964,3 @@ void IsLastMonThatKnowsSurf(void) gSpecialVar_Result = TRUE; } } - -u16 GetTMHMMoves(u16 item) -{ - return (ItemId_GetPocket(item) == POCKET_TM_HM) ? gItems[item].secondaryId : MOVE_NONE; -} diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index da6b25642dad..2aa92c7c22e6 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -159,7 +159,7 @@ static EWRAM_DATA u16 sLastSelectedPokemon = 0; static EWRAM_DATA u8 sPokeBallRotation = 0; static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL; //Pokedex Plus HGSS_Ui -#define MOVES_COUNT_TOTAL (EGG_MOVES_ARRAY_COUNT + MAX_LEVEL_UP_MOVES + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + 20) +#define MOVES_COUNT_TOTAL (EGG_MOVES_ARRAY_COUNT + MAX_LEVEL_UP_MOVES + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES) EWRAM_DATA static u16 sStatsMoves[MOVES_COUNT_TOTAL] = {0}; EWRAM_DATA static u16 sStatsMovesTMHM_ID[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0}; @@ -5108,7 +5108,7 @@ static bool8 CalculateMoves(void) move = gTeachableLearnsets[species][i]; for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) { - if (GetTMHMMoves(j) == move) + if (ItemIdToBattleMoveId(ITEM_TM01 + j) == move) { sStatsMovesTMHM_ID[numTMHMMoves] = (ITEM_TM01 + j); numTMHMMoves++; From dbeaa2b2e952ee0b93156ef653ff0b4d50e34425 Mon Sep 17 00:00:00 2001 From: Aaghat Date: Fri, 8 Sep 2023 21:56:12 +0530 Subject: [PATCH 80/88] add config comment --- include/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config.h b/include/config.h index fbfd1e723861..9d183e00186d 100644 --- a/include/config.h +++ b/include/config.h @@ -75,6 +75,6 @@ // General settings #define EXPANSION_INTRO TRUE // If TRUE, a custom RHH intro will play after the vanilla copyright screen. -#define POKEDEX_PLUS_HGSS TRUE +#define POKEDEX_PLUS_HGSS TRUE // If TRUE, enables the custom HGSS style Pokedex. #endif // GUARD_CONFIG_H From 6ac16c8c2e8bfe502a9b17afb99efcdb150629fa Mon Sep 17 00:00:00 2001 From: Aaghat Date: Sat, 9 Sep 2023 10:16:14 +0530 Subject: [PATCH 81/88] More clean up --- include/graphics.h | 1 - include/pokedex.h | 2 +- include/pokedex_plus_hgss.h | 6 ++---- include/strings.h | 1 - src/daycare.c | 2 +- src/pokedex.c | 2 ++ 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/graphics.h b/include/graphics.h index 37509783d0c3..7d96c5ef9ed5 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -7712,7 +7712,6 @@ extern const u32 gPokedexPlusHGSS_ScreenSearchHoenn_Tilemap[]; extern const u32 gPokedexPlusHGSS_ScreenSearchNational_Tilemap[]; #endif - // berry tag screen extern const u32 gBerryCheck_Gfx[]; extern const u32 gBerryCheck_Pal[]; diff --git a/include/pokedex.h b/include/pokedex.h index a28024898172..96cd02affbdd 100644 --- a/include/pokedex.h +++ b/include/pokedex.h @@ -36,7 +36,7 @@ void ResetPokedex(void); u16 GetPokedexHeightWeight(u16 dexNum, u8 data); u16 GetNationalPokedexCount(u8); u16 GetHoennPokedexCount(u8); -u8 DisplayCaughtMonDexPage(u16 species, u32 otId, u32 personality); +u8 DisplayCaughtMonDexPage(u16 dexNum, u32 otId, u32 personality); s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId); u16 CreateMonSpriteFromNationalDexNumber(u16, s16, s16, u16); bool16 HasAllHoennMons(void); diff --git a/include/pokedex_plus_hgss.h b/include/pokedex_plus_hgss.h index 45367cc4bbe9..d8879dc7bb54 100644 --- a/include/pokedex_plus_hgss.h +++ b/include/pokedex_plus_hgss.h @@ -1,11 +1,9 @@ #ifndef GUARD_POKEDEX_PLUS_HGSS_H #define GUARD_POKEDEX_PLUS_HGSS_H -extern u8 gUnusedPokedexU8; -extern void (*gPokedexVBlankCB)(void); - - +#if POKEDEX_PLUS_HGSS == TRUE void CB2_OpenPokedexPlusHGSS(void); u16 NationalPokedexNumToSpeciesHGSS(u16 nationalNum); +#endif #endif // GUARD_POKEDEX_PLUS_HGSS_H diff --git a/include/strings.h b/include/strings.h index 1382e562dc20..da9ea1273c1b 100644 --- a/include/strings.h +++ b/include/strings.h @@ -658,7 +658,6 @@ extern const u8 gText_FORMS_Buttons_Submenu_Decapped_PE[]; extern const u8 gText_FORMS_NONE[]; #endif - // birch dex rating text extern const u8 gBirchDexRatingText_LessThan10[]; extern const u8 gBirchDexRatingText_LessThan20[]; diff --git a/src/daycare.c b/src/daycare.c index b577fe68ca41..42493bb92b67 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -806,7 +806,6 @@ u8 GetEggMovesSpecies(u16 species, u16 *eggMoves) return numEggMoves; } -#endif bool8 SpeciesCanLearnEggMove(u16 species, u16 move) //Move search PokedexPlus HGSS_Ui { @@ -832,6 +831,7 @@ bool8 SpeciesCanLearnEggMove(u16 species, u16 move) //Move search PokedexPlus HG } return FALSE; } +#endif static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, struct BoxPokemon *mother) { diff --git a/src/pokedex.c b/src/pokedex.c index b0b19a455631..7da3226bc13d 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -14,7 +14,9 @@ #include "overworld.h" #include "palette.h" #include "pokedex.h" +#if POKEDEX_PLUS_HGSS == TRUE #include "pokedex_plus_hgss.h" +#endif #include "pokedex_area_screen.h" #include "pokedex_cry_screen.h" #include "scanline_effect.h" From 332cc292739cf4d4092434b4cebc5cd662e8c140 Mon Sep 17 00:00:00 2001 From: Aaghat Date: Sat, 9 Sep 2023 10:56:45 +0530 Subject: [PATCH 82/88] Add new Evo methods --- include/strings.h | 9 +++++++++ src/pokedex_plus_hgss.c | 43 +++++++++++++++++++++++++++++++++++++++++ src/strings.c | 9 +++++++++ 3 files changed, 61 insertions(+) diff --git a/include/strings.h b/include/strings.h index da9ea1273c1b..797b1898abcf 100644 --- a/include/strings.h +++ b/include/strings.h @@ -648,6 +648,15 @@ extern const u8 gText_EVO_SPECIFIC_MON_IN_PARTY[]; extern const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[]; extern const u8 gText_EVO_TRADE_SPECIFIC_MON[]; extern const u8 gText_EVO_SPECIFIC_MAP[]; +extern const u8 gText_EVO_LEVEL_NATURE_AMPED[]; +extern const u8 gText_EVO_LEVEL_NATURE_LOW_KEY[]; +extern const u8 gText_EVO_CRITICAL_HITS[]; +extern const u8 gText_EVO_SCRIPT_TRIGGER_DMG[]; +extern const u8 gText_EVO_DARK_SCROLL[]; +extern const u8 gText_EVO_WATER_SCROLL[]; +extern const u8 gText_EVO_ITEM_NIGHT[]; +extern const u8 gText_EVO_ITEM_DAY[]; +extern const u8 gText_EVO_ITEM_HOLD[]; extern const u8 gText_EVO_UNKNOWN[]; extern const u8 gText_EVO_NONE[]; diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index 2aa92c7c22e6..3a5676ce9eb3 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -6350,6 +6350,8 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species) } #define EVO_SCREEN_LVL_DIGITS 2 +#define EVO_SCREEN_CRITS_DIGITS 1 +#define EVO_SCREEN_DMG_DIGITS 2 static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_i) { @@ -6540,6 +6542,47 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, GetMapName(gStringVar2, mapHeader->regionMapSectionId, 0); StringExpandPlaceholders(gStringVar4, gText_EVO_SPECIFIC_MAP ); break; + case EVO_LEVEL_NATURE_AMPED: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NATURE_AMPED); + break; + case EVO_LEVEL_NATURE_LOW_KEY: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_LVL_DIGITS); //level + StringExpandPlaceholders(gStringVar4, gText_EVO_LEVEL_NATURE_LOW_KEY); + break; + case EVO_CRITICAL_HITS: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_CRITS_DIGITS); //crits + StringExpandPlaceholders(gStringVar4, gText_EVO_CRITICAL_HITS); + break; + case EVO_SCRIPT_TRIGGER_DMG: + ConvertIntToDecimalStringN(gStringVar2, gEvolutionTable[species][i].param, STR_CONV_MODE_LEADING_ZEROS, EVO_SCREEN_DMG_DIGITS); //damage + StringExpandPlaceholders(gStringVar4, gText_EVO_SCRIPT_TRIGGER_DMG); + break; + case EVO_DARK_SCROLL: + item = gEvolutionTable[species][i].param; + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_EVO_DARK_SCROLL ); + break; + case EVO_WATER_SCROLL: + item = gEvolutionTable[species][i].param; + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_EVO_WATER_SCROLL ); + break; + case EVO_ITEM_NIGHT: + item = gEvolutionTable[species][i].param; + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_NIGHT ); + break; + case EVO_ITEM_DAY: + item = gEvolutionTable[species][i].param; + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_DAY ); + break; + case EVO_ITEM_HOLD: + item = gEvolutionTable[species][i].param; + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_EVO_ITEM_HOLD ); + break; default: StringExpandPlaceholders(gStringVar4, gText_EVO_UNKNOWN ); break; diff --git a/src/strings.c b/src/strings.c index 85ac0d01604e..5c96c9a4c842 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1943,6 +1943,15 @@ const u8 gText_EVO_SPECIFIC_MON_IN_PARTY[] = _("LvlUp with {STR_VAR_2} const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[] = _("LvlUp with dark type in party"); const u8 gText_EVO_TRADE_SPECIFIC_MON[] = _("Traded for {STR_VAR_2}"); const u8 gText_EVO_SPECIFIC_MAP[] = _("LvlUp on {STR_VAR_2}"); +const u8 gText_EVO_LEVEL_NATURE_AMPED[] = _("LvlUp to {STR_VAR_2}, Amped natures"); +const u8 gText_EVO_LEVEL_NATURE_LOW_KEY[] = _("LvlUp to {STR_VAR_2}, Low Key natures"); +const u8 gText_EVO_CRITICAL_HITS[] = _("Land {STR_VAR_2} critical hits in\nsingle battle"); +const u8 gText_EVO_SCRIPT_TRIGGER_DMG[] = _("Takes at least {STR_VAR_2} HP in damage"); +const u8 gText_EVO_DARK_SCROLL[] = _("ScrllOfDrknss is used"); +const u8 gText_EVO_WATER_SCROLL[] = _("ScrollOfWatrs is used"); +const u8 gText_EVO_ITEM_NIGHT[] = _("{STR_VAR_2} is used, night"); +const u8 gText_EVO_ITEM_DAY[] = _("{STR_VAR_2} is used, day"); +const u8 gText_EVO_ITEM_HOLD[] = _("LvlUp, holds {STR_VAR_2}"); const u8 gText_EVO_UNKNOWN[] = _("Method unknown"); const u8 gText_EVO_NONE[] = _("{STR_VAR_1} has no evolution."); From 1b17e3adfffb1d610b9eab7788eb8962b43470f6 Mon Sep 17 00:00:00 2001 From: Aaghat Date: Sat, 9 Sep 2023 10:59:44 +0530 Subject: [PATCH 83/88] set hgss pokedex off by default --- include/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config.h b/include/config.h index 9d183e00186d..17082b0fdc72 100644 --- a/include/config.h +++ b/include/config.h @@ -75,6 +75,6 @@ // General settings #define EXPANSION_INTRO TRUE // If TRUE, a custom RHH intro will play after the vanilla copyright screen. -#define POKEDEX_PLUS_HGSS TRUE // If TRUE, enables the custom HGSS style Pokedex. +#define POKEDEX_PLUS_HGSS FALSE // If TRUE, enables the custom HGSS style Pokedex. #endif // GUARD_CONFIG_H From 2d2a255e6f3d1579a2f88bbb7e1938b4eb216e46 Mon Sep 17 00:00:00 2001 From: Aaghat Date: Sat, 9 Sep 2023 11:29:24 +0530 Subject: [PATCH 84/88] Forgot to change caught mon dex page --- include/pokedex_plus_hgss.h | 1 + src/pokedex.c | 4 ++++ src/pokedex_plus_hgss.c | 3 +-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/pokedex_plus_hgss.h b/include/pokedex_plus_hgss.h index d8879dc7bb54..68a4ddce4fd2 100644 --- a/include/pokedex_plus_hgss.h +++ b/include/pokedex_plus_hgss.h @@ -4,6 +4,7 @@ #if POKEDEX_PLUS_HGSS == TRUE void CB2_OpenPokedexPlusHGSS(void); u16 NationalPokedexNumToSpeciesHGSS(u16 nationalNum); +void Task_DisplayCaughtMonDexPageHGSS(u8); #endif #endif // GUARD_POKEDEX_PLUS_HGSS_H diff --git a/src/pokedex.c b/src/pokedex.c index 7da3226bc13d..cf30ba549abe 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -3945,7 +3945,11 @@ static void HighlightSubmenuScreenSelectBarItem(u8 a, u16 b) u8 DisplayCaughtMonDexPage(u16 dexNum, u32 otId, u32 personality) { +#if POKEDEX_PLUS_HGSS == TRUE + u8 taskId = CreateTask(Task_DisplayCaughtMonDexPageHGSS, 0); +#else u8 taskId = CreateTask(Task_DisplayCaughtMonDexPage, 0); +#endif gTasks[taskId].tState = 0; gTasks[taskId].tDexNum = dexNum; diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index 3a5676ce9eb3..4ca784e3a9a7 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -376,7 +376,6 @@ static void LoadScreenSelectBarMain(u16); static void LoadScreenSelectBarSubmenu(u16); static void HighlightScreenSelectBarItem(u8, u16); static void HighlightSubmenuScreenSelectBarItem(u8, u16); -static void Task_DisplayCaughtMonDexPage(u8); static void Task_HandleCaughtMonPageInput(u8); static void Task_ExitCaughtMonPage(u8); static void SpriteCB_SlideCaughtMonToCenter(struct Sprite *sprite); @@ -3978,7 +3977,7 @@ static void HighlightSubmenuScreenSelectBarItem(u8 a, u16 b) #define tPersonalityLo data[14] #define tPersonalityHi data[15] -static void Task_DisplayCaughtMonDexPage(u8 taskId) +void Task_DisplayCaughtMonDexPageHGSS(u8 taskId) { u8 spriteId; u16 species = gTasks[taskId].tSpecies; From e2390733c5512b2adfe360397100b0bf3c575246 Mon Sep 17 00:00:00 2001 From: Aaghat Date: Mon, 11 Sep 2023 17:25:18 +0530 Subject: [PATCH 85/88] remove the HGSS prefixes --- .../{HGSS_SelectBar.bin => SelectBar.bin} | Bin ...electBar_clear.bin => SelectBar_clear.bin} | Bin ...alette_default.pal => palette_default.pal} | 0 ...ault_dark.pal => palette_default_dark.pal} | 0 ...ette_national.pal => palette_national.pal} | 0 ...nal_dark.pal => palette_national_dark.pal} | 0 ...earch_menu.pal => palette_search_menu.pal} | 0 ..._dark.pal => palette_search_menu_dark.pal} | 0 ...results.pal => palette_search_results.pal} | 0 ...rk.pal => palette_search_results_dark.pal} | 0 ..._cry_screen.bin => tilemap_cry_screen.bin} | Bin ..._evo_screen.bin => tilemap_evo_screen.bin} | Bin ...creen_PE.bin => tilemap_evo_screen_PE.bin} | Bin ...ms_screen.bin => tilemap_forms_screen.bin} | Bin ...nfo_screen.bin => tilemap_info_screen.bin} | Bin ...ist_screen.bin => tilemap_list_screen.bin} | Bin ...y.bin => tilemap_list_screen_underlay.bin} | Bin ...nn.bin => tilemap_search_screen_hoenn.bin} | Bin ...bin => tilemap_search_screen_national.bin} | Bin ...ize_screen.bin => tilemap_size_screen.bin} | Bin ..._start_menu.bin => tilemap_start_menu.bin} | Bin ... => tilemap_start_menu_search_results.bin} | Bin ...ts_screen.bin => tilemap_stats_screen.bin} | Bin ...et_interface.png => tileset_interface.png} | Bin ...ce_DECA.png => tileset_interface_DECA.png} | Bin ...SS_tileset_menu1.png => tileset_menu1.png} | Bin ...SS_tileset_menu2.png => tileset_menu2.png} | Bin ...SS_tileset_menu3.png => tileset_menu3.png} | Bin ...et_menu_list.png => tileset_menu_list.png} | Bin ...st_DECA.png => tileset_menu_list_DECA.png} | Bin ...enu_search.png => tileset_menu_search.png} | Bin ..._DECA.png => tileset_menu_search_DECA.png} | Bin src/graphics.c | 64 +++++++++--------- 33 files changed, 32 insertions(+), 32 deletions(-) rename graphics/pokedex/hgss/{HGSS_SelectBar.bin => SelectBar.bin} (100%) rename graphics/pokedex/hgss/{HGSS_SelectBar_clear.bin => SelectBar_clear.bin} (100%) rename graphics/pokedex/hgss/{HGSS_palette_default.pal => palette_default.pal} (100%) rename graphics/pokedex/hgss/{HGSS_palette_default_dark.pal => palette_default_dark.pal} (100%) rename graphics/pokedex/hgss/{HGSS_palette_national.pal => palette_national.pal} (100%) rename graphics/pokedex/hgss/{HGSS_palette_national_dark.pal => palette_national_dark.pal} (100%) rename graphics/pokedex/hgss/{HGSS_palette_search_menu.pal => palette_search_menu.pal} (100%) rename graphics/pokedex/hgss/{HGSS_palette_search_menu_dark.pal => palette_search_menu_dark.pal} (100%) rename graphics/pokedex/hgss/{HGSS_palette_search_results.pal => palette_search_results.pal} (100%) rename graphics/pokedex/hgss/{HGSS_palette_search_results_dark.pal => palette_search_results_dark.pal} (100%) rename graphics/pokedex/hgss/{HGSS_tilemap_cry_screen.bin => tilemap_cry_screen.bin} (100%) rename graphics/pokedex/hgss/{HGSS_tilemap_evo_screen.bin => tilemap_evo_screen.bin} (100%) mode change 100755 => 100644 rename graphics/pokedex/hgss/{HGSS_tilemap_evo_screen_PE.bin => tilemap_evo_screen_PE.bin} (100%) mode change 100755 => 100644 rename graphics/pokedex/hgss/{HGSS_tilemap_forms_screen.bin => tilemap_forms_screen.bin} (100%) mode change 100755 => 100644 rename graphics/pokedex/hgss/{HGSS_tilemap_info_screen.bin => tilemap_info_screen.bin} (100%) rename graphics/pokedex/hgss/{HGSS_tilemap_list_screen.bin => tilemap_list_screen.bin} (100%) rename graphics/pokedex/hgss/{HGSS_tilemap_list_screen_underlay.bin => tilemap_list_screen_underlay.bin} (100%) rename graphics/pokedex/hgss/{HGSS_tilemap_search_screen_hoenn.bin => tilemap_search_screen_hoenn.bin} (100%) rename graphics/pokedex/hgss/{HGSS_tilemap_search_screen_national.bin => tilemap_search_screen_national.bin} (100%) rename graphics/pokedex/hgss/{HGSS_tilemap_size_screen.bin => tilemap_size_screen.bin} (100%) rename graphics/pokedex/hgss/{HGSS_tilemap_start_menu.bin => tilemap_start_menu.bin} (100%) rename graphics/pokedex/hgss/{HGSS_tilemap_start_menu_search_results.bin => tilemap_start_menu_search_results.bin} (100%) rename graphics/pokedex/hgss/{HGSS_tilemap_stats_screen.bin => tilemap_stats_screen.bin} (100%) rename graphics/pokedex/hgss/{HGSS_tileset_interface.png => tileset_interface.png} (100%) rename graphics/pokedex/hgss/{HGSS_tileset_interface_DECA.png => tileset_interface_DECA.png} (100%) rename graphics/pokedex/hgss/{HGSS_tileset_menu1.png => tileset_menu1.png} (100%) rename graphics/pokedex/hgss/{HGSS_tileset_menu2.png => tileset_menu2.png} (100%) rename graphics/pokedex/hgss/{HGSS_tileset_menu3.png => tileset_menu3.png} (100%) rename graphics/pokedex/hgss/{HGSS_tileset_menu_list.png => tileset_menu_list.png} (100%) rename graphics/pokedex/hgss/{HGSS_tileset_menu_list_DECA.png => tileset_menu_list_DECA.png} (100%) rename graphics/pokedex/hgss/{HGSS_tileset_menu_search.png => tileset_menu_search.png} (100%) rename graphics/pokedex/hgss/{HGSS_tileset_menu_search_DECA.png => tileset_menu_search_DECA.png} (100%) diff --git a/graphics/pokedex/hgss/HGSS_SelectBar.bin b/graphics/pokedex/hgss/SelectBar.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_SelectBar.bin rename to graphics/pokedex/hgss/SelectBar.bin diff --git a/graphics/pokedex/hgss/HGSS_SelectBar_clear.bin b/graphics/pokedex/hgss/SelectBar_clear.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_SelectBar_clear.bin rename to graphics/pokedex/hgss/SelectBar_clear.bin diff --git a/graphics/pokedex/hgss/HGSS_palette_default.pal b/graphics/pokedex/hgss/palette_default.pal similarity index 100% rename from graphics/pokedex/hgss/HGSS_palette_default.pal rename to graphics/pokedex/hgss/palette_default.pal diff --git a/graphics/pokedex/hgss/HGSS_palette_default_dark.pal b/graphics/pokedex/hgss/palette_default_dark.pal similarity index 100% rename from graphics/pokedex/hgss/HGSS_palette_default_dark.pal rename to graphics/pokedex/hgss/palette_default_dark.pal diff --git a/graphics/pokedex/hgss/HGSS_palette_national.pal b/graphics/pokedex/hgss/palette_national.pal similarity index 100% rename from graphics/pokedex/hgss/HGSS_palette_national.pal rename to graphics/pokedex/hgss/palette_national.pal diff --git a/graphics/pokedex/hgss/HGSS_palette_national_dark.pal b/graphics/pokedex/hgss/palette_national_dark.pal similarity index 100% rename from graphics/pokedex/hgss/HGSS_palette_national_dark.pal rename to graphics/pokedex/hgss/palette_national_dark.pal diff --git a/graphics/pokedex/hgss/HGSS_palette_search_menu.pal b/graphics/pokedex/hgss/palette_search_menu.pal similarity index 100% rename from graphics/pokedex/hgss/HGSS_palette_search_menu.pal rename to graphics/pokedex/hgss/palette_search_menu.pal diff --git a/graphics/pokedex/hgss/HGSS_palette_search_menu_dark.pal b/graphics/pokedex/hgss/palette_search_menu_dark.pal similarity index 100% rename from graphics/pokedex/hgss/HGSS_palette_search_menu_dark.pal rename to graphics/pokedex/hgss/palette_search_menu_dark.pal diff --git a/graphics/pokedex/hgss/HGSS_palette_search_results.pal b/graphics/pokedex/hgss/palette_search_results.pal similarity index 100% rename from graphics/pokedex/hgss/HGSS_palette_search_results.pal rename to graphics/pokedex/hgss/palette_search_results.pal diff --git a/graphics/pokedex/hgss/HGSS_palette_search_results_dark.pal b/graphics/pokedex/hgss/palette_search_results_dark.pal similarity index 100% rename from graphics/pokedex/hgss/HGSS_palette_search_results_dark.pal rename to graphics/pokedex/hgss/palette_search_results_dark.pal diff --git a/graphics/pokedex/hgss/HGSS_tilemap_cry_screen.bin b/graphics/pokedex/hgss/tilemap_cry_screen.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_cry_screen.bin rename to graphics/pokedex/hgss/tilemap_cry_screen.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_evo_screen.bin b/graphics/pokedex/hgss/tilemap_evo_screen.bin old mode 100755 new mode 100644 similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_evo_screen.bin rename to graphics/pokedex/hgss/tilemap_evo_screen.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_evo_screen_PE.bin b/graphics/pokedex/hgss/tilemap_evo_screen_PE.bin old mode 100755 new mode 100644 similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_evo_screen_PE.bin rename to graphics/pokedex/hgss/tilemap_evo_screen_PE.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_forms_screen.bin b/graphics/pokedex/hgss/tilemap_forms_screen.bin old mode 100755 new mode 100644 similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_forms_screen.bin rename to graphics/pokedex/hgss/tilemap_forms_screen.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_info_screen.bin b/graphics/pokedex/hgss/tilemap_info_screen.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_info_screen.bin rename to graphics/pokedex/hgss/tilemap_info_screen.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_list_screen.bin b/graphics/pokedex/hgss/tilemap_list_screen.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_list_screen.bin rename to graphics/pokedex/hgss/tilemap_list_screen.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_list_screen_underlay.bin b/graphics/pokedex/hgss/tilemap_list_screen_underlay.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_list_screen_underlay.bin rename to graphics/pokedex/hgss/tilemap_list_screen_underlay.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_search_screen_hoenn.bin b/graphics/pokedex/hgss/tilemap_search_screen_hoenn.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_search_screen_hoenn.bin rename to graphics/pokedex/hgss/tilemap_search_screen_hoenn.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_search_screen_national.bin b/graphics/pokedex/hgss/tilemap_search_screen_national.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_search_screen_national.bin rename to graphics/pokedex/hgss/tilemap_search_screen_national.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_size_screen.bin b/graphics/pokedex/hgss/tilemap_size_screen.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_size_screen.bin rename to graphics/pokedex/hgss/tilemap_size_screen.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_start_menu.bin b/graphics/pokedex/hgss/tilemap_start_menu.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_start_menu.bin rename to graphics/pokedex/hgss/tilemap_start_menu.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_start_menu_search_results.bin b/graphics/pokedex/hgss/tilemap_start_menu_search_results.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_start_menu_search_results.bin rename to graphics/pokedex/hgss/tilemap_start_menu_search_results.bin diff --git a/graphics/pokedex/hgss/HGSS_tilemap_stats_screen.bin b/graphics/pokedex/hgss/tilemap_stats_screen.bin similarity index 100% rename from graphics/pokedex/hgss/HGSS_tilemap_stats_screen.bin rename to graphics/pokedex/hgss/tilemap_stats_screen.bin diff --git a/graphics/pokedex/hgss/HGSS_tileset_interface.png b/graphics/pokedex/hgss/tileset_interface.png similarity index 100% rename from graphics/pokedex/hgss/HGSS_tileset_interface.png rename to graphics/pokedex/hgss/tileset_interface.png diff --git a/graphics/pokedex/hgss/HGSS_tileset_interface_DECA.png b/graphics/pokedex/hgss/tileset_interface_DECA.png similarity index 100% rename from graphics/pokedex/hgss/HGSS_tileset_interface_DECA.png rename to graphics/pokedex/hgss/tileset_interface_DECA.png diff --git a/graphics/pokedex/hgss/HGSS_tileset_menu1.png b/graphics/pokedex/hgss/tileset_menu1.png similarity index 100% rename from graphics/pokedex/hgss/HGSS_tileset_menu1.png rename to graphics/pokedex/hgss/tileset_menu1.png diff --git a/graphics/pokedex/hgss/HGSS_tileset_menu2.png b/graphics/pokedex/hgss/tileset_menu2.png similarity index 100% rename from graphics/pokedex/hgss/HGSS_tileset_menu2.png rename to graphics/pokedex/hgss/tileset_menu2.png diff --git a/graphics/pokedex/hgss/HGSS_tileset_menu3.png b/graphics/pokedex/hgss/tileset_menu3.png similarity index 100% rename from graphics/pokedex/hgss/HGSS_tileset_menu3.png rename to graphics/pokedex/hgss/tileset_menu3.png diff --git a/graphics/pokedex/hgss/HGSS_tileset_menu_list.png b/graphics/pokedex/hgss/tileset_menu_list.png similarity index 100% rename from graphics/pokedex/hgss/HGSS_tileset_menu_list.png rename to graphics/pokedex/hgss/tileset_menu_list.png diff --git a/graphics/pokedex/hgss/HGSS_tileset_menu_list_DECA.png b/graphics/pokedex/hgss/tileset_menu_list_DECA.png similarity index 100% rename from graphics/pokedex/hgss/HGSS_tileset_menu_list_DECA.png rename to graphics/pokedex/hgss/tileset_menu_list_DECA.png diff --git a/graphics/pokedex/hgss/HGSS_tileset_menu_search.png b/graphics/pokedex/hgss/tileset_menu_search.png similarity index 100% rename from graphics/pokedex/hgss/HGSS_tileset_menu_search.png rename to graphics/pokedex/hgss/tileset_menu_search.png diff --git a/graphics/pokedex/hgss/HGSS_tileset_menu_search_DECA.png b/graphics/pokedex/hgss/tileset_menu_search_DECA.png similarity index 100% rename from graphics/pokedex/hgss/HGSS_tileset_menu_search_DECA.png rename to graphics/pokedex/hgss/tileset_menu_search_DECA.png diff --git a/src/graphics.c b/src/graphics.c index c4c41b2b3f3d..b2065356bf96 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1741,38 +1741,38 @@ const u32 gPokedexSearchMenuNational_Tilemap[] = INCBIN_U32("graphics/pokedex/se const u32 gPokedexSearchMenuHoenn_Tilemap[] = INCBIN_U32("graphics/pokedex/search_menu_hoenn.bin.lz"); // Pokedex HGSS #if POKEDEX_PLUS_HGSS == TRUE -const u16 gPokedexPlusHGSS_Default_Pal[] = INCBIN_U16("graphics/pokedex/hgss/HGSS_palette_default.gbapal"); -const u16 gPokedexPlusHGSS_National_Pal[] = INCBIN_U16("graphics/pokedex/hgss/HGSS_palette_national.gbapal"); -const u16 gPokedexPlusHGSS_MenuSearch_Pal[] = INCBIN_U16("graphics/pokedex/hgss/HGSS_palette_search_menu.gbapal"); -const u16 gPokedexPlusHGSS_SearchResults_Pal[] = INCBIN_U16("graphics/pokedex/hgss/HGSS_palette_search_results.gbapal"); -const u16 gPokedexPlusHGSS_Default_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/HGSS_palette_default_dark.gbapal"); -const u16 gPokedexPlusHGSS_National_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/HGSS_palette_national_dark.gbapal"); -const u16 gPokedexPlusHGSS_MenuSearch_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/HGSS_palette_search_menu_dark.gbapal"); -const u16 gPokedexPlusHGSS_SearchResults_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/HGSS_palette_search_results_dark.gbapal"); -const u32 gPokedexPlusHGSS_MenuList_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tileset_menu_list.4bpp.lz"); -const u32 gPokedexPlusHGSS_MenuList_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tileset_menu_list_DECA.4bpp.lz"); -const u32 gPokedexPlusHGSS_Interface_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tileset_interface.4bpp.lz"); -const u32 gPokedexPlusHGSS_Interface_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tileset_interface_DECA.4bpp.lz"); -const u32 gPokedexPlusHGSS_Menu_1_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tileset_menu1.4bpp.lz"); -const u32 gPokedexPlusHGSS_Menu_2_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tileset_menu2.4bpp.lz"); -const u32 gPokedexPlusHGSS_Menu_3_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tileset_menu3.4bpp.lz"); -const u32 gPokedexPlusHGSS_MenuSearch_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tileset_menu_search.4bpp.lz"); -const u32 gPokedexPlusHGSS_MenuSearch_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tileset_menu_search_DECA.4bpp.lz"); -const u32 gPokedexPlusHGSS_StartMenuMain_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_start_menu.bin.lz"); -const u32 gPokedexPlusHGSS_StartMenuSearchResults_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_start_menu_search_results.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenSelectBarSubmenu_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_SelectBar.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenSelectBarSubmenu_Tilemap_Clear[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_SelectBar_clear.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenList_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_list_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenListUnderlay_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_list_screen_underlay.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenInfo_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_info_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenStats_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_stats_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenEvolution_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_evo_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenEvolution_Tilemap_PE[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_evo_screen_PE.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenForms_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_forms_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenCry_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_cry_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenSize_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_size_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenSearchHoenn_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_search_screen_hoenn.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenSearchNational_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/HGSS_tilemap_search_screen_national.bin.lz"); +const u16 gPokedexPlusHGSS_Default_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_default.gbapal"); +const u16 gPokedexPlusHGSS_National_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_national.gbapal"); +const u16 gPokedexPlusHGSS_MenuSearch_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_menu.gbapal"); +const u16 gPokedexPlusHGSS_SearchResults_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_results.gbapal"); +const u16 gPokedexPlusHGSS_Default_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_default_dark.gbapal"); +const u16 gPokedexPlusHGSS_National_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_national_dark.gbapal"); +const u16 gPokedexPlusHGSS_MenuSearch_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_menu_dark.gbapal"); +const u16 gPokedexPlusHGSS_SearchResults_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_results_dark.gbapal"); +const u32 gPokedexPlusHGSS_MenuList_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_list.4bpp.lz"); +const u32 gPokedexPlusHGSS_MenuList_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_list_DECA.4bpp.lz"); +const u32 gPokedexPlusHGSS_Interface_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_interface.4bpp.lz"); +const u32 gPokedexPlusHGSS_Interface_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_interface_DECA.4bpp.lz"); +const u32 gPokedexPlusHGSS_Menu_1_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu1.4bpp.lz"); +const u32 gPokedexPlusHGSS_Menu_2_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu2.4bpp.lz"); +const u32 gPokedexPlusHGSS_Menu_3_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu3.4bpp.lz"); +const u32 gPokedexPlusHGSS_MenuSearch_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_search.4bpp.lz"); +const u32 gPokedexPlusHGSS_MenuSearch_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_search_DECA.4bpp.lz"); +const u32 gPokedexPlusHGSS_StartMenuMain_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_start_menu.bin.lz"); +const u32 gPokedexPlusHGSS_StartMenuSearchResults_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_start_menu_search_results.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenSelectBarSubmenu_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/SelectBar.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenSelectBarSubmenu_Tilemap_Clear[] = INCBIN_U32("graphics/pokedex/hgss/SelectBar_clear.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenList_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_list_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenListUnderlay_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_list_screen_underlay.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenInfo_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_info_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenStats_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_stats_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenEvolution_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_evo_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenEvolution_Tilemap_PE[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_evo_screen_PE.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenForms_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_forms_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenCry_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_cry_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenSize_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_size_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenSearchHoenn_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_search_screen_hoenn.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenSearchNational_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_search_screen_national.bin.lz"); #endif const u16 gSummaryScreen_MoveEffect_Battle_Tilemap[] = INCBIN_U16("graphics/summary_screen/effect_battle.bin"); From daeb2efd4648cee0c55f97a78bf9203b7fd224a0 Mon Sep 17 00:00:00 2001 From: Aaghat Date: Mon, 11 Sep 2023 17:55:17 +0530 Subject: [PATCH 86/88] some minor clean up --- include/daycare.h | 2 - src/daycare.c | 2 - src/fonts.c | 37 ------ src/graphics.c | 62 +++++----- src/pokedex.c | 4 +- src/pokedex_area_screen.c | 26 ---- src/pokedex_plus_hgss.c | 140 +++++++++++----------- src/strings.c | 242 +++++++++++++++++++------------------- 8 files changed, 223 insertions(+), 292 deletions(-) diff --git a/include/daycare.h b/include/daycare.h index ac6e4281c515..c9a8c614cbe8 100644 --- a/include/daycare.h +++ b/include/daycare.h @@ -30,9 +30,7 @@ void SetDaycareCompatibilityString(void); bool8 NameHasGenderSymbol(const u8 *name, u8 genderRatio); void ShowDaycareLevelMenu(void); void ChooseSendDaycareMon(void); -#if POKEDEX_PLUS_HGSS == TRUE u8 GetEggMovesSpecies(u16 species, u16 *eggMoves); bool8 SpeciesCanLearnEggMove(u16 species, u16 move); -#endif #endif // GUARD_DAYCARE_H diff --git a/src/daycare.c b/src/daycare.c index 42493bb92b67..380a390b0b51 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -774,7 +774,6 @@ static u8 GetEggMoves(struct Pokemon *pokemon, u16 *eggMoves) return numEggMoves; } -#if POKEDEX_PLUS_HGSS == TRUE u8 GetEggMovesSpecies(u16 species, u16 *eggMoves) { u16 eggMoveIdx; @@ -831,7 +830,6 @@ bool8 SpeciesCanLearnEggMove(u16 species, u16 move) //Move search PokedexPlus HG } return FALSE; } -#endif static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, struct BoxPokemon *mother) { diff --git a/src/fonts.c b/src/fonts.c index 8ae3b6390411..381fd795e962 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -37,7 +37,6 @@ ALIGNED(4) const u8 gFontSmallNarrowLatinGlyphWidths[] = { }; ALIGNED(4) const u16 gFontSmallLatinGlyphs[] = INCBIN_U16("graphics/fonts/small.latfont"); -#if POKEDEX_PLUS_HGSS == TRUE ALIGNED(4) const u8 gFontSmallLatinGlyphWidths[] = { 3, 5, 5, 5, 5, 5, 5, 5, 5, 4, 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 5, 5, 5, 5, 5, 4, 3, @@ -72,42 +71,6 @@ ALIGNED(4) const u8 gFontSmallLatinGlyphWidths[] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, }; -#else -ALIGNED(4) const u8 gFontSmallLatinGlyphWidths[] = { - 3, 5, 5, 5, 5, 5, 5, 5, 5, 4, 3, 4, 4, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 3, 5, 5, 5, 5, 5, 4, 3, - 4, 4, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 8, 7, 8, 3, - 3, 3, 3, 3, 8, 8, 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 5, 5, 5, 8, 8, 8, 8, 8, 8, 8, 4, 7, 5, 5, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 3, 3, 3, 3, 4, - 3, 3, 3, 3, 3, 3, 3, 5, 3, 8, 8, 8, 8, 1, 2, 3, - 4, 5, 6, 7, 5, 7, 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 8, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 8, 5, 8, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, - 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, - 7, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, -}; -#endif ALIGNED(4) const u16 gFontNarrowLatinGlyphs[] = INCBIN_U16("graphics/fonts/narrow.latfont"); ALIGNED(4) const u8 gFontNarrowLatinGlyphWidths[] = { diff --git a/src/graphics.c b/src/graphics.c index b2065356bf96..5601ad2303ac 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1741,37 +1741,37 @@ const u32 gPokedexSearchMenuNational_Tilemap[] = INCBIN_U32("graphics/pokedex/se const u32 gPokedexSearchMenuHoenn_Tilemap[] = INCBIN_U32("graphics/pokedex/search_menu_hoenn.bin.lz"); // Pokedex HGSS #if POKEDEX_PLUS_HGSS == TRUE -const u16 gPokedexPlusHGSS_Default_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_default.gbapal"); -const u16 gPokedexPlusHGSS_National_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_national.gbapal"); -const u16 gPokedexPlusHGSS_MenuSearch_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_menu.gbapal"); -const u16 gPokedexPlusHGSS_SearchResults_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_results.gbapal"); -const u16 gPokedexPlusHGSS_Default_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_default_dark.gbapal"); -const u16 gPokedexPlusHGSS_National_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_national_dark.gbapal"); -const u16 gPokedexPlusHGSS_MenuSearch_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_menu_dark.gbapal"); -const u16 gPokedexPlusHGSS_SearchResults_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_results_dark.gbapal"); -const u32 gPokedexPlusHGSS_MenuList_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_list.4bpp.lz"); -const u32 gPokedexPlusHGSS_MenuList_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_list_DECA.4bpp.lz"); -const u32 gPokedexPlusHGSS_Interface_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_interface.4bpp.lz"); -const u32 gPokedexPlusHGSS_Interface_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_interface_DECA.4bpp.lz"); -const u32 gPokedexPlusHGSS_Menu_1_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu1.4bpp.lz"); -const u32 gPokedexPlusHGSS_Menu_2_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu2.4bpp.lz"); -const u32 gPokedexPlusHGSS_Menu_3_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu3.4bpp.lz"); -const u32 gPokedexPlusHGSS_MenuSearch_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_search.4bpp.lz"); -const u32 gPokedexPlusHGSS_MenuSearch_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_search_DECA.4bpp.lz"); -const u32 gPokedexPlusHGSS_StartMenuMain_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_start_menu.bin.lz"); -const u32 gPokedexPlusHGSS_StartMenuSearchResults_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_start_menu_search_results.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenSelectBarSubmenu_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/SelectBar.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenSelectBarSubmenu_Tilemap_Clear[] = INCBIN_U32("graphics/pokedex/hgss/SelectBar_clear.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenList_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_list_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenListUnderlay_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_list_screen_underlay.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenInfo_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_info_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenStats_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_stats_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenEvolution_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_evo_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenEvolution_Tilemap_PE[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_evo_screen_PE.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenForms_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_forms_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenCry_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_cry_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenSize_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_size_screen.bin.lz"); -const u32 gPokedexPlusHGSS_ScreenSearchHoenn_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_search_screen_hoenn.bin.lz"); +const u16 gPokedexPlusHGSS_Default_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_default.gbapal"); +const u16 gPokedexPlusHGSS_National_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_national.gbapal"); +const u16 gPokedexPlusHGSS_MenuSearch_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_menu.gbapal"); +const u16 gPokedexPlusHGSS_SearchResults_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_results.gbapal"); +const u16 gPokedexPlusHGSS_Default_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_default_dark.gbapal"); +const u16 gPokedexPlusHGSS_National_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_national_dark.gbapal"); +const u16 gPokedexPlusHGSS_MenuSearch_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_menu_dark.gbapal"); +const u16 gPokedexPlusHGSS_SearchResults_dark_Pal[] = INCBIN_U16("graphics/pokedex/hgss/palette_search_results_dark.gbapal"); +const u32 gPokedexPlusHGSS_MenuList_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_list.4bpp.lz"); +const u32 gPokedexPlusHGSS_MenuList_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_list_DECA.4bpp.lz"); +const u32 gPokedexPlusHGSS_Interface_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_interface.4bpp.lz"); +const u32 gPokedexPlusHGSS_Interface_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_interface_DECA.4bpp.lz"); +const u32 gPokedexPlusHGSS_Menu_1_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu1.4bpp.lz"); +const u32 gPokedexPlusHGSS_Menu_2_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu2.4bpp.lz"); +const u32 gPokedexPlusHGSS_Menu_3_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu3.4bpp.lz"); +const u32 gPokedexPlusHGSS_MenuSearch_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_search.4bpp.lz"); +const u32 gPokedexPlusHGSS_MenuSearch_DECA_Gfx[] = INCBIN_U32("graphics/pokedex/hgss/tileset_menu_search_DECA.4bpp.lz"); +const u32 gPokedexPlusHGSS_StartMenuMain_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_start_menu.bin.lz"); +const u32 gPokedexPlusHGSS_StartMenuSearchResults_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_start_menu_search_results.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenSelectBarSubmenu_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/SelectBar.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenSelectBarSubmenu_Tilemap_Clear[] = INCBIN_U32("graphics/pokedex/hgss/SelectBar_clear.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenList_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_list_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenListUnderlay_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_list_screen_underlay.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenInfo_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_info_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenStats_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_stats_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenEvolution_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_evo_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenEvolution_Tilemap_PE[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_evo_screen_PE.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenForms_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_forms_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenCry_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_cry_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenSize_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_size_screen.bin.lz"); +const u32 gPokedexPlusHGSS_ScreenSearchHoenn_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_search_screen_hoenn.bin.lz"); const u32 gPokedexPlusHGSS_ScreenSearchNational_Tilemap[] = INCBIN_U32("graphics/pokedex/hgss/tilemap_search_screen_national.bin.lz"); #endif diff --git a/src/pokedex.c b/src/pokedex.c index cf30ba549abe..42bb44798e01 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -14,11 +14,9 @@ #include "overworld.h" #include "palette.h" #include "pokedex.h" -#if POKEDEX_PLUS_HGSS == TRUE -#include "pokedex_plus_hgss.h" -#endif #include "pokedex_area_screen.h" #include "pokedex_cry_screen.h" +#include "pokedex_plus_hgss.h" #include "scanline_effect.h" #include "sound.h" #include "sprite.h" diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index 2bef72589fe1..d5aa3f96c905 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -667,7 +667,6 @@ static void Task_HandlePokedexAreaScreenInput(u8 taskId) return; break; case 1: -#if POKEDEX_PLUS_HGSS == TRUE if (JOY_NEW(B_BUTTON)) { gTasks[taskId].data[1] = 1; @@ -691,31 +690,6 @@ static void Task_HandlePokedexAreaScreenInput(u8 taskId) else return; break; -#else - if (JOY_NEW(B_BUTTON)) - { - gTasks[taskId].data[1] = 1; - PlaySE(SE_DEX_PAGE); - } - else if (JOY_NEW(DPAD_LEFT) || (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) - { - gTasks[taskId].data[1] = 1; - PlaySE(SE_DEX_PAGE); - } - else if (JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) - { - if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(sPokedexAreaScreen->species), FLAG_GET_CAUGHT)) - { - PlaySE(SE_FAILURE); - return; - } - gTasks[taskId].data[1] = 2; - PlaySE(SE_DEX_PAGE); - } - else - return; - break; -#endif case 2: BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 16, RGB_BLACK); break; diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index 4ca784e3a9a7..da9a32093594 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -204,7 +204,7 @@ struct PokedexListItem u16 owned:1; }; -//HGSS_Ui + struct PokemonStats { u16 species; @@ -268,21 +268,21 @@ struct PokedexView u16 seenCount; u16 ownCount; u16 monSpriteIds[MAX_MONS_ON_SCREEN]; - u8 typeIconSpriteIds[2]; //HGSS_Ui - u16 moveSelected; //HGSS_Ui - u8 movesTotal; //HGSS_Ui - u8 statBarsSpriteId; //HGSS_Ui - u8 statBarsBgSpriteId; //HGSS_Ui - bool8 justScrolled; //HGSS_Ui - u8 splitIconSpriteId; //HGSS_Ui Physical/Special Split - u8 numEggMoves; //HGSS_Ui - u8 numLevelUpMoves; //HGSS_Ui - u8 numTMHMMoves; //HGSS_Ui - u8 numTutorMoves; //HGSS_Ui - u8 numPreEvolutions; //HGSS_Ui - struct PokemonStats sPokemonStats; //HGSS_Ui - struct EvoScreenData sEvoScreenData; //HGSS_Ui - struct FromScreenData sFormScreenData; //HGSS_Ui + u8 typeIconSpriteIds[2]; + u16 moveSelected; + u8 movesTotal; + u8 statBarsSpriteId; + u8 statBarsBgSpriteId; + bool8 justScrolled; + u8 splitIconSpriteId; //Physical/Special Split + u8 numEggMoves; + u8 numLevelUpMoves; + u8 numTMHMMoves; + u8 numTutorMoves; + u8 numPreEvolutions; + struct PokemonStats sPokemonStats; + struct EvoScreenData sEvoScreenData; + struct FromScreenData sFormScreenData; u16 formSpecies; u16 selectedMonSpriteId; u16 pokeBallRotationStep; @@ -452,14 +452,14 @@ static void CreateStatBarsBg(void); static void SpriteCB_StatBars(struct Sprite *sprite); static void SpriteCB_StatBarsBg(struct Sprite *sprite); -//HGSS_UI Forms screen +//Forms screen static void Task_LoadFormsScreen(u8 taskId); static void Task_HandleFormsScreenInput(u8 taskId); static void PrintForms(u8 taskId, u16 species); static void Task_SwitchScreensFromFormsScreen(u8 taskId); static void Task_ExitFormsScreen(u8 taskId); -//HGSS_UI Physical Special Split icon +//Physical Special Split icon static u8 ShowSplitIcon(u32 split); //Physical/Special Split from BE static void DestroySplitIcon(void); //Physical/Special Split from BE @@ -518,7 +518,7 @@ static const struct SpriteTemplate sSpriteTemplate_SplitIcons = .callback = SpriteCallbackDummy }; -//HGSS_Ui Stat bars by DizzyEgg +//Stat bars by DizzyEgg #define TAG_STAT_BAR 4097 #define TAG_STAT_BAR_BG 4098 static const struct OamData sOamData_StatBar = @@ -2066,7 +2066,7 @@ static void Task_HandlePokedexInput(u8 taskId) if (sPokedexView->menuY) { sPokedexView->menuY -= 8; - if (sPokedexView->menuIsOpen == FALSE && sPokedexView->menuY == 8) //HGSS_Ui + if (sPokedexView->menuIsOpen == FALSE && sPokedexView->menuY == 8) { CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); CreateStatBarsBg(); @@ -2076,7 +2076,7 @@ static void Task_HandlePokedexInput(u8 taskId) { if (JOY_NEW(A_BUTTON) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen) { - TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBars(); UpdateSelectedMonSpriteId(); BeginNormalPaletteFade(~(1 << (gSprites[sPokedexView->selectedMonSpriteId].oam.paletteNum + 16)), 0, 0, 0x10, RGB_BLACK); gSprites[sPokedexView->selectedMonSpriteId].callback = SpriteCB_MoveMonForInfoScreen; @@ -2086,8 +2086,8 @@ static void Task_HandlePokedexInput(u8 taskId) } else if (JOY_NEW(START_BUTTON)) { - TryDestroyStatBars(); //HGSS_Ui - TryDestroyStatBarsBg(); //HGSS_Ui + TryDestroyStatBars(); + TryDestroyStatBarsBg(); sPokedexView->menuY = 0; sPokedexView->menuIsOpen = TRUE; sPokedexView->menuCursorPos = 0; @@ -2110,7 +2110,7 @@ static void Task_HandlePokedexInput(u8 taskId) } else if (JOY_NEW(B_BUTTON)) { - TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBars(); BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ClosePokedex; PlaySE(SE_PC_OFF); @@ -2121,15 +2121,15 @@ static void Task_HandlePokedexInput(u8 taskId) sPokedexView->selectedPokemon = TryDoPokedexScroll(sPokedexView->selectedPokemon, 0xE); if (sPokedexView->scrollTimer) gTasks[taskId].func = Task_WaitForScroll; - else if (!sPokedexView->scrollTimer && !sPokedexView->scrollSpeed &&sPokedexView->justScrolled) //HGSS_Ui - CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui + else if (!sPokedexView->scrollTimer && !sPokedexView->scrollSpeed &&sPokedexView->justScrolled) + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); } } } static void Task_WaitForScroll(u8 taskId) { - TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBars(); if (UpdateDexListScroll(sPokedexView->scrollDirection, sPokedexView->scrollMonIncrement, sPokedexView->maxScrollTimer)) gTasks[taskId].func = Task_HandlePokedexInput; } @@ -2320,7 +2320,7 @@ static bool8 LoadPokedexListPage(u8 page) gReservedSpritePaletteCount = 8; LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[HGSS_DECAPPED]); LoadSpritePalettes(sInterfaceSpritePalette); - LoadSpritePalettes(sStatBarSpritePal); //HGSS_Ui + LoadSpritePalettes(sStatBarSpritePal); CreateInterfaceSprites(page); gMain.state++; break; @@ -2331,10 +2331,10 @@ static bool8 LoadPokedexListPage(u8 page) if (page == PAGE_MAIN) CreatePokedexList(sPokedexView->dexMode, sPokedexView->dexOrder); CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); - sPokedexView->statBarsSpriteId = 0xFF; //HGSS_Ui stat bars - CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui stat bars - sPokedexView->statBarsBgSpriteId = 0xFF; //HGSS_Ui stat bars background - CreateStatBarsBg(); //HGSS_Ui stat bars background + sPokedexView->statBarsSpriteId = 0xFF; //stat bars + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //stat bars + sPokedexView->statBarsBgSpriteId = 0xFF; //stat bars background + CreateStatBarsBg(); //stat bars background sPokedexView->menuIsOpen = FALSE; sPokedexView->menuY = 0; CopyBgTilemapBufferToVram(0); @@ -2532,7 +2532,7 @@ static void PrintMonDexNumAndName(u8 windowId, u8 fontId, const u8 *str, u8 left AddTextPrinterParameterized4(windowId, fontId, left * 8, (top * 8) + 1, 0, 0, color, TEXT_SKIP_DRAW, str); } -static void PrintMonDexNumAndName_2(u8 windowId, u8 fontId, const u8* str, u8 left, u8 top) //HGSS_Ui offset for closer numer + text +static void PrintMonDexNumAndName_2(u8 windowId, u8 fontId, const u8* str, u8 left, u8 top) //offset for closer numer + text { u8 color[3]; @@ -2813,7 +2813,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) selectedMon = GetNextPosition(1, selectedMon, 0, sPokedexView->pokemonListCount - 1); CreateScrollingPokemonSprite(1, selectedMon); CreateMonListEntry(1, selectedMon, ignored); - sPokedexView->justScrolled = TRUE; //HGSS_Ui + sPokedexView->justScrolled = TRUE; PlaySE(SE_DEX_SCROLL); } else if (JOY_HELD(DPAD_DOWN) && (selectedMon < sPokedexView->pokemonListCount - 1)) @@ -2822,7 +2822,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) selectedMon = GetNextPosition(0, selectedMon, 0, sPokedexView->pokemonListCount - 1); CreateScrollingPokemonSprite(2, selectedMon); CreateMonListEntry(2, selectedMon, ignored); - sPokedexView->justScrolled = TRUE; //HGSS_Ui + sPokedexView->justScrolled = TRUE; PlaySE(SE_DEX_SCROLL); } else if (JOY_NEW(DPAD_LEFT) && (selectedMon > 0)) @@ -2834,7 +2834,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) sPokedexView->pokeBallRotation += 16 * (selectedMon - startingPos); ClearMonSprites(); CreateMonSpritesAtPos(selectedMon, 0xE); - sPokedexView->justScrolled = TRUE; //HGSS_Ui + sPokedexView->justScrolled = TRUE; PlaySE(SE_DEX_PAGE); } else if (JOY_NEW(DPAD_RIGHT) && (selectedMon < sPokedexView->pokemonListCount - 1)) @@ -2845,7 +2845,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) sPokedexView->pokeBallRotation += 16 * (selectedMon - startingPos); ClearMonSprites(); CreateMonSpritesAtPos(selectedMon, 0xE); - sPokedexView->justScrolled = TRUE; //HGSS_Ui + sPokedexView->justScrolled = TRUE; PlaySE(SE_DEX_PAGE); } @@ -3528,7 +3528,7 @@ static void CreateStatBars(struct PokedexListItem *dexMon) } sPokedexView->statBarsSpriteId = CreateSprite(&sStatBarSpriteTemplate, 36+offset_x, 107+offset_y, 10); } -static void CreateStatBarsBg(void) //HGSS_Ui stat bars background text +static void CreateStatBarsBg(void) //stat bars background text { static const struct SpriteSheet sheetStatBarsBg = {sStatBarsGfx, 64 * 64, TAG_STAT_BAR_BG}; u8 offset_x = 184; //Moves the complete stat box left/right @@ -3845,7 +3845,7 @@ static void Task_LoadAreaScreen(u8 taskId) } break; case 1: - LoadScreenSelectBarSubmenu(0xD); //HGSS_Ui + LoadScreenSelectBarSubmenu(0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(13) | BGCNT_16COLOR | BGCNT_TXT256x256); gMain.state++; @@ -3906,7 +3906,7 @@ static void LoadScreenSelectBarSubmenu(u16 unused) CopyBgTilemapBufferToVram(1); } -static void HighlightScreenSelectBarItem(u8 selectedScreen, u16 unused) //HGSS_Ui +static void HighlightScreenSelectBarItem(u8 selectedScreen, u16 unused) { u8 i; u8 j; @@ -4160,7 +4160,7 @@ static void PrintInfoScreenText(const u8 *str, u8 left, u8 top) AddTextPrinterParameterized4(0, 1, left, top, 0, 0, color, -1, str); } -static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top) //HGSS_Ui +static void PrintInfoScreenTextWhite(const u8* str, u8 left, u8 top) { u8 color[3]; color[0] = TEXT_COLOR_TRANSPARENT; @@ -4320,13 +4320,13 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) else value = num; ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); - PrintInfoScreenTextWhite(str, 123, 17); //HGSS_Ui + PrintInfoScreenTextWhite(str, 123, 17); species = NationalPokedexNumToSpeciesHGSS(num); if (species) name = gSpeciesNames[species]; else name = sText_TenDashes2; - PrintInfoScreenTextWhite(name, 157, 17); //HGSS_Ui + PrintInfoScreenTextWhite(name, 157, 17); if (owned) { CopyMonCategoryText(num, str2); @@ -4336,18 +4336,18 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) { category = gText_5MarksPokemon; } - PrintInfoScreenText(category, 123, 31); //HGSS_Ui - PrintInfoScreenText(gText_HTHeight, 155, 64); //HGSS_Ui - PrintInfoScreenText(gText_WTWeight, 155, 77); //HGSS_Ui + PrintInfoScreenText(category, 123, 31); + PrintInfoScreenText(gText_HTHeight, 155, 64); + PrintInfoScreenText(gText_WTWeight, 155, 77); if (owned) { - PrintMonHeight(gPokedexEntries[num].height, 180, 64); //HGSS_Ui - PrintMonWeight(gPokedexEntries[num].weight, 180, 77); //HGSS_Ui + PrintMonHeight(gPokedexEntries[num].height, 180, 64); + PrintMonWeight(gPokedexEntries[num].weight, 180, 77); } else { - PrintInfoScreenText(gText_UnkHeight, 180, 64); //HGSS_Ui - PrintInfoScreenText(gText_UnkWeight, 180, 77); //HGSS_Ui + PrintInfoScreenText(gText_UnkHeight, 180, 64); + PrintInfoScreenText(gText_UnkWeight, 180, 77); } if (owned) { @@ -4355,11 +4355,11 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) } else description = sExpandedPlaceholder_PokedexDescription; - PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, 0xF0), 93); //HGSS_Ui + PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, 0xF0), 93); - //Type Icon(s) //HGSS_Ui + //Type Icon(s) if (owned) - PrintCurrentSpeciesTypeInfo(newEntry, species); //HGSS_Ui + PrintCurrentSpeciesTypeInfo(newEntry, species); } static void PrintMonHeight(u16 height, u8 left, u8 top) @@ -6022,7 +6022,7 @@ static void Task_LoadEvolutionScreen(u8 taskId) LoadMonIconPalette(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); //Loads pallete for current mon PrintPreEvolutions(taskId, NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum)); gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18 + 32*sPokedexView->numPreEvolutions, 31, 4, 0); //Create pokemon sprite - EvoFormsPage_PrintNavigationButtons(); //HGSS_Ui Navigation buttons + EvoFormsPage_PrintNavigationButtons(); // Navigation buttons gSprites[gTasks[taskId].data[4]].oam.priority = 0; } gMain.state++; @@ -6699,7 +6699,7 @@ static void Task_LoadFormsScreen(u8 taskId) gTasks[taskId].data[4] = CreateMonIcon(NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum), SpriteCB_MonIcon, 18, 31, 4, 0); //Create pokemon sprite gSprites[gTasks[taskId].data[4]].oam.priority = 0; } - EvoFormsPage_PrintNavigationButtons(); //HGSS_Ui Navigation buttons + EvoFormsPage_PrintNavigationButtons(); // Navigation buttons sPokedexView->sFormScreenData.menuPos = 1; gMain.state++; break; @@ -6988,7 +6988,7 @@ static void Task_LoadCryScreen(u8 taskId) gMain.state++; break; case 2: - LoadScreenSelectBarMain(0xD); //HGSS_Ui + LoadScreenSelectBarMain(0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); gMain.state++; break; @@ -7173,7 +7173,7 @@ static void Task_LoadSizeScreen(u8 taskId) gMain.state++; break; case 2: - LoadScreenSelectBarMain(0xD); //HGSS_Ui + LoadScreenSelectBarMain(0xD); LoadPokedexBgPalette(sPokedexView->isSearchResults); gMain.state++; break; @@ -7312,8 +7312,8 @@ static void Task_WaitForExitSearch(u8 taskId) if (!gTasks[gTasks[taskId].tLoadScreenTaskId].isActive) { ClearMonSprites(); - TryDestroyStatBars(); //HGSS_Ui - TryDestroyStatBarsBg(); //HGSS_Ui + TryDestroyStatBars(); + TryDestroyStatBarsBg(); // Search produced results if (sPokedexView->screenSwitchState != 0) @@ -7352,7 +7352,7 @@ static void Task_HandleSearchResultsInput(u8 taskId) if (sPokedexView->menuY) { sPokedexView->menuY -= 8; - if (sPokedexView->menuIsOpen == FALSE && sPokedexView->menuY == 8) //HGSS_Ui + if (sPokedexView->menuIsOpen == FALSE && sPokedexView->menuY == 8) { CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); CreateStatBarsBg(); @@ -7364,7 +7364,7 @@ static void Task_HandleSearchResultsInput(u8 taskId) { u32 a; - TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBars(); UpdateSelectedMonSpriteId(); a = (1 << (gSprites[sPokedexView->selectedMonSpriteId].oam.paletteNum + 16)); gSprites[sPokedexView->selectedMonSpriteId].callback = SpriteCB_MoveMonForInfoScreen; @@ -7375,8 +7375,8 @@ static void Task_HandleSearchResultsInput(u8 taskId) } else if (JOY_NEW(START_BUTTON)) { - TryDestroyStatBars(); //HGSS_Ui - TryDestroyStatBarsBg(); //HGSS_Ui + TryDestroyStatBars(); + TryDestroyStatBarsBg(); sPokedexView->menuY = 0; sPokedexView->menuIsOpen = TRUE; sPokedexView->menuCursorPos = 0; @@ -7394,7 +7394,7 @@ static void Task_HandleSearchResultsInput(u8 taskId) } else if (JOY_NEW(B_BUTTON)) { - TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBars(); BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ReturnToPokedexFromSearchResults; PlaySE(SE_PC_OFF); @@ -7405,15 +7405,15 @@ static void Task_HandleSearchResultsInput(u8 taskId) sPokedexView->selectedPokemon = TryDoPokedexScroll(sPokedexView->selectedPokemon, 0xE); if (sPokedexView->scrollTimer) gTasks[taskId].func = Task_WaitForSearchResultsScroll; - else if (!sPokedexView->scrollTimer && !sPokedexView->scrollSpeed && sPokedexView->justScrolled) //HGSS_Ui - CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui + else if (!sPokedexView->scrollTimer && !sPokedexView->scrollSpeed && sPokedexView->justScrolled) + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); } } } static void Task_WaitForSearchResultsScroll(u8 taskId) { - TryDestroyStatBars(); //HGSS_Ui + TryDestroyStatBars(); if (UpdateDexListScroll(sPokedexView->scrollDirection, sPokedexView->scrollMonIncrement, sPokedexView->maxScrollTimer)) gTasks[taskId].func = Task_HandleSearchResultsInput; } @@ -7738,7 +7738,7 @@ static void Task_LoadSearchMenu(u8 taskId) case 1: LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[HGSS_DECAPPED]); LoadSpritePalettes(sInterfaceSpritePalette); - LoadSpritePalettes(sStatBarSpritePal); //HGSS_Ui + LoadSpritePalettes(sStatBarSpritePal); CreateSearchParameterScrollArrows(taskId); for (i = 0; i < NUM_TASK_DATA; i++) gTasks[taskId].data[i] = 0; @@ -7753,8 +7753,8 @@ static void Task_LoadSearchMenu(u8 taskId) break; case 2: BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); - sPokedexView->statBarsSpriteId = 0xFF; //HGSS_Ui - CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //HGSS_Ui + sPokedexView->statBarsSpriteId = 0xFF; + CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); gMain.state++; break; case 3: diff --git a/src/strings.c b/src/strings.c index 5c96c9a4c842..292a5e4ee14e 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1836,128 +1836,128 @@ const u8 gText_ExpShareOff[] = _("The Exp. Share has been turned off.{PAUSE_UNTI //HGSS_Ui PokedexPlus #if POKEDEX_PLUS_HGSS == TRUE -const u8 gText_Stats_Buttons[] = _("{A_BUTTON}TOGGLE {DPAD_UPDOWN}MOVES"); -const u8 gText_Stats_Buttons_Decapped[] = _("{A_BUTTON}Toggle {DPAD_UPDOWN}Moves"); -const u8 gText_Stats_HP[] = _("HP"); -const u8 gText_Stats_Attack[] = _("ATK"); -const u8 gText_Stats_Defense[] = _("DEF"); -const u8 gText_Stats_Speed[] = _("SPE"); -const u8 gText_Stats_SpAttack[] = _("SP.A"); -const u8 gText_Stats_SpDefense[] = _("SP.D"); -const u8 gText_Stats_EV_Plus1[] = _("{UP_ARROW_2}"); -const u8 gText_Stats_EV_Plus2[] = _("{UP_ARROW_2}{UP_ARROW_2}"); -const u8 gText_Stats_EV_Plus3[] = _("{UP_ARROW_2}{UP_ARROW_2}{UP_ARROW_2}"); -const u8 gText_Stats_EvStr1Str2[] = _("{STR_VAR_1}{STR_VAR_2}"); -const u8 gText_Stats_MoveSelectedMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); -const u8 gText_Stats_MoveLevel[] = _("LVL"); -const u8 gText_Stats_Gender_0[] = _("♂"); -const u8 gText_Stats_Gender_12_5[] = _("♀ 1/7 ♂"); //_("♀ 12.5 / 87.5 ♂"); -const u8 gText_Stats_Gender_25[] = _("♀ 1/3 ♂"); //_("♀ 25 / 75 ♂"); -const u8 gText_Stats_Gender_50[] = _("♀ 1/1 ♂"); //_("♀ 50 / 50 ♂"); -const u8 gText_Stats_Gender_75[] = _("♀ 3/1 ♂"); //_("♀ 75 / 25 ♂"); -const u8 gText_Stats_Gender_87_5[] = _("♀ 7/1 ♂"); -const u8 gText_Stats_Gender_100[] = _("♀"); -const u8 gText_Stats_CatchRate[] = _("CATCH{0x5B}: "); -const u8 gText_Stats_CatchRate_Legend[] = _("LEGENDARY"); -const u8 gText_Stats_CatchRate_VeryHard[] = _("VERY HARD"); -const u8 gText_Stats_CatchRate_Difficult[] = _("DIFFICULT"); -const u8 gText_Stats_CatchRate_Medium[] = _("MEDIUM"); -const u8 gText_Stats_CatchRate_Relaxed[] = _("RELAXED"); -const u8 gText_Stats_CatchRate_Easy[] = _("EASY"); -const u8 gText_Stats_ExpYield[] = _("EXP YIELD: "); -const u8 gText_Stats_EggCycles[] = _("HATCH STEPS:"); -const u8 gText_Stats_EggCycles_VeryFast[] = _("{EMOJI_BOLT}{EMOJI_DIZZYEGG}"); -const u8 gText_Stats_EggCycles_Fast[] = _("{EMOJI_DIZZYEGG}"); -const u8 gText_Stats_EggCycles_Normal[] = _("{EMOJI_DIZZYEGG}{EMOJI_DIZZYEGG}"); -const u8 gText_Stats_EggCycles_Slow[] = _("{EMOJI_DIZZYEGG}{EMOJI_DIZZYEGG}{EMOJI_DIZZYEGG}"); -const u8 gText_Stats_Growthrate[] = _("GROW: "); -const u8 gText_Stats_Friendship[] = _("FRIENDSHIP:"); -const u8 gText_Stats_Friendship_BigAnger[] = _("{EMOJI_BIGANGER}"); -const u8 gText_Stats_Friendship_Neutral[] = _("{EMOJI_NEUTRAL}"); -const u8 gText_Stats_Friendship_Happy[] = _("{EMOJI_HAPPY}"); -const u8 gText_Stats_Friendship_BigSmile[] = _("{EMOJI_BIGSMILE}"); -const u8 gText_Stats_MEDIUM_FAST[] = _("MED. FAST"); -const u8 gText_Stats_ERRATIC[] = _("ERRATIC"); -const u8 gText_Stats_FLUCTUATING[] = _("FLUCTUATING"); -const u8 gText_Stats_MEDIUM_SLOW[] = _("MED. SLOW"); -const u8 gText_Stats_FAST[] = _("FAST"); -const u8 gText_Stats_SLOW[] = _("SLOW"); -const u8 gText_Stats_ContestHeart[] = _("H"); +const u8 gText_Stats_Buttons[] = _("{A_BUTTON}TOGGLE {DPAD_UPDOWN}MOVES"); +const u8 gText_Stats_Buttons_Decapped[] = _("{A_BUTTON}Toggle {DPAD_UPDOWN}Moves"); +const u8 gText_Stats_HP[] = _("HP"); +const u8 gText_Stats_Attack[] = _("ATK"); +const u8 gText_Stats_Defense[] = _("DEF"); +const u8 gText_Stats_Speed[] = _("SPE"); +const u8 gText_Stats_SpAttack[] = _("SP.A"); +const u8 gText_Stats_SpDefense[] = _("SP.D"); +const u8 gText_Stats_EV_Plus1[] = _("{UP_ARROW_2}"); +const u8 gText_Stats_EV_Plus2[] = _("{UP_ARROW_2}{UP_ARROW_2}"); +const u8 gText_Stats_EV_Plus3[] = _("{UP_ARROW_2}{UP_ARROW_2}{UP_ARROW_2}"); +const u8 gText_Stats_EvStr1Str2[] = _("{STR_VAR_1}{STR_VAR_2}"); +const u8 gText_Stats_MoveSelectedMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); +const u8 gText_Stats_MoveLevel[] = _("LVL"); +const u8 gText_Stats_Gender_0[] = _("♂"); +const u8 gText_Stats_Gender_12_5[] = _("♀ 1/7 ♂"); //_("♀ 12.5 / 87.5 ♂"); +const u8 gText_Stats_Gender_25[] = _("♀ 1/3 ♂"); //_("♀ 25 / 75 ♂"); +const u8 gText_Stats_Gender_50[] = _("♀ 1/1 ♂"); //_("♀ 50 / 50 ♂"); +const u8 gText_Stats_Gender_75[] = _("♀ 3/1 ♂"); //_("♀ 75 / 25 ♂"); +const u8 gText_Stats_Gender_87_5[] = _("♀ 7/1 ♂"); +const u8 gText_Stats_Gender_100[] = _("♀"); +const u8 gText_Stats_CatchRate[] = _("CATCH{0x5B}: "); +const u8 gText_Stats_CatchRate_Legend[] = _("LEGENDARY"); +const u8 gText_Stats_CatchRate_VeryHard[] = _("VERY HARD"); +const u8 gText_Stats_CatchRate_Difficult[] = _("DIFFICULT"); +const u8 gText_Stats_CatchRate_Medium[] = _("MEDIUM"); +const u8 gText_Stats_CatchRate_Relaxed[] = _("RELAXED"); +const u8 gText_Stats_CatchRate_Easy[] = _("EASY"); +const u8 gText_Stats_ExpYield[] = _("EXP YIELD: "); +const u8 gText_Stats_EggCycles[] = _("HATCH STEPS:"); +const u8 gText_Stats_EggCycles_VeryFast[] = _("{EMOJI_BOLT}{EMOJI_DIZZYEGG}"); +const u8 gText_Stats_EggCycles_Fast[] = _("{EMOJI_DIZZYEGG}"); +const u8 gText_Stats_EggCycles_Normal[] = _("{EMOJI_DIZZYEGG}{EMOJI_DIZZYEGG}"); +const u8 gText_Stats_EggCycles_Slow[] = _("{EMOJI_DIZZYEGG}{EMOJI_DIZZYEGG}{EMOJI_DIZZYEGG}"); +const u8 gText_Stats_Growthrate[] = _("GROW: "); +const u8 gText_Stats_Friendship[] = _("FRIENDSHIP:"); +const u8 gText_Stats_Friendship_BigAnger[] = _("{EMOJI_BIGANGER}"); +const u8 gText_Stats_Friendship_Neutral[] = _("{EMOJI_NEUTRAL}"); +const u8 gText_Stats_Friendship_Happy[] = _("{EMOJI_HAPPY}"); +const u8 gText_Stats_Friendship_BigSmile[] = _("{EMOJI_BIGSMILE}"); +const u8 gText_Stats_MEDIUM_FAST[] = _("MED. FAST"); +const u8 gText_Stats_ERRATIC[] = _("ERRATIC"); +const u8 gText_Stats_FLUCTUATING[] = _("FLUCTUATING"); +const u8 gText_Stats_MEDIUM_SLOW[] = _("MED. SLOW"); +const u8 gText_Stats_FAST[] = _("FAST"); +const u8 gText_Stats_SLOW[] = _("SLOW"); +const u8 gText_Stats_ContestHeart[] = _("H"); const u8 gText_Stats_Minus[] = _("-"); -const u8 gText_Stats_eggGroup[] = _("EGG G1:"); -const u8 gText_Stats_eggGroup_Groups[] = _("{STR_VAR_1}/{STR_VAR_2}"); -const u8 gText_Stats_eggGroup_MONSTER[] = _("MONSTER"); -const u8 gText_Stats_eggGroup_WATER_1[] = _("WATER {CIRCLE_1}"); -const u8 gText_Stats_eggGroup_BUG[] = _("BUG"); -const u8 gText_Stats_eggGroup_FLYING[] = _("FLYING"); -const u8 gText_Stats_eggGroup_FIELD[] = _("FIELD"); -const u8 gText_Stats_eggGroup_FAIRY[] = _("FAIRY"); -const u8 gText_Stats_eggGroup_GRASS[] = _("GRASS"); -const u8 gText_Stats_eggGroup_HUMAN_LIKE[] = _("HUMANE"); -const u8 gText_Stats_eggGroup_WATER_3[] = _("WATER {CIRCLE_3}"); -const u8 gText_Stats_eggGroup_MINERAL[] = _("MINERAL"); -const u8 gText_Stats_eggGroup_AMORPHOUS[] = _("AMORPHOUS"); -const u8 gText_Stats_eggGroup_WATER_2[] = _("WATER {CIRCLE_2}"); -const u8 gText_Stats_eggGroup_DITTO[] = _("DITTO"); -const u8 gText_Stats_eggGroup_DRAGON[] = _("DRAGON"); -const u8 gText_Stats_eggGroup_UNDISCOVERED[]= _("---"); -const u8 gText_Dex_SEEN[] = _("SEEN"); -const u8 gText_Dex_OWN[] = _("OWN"); +const u8 gText_Stats_eggGroup[] = _("EGG G1:"); +const u8 gText_Stats_eggGroup_Groups[] = _("{STR_VAR_1}/{STR_VAR_2}"); +const u8 gText_Stats_eggGroup_MONSTER[] = _("MONSTER"); +const u8 gText_Stats_eggGroup_WATER_1[] = _("WATER {CIRCLE_1}"); +const u8 gText_Stats_eggGroup_BUG[] = _("BUG"); +const u8 gText_Stats_eggGroup_FLYING[] = _("FLYING"); +const u8 gText_Stats_eggGroup_FIELD[] = _("FIELD"); +const u8 gText_Stats_eggGroup_FAIRY[] = _("FAIRY"); +const u8 gText_Stats_eggGroup_GRASS[] = _("GRASS"); +const u8 gText_Stats_eggGroup_HUMAN_LIKE[] = _("HUMANE"); +const u8 gText_Stats_eggGroup_WATER_3[] = _("WATER {CIRCLE_3}"); +const u8 gText_Stats_eggGroup_MINERAL[] = _("MINERAL"); +const u8 gText_Stats_eggGroup_AMORPHOUS[] = _("AMORPHOUS"); +const u8 gText_Stats_eggGroup_WATER_2[] = _("WATER {CIRCLE_2}"); +const u8 gText_Stats_eggGroup_DITTO[] = _("DITTO"); +const u8 gText_Stats_eggGroup_DRAGON[] = _("DRAGON"); +const u8 gText_Stats_eggGroup_UNDISCOVERED[] = _("---"); +const u8 gText_Dex_SEEN[] = _("SEEN"); +const u8 gText_Dex_OWN[] = _("OWN"); -const u8 gText_EVO_Buttons[] = _("{DPAD_UPDOWN}EVOs {A_BUTTON}CHECK"); -const u8 gText_EVO_Buttons_Decapped[] = _("{DPAD_UPDOWN}Evos {A_BUTTON}Check"); -const u8 gText_EVO_Buttons_PE[] = _("{DPAD_UPDOWN}EVOs {A_BUTTON}CHECK {START_BUTTON}FORMs"); -const u8 gText_EVO_Buttons_Decapped_PE[] = _("{DPAD_UPDOWN}Evos {A_BUTTON}Check {START_BUTTON}Froms"); -const u8 gText_EVO_Name[] = _("{STR_VAR_3}:"); -const u8 gText_EVO_PreEvo[] = _("{STR_VAR_1} evolves from {STR_VAR_2}"); -const u8 gText_EVO_PreEvo_PE_Mega[] = _("{STR_VAR_1} mega evolves with {STR_VAR_2}"); -const u8 gText_EVO_FRIENDSHIP[] = _("LvlUp, high friendship"); -const u8 gText_EVO_FRIENDSHIP_DAY[] = _("LvlUp, high friendship, day"); -const u8 gText_EVO_FRIENDSHIP_NIGHT[] = _("Lvlup, high friendship, night"); -const u8 gText_EVO_LEVEL[] = _("LvlUp to {STR_VAR_2}"); -const u8 gText_EVO_TRADE[] = _("Trading"); -const u8 gText_EVO_TRADE_ITEM[] = _("Trading, holding {STR_VAR_2}"); -const u8 gText_EVO_ITEM[] = _("{STR_VAR_2} is used"); -const u8 gText_EVO_LEVEL_ATK_GT_DEF[] = _("LvlUp to {STR_VAR_2}, Atk > Def"); -const u8 gText_EVO_LEVEL_ATK_EQ_DEF[] = _("LvlUp to {STR_VAR_2}, Atk = Def"); -const u8 gText_EVO_LEVEL_ATK_LT_DEF[] = _("LvlUp to {STR_VAR_2}, Atk < Def"); -const u8 gText_EVO_LEVEL_SILCOON[] = _("LvlUp to {STR_VAR_2}, Silcoon persona"); -const u8 gText_EVO_LEVEL_CASCOON[] = _("LvlUp to {STR_VAR_2}, Cascoon persona"); -const u8 gText_EVO_LEVEL_NINJASK[] = _("LvlUp to {STR_VAR_2}"); -const u8 gText_EVO_LEVEL_SHEDINJA[] = _("LvlUp to {STR_VAR_2}, party<6, 1x POKéBALL"); -const u8 gText_EVO_BEAUTY[] = _("LvlUp, high beauty"); -const u8 gText_EVO_LEVEL_FEMALE[] = _("LvlUp to {STR_VAR_2}, is female"); -const u8 gText_EVO_LEVEL_MALE[] = _("LvlUp to {STR_VAR_2}, is male"); -const u8 gText_EVO_LEVEL_NIGHT[] = _("LvlUp to {STR_VAR_2}, night"); -const u8 gText_EVO_LEVEL_DAY[] = _("LvlUp to {STR_VAR_2}, day"); -const u8 gText_EVO_LEVEL_DUSK[] = _("LvlUp to {STR_VAR_2}, dusk (5-6PM)"); -const u8 gText_EVO_ITEM_HOLD_DAY[] = _("LvlUp, holds {STR_VAR_2}, day"); -const u8 gText_EVO_ITEM_HOLD_NIGHT[] = _("LvlUp, holds {STR_VAR_2}, night"); -const u8 gText_EVO_MOVE[] = _("LvlUp, knows {STR_VAR_2}"); -const u8 gText_EVO_MOVE_TYPE[] = _("LvlUp, knows {STR_VAR_2} move"); -const u8 gText_EVO_MAPSEC[] = _("LvlUp on {STR_VAR_2}"); -const u8 gText_EVO_ITEM_MALE[] = _("{STR_VAR_2} used on male"); -const u8 gText_EVO_ITEM_FEMALE[] = _("{STR_VAR_2} used on female"); -const u8 gText_EVO_LEVEL_RAIN[] = _("LvlUp to {STR_VAR_2} while raining"); -const u8 gText_EVO_SPECIFIC_MON_IN_PARTY[] = _("LvlUp with {STR_VAR_2} in party"); -const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[] = _("LvlUp with dark type in party"); -const u8 gText_EVO_TRADE_SPECIFIC_MON[] = _("Traded for {STR_VAR_2}"); -const u8 gText_EVO_SPECIFIC_MAP[] = _("LvlUp on {STR_VAR_2}"); -const u8 gText_EVO_LEVEL_NATURE_AMPED[] = _("LvlUp to {STR_VAR_2}, Amped natures"); -const u8 gText_EVO_LEVEL_NATURE_LOW_KEY[] = _("LvlUp to {STR_VAR_2}, Low Key natures"); -const u8 gText_EVO_CRITICAL_HITS[] = _("Land {STR_VAR_2} critical hits in\nsingle battle"); -const u8 gText_EVO_SCRIPT_TRIGGER_DMG[] = _("Takes at least {STR_VAR_2} HP in damage"); -const u8 gText_EVO_DARK_SCROLL[] = _("ScrllOfDrknss is used"); -const u8 gText_EVO_WATER_SCROLL[] = _("ScrollOfWatrs is used"); -const u8 gText_EVO_ITEM_NIGHT[] = _("{STR_VAR_2} is used, night"); -const u8 gText_EVO_ITEM_DAY[] = _("{STR_VAR_2} is used, day"); -const u8 gText_EVO_ITEM_HOLD[] = _("LvlUp, holds {STR_VAR_2}"); -const u8 gText_EVO_UNKNOWN[] = _("Method unknown"); -const u8 gText_EVO_NONE[] = _("{STR_VAR_1} has no evolution."); +const u8 gText_EVO_Buttons[] = _("{DPAD_UPDOWN}EVOs {A_BUTTON}CHECK"); +const u8 gText_EVO_Buttons_Decapped[] = _("{DPAD_UPDOWN}Evos {A_BUTTON}Check"); +const u8 gText_EVO_Buttons_PE[] = _("{DPAD_UPDOWN}EVOs {A_BUTTON}CHECK {START_BUTTON}FORMs"); +const u8 gText_EVO_Buttons_Decapped_PE[] = _("{DPAD_UPDOWN}Evos {A_BUTTON}Check {START_BUTTON}Froms"); +const u8 gText_EVO_Name[] = _("{STR_VAR_3}:"); +const u8 gText_EVO_PreEvo[] = _("{STR_VAR_1} evolves from {STR_VAR_2}"); +const u8 gText_EVO_PreEvo_PE_Mega[] = _("{STR_VAR_1} mega evolves with {STR_VAR_2}"); +const u8 gText_EVO_FRIENDSHIP[] = _("LvlUp, high friendship"); +const u8 gText_EVO_FRIENDSHIP_DAY[] = _("LvlUp, high friendship, day"); +const u8 gText_EVO_FRIENDSHIP_NIGHT[] = _("Lvlup, high friendship, night"); +const u8 gText_EVO_LEVEL[] = _("LvlUp to {STR_VAR_2}"); +const u8 gText_EVO_TRADE[] = _("Trading"); +const u8 gText_EVO_TRADE_ITEM[] = _("Trading, holding {STR_VAR_2}"); +const u8 gText_EVO_ITEM[] = _("{STR_VAR_2} is used"); +const u8 gText_EVO_LEVEL_ATK_GT_DEF[] = _("LvlUp to {STR_VAR_2}, Atk > Def"); +const u8 gText_EVO_LEVEL_ATK_EQ_DEF[] = _("LvlUp to {STR_VAR_2}, Atk = Def"); +const u8 gText_EVO_LEVEL_ATK_LT_DEF[] = _("LvlUp to {STR_VAR_2}, Atk < Def"); +const u8 gText_EVO_LEVEL_SILCOON[] = _("LvlUp to {STR_VAR_2}, Silcoon persona"); +const u8 gText_EVO_LEVEL_CASCOON[] = _("LvlUp to {STR_VAR_2}, Cascoon persona"); +const u8 gText_EVO_LEVEL_NINJASK[] = _("LvlUp to {STR_VAR_2}"); +const u8 gText_EVO_LEVEL_SHEDINJA[] = _("LvlUp to {STR_VAR_2}, party<6, 1x POKéBALL"); +const u8 gText_EVO_BEAUTY[] = _("LvlUp, high beauty"); +const u8 gText_EVO_LEVEL_FEMALE[] = _("LvlUp to {STR_VAR_2}, is female"); +const u8 gText_EVO_LEVEL_MALE[] = _("LvlUp to {STR_VAR_2}, is male"); +const u8 gText_EVO_LEVEL_NIGHT[] = _("LvlUp to {STR_VAR_2}, night"); +const u8 gText_EVO_LEVEL_DAY[] = _("LvlUp to {STR_VAR_2}, day"); +const u8 gText_EVO_LEVEL_DUSK[] = _("LvlUp to {STR_VAR_2}, dusk (5-6PM)"); +const u8 gText_EVO_ITEM_HOLD_DAY[] = _("LvlUp, holds {STR_VAR_2}, day"); +const u8 gText_EVO_ITEM_HOLD_NIGHT[] = _("LvlUp, holds {STR_VAR_2}, night"); +const u8 gText_EVO_MOVE[] = _("LvlUp, knows {STR_VAR_2}"); +const u8 gText_EVO_MOVE_TYPE[] = _("LvlUp, knows {STR_VAR_2} move"); +const u8 gText_EVO_MAPSEC[] = _("LvlUp on {STR_VAR_2}"); +const u8 gText_EVO_ITEM_MALE[] = _("{STR_VAR_2} used on male"); +const u8 gText_EVO_ITEM_FEMALE[] = _("{STR_VAR_2} used on female"); +const u8 gText_EVO_LEVEL_RAIN[] = _("LvlUp to {STR_VAR_2} while raining"); +const u8 gText_EVO_SPECIFIC_MON_IN_PARTY[] = _("LvlUp with {STR_VAR_2} in party"); +const u8 gText_EVO_LEVEL_DARK_TYPE_MON_IN_PARTY[] = _("LvlUp with dark type in party"); +const u8 gText_EVO_TRADE_SPECIFIC_MON[] = _("Traded for {STR_VAR_2}"); +const u8 gText_EVO_SPECIFIC_MAP[] = _("LvlUp on {STR_VAR_2}"); +const u8 gText_EVO_LEVEL_NATURE_AMPED[] = _("LvlUp to {STR_VAR_2}, Amped natures"); +const u8 gText_EVO_LEVEL_NATURE_LOW_KEY[] = _("LvlUp to {STR_VAR_2}, Low Key natures"); +const u8 gText_EVO_CRITICAL_HITS[] = _("Land {STR_VAR_2} critical hits in\nsingle battle"); +const u8 gText_EVO_SCRIPT_TRIGGER_DMG[] = _("Takes at least {STR_VAR_2} HP in damage"); +const u8 gText_EVO_DARK_SCROLL[] = _("ScrllOfDrknss is used"); +const u8 gText_EVO_WATER_SCROLL[] = _("ScrollOfWatrs is used"); +const u8 gText_EVO_ITEM_NIGHT[] = _("{STR_VAR_2} is used, night"); +const u8 gText_EVO_ITEM_DAY[] = _("{STR_VAR_2} is used, day"); +const u8 gText_EVO_ITEM_HOLD[] = _("LvlUp, holds {STR_VAR_2}"); +const u8 gText_EVO_UNKNOWN[] = _("Method unknown"); +const u8 gText_EVO_NONE[] = _("{STR_VAR_1} has no evolution."); -const u8 gText_FORMS_Buttons_PE[] = _("{A_BUTTON}FORM MODE {START_BUTTON}EVOs"); -const u8 gText_FORMS_Buttons_Decapped_PE[] = _("{START_BUTTON}Evos"); -const u8 gText_FORMS_Buttons_Submenu_PE[] = _("{DPAD_NONE}FORMs {A_BUTTON}CHECK {START_BUTTON}EVOs"); -const u8 gText_FORMS_Buttons_Submenu_Decapped_PE[] = _("{START_BUTTON}Evos"); -const u8 gText_FORMS_NONE[] = _("{STR_VAR_1} has no alternate forms."); +const u8 gText_FORMS_Buttons_PE[] = _("{A_BUTTON}FORM MODE {START_BUTTON}EVOs"); +const u8 gText_FORMS_Buttons_Decapped_PE[] = _("{START_BUTTON}Evos"); +const u8 gText_FORMS_Buttons_Submenu_PE[] = _("{DPAD_NONE}FORMs {A_BUTTON}CHECK {START_BUTTON}EVOs"); +const u8 gText_FORMS_Buttons_Submenu_Decapped_PE[] = _("{START_BUTTON}Evos"); +const u8 gText_FORMS_NONE[] = _("{STR_VAR_1} has no alternate forms."); #endif From 75bf32e0d125b61ad3cdcfa96a69764c7a121e00 Mon Sep 17 00:00:00 2001 From: Aaghat Date: Sun, 17 Sep 2023 17:07:58 +0530 Subject: [PATCH 87/88] Applied requested changes --- graphics/pokedex/hgss/RES_HGSS_palette.pal | 19 ------------------- include/pokemon_summary_screen.h | 4 ++-- src/pokedex_plus_hgss.c | 4 ++-- src/pokemon_summary_screen.c | 8 ++++---- 4 files changed, 8 insertions(+), 27 deletions(-) delete mode 100644 graphics/pokedex/hgss/RES_HGSS_palette.pal diff --git a/graphics/pokedex/hgss/RES_HGSS_palette.pal b/graphics/pokedex/hgss/RES_HGSS_palette.pal deleted file mode 100644 index 96fe4b782ac3..000000000000 --- a/graphics/pokedex/hgss/RES_HGSS_palette.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -193 33 177 -249 249 249 -225 225 225 -201 201 201 -169 169 169 -129 129 129 -249 153 161 -233 49 49 -193 33 41 -145 17 33 -249 153 161 -193 33 41 -141 251 184 -52 66 162 -194 181 66 -0 0 0 \ No newline at end of file diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index c7839479f7a6..b313b59d9b72 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -8,8 +8,8 @@ extern u8 gLastViewedMonIndex; extern const u8 *const gMoveDescriptionPointers[]; extern const u8 gNotDoneYetDescription[]; extern const u8 *const gNatureNamePointers[]; -extern const struct SpriteTemplate sSpriteTemplate_MoveTypes; -extern const struct CompressedSpriteSheet sSpriteSheet_MoveTypes; +extern const struct SpriteTemplate gSpriteTemplate_MoveTypes; +extern const struct CompressedSpriteSheet gSpriteSheet_MoveTypes; void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); void ShowSelectMovePokemonSummaryScreen(struct Pokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void), u16 newMove); diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index da9a32093594..5e6d8992b1de 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -4292,12 +4292,12 @@ static void CreateTypeIconSprites(void) { u8 i; - LoadCompressedSpriteSheet(&sSpriteSheet_MoveTypes); + LoadCompressedSpriteSheet(&gSpriteSheet_MoveTypes); LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); for (i = 0; i < 2; i++) { if (sPokedexView->typeIconSpriteIds[i] == 0xFF) - sPokedexView->typeIconSpriteIds[i] = CreateSprite(&sSpriteTemplate_MoveTypes, 10, 10, 2); + sPokedexView->typeIconSpriteIds[i] = CreateSprite(&gSpriteTemplate_MoveTypes, 10, 10, 2); SetSpriteInvisibility(i, TRUE); } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 7b8f7fa99b06..9e7834c113e4 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -935,13 +935,13 @@ static const union AnimCmd *const sSpriteAnimTable_MoveTypes[NUMBER_OF_MON_TYPES sSpriteAnim_CategoryTough, }; -const struct CompressedSpriteSheet sSpriteSheet_MoveTypes = +const struct CompressedSpriteSheet gSpriteSheet_MoveTypes = { .data = gMoveTypes_Gfx, .size = (NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT) * 0x100, .tag = TAG_MOVE_TYPES }; -const struct SpriteTemplate sSpriteTemplate_MoveTypes = +const struct SpriteTemplate gSpriteTemplate_MoveTypes = { .tileTag = TAG_MOVE_TYPES, .paletteTag = TAG_MOVE_TYPES, @@ -1427,7 +1427,7 @@ static bool8 DecompressGraphics(void) sMonSummaryScreen->switchCounter++; break; case 7: - LoadCompressedSpriteSheet(&sSpriteSheet_MoveTypes); + LoadCompressedSpriteSheet(&gSpriteSheet_MoveTypes); sMonSummaryScreen->switchCounter++; break; case 8: @@ -3882,7 +3882,7 @@ static void CreateMoveTypeIcons(void) for (i = SPRITE_ARR_ID_TYPE; i < SPRITE_ARR_ID_TYPE + TYPE_ICON_SPRITE_COUNT; i++) { if (sMonSummaryScreen->spriteIds[i] == SPRITE_NONE) - sMonSummaryScreen->spriteIds[i] = CreateSprite(&sSpriteTemplate_MoveTypes, 0, 0, 2); + sMonSummaryScreen->spriteIds[i] = CreateSprite(&gSpriteTemplate_MoveTypes, 0, 0, 2); SetSpriteInvisibility(i, TRUE); } From 58cd22ba6c43bac89b0fddaa36e2da81b2838e27 Mon Sep 17 00:00:00 2001 From: Aaghat Date: Sun, 17 Sep 2023 17:08:21 +0530 Subject: [PATCH 88/88] Added dark mode --- graphics/pokedex/hgss/palette_national_dark.pal | 10 +++++----- src/pokedex_plus_hgss.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/graphics/pokedex/hgss/palette_national_dark.pal b/graphics/pokedex/hgss/palette_national_dark.pal index 5889ede7ac0f..1523b7d25f55 100644 --- a/graphics/pokedex/hgss/palette_national_dark.pal +++ b/graphics/pokedex/hgss/palette_national_dark.pal @@ -7,11 +7,11 @@ JASC-PAL 201 201 201 169 169 169 129 129 129 -249 153 161 -233 49 49 -193 33 41 -145 17 33 -249 153 161 +106 106 106 +37 37 37 +106 106 106 +0 0 0 +106 106 106 193 33 41 141 251 184 52 66 162 diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index 5e6d8992b1de..8a73315b84e4 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -135,9 +135,9 @@ static const u8 sText_TenDashes2[] = _("----------"); #define SCROLLING_MON_X 146 -#define HGSS_DECAPPED 0 //0 false, 1 true -#define HGSS_DARK_MODE 0 //0 false, 1 true -#define HGSS_HIDE_UNSEEN_EVOLUTION_NAMES 0 //0 false, 1 true +#define HGSS_DECAPPED FALSE +#define HGSS_DARK_MODE FALSE +#define HGSS_HIDE_UNSEEN_EVOLUTION_NAMES FALSE // For scrolling search parameter #define MAX_SEARCH_PARAM_ON_SCREEN 6