move stuff back into class; securom comments

This commit is contained in:
withmorten 2021-01-13 00:18:58 +01:00
parent 4505b8795a
commit 232d990e6d
7 changed files with 41 additions and 45 deletions

View File

@ -1729,7 +1729,7 @@ void CReplay::SaveReplayToHD(void)
CFileMgr::SetDir("");
}
void PlayReplayFromHD(void)
void CReplay::PlayReplayFromHD(void)
{
CFileMgr::SetDirMyDocuments();
int fr = CFileMgr::OpenFile("replay.rep", "rb");

View File

@ -64,8 +64,6 @@ struct CStoredDetailedAnimationState
uint8 aGroupId2[NUM_PARTIAL_ANIMS_IN_REPLAY];
};
void PlayReplayFromHD(void);
#ifdef GTA_REPLAY
#define REPLAY_STUB
#else
@ -410,12 +408,10 @@ private:
static void EmptyAllPools(void);
static void MarkEverythingAsNew(void);
static void SaveReplayToHD(void);
static void PlayReplayFromHD(void); // out of class in III PC and later because of SecuROM
static void FindFirstFocusCoordinate(CVector *coord);
static void ProcessLookAroundCam(void);
static size_t FindSizeOfPacket(uint8);
static void GoToNextBlock(void);
/* Absolute nonsense, but how could this function end up being outside of class? */
friend void PlayReplayFromHD(void);
#endif
};

View File

@ -462,7 +462,7 @@ bool CGame::Initialise(const char* datFile)
TestModelIndices();
LoadingScreen("Loading the Game", "Setup water", nil);
WaterLevelInitialise("DATA\\WATER.DAT");
CWaterLevel::Initialise("DATA\\WATER.DAT");
TheConsole.Init();
CDraw::SetFOV(120.0f);
CDraw::ms_fLODDistance = 500.0f;

View File

@ -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");
}

View File

@ -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);

View File

@ -762,7 +762,7 @@ CHeli::InitHelis(void)
}
CHeli*
GenerateHeli(bool catalina)
CHeli::GenerateHeli(bool catalina)
{
CHeli *heli;
CVector heliPos;

View File

@ -83,13 +83,14 @@ public:
bool SendDownSwat(void);
static void InitHelis(void);
static CHeli *GenerateHeli(bool catalina); // out of class in III PC and later because of SecuROM
static void UpdateHelis(void);
static void SpecialHeliPreRender(void);
static bool TestRocketCollision(CVector *coors);
static bool TestBulletCollision(CVector *line0, CVector *line1, CVector *bulletPos, int32 damage);
static bool TestSniperCollision(CVector *line0, CVector *line1);
static void StartCatalinaFlyBy(void);
static void StartCatalinaFlyBy(void); // out of class in III PC and later because of SecuROM
static void RemoveCatalinaHeli(void);
static CHeli *FindPointerToCatalinasHeli(void);
static void CatalinaTakeOff(void);