summaryrefslogtreecommitdiffstats
path: root/src/render/WaterLevel.cpp
diff options
context:
space:
mode:
authorFire-Head <Fire-Head@users.noreply.github.com>2020-05-28 01:40:23 +0200
committerFire-Head <Fire-Head@users.noreply.github.com>2020-05-28 01:40:23 +0200
commit8280e04b23635a5a4ee23dd50883836b3851641c (patch)
tree025a6ff6a8c23a6a168cb562515cdd489eb71da4 /src/render/WaterLevel.cpp
parentsurfacetable included (diff)
downloadre3-8280e04b23635a5a4ee23dd50883836b3851641c.tar
re3-8280e04b23635a5a4ee23dd50883836b3851641c.tar.gz
re3-8280e04b23635a5a4ee23dd50883836b3851641c.tar.bz2
re3-8280e04b23635a5a4ee23dd50883836b3851641c.tar.lz
re3-8280e04b23635a5a4ee23dd50883836b3851641c.tar.xz
re3-8280e04b23635a5a4ee23dd50883836b3851641c.tar.zst
re3-8280e04b23635a5a4ee23dd50883836b3851641c.zip
Diffstat (limited to 'src/render/WaterLevel.cpp')
-rw-r--r--src/render/WaterLevel.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index ac2f7031..e6dbb9c4 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -403,12 +403,11 @@ CWaterLevel::GetWaterLevel(float fX, float fY, float fZ, float *pfOutLevel, bool
{
int32 x = WATER_TO_SMALL_SECTOR_X(fX + WATER_X_OFFSET);
int32 y = WATER_TO_SMALL_SECTOR_Y(fY);
-
- ASSERT( x >= 0 && x < MAX_SMALL_SECTORS );
- ASSERT( y >= 0 && y < MAX_SMALL_SECTORS );
-
+
+#ifdef FIX_BUGS
if ( x < 0 || x >= MAX_SMALL_SECTORS ) return false;
if ( y < 0 || y >= MAX_SMALL_SECTORS ) return false;
+#endif
uint8 nBlock = aWaterFineBlockList[x][y];
@@ -447,8 +446,10 @@ CWaterLevel::GetWaterLevelNoWaves(float fX, float fY, float fZ, float *pfOutLeve
int32 x = WATER_TO_SMALL_SECTOR_X(fX + WATER_X_OFFSET);
int32 y = WATER_TO_SMALL_SECTOR_Y(fY);
+#ifdef FIX_BUGS
if ( x < 0 || x >= MAX_SMALL_SECTORS ) return false;
if ( y < 0 || y >= MAX_SMALL_SECTORS ) return false;
+#endif
uint8 nBlock = aWaterFineBlockList[x][y];
@@ -670,7 +671,7 @@ CWaterLevel::RenderWater()
int32 nEndX = WATER_TO_HUGE_SECTOR_X(camPos.x + fHugeSectorMaxRenderDist + WATER_X_OFFSET) + 1;
int32 nStartY = WATER_TO_HUGE_SECTOR_Y(camPos.y - fHugeSectorMaxRenderDist);
int32 nEndY = WATER_TO_HUGE_SECTOR_Y(camPos.y + fHugeSectorMaxRenderDist) + 1;
-
+
if ( bUseCamStartX )
nStartX = WATER_TO_HUGE_SECTOR_X(camPos.x + WATER_X_OFFSET);
if ( bUseCamEndX )
@@ -1857,6 +1858,9 @@ CWaterLevel::PreCalcWaterGeometry(void)
int32 BlockX = WATER_TO_SMALL_SECTOR_X(fCamX + WATER_X_OFFSET) + 1;
int32 BlockY = WATER_TO_SMALL_SECTOR_Y(fCamY ) + 1;
+ ASSERT( BlockX >= 0 && BlockX < MAX_SMALL_SECTORS );
+ ASSERT( BlockY >= 0 && BlockY < MAX_SMALL_SECTORS );
+
if ( _IsColideWithBlock(BlockX, BlockY, nBlock) )
{
float fMaskX = floorf(fCamX / 2.0f) * 2.0f;