diff options
author | Fire-Head <Fire-Head@users.noreply.github.com> | 2021-01-25 22:52:03 +0100 |
---|---|---|
committer | Fire-Head <Fire-Head@users.noreply.github.com> | 2021-01-25 22:52:03 +0100 |
commit | ba4028b9dd6aa6f7eef7522421696c3a3d176eb2 (patch) | |
tree | 5ccb13758cc802f959e04462104d4037141d9753 | |
parent | Merge pull request #976 from Fire-Head/lcs (diff) | |
download | re3-ba4028b9dd6aa6f7eef7522421696c3a3d176eb2.tar re3-ba4028b9dd6aa6f7eef7522421696c3a3d176eb2.tar.gz re3-ba4028b9dd6aa6f7eef7522421696c3a3d176eb2.tar.bz2 re3-ba4028b9dd6aa6f7eef7522421696c3a3d176eb2.tar.lz re3-ba4028b9dd6aa6f7eef7522421696c3a3d176eb2.tar.xz re3-ba4028b9dd6aa6f7eef7522421696c3a3d176eb2.tar.zst re3-ba4028b9dd6aa6f7eef7522421696c3a3d176eb2.zip |
-rw-r--r-- | src/render/WaterCannon.cpp | 60 | ||||
-rw-r--r-- | src/render/WaterCannon.h | 3 |
2 files changed, 43 insertions, 20 deletions
diff --git a/src/render/WaterCannon.cpp b/src/render/WaterCannon.cpp index 91304be3..82b33651 100644 --- a/src/render/WaterCannon.cpp +++ b/src/render/WaterCannon.cpp @@ -13,7 +13,15 @@ #include "Camera.h" #include "Particle.h" -// --MIAMI: file done +// --LCS: file done + +#if 0 + //PSP: + #define WATER_COLOR 255 +#else + //PS2: + #define WATER_COLOR 127 +#endif #define WATERCANNONVERTS 4 #define WATERCANNONINDEXES 12 @@ -117,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; @@ -144,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()); @@ -151,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); @@ -178,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 { |