123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496 |
- #include "CGFXFX.h"
- #include <algorithm>
- #include "CBall.h"
- #include "CFTT3dGenShader.h"
- #include "CFTTColour.h"
- #include "CFTTGraphicsDevice.h"
- #include "CFTTMaterialManager.h"
- #include "CFTTSphere32.h"
- #include "CFTTTextureCache.h"
- #include "CFTTTime.h"
- #include "CFTTVector32.h"
- #include "CGraphicsRewindEffect.h"
- #include "CGraphicsTexLoadOptions.h"
- #include "CLegacyLitShader.h"
- #include "FREE.h"
- #include "GFXCAMERA.h"
- #include "GM.h"
- #include "Matrix.h"
- #include "TGame.h"
- #include "XSYS.h"
- #include "memctrl.h"
- //#include "GFXCAMERA.h"
- #define BallPathSize 128
- CGraphicsRewindEffect *CGFXFX::ms_pRewindEffect;
- int CGFXFX::ms_iAdditiveMat = -1; // 0033EFBC
- int CGFXFX::ms_iModulateMat = -1; // 0033EFC0
- int CGFXFX::ms_iConfettiMat = -1; // 0033EFC4
- CFTTRenderHelper *CGFXFX::ms_pRenderHelperAdditive; // 003A4EE4
- CFTTRenderHelper *CGFXFX::ms_pRenderHelperModulate; // 003A4EE8
- CFTTRenderHelper *CGFXFX::ms_pRenderHelperConfetti; // 003A4EEC
- CFTTRenderHelper *CGFXFX::ms_pRenderHelperStrip; // 003A4EF0
- Particle CGFXFX::m_tParticle[0x2000]; // 003A4EF4 88 8192
- int CGFXFX::m_iNumActiveParticles; // 00454EF4
- TPoint3D CGFXFX::m_vBallPosPrev; // 00454EF8
- TPoint3D CGFXFX::m_vBallMovePrev; // 00454F04
- TPoint CGFXFX::ms_tFountainsInfo; // 00454F10
- int CGFXFX::ms_iSwirlTick; // 00454F18
- TPoint3D CGFXFX::m_vBallPath[BallPathSize]; // 00454F1C
- int CGFXFX::m_iBallPathSize; // 0045551C
- int CGFXFX::m_iBallPathStart; // 00455520
- int CGFXFX::m_iBallTrailCol; // 00455524
- TPoint CGFXFX::m_vSwipeScreen[0x100]; // 00455528
- int CGFXFX::m_iSwipeScreenSize; // 00455D28
- CFTTVector32 CGFXFX::m_vSwipePath[0x100]; // 00455D2C
- int CGFXFX::m_iSwipePathSize; // 0045692C
- int CGFXFX::m_iSwipeTime; // 00456930
- int CGFXFX::m_iSwipeCol; // 00456934
- bool CGFXFX::m_bEnableRender; // 00456938
- // CGFXFX::ms_pRewindEffect; //0045693C
- uint CGFXFX::ms_uGoldenBootEnabled; // 00456940
- uint CGFXFX::ms_uStarPlayerEnabled; /// 00456944
- static int list_rand_456948[1024]; // 00456948
- static int gs_i457948;
- char *gs_s_323118[8] = {"data/fx/circle0.png",
- "data/fx/flames.png",
- "data/fx/smoke.png",
- "data/fx/star1.png",
- "Data/models/SpecialFX/glare.bmp",
- "data/fx/star1.png",
- "Data/fx/confetti.png",
- "data/fx/star1.png"};
- //-------------------------------------------------------------------------------------------------
- // 00181AC8 -_- 经过单元测试,功能正常
- void CGFXFX::Init() {
- LOGI("CGFXFX::Init entry");
- LOGI("CGFXFX::Init end");
- }
- //-------------------------------------------------------------------------------------------------
- // 00181D48 //^_^
- void CGFXFX::Shutdown() {}
- //-------------------------------------------------------------------------------------------------
- // 00181E44
- void CGFXFX::Update(float) {}
- //-------------------------------------------------------------------------------------------------
- // 00181EB4
- void CGFXFX::ParticleLogicUpdate() {}
- //-------------------------------------------------------------------------------------------------
- // 00181FD0
- void CGFXFX::ParticleProcess() {}
- //-------------------------------------------------------------------------------------------------
- // 0018222C
- void CGFXFX::BallPathProcess() {}
- //-------------------------------------------------------------------------------------------------
- // 00182324
- void CGFXFX::BallEffectsProcess() {}
- //-------------------------------------------------------------------------------------------------
- // 0018274C
- void CGFXFX::SwipeUpdate() {}
- //-------------------------------------------------------------------------------------------------
- // 00182794 //^_^ 经过单元测试,功能正常
- void CGFXFX::Render2D() {
- // LOGI("CGFXFX::Render2D Entry");
- }
- //-------------------------------------------------------------------------------------------------
- // 001827B4
- void CGFXFX::Render() {}
- //-------------------------------------------------------------------------------------------------
- // 0018296C
- void CGFXFX::BallPathAddVerts(TFVF_PFLOAT_CINT_TFLOAT *&) {}
- //-------------------------------------------------------------------------------------------------
- // 00182BB0
- void CGFXFX::BallTrailAddVerts(TFVF_PFLOAT_CINT_TFLOAT *&) {}
- //-------------------------------------------------------------------------------------------------
- // 00182E5C
- void CGFXFX::SwipeAddVerts(TFVF_PFLOAT_CINT_TFLOAT *&) {}
- //-------------------------------------------------------------------------------------------------
- // 00183458
- void CGFXFX::ParticleRender() {
- float s16_f = 0.000030518f;
- // sp8=m_tParticle sp14=m_iNumActiveParticles sp10=cball sp18=sinf
- int r5_i = 0;
- // loc_183994
- while (r5_i != 8) {
- // loc_18348A
- RenderHelperConfetti_LockVerticesRet *r8_pv = 0;
- TFVF_PFLOAT_CINT_TFLOAT *r7_pv = 0;
- int r11_i = 0;
- TFVF_PFLOAT_CINT_TFLOAT *pv_sp1C = NULL;
- RenderHelperConfetti_LockVerticesRet *pv_spC = NULL;
- // loc_1838CC
- while (r11_i < m_iNumActiveParticles) {
- // /loc_1834A4
- if (m_tParticle[r11_i].eGFXFXParticle_0 == r5_i) {
- LOGE("CGFXFX::ParticleRender_1");
- int r0_i = 0;
- float s26_f = m_tParticle[r11_i].vector32_4.float_0;
- float s28_f = m_tParticle[r11_i].vector32_4.float_4;
- float s30_f = m_tParticle[r11_i].vector32_4.float_8;
- if ((r5_i & 0x7FFFFFFF) == 7 || (r5_i & 0x7FFFFFFF) == 1) {
- LOGE("CGFXFX::ParticleRender_2");
- float s0_f = cBall.ballPosPrev_4.point_0.dx_0;
- float s2_f = cBall.ballPosPrev_4.point_0.dy_4;
- float s4_f = cBall.ballPosPrev_4.dz_8;
- s30_f = s30_f + s2_f * s16_f;
- s28_f = s28_f + s4_f * s16_f;
- s26_f = s26_f - s0_f * s16_f;
- }
- // loc_1834EC
- float s24_f = m_tParticle[r11_i].f_38;
- float s17_f = m_tParticle[r11_i].f_3C;
- float s0_f = m_tParticle[r11_i].f_48;
- float s2_f = m_tParticle[r11_i].f_4C;
- s2_f -= s0_f;
- float s21_f = m_tParticle[r11_i].i_54 - m_tParticle[r11_i].i_50;
- float s23_f = m_tParticle[r11_i].i_54;
-
- s2_f *= s21_f;
- s2_f /= s23_f;
- s0_f += s2_f;
- sinf(s0_f);
- cosf(s0_f);
- sinf(s0_f);
- cosf(s0_f);
- float s29_f = sinf(s0_f);
- float s31_f = cosf(s0_f);
- float s19_f = GFXCAMERA_vCamUp.float_0;
- float s25_f = GFXCAMERA_vCamUp.float_4;
- float s27_f = GFXCAMERA_vCamUp.float_8;
- s0_f = s31_f * s19_f;
- s2_f = s31_f * s25_f;
- float s4_f = s31_f * s27_f;
- float s22_f = GFXCAMERA_vCamRight.float_0;
- float s18_f = GFXCAMERA_vCamRight.float_4;
- float s20_f = GFXCAMERA_vCamRight.float_8;
- s0_f = s0_f + s29_f * s22_f;
- s2_f = s2_f + s29_f * s18_f;
- s4_f = s4_f + s29_f * s20_f;
- CFTTVector32 v32_sp70;
- v32_sp70.float_0 = s0_f;
- v32_sp70.float_4 = s2_f;
- v32_sp70.float_8 = s4_f;
- s0_f = s17_f - s24_f;
- s0_f *= s21_f;
- s2_f = m_tParticle[r11_i].i_54 - m_tParticle[r11_i].i_50;
- s4_f = m_tParticle[r11_i].i_54;
- s0_f /= s23_f;
- s2_f /= s4_f;
- s24_f += s0_f;
- uint r1_u =
- XMixCol(m_tParticle[r11_i].u_40, m_tParticle[r11_i].u_44, s2_f);
- s0_f = 0.5f;
- s17_f = s24_f * s0_f;
- // 001835E8
- uint r6_platformU32 = g_pGraphicsDevice->ARGBToPlatformU32(r1_u);
- if (m_tParticle[r11_i].eGFXFXParticle_0 == EGFXFXParticle_6) {
- LOGE("CGFXFX::ParticleRender_3");
- // 001835F6
- s2_f = m_tParticle[r11_i].vector32_1C.float_0;
- float s6_f = 0.0f;
- s0_f = m_tParticle[r11_i].vector32_1C.float_4;
- // int r10_i = r5_i;
- s0_f = s0_f + s2_f * s6_f;
- s4_f = m_tParticle[r11_i].vector32_1C.float_8;
- s2_f = -1.0f;
- CFTTVector32 v32_sp64;
- v32_sp64.float_0 = 0;
- v32_sp64.float_4 = 1.0f;
- v32_sp64.float_8 = 0;
- s0_f = s0_f + s4_f * s6_f;
- if (s0_f == s2_f || s0_f == 1.0f) {
- // 0018363C
- LOGE("CGFXFX::ParticleRender_4");
- v32_sp64.float_4 = 0;
- v32_sp64.float_0 = 1.0f;
- v32_sp64.float_8 = 0;
- }
- // 00183648
- CFTTVector32 vec32_sp20 =
- CrossProduct(m_tParticle[r11_i].vector32_1C, v32_sp64);
- v32_sp70 = vec32_sp20;
- vec32_sp20 = CrossProduct(m_tParticle[r11_i].vector32_1C, v32_sp70);
- s18_f = vec32_sp20.float_0;
- s20_f = vec32_sp20.float_4;
- s22_f = vec32_sp20.float_8;
- s24_f = v32_sp70.float_0;
- s19_f = v32_sp70.float_4;
- s21_f = v32_sp70.float_8;
- CFTTMatrix32 mat32_sp20 = MakeVectorRotationMatrix32(
- m_tParticle[r11_i].vector32_28, m_tParticle[r11_i].f_34);
- VectorMatrixMultiply(&m_tParticle[r11_i].vector32_1C, &mat32_sp20);
- s0_f = s17_f * s22_f;
- s2_f = s17_f * s20_f;
- s4_f = s17_f * s18_f;
- s6_f = s17_f * s21_f;
- float s10_f = s17_f * s19_f;
- float s14_f = s17_f * s24_f;
- float s8_f = s30_f + s0_f;
- float s12_f = s28_f + s2_f;
- s2_f = s28_f - s2_f;
- float s1_f = s26_f + s4_f;
- s0_f = s30_f - s0_f;
- s4_f = s26_f - s4_f;
- s26_f = s8_f - s6_f;
- s28_f = s12_f - s10_f;
- s19_f = s2_f - s10_f;
- s30_f = s1_f - s14_f;
- s17_f = s0_f - s6_f;
- s21_f = s4_f - s14_f;
- s23_f = s8_f + s6_f;
- s25_f = s12_f + s10_f;
- s27_f = s1_f + s14_f;
- s29_f = s0_f + s6_f;
- s31_f = s2_f + s10_f;
- s24_f = s4_f + s14_f;
- if (m_tParticle[r11_i].eGFXFXParticle_0 == EGFXFXParticle_6) {
- LOGE("CGFXFX::ParticleRender_5");
- // r0_pv = pv_spC;
- if (pv_spC == NULL) {
-
- // LOGE("CGFXFX::ParticleRender_6");
- pv_spC = (RenderHelperConfetti_LockVerticesRet *)
- ms_pRenderHelperConfetti->LockVertices();
- r8_pv = pv_spC;
- }
- // loc_18371E
- // pv_spC = r0_pv;
- r8_pv->f_0 = s24_f;
- r8_pv->f_4 = s31_f;
- r8_pv->f_8 = s29_f;
- r8_pv->v32_C = m_tParticle[r11_i].vector32_1C;
- r8_pv->platformU32_18 = r6_platformU32;
- r8_pv->f_1C = 0;
- r8_pv->f_20 = 1.0f;
- r8_pv++;
- r8_pv->f_0 = s27_f;
- r8_pv->f_4 = s25_f;
- r8_pv->f_8 = s23_f;
- r8_pv->v32_C = m_tParticle[r11_i].vector32_1C;
- r8_pv->platformU32_18 = r6_platformU32;
- r8_pv->f_1C = 1.0f;
- r8_pv->f_20 = 1.0f;
- r8_pv++;
- r8_pv->f_0 = s21_f;
- r8_pv->f_4 = s19_f;
- r8_pv->f_8 = s17_f;
- r8_pv->v32_C = m_tParticle[r11_i].vector32_1C;
- r8_pv->platformU32_18 = r6_platformU32;
- r8_pv->f_1C = 0;
- r8_pv->f_20 = 0;
- r8_pv++;
- r8_pv->f_0 = s30_f;
- r8_pv->f_4 = s28_f;
- r8_pv->f_8 = s26_f;
- r8_pv->v32_C = m_tParticle[r11_i].vector32_1C;
- r8_pv->platformU32_18 = r6_platformU32;
- r8_pv->f_1C = 1.0f;
- r8_pv->f_20 = 0;
- r8_pv++;
- }
- }
- // RenderHelperConfetti_LockVerticesRet *r0_pv;
- else {
- // loc_1837B0
- LOGE("CGFXFX::ParticleRender_7");
- s0_f = s31_f * s20_f;
- float s6_f = v32_sp70.float_0;
- s2_f = s31_f * s18_f;
- float s8_f = v32_sp70.float_4;
- s4_f = s31_f * s22_f;
- float s10_f = v32_sp70.float_8;
- s8_f = s17_f * s8_f;
- s10_f = s17_f * s10_f;
- s6_f = s17_f * s6_f;
- s0_f = s0_f - s29_f * s27_f;
- s2_f -= s29_f * s25_f;
- s4_f -= s29_f * s19_f;
- s0_f = s17_f * s0_f;
- s2_f = s17_f * s2_f;
- s4_f = s17_f * s4_f;
- float s12_f = s30_f + s0_f;
- float s14_f = s28_f + s2_f;
- s2_f = s28_f - s2_f;
- float s1_f = s26_f + s4_f;
- s0_f = s30_f - s0_f;
- s4_f = s26_f - s4_f;
- s26_f = s12_f - s10_f;
- s28_f = s14_f - s8_f;
- s19_f = s2_f - s8_f;
- s30_f = s1_f - s6_f;
- s17_f = s0_f - s10_f;
- s21_f = s4_f - s6_f;
- s23_f = s12_f + s10_f;
- s25_f = s14_f + s8_f;
- s27_f = s1_f + s6_f;
- s29_f = s0_f + s10_f;
- s31_f = s2_f + s8_f;
- s24_f = s4_f + s6_f;
- }
- // loc_18385E
- if (pv_sp1C == NULL) {
- pv_sp1C = (TFVF_PFLOAT_CINT_TFLOAT *)
- ms_pRenderHelperAdditive->LockVertices();
- r7_pv = pv_sp1C;
- LOGE("CGFXFX::ParticleRender_8r7=%x", (uint)r7_pv);
- }
- // loc_183870
- r7_pv->positon_0.float_0 = s24_f;
- r7_pv->positon_0.float_4 = s31_f;
- r7_pv->positon_0.float_8 = s29_f;
- r7_pv->platformU32_C = r6_platformU32;
- r7_pv->f_10 = 0;
- r7_pv->f_14 = 1.0f;
- r7_pv++;
- r7_pv->positon_0.float_0 = s27_f;
- r7_pv->positon_0.float_4 = s25_f;
- r7_pv->positon_0.float_8 = s23_f;
- r7_pv->platformU32_C = r6_platformU32;
- r7_pv->f_10 = 1.0f;
- r7_pv->f_14 = 1.0f;
- r7_pv++;
- r7_pv->positon_0.float_0 = s21_f;
- r7_pv->positon_0.float_4 = s19_f;
- r7_pv->positon_0.float_8 = s17_f;
- r7_pv->platformU32_C = r6_platformU32;
- r7_pv->f_10 = 0;
- r7_pv->f_14 = 0;
- r7_pv++;
- r7_pv->positon_0.float_0 = s30_f;
- r7_pv->positon_0.float_4 = s28_f;
- r7_pv->positon_0.float_8 = s26_f;
- r7_pv->platformU32_C = r6_platformU32;
- r7_pv->f_10 = 1.0f;
- r7_pv->f_14 = 0;
- r7_pv++;
- }
- // loc_1838C4
- r11_i++;
- }
- // loc_1838CC
- // 001838D4
- if (pv_spC) {
- LOGE("CGFXFX::ParticleRender_9");
- CFTTTexture *r2_ptexture = CFTTTextureCache::GetTexture(
- gs_s_323118[r5_i], g_tGlobalTexLoadOptions.mTexLoadOptions_4, 1);
- // CFTTTexParam parm;
- // parm.tTexParamData_4.u_0.pTexture_0 = r2_ptexture;
- // parm.tTexParamData_4.field_4 = 0;
- CFTTTexParam parm(r2_ptexture);
- CLegacyLitShader::s_tInstance.SetTex1(parm, ms_iConfettiMat);
- int r1_count = r8_pv - pv_spC;
- ms_pRenderHelperConfetti->UnlockVertices(r1_count);
- ms_pRenderHelperConfetti->Render(NULL, -1, 0, -1);
- }
- // loc_183934
- if (pv_sp1C) {
- LOGE("CGFXFX::ParticleRender_10");
- CFTTTexture *r2_ptexture = CFTTTextureCache::GetTexture(
- gs_s_323118[r5_i], g_tGlobalTexLoadOptions.mTexLoadOptions_4, 1);
- // CFTTTexParam parm;
- // parm.tTexParamData_4.u_0.pTexture_0 = r2_ptexture;
- // parm.tTexParamData_4.field_4 = 0;
- CFTTTexParam parm(r2_ptexture);
- CFTT3dGenShader::s_tInstance.SetSampler00(parm, ms_iAdditiveMat);
- int r1_count = r7_pv - pv_sp1C;
- ms_pRenderHelperAdditive->UnlockVertices(r1_count);
- ms_pRenderHelperAdditive->Render(NULL, -1, 0, -1);
- }
- // loc_183992
- r5_i++;
- }
- // loc_183994
- }
- //-------------------------------------------------------------------------------------------------
- // 001839DC
- bool CGFXFX::ParticleSystemVisible(EGFXParticleSystemType) { return 0; }
- //-------------------------------------------------------------------------------------------------
- // 00183A20
- EGFXFXParticle CGFXFX::GetFirstParticleType() { return EGFXFXParticle_0; }
- //-------------------------------------------------------------------------------------------------
- // 00183A40
- void CGFXFX::ResetParticles() {}
- //-------------------------------------------------------------------------------------------------
- // 00183A50
- void CGFXFX::FountainsUpdate(TFountainsInfo *, TPoint3D, TPoint3D, int) {}
- //-------------------------------------------------------------------------------------------------
- // 00183D34
- void CGFXFX::AddFireworkBurst(TPoint3D, TPoint3D, int) {
- // empty
- }
- //-------------------------------------------------------------------------------------------------
- // 00183D38
- void CGFXFX::ConfettiUpdate(TPoint3D, float) {}
- //-------------------------------------------------------------------------------------------------
- // 00183EF4
- void CGFXFX::ParticleAdd(EGFXFXParticle, CFTTVector32 *, CFTTVector32 *,
- CFTTVector32 *, CFTTVector32 *, int, float, float,
- uint, uint, float, float, float) {}
- //-------------------------------------------------------------------------------------------------
- // 00184028
- bool CGFXFX::GetGoldenBootEffectsEnabled() { return 0; }
- //-------------------------------------------------------------------------------------------------
- // 0018404C
- bool CGFXFX::GetStarPlayerEffectsEnabled() { return 0; }
- //-------------------------------------------------------------------------------------------------
- // 00184070
- void CGFXFX::SwipeReset() {}
- //-------------------------------------------------------------------------------------------------
- // 001840AC
- void CGFXFX::SwipeSetCol(uint) {}
- //-------------------------------------------------------------------------------------------------
- // 001840C0
- void CGFXFX::SwipeAddPoint(TPoint) {}
- //-------------------------------------------------------------------------------------------------
- // 0018416C
- void CGFXFX::EnableGoldenBootEffects() {}
- //-------------------------------------------------------------------------------------------------
- // 00184188
- void CGFXFX::ResetGoldenBootEffects() {
- LOGE("CGFXFX::ResetGoldenBootEffects");
- }
- //-------------------------------------------------------------------------------------------------
- // 001841EC
- void CGFXFX::EnableStarPlayerEffects() {}
- //-------------------------------------------------------------------------------------------------
- // 00184208
- void CGFXFX::ResetStarPlayerEffects() {
- LOGE("CGFXFX::ResetStarPlayerEffects");
- }
- //-------------------------------------------------------------------------------------------------
- // 0018426C
- void CGFXFX::BallTrailSetCol(uint) {}
- //-------------------------------------------------------------------------------------------------
|