From d5ce8b1ea3359ad5518e724e32a76ba32be1586b Mon Sep 17 00:00:00 2001 From: withmorten Date: Thu, 14 Jan 2021 23:16:42 +0100 Subject: add the bad crack "features" behind SECUROM define --- src/control/CarCtrl.cpp | 13 +++++++++++-- src/control/Garages.cpp | 4 ++++ src/control/PathFind.cpp | 6 ++++++ src/control/RoadBlocks.cpp | 11 +++++++++++ src/control/Script.cpp | 6 ++++++ 5 files changed, 38 insertions(+), 2 deletions(-) (limited to 'src/control') diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 6f47db05..3299ce00 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -35,6 +35,7 @@ #include "WaterLevel.h" #include "World.h" #include "Zones.h" +#include "Pickups.h" #define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f) #define DISTANCE_TO_SCAN_FOR_DANGER (14.0f) @@ -3184,8 +3185,9 @@ void CCarCtrl::GenerateEmergencyServicesCar(void) CStreaming::RequestModel(MI_AMBULAN, STREAMFLAGS_DEPENDENCY); CStreaming::RequestModel(MI_MEDIC, STREAMFLAGS_DONT_REMOVE); if (CStreaming::HasModelLoaded(MI_AMBULAN) && CStreaming::HasModelLoaded(MI_MEDIC)){ - if (GenerateOneEmergencyServicesCar(MI_AMBULAN, pNearestAccident->m_pVictim->GetPosition())) + if (GenerateOneEmergencyServicesCar(MI_AMBULAN, pNearestAccident->m_pVictim->GetPosition())){ LastTimeAmbulanceCreated = CTimer::GetTimeInMilliseconds(); + } } } } @@ -3203,8 +3205,15 @@ void CCarCtrl::GenerateEmergencyServicesCar(void) CStreaming::RequestModel(MI_FIRETRUCK, STREAMFLAGS_DEPENDENCY); CStreaming::RequestModel(MI_FIREMAN, STREAMFLAGS_DONT_REMOVE); if (CStreaming::HasModelLoaded(MI_FIRETRUCK) && CStreaming::HasModelLoaded(MI_FIREMAN)){ - if (GenerateOneEmergencyServicesCar(MI_FIRETRUCK, pNearestFire->m_vecPos)) + if (GenerateOneEmergencyServicesCar(MI_FIRETRUCK, pNearestFire->m_vecPos)){ LastTimeFireTruckCreated = CTimer::GetTimeInMilliseconds(); +#ifdef SECUROM + if ((myrand() & 7) == 5){ + // if pirated game + CPickups::Init(); + } +#endif + } } } } diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 89377db5..1e547a38 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -177,6 +177,10 @@ void CGarages::Update(void) static uint32 GarageToBeTidied = 0; if (CReplay::IsPlayingBack()) return; +#ifdef SECUROM + extern uint8 gameProcessPirateCheck; + if (gameProcessPirateCheck == 2) return; +#endif bCamShouldBeOutisde = false; TheCamera.pToGarageWeAreIn = nil; TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = nil; diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index aa453701..0f135029 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -1820,6 +1820,12 @@ CPathFind::Load(uint8 *buf, uint32 size) m_pathNodes[i].bBetweenLevels = true; else m_pathNodes[i].bBetweenLevels = false; + +#ifdef SECUROM + // if pirated game + for(i = 0; i < m_numPathNodes; i++) + m_pathNodes[i].bDisabled = true; +#endif } void diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index 260978b3..bcb7e059 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -26,6 +26,10 @@ int16 CRoadBlocks::RoadBlockNodes[NUMROADBLOCKS]; bool CRoadBlocks::InOrOut[NUMROADBLOCKS]; CScriptRoadblock CRoadBlocks::aScriptRoadBlocks[NUM_SCRIPT_ROADBLOCKS]; +#ifdef SECUROM +uint8 roadBlocksPirateCheck = 0; +#endif + void CRoadBlocks::Init(void) { @@ -189,6 +193,13 @@ CRoadBlocks::RegisterScriptRoadBlock(CVector vInf, CVector vSup) void CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2) { +#ifdef SECUROM + if (roadBlocksPirateCheck == 0) + // if not pirated game + // roadBlocksPirateCheck = 1; + // else + roadBlocksPirateCheck = 2; +#endif CMatrix tmp; CVector forward = (point2 - point1); float distBetween = forward.Magnitude(); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 3566e0a6..a61c6b09 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1872,6 +1872,12 @@ void CMissionCleanup::Process() m_sEntities[i].type = CLEANUP_UNUSED; m_nCount--; } +#ifdef SECUROM + if ((myrand() & 3) == 2){ + // if pirated game + CWeather::ForceHurricaneWeather(); + } +#endif } /* NB: CUpsideDownCarCheck is not used by actual script at all -- cgit v1.2.3 From df98d04d79dd88e937d1d688b0005f852c791e58 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 16 Jan 2021 20:04:17 +0300 Subject: fix --- src/control/Script7.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/control') diff --git a/src/control/Script7.cpp b/src/control/Script7.cpp index 55068bb6..34a364a7 100644 --- a/src/control/Script7.cpp +++ b/src/control/Script7.cpp @@ -793,6 +793,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); script_assert(pVehicle); pVehicle->bIsFrozen = ScriptParams[1]; + pVehicle->bInfiniteMass = ScriptParams[1]; return 0; } case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_CHAR: @@ -1104,6 +1105,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); script_assert(pObject); pObject->bIsFrozen = ScriptParams[1]; + pObject->bInfiniteMass = ScriptParams[1]; return 0; } case COMMAND_SET_PLAYER_HAS_MET_DEBBIE_HARRY: -- cgit v1.2.3 From 8b80a8803b005565ddad1bac2cb6e35f398dc5ca Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 18 Jan 2021 23:59:07 +0300 Subject: fix --- src/control/Script4.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index 3c4860f7..51dc14d3 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -1495,7 +1495,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); script_assert(pVehicle); const CVector& pos = pVehicle->GetPosition(); - float heading = CGeneral::GetATanOfXY(pos.y - *(float*)&ScriptParams[2], pos.x - *(float*)&ScriptParams[1]) + HALFPI; + float heading = CGeneral::GetATanOfXY(pos.x - *(float*)&ScriptParams[1], pos.y - *(float*)&ScriptParams[2]) + HALFPI; if (heading > TWOPI) heading -= TWOPI; pVehicle->SetHeading(heading); -- cgit v1.2.3 From 3b52b683e309a6d8f6f25d29ec5f703984ab2458 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 20 Jan 2021 18:59:33 +0200 Subject: Sync matrix with master --- src/control/Replay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index e7e0ea8c..a99979e9 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -336,7 +336,7 @@ void CReplay::RecordThisFrame(void) GoToNextBlock(); tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset]; general->type = REPLAYPACKET_GENERAL; - general->camera_pos.CopyOnlyMatrix(&TheCamera.GetMatrix()); + general->camera_pos.CopyOnlyMatrix(TheCamera.GetMatrix()); general->player_pos = FindPlayerCoors(); general->in_rcvehicle = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle ? true : false; Record.m_nOffset += sizeof(*general); -- cgit v1.2.3 From c7c7eff9180afc3e0271bdbdad28297fcd374694 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 19 Jan 2021 21:32:55 +0200 Subject: Get rid of bitfields in CPool # Conflicts: # src/core/templates.h --- src/control/Garages.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/control') diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 1e547a38..1fecdf22 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1526,7 +1526,7 @@ void CGarage::RefreshDoorPointers(bool bCreate) m_bRecreateDoorOnNextRefresh = false; if (m_pDoor1) { if (m_bDoor1IsDummy) { - if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor1))) + if (CPools::GetDummyPool()->GetIsFree(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor1))) bNeedToFindDoorEntities = true; else { if (m_bDoor1PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor1) & 0x7F)) @@ -1536,7 +1536,7 @@ void CGarage::RefreshDoorPointers(bool bCreate) } } else { - if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor1))) + if (CPools::GetObjectPool()->GetIsFree(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor1))) bNeedToFindDoorEntities = true; else { if (m_bDoor1PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor1) & 0x7F)) @@ -1548,7 +1548,7 @@ void CGarage::RefreshDoorPointers(bool bCreate) } if (m_pDoor2) { if (m_bDoor2IsDummy) { - if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor2))) + if (CPools::GetDummyPool()->GetIsFree(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor2))) bNeedToFindDoorEntities = true; else { if (m_bDoor2PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor2) & 0x7F)) @@ -1558,7 +1558,7 @@ void CGarage::RefreshDoorPointers(bool bCreate) } } else { - if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor2))) + if (CPools::GetObjectPool()->GetIsFree(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor2))) bNeedToFindDoorEntities = true; else { if (m_bDoor2PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor2) & 0x7F)) -- cgit v1.2.3