diff options
author | Fire-Head <Fire-Head@users.noreply.github.com> | 2021-01-13 21:15:33 +0100 |
---|---|---|
committer | Fire-Head <Fire-Head@users.noreply.github.com> | 2021-01-13 21:15:33 +0100 |
commit | 97c9a4a02c9f801d35fbcf47658756a89a33f6d9 (patch) | |
tree | 232709023f42a318c0588b61f4de2c91b724a5b1 /src/render/WaterLevel.cpp | |
parent | Merge branch 'lcs' of https://github.com/GTAmodding/re3 into lcs (diff) | |
download | re3-97c9a4a02c9f801d35fbcf47658756a89a33f6d9.tar re3-97c9a4a02c9f801d35fbcf47658756a89a33f6d9.tar.gz re3-97c9a4a02c9f801d35fbcf47658756a89a33f6d9.tar.bz2 re3-97c9a4a02c9f801d35fbcf47658756a89a33f6d9.tar.lz re3-97c9a4a02c9f801d35fbcf47658756a89a33f6d9.tar.xz re3-97c9a4a02c9f801d35fbcf47658756a89a33f6d9.tar.zst re3-97c9a4a02c9f801d35fbcf47658756a89a33f6d9.zip |
Diffstat (limited to 'src/render/WaterLevel.cpp')
-rw-r--r-- | src/render/WaterLevel.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index 6247c611..6caac31e 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -113,9 +113,9 @@ float fMinWaterAlphaMult = -30.0f; void -CWaterLevel::Initialise(Const char *pWaterDat) +WaterLevelInitialise(Const char *pWaterDat) { - ms_nNoOfWaterLevels = 0; + CWaterLevel::ms_nNoOfWaterLevels = 0; #ifdef MASTER int32 hFile = -1; @@ -131,11 +131,11 @@ CWaterLevel::Initialise(Const char *pWaterDat) if (hFile > 0) { - 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::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::CloseFile(hFile); } #ifndef MASTER @@ -157,7 +157,7 @@ CWaterLevel::Initialise(Const char *pWaterDat) { float z, l, b, r, t; sscanf(line, "%f %f %f %f %f", &z, &l, &b, &r, &t); - AddWaterLevel(l, b, r, t, z); + CWaterLevel::AddWaterLevel(l, b, r, t, z); } } @@ -167,17 +167,17 @@ CWaterLevel::Initialise(Const char *pWaterDat) { for (int32 y = 0; y < MAX_SMALL_SECTORS; y++) { - aWaterFineBlockList[x][y] = NO_WATER; + CWaterLevel::aWaterFineBlockList[x][y] = NO_WATER; } } // rasterize water rects read from file - for (int32 i = 0; i < ms_nNoOfWaterLevels; i++) + for (int32 i = 0; i < CWaterLevel::ms_nNoOfWaterLevels; i++) { - 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; + 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; l = clamp(l, 0, MAX_SMALL_SECTORS - 1); r = clamp(r, 0, MAX_SMALL_SECTORS - 1); @@ -188,7 +188,7 @@ CWaterLevel::Initialise(Const char *pWaterDat) { for (int32 y = t; y <= b; y++) { - aWaterFineBlockList[x][y] = i; + CWaterLevel::aWaterFineBlockList[x][y] = i; } } } @@ -209,10 +209,10 @@ CWaterLevel::Initialise(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), ms_aWaterZs[aWaterFineBlockList[x][y]]); + CVector worldPos = CVector(worldX + i * (SMALL_SECTOR_SIZE / 8), worldY + j * (SMALL_SECTOR_SIZE / 8), CWaterLevel::ms_aWaterZs[CWaterLevel::aWaterFineBlockList[x][y]]); if ((worldPos.x > WORLD_MIN_X && worldPos.x < WORLD_MAX_X) && (worldPos.y > WORLD_MIN_Y && worldPos.y < WORLD_MAX_Y) && - (!WaterLevelAccordingToRectangles(worldPos.x, worldPos.y) || TestVisibilityForFineWaterBlocks(worldPos))) + (!CWaterLevel::WaterLevelAccordingToRectangles(worldPos.x, worldPos.y) || CWaterLevel::TestVisibilityForFineWaterBlocks(worldPos))) continue; // at least one point in the tile wasn't blocked, so don't remove water @@ -222,37 +222,37 @@ CWaterLevel::Initialise(Const char *pWaterDat) } if (i < 1000) - aWaterFineBlockList[x][y] = NO_WATER; + CWaterLevel::aWaterFineBlockList[x][y] = NO_WATER; } } } - RemoveIsolatedWater(); + CWaterLevel::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 (aWaterFineBlockList[x * 2][y * 2] >= 0) + if (CWaterLevel::aWaterFineBlockList[x * 2][y * 2] >= 0) { - aWaterBlockList[x][y] = aWaterFineBlockList[x * 2][y * 2]; + CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2][y * 2]; } - else if (aWaterFineBlockList[x * 2 + 1][y * 2] >= 0) + else if (CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2] >= 0) { - aWaterBlockList[x][y] = aWaterFineBlockList[x * 2 + 1][y * 2]; + CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2]; } - else if (aWaterFineBlockList[x * 2][y * 2 + 1] >= 0) + else if (CWaterLevel::aWaterFineBlockList[x * 2][y * 2 + 1] >= 0) { - aWaterBlockList[x][y] = aWaterFineBlockList[x * 2][y * 2 + 1]; + CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2][y * 2 + 1]; } - else if (aWaterFineBlockList[x * 2 + 1][y * 2 + 1] >= 0) + else if (CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2 + 1] >= 0) { - aWaterBlockList[x][y] = aWaterFineBlockList[x * 2 + 1][y * 2 + 1]; + CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2 + 1]; } else { - aWaterBlockList[x][y] = NO_WATER; + CWaterLevel::aWaterBlockList[x][y] = NO_WATER; } } } @@ -261,11 +261,11 @@ CWaterLevel::Initialise(Const char *pWaterDat) if (hFile > 0) { - 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::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::CloseFile(hFile); } @@ -300,7 +300,7 @@ CWaterLevel::Initialise(Const char *pWaterDat) CTxdStore::PopCurrentTxd(); - CreateWavyAtomic(); + CWaterLevel::CreateWavyAtomic(); printf("Done Initing waterlevels\n"); } |