1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-23 17:45:28 +00:00

more tidy water sync

This commit is contained in:
aap 2020-12-16 13:32:13 +01:00
parent c4c92c357f
commit c42463bf4e

View file

@ -221,8 +221,8 @@ CWaterLevel::Initialise(Const char *pWaterDat)
int32 slot = CTxdStore::FindTxdSlot("particle"); int32 slot = CTxdStore::FindTxdSlot("particle");
CTxdStore::SetCurrentTxd(slot); CTxdStore::SetCurrentTxd(slot);
if ( gpWaterTex == NULL ) if ( gpWaterTex == nil )
gpWaterTex = RwTextureRead("water_old", NULL); gpWaterTex = RwTextureRead("water_old", nil);
gpWaterRaster = RwTextureGetRaster(gpWaterTex); gpWaterRaster = RwTextureGetRaster(gpWaterTex);
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
@ -239,10 +239,10 @@ CWaterLevel::Shutdown()
FreeBoatWakeArray(); FreeBoatWakeArray();
DestroyWavyAtomic(); DestroyWavyAtomic();
if ( gpWaterTex != NULL ) if ( gpWaterTex != nil )
{ {
RwTextureDestroy(gpWaterTex); RwTextureDestroy(gpWaterTex);
gpWaterTex = NULL; gpWaterTex = nil;
} }
} }
@ -264,15 +264,15 @@ CWaterLevel::CreateWavyAtomic()
|rpGEOMETRYPRELIT |rpGEOMETRYPRELIT
|rpGEOMETRYMODULATEMATERIALCOLOR); |rpGEOMETRYMODULATEMATERIALCOLOR);
ASSERT(wavyGeometry != NULL); ASSERT(wavyGeometry != nil);
} }
{ {
wavyMaterial = RpMaterialCreate(); wavyMaterial = RpMaterialCreate();
ASSERT(wavyMaterial != NULL); ASSERT(wavyMaterial != nil);
ASSERT(gpWaterTex != NULL); ASSERT(gpWaterTex != nil);
RpMaterialSetTexture(wavyMaterial, gpWaterTex); RpMaterialSetTexture(wavyMaterial, gpWaterTex);
} }
@ -280,7 +280,7 @@ CWaterLevel::CreateWavyAtomic()
{ {
wavyTriangles = RpGeometryGetTriangles(wavyGeometry); wavyTriangles = RpGeometryGetTriangles(wavyGeometry);
ASSERT(wavyTriangles != NULL); ASSERT(wavyTriangles != nil);
/* /*
[B] [C] [B] [C]
*********** ***********
@ -311,9 +311,9 @@ CWaterLevel::CreateWavyAtomic()
{ {
wavyMorphTarget = RpGeometryGetMorphTarget(wavyGeometry, 0); wavyMorphTarget = RpGeometryGetMorphTarget(wavyGeometry, 0);
ASSERT(wavyMorphTarget != NULL); ASSERT(wavyMorphTarget != nil);
wavyVert = RpMorphTargetGetVertices(wavyMorphTarget); wavyVert = RpMorphTargetGetVertices(wavyMorphTarget);
ASSERT(wavyVert != NULL); ASSERT(wavyVert != nil);
for ( int32 i = 0; i < 9; i++ ) for ( int32 i = 0; i < 9; i++ )
{ {
@ -333,10 +333,10 @@ CWaterLevel::CreateWavyAtomic()
{ {
wavyFrame = RwFrameCreate(); wavyFrame = RwFrameCreate();
ASSERT( wavyFrame != NULL ); ASSERT( wavyFrame != nil );
ms_pWavyAtomic = RpAtomicCreate(); ms_pWavyAtomic = RpAtomicCreate();
ASSERT( ms_pWavyAtomic != NULL ); ASSERT( ms_pWavyAtomic != nil );
RpAtomicSetGeometry(ms_pWavyAtomic, wavyGeometry, 0); RpAtomicSetGeometry(ms_pWavyAtomic, wavyGeometry, 0);
RpAtomicSetFrame(ms_pWavyAtomic, wavyFrame); RpAtomicSetFrame(ms_pWavyAtomic, wavyFrame);
@ -535,7 +535,7 @@ CWaterLevel::GetWaterLevel(float fX, float fY, float fZ, float *pfOutLevel, bool
if ( nBlock == NO_WATER ) if ( nBlock == NO_WATER )
return false; return false;
ASSERT( pfOutLevel != NULL ); ASSERT( pfOutLevel != nil );
*pfOutLevel = ms_aWaterZs[nBlock]; *pfOutLevel = ms_aWaterZs[nBlock];
float fAngle = (CTimer::GetTimeInMilliseconds() & 4095) * (TWOPI / 4096.0f); float fAngle = (CTimer::GetTimeInMilliseconds() & 4095) * (TWOPI / 4096.0f);
@ -574,7 +574,7 @@ CWaterLevel::GetWaterLevelNoWaves(float fX, float fY, float fZ, float *pfOutLeve
if ( nBlock == NO_WATER ) if ( nBlock == NO_WATER )
return false; return false;
ASSERT( pfOutLevel != NULL ); ASSERT( pfOutLevel != nil );
*pfOutLevel = ms_aWaterZs[nBlock]; *pfOutLevel = ms_aWaterZs[nBlock];
return true; return true;
@ -1247,19 +1247,19 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
CBoat::FillBoatList(); CBoat::FillBoatList();
ASSERT( ms_pWavyAtomic != NULL ); ASSERT( ms_pWavyAtomic != nil );
RpGeometry *geometry = RpAtomicGetGeometry(ms_pWavyAtomic); RpGeometry *geometry = RpAtomicGetGeometry(ms_pWavyAtomic);
ASSERT( geometry != NULL ); ASSERT( geometry != nil );
RwRGBA *wavyPreLights = RpGeometryGetPreLightColors(geometry); RwRGBA *wavyPreLights = RpGeometryGetPreLightColors(geometry);
RwTexCoords *wavyTexCoords = RpGeometryGetVertexTexCoords(geometry, rwTEXTURECOORDINATEINDEX0); RwTexCoords *wavyTexCoords = RpGeometryGetVertexTexCoords(geometry, rwTEXTURECOORDINATEINDEX0);
RwV3d *wavyVertices = RpMorphTargetGetVertices(RpGeometryGetMorphTarget(geometry, 0)); RwV3d *wavyVertices = RpMorphTargetGetVertices(RpGeometryGetMorphTarget(geometry, 0));
ASSERT( wavyPreLights != NULL ); ASSERT( wavyPreLights != nil );
ASSERT( wavyTexCoords != NULL ); ASSERT( wavyTexCoords != nil );
ASSERT( wavyVertices != NULL ); ASSERT( wavyVertices != nil );
RpGeometryLock(geometry, rpGEOMETRYLOCKVERTICES RpGeometryLock(geometry, rpGEOMETRYLOCKVERTICES
| rpGEOMETRYLOCKPRELIGHT | rpGEOMETRYLOCKPRELIGHT
@ -1282,7 +1282,7 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
RpGeometryUnlock(geometry); RpGeometryUnlock(geometry);
} }
static CBoat *apBoatList[4] = { NULL }; static CBoat *apBoatList[4] = { nil };
if ( apGeomArray[0] if ( apGeomArray[0]
&& nGeomUsed < MAX_BOAT_WAKES && nGeomUsed < MAX_BOAT_WAKES
@ -1296,16 +1296,16 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic); RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
RpGeometry *geom = apGeomArray[nGeomUsed++]; RpGeometry *geom = apGeomArray[nGeomUsed++];
ASSERT( wavyGeometry != NULL ); ASSERT( wavyGeometry != nil );
ASSERT( geom != NULL ); ASSERT( geom != nil );
RpAtomic *atomic = RpAtomicCreate(); RpAtomic *atomic = RpAtomicCreate();
ASSERT( atomic != NULL ); ASSERT( atomic != nil );
RpAtomicSetGeometry(atomic, geom, 0); RpAtomicSetGeometry(atomic, geom, 0);
RwFrame *frame = RwFrameCreate(); RwFrame *frame = RwFrameCreate();
ASSERT( frame != NULL ); ASSERT( frame != nil );
RwMatrixCopy(RwFrameGetMatrix(frame), RwFrameGetMatrix(RpAtomicGetFrame(ms_pWavyAtomic))); RwMatrixCopy(RwFrameGetMatrix(frame), RwFrameGetMatrix(RpAtomicGetFrame(ms_pWavyAtomic)));
RpAtomicSetFrame(atomic, frame); RpAtomicSetFrame(atomic, frame);
@ -1316,11 +1316,11 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
RwV3d *geomVertices = RpMorphTargetGetVertices(RpGeometryGetMorphTarget(geom, 0)); RwV3d *geomVertices = RpMorphTargetGetVertices(RpGeometryGetMorphTarget(geom, 0));
RwV3d *wavyVertices = RpMorphTargetGetVertices(RpGeometryGetMorphTarget(wavyGeometry, 0)); RwV3d *wavyVertices = RpMorphTargetGetVertices(RpGeometryGetMorphTarget(wavyGeometry, 0));
ASSERT( geomTexCoords != NULL ); ASSERT( geomTexCoords != nil );
ASSERT( wavyTexCoord != NULL ); ASSERT( wavyTexCoord != nil );
ASSERT( geomPreLights != NULL ); ASSERT( geomPreLights != nil );
ASSERT( geomVertices != NULL ); ASSERT( geomVertices != nil );
ASSERT( wavyVertices != NULL ); ASSERT( wavyVertices != nil );
RpGeometryLock(geom, rpGEOMETRYLOCKVERTICES | rpGEOMETRYLOCKPRELIGHT | rpGEOMETRYLOCKTEXCOORDS); RpGeometryLock(geom, rpGEOMETRYLOCKVERTICES | rpGEOMETRYLOCKPRELIGHT | rpGEOMETRYLOCKTEXCOORDS);
@ -1337,7 +1337,7 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
for ( int32 k = 0; k < 4; k++ ) for ( int32 k = 0; k < 4; k++ )
{ {
if ( apBoatList[k] != NULL ) if ( apBoatList[k] != nil )
fDistMult += CBoat::IsVertexAffectedByWake(CVector(fVertexX, fVertexY, 0.0f), apBoatList[k]); fDistMult += CBoat::IsVertexAffectedByWake(CVector(fVertexX, fVertexY, 0.0f), apBoatList[k]);
} }
@ -1386,7 +1386,7 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
pos.y = fY; pos.y = fY;
pos.z = fZ; pos.z = fZ;
ASSERT( ms_pWavyAtomic != NULL ); ASSERT( ms_pWavyAtomic != nil );
RwFrameTranslate(RpAtomicGetFrame(ms_pWavyAtomic), &pos, rwCOMBINEREPLACE); RwFrameTranslate(RpAtomicGetFrame(ms_pWavyAtomic), &pos, rwCOMBINEREPLACE);
@ -1441,7 +1441,7 @@ CWaterLevel::RenderAndEmptyRenderBuffer()
{ {
LittleTest(); LittleTest();
if ( RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, NULL, rwIM3D_VERTEXUV) ) if ( RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, rwIM3D_VERTEXUV) )
{ {
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempBufferRenderIndexList, TempBufferIndicesStored); RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempBufferRenderIndexList, TempBufferIndicesStored);
RwIm3DEnd(); RwIm3DEnd();
@ -1459,29 +1459,29 @@ CWaterLevel::AllocateBoatWakeArray()
PUSH_MEMID(MEMID_STREAM); PUSH_MEMID(MEMID_STREAM);
ASSERT(ms_pWavyAtomic != NULL ); ASSERT(ms_pWavyAtomic != nil );
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic); RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
ASSERT(wavyGeometry != NULL ); ASSERT(wavyGeometry != nil );
RpMorphTarget *wavyMorphTarget = RpGeometryGetMorphTarget(wavyGeometry, 0); RpMorphTarget *wavyMorphTarget = RpGeometryGetMorphTarget(wavyGeometry, 0);
RpMaterial *wavyMaterial = RpGeometryGetMaterial(wavyGeometry, 0); RpMaterial *wavyMaterial = RpGeometryGetMaterial(wavyGeometry, 0);
ASSERT(wavyMorphTarget != NULL ); ASSERT(wavyMorphTarget != nil );
ASSERT(wavyMaterial != NULL ); ASSERT(wavyMaterial != nil );
for ( int32 geom = 0; geom < MAX_BOAT_WAKES; geom++ ) for ( int32 geom = 0; geom < MAX_BOAT_WAKES; geom++ )
{ {
if ( apGeomArray[geom] == NULL ) if ( apGeomArray[geom] == nil )
{ {
apGeomArray[geom] = RpGeometryCreate(9*9, 8*8*2, rpGEOMETRYTRISTRIP apGeomArray[geom] = RpGeometryCreate(9*9, 8*8*2, rpGEOMETRYTRISTRIP
| rpGEOMETRYPRELIT | rpGEOMETRYPRELIT
| rpGEOMETRYMODULATEMATERIALCOLOR | rpGEOMETRYMODULATEMATERIALCOLOR
| rpGEOMETRYTEXTURED); | rpGEOMETRYTEXTURED);
ASSERT(apGeomArray[geom] != NULL); ASSERT(apGeomArray[geom] != nil);
RpTriangle *geomTriangles = RpGeometryGetTriangles(apGeomArray[geom]); RpTriangle *geomTriangles = RpGeometryGetTriangles(apGeomArray[geom]);
ASSERT( geomTriangles != NULL ); ASSERT( geomTriangles != nil );
for ( int32 i = 0; i < 8; i++ ) for ( int32 i = 0; i < 8; i++ )
{ {
@ -1515,8 +1515,8 @@ CWaterLevel::AllocateBoatWakeArray()
RpMorphTarget *geomMorphTarget = RpGeometryGetMorphTarget(apGeomArray[geom], 0); RpMorphTarget *geomMorphTarget = RpGeometryGetMorphTarget(apGeomArray[geom], 0);
RwV3d *geomVertices = RpMorphTargetGetVertices(geomMorphTarget); RwV3d *geomVertices = RpMorphTargetGetVertices(geomMorphTarget);
ASSERT( geomMorphTarget != NULL ); ASSERT( geomMorphTarget != nil );
ASSERT( geomVertices != NULL ); ASSERT( geomVertices != nil );
for ( int32 i = 0; i < 9; i++ ) for ( int32 i = 0; i < 9; i++ )
{ {
@ -1541,10 +1541,10 @@ CWaterLevel::FreeBoatWakeArray()
{ {
for ( int32 i = 0; i < MAX_BOAT_WAKES; i++ ) for ( int32 i = 0; i < MAX_BOAT_WAKES; i++ )
{ {
if ( apGeomArray[i] != NULL ) if ( apGeomArray[i] != nil )
{ {
RpGeometryDestroy(apGeomArray[i]); RpGeometryDestroy(apGeomArray[i]);
apGeomArray[i] = NULL; apGeomArray[i] = nil;
} }
} }