Merge pull request #960 from withmorten/miami

add the bad crack "features" behind SECUROM define
This commit is contained in:
aap 2021-01-17 20:06:25 +01:00 committed by GitHub
commit 2b4b00b388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 104 additions and 10 deletions

View File

@ -35,6 +35,7 @@
#include "WaterLevel.h" #include "WaterLevel.h"
#include "World.h" #include "World.h"
#include "Zones.h" #include "Zones.h"
#include "Pickups.h"
#define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f) #define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f)
#define DISTANCE_TO_SCAN_FOR_DANGER (14.0f) #define DISTANCE_TO_SCAN_FOR_DANGER (14.0f)
@ -3184,13 +3185,14 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
CStreaming::RequestModel(MI_AMBULAN, STREAMFLAGS_DEPENDENCY); CStreaming::RequestModel(MI_AMBULAN, STREAMFLAGS_DEPENDENCY);
CStreaming::RequestModel(MI_MEDIC, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_MEDIC, STREAMFLAGS_DONT_REMOVE);
if (CStreaming::HasModelLoaded(MI_AMBULAN) && CStreaming::HasModelLoaded(MI_MEDIC)){ 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(); LastTimeAmbulanceCreated = CTimer::GetTimeInMilliseconds();
} }
} }
} }
} }
} }
}
if (NumFiretrucksOnDuty == 0){ if (NumFiretrucksOnDuty == 0){
if (gFireManager.GetTotalActiveFires() < 3){ if (gFireManager.GetTotalActiveFires() < 3){
if (CStreaming::HasModelLoaded(MI_FIRETRUCK)) if (CStreaming::HasModelLoaded(MI_FIRETRUCK))
@ -3203,8 +3205,15 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
CStreaming::RequestModel(MI_FIRETRUCK, STREAMFLAGS_DEPENDENCY); CStreaming::RequestModel(MI_FIRETRUCK, STREAMFLAGS_DEPENDENCY);
CStreaming::RequestModel(MI_FIREMAN, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_FIREMAN, STREAMFLAGS_DONT_REMOVE);
if (CStreaming::HasModelLoaded(MI_FIRETRUCK) && CStreaming::HasModelLoaded(MI_FIREMAN)){ 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(); LastTimeFireTruckCreated = CTimer::GetTimeInMilliseconds();
#ifdef SECUROM
if ((myrand() & 7) == 5){
// if pirated game
CPickups::Init();
}
#endif
}
} }
} }
} }

View File

@ -177,6 +177,10 @@ void CGarages::Update(void)
static uint32 GarageToBeTidied = 0; static uint32 GarageToBeTidied = 0;
if (CReplay::IsPlayingBack()) if (CReplay::IsPlayingBack())
return; return;
#ifdef SECUROM
extern uint8 gameProcessPirateCheck;
if (gameProcessPirateCheck == 2) return;
#endif
bCamShouldBeOutisde = false; bCamShouldBeOutisde = false;
TheCamera.pToGarageWeAreIn = nil; TheCamera.pToGarageWeAreIn = nil;
TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = nil; TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = nil;

View File

@ -1820,6 +1820,12 @@ CPathFind::Load(uint8 *buf, uint32 size)
m_pathNodes[i].bBetweenLevels = true; m_pathNodes[i].bBetweenLevels = true;
else else
m_pathNodes[i].bBetweenLevels = false; m_pathNodes[i].bBetweenLevels = false;
#ifdef SECUROM
// if pirated game
for(i = 0; i < m_numPathNodes; i++)
m_pathNodes[i].bDisabled = true;
#endif
} }
void void

View File

@ -26,6 +26,10 @@ int16 CRoadBlocks::RoadBlockNodes[NUMROADBLOCKS];
bool CRoadBlocks::InOrOut[NUMROADBLOCKS]; bool CRoadBlocks::InOrOut[NUMROADBLOCKS];
CScriptRoadblock CRoadBlocks::aScriptRoadBlocks[NUM_SCRIPT_ROADBLOCKS]; CScriptRoadblock CRoadBlocks::aScriptRoadBlocks[NUM_SCRIPT_ROADBLOCKS];
#ifdef SECUROM
uint8 roadBlocksPirateCheck = 0;
#endif
void void
CRoadBlocks::Init(void) CRoadBlocks::Init(void)
{ {
@ -189,6 +193,13 @@ CRoadBlocks::RegisterScriptRoadBlock(CVector vInf, CVector vSup)
void void
CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2) CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
{ {
#ifdef SECUROM
if (roadBlocksPirateCheck == 0)
// if not pirated game
// roadBlocksPirateCheck = 1;
// else
roadBlocksPirateCheck = 2;
#endif
CMatrix tmp; CMatrix tmp;
CVector forward = (point2 - point1); CVector forward = (point2 - point1);
float distBetween = forward.Magnitude(); float distBetween = forward.Magnitude();

View File

@ -1872,6 +1872,12 @@ void CMissionCleanup::Process()
m_sEntities[i].type = CLEANUP_UNUSED; m_sEntities[i].type = CLEANUP_UNUSED;
m_nCount--; m_nCount--;
} }
#ifdef SECUROM
if ((myrand() & 3) == 2){
// if pirated game
CWeather::ForceHurricaneWeather();
}
#endif
} }
/* NB: CUpsideDownCarCheck is not used by actual script at all /* NB: CUpsideDownCarCheck is not used by actual script at all

View File

@ -3237,7 +3237,9 @@ CMenuManager::PrintBriefs()
void void
CMenuManager::PrintStats() CMenuManager::PrintStats()
{ {
static uint8 pirateCheck = 0; #ifdef SECUROM
static uint8 statsPirateCheck = 0;
#endif
static float scrollY = 0; static float scrollY = 0;
int rowNum = CStats::ConstructStatLine(99999); int rowNum = CStats::ConstructStatLine(99999);
@ -3250,11 +3252,13 @@ CMenuManager::PrintStats()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetDropShadowPosition(0); CFont::SetDropShadowPosition(0);
if (pirateCheck == 0) #ifdef SECUROM
if (statsPirateCheck == 0)
// if not pirated game // if not pirated game
pirateCheck = 46; // statsPirateCheck = 46;
// else // else
// pirateCheck = 45; statsPirateCheck = 45;
#endif
if (m_PrefsLanguage == LANGUAGE_AMERICAN) if (m_PrefsLanguage == LANGUAGE_AMERICAN)
CFont::SetScale(MENU_X(0.43f), MENU_Y(0.75f)); CFont::SetScale(MENU_X(0.43f), MENU_Y(0.75f));
@ -3274,8 +3278,10 @@ CMenuManager::PrintStats()
lastCheck = CTimer::GetTimeInMillisecondsPauseMode(); lastCheck = CTimer::GetTimeInMillisecondsPauseMode();
} }
if (pirateCheck == 45) #ifdef SECUROM
if (statsPirateCheck == 45)
return; return;
#endif
float nextYChange, y, alpha; float nextYChange, y, alpha;

View File

@ -121,6 +121,10 @@ bool8 CGame::VarUpdatePlayerCoords;
int gameTxdSlot; int gameTxdSlot;
#ifdef SECUROM
uint8 gameProcessPirateCheck = 0;
#endif
// --MIAMI: File done // --MIAMI: File done
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); 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(); FrontEndMenuManager.Process();
CTheZones::Update(); 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(); uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
CStreaming::Update(); CStreaming::Update();
uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime; uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;

View File

@ -476,6 +476,10 @@ void CRadar::Draw3dMarkers()
void CRadar::DrawBlips() void CRadar::DrawBlips()
{ {
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) { 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(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);

View File

@ -54,7 +54,7 @@ bool CWeather::bScriptsForceRain;
tRainStreak Streaks[NUM_RAIN_STREAKS]; 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_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, 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 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_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, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_EXTRA_SUNNY,
@ -647,3 +647,18 @@ void CWeather::RenderRainStreaks(void)
TempBufferVerticesStored = 0; TempBufferVerticesStored = 0;
TempBufferIndicesStored = 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

View File

@ -55,6 +55,8 @@ public:
static void AddRain(); static void AddRain();
static void AddHeatHaze(); static void AddHeatHaze();
static void AddBeastie(); static void AddBeastie();
static void ForceHurricaneWeather();
}; };
enum { enum {

View File

@ -326,6 +326,11 @@ GenericLoad()
ReadDataFromBufferPointer(buf, CWeather::OldWeatherType); ReadDataFromBufferPointer(buf, CWeather::OldWeatherType);
ReadDataFromBufferPointer(buf, CWeather::NewWeatherType); ReadDataFromBufferPointer(buf, CWeather::NewWeatherType);
ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType); ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType);
#ifdef SECUROM
if (CTimer::m_FrameCounter > 72000){
buf += align4bytes(4);
}
#endif
ReadDataFromBufferPointer(buf, CWeather::InterpolationValue); ReadDataFromBufferPointer(buf, CWeather::InterpolationValue);
ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList); ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList);
#ifdef COMPATIBLE_SAVES #ifdef COMPATIBLE_SAVES

View File

@ -44,6 +44,10 @@ float fPlayerAimScale = 2.5f;
bool CWeapon::bPhotographHasBeenTaken; bool CWeapon::bPhotographHasBeenTaken;
#ifdef SECUROM
int32 sniperPirateCheck = 0x00797743; // 'Cwy\0' ???
#endif
CWeaponInfo * CWeaponInfo *
CWeapon::GetInfo() CWeapon::GetInfo()
{ {
@ -2201,6 +2205,13 @@ CWeapon::FireSniper(CEntity *shooter)
} }
} }
#ifdef SECUROM
if (sniperPirateCheck){
// if not pirated game
// sniperPirateCheck = 0;
}
#endif
#ifndef FIX_BUGS #ifndef FIX_BUGS
CWeaponInfo *info = GetInfo(); //unused CWeaponInfo *info = GetInfo(); //unused
#endif #endif
@ -2217,6 +2228,10 @@ CWeapon::FireSniper(CEntity *shooter)
dir.Normalise(); dir.Normalise();
dir *= 16.0f; dir *= 16.0f;
#ifdef SECUROM
if (sniperPirateCheck) return true;
#endif
CBulletInfo::AddBullet(shooter, m_eWeaponType, source, dir); CBulletInfo::AddBullet(shooter, m_eWeaponType, source, dir);
if ( shooter == FindPlayerPed() ) if ( shooter == FindPlayerPed() )