CGfxCrowd.cpp 80 KB

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