summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/render/WaterLevel.cpp68
-rw-r--r--src/render/WaterLevel.h3
2 files changed, 35 insertions, 36 deletions
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index 854653f0..08fd5e6e 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -113,9 +113,9 @@ float fMinWaterAlphaMult = -30.0f;
void
-WaterLevelInitialise(Const char *pWaterDat)
+CWaterLevel::Initialise(Const char *pWaterDat)
{
- CWaterLevel::ms_nNoOfWaterLevels = 0;
+ ms_nNoOfWaterLevels = 0;
#ifdef MASTER
int32 hFile = -1;
@@ -131,11 +131,11 @@ WaterLevelInitialise(Const char *pWaterDat)
if (hFile > 0)
{
- CFileMgr::Read(hFile, (char *)&CWaterLevel::ms_nNoOfWaterLevels, sizeof(CWaterLevel::ms_nNoOfWaterLevels));
- CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterZs, sizeof(CWaterLevel::ms_aWaterZs));
- CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterRects, sizeof(CWaterLevel::ms_aWaterRects));
- CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterBlockList, sizeof(CWaterLevel::aWaterBlockList));
- CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterFineBlockList, sizeof(CWaterLevel::aWaterFineBlockList));
+ CFileMgr::Read(hFile, (char *)&ms_nNoOfWaterLevels, sizeof(ms_nNoOfWaterLevels));
+ CFileMgr::Read(hFile, (char *)ms_aWaterZs, sizeof(ms_aWaterZs));
+ CFileMgr::Read(hFile, (char *)ms_aWaterRects, sizeof(ms_aWaterRects));
+ CFileMgr::Read(hFile, (char *)aWaterBlockList, sizeof(aWaterBlockList));
+ CFileMgr::Read(hFile, (char *)aWaterFineBlockList, sizeof(aWaterFineBlockList));
CFileMgr::CloseFile(hFile);
}
#ifndef MASTER
@@ -157,7 +157,7 @@ WaterLevelInitialise(Const char *pWaterDat)
{
float z, l, b, r, t;
sscanf(line, "%f %f %f %f %f", &z, &l, &b, &r, &t);
- CWaterLevel::AddWaterLevel(l, b, r, t, z);
+ AddWaterLevel(l, b, r, t, z);
}
}
@@ -167,17 +167,17 @@ WaterLevelInitialise(Const char *pWaterDat)
{
for (int32 y = 0; y < MAX_SMALL_SECTORS; y++)
{
- CWaterLevel::aWaterFineBlockList[x][y] = NO_WATER;
+ aWaterFineBlockList[x][y] = NO_WATER;
}
}
// rasterize water rects read from file
- for (int32 i = 0; i < CWaterLevel::ms_nNoOfWaterLevels; i++)
+ for (int32 i = 0; i < ms_nNoOfWaterLevels; i++)
{
- int32 l = WATER_HUGE_X(CWaterLevel::ms_aWaterRects[i].left + WATER_X_OFFSET);
- int32 r = WATER_HUGE_X(CWaterLevel::ms_aWaterRects[i].right + WATER_X_OFFSET) + 1.0f;
- int32 t = WATER_HUGE_Y(CWaterLevel::ms_aWaterRects[i].top);
- int32 b = WATER_HUGE_Y(CWaterLevel::ms_aWaterRects[i].bottom) + 1.0f;
+ int32 l = WATER_HUGE_X(ms_aWaterRects[i].left + WATER_X_OFFSET);
+ int32 r = WATER_HUGE_X(ms_aWaterRects[i].right + WATER_X_OFFSET) + 1.0f;
+ int32 t = WATER_HUGE_Y(ms_aWaterRects[i].top);
+ int32 b = WATER_HUGE_Y(ms_aWaterRects[i].bottom) + 1.0f;
l = clamp(l, 0, MAX_SMALL_SECTORS - 1);
r = clamp(r, 0, MAX_SMALL_SECTORS - 1);
@@ -188,7 +188,7 @@ WaterLevelInitialise(Const char *pWaterDat)
{
for (int32 y = t; y <= b; y++)
{
- CWaterLevel::aWaterFineBlockList[x][y] = i;
+ aWaterFineBlockList[x][y] = i;
}
}
}
@@ -209,10 +209,10 @@ WaterLevelInitialise(Const char *pWaterDat)
{
for (int32 j = 0; j <= 8; j++)
{
- CVector worldPos = CVector(worldX + i * (SMALL_SECTOR_SIZE / 8), worldY + j * (SMALL_SECTOR_SIZE / 8), CWaterLevel::ms_aWaterZs[CWaterLevel::aWaterFineBlockList[x][y]]);
+ CVector worldPos = CVector(worldX + i * (SMALL_SECTOR_SIZE / 8), worldY + j * (SMALL_SECTOR_SIZE / 8), ms_aWaterZs[aWaterFineBlockList[x][y]]);
if ((worldPos.x > WORLD_MIN_X && worldPos.x < WORLD_MAX_X) && (worldPos.y > WORLD_MIN_Y && worldPos.y < WORLD_MAX_Y) &&
- (!CWaterLevel::WaterLevelAccordingToRectangles(worldPos.x, worldPos.y) || CWaterLevel::TestVisibilityForFineWaterBlocks(worldPos)))
+ (!WaterLevelAccordingToRectangles(worldPos.x, worldPos.y) || TestVisibilityForFineWaterBlocks(worldPos)))
continue;
// at least one point in the tile wasn't blocked, so don't remove water
@@ -222,37 +222,37 @@ WaterLevelInitialise(Const char *pWaterDat)
}
if (i < 1000)
- CWaterLevel::aWaterFineBlockList[x][y] = NO_WATER;
+ aWaterFineBlockList[x][y] = NO_WATER;
}
}
}
- CWaterLevel::RemoveIsolatedWater();
+ RemoveIsolatedWater();
// calculate coarse tiles from fine tiles
for (int32 x = 0; x < MAX_LARGE_SECTORS; x++)
{
for (int32 y = 0; y < MAX_LARGE_SECTORS; y++)
{
- if (CWaterLevel::aWaterFineBlockList[x * 2][y * 2] >= 0)
+ if (aWaterFineBlockList[x * 2][y * 2] >= 0)
{
- CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2][y * 2];
+ aWaterBlockList[x][y] = aWaterFineBlockList[x * 2][y * 2];
}
- else if (CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2] >= 0)
+ else if (aWaterFineBlockList[x * 2 + 1][y * 2] >= 0)
{
- CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2];
+ aWaterBlockList[x][y] = aWaterFineBlockList[x * 2 + 1][y * 2];
}
- else if (CWaterLevel::aWaterFineBlockList[x * 2][y * 2 + 1] >= 0)
+ else if (aWaterFineBlockList[x * 2][y * 2 + 1] >= 0)
{
- CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2][y * 2 + 1];
+ aWaterBlockList[x][y] = aWaterFineBlockList[x * 2][y * 2 + 1];
}
- else if (CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2 + 1] >= 0)
+ else if (aWaterFineBlockList[x * 2 + 1][y * 2 + 1] >= 0)
{
- CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2 + 1];
+ aWaterBlockList[x][y] = aWaterFineBlockList[x * 2 + 1][y * 2 + 1];
}
else
{
- CWaterLevel::aWaterBlockList[x][y] = NO_WATER;
+ aWaterBlockList[x][y] = NO_WATER;
}
}
}
@@ -261,11 +261,11 @@ WaterLevelInitialise(Const char *pWaterDat)
if (hFile > 0)
{
- CFileMgr::Write(hFile, (char *)&CWaterLevel::ms_nNoOfWaterLevels, sizeof(CWaterLevel::ms_nNoOfWaterLevels));
- CFileMgr::Write(hFile, (char *)CWaterLevel::ms_aWaterZs, sizeof(CWaterLevel::ms_aWaterZs));
- CFileMgr::Write(hFile, (char *)CWaterLevel::ms_aWaterRects, sizeof(CWaterLevel::ms_aWaterRects));
- CFileMgr::Write(hFile, (char *)CWaterLevel::aWaterBlockList, sizeof(CWaterLevel::aWaterBlockList));
- CFileMgr::Write(hFile, (char *)CWaterLevel::aWaterFineBlockList, sizeof(CWaterLevel::aWaterFineBlockList));
+ CFileMgr::Write(hFile, (char *)&ms_nNoOfWaterLevels, sizeof(ms_nNoOfWaterLevels));
+ CFileMgr::Write(hFile, (char *)ms_aWaterZs, sizeof(ms_aWaterZs));
+ CFileMgr::Write(hFile, (char *)ms_aWaterRects, sizeof(ms_aWaterRects));
+ CFileMgr::Write(hFile, (char *)aWaterBlockList, sizeof(aWaterBlockList));
+ CFileMgr::Write(hFile, (char *)aWaterFineBlockList, sizeof(aWaterFineBlockList));
CFileMgr::CloseFile(hFile);
}
@@ -300,7 +300,7 @@ WaterLevelInitialise(Const char *pWaterDat)
CTxdStore::PopCurrentTxd();
- CWaterLevel::CreateWavyAtomic();
+ CreateWavyAtomic();
printf("Done Initing waterlevels\n");
}
diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h
index 5a497ddf..6d6614d8 100644
--- a/src/render/WaterLevel.h
+++ b/src/render/WaterLevel.h
@@ -116,6 +116,7 @@ public:
static RpAtomic *ms_pWavyAtomic;
static RpAtomic *ms_pMaskAtomic;
+ static void Initialise(Const char *pWaterDat); // out of class in III PC and later because of SecuROM
static void Shutdown();
static void CreateWavyAtomic();
@@ -181,5 +182,3 @@ public:
static void HandleBeachToysStuff(void);
static CEntity *CreateBeachToy(CVector const &vec, eBeachToy beachtoy);
};
-
-extern void WaterLevelInitialise(Const char *datFile); \ No newline at end of file