CGfxCrowd.cpp 79 KB

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