From 8858df2185b2a88922176194afb0d7a56b401fe4 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 12 Jan 2021 22:58:50 +0100 Subject: [PATCH 1/7] ProcessWheel bug --- src/vehicles/Vehicle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 1849fd7f..75bd6ec6 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -913,7 +913,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon float turnImpulse = turnSpeed*GetMass(wheelContactPoint, turnDirection); ApplyMoveForce(impulse * direction); - ApplyTurnForce(turnImpulse * direction, wheelContactPoint); + ApplyTurnForce(turnImpulse * turnDirection, wheelContactPoint); } } From faab9f4aa47b216c979ad7fdbac0eae8beb940fd Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 12 Jan 2021 23:28:13 +0100 Subject: [PATCH 2/7] escalator fix --- src/render/Fluff.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index 157be0c8..30e271fb 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -935,7 +935,7 @@ CEscalator::AddThisOne(CVector pos0, CVector pos1, CVector pos2, CVector pos3, b m_lowerEnd = magnitudes[0] / length; m_upperEnd = (magnitudes[0] + magnitudes[1]) / length; - m_stepsCount = Max(24.0f, length / 0.6f); + m_stepsCount = Min(24.0f, length / 0.6f); CVector direction(m_pos0.x - m_pos1.x, m_pos0.y - m_pos1.y, 0.0f); direction.Normalise(); From b407f6a011df3e7e2a33f1b85f05a9538524ad35 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 12 Jan 2021 23:32:45 +0100 Subject: [PATCH 3/7] fix CreateInstance virtual overload order --- src/modelinfo/BaseModelInfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h index a4906fc9..18e84c21 100644 --- a/src/modelinfo/BaseModelInfo.h +++ b/src/modelinfo/BaseModelInfo.h @@ -38,8 +38,8 @@ public: virtual ~CBaseModelInfo() {} virtual void Shutdown(void); virtual void DeleteRwObject(void) = 0; - virtual RwObject *CreateInstance(RwMatrix *) = 0; virtual RwObject *CreateInstance(void) = 0; + virtual RwObject *CreateInstance(RwMatrix *) = 0; virtual RwObject *GetRwObject(void) = 0; virtual void SetAnimFile(const char *file) {} virtual void ConvertAnimFileIndex(void) {} From 4505b8795add8bdc9ee30aa9eb6ced6f8310ddc7 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Wed, 13 Jan 2021 01:37:25 +0300 Subject: [PATCH 4/7] fix --- src/control/Script4.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index efe35efb..fa9a9d6a 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -1811,8 +1811,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) return 0; int attempts; int model = -1; - int index = CGeneral::GetRandomNumberInRange(0, 50); - for (attempts = 0; attempts < 50; attempts++) { + int index = CGeneral::GetRandomNumberInRange(0, MAXVEHICLESLOADED); + for (attempts = 0; attempts < MAXVEHICLESLOADED; attempts++) { if (model != -1) break; model = CStreaming::ms_vehiclesLoaded[index]; From 92b1e8ab754581fa085044aa799c1660061eac44 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 13 Jan 2021 01:01:04 +0200 Subject: [PATCH 5/7] More font fixes --- src/render/Font.cpp | 122 +++++++++++++++++++++++++++++++++----------- 1 file changed, 92 insertions(+), 30 deletions(-) diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 6d569591..d15dc7d3 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -274,13 +274,13 @@ CFont::Initialise(void) SetScale(1.0f, 1.0f); SetSlantRefPoint(SCREEN_WIDTH, 0.0f); SetSlant(0.0f); - SetColor(CRGBA(0xFF, 0xFF, 0xFF, 0)); + SetColor(CRGBA(255, 255, 255, 0)); SetJustifyOff(); SetCentreOff(); SetWrapx(SCREEN_WIDTH); SetCentreSize(SCREEN_WIDTH); SetBackgroundOff(); - SetBackgroundColor(CRGBA(0x80, 0x80, 0x80, 0x80)); + SetBackgroundColor(CRGBA(128, 128, 128, 128)); SetBackGroundOnlyTextOff(); SetPropOn(); SetFontStyle(FONT_BANK); @@ -614,10 +614,10 @@ CFont::PrintString(float xstart, float ystart, wchar *s) x = xstart; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) - y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; else #endif - y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY; start = s; }else break; @@ -653,7 +653,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s) else x = 0.0f; - y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; numSpaces = 0; first = true; lineLength = 0.0f; @@ -676,7 +676,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s) x = xstart; else x = 0.0f; - y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; numSpaces = 0; first = true; lineLength = 0.0f; @@ -753,10 +753,10 @@ CFont::GetNumberLines(float xstart, float ystart, wchar *s) // Why even? #ifdef MORE_LANGUAGES if (IsJapanese()) - y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; else #endif - y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY; }else{ // still space in current line t = GetNextSpace(s); @@ -827,7 +827,7 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) else x = xstart; numLines++; - y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY; }else{ // still space in current line t = GetNextSpace(s); @@ -855,11 +855,11 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) rect->right = xstart + maxlength/2 + 4.0f; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) { - rect->bottom = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + (4.0f / 2.75f); + rect->bottom = (32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY) * numLines + ystart + (4.0f / 2.75f); rect->top = ystart - (4.0f / 2.75f); } else { #endif - rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f; + rect->bottom = (32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f; rect->top = ystart - 2.0f; #ifdef MORE_LANGUAGES } @@ -869,11 +869,11 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) rect->right = xstart + Details.centreSize*0.5f + 4.0f; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) { - rect->bottom = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + (4.0f / 2.75f); + rect->bottom = (32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY) * numLines + ystart + (4.0f / 2.75f); rect->top = ystart - (4.0f / 2.75f); } else { #endif - rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f; + rect->bottom = (32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f; rect->top = ystart - 2.0f; #ifdef MORE_LANGUAGES } @@ -886,10 +886,10 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) rect->bottom = ystart - 4.0f + 4.0f; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) - rect->top = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f + (4.0f / 2.75f); + rect->top = (32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f + (4.0f / 2.75f); else #endif - rect->top = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f + 2.0f; + rect->top = (32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f + 2.0f; } } @@ -1315,27 +1315,89 @@ CFont::ParseToken(wchar *s) case 'n': NewLine = 1; break; - case 'b': SetColor(CRGBA(27, 89, 130, 255)); Details.anonymous_23 = true; break; + case 'b': + Details.color.r = 27; + Details.color.g = 89; + Details.color.b = 130; + Details.anonymous_23 = true; + break; case 'f': Details.bFlash = !Details.bFlash; if (!Details.bFlash) Details.color.a = 255; break; - case 'g': SetColor(CRGBA(255, 150, 225, 255)); Details.anonymous_23 = true; break; - case 'h': SetColor(CRGBA(225, 225, 225, 255)); Details.anonymous_23 = true; break; - case 'l': SetColor(CRGBA(0, 0, 0, 255)); Details.anonymous_23 = true; break; - case 'o': SetColor(CRGBA(229, 125, 126, 255)); Details.anonymous_23 = true; break; - case 'p': SetColor(CRGBA(168, 110, 252, 255)); Details.anonymous_23 = true; break; - case 'q': SetColor(CRGBA(199, 144, 203, 255)); Details.anonymous_23 = true; break; - case 'r': SetColor(CRGBA(255, 150, 225, 255)); Details.anonymous_23 = true; break; - case 't': SetColor(CRGBA(86, 212, 146, 255)); Details.anonymous_23 = true; break; - case 'w': SetColor(CRGBA(175, 175, 175, 255)); Details.anonymous_23 = true; break; + case 'g': + Details.color.r = 255; + Details.color.g = 150; + Details.color.b = 225; + Details.anonymous_23 = true; + break; + case 'h': + Details.color.r = 225; + Details.color.g = 225; + Details.color.b = 225; + Details.anonymous_23 = true; + break; + case 'l': + Details.color.r = 0; + Details.color.g = 0; + Details.color.b = 0; + Details.anonymous_23 = true; + break; + case 'o': + Details.color.r = 229; + Details.color.g = 125; + Details.color.b = 126; + Details.anonymous_23 = true; + break; + case 'p': + Details.color.r = 168; + Details.color.g = 110; + Details.color.b = 252; + Details.anonymous_23 = true; + break; + case 'q': + Details.color.r = 199; + Details.color.g = 144; + Details.color.b = 203; + Details.anonymous_23 = true; + break; + case 'r': + Details.color.r = 255; + Details.color.g = 150; + Details.color.b = 225; + Details.anonymous_23 = true; + break; + case 't': + Details.color.r = 86; + Details.color.g = 212; + Details.color.b = 146; + Details.anonymous_23 = true; + break; + case 'w': + Details.color.r = 175; + Details.color.g = 175; + Details.color.b = 175; + Details.anonymous_23 = true; + break; + case 'x': #ifdef FIX_BUGS - case 'x': SetColor(CRGBA(0, 255, 255, 255)); Details.anonymous_23 = true; break; + Details.color.r = 0; + Details.color.g = 255; + Details.color.b = 255; #else - case 'x': SetColor(CRGBA(132, 146, 197, 255)); Details.anonymous_23 = true; break; + Details.color.r = 132; + Details.color.g = 146; + Details.color.b = 197; #endif - case 'y': SetColor(CRGBA(255, 227, 79, 255)); Details.anonymous_23 = true; break; + Details.anonymous_23 = true; + break; + case 'y': + Details.color.r = 255; + Details.color.g = 227; + Details.color.b = 79; + Details.anonymous_23 = true; + break; #ifdef BUTTON_ICONS case 'U': PS2Symbol = BUTTON_UP; break; case 'D': PS2Symbol = BUTTON_DOWN; break; @@ -1542,7 +1604,7 @@ CFont::RenderFontBuffer() if (RenderState.bFontHalfTexture) c = FindNewCharacter(c); else if (c > 155) - c = 0; + c = '\0'; if (RenderState.slant != 0.0f) textPosY = (RenderState.slantRefX - textPosX) * RenderState.slant + RenderState.slantRefY; @@ -1556,7 +1618,7 @@ CFont::RenderFontBuffer() // PS2 uses different chars for some symbols if (!RenderState.bFontHalfTexture && c == 30) c = 61; // wanted star #endif - textPosX += RenderState.scaleX * (RenderState.proportional ? Size[RenderState.style][c] : Size[RenderState.style][209]); + textPosX += RenderState.scaleX * GetCharacterWidth(c); if (c == '\0') textPosX += RenderState.fExtraSpace; } From 232d990e6d76e52821a5cc69d51048a94ddec867 Mon Sep 17 00:00:00 2001 From: withmorten Date: Wed, 13 Jan 2021 00:18:58 +0100 Subject: [PATCH 6/7] move stuff back into class; securom comments --- src/control/Replay.cpp | 2 +- src/control/Replay.h | 6 +--- src/core/Game.cpp | 2 +- src/render/WaterLevel.cpp | 68 +++++++++++++++++++-------------------- src/render/WaterLevel.h | 3 +- src/vehicles/Heli.cpp | 2 +- src/vehicles/Heli.h | 3 +- 7 files changed, 41 insertions(+), 45 deletions(-) diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 37a54999..db768e17 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -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"); diff --git a/src/control/Replay.h b/src/control/Replay.h index 84a6bef0..5dd8b651 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -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 }; diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 8405c2ec..4cf99465 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -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; 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 diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index 644fdde8..7854f7fd 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -762,7 +762,7 @@ CHeli::InitHelis(void) } CHeli* -GenerateHeli(bool catalina) +CHeli::GenerateHeli(bool catalina) { CHeli *heli; CVector heliPos; diff --git a/src/vehicles/Heli.h b/src/vehicles/Heli.h index 1f372e42..c5ae08e2 100644 --- a/src/vehicles/Heli.h +++ b/src/vehicles/Heli.h @@ -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); From e122a75dd283b79fe5f5da742a8e11eab8730ec3 Mon Sep 17 00:00:00 2001 From: withmorten Date: Wed, 13 Jan 2021 00:28:51 +0100 Subject: [PATCH 7/7] more securom fixes --- src/control/Replay.cpp | 18 +++++++++--------- src/vehicles/Cranes.h | 2 +- src/vehicles/Heli.cpp | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index db768e17..e7e0ea8c 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -1748,17 +1748,17 @@ void CReplay::PlayReplayFromHD(void) return; } int slot; - for (slot = 0; CFileMgr::Read(fr, (char*)CReplay::Buffers[slot], sizeof(CReplay::Buffers[slot])); slot++) - CReplay::BufferStatus[slot] = CReplay::REPLAYBUFFER_PLAYBACK; - CReplay::BufferStatus[slot - 1] = CReplay::REPLAYBUFFER_RECORD; - while (slot < CReplay::NUM_REPLAYBUFFERS) - CReplay::BufferStatus[slot++] = CReplay::REPLAYBUFFER_UNUSED; + for (slot = 0; CFileMgr::Read(fr, (char*)Buffers[slot], sizeof(Buffers[slot])); slot++) + BufferStatus[slot] = REPLAYBUFFER_PLAYBACK; + BufferStatus[slot - 1] = REPLAYBUFFER_RECORD; + while (slot < NUM_REPLAYBUFFERS) + BufferStatus[slot++] = REPLAYBUFFER_UNUSED; CFileMgr::CloseFile(fr); CFileMgr::SetDir(""); - CReplay::TriggerPlayback(CReplay::REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false); - CReplay::bPlayingBackFromFile = true; - CReplay::bAllowLookAroundCam = true; - CReplay::StreamAllNecessaryCarsAndPeds(); + TriggerPlayback(REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false); + bPlayingBackFromFile = true; + bAllowLookAroundCam = true; + StreamAllNecessaryCarsAndPeds(); } void CReplay::StreamAllNecessaryCarsAndPeds(void) diff --git a/src/vehicles/Cranes.h b/src/vehicles/Cranes.h index 162f9af9..e842ed3f 100644 --- a/src/vehicles/Cranes.h +++ b/src/vehicles/Cranes.h @@ -88,7 +88,7 @@ public: static bool IsThisCarBeingCarriedByAnyCrane(CVehicle* pVehicle); static bool IsThisCarBeingTargettedByAnyCrane(CVehicle* pVehicle); static void Save(uint8* buf, uint32* size); - static void Load(uint8* buf, uint32 size); // on mobile it's CranesLoad outside of the class + static void Load(uint8* buf, uint32 size); // out of class in III PC and later because of SecuROM static uint32 CarsCollectedMilitaryCrane; static int32 NumCranes; diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index 7854f7fd..1c1b2617 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -800,7 +800,7 @@ CHeli::GenerateHeli(bool catalina) id++; found = true; for(i = 0; i < 4; i++) - if(CHeli::pHelis[i] && CHeli::pHelis[i]->m_nHeliId == id) + if(pHelis[i] && pHelis[i]->m_nHeliId == id) found = false; } heli->m_nHeliId = id;