diff options
author | Sergeanur <s.anureev@yandex.ua> | 2021-02-03 20:44:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-03 20:44:21 +0100 |
commit | 4f7793a42396cf594e87a6c23eece0a6a05e1ff1 (patch) | |
tree | 2420a398c41756102bb20345fcd5364ef5ac7525 /src | |
parent | fix gcc/clang build by adding -fpermssive and -Wno-address-of-temporary (diff) | |
parent | Merge branch 'lcs' into lcs (diff) | |
download | re3-4f7793a42396cf594e87a6c23eece0a6a05e1ff1.tar re3-4f7793a42396cf594e87a6c23eece0a6a05e1ff1.tar.gz re3-4f7793a42396cf594e87a6c23eece0a6a05e1ff1.tar.bz2 re3-4f7793a42396cf594e87a6c23eece0a6a05e1ff1.tar.lz re3-4f7793a42396cf594e87a6c23eece0a6a05e1ff1.tar.xz re3-4f7793a42396cf594e87a6c23eece0a6a05e1ff1.tar.zst re3-4f7793a42396cf594e87a6c23eece0a6a05e1ff1.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/config.h | 1 | ||||
-rw-r--r-- | src/render/WaterCannon.cpp | 60 | ||||
-rw-r--r-- | src/render/WaterCannon.h | 3 |
3 files changed, 45 insertions, 19 deletions
diff --git a/src/core/config.h b/src/core/config.h index c5799817..94b2eb60 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -287,6 +287,7 @@ enum Config { // Water & Particle // #define PC_WATER #define WATER_CHEATS +//#define PSP_WATERCANNON //#define USE_CUTSCENE_SHADOW_FOR_PED #define DISABLE_CUTSCENE_SHADOWS diff --git a/src/render/WaterCannon.cpp b/src/render/WaterCannon.cpp index 53b4d30e..65d8b388 100644 --- a/src/render/WaterCannon.cpp +++ b/src/render/WaterCannon.cpp @@ -13,6 +13,16 @@ #include "Camera.h" #include "Particle.h" +// --LCS: file done + +#ifdef PSP_WATERCANNON + //PSP: + #define WATER_COLOR 255 +#else + //PS2: + #define WATER_COLOR 127 +#endif + #define WATERCANNONVERTS 4 #define WATERCANNONINDEXES 12 @@ -115,24 +125,34 @@ void CWaterCannon::Update_NewInput(CVector *pos, CVector *dir) m_abUsed[m_nCur] = true; } +static float fWaterCannonU = 0.0f; void CWaterCannon::Render(void) { + extern RwRaster *gpFireHoseRaster; + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void *)TRUE); - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)gpWaterRaster); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)gpFireHoseRaster); - float v = float(CGeneral::GetRandomNumber() & 255) / 256; - - RwIm3DVertexSetV(&WaterCannonVertices[0], v); - RwIm3DVertexSetV(&WaterCannonVertices[1], v); - RwIm3DVertexSetV(&WaterCannonVertices[2], v); - RwIm3DVertexSetV(&WaterCannonVertices[3], v); + fWaterCannonU += CTimer::GetTimeStepInSeconds() * 6.0f; - int16 pointA = m_nCur % NUM_SEGMENTPOINTS; + while ( fWaterCannonU >= 1.0f ) + fWaterCannonU -= 1.0f; + RwIm3DVertexSetU(&WaterCannonVertices[0], -fWaterCannonU); + RwIm3DVertexSetV(&WaterCannonVertices[0], 0.0f); + RwIm3DVertexSetU(&WaterCannonVertices[1], -fWaterCannonU); + RwIm3DVertexSetV(&WaterCannonVertices[1], 1.0f); + RwIm3DVertexSetU(&WaterCannonVertices[2], 1.0f - fWaterCannonU); + RwIm3DVertexSetV(&WaterCannonVertices[2], 0.0f); + RwIm3DVertexSetU(&WaterCannonVertices[3], 1.0f - fWaterCannonU); + RwIm3DVertexSetV(&WaterCannonVertices[3], 1.0f); + + int16 pointA = m_nCur % NUM_SEGMENTPOINTS; int16 pointB = pointA - 1; - if ( (pointA - 1) < 0 ) + int16 pointC = pointA; + if ( pointB < 0 ) pointB += NUM_SEGMENTPOINTS; bool bInit = false; @@ -142,6 +162,10 @@ void CWaterCannon::Render(void) { if ( m_abUsed[pointA] && m_abUsed[pointB] ) { + bool bFirst = false; + if ( i == 0 || m_abUsed[pointA] && !m_abUsed[pointC] ) + bFirst = true; + if ( !bInit ) { CVector cp = CrossProduct(m_avecPos[pointB] - m_avecPos[pointA], TheCamera.GetForward()); @@ -149,26 +173,25 @@ void CWaterCannon::Render(void) bInit = true; } - float dist = float(i*i*i) / 300.0f + 1.0f; float brightness = float(i) / NUM_SEGMENTPOINTS; - int32 color = (int32)((1.0f - brightness*brightness) * 255.0f); - CVector offset = dist * norm; - RwIm3DVertexSetRGBA(&WaterCannonVertices[0], color, color, color, color); + CVector offset = (float(i)+1.0f) * norm; + + RwIm3DVertexSetRGBA(&WaterCannonVertices[0], WATER_COLOR, WATER_COLOR, WATER_COLOR, bFirst ? 0 : color); RwIm3DVertexSetPos (&WaterCannonVertices[0], m_avecPos[pointA].x - offset.x, m_avecPos[pointA].y - offset.y, m_avecPos[pointA].z - offset.z); - RwIm3DVertexSetRGBA(&WaterCannonVertices[1], color, color, color, color); + RwIm3DVertexSetRGBA(&WaterCannonVertices[1], WATER_COLOR, WATER_COLOR, WATER_COLOR, bFirst ? 0 : color); RwIm3DVertexSetPos (&WaterCannonVertices[1], m_avecPos[pointA].x + offset.x, m_avecPos[pointA].y + offset.y, m_avecPos[pointA].z + offset.z); - RwIm3DVertexSetRGBA(&WaterCannonVertices[2], color, color, color, color); + offset = (float(i+1)+1.0f) * norm; + + RwIm3DVertexSetRGBA(&WaterCannonVertices[2], WATER_COLOR, WATER_COLOR, WATER_COLOR, color); RwIm3DVertexSetPos (&WaterCannonVertices[2], m_avecPos[pointB].x - offset.x, m_avecPos[pointB].y - offset.y, m_avecPos[pointB].z - offset.z); - RwIm3DVertexSetRGBA(&WaterCannonVertices[3], color, color, color, color); + RwIm3DVertexSetRGBA(&WaterCannonVertices[3], WATER_COLOR, WATER_COLOR, WATER_COLOR, color); RwIm3DVertexSetPos (&WaterCannonVertices[3], m_avecPos[pointB].x + offset.x, m_avecPos[pointB].y + offset.y, m_avecPos[pointB].z + offset.z); - LittleTest(); - if ( RwIm3DTransform(WaterCannonVertices, WATERCANNONVERTS, NULL, rwIM3D_VERTEXUV) ) { RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, WaterCannonIndexList, WATERCANNONINDEXES); @@ -176,6 +199,7 @@ void CWaterCannon::Render(void) } } + pointC = pointA; pointA = pointB--; if ( pointB < 0 ) pointB += NUM_SEGMENTPOINTS; diff --git a/src/render/WaterCannon.h b/src/render/WaterCannon.h index a37bdd12..5b60639c 100644 --- a/src/render/WaterCannon.h +++ b/src/render/WaterCannon.h @@ -14,6 +14,7 @@ public: int32 m_nId; int16 m_nCur; uint32 m_nTimeCreated; + int32 field_C; CVector m_avecPos[NUM_SEGMENTPOINTS]; CVector m_avecVelocity[NUM_SEGMENTPOINTS]; bool m_abUsed[NUM_SEGMENTPOINTS]; @@ -25,7 +26,7 @@ public: void PushPeds(void); }; -VALIDATE_SIZE(CWaterCannon, 412); +VALIDATE_SIZE(CWaterCannon, 0x1A0); class CWaterCannons { |