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 diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index d14f15d4..98344b6d 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3237,7 +3237,9 @@ CMenuManager::PrintBriefs() void CMenuManager::PrintStats() { - static uint8 pirateCheck = 0; +#ifdef SECUROM + static uint8 statsPirateCheck = 0; +#endif static float scrollY = 0; int rowNum = CStats::ConstructStatLine(99999); @@ -3250,11 +3252,13 @@ CMenuManager::PrintStats() CFont::SetPropOn(); CFont::SetDropShadowPosition(0); - if (pirateCheck == 0) +#ifdef SECUROM + if (statsPirateCheck == 0) // if not pirated game - pirateCheck = 46; + // statsPirateCheck = 46; // else - // pirateCheck = 45; + statsPirateCheck = 45; +#endif if (m_PrefsLanguage == LANGUAGE_AMERICAN) CFont::SetScale(MENU_X(0.43f), MENU_Y(0.75f)); @@ -3274,8 +3278,10 @@ CMenuManager::PrintStats() lastCheck = CTimer::GetTimeInMillisecondsPauseMode(); } - if (pirateCheck == 45) +#ifdef SECUROM + if (statsPirateCheck == 45) return; +#endif float nextYChange, y, alpha; diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 4cf99465..ece19446 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -121,6 +121,10 @@ bool8 CGame::VarUpdatePlayerCoords; int gameTxdSlot; +#ifdef SECUROM +uint8 gameProcessPirateCheck = 0; +#endif + // --MIAMI: File done bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); @@ -845,7 +849,14 @@ void CGame::Process(void) FrontEndMenuManager.Process(); CTheZones::Update(); - // DRM call in here +#ifdef SECUROM + if (CTimer::GetTimeInMilliseconds() >= (35 * 60 * 1000) && gameProcessPirateCheck == 0){ + // if game not pirated + // gameProcessPirateCheck = 1; + // else + gameProcessPirateCheck = 2; + } +#endif uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond(); CStreaming::Update(); uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime; diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 8fe900ae..6fbc2280 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -476,6 +476,10 @@ void CRadar::Draw3dMarkers() void CRadar::DrawBlips() { if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) { +#ifdef SECUROM + extern uint8 roadBlocksPirateCheck; + if (roadBlocksPirateCheck == 2) return; +#endif RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index 17c45fcd..f5d7402a 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -54,7 +54,7 @@ bool CWeather::bScriptsForceRain; tRainStreak Streaks[NUM_RAIN_STREAKS]; -const int16 WeatherTypesList[] = { +int16 WeatherTypesList[] = { WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_EXTRA_SUNNY, @@ -73,7 +73,7 @@ const int16 WeatherTypesList[] = { WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY }; -const int16 WeatherTypesList_WithHurricanes[] = { +int16 WeatherTypesList_WithHurricanes[] = { WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_EXTRA_SUNNY, @@ -647,3 +647,18 @@ void CWeather::RenderRainStreaks(void) TempBufferVerticesStored = 0; TempBufferIndicesStored = 0; } + +#ifdef SECUROM +void CWeather::ForceHurricaneWeather() +{ + for (int i = 0; i < ARRAY_SIZE(WeatherTypesList_WithHurricanes); i++) + { + WeatherTypesList[i] = WEATHER_HURRICANE; + WeatherTypesList_WithHurricanes[i] = WEATHER_HURRICANE; + } + + CWeather::OldWeatherType = WEATHER_HURRICANE; + CWeather::NewWeatherType = WEATHER_HURRICANE; + CWeather::ForcedWeatherType = WEATHER_HURRICANE; +} +#endif diff --git a/src/render/Weather.h b/src/render/Weather.h index ef62ebb6..bda57d55 100644 --- a/src/render/Weather.h +++ b/src/render/Weather.h @@ -55,6 +55,8 @@ public: static void AddRain(); static void AddHeatHaze(); static void AddBeastie(); + + static void ForceHurricaneWeather(); }; enum { diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 82f66308..b0cf1d98 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -326,6 +326,11 @@ GenericLoad() ReadDataFromBufferPointer(buf, CWeather::OldWeatherType); ReadDataFromBufferPointer(buf, CWeather::NewWeatherType); ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType); +#ifdef SECUROM + if (CTimer::m_FrameCounter > 72000){ + buf += align4bytes(4); + } +#endif ReadDataFromBufferPointer(buf, CWeather::InterpolationValue); ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList); #ifdef COMPATIBLE_SAVES diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 940a6b98..17e0b313 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -44,6 +44,10 @@ float fPlayerAimScale = 2.5f; bool CWeapon::bPhotographHasBeenTaken; +#ifdef SECUROM +int32 sniperPirateCheck = 0x00797743; // 'Cwy\0' ??? +#endif + CWeaponInfo * CWeapon::GetInfo() { @@ -2201,6 +2205,13 @@ CWeapon::FireSniper(CEntity *shooter) } } +#ifdef SECUROM + if (sniperPirateCheck){ + // if not pirated game + // sniperPirateCheck = 0; + } +#endif + #ifndef FIX_BUGS CWeaponInfo *info = GetInfo(); //unused #endif @@ -2217,6 +2228,10 @@ CWeapon::FireSniper(CEntity *shooter) dir.Normalise(); dir *= 16.0f; +#ifdef SECUROM + if (sniperPirateCheck) return true; +#endif + CBulletInfo::AddBullet(shooter, m_eWeaponType, source, dir); if ( shooter == FindPlayerPed() )