CGfxCrowd.cpp 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039
  1. #include "CGFXSpec.h"
  2. #include "CGfxCrowd.h"
  3. #include "CCrowdNewShader.h"
  4. #include "CFTTBatchModelManager.h"
  5. #include "CFTTCamera.h"
  6. #include "CFTTMaterialManager.h"
  7. #include "CFTTShaderBuiltInConstants.h"
  8. #include "CFTTTextureManager.h"
  9. #include "CGaussianNewShader.h"
  10. #include "CGfxEnvironmentMap.h"
  11. #include "CGfxKits.h"
  12. #include "CGfxPlayer.h"
  13. #include "CGraphicsTexLoadOptions.h"
  14. #include "CModelManager.h"
  15. #include "CPlayerShader.h"
  16. #include "FTT2D.h"
  17. #include "GFXSCENE.h"
  18. #include "Matrix.h"
  19. #include "TGame.h"
  20. #include "XSYS.h"
  21. #include "memctrl.h"
  22. #include <algorithm>
  23. #include "FTTArray.h"
  24. CGfxCrowd *CGfxCrowd::ms_pInstance = nullptr;
  25. MYCONST uchar byte_2FDF94[] = {0, 0, 0, 0, 1, 1, 1, 1, 3, 3, 3, 3, 4, 4, 4, 4};
  26. MYCONST uchar byte_2FEFF4[15] = {5, 4, 0, 0xC, 1, 5, 4, 0, 0xC, 1, 3, 2, 0, 3, 3};
  27. MYCONST uchar byte_2FF003[180] = {
  28. 3, 3, 0xE, 0xE, 0x10, 0, 0, 0, 0, 0, 0, 0, 2, 3, 6,
  29. 0x11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  30. 0, 0, 0, 0, 0, 0, 0, 1, 5, 4, 7, 8, 9, 0xA, 0xC,
  31. 0xD, 0xE, 0xF, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  32. 3, 3, 0xE, 0xE, 0x10, 0, 0, 0, 0, 0, 0, 0, 2, 3, 6,
  33. 0x11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  34. 0, 0, 0, 0, 0, 0, 0, 1, 5, 4, 7, 8, 9, 0xA, 0xC,
  35. 0xD, 0xE, 0xF, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  36. 3, 3, 0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0,
  37. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  38. 0, 0, 0, 0, 0, 0, 3, 4, 0xA, 0, 0, 0, 0, 0, 0,
  39. 0, 0, 0, 3, 4, 0xA, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  40. MYCONST uchar byte_2FF0B7[] = {0x12, 0x13, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  41. MYCONST uchar byte_2FF0C3[] = {0, 0, 0, 0, 0};
  42. MYCONST int dword_2FF0C8[] = {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
  43. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};
  44. struct byte5 {
  45. uchar b_0;
  46. uchar b_1;
  47. uchar b_2;
  48. uchar b_3;
  49. uchar b_4;
  50. };
  51. MYCONST byte5 byte5_2FF148[] = {
  52. {5, 4, 0, 0xC, 1}, {5, 4, 0, 0xC, 1}, {2, 2, 2, 0, 0}};
  53. MYCONST uchar byte_2FF157[] = {
  54. 3, 6, 0xE, 0xE, 0x10, 0, 0, 0, 0, 0, 0, 0, 2, 3, 6, 0x11, 0, 0, 0, 0,
  55. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5, 4,
  56. 7, 8, 9, 0xA, 0xC, 0xD, 0xE, 0xF, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  57. 3, 6, 0xE, 0xE, 0x10, 0, 0, 0, 0, 0, 0, 0, 2, 3, 6, 0x11, 0, 0, 0, 0,
  58. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5, 4,
  59. 7, 8, 9, 0xA, 0xC, 0xD, 0xE, 0xF, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  60. 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, 0, 0, 0,
  61. 0, 0, 0, 0, 4, 0xA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  62. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  63. 0};
  64. struct Unknow_4630E0 {
  65. uchar byte_4630E0[8];
  66. uchar byte_4630E8[0x10];
  67. } t_4630e0;
  68. //0019ED8C ^_-
  69. //单元测试等级: 游戏运行正常
  70. //单元测试内容: 启动游戏到第10关
  71. //单元测试结果: 正常
  72. void sub_19ED8C(CFTTMatrix32 &r0_pmatrix, CFTTVector32 *r1_pvector32,
  73. CFTTVector32 *r2_pvector32, CFTTVector32 *r3_pvector32,
  74. CFTTVector32 *sp0_pvector32) {
  75. // r12=sp0_pvector32
  76. float s2_f = sp0_pvector32->float_0 - r3_pvector32->float_0;
  77. float s0_f = r2_pvector32->float_0 - r1_pvector32->float_0;
  78. r0_pmatrix.d[0][0] = s2_f / s0_f;
  79. r0_pmatrix.d[0][1] = 0;
  80. r0_pmatrix.d[1][0] = 0;
  81. r0_pmatrix.d[2][0] = 0;
  82. s2_f = r3_pvector32->float_0 * r2_pvector32->float_0 -
  83. sp0_pvector32->float_0 * r1_pvector32->float_0;
  84. s0_f = r2_pvector32->float_0 - r1_pvector32->float_0;
  85. r0_pmatrix.d[3][0] = s2_f / s0_f;
  86. s0_f = r2_pvector32->float_4 - r1_pvector32->float_4;
  87. r0_pmatrix.d[2][1] = 0;
  88. s2_f = sp0_pvector32->float_4 - r3_pvector32->float_4;
  89. r0_pmatrix.d[1][1] = s2_f / s0_f;
  90. s2_f = r3_pvector32->float_4 * r2_pvector32->float_4 -
  91. sp0_pvector32->float_4 * r1_pvector32->float_4;
  92. ;
  93. s0_f = r2_pvector32->float_4 - r1_pvector32->float_4;
  94. r0_pmatrix.d[0][2] = 0;
  95. r0_pmatrix.d[1][2] = 0;
  96. r0_pmatrix.d[3][1] = s2_f / s0_f;
  97. s0_f = r2_pvector32->float_8 - r1_pvector32->float_8;
  98. s2_f = sp0_pvector32->float_8 - r3_pvector32->float_8;
  99. r0_pmatrix.d[2][2] = s2_f / s0_f;
  100. s2_f = r3_pvector32->float_8 * r2_pvector32->float_8-sp0_pvector32->float_8 *r1_pvector32->float_8;
  101. s0_f = r2_pvector32->float_8 - r1_pvector32->float_8;
  102. r0_pmatrix.d[0][3] = 0;
  103. r0_pmatrix.d[1][3] = 0;
  104. r0_pmatrix.d[2][3] = 0;
  105. r0_pmatrix.d[3][3] = 1.0f;
  106. r0_pmatrix.d[3][2] = s2_f/s0_f;
  107. }
  108. //00189C0C ^_-
  109. //单元测试等级: 游戏运行正常
  110. //单元测试内容: 启动游戏到第7关
  111. //单元测试结果: 正常
  112. //!!!!!!!这里要更新FTTArray头文件 否则函数签名不一致
  113. void SetupGaussian(FTTArray<FTTPair<float,float>,PointType_16> &r0_parr,float r1_f)
  114. {
  115. uchar r7_uc=0;
  116. float s4_f=r1_f+r1_f;
  117. float s2_f=r1_f*6.28318548f;
  118. float s18_f=s4_f*r1_f;
  119. float s0_f=s2_f*r1_f;
  120. float s20_f=sqrt(s0_f);
  121. float f_sp1c[0x20];
  122. while(1){
  123. //loc_189C72 OK
  124. //check
  125. LOGE("SetupGaussian_1");
  126. float s0_f=s20_f;
  127. float s24_f=1.0f/s0_f;
  128. float s2_f=(short)r7_uc*(short)r7_uc;
  129. s2_f=-s2_f;
  130. s2_f/=s18_f;
  131. s0_f=powf(2.71828175f,s2_f);
  132. s0_f=s24_f*s0_f;
  133. if(s0_f<=0.00999999978f)
  134. break;
  135. //loc_189C4A
  136. f_sp1c[r7_uc++]=s0_f;
  137. };
  138. //00189CA8
  139. //r1=-4 s2=0.0 r2=sp20 s0=sp1c[0]
  140. s2_f=0.0f;
  141. int r1_i=r7_uc-1;
  142. int i=1;
  143. while(r1_i){
  144. //loc_189CBE Ok
  145. LOGE("SetupGaussian_2");
  146. s2_f=s2_f+ f_sp1c[i];
  147. i++;
  148. r1_i--;
  149. }
  150. //00189CCE
  151. s2_f=s2_f+s2_f;
  152. s0_f=1.0f/(f_sp1c[0]+s2_f);
  153. //loc_189CF2
  154. int r0_i=0;
  155. while(r0_i!=r7_uc){
  156. //loc_189CE2 OK
  157. LOGE("SetupGaussian_3");
  158. f_sp1c[r0_i]=s0_f*f_sp1c[r0_i];
  159. r0_i++;
  160. }
  161. //00189CF6
  162. uchar r4_uc=r7_uc-1;
  163. //loc_189D38
  164. while(r4_uc!=1){
  165. //loc_189CFC
  166. if(r4_uc!=0){
  167. //00189CFE OK
  168. LOGE("SetupGaussian_4");
  169. s0_f=f_sp1c[r4_uc];
  170. s4_f=r4_uc-1;
  171. s2_f=f_sp1c[r4_uc-1];
  172. s2_f=s2_f+s0_f;
  173. s0_f/=s2_f;
  174. s0_f+=s4_f;
  175. FTTPair<float, float> pair_sp14;
  176. pair_sp14.m_t1=s0_f;
  177. pair_sp14.m_t2=s2_f;
  178. r0_parr.Insert(std::move(pair_sp14));
  179. r4_uc-=2;
  180. }else{
  181. //loc_189D64
  182. break;
  183. }
  184. }
  185. if(r4_uc==1){
  186. //00189D3E
  187. LOGE("SetupGaussian_5");
  188. s4_f=f_sp1c[r4_uc];
  189. s2_f=f_sp1c[0];
  190. float s6_f=s4_f+s2_f*0.5f;
  191. s0_f=s4_f/s6_f;
  192. FTTPair<float, float> pair_sp14;
  193. pair_sp14.m_t1=s0_f;
  194. pair_sp14.m_t2=s6_f;
  195. //!!!!!!!这里的函数签名不对要注意修改
  196. r0_parr.Insert(std::move(pair_sp14));
  197. }else if(r4_uc==0){
  198. //loc_189D64 OK
  199. LOGE("SetupGaussian_6");
  200. FTTPair<float, float> pair_sp14;
  201. pair_sp14.m_t1=0;
  202. pair_sp14.m_t2=f_sp1c[0];
  203. r0_parr.Insert(std::move(pair_sp14));
  204. }
  205. //00189D74
  206. FTTArray<FTTPair<float,float>,PointType_16>::Iterator it_spc(r0_parr.array_0);
  207. //it_spc.m_buf=&r0_parr;
  208. FTTArray<FTTPair<float,float>,PointType_16>::Iterator it_sp4(r0_parr.array_0+r0_parr.m_count);
  209. //it_sp4.m_buf=&r0_parr+r0_parr.m_count;
  210. //FTTALG::Reverse<FTTArray<FTTPair<float,float>,16u>::Iterator>(FTTArray<FTTPair<float,float>,16u>::Iterator,FTTArray<FTTPair<float,float>,16u>::Iterator)
  211. // FTTALG::Reverse<FTTArray<FTTPair<float,float>,16u>::Iterator>(FTTArray<FTTPair<float,float>,16u>::Iterator,FTTArray<FTTPair<float,float>,16u>::Iterator)
  212. FTTALG::Reverse(it_spc,it_sp4);
  213. LOGE("SetupGaussian_end");
  214. }
  215. void GaussianBlur(CFTTRenderToTexture *a1, CFTTRenderToTexture *a2,
  216. CFTTRenderToTexture *a3, float a4, int a5, bool a6, bool a7) {
  217. LOGE("GaussianBlur=%x%x%x%x%x%x%x",a1,a2,a3,a4,a5,a6,a7);
  218. }
  219. // 00185e1a ^_-
  220. // void GetFaceData(TFTTModel *pModel0, ushort *&pUS1, int &i2, int i3) {
  221. // int iR1 = 0;
  222. // i2 = 0;
  223. // //.text:00185E2E B loc_185E58
  224. // for (int iR6 = 0; iR6 < pModel0->us_10; iR6++) { // loc_185E30
  225. // bool b = i3 == -1;
  226. // // text:00185E32 IT NE
  227. // if (i3 != -1)
  228. // b = i3 == iR6;
  229. // //.text:00185E36 BNE loc_185E54
  230. // if (b) {
  231. // uint iR7 = pModel0->u_28.list_C[iR6].field_4;
  232. // //.text:00185E40 CBZ R7, loc_185E4C
  233. // if (iR7) {
  234. // iR1 += iR7 - 2;
  235. // i2 = iR1;
  236. // }
  237. // // loc_185E4C
  238. // iR1 += pModel0->u_28.list_C[iR6].field_6;
  239. // i2 = iR1;
  240. // }
  241. // // loc_185E54
  242. // }
  243. // //.text:00185E5E BCC loc_185E30
  244. // pUS1 = new ushort[iR1 * 3];
  245. // int offsetR9 = 0;
  246. // int posR7 = 0;
  247. // // LOGE("pppp");
  248. // //.text:00185E86 B loc_185F9A
  249. // for (int iR6 = 0; iR6 < pModel0->us_10; iR6++) { // loc_185E88
  250. // bool b = i3 == -1;
  251. // //.text:00185E8A IT NE
  252. // if (i3 != -1)
  253. // b = i3 == iR6;
  254. // int sizeR12;
  255. // //.text:00185E8E BNE loc_185EDE
  256. // if (b) { //.text:00185E90
  257. // memcpy(&pUS1[3 * offsetR9],
  258. // (char *)&pModel0->u_24.pmodel_union_struct_2[posR7],
  259. // 6 * pModel0->u_28.list_C[iR6].field_6);
  260. // sizeR12 = pModel0->u_28.list_C[iR6].field_6;
  261. // int lenR3 = pModel0->u_28.list_C[iR6].field_4;
  262. // offsetR9 += sizeR12;
  263. // int sLR, eR0;
  264. // //.text:00185ED0 CBZ R3, loc_185EF0
  265. // if (lenR3) { //.text:00185ED2
  266. // sLR = pModel0->u_28.list_C[iR6].field_2;
  267. // eR0 = pModel0->u_28.list_C[iR6].field_0;
  268. // //.text:00185EDC B loc_185EF6
  269. // } else { // loc_185EF0
  270. // eR0 = 0;
  271. // sLR = 0;
  272. // }
  273. // // loc_185EF6
  274. // //.text:00185EFC BCS loc_185F92
  275. // for (int iR2 = 2; iR2 < lenR3; iR2++) {
  276. // int iR3 = 3 * offsetR9;
  277. // pUS1[iR3] = eR0;
  278. // //.text:00185F0C BNE loc_185F26
  279. // if (iR2 << 31) { // loc_185F26
  280. // pUS1[iR3 + 1] = (&pModel0->u_28.list_C[iR6].field_0)[iR2];
  281. // pUS1[iR3 + 2] = sLR;
  282. // } else { //.text:00185F0E
  283. // pUS1[iR3 + 1] = sLR;
  284. // pUS1[iR3 + 2] = (&pModel0->u_28.list_C[iR6].field_0)[iR2];
  285. // }
  286. // // loc_185F3E
  287. // //.text:00185F62 BEQ loc_185F72
  288. // if (pUS1[3 * offsetR9] == pUS1[3 * offsetR9 + 1]
  289. // //.text:00185F70 BNE loc_185F8C
  290. // || pUS1[3 * offsetR9 + 1] == pUS1[3 * offsetR9 + 2] || pUS1[3 *
  291. // offsetR9] == pUS1[3 * offsetR9 + 2]) {
  292. // --i2;
  293. // } else { // loc_185F8C
  294. // ++offsetR9;
  295. // }
  296. // eR0 = sLR;
  297. // sLR = (&pModel0->u_28.list_C[iR6].field_0)[iR2];
  298. // }
  299. // } else { // oc_185EDE
  300. // sizeR12 = pModel0->u_28.list_C[iR6].field_6;
  301. // }
  302. // posR7 += sizeR12;
  303. // } //.text:00185FA0 BCC.W loc_185E88
  304. // }
  305. //-------------------------------------------------------------------------------------------------
  306. // 0019691C 经过单元测试功能正常 (前5关)
  307. CGfxCrowd::CGfxCrowd() {
  308. // pRender2Tex_9C = nullptr;
  309. // pRender2Tex_A0 = nullptr;
  310. // pRender2Tex_A4 = nullptr;
  311. // b_CBB4 = false;
  312. // // 001969D0
  313. // CFTTTexParam var_28(1);
  314. // dCrowdNewShaderID_CBBC[0] =
  315. // CCrowdNewShader::s_tInstance.CreateMat(ECrowdNewShader_Quads_1,
  316. // ECrowdNewShader_Alphatest_0,
  317. // var_28,
  318. // ECrowdNewShader_CullMode_1);
  319. // // 001969E4
  320. // dCrowdNewShaderID_CBBC[1] =
  321. // CCrowdNewShader::s_tInstance.CreateMat(ECrowdNewShader_Quads_1,
  322. // ECrowdNewShader_Alphatest_1,
  323. // var_28,
  324. // ECrowdNewShader_CullMode_1);
  325. // // 001969F8
  326. // dCrowdNewShaderID_CBBC[2] =
  327. // CCrowdNewShader::s_tInstance.CreateMat(ECrowdNewShader_Quads_0,
  328. // ECrowdNewShader_Alphatest_0,
  329. // var_28,
  330. // ECrowdNewShader_CullMode_1);
  331. }
  332. //-------------------------------------------------------------------------------------------------
  333. // 00196A10
  334. CGfxCrowd::~CGfxCrowd() {
  335. Shut();
  336. for (int r5 = 0; r5 != 3; r5++) { // loc_196A48
  337. // loc_196A3C
  338. FTT_pMtlL->ReleaseMaterial(dCrowdNewShaderID_CBBC[r5]);
  339. }
  340. // 00196A4C
  341. }
  342. //-------------------------------------------------------------------------------------------------
  343. // 001968CC ^_^
  344. void CGfxCrowd::Initialise() { ms_pInstance = new CGfxCrowd; }
  345. //-------------------------------------------------------------------------------------------------
  346. // 001968EC
  347. void CGfxCrowd::Shutdown() {
  348. if (CGfxCrowd::ms_pInstance != nullptr) {
  349. delete CGfxCrowd::ms_pInstance;
  350. }
  351. CGfxCrowd::ms_pInstance = nullptr;
  352. }
  353. //-------------------------------------------------------------------------------------------------
  354. // 0019690C
  355. CGfxCrowd *CGfxCrowd::Get() { return CGfxCrowd::ms_pInstance; }
  356. //-------------------------------------------------------------------------------------------------
  357. // 00196AF8
  358. void CGfxCrowd::Shut() { LOGX("CGfxCrowd::Shut 00196AF8"); }
  359. //-------------------------------------------------------------------------------------------------
  360. // 00196E72 ^_^
  361. void CGfxCrowd::Init() { f_CBB8 = 0; }
  362. //-------------------------------------------------------------------------------------------------
  363. // 00197140
  364. void CGfxCrowd::AddStand(CFTTModel *, CFTTMatrix32) {
  365. LOGX("CGfxCrowd::AddStand 00197140");
  366. }
  367. //-------------------------------------------------------------------------------------------------
  368. // 00199D4C
  369. void CGfxCrowd::GetCapacity(CFTTModel *, CFTTMatrix32) {
  370. LOGX("CGfxCrowd::GetCapacity 00199D4C");
  371. }
  372. //-------------------------------------------------------------------------------------------------
  373. // 00199E08 ^_^ 经过单元测试,功能正常(前5关)
  374. // void CGfxCrowd::AssessDesirability(TGfxCrowdSeat &tSeat) {
  375. // tSeat.f_18 =
  376. // powf(XSYS_RandomNoSyncF(17.5f), 1.5f) + (20.0f - (tSeat.f_4 + tSeat.f_4));
  377. // }
  378. //-------------------------------------------------------------------------------------------------
  379. // 00199E3C 经过单元测试,功能正常(前5关)
  380. // void CGfxCrowd::AssessDesirability(TGfxCrowdSeat &tSeat1, bool b2) {
  381. // float fr6 = powf(XSYS_RandomNoSyncF(20.0f), 1.5f);
  382. // float fs16 = -1.0f;
  383. // // 00199E62
  384. // if (b2) {
  385. // // 00199E6A
  386. // fs16 = 1.0;
  387. // }
  388. // // 00199E70
  389. // float fs6 = XMATH_ClampFloat(tSeat1.f_8, -60.0f, 60.0f);
  390. // float fs0 = fr6 + (20.0f - (tSeat1.f_4 + tSeat1.f_4));
  391. // float fs8 = 10.0f + (fabs(tSeat1.f_0) * -0.5f);
  392. // /*
  393. // 以下写法与原始汇编一致,但是可读性差,我改成逻辑一致,可读性更强的代码
  394. // float32x2_t f32_1{fs8, 0.0f};
  395. // float32x2_t f32_2{0.0f, 0.0f};
  396. // float32x2_t ff32 = vmax_f32(f32_1, f32_2);
  397. // float dfs8 = ff32[0];
  398. // -----
  399. // 我改成直接调用 fmaxf API
  400. // */
  401. // tSeat1.f_18 =
  402. // (fs0 + (fs16 * fs6)) + fmaxf(10.0f + (fabs(tSeat1.f_0) * -0.5f), 0.0f);
  403. // }
  404. //-------------------------------------------------------------------------------------------------
  405. // 00199ED0
  406. void CGfxCrowd::Distribute(uint) { LOGX("CGfxCrowd::Distribute 00199ED0"); }
  407. //-------------------------------------------------------------------------------------------------
  408. // 0019CBA0 ^_-
  409. //单元测试等级: 游戏运行正常
  410. //单元测试内容: 启动游戏到第10关
  411. //单元测试结果: 正常
  412. void CGfxCrowd::UpdateCrowdTextures(uint r1_u) {
  413. // sp30=this
  414. // sp2c=r1_u
  415. LOGE("CGfxCrowd::UpdateCrowdTextures=%x",r1_u);
  416. switch (r1_u) {
  417. // sp28=m_st_D0
  418. // r11=m_st_D0
  419. case 0: {
  420. // loc_19CBE6 OK
  421. // sp28=m_st_D0
  422. LOGE("case 0");
  423. CrowdTextureCreationData *r1_pdata = new CrowdTextureCreationData;
  424. r1_pdata->mpFTTAtlasGenerator_194C.pType_0 = 0;
  425. r1_pdata->miCFTTMaterialIndex_0 = -1;
  426. r1_pdata->name_texture_5C = 0;
  427. r1_pdata->name_texture_60 = 0;
  428. r1_pdata->name_texture_64 = 0;
  429. r1_pdata->pmembers_34.pType_0 = 0;
  430. r1_pdata->pprenderToTexture_38[0] = 0;
  431. r1_pdata->pprenderToTexture_38[1] = 0;
  432. r1_pdata->prenderToTexture_40 = 0;
  433. r1_pdata->prenderToTexture_44 = 0;
  434. tPtrTextureData_D0 = r1_pdata;
  435. g_pGraphicsDevice->setDither(false);
  436. // 0019CC38
  437. tPtrTextureData_D0.pType_0->miCFTTMaterialIndex_0 =
  438. CGaussianNewShader::s_tInstance.CreateMat(
  439. EGaussianNewShader_Channel_1, EGaussianNewShader_Blend_1);
  440. CFTTTexLoadOptions options_sp78 =
  441. g_tGlobalTexLoadOptions.mTexLoadOptions_4;
  442. // r9=spd0
  443. TBuildKitTeamTextures team_textures_spd0[2];
  444. for (int r1_i = 0; r1_i < 2; r1_i++) {
  445. // loc_19CC72
  446. //team_textures_spd0[r1_i].pCTeam_0 = 0;
  447. team_textures_spd0[r1_i].filed_4 = -1;
  448. // team_textures_spd0[r1_i].pTexture_8 = 0;
  449. // team_textures_spd0[r1_i].pTexture_C = 0;
  450. // team_textures_spd0[r1_i].pTexture_10=0;
  451. // team_textures_spd0[r1_i].pTexture_14=0;
  452. }
  453. CGfxKits::LoadKitTeamTextures(
  454. &tGame.CTeam_2C60[0], &team_textures_spd0[0],
  455. g_tGlobalTexLoadOptions.mTexLoadOptions_4, 0);
  456. CGfxKits::LoadKitTeamTextures(
  457. &tGame.CTeam_2C60[1], &team_textures_spd0[1],
  458. g_tGlobalTexLoadOptions.mTexLoadOptions_4, 0);
  459. CGfxKits::BeginBuildKit(0);
  460. CGfxKits::GetTexture(tPtrTextureData_D0.pType_0->texture_4,
  461. team_textures_spd0, 0, EKitTextureType_0, NULL);
  462. CGfxKits::GetTexture(tPtrTextureData_D0.pType_0->texture_8,
  463. team_textures_spd0, 1, EKitTextureType_0, NULL);
  464. // 0019CCDE
  465. CGfxKits::GetTexture(tPtrTextureData_D0.pType_0->texture_C,
  466. &team_textures_spd0[1], 0, EKitTextureType_0, NULL);
  467. CGfxKits::GetTexture(tPtrTextureData_D0.pType_0->texture_10,
  468. &team_textures_spd0[1], 1, EKitTextureType_0, NULL);
  469. CGfxKits::EndBuildKit();
  470. // 0019CD02
  471. CGfxKits::FreeKitTeamTextures(team_textures_spd0);
  472. CGfxKits::FreeKitTeamTextures(&team_textures_spd0[1]);
  473. // 0019CD0E
  474. tPtrTextureData_D0.pType_0->model_2C = CModelManager::LoadModel(
  475. "data/models/crowd/crowd1.FTM", "data/models/crowd/",
  476. EModelLoadFlags_2, true);
  477. // 0019CD20
  478. tPtrTextureData_D0.pType_0->model_30 = CModelManager::LoadModel(
  479. "data/models/crowd/crowd2.FTM", "data/models/crowd/",
  480. EModelLoadFlags_2, true);
  481. // 0019CD34
  482. tPtrTextureData_D0.pType_0->texture_48 = FTT_pTex->LoadTexture(
  483. "data/models/Player/Textures/kit_dyn_n.p", options_sp78);
  484. // 0019CD50
  485. tPtrTextureData_D0.pType_0->texture_4C = FTT_pTex->LoadTexture(
  486. "data/models/Player/Textures/kit_dyn_a.p", options_sp78);
  487. // 0019CD5E
  488. tPtrTextureData_D0.pType_0->texture_50 = FTT_pTex->LoadTexture(
  489. "data/models/Player/Textures/atlas_n.png", options_sp78);
  490. // 0019CD6C
  491. tPtrTextureData_D0.pType_0->texture_58 = FTT_pTex->LoadTexture(
  492. "data/models/Player/Textures/atlas_s.png", options_sp78);
  493. // 0019CD7A
  494. options_sp78.eMinFilter_18 = EFTTTex_MinFilter_0;
  495. CFTTTexture *r4_name_texture = CFTTTexture::LoadName(
  496. "data/models/Crowd/jeans.png", options_sp78, true);
  497. if (tPtrTextureData_D0.pType_0->name_texture_5C) { // 0019CD98
  498. delete tPtrTextureData_D0.pType_0->name_texture_5C;
  499. }
  500. // loc_19CD9E
  501. tPtrTextureData_D0.pType_0->name_texture_5C = r4_name_texture;
  502. options_sp78.eMinFilter_18=EFTTTex_MinFilter_0;
  503. r4_name_texture = CFTTTexture::LoadName("data/models/Crowd/steward.png",
  504. options_sp78, true);
  505. if (tPtrTextureData_D0.pType_0->name_texture_60) { // 0019CDB6
  506. delete tPtrTextureData_D0.pType_0->name_texture_60;
  507. }
  508. // loc_19CDBC
  509. tPtrTextureData_D0.pType_0->name_texture_60 = r4_name_texture;
  510. r4_name_texture = CFTTTexture::LoadName("data/models/Crowd/jacket.png",
  511. options_sp78, true);
  512. if (tPtrTextureData_D0.pType_0->name_texture_64) { // 0019CDD4
  513. delete tPtrTextureData_D0.pType_0->name_texture_64;
  514. }
  515. // loc_19CDDA
  516. tPtrTextureData_D0.pType_0->name_texture_64 = r4_name_texture;
  517. GFXSCENE_Apply(NULL);
  518. CFTTVector32 vrctor32_sp50;
  519. vrctor32_sp50.float_0 = 0;
  520. vrctor32_sp50.float_4 = 0.300000012f;
  521. vrctor32_sp50.float_8 = -1.0f;
  522. // CFTTVector32
  523. GFXSCENE_vLightDir = Normalize(vrctor32_sp50);
  524. // 0019CDFA
  525. // GFXSCENE_vLightDir=vrctor32_sp120;
  526. CPBRLighting::Get()->Reinitialise(true);
  527. CGfxEnvironmentMap::Get()->SetForced(EEnvMapOverride_1);
  528. // loc_19CE38
  529. // 0019CE48 这里的符号不对 可能会造成内存泄漏
  530. // FTTUPtr<TCrowdMember []>::operator=(TCrowdMember*)
  531. LOGE("tPtrTextureData_D0.pType_0->pmembers_34=%x",tPtrTextureData_D0.pType_0->pmembers_34.pType_0);
  532. //TCrowdMember* r5_pmem = new TCrowdMember [0x20];
  533. //FTTUPtr<TCrowdMember[0x20]> r5_pmem(new TCrowdMember [0x20]);
  534. tPtrTextureData_D0.pType_0->pmembers_34= new TCrowdMember [0x20];
  535. CPlayerShader::s_tInstance.SetCinematic(EPlayerShader_Cinematic_1);
  536. CFTTVector32x4 vector32x4_sp120;
  537. vector32x4_sp120.my[0] = 1.0f;
  538. vector32x4_sp120.my[1] = 1.0f;
  539. vector32x4_sp120.my[2] = 0;
  540. vector32x4_sp120.my[3] = 0;
  541. CPlayerShader::s_tInstance.SetCinematicLightingCloth(vector32x4_sp120);
  542. vector32x4_sp120.my[0] = 1.0f;
  543. vector32x4_sp120.my[1] = 1.0f;
  544. vector32x4_sp120.my[2] = 0;
  545. vector32x4_sp120.my[3] = 0;
  546. CPlayerShader::s_tInstance.SetCinematicLightingSkin(vector32x4_sp120);
  547. break;
  548. }
  549. case 1: {
  550. // 0019CE84 OK
  551. LOGE("case 1");
  552. for (int r4_i = 0; r4_i != 0x20; r4_i++) {
  553. // loc_19CE9E
  554. float s0_f = XSYS_RandomNoSyncF(0.0799999982f);
  555. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r4_i]
  556. .m_cVec32_ADC.float_4 = 0;
  557. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r4_i]
  558. .m_cVec32_ADC.float_8 = 0;
  559. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r4_i]
  560. .m_cVec32_ADC.float_0 =
  561. (-6.975f + r4_i * 0.449999988f) + (s0_f - 0.0399999991f);
  562. }
  563. // 0019CEDA
  564. CGfxPlayer::SetupBatchConstants();
  565. CPlayerShader::s_tInstance.SetShadowMap(EPlayerShader_ShadowMap_0);
  566. CPlayerShader::s_tInstance.SetBlendMode(EPlayerShader_BlendMode_0);
  567. CPlayerShader::s_tInstance.SetModel(EPlayerShader_Model_0);
  568. CPlayerShader::s_tInstance.SetQuality(EPlayerShader_Quality_2);
  569. break;
  570. }
  571. case 2:
  572. case 4: { // loc_19CFB4 OK
  573. // sp4c=tPtrTextureData_D0
  574. LOGE("case 2 4");
  575. CFTTRenderToTexture *r5_prenderToTexture =
  576. g_pGraphicsDevice->createRenderToTexture(
  577. EFTTTexFormat_2, 0x400, 0x400, 0x1, 0x18, EFTTRTTZBufMode_1,
  578. false, EFTTTextureType_0, 1);
  579. ECrowdMemberType r4_member_type = ECrowdMemberType_0;
  580. if (r1_u != 2) r4_member_type = ECrowdMemberType_1;
  581. // 0019CFE0
  582. if (tPtrTextureData_D0.pType_0
  583. ->pprenderToTexture_38[(uint)r4_member_type]) // 0019CFF4
  584. delete tPtrTextureData_D0.pType_0
  585. ->pprenderToTexture_38[(uint)r4_member_type];
  586. // loc_19CFFA
  587. tPtrTextureData_D0.pType_0->pprenderToTexture_38[(uint)r4_member_type] =
  588. r5_prenderToTexture;
  589. // loc_19D022
  590. for (uint r6_u = 0; r6_u != 0x20; r6_u++) {
  591. // loc_19D002
  592. if (r6_u <= 5) { // 0019D00C
  593. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r6_u].Setup(
  594. r4_member_type, r6_u);
  595. } else {
  596. // loc_19D012
  597. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r6_u].Setup(
  598. ECrowdMemberType_2, r6_u - 6);
  599. }
  600. // loc_19D018
  601. }
  602. // 0019D026
  603. FTTALG::Shuffle(tPtrTextureData_D0.pType_0->pmembers_34.pType_0,
  604. &tPtrTextureData_D0.pType_0->pmembers_34.pType_0[0x20]);
  605. // 0019D032
  606. // loc_19D084
  607. for (int r4_i = 0; r4_i != 0x20; r4_i++) {
  608. // loc_19D04C
  609. float s0_f = XSYS_RandomNoSyncF(0.0399999991f);
  610. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r4_i]
  611. .m_cVec32_ADC.float_4 = 0;
  612. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r4_i]
  613. .m_cVec32_ADC.float_8 = 0;
  614. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r4_i]
  615. .m_cVec32_ADC.float_0 =
  616. (-6.975f + r4_i * 0.449999988f) + (s0_f - 0.0199999996f);
  617. }
  618. // 0019D088
  619. // sp38=unk_2FEFF4
  620. // sp34=unk_2FF003
  621. // r1=0
  622. int r1_i = 0;
  623. // loc_19D128
  624. for (int r2_i = 0; r2_i != 0x20; r2_i++) {
  625. // loc_19D0A2
  626. // sp44=r2_i
  627. // sp48=r1
  628. int r1_i = (int)tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r2_i]
  629. .m_eCrowdMemberType_0 *
  630. 5;
  631. const uchar *r4_pb = &byte_2FEFF4[r1_i];
  632. int i_sp40 = XSYS_RandomNoSync(byte_2FEFF4[r1_i]);
  633. // sp3c=r4_pb[4]
  634. int r10_i = XSYS_RandomNoSync(r4_pb[1]);
  635. int r5_i = XSYS_RandomNoSync(r4_pb[2]);
  636. int r0_i = XSYS_RandomNoSync(r4_pb[3]);
  637. const uchar *r6_pb =
  638. &byte_2FF003[tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r2_i]
  639. .m_eCrowdMemberType_0 *
  640. 60];
  641. //
  642. int r0_i1 = XSYS_RandomNoSync(r4_pb[4]);
  643. tPtrTextureData_D0.pType_0->buff_68[r2_i][0] = *(r6_pb + (uchar)i_sp40);
  644. tPtrTextureData_D0.pType_0->buff_68[r2_i][1] =
  645. *(r6_pb + (uchar)r10_i + 0xC);
  646. tPtrTextureData_D0.pType_0->buff_68[r2_i][2] =
  647. *(r6_pb + (uchar)r5_i + 0x18);
  648. tPtrTextureData_D0.pType_0->buff_68[r2_i][3] =
  649. *(r6_pb + (uchar)r0_i + 0x24);
  650. tPtrTextureData_D0.pType_0->buff_68[r2_i][4] =
  651. *(r6_pb + (uchar)r0_i1 + 0x30);
  652. }
  653. // 0019D12C
  654. // sp48=byte_2FDF94
  655. // sp44=byte_4630E0
  656. // loc_19D1DC
  657. for (int r9_i = 0; r9_i != 0x20; r9_i++) {
  658. // 0019D146
  659. // loc_19D1D0
  660. for (int r5_i = 0; r5_i != 0x10; r5_i++) {
  661. // loc_19D14A
  662. tPtrTextureData_D0.pType_0->field_10c[r9_i][r5_i].b_0 =
  663. tPtrTextureData_D0.pType_0->buff_68[r9_i][byte_2FDF94[r5_i]];
  664. ushort r0_us =
  665. GetAnim(tPtrTextureData_D0.pType_0->field_10c[r9_i][r5_i].b_0)
  666. ->filed_4;
  667. int r0_i;
  668. int r6_i = t_4630e0.byte_4630E0[byte_2FDF94[r5_i] * 2];
  669. if (r5_i == r6_i) {
  670. // 0019D17A
  671. // check UXTH
  672. r0_i = XSYS_RandomNoSync((ushort)r0_us);
  673. } else { // loc_19D182
  674. float s0_f = t_4630e0.byte_4630E0[byte_2FDF94[r5_i * 2] + 1] - r6_i;
  675. float s2_f = r5_i - r6_i;
  676. s0_f = s2_f / s0_f;
  677. // check UXTH
  678. s2_f = r0_us;
  679. // check 寻址 s4
  680. float s4_f = tPtrTextureData_D0.pType_0->field_10c[r9_i][r6_i].us_2;
  681. s4_f += s0_f * s2_f;
  682. r0_i = (uint)s4_f % r0_us;
  683. }
  684. // loc_19D1CA
  685. // check
  686. tPtrTextureData_D0.pType_0->field_10c[r9_i][r5_i].us_2 = r0_i;
  687. }
  688. // 0019D1D4
  689. }
  690. break;
  691. }
  692. case 3:
  693. case 5: {
  694. // loc_19D20E OK
  695. // check 赋值
  696. LOGE("case 3_5");
  697. CFTTClearSettings clear_setting_sp120 = g_tBlankCanvasClearSettings;
  698. clear_setting_sp120.dRGBA_8 = 0xFFFFFF;
  699. int r0_i = 0;
  700. if (r1_u != 3) {
  701. r0_i = 1;
  702. }
  703. // sp40=tPtrTextureData_D0.pType_0[r0_i].texture_38
  704. tPtrTextureData_D0.pType_0
  705. ->pprenderToTexture_38[r0_i]->BeginRenderToTexture(clear_setting_sp120);
  706. // 0019D24A
  707. CFTTVector32 vector_sp50;
  708. vector_sp50.float_0 = -7.19999981f;
  709. vector_sp50.float_4 = -0.100000001f;
  710. vector_sp50.float_8 = 0;
  711. CFTTVector32 vector_sp114;
  712. vector_sp114.float_0 = 7.19999981f;
  713. vector_sp114.float_4 = 2.4000001f;
  714. vector_sp114.float_8 = 20.0f;
  715. CFTTCamera::SetOrthographic(1.0f, 20.0f, 2.4000001f, -0.100000001f,
  716. -7.19999981, 7.19999981f);
  717. CFTTVector32 vector32_spD0;
  718. vector32_spD0.float_0 = 0;
  719. vector32_spD0.float_4 = 0;
  720. vector32_spD0.float_8 = -10.0f;
  721. CFTTCamera::SetPosition(vector32_spD0);
  722. vector32_spD0.float_0 = 0;
  723. vector32_spD0.float_4 = 0;
  724. vector32_spD0.float_8 = 1.0f;
  725. CFTTCamera::SetDirection(vector32_spD0, NULL);
  726. CFTTCamera::SetViewport(0x400, 0x400, 0);
  727. CFTTCamera::ApplyCameraSettings();
  728. g_pGraphicsDevice->setDepthTest(EFTTDepthTest_8, true);
  729. CFTTShaderBuiltInConstants::SetViewMatrix(CFTTMatrix32::s_matIdentity);
  730. CFTTShaderBuiltInConstants::SetProjMatrix(CFTTMatrix32::s_matIdentity);
  731. // 0019D2C6
  732. // sp3c=GFXPLAYER_pBatch
  733. GFXPLAYER_pBatch->cfttbmmmatrixcache_0.field_20 = false;
  734. GFXPLAYER_pBatch->Begin();
  735. // sp48=r11
  736. // sp44=g_pGraphicsDevice
  737. // s18=-1.0f
  738. // s20=1.0f r10=0 r6=0xaf0 s16=0.0625f
  739. // loc_19D41E
  740. for (int r10_i = 0; r10_i != 0x20; r10_i++) {
  741. // loc_19D2F4
  742. // loc_19D40C
  743. for (int r4_i = 0; r4_i != 0x10; r4_i++) {
  744. // loc_19D348
  745. // tPtrTextureData_D0
  746. float s22_f = (float)r4_i * 0.0625f;
  747. float s24_f = (float)(r4_i + 1) * 0.0625f;
  748. if (g_pGraphicsDevice->Matrices_FlipsRTT() == 0) {
  749. // 0019D36E
  750. if (g_pGraphicsDevice->Matrices_FlipsY() == 0) {
  751. s24_f = 1.0f - s24_f;
  752. s22_f = 1.0f - s22_f;
  753. }
  754. }
  755. // loc_19D380
  756. float s2_f = s22_f + s22_f - 1.0f;
  757. float s0_f = s24_f + s24_f - 1.0f;
  758. // spc4=
  759. // vector_sp50
  760. CFTTMatrix32 matrix32_spd0;
  761. CFTTVector32 vector32_spc4;
  762. vector32_spc4.float_0 = -1.0f;
  763. vector32_spc4.float_8 = 0;
  764. CFTTVector32 vector32_spb8;
  765. vector32_spb8.float_0 = 1.0f;
  766. vector32_spb8.float_4 = s2_f;
  767. vector32_spb8.float_8 = 1.0f;
  768. vector32_spc4.float_4 = s0_f;
  769. sub_19ED8C(matrix32_spd0, &vector_sp50, &vector_sp114, &vector32_spc4,
  770. &vector32_spb8);
  771. // 0019D3BC
  772. TSATAnim_TSX *r9_panim =
  773. GetAnim(tPtrTextureData_D0.pType_0->field_10c[r10_i][r4_i].b_0);
  774. TSATAnim_TSX *r3_panim = GetLegAnim(
  775. tPtrTextureData_D0.pType_0->field_10c[r10_i][r4_i].b_0);
  776. CFTTMatrix32 matrix_sp78 =
  777. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r10_i].Animate(
  778. r9_panim, r3_panim,
  779. tPtrTextureData_D0.pType_0->field_10c[r10_i][r4_i].us_2);
  780. // 0019D3EE
  781. MatrixMultiply(&matrix_sp78, &matrix32_spd0, &CFTTCamera::s_matView);
  782. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r10_i].Render(
  783. &matrix_sp78);
  784. }
  785. // 0019D410
  786. }
  787. // 0019D426
  788. GFXPLAYER_pBatch->End();
  789. CGfxPlayer::FlushPlayerSkins();
  790. GFXPLAYER_pBatch->ResetCache(false);
  791. GFXPLAYER_pBatch->cfttbmmmatrixcache_0.field_20 = true;
  792. // check ptype0
  793. tPtrTextureData_D0.pType_0->pprenderToTexture_38[r0_i]->EndRenderToTexture(
  794. EFTTRTTCopyMode_0);
  795. break;
  796. }
  797. case 6: {
  798. // 0019D470 OK
  799. // r8=tPtrTextureData_D0
  800. LOGE("case 6");
  801. CFTTRenderToTexture *r11_prenderToTexture =
  802. g_pGraphicsDevice->createRenderToTexture(
  803. EFTTTexFormat_2, 0x200, 0x400, 1, 0, EFTTRTTZBufMode_1, false,
  804. EFTTTextureType_0, 1);
  805. // 0019D49E
  806. CFTTRenderToTexture *prenderToTexture_sp48 =
  807. g_pGraphicsDevice->createRenderToTexture(
  808. EFTTTexFormat_2, 0x200, 0x400, 1, 0, EFTTRTTZBufMode_1, false,
  809. EFTTTextureType_0, 1);
  810. // 0019D4C2
  811. CFTTRenderToTexture *prenderToTexture_sp44 =
  812. g_pGraphicsDevice->createRenderToTexture(
  813. EFTTTexFormat_2, 0x200, 0x400, 1, 0, EFTTRTTZBufMode_1, false,
  814. EFTTTextureType_0, 1);
  815. // 0019D4E4
  816. r11_prenderToTexture->BeginRenderToTexture(g_tBlankCanvasClearSettings);
  817. FTT2D_Begin();
  818. // 0019D4FA
  819. FTT2D_SetDefaultMatBlend(EFTT2D_Blend_5);
  820. FTT2D_SetTexture(
  821. tPtrTextureData_D0.pType_0->pprenderToTexture_38[0]->GetTexture(), 0);
  822. // 0019D51A
  823. FTT2D_DrawTexturedRect(0, 0, 512.0f, 512.0f, -1, 0, -999999.0f,
  824. -999999.0f);
  825. // 0019D53C
  826. FTT2D_SetTexture(
  827. tPtrTextureData_D0.pType_0->pprenderToTexture_38[1]->GetTexture(), 0);
  828. FTT2D_DrawTexturedRect(0, 512.0f, 512.0f, 512.0f, -1, 0, -999999.0f,
  829. -999999.0f);
  830. FTT2D_End();
  831. r11_prenderToTexture->EndRenderToTexture(EFTTRTTCopyMode_0);
  832. CFTTVector32x4 vector32x4_spd0;
  833. vector32x4_spd0.my[0] = 1.0f;
  834. vector32x4_spd0.my[1] = 1.0f;
  835. vector32x4_spd0.my[2] = 1.0f;
  836. vector32x4_spd0.my[3] = 0;
  837. CGaussianNewShader::s_tInstance.SetColourMultiplier(vector32x4_spd0);
  838. // 0019D58C
  839. GaussianBlur(
  840. r11_prenderToTexture, prenderToTexture_sp44, prenderToTexture_sp48,
  841. 2.0f, tPtrTextureData_D0.pType_0->miCFTTMaterialIndex_0, true, true);
  842. FTT2D_Begin();
  843. FTT2D_SetDefaultMatBlend(EFTT2D_Blend_5);
  844. // 0019D5B0
  845. // sp3c=r11
  846. FTT2D_SetTexture(r11_prenderToTexture->GetTexture(), 0);
  847. // 0019D5C2
  848. FTT2D_DrawTexturedRect(0, 0, 512.0f, 1024.0f, -1, 0, -999999.0f,
  849. -999999.0f);
  850. FTT2D_SetDefaultMatBlend(EFTT2D_Blend_7);
  851. for (int r6_i = 0; r6_i != 0x20; r6_i++) {
  852. // loc_19D5E2
  853. FTT2D_DrawRect4(0, r6_i * 0x20, 512.0f, 32.0f, -1, -1, 0xFF404040,
  854. 0xFF404040, 0, -999999.0f, -999999.0f);
  855. }
  856. // 0019D612
  857. FTT2D_End();
  858. //这里check r5_ptexture ptexture_9C的类型
  859. CFTTTexture *r5_ptexture =
  860. prenderToTexture_sp44->EndRenderToTexture(EFTTRTTCopyMode_2);
  861. if (ptexture_9C) { // 0019D62C
  862. delete ptexture_9C;
  863. }
  864. // loc_19D632
  865. ptexture_9C = r5_ptexture;
  866. switch (GFXSPEC_pSpecification->eCrowdQuality_4C) {
  867. case 2:
  868. case 3:
  869. case 4:
  870. // loc_19D654
  871. r5_ptexture->SetMinFilter(EFTTTex_MinFilter_5);
  872. break;
  873. case 1:
  874. default:
  875. r5_ptexture->SetMinFilter(EFTTTex_MinFilter_4);
  876. // 0019D65A
  877. break;
  878. }
  879. // 0019D664
  880. CFTTTexParam parm;
  881. // check 这里传参
  882. parm.setTexture(ptexture_9C);
  883. CCrowdNewShader::s_tInstance.SetDiffuse(parm, dCrowdNewShaderID_CBBC[0]);
  884. if (tPtrTextureData_D0.pType_0->pprenderToTexture_38[0]) {
  885. // 0019D688
  886. delete tPtrTextureData_D0.pType_0->pprenderToTexture_38[0];
  887. }
  888. // loc_19D68E
  889. tPtrTextureData_D0.pType_0->pprenderToTexture_38[0] = NULL;
  890. if (tPtrTextureData_D0.pType_0->pprenderToTexture_38[1]) {
  891. // 0019D6B0
  892. delete tPtrTextureData_D0.pType_0->pprenderToTexture_38[1];
  893. }
  894. // loc_19D69E
  895. tPtrTextureData_D0.pType_0->pprenderToTexture_38[1] = NULL;
  896. delete prenderToTexture_sp44;
  897. if (prenderToTexture_sp48) {
  898. // 0019D6B0
  899. delete prenderToTexture_sp48;
  900. }
  901. // loc_19D6B6
  902. if (r11_prenderToTexture) {
  903. delete r11_prenderToTexture;
  904. }
  905. // loc_19D6C0
  906. break;
  907. }
  908. case 7: {
  909. // 0019D724 OK
  910. LOGE("case 7");
  911. CFTTRenderToTexture *r4_prenderToTexture =
  912. g_pGraphicsDevice->createRenderToTexture(
  913. EFTTTexFormat_2, 0x100, 0x200, 0x1, 0x18, EFTTRTTZBufMode_1,
  914. false, EFTTTextureType_0, 1);
  915. if (tPtrTextureData_D0.pType_0->prenderToTexture_40) {
  916. // 0019D758
  917. delete tPtrTextureData_D0.pType_0->prenderToTexture_40;
  918. }
  919. // loc_19D75E
  920. tPtrTextureData_D0.pType_0->prenderToTexture_40 = r4_prenderToTexture;
  921. // s16=-1.5f r8=r0=0.0799999982f s18=-0.0399999991f r6=0xAE4
  922. // loc_19D7AA
  923. for (int r4_i = 0; r4_i != 4; r4_i++) {
  924. // loc_19D776
  925. float s0_f = XSYS_RandomNoSyncF(0.0799999982f);
  926. float s2_f = (float)r4_i - 1.5f;
  927. s0_f -= 0.0399999991f;
  928. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r4_i]
  929. .m_cVec32_ADC.float_8 = 0;
  930. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r4_i]
  931. .m_cVec32_ADC.float_4 = 0;
  932. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r4_i]
  933. .m_cVec32_ADC.float_0 = s2_f + s0_f;
  934. }
  935. // 0019D7AE
  936. CFTTClearSettings clearSetting_spd0 = g_tBlankCanvasClearSettings;
  937. clearSetting_spd0.dRGBA_8 = 0xFFFFFF;
  938. CGfxPlayer::SetupBatchConstants();
  939. CPlayerShader::s_tInstance.SetShadowMap(EPlayerShader_ShadowMap_0);
  940. CPlayerShader::s_tInstance.SetBlendMode(EPlayerShader_BlendMode_0);
  941. CPlayerShader::s_tInstance.SetModel(EPlayerShader_Model_0);
  942. CPlayerShader::s_tInstance.SetQuality(EPlayerShader_Quality_2);
  943. tPtrTextureData_D0.pType_0->prenderToTexture_40->BeginRenderToTexture(
  944. clearSetting_spd0);
  945. tPtrTextureData_D0.pType_0->prenderToTexture_40->EndRenderToTexture(
  946. EFTTRTTCopyMode_0);
  947. break;
  948. }
  949. case 8: { // loc_19D832 OK
  950. LOGE("case 8");
  951. for (int r4_i = 0; r4_i != 4; r4_i++) {
  952. // loc_19D836
  953. // check 寻址
  954. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r4_i].Setup(
  955. ECrowdMemberType_2, 0xff);
  956. }
  957. // 0019D84E
  958. FTTALG::Shuffle(tPtrTextureData_D0.pType_0->pmembers_34.pType_0,
  959. &tPtrTextureData_D0.pType_0->pmembers_34.pType_0[4]);
  960. // loc_19D870
  961. for (int r5_i = 0; r5_i != 4; r5_i++) {
  962. uchar r0_b = XSYS_RandomNoSync(3);
  963. tPtrTextureData_D0.pType_0->byte_108[r5_i] = byte_2FF0B7[r0_b];
  964. }
  965. // 0019D874
  966. // sp44= tPtrTextureData_D0.pType_0->buff_90e
  967. //r8=byte_2FF0C3
  968. //r9=byte_4630E0
  969. // loc_19D92A
  970. for (int r1_i = 0; r1_i != 4; r1_i++) {
  971. // loc_19D88A
  972. // sp48=r1_i
  973. for (int r6_i = 0; r6_i != 4; r6_i++) {
  974. // loc_19D89C
  975. // r1=byte_2FF0C3[r6_i]
  976. // check
  977. uint r4_u = t_4630e0.byte_4630E0[byte_2FF0C3[r6_i] * 2];
  978. tPtrTextureData_D0.pType_0->data_90c[r1_i][r6_i].b_0 =
  979. tPtrTextureData_D0.pType_0->byte_108[r1_i];
  980. uint r5_u = t_4630e0.byte_4630E0[byte_2FF0C3[r6_i] * 2 + 1];
  981. ushort r0_us =
  982. GetAnim(tPtrTextureData_D0.pType_0->byte_108[r1_i])->filed_4;
  983. if (r6_i == r4_u) {
  984. // 0019D8BE
  985. r0_us = XSYS_RandomNoSync(r0_us);
  986. } else {
  987. // loc_19D8C6
  988. float s0_f = r5_u - r4_u;
  989. float s2_f = r6_i - r4_u;
  990. s0_f = s2_f / s0_f;
  991. s2_f = r0_us;
  992. float s4_f = tPtrTextureData_D0.pType_0->data_90c[r1_i][r4_u].us_2 +
  993. s0_f * s2_f;
  994. r0_us = ((uint)s4_f) % r0_us;
  995. }
  996. // loc_19D912
  997. tPtrTextureData_D0.pType_0->data_90c[r1_i][r6_i].us_2 = r0_us;
  998. }
  999. }
  1000. break;
  1001. }
  1002. case 9: { // loc_19D94A OK
  1003. LOGE("case 9");
  1004. CFTTClearSettings clear_setting_sp78 = g_tBlankCanvasClearSettings;
  1005. clear_setting_sp78.dRGBA_8 = 0xFFFFFF;
  1006. tPtrTextureData_D0.pType_0->prenderToTexture_40->BeginRenderToTexture(
  1007. clear_setting_sp78);
  1008. //0019D978
  1009. CFTTVector32 vector_sp50;
  1010. vector_sp50.float_0 = -2.0f;
  1011. vector_sp50.float_4 = -0.100000001f;
  1012. vector_sp50.float_8 = 0;
  1013. CFTTVector32 vector_sp114;
  1014. vector_sp114.float_0 = 2.0f;
  1015. vector_sp114.float_4 = 3.0f;
  1016. vector_sp114.float_8 = 20.0f;
  1017. CFTTCamera::SetOrthographic(1.0f, 20.0f, 3.0f, -0.100000001f, -2.0f,
  1018. 2.0f);
  1019. CFTTVector32 vector32_spd0;
  1020. vector32_spd0.float_0 = 0;
  1021. vector32_spd0.float_4 = 0;
  1022. vector32_spd0.float_8 = -10.0f;
  1023. CFTTCamera::SetPosition(vector32_spd0);
  1024. vector32_spd0.float_0 = 0;
  1025. vector32_spd0.float_4 = 0;
  1026. vector32_spd0.float_8 = 1.0f;
  1027. CFTTCamera::SetDirection(vector32_spd0, NULL);
  1028. CFTTCamera::SetViewport(0x100, 0x200, 0);
  1029. CFTTCamera::ApplyCameraSettings();
  1030. g_pGraphicsDevice->setDepthTest(EFTTDepthTest_8, true);
  1031. // s16=0.25f s18=-1.0f r9= tPtrTextureData_D0.pType_0->data_90c
  1032. // s20=1.0f r4=g_pGraphicsDevice R6=sp120
  1033. // sp44=g_pGraphicsDevice
  1034. // loc_19DB34
  1035. for (int r5_i = 0; r5_i != 4; r5_i++) {
  1036. // loc_19DA00
  1037. float s0_f = (float)r5_i;
  1038. float s2_f = (float)(r5_i+1);
  1039. // check 虚函数顺序
  1040. float s24_f = s2_f * 0.25f;
  1041. float s22_f = s0_f * 0.25f;
  1042. if (g_pGraphicsDevice->Matrices_FlipsRTT() == 0) {
  1043. // 0019DA28
  1044. if (g_pGraphicsDevice->Matrices_FlipsY() == 0) {
  1045. s24_f = 1.0f - s24_f;
  1046. s22_f = 1.0f - s22_f;
  1047. }
  1048. }
  1049. // loc_19DA3A
  1050. s2_f = s22_f + s22_f;
  1051. s0_f = s24_f + s24_f;
  1052. CFTTMatrix32 mat32_spd0;
  1053. CFTTVector32 vector32_spc4;
  1054. CFTTVector32 vector32_spb8;
  1055. vector32_spc4.float_0 = -1.0f;
  1056. vector32_spc4.float_4 = s0_f - 1.0f;
  1057. vector32_spc4.float_8 = 0;
  1058. vector32_spb8.float_0 = 1.0f;
  1059. vector32_spb8.float_4 = s2_f - 1.0f;
  1060. vector32_spb8.float_8 = 1.0f;
  1061. // check mat32_spd0 是否是传出参数
  1062. sub_19ED8C(mat32_spd0, &vector_sp50, &vector_sp114, &vector32_spc4,
  1063. &vector32_spb8);
  1064. CFTTShaderBuiltInConstants::SetProjMatrix(mat32_spd0);
  1065. GFXPLAYER_pBatch->Begin();
  1066. // loc_19DB12
  1067. for (int r10_i = 0; r10_i != 4; r10_i++) {
  1068. // loc_19DAD4
  1069. // check 寻址
  1070. TSATAnim_TSX *r5_panim =
  1071. GetAnim(tPtrTextureData_D0.pType_0->data_90c[r10_i][r5_i].b_0);
  1072. TSATAnim_TSX *r3_plegAnim =
  1073. GetLegAnim(tPtrTextureData_D0.pType_0->data_90c[r10_i][r5_i].b_0);
  1074. CFTTMatrix32 mat32_sp120 =
  1075. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r10_i].Animate(
  1076. r5_panim, r3_plegAnim,
  1077. tPtrTextureData_D0.pType_0->data_90c[r10_i][r5_i].us_2);
  1078. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r10_i].Render(NULL);
  1079. }
  1080. // 0019DB18
  1081. GFXPLAYER_pBatch->End();
  1082. CGfxPlayer::FlushPlayerSkins();
  1083. GFXPLAYER_pBatch->ResetCache(false);
  1084. }
  1085. // 0019DB3A
  1086. tPtrTextureData_D0.pType_0->prenderToTexture_40->EndRenderToTexture(
  1087. EFTTRTTCopyMode_0);
  1088. LOGE("9 end");
  1089. break;
  1090. }
  1091. case 10: {
  1092. // loc_19DB64 OK
  1093. LOGE("case 10");
  1094. CFTTRenderToTexture *r11_prenderToTexture =
  1095. g_pGraphicsDevice->createRenderToTexture(EFTTTexFormat_2, 0x80, 0x100,
  1096. 0x1, 0, EFTTRTTZBufMode_1,
  1097. false, EFTTTextureType_0, 1);
  1098. // 0019DB8E
  1099. // r10=r11
  1100. CFTTRenderToTexture *prenderToTexture_sp48 =
  1101. g_pGraphicsDevice->createRenderToTexture(EFTTTexFormat_2, 0x80, 0x100,
  1102. 0x1, 0, EFTTRTTZBufMode_1,
  1103. false, EFTTTextureType_0, 1);
  1104. CFTTRenderToTexture *r9_prenderToTexture =
  1105. g_pGraphicsDevice->createRenderToTexture(EFTTTexFormat_2, 0x80, 0x100,
  1106. 0x1, 0, EFTTRTTZBufMode_1,
  1107. false, EFTTTextureType_0, 1);
  1108. // 0019DBD2
  1109. r11_prenderToTexture->BeginRenderToTexture(g_tBlankCanvasClearSettings);
  1110. FTT2D_Begin();
  1111. FTT2D_SetDefaultMatBlend(EFTT2D_Blend_5);
  1112. FTT2D_SetTexture(
  1113. tPtrTextureData_D0.pType_0->prenderToTexture_40->GetTexture(), 0);
  1114. // 0019DBFC
  1115. FTT2D_DrawTexturedRect(0, 0, 128.0f, 256.0f, -1, 0, -999999.0f,
  1116. -999999.0f);
  1117. FTT2D_End();
  1118. r11_prenderToTexture->EndRenderToTexture(EFTTRTTCopyMode_0);
  1119. // 0019DC2A
  1120. CFTTVector32x4 vector32x4_spd0;
  1121. vector32x4_spd0.my[0] = 1.0f;
  1122. vector32x4_spd0.my[1] = 1.0f;
  1123. vector32x4_spd0.my[2] = 1.0f;
  1124. vector32x4_spd0.my[3] = 0;
  1125. CGaussianNewShader::s_tInstance.SetColourMultiplier(vector32x4_spd0);
  1126. GaussianBlur(
  1127. r11_prenderToTexture, r9_prenderToTexture, prenderToTexture_sp48,
  1128. 2.0f, tPtrTextureData_D0.pType_0->miCFTTMaterialIndex_0, true, true);
  1129. FTT2D_Begin();
  1130. FTT2D_SetDefaultMatBlend(EFTT2D_Blend_5);
  1131. FTT2D_SetTexture(r11_prenderToTexture->GetTexture(), 0);
  1132. FTT2D_DrawTexturedRect(0, 0, 128.0f, 256.0f, -1, 0, -999999.0f,
  1133. -999999.0f);
  1134. FTT2D_End();
  1135. CFTTTexture *r5_ptexture =
  1136. r9_prenderToTexture->EndRenderToTexture(EFTTRTTCopyMode_2);
  1137. if (ptexture_A0) { // 0019DCA8
  1138. delete ptexture_A0;
  1139. }
  1140. // loc_19DCAE
  1141. ptexture_A0 = r5_ptexture;
  1142. switch (GFXSPEC_pSpecification->eCrowdQuality_4C) {
  1143. case 2:
  1144. case 3:
  1145. case 4:
  1146. // loc_19DCD2
  1147. r5_ptexture->SetMinFilter(EFTTTex_MinFilter_5);
  1148. break;
  1149. default:
  1150. // 0019E904
  1151. r5_ptexture->SetMinFilter(EFTTTex_MinFilter_4);
  1152. // loc_19E908
  1153. break;
  1154. }
  1155. // 0019E90E
  1156. CFTTTexParam parm;
  1157. // check 这里传参
  1158. parm.setTexture(ptexture_A0);
  1159. LOGE("PARM.SIZE=%x",sizeof(parm));
  1160. CCrowdNewShader::s_tInstance.SetDiffuse(parm, dCrowdNewShaderID_CBBC[1]);
  1161. if (tPtrTextureData_D0.pType_0->prenderToTexture_40) {
  1162. // 0019E930
  1163. delete tPtrTextureData_D0.pType_0->prenderToTexture_40;
  1164. }
  1165. // 0019E936
  1166. tPtrTextureData_D0.pType_0->prenderToTexture_40 = 0;
  1167. if (r9_prenderToTexture) {
  1168. // 0019E940
  1169. delete r9_prenderToTexture;
  1170. }
  1171. // loc_19E94A
  1172. if (prenderToTexture_sp48) {
  1173. delete prenderToTexture_sp48;
  1174. }
  1175. // loc_19E954
  1176. if (r11_prenderToTexture) {
  1177. // 0019E95C
  1178. delete r11_prenderToTexture;
  1179. }
  1180. break;
  1181. }
  1182. case 15: {
  1183. // loc_19E9C0 OK
  1184. // check 虚函数
  1185. LOGE("case 15");
  1186. g_pGraphicsDevice->setDither(true);
  1187. FTT_pTex->ReleaseTexture(tPtrTextureData_D0.pType_0->texture_48);
  1188. FTT_pTex->ReleaseTexture(tPtrTextureData_D0.pType_0->texture_4C);
  1189. FTT_pTex->ReleaseTexture(tPtrTextureData_D0.pType_0->texture_50);
  1190. FTT_pTex->ReleaseTexture(tPtrTextureData_D0.pType_0->texture_58);
  1191. FTT_pTex->ReleaseTexture(tPtrTextureData_D0.pType_0->texture_4);
  1192. FTT_pTex->ReleaseTexture(tPtrTextureData_D0.pType_0->texture_8);
  1193. FTT_pTex->ReleaseTexture(tPtrTextureData_D0.pType_0->texture_C);
  1194. FTT_pTex->ReleaseTexture(tPtrTextureData_D0.pType_0->texture_10);
  1195. CModelManager::FreeModel(tPtrTextureData_D0.pType_0->model_2C);
  1196. CModelManager::FreeModel(tPtrTextureData_D0.pType_0->model_30);
  1197. FTT_pMtlL->ReleaseMaterial(
  1198. tPtrTextureData_D0.pType_0->miCFTTMaterialIndex_0);
  1199. tPtrTextureData_D0.pType_0->miCFTTMaterialIndex_0 = -1;
  1200. tPtrTextureData_D0 = NULL;
  1201. CPlayerShader::s_tInstance.SetCinematic(EPlayerShader_Cinematic_0);
  1202. CGfxEnvironmentMap::Get()->SetForced(EEnvMapOverride_0);
  1203. break;
  1204. }
  1205. case 11:
  1206. case 12:
  1207. case 13:
  1208. case 14:
  1209. {
  1210. // check eCrowdQuality_4C
  1211. // 0019CBC0
  1212. LOGE("case default GFXSPEC_pSpecification->eCrowdQuality_4C=%x",GFXSPEC_pSpecification->eCrowdQuality_4C);
  1213. if (GFXSPEC_pSpecification->eCrowdQuality_4C) {
  1214. // 0019CBD0
  1215. // loc_19CF04
  1216. switch (r1_u) {
  1217. case 11: {
  1218. // loc_19DCDA
  1219. LOGE("case 11");
  1220. CFTTRenderToTexture *r4_prenderToTexture =
  1221. g_pGraphicsDevice->createRenderToTexture(
  1222. EFTTTexFormat_2, 0x800, 0x800, 0x1, 0x18, EFTTRTTZBufMode_1,
  1223. false, EFTTTextureType_0, 1);
  1224. // 0019DD0C
  1225. if (tPtrTextureData_D0.pType_0->prenderToTexture_44) // 0019DD0E
  1226. delete tPtrTextureData_D0.pType_0->prenderToTexture_44;
  1227. tPtrTextureData_D0.pType_0->prenderToTexture_44 =
  1228. r4_prenderToTexture;
  1229. break;
  1230. }
  1231. case 12: {
  1232. // loc_19DD1C
  1233. LOGE("case 12");
  1234. for (uchar r5_uc = 0; r5_uc != 0x20; r5_uc++) {
  1235. // loc_19DD22
  1236. if (r5_uc <= 4) {
  1237. // 0019DD26
  1238. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r5_uc].Setup(
  1239. ECrowdMemberType_0, r5_uc);
  1240. } else {
  1241. // loc_19DD32
  1242. if (r5_uc <= 9) {
  1243. // /0019DD3C
  1244. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r5_uc].Setup(
  1245. ECrowdMemberType_1, r5_uc - 0x5);
  1246. } else {
  1247. // loc_19DD44
  1248. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r5_uc].Setup(
  1249. ECrowdMemberType_2, r5_uc - 0xa);
  1250. }
  1251. }
  1252. }
  1253. // 0019DD5A
  1254. for (int r1_i = 0; r1_i != 0x20; r1_i++) {
  1255. // loc_19DD60
  1256. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r1_i]
  1257. .m_cVec32_ADC.float_0 = 0;
  1258. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r1_i]
  1259. .m_cVec32_ADC.float_4 = 0;
  1260. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r1_i]
  1261. .m_cVec32_ADC.float_8 = 0;
  1262. }
  1263. // 0019DD7C
  1264. // sp48 dword_2FF0C8
  1265. // sp38=unk_2FF157
  1266. // r11=byte_2FF148
  1267. // loc_19DE22
  1268. for (int r9_i = 0; r9_i != 0x20; r9_i++) {
  1269. // loc_19DD9C
  1270. int r6_i = dword_2FF0C8[r9_i];
  1271. uchar r10_uc = XSYS_RandomNoSync(byte5_2FF148[r6_i].b_0);
  1272. uchar r4_uc = XSYS_RandomNoSync(byte5_2FF148[r6_i].b_1);
  1273. uchar r0_uc = XSYS_RandomNoSync(byte5_2FF148[r6_i].b_2);
  1274. const uchar *r5_puc = &byte_2FF157[r6_i * 60];
  1275. tPtrTextureData_D0.pType_0->buff_68[r9_i][1] =
  1276. r5_puc[r4_uc + 0xc];
  1277. tPtrTextureData_D0.pType_0->buff_68[r9_i][0] = r5_puc[r10_uc];
  1278. tPtrTextureData_D0.pType_0->buff_68[r9_i][2] =
  1279. r5_puc[r0_uc + 0x18];
  1280. r4_uc = XSYS_RandomNoSync(byte5_2FF148[r6_i].b_3);
  1281. r0_uc = XSYS_RandomNoSync(byte5_2FF148[r6_i].b_4);
  1282. tPtrTextureData_D0.pType_0->buff_68[r9_i][3] =
  1283. r5_puc[r4_uc + 0x24];
  1284. tPtrTextureData_D0.pType_0->buff_68[r9_i][4] =
  1285. r5_puc[r0_uc + 0x30];
  1286. }
  1287. // 0019DE28
  1288. // sp38=0 lr r8 r1
  1289. // r12=tPtrTextureData_D0
  1290. // r0 tPtrTextureData_D0.pType_0.2970
  1291. // loc_19DEDA
  1292. // check 寻址
  1293. ushort us_sp38 = 0;
  1294. for (int r8_i = 0; r8_i != 0x20; r8_i++) {
  1295. // loc_19DE40
  1296. // r10 = tPtrTextureData_D0.pType_0->buf_2950[r8_i]
  1297. uchar r3_uc = 0;
  1298. int r9_i = dword_2FF0C8[r8_i];
  1299. tPtrTextureData_D0.pType_0->uc_2950[r8_i] = 0;
  1300. // loc_19DEC6
  1301. for (int r2_i = 0; r2_i != 5; r2_i++) {
  1302. // loc_19DE5A
  1303. if (byte_2FF157[r9_i * 5 + r2_i]) {
  1304. // 0019DE66
  1305. TGfxCrowdState::uSpan[r8_i][r2_i].b_0 = r3_uc;
  1306. uchar r6_uc = dword_462764[tPtrTextureData_D0.pType_0
  1307. ->buff_68[r8_i][r2_i]]
  1308. .filed_4;
  1309. TGfxCrowdState::uSpan[r8_i][r2_i].b_1 = r6_uc + r3_uc;
  1310. // check uxtab
  1311. uint r1_u = r6_uc + r3_uc;
  1312. // loc_19DEA0
  1313. // check 这里
  1314. while (r3_uc < r1_u) {
  1315. // loc_19DE9C
  1316. // check
  1317. tPtrTextureData_D0.pType_0->buf_2970[r8_i][r3_uc] = r2_i;
  1318. r3_uc++;
  1319. }
  1320. // 0019DEA4
  1321. tPtrTextureData_D0.pType_0->uc_2950[r8_i] += r6_uc ;
  1322. r3_uc=r1_u;
  1323. } else {
  1324. // loc_19DEB2
  1325. TGfxCrowdState::uSpan[r8_i][r2_i].b_0 = 0;
  1326. TGfxCrowdState::uSpan[r8_i][r2_i].b_1 = 0;
  1327. }
  1328. }
  1329. // 0019DECA
  1330. us_sp38++;
  1331. }
  1332. // 0019DEE0
  1333. // r2=tPtrTextureData_D0.pType_0->buf_2970
  1334. // r11=tPtrTextureData_D0
  1335. // r10=tPtrTextureData_D0.pType_0.94e
  1336. // sp40=TGfxCrowdState::uSpan
  1337. // loc_19E092
  1338. for (int r5_i = 0; r5_i != 0x20; r5_i++) {
  1339. // loc_19DF34
  1340. // sp48=tPtrTextureData_D0.pType_0->buf_2950[r5_i]
  1341. // sp34=r10=tPtrTextureData_D0.pType_0.94e
  1342. // sp44=r2=tPtrTextureData_D0.pType_0->buf_2970
  1343. // loc_19DF4C
  1344. // r3=r10=tPtrTextureData_D0.pType_0.94e
  1345. for (int r9_u = 0;
  1346. r9_u < tPtrTextureData_D0.pType_0->uc_2950[r5_i]; r9_u++) {
  1347. // 0019DF56
  1348. // check 寻址以及r4_uc
  1349. uchar r0_uc = tPtrTextureData_D0.pType_0->buf_2970[r5_i][r9_u];
  1350. uchar r4_uc = tPtrTextureData_D0.pType_0->buff_68[r5_i][r0_uc];
  1351. tPtrTextureData_D0.pType_0->buff_94c[r5_i][r9_u].b_0 = r4_uc;
  1352. ushort r1_us = GetAnim(r4_uc)->filed_4;
  1353. uint r0_u;
  1354. if (TGfxCrowdState::uSpan[r5_i][r0_uc].b_0 == r9_u) {
  1355. // 0019DF90
  1356. // sp3c=tPtrTextureData_D0.pType_0.94e
  1357. if ((dword_462764[r4_uc].filed_5 |
  1358. dword_462764[r4_uc].filed_6) == 0) {
  1359. // 0019DFAE
  1360. if (dword_462764[r4_uc].filed_7 == 0) {
  1361. // 0019DFB2
  1362. if (dword_462764[r4_uc].filed_8) {
  1363. // loc_19DFBA
  1364. r0_u =
  1365. XSYS_RandomNoSync(1 - dword_462764[r4_uc].filed_5);
  1366. } else {
  1367. // loc_19E05A
  1368. // check continue
  1369. int r10_i = XSYS_RandomNoSync(r1_us);
  1370. tPtrTextureData_D0.pType_0->buff_94c[r5_i][r9_u].us_2 =
  1371. r10_i;
  1372. r10_i += XSYS_RandomNoSync(r1_us);
  1373. tPtrTextureData_D0.pType_0
  1374. ->buff_94c[r5_i]
  1375. [TGfxCrowdState::uSpan[r5_i][r0_uc].b_1]
  1376. .us_2 = r10_i;
  1377. continue;
  1378. }
  1379. } else {
  1380. // loc_19DFBA
  1381. r0_u = XSYS_RandomNoSync(1 - dword_462764[r4_uc].filed_5);
  1382. // 0019DFC6
  1383. }
  1384. } else {
  1385. // loc_19DFBC
  1386. r0_u = XSYS_RandomNoSync(dword_462764[r4_uc].filed_6 +
  1387. (1 - dword_462764[r4_uc].filed_5));
  1388. // 0019DFC6
  1389. }
  1390. // 0019DFC6
  1391. // check
  1392. tPtrTextureData_D0.pType_0->buff_94c[r5_i][r9_u].us_2 =
  1393. r0_u + dword_462764[r4_uc].filed_5;
  1394. // check
  1395. r0_u = XSYS_RandomNoSync(dword_462764[r4_uc].filed_8 +
  1396. (1 - dword_462764[r4_uc].filed_7));
  1397. tPtrTextureData_D0.pType_0
  1398. ->buff_94c[r5_i][TGfxCrowdState::uSpan[r5_i][r0_uc].b_1]
  1399. .us_2 = r0_u + dword_462764[r4_uc].filed_7;
  1400. } else {
  1401. // loc_19DFF4
  1402. float s0_f = TGfxCrowdState::uSpan[r5_i][r0_uc].b_1 -
  1403. TGfxCrowdState::uSpan[r5_i][r0_uc].b_0;
  1404. float s2_f = r9_u - TGfxCrowdState::uSpan[r5_i][r0_uc].b_0;
  1405. ushort r2_us =
  1406. tPtrTextureData_D0.pType_0
  1407. ->buff_94c[r5_i]
  1408. [TGfxCrowdState::uSpan[r5_i][r0_uc].b_0]
  1409. .us_2;
  1410. ushort r0_us =
  1411. tPtrTextureData_D0.pType_0
  1412. ->buff_94c[r5_i]
  1413. [TGfxCrowdState::uSpan[r5_i][r0_uc].b_1]
  1414. .us_2;
  1415. // check 这里一堆的数据类型转换
  1416. float s4_f = r2_us;
  1417. s0_f = s2_f / s0_f;
  1418. s2_f = r0_us - r2_us;
  1419. s4_f = s4_f + s0_f * s2_f;
  1420. // check 取余函数 以及寻址
  1421. tPtrTextureData_D0.pType_0->buff_94c[r5_i][r9_u].us_2 =
  1422. (uint)s4_f % r1_us;
  1423. }
  1424. // loc_19E052
  1425. }
  1426. // loc_19E086
  1427. }
  1428. // 0019E098
  1429. // check uxth
  1430. // uint u_sp34=(ushort)us_sp38;
  1431. FTTVector<TShot> vectoeShot_sp78;
  1432. vectoeShot_sp78.Resize(us_sp38);
  1433. // r5=tPtrTextureData_D0.pType_0.94c
  1434. // r10=f4
  1435. // loc_19E192
  1436. // r2=0
  1437. uint r2_u = 0;
  1438. for (int r0_i = 0; r0_i != 0x20; r0_i++) {
  1439. // loc_19E0C4
  1440. // sp44=tPtrTextureData_D0.pType_0->buf_2950[r0_i]
  1441. // sp38=r5=tPtrTextureData_D0.pType_0.94c
  1442. // sp3c=r10=tPtrTextureData_D0.pType_0.f4
  1443. // uint r8_u=r2_u;
  1444. for (uint r11_u = 0;
  1445. r11_u < tPtrTextureData_D0.pType_0->uc_2950[r0_i]; r11_u++) {
  1446. /// loc_19E0DE
  1447. // sp48=r2
  1448. // check 94c 寻址
  1449. TSATAnim_TSX *r4_panim =
  1450. GetAnim(tPtrTextureData_D0.pType_0->buff_94c[r0_i][r11_u].b_0);
  1451. TSATAnim_TSX *r3_plegAnim = GetLegAnim(
  1452. tPtrTextureData_D0.pType_0->buff_94c[r0_i][r11_u].b_0);
  1453. CFTTMatrix32 mat_spd0 =
  1454. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r0_i]
  1455. .Animate(
  1456. r4_panim, r3_plegAnim,
  1457. tPtrTextureData_D0.pType_0->buff_94c[r0_i][r11_u].us_2);
  1458. // 0019E10E
  1459. CFTTVector32 vector32_sp120;
  1460. vector32_sp120.float_0 = 0.100000001f;
  1461. vector32_sp120.float_4 = 0.150000006f;
  1462. vector32_sp120.float_8 = 0.100000001f;
  1463. // CFTTMatrix32 结构体应该是包含TAABB结构 这里先不改
  1464. ((TAABB *)&mat_spd0)->Inflate(vector32_sp120);
  1465. data_d8[r0_i][r11_u].f_0 = mat_spd0.d[0][0];
  1466. data_d8[r0_i][r11_u].f_4 = mat_spd0.d[0][1];
  1467. // check
  1468. data_d8[r0_i][r11_u].f_8 = mat_spd0.d[0][3];
  1469. data_d8[r0_i][r11_u].f_C = mat_spd0.d[0][1];
  1470. data_d8[r0_i][r11_u].f_10 = mat_spd0.d[0][0];
  1471. data_d8[r0_i][r11_u].f_1C = mat_spd0.d[1][0];
  1472. data_d8[r0_i][r11_u].f_14 = mat_spd0.d[1][0];
  1473. data_d8[r0_i][r11_u].f_18 = mat_spd0.d[0][3];
  1474. vectoeShot_sp78.list_0[r2_u].b_0 = r11_u;
  1475. vectoeShot_sp78.list_0[r2_u].b_1 = r0_i;
  1476. vectoeShot_sp78.list_0[r2_u].f_4 = mat_spd0.d[0][0];
  1477. vectoeShot_sp78.list_0[r2_u].f_8 = mat_spd0.d[0][1];
  1478. vectoeShot_sp78.list_0[r2_u].f_C = mat_spd0.d[0][2];
  1479. vectoeShot_sp78.list_0[r2_u].f_10 = mat_spd0.d[0][3];
  1480. vectoeShot_sp78.list_0[r2_u].f_14 = mat_spd0.d[1][0];
  1481. vectoeShot_sp78.list_0[r2_u].f_18 = mat_spd0.d[1][1];
  1482. //vectoeShot_sp78
  1483. r2_u++;
  1484. }
  1485. // 0019E17E
  1486. }
  1487. // 0019E196
  1488. FTTVector<TShot>::Iterator vectorIt_sp70;
  1489. vectorIt_sp70.list_4 = vectoeShot_sp78.list_0;
  1490. FTTVector<TShot>::Iterator vectorIt_sp68;
  1491. vectorIt_sp68.list_4 =
  1492. vectoeShot_sp78.use_count_C + vectoeShot_sp78.list_0;
  1493. // check 函数符号以及传参是否使用了栈
  1494. FTTALG::Quicksort<SortShots,FTTVector<TShot>::Iterator>(vectorIt_sp70, vectorIt_sp68);
  1495. FTTAtlasGenerator *r6_pGenerator =
  1496. new FTTAtlasGenerator(0x800, 0x800, 0x800);
  1497. tPtrTextureData_D0.pType_0->mpFTTAtlasGenerator_194C =
  1498. r6_pGenerator;
  1499. float s16_f = us_sp38;
  1500. float s18_f = 80.0f;
  1501. // S20=0.25f s22=-10.0f s18=80.0f s24=0.5f s19=0.00048828125f
  1502. // r0=1950 s26=-5.0f s28=0.75f s30=-1.0f s17=-2.0f
  1503. // r5 r10 =0
  1504. // r9=tPtrTextureData_D0.pType_0.1950
  1505. // for(uint r10_u=0;r10_u<u_sp34;)
  1506. // loc_19E21C
  1507. uint r5_u = 0;
  1508. int r10_i = 0;
  1509. // loc_19E2EA check 符号
  1510. while (r10_i < us_sp38) {
  1511. // 0019E2F0
  1512. int r1_i = s18_f * (vectoeShot_sp78.list_0[r5_u].f_10 -
  1513. vectoeShot_sp78.list_0[r5_u].f_4);
  1514. int r2_i = s18_f * (vectoeShot_sp78.list_0[r5_u].f_14 -
  1515. vectoeShot_sp78.list_0[r5_u].f_8);
  1516. FTTAtlasGeneratorNode *r0_node =
  1517. tPtrTextureData_D0.pType_0->mpFTTAtlasGenerator_194C.pType_0
  1518. ->Insert(r1_i, r2_i);
  1519. // 0019E32C check
  1520. tPtrTextureData_D0.pType_0
  1521. ->buf_1950[vectoeShot_sp78.list_0[r5_u].b_1]
  1522. [vectoeShot_sp78.list_0[r5_u].b_0] = r0_node;
  1523. if (tPtrTextureData_D0.pType_0
  1524. ->buf_1950[vectoeShot_sp78.list_0[r5_u].b_1]
  1525. [vectoeShot_sp78.list_0[r5_u].b_0] == 0) {
  1526. // 0019E34A
  1527. tPtrTextureData_D0.pType_0->mpFTTAtlasGenerator_194C.pType_0
  1528. ->Clear();
  1529. float s0_f = (float)r10_i / s16_f;
  1530. float s2_f = -10.0f;
  1531. if (s0_f >= 0.25f) {
  1532. // 0019E36C
  1533. s2_f = -5.0f;
  1534. if (s0_f >= 0.5f) {
  1535. // 0019E37A
  1536. s2_f = - 1.0f;
  1537. if (s0_f < 0.75f) {
  1538. s2_f = - 2.0f;
  1539. }
  1540. }
  1541. }
  1542. // loc_19E38C
  1543. s18_f += s2_f;
  1544. } else {
  1545. // loc_19E23C
  1546. int r3_i = tPtrTextureData_D0.pType_0
  1547. ->buf_1950[vectoeShot_sp78.list_0[r5_u].b_1]
  1548. [vectoeShot_sp78.list_0[r5_u].b_0]
  1549. ->field_C;
  1550. int r12_i = tPtrTextureData_D0.pType_0
  1551. ->buf_1950[vectoeShot_sp78.list_0[r5_u].b_1]
  1552. [vectoeShot_sp78.list_0[r5_u].b_0]
  1553. ->field_10;
  1554. int lr_i = tPtrTextureData_D0.pType_0
  1555. ->buf_1950[vectoeShot_sp78.list_0[r5_u].b_1]
  1556. [vectoeShot_sp78.list_0[r5_u].b_0]
  1557. ->field_14;
  1558. int r11_i = tPtrTextureData_D0.pType_0
  1559. ->buf_1950[vectoeShot_sp78.list_0[r5_u].b_1]
  1560. [vectoeShot_sp78.list_0[r5_u].b_0]
  1561. ->field_18;
  1562. data_d8[vectoeShot_sp78.list_0[r5_u].b_1]
  1563. [vectoeShot_sp78.list_0[r5_u].b_0]
  1564. .f_20 = (float)r3_i * 0.00048828125f;
  1565. data_d8[vectoeShot_sp78.list_0[r5_u].b_1]
  1566. [vectoeShot_sp78.list_0[r5_u].b_0]
  1567. .f_24 = (float)(r3_i + lr_i) * 0.00048828125f;
  1568. data_d8[vectoeShot_sp78.list_0[r5_u].b_1]
  1569. [vectoeShot_sp78.list_0[r5_u].b_0]
  1570. .f_28 = (float)r2_i * 0.00048828125f;
  1571. data_d8[vectoeShot_sp78.list_0[r5_u].b_1]
  1572. [vectoeShot_sp78.list_0[r5_u].b_0]
  1573. .f_2C = (float)(r12_i + r11_i + 4) * 0.00048828125f;
  1574. r10_i++;
  1575. r5_u++;
  1576. continue;
  1577. }
  1578. // loc_19E21C
  1579. r5_u = 0;
  1580. r10_i = 0;
  1581. }
  1582. break;
  1583. }
  1584. case 13: {
  1585. // loc_19E3B0
  1586. LOGE("case 13");
  1587. CFTTClearSettings clearSetting_sp120 = g_tBlankCanvasClearSettings;
  1588. clearSetting_sp120.dRGBA_8 = 0xFFFFFF;
  1589. tPtrTextureData_D0.pType_0->prenderToTexture_44
  1590. ->BeginRenderToTexture(clearSetting_sp120);
  1591. // 0019E3EC
  1592. CFTTCamera::SetOrthographic(1.0f, 20.0f, 2.0f, 0, -1.0f, 1.0f);
  1593. CFTTVector32 vector32_spd0;
  1594. vector32_spd0.float_0 = 0;
  1595. vector32_spd0.float_4 = 0;
  1596. vector32_spd0.float_8 = -10.0f;
  1597. CFTTCamera::SetPosition(vector32_spd0);
  1598. vector32_spd0.float_0 = 0;
  1599. vector32_spd0.float_4 = 0;
  1600. vector32_spd0.float_8 = 1.0f;
  1601. CFTTCamera::SetDirection(vector32_spd0, 0);
  1602. CFTTCamera::SetViewport(0x800, 0x800, 0);
  1603. CFTTCamera::ApplyCameraSettings();
  1604. g_pGraphicsDevice->setDepthTest(EFTTDepthTest_8, true);
  1605. // s18=1.0f r6=sp50 s20=-1.0f s16=0.00048828125f
  1606. // r5=r11=tPtrTextureData_D0.pType_0
  1607. // sp44=sp5c
  1608. // sp3c=GFXPLAYER_pBatch
  1609. // loc_19E5DE
  1610. for (int r9_i = 0; r9_i != 0x20; r9_i++) {
  1611. // loc_19E46A
  1612. GFXPLAYER_pBatch->Begin();
  1613. // r5=tPtrTextureData_D0.pType_0->buff_94c[r9_i]
  1614. for (int r8_u = 0; tPtrTextureData_D0.pType_0->uc_2950[r9_i];
  1615. r8_u++) {
  1616. // loc_19E484
  1617. TSATAnim_TSX *r4_panim = GetAnim(
  1618. tPtrTextureData_D0.pType_0->buff_94c[r9_i][r8_u].b_0);
  1619. TSATAnim_TSX *r3_panim = GetLegAnim(
  1620. tPtrTextureData_D0.pType_0->buff_94c[r9_i][r8_u].b_0);
  1621. CFTTMatrix32 mat_sp50 =
  1622. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r9_i]
  1623. .Animate(
  1624. r4_panim, r3_panim,
  1625. tPtrTextureData_D0.pType_0->buff_94c[r9_i][r8_u]
  1626. .us_2);
  1627. vector32_spd0.float_0 = 0.100000001f;
  1628. vector32_spd0.float_4 = 0.300000012f;
  1629. vector32_spd0.float_8 = 0.100000001f;
  1630. ((TAABB *)&mat_sp50)->Inflate(vector32_spd0);
  1631. // 0019E4C4
  1632. int r1_i =
  1633. tPtrTextureData_D0.pType_0->buf_1950[r9_i][r8_u]->field_C;
  1634. int r2_i =
  1635. tPtrTextureData_D0.pType_0->buf_1950[r9_i][r8_u]->field_10;
  1636. int r3_i =
  1637. tPtrTextureData_D0.pType_0->buf_1950[r9_i][r8_u]->field_14;
  1638. int r0_i =
  1639. tPtrTextureData_D0.pType_0->buf_1950[r9_i][r8_u]->field_18;
  1640. float s6_f = r1_i;
  1641. float s4_f = r2_i;
  1642. float s0_f = r0_i + r2_i;
  1643. float s2_f = r3_i + r1_i;
  1644. float s24_f = s0_f * 0.00048828125f;
  1645. float s22_f = s2_f * 0.00048828125f;
  1646. float s28_f = s4_f * 0.00048828125f;
  1647. float s26_f = s6_f * 0.00048828125f;
  1648. if (g_pGraphicsDevice->Matrices_FlipsRTT() ||
  1649. g_pGraphicsDevice->Matrices_FlipsY()) {
  1650. // loc_19E51E
  1651. s24_f = 1.0f - s24_f;
  1652. s28_f = 1.0f - s28_f;
  1653. }
  1654. // loc_19E526
  1655. s4_f = s24_f + s24_f;
  1656. s6_f = s22_f + s22_f;
  1657. s0_f = s28_f + s28_f;
  1658. s2_f = s26_f + s26_f;
  1659. CFTTVector32 vector_sp114;
  1660. vector_sp114.float_8 = 0;
  1661. mat_sp50.d[0][2]=0;
  1662. mat_sp50.d[1][1]=20.0f;
  1663. // sp64= 20f
  1664. s4_f = s4_f - 1.0f;
  1665. s6_f = s6_f - 1.0f;
  1666. s0_f = s0_f - 1.0f;
  1667. s2_f = s2_f - 1.0f;
  1668. CFTTVector32 vector_spc4;
  1669. vector_spc4.float_0 = s6_f;
  1670. vector_spc4.float_4 = s4_f;
  1671. vector_spc4.float_8 = 1.0f;
  1672. vector_sp114.float_0 = s2_f;
  1673. vector_sp114.float_4 = s0_f;
  1674. CFTTMatrix32 mat32_spd0;
  1675. sub_19ED8C(mat32_spd0, (CFTTVector32 *)&mat_sp50,
  1676. (CFTTVector32 *)&mat_sp50.d[0][3], &vector_sp114,
  1677. &vector_spc4);
  1678. CFTTShaderBuiltInConstants::SetViewMatrix(
  1679. CFTTMatrix32::s_matIdentity);
  1680. CFTTShaderBuiltInConstants::SetProjMatrix(
  1681. CFTTMatrix32::s_matIdentity);
  1682. // 0019E58C
  1683. CFTTMatrix32 mat32_sp78;
  1684. MatrixMultiply(&mat32_sp78, &mat32_spd0,
  1685. &CFTTCamera::s_matView);
  1686. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r9_i].Render(
  1687. &mat32_sp78);
  1688. }
  1689. // 0019E5BE
  1690. GFXPLAYER_pBatch->End();
  1691. CGfxPlayer::FlushPlayerSkins();
  1692. GFXPLAYER_pBatch->ResetCache(false);
  1693. }
  1694. // 0019E5E6
  1695. tPtrTextureData_D0.pType_0->prenderToTexture_44->EndRenderToTexture(
  1696. EFTTRTTCopyMode_0);
  1697. GFXPLAYER_pBatch->cfttbmmmatrixcache_0.field_20 = 1;
  1698. break;
  1699. }
  1700. case 14: {
  1701. // loc_19E602
  1702. LOGE("case 14");
  1703. CFTTRenderToTexture *r4_prenderToTexture =
  1704. g_pGraphicsDevice->createRenderToTexture(
  1705. EFTTTexFormat_2, 0x400, 0x400, 0x1, 0, EFTTRTTZBufMode_1,
  1706. false, EFTTTextureType_0, 1);
  1707. CFTTRenderToTexture *prenderToTexture_sp44 =
  1708. g_pGraphicsDevice->createRenderToTexture(
  1709. EFTTTexFormat_2, 0x400, 0x400, 0x1, 0, EFTTRTTZBufMode_1,
  1710. false, EFTTTextureType_0, 1);
  1711. CFTTRenderToTexture *r9_prenderToTexture =
  1712. g_pGraphicsDevice->createRenderToTexture(
  1713. EFTTTexFormat_2, 0x400, 0x400, 0x1, 0, EFTTRTTZBufMode_1,
  1714. false, EFTTTextureType_0, 1);
  1715. r4_prenderToTexture->BeginRenderToTexture(
  1716. g_tBlankCanvasClearSettings);
  1717. FTT2D_Begin();
  1718. FTT2D_SetDefaultMatBlend(EFTT2D_Blend_5);
  1719. FTT2D_SetTexture(
  1720. tPtrTextureData_D0.pType_0->prenderToTexture_44->GetTexture(),
  1721. 0);
  1722. FTT2D_DrawTexturedRect(0, 0, 1024.0f, 1024.0f, -1, 0, -999999.0f,
  1723. -999999.0f);
  1724. FTT2D_End();
  1725. r4_prenderToTexture->EndRenderToTexture(EFTTRTTCopyMode_0);
  1726. // 0019E6CE
  1727. CFTTVector32x4 vector32x4_spd0;
  1728. vector32x4_spd0.my[0] = 1.0f;
  1729. vector32x4_spd0.my[1] = 1.0f;
  1730. vector32x4_spd0.my[2] = 1.0f;
  1731. vector32x4_spd0.my[3] = 0;
  1732. CGaussianNewShader::s_tInstance.SetColourMultiplier(
  1733. vector32x4_spd0);
  1734. // sp3c=r9
  1735. GaussianBlur(r4_prenderToTexture, r9_prenderToTexture,
  1736. prenderToTexture_sp44, 2.0f,
  1737. tPtrTextureData_D0.pType_0->miCFTTMaterialIndex_0,
  1738. true, true);
  1739. FTT2D_Begin();
  1740. FTT2D_SetTexture(r4_prenderToTexture->GetTexture(), 0);
  1741. FTT2D_DrawTexturedRect(0, 0, 1024.0f, 1024.0f, -1, 0, -999999.0f,
  1742. -999999.0f);
  1743. FTT2D_SetDefaultMatBlend(EFTT2D_Blend_7);
  1744. // sp40=r4
  1745. // s16=2.5f s18=192.0f s20=64.0f s22=255.0f
  1746. // sp48=r11=tPtrTextureData_D0.pType_0
  1747. // loc_19E8B8
  1748. for (int r10_i = 0; r10_i != 0x20; r10_i++) {
  1749. // loc_19E754
  1750. // r8=tPtrTextureData_D0.pType_0.2950[r10_i]
  1751. for (uint r9_u = 0;
  1752. r9_u < tPtrTextureData_D0.pType_0->uc_2950[r10_i]; r9_u++) {
  1753. // loc_19E7A8
  1754. TSATAnim_TSX *r5_panim = GetAnim(
  1755. tPtrTextureData_D0.pType_0->buff_94c[r10_i][r9_u].b_0);
  1756. TSATAnim_TSX *r3_panim = GetLegAnim(
  1757. tPtrTextureData_D0.pType_0->buff_94c[r10_i][r9_u].b_0);
  1758. CFTTMatrix32 mat32_spd0 =
  1759. tPtrTextureData_D0.pType_0->pmembers_34.pType_0[r10_i]
  1760. .Animate(
  1761. r5_panim, r3_panim,
  1762. tPtrTextureData_D0.pType_0->buff_94c[r10_i][r9_u]
  1763. .us_2);
  1764. CFTTVector32 vector_sp78;
  1765. vector_sp78.float_0 = 0.100000001f;
  1766. vector_sp78.float_4 = 0.300000012f;
  1767. vector_sp78.float_8 = 0.100000001f;
  1768. ((TAABB *)&mat32_spd0)->Inflate(vector_sp78);
  1769. // 0019E7F2
  1770. float s0_f = mat32_spd0.d[1][0] / 2.5f;
  1771. int r0_i =
  1772. tPtrTextureData_D0.pType_0->buf_1950[r10_i][r9_u]->field_C /
  1773. 2;
  1774. int r1_i =
  1775. 0x400 - tPtrTextureData_D0.pType_0->buf_1950[r10_i][r9_u]
  1776. ->field_10 /
  1777. 2;
  1778. int r2_i = tPtrTextureData_D0.pType_0->buf_1950[r10_i][r9_u]
  1779. ->field_14 /
  1780. 2;
  1781. //s8=r3
  1782. int r3_i = 0 - tPtrTextureData_D0.pType_0->buf_1950[r10_i][r9_u]
  1783. ->field_18 /
  1784. 2;
  1785. float s10_f = 64.0f + s0_f * 192.0f;
  1786. float s2_f = r0_i;
  1787. float s8_f = r3_i;
  1788. float s4_f = r1_i;
  1789. float s6_f = r2_i;
  1790. s0_f = 255.0f;
  1791. if (s10_f < 255.0f) {
  1792. s0_f = s10_f;
  1793. }
  1794. uint r5_u = s0_f;
  1795. r5_u =
  1796. ((r5_u | (r5_u * 0x100)) | (r5_u * 0x10000)) | 0xFF000000;
  1797. FTT2D_DrawRect4(s2_f, s4_f, s6_f, s8_f, 0xFF404040, 0xFF404040,
  1798. r5_u, r5_u, 0, -999999.0f, -999999.0f);
  1799. }
  1800. // 0019E8AA
  1801. }
  1802. // 0019E8C0
  1803. FTT2D_End();
  1804. CFTTTexture *r4_ptexture =
  1805. r9_prenderToTexture->EndRenderToTexture(EFTTRTTCopyMode_2);
  1806. if (ptexture_A4) {
  1807. // 0019E8DA
  1808. delete ptexture_A4;
  1809. }
  1810. // loc_19E8E0
  1811. ptexture_A4 = r4_ptexture;
  1812. switch (GFXSPEC_pSpecification->eCrowdQuality_4C) {
  1813. case 1:
  1814. case 2:
  1815. case 3:
  1816. case 4:
  1817. // loc_19E8FE
  1818. // loc_19E96C
  1819. r4_ptexture->SetMinFilter(EFTTTex_MinFilter_5);
  1820. break;
  1821. default:
  1822. // 0019E968
  1823. // loc_19E96C
  1824. r4_ptexture->SetMinFilter(EFTTTex_MinFilter_4);
  1825. break;
  1826. }
  1827. // 0019E972
  1828. CFTTTexParam parm;
  1829. // check 这里传参
  1830. parm.setTexture(ptexture_A4);
  1831. CCrowdNewShader::s_tInstance.SetDiffuse(parm,
  1832. dCrowdNewShaderID_CBBC[2]);
  1833. if (tPtrTextureData_D0.pType_0->prenderToTexture_44) {
  1834. // 0019E994
  1835. delete tPtrTextureData_D0.pType_0->prenderToTexture_44;
  1836. }
  1837. // loc_19E99A
  1838. tPtrTextureData_D0.pType_0->prenderToTexture_44 = NULL;
  1839. delete r9_prenderToTexture;
  1840. // 0019E9A8
  1841. if (prenderToTexture_sp44) // 0019E9AA
  1842. delete prenderToTexture_sp44;
  1843. // loc_19E9B0
  1844. if (r4_prenderToTexture) // 0019E9B4
  1845. delete r4_prenderToTexture;
  1846. // loc_19E9BA
  1847. break;
  1848. }
  1849. default:
  1850. break;
  1851. }
  1852. }
  1853. break;
  1854. }
  1855. default:
  1856. break;
  1857. }
  1858. LOGE("end");
  1859. }
  1860. //-------------------------------------------------------------------------------------------------
  1861. // 0019F7E4 ^_^
  1862. void CGfxCrowd::Render() {
  1863. // LOGI("CGfxCrowd::Render 0019F7E4");
  1864. // if (aVec_8C[0].GetObj() == nullptr || pRender2Tex_9C == nullptr) { //
  1865. // 0019F7EC
  1866. // return;
  1867. // }
  1868. // // 0019F7F4
  1869. // g_pGraphicsDevice->setDepthTest(EFTTDepthTest_8, false);
  1870. // RenderSteward();
  1871. // RenderStatic();
  1872. // RenderDynamic();
  1873. // g_pGraphicsDevice->setDepthTest(EFTTDepthTest_8, true);
  1874. // // 0019F82A
  1875. // for (uint r5 = 0; r5 < vec_64.use_count_C; r5++) { // loc_19F838
  1876. // // loc_19F82C
  1877. // vec_64.GetObj()[r5].GetObj()->Render();
  1878. // }
  1879. // // 0019F83E
  1880. // for (uint r5 = 0; r5 < vec_78.use_count_C; r5++) { // loc_19F838
  1881. // // loc_19F82C
  1882. // vec_78.GetObj()[r5].GetObj()->Render();
  1883. // }
  1884. }
  1885. //-------------------------------------------------------------------------------------------------
  1886. // 0019F85C
  1887. void CGfxCrowd::RenderSteward() {
  1888. LOGX("CGfxCrowd::RenderSteward 0019F85C %p", this);
  1889. }
  1890. //-------------------------------------------------------------------------------------------------
  1891. // 0019F990
  1892. void CGfxCrowd::RenderStatic() {
  1893. LOGX("CGfxCrowd::RenderStatic 0019F990 %p", this);
  1894. }
  1895. //-------------------------------------------------------------------------------------------------
  1896. // 0019FCC8
  1897. void CGfxCrowd::RenderDynamic() {
  1898. LOGX("CGfxCrowd::RenderDynamic 0019FCC8 %p", this);
  1899. }
  1900. //-------------------------------------------------------------------------------------------------
  1901. // 001A101C
  1902. void CGfxCrowd::Process() { LOGI("CGfxCrowd::Process 001A101C"); }
  1903. //-------------------------------------------------------------------------------------------------
  1904. // 001A12C8 ^_^
  1905. void CGfxCrowd::GetCrowdState(float &f1, float &f2, float &f3) {
  1906. // f1 = tCrowd_C0EC[0].f_0;
  1907. // f2 = tCrowd_C0EC[4].f_0;
  1908. // f3 = tCrowd_C0EC[8].f_0;
  1909. }
  1910. //-------------------------------------------------------------------------------------------------
  1911. // 001A12E6 ^_^
  1912. int CGfxCrowd::GetCapacity() { return vec_0.use_count_C; }
  1913. //-------------------------------------------------------------------------------------------------
  1914. // 001A12EA ^_^
  1915. CrowdTextureCreationData *CGfxCrowd::GetTextureCreationData() {
  1916. return tPtrTextureData_D0.pType_0;
  1917. }
  1918. //-------------------------------------------------------------------------------------------------
  1919. // 001A12F0 ^_^
  1920. float CGfxCrowd::GetCrowdValue(ECrowdMemberType eType1) {
  1921. return f_CBC8[eType1];
  1922. }
  1923. //-------------------------------------------------------------------------------------------------
  1924. // 001A12FC ^_^
  1925. void CGfxCrowd::SetCrowdValue(ECrowdMemberType eType1, float f2) {
  1926. f_CBC8[eType1] = f2;
  1927. }
  1928. //-------------------------------------------------------------------------------------------------