CGfxCrowd.cpp 76 KB

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