summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/audio/sampman_oal.cpp2
-rw-r--r--src/control/PathFind.cpp2
-rw-r--r--src/control/Script.cpp14
-rw-r--r--src/control/Script.h2
-rw-r--r--src/core/Accident.cpp2
-rw-r--r--src/core/Camera.cpp6
-rw-r--r--src/core/Clock.cpp10
-rw-r--r--src/core/Frontend.cpp5
-rw-r--r--src/core/Game.cpp80
-rw-r--r--src/core/Zones.cpp6
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/main.cpp28
-rw-r--r--src/core/re3.cpp2
-rw-r--r--src/peds/CivilianPed.cpp59
-rw-r--r--src/peds/Ped.cpp722
-rw-r--r--src/peds/Ped.h22
-rw-r--r--src/peds/Population.cpp4
-rw-r--r--src/peds/Population.h2
-rw-r--r--src/render/Occlusion.cpp6
-rw-r--r--src/render/Occlusion.h4
-rw-r--r--src/render/PlayerSkin.cpp2
-rw-r--r--src/rw/RwHelper.cpp6
22 files changed, 482 insertions, 505 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index ffa4c456..1e9f60fd 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -450,9 +450,9 @@ int8 cSampleManager::GetCurrent3DProviderIndex(void)
int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
{
- ASSERT( nProvider < m_nNumberOfProviders );
if (nProvider >= m_nNumberOfProviders)
nProvider = 0;
+ ASSERT( nProvider < m_nNumberOfProviders );
int savedprovider = curprovider;
if ( nProvider < m_nNumberOfProviders )
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index 0dd9359c..f8bc2df6 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -1737,7 +1737,7 @@ CPathFind::Load(uint8 *buf, uint32 size)
void
CPathFind::DisplayPathData(void)
{
- // Not the function from mobm_carPathLinksile but my own!
+ // Not the function from mobile but my own!
int i, j, k;
// Draw 50 units around camera
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index bf761a3f..0921d1c6 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1698,11 +1698,11 @@ void CMissionCleanup::AddEntityToList(int32 id, uint8 type)
m_nCount++;
}
-static void PossiblyWakeThisEntity(CPhysical* pEntity)
+static void PossiblyWakeThisEntity(CPhysical* pEntity, bool ifColLoaded = false)
{
if (!pEntity->bIsStaticWaitingForCollision)
return;
- if (CColStore::HasCollisionLoaded(pEntity->GetPosition())) {
+ if (!ifColLoaded || CColStore::HasCollisionLoaded(pEntity->GetPosition())) {
pEntity->bIsStaticWaitingForCollision = false;
if (!pEntity->IsStatic())
pEntity->AddToMovingList();
@@ -1745,7 +1745,7 @@ void CMissionCleanup::RemoveEntityFromList(int32 id, uint8 type)
}
}
-void CMissionCleanup::CheckIfCollisionHasLoadedForMissionObject()
+void CMissionCleanup::CheckIfCollisionHasLoadedForMissionObjects()
{
for (int i = 0; i < MAX_CLEANUP; i++) {
switch (m_sEntities[i].type) {
@@ -1753,21 +1753,21 @@ void CMissionCleanup::CheckIfCollisionHasLoadedForMissionObject()
{
CVehicle* v = CPools::GetVehiclePool()->GetAt(m_sEntities[i].id);
if (v)
- PossiblyWakeThisEntity(v);
+ PossiblyWakeThisEntity(v, true);
break;
}
case CLEANUP_CHAR:
{
CPed* p = CPools::GetPedPool()->GetAt(m_sEntities[i].id);
if (p)
- PossiblyWakeThisEntity(p);
+ PossiblyWakeThisEntity(p, true);
break;
}
case CLEANUP_OBJECT:
{
CObject* o = CPools::GetObjectPool()->GetAt(m_sEntities[i].id);
if (o)
- PossiblyWakeThisEntity(o);
+ PossiblyWakeThisEntity(o, true);
break;
}
default:
@@ -2350,7 +2350,7 @@ void CTheScripts::Process()
float timeStep = CTimer::GetTimeStepInMilliseconds();
UpsideDownCars.UpdateTimers();
StuckCars.Process();
- MissionCleanup.CheckIfCollisionHasLoadedForMissionObject();
+ MissionCleanup.CheckIfCollisionHasLoadedForMissionObjects();
DrawScriptSpheres();
if (FailCurrentMission)
--FailCurrentMission;
diff --git a/src/control/Script.h b/src/control/Script.h
index ba315c46..42f9cbff 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -138,7 +138,7 @@ public:
void AddEntityToList(int32, uint8);
void RemoveEntityFromList(int32, uint8);
void Process();
- void CheckIfCollisionHasLoadedForMissionObject();
+ void CheckIfCollisionHasLoadedForMissionObjects();
CPhysical* DoesThisEntityWaitForCollision(int i);
};
diff --git a/src/core/Accident.cpp b/src/core/Accident.cpp
index c8611323..cb46e181 100644
--- a/src/core/Accident.cpp
+++ b/src/core/Accident.cpp
@@ -6,6 +6,8 @@
#include "Pools.h"
#include "World.h"
+// --MIAMI: File done
+
CAccidentManager gAccidentManager;
CAccident*
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index df778815..704e77b8 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -2044,7 +2044,11 @@ CCamera::GetScreenRect(CRect &rect)
{
rect.left = 0.0f;
rect.right = SCREEN_WIDTH;
- if(m_WideScreenOn){
+ if(m_WideScreenOn
+#ifdef CUTSCENE_BORDERS_SWITCH
+ && CMenuManager::m_PrefsCutsceneBorders
+#endif
+ ){
float borderSize = (SCREEN_HEIGHT / 2) * (m_ScreenReductionPercentage / 100.f);
rect.top = borderSize - SCREEN_SCALE_Y(22.f);
rect.bottom = SCREEN_HEIGHT - borderSize - SCREEN_SCALE_Y(14.f);
diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp
index e4b908e0..6c54ac63 100644
--- a/src/core/Clock.cpp
+++ b/src/core/Clock.cpp
@@ -5,6 +5,8 @@
#include "Clock.h"
#include "Stats.h"
+// --MIAMI: File done
+
_TODO("gbFastTime");
bool gbFastTime;
@@ -73,8 +75,14 @@ CClock::Update(void)
void
CClock::SetGameClock(uint8 h, uint8 m)
{
- ms_nGameClockHours = h;
+ while (m >= 60) {
+ m -= 60;
+ h++;
+ }
ms_nGameClockMinutes = m;
+ while (h >= 24)
+ h -= 24;
+ ms_nGameClockHours = h;
ms_nGameClockSeconds = 0;
ms_nLastClockTick = CTimer::GetTimeInMilliseconds();
}
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index c55b139c..715e9061 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -3507,8 +3507,9 @@ CMenuManager::Process(void)
UserInput();
ProcessFileActions();
DMAudio.Service();
-
- // Game calls some texture pool cleanup functions in here
+#ifdef USE_TEXTURE_POOL
+ // TODO
+#endif
}
SwitchMenuOnAndOff();
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index ee3c32b1..d108c78d 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -109,6 +109,7 @@ bool CGame::japaneseGame = false;
int gameTxdSlot;
+// --MIAMI: File done
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
void DoRWStuffEndOfFrame(void);
@@ -153,7 +154,11 @@ CGame::InitialiseOnceBeforeRW(void)
{
CFileMgr::Initialise();
CdStreamInit(MAX_CDCHANNELS);
- ValidateVersion();
+ debug("size of matrix %d\n", sizeof(CMatrix));
+ debug("size of placeable %d\n", sizeof(CPlaceable));
+ debug("size of entity %d\n", sizeof(CEntity));
+ debug("size of building %d\n", sizeof(CBuilding));
+ debug("size of dummy %d\n", sizeof(CDummy));
#ifdef EXTENDED_COLOURFILTER
CPostFX::InitOnce();
#endif
@@ -172,6 +177,7 @@ void ReplaceAtomicPipeCallback();
bool
CGame::InitialiseRenderWare(void)
{
+ ValidateVersion();
#ifdef USE_TEXTURE_POOL
_TexturePoolsInitialise();
#endif
@@ -237,7 +243,6 @@ CGame::InitialiseRenderWare(void)
void CGame::ShutdownRenderWare(void)
{
- CMBlur::MotionBlurClose();
DestroySplashScreen();
CHud::Shutdown();
CFont::Shutdown();
@@ -293,7 +298,6 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.SetEffectsMasterVolume(FrontEndMenuManager.m_PrefsSfxVolume);
DMAudio.SetEffectsFadeVol(127);
DMAudio.SetMusicFadeVol(127);
- CWorld::Players[0].SetPlayerSkin(FrontEndMenuManager.m_PrefsSkinFile);
return true;
}
@@ -311,7 +315,11 @@ bool CGame::Initialise(const char* datFile)
strcpy(aDatFile, datFile);
CPools::Initialise();
CIniFile::LoadIniFile();
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsUnknown(false);
+#endif
currLevel = LEVEL_BEACH;
+ currArea = AREA_MAIN_MAP;
LoadingScreen("Loading the Game", "Loading generic textures", GetRandomSplashScreen());
gameTxdSlot = CTxdStore::AddTxdSlot("generic");
CTxdStore::Create(gameTxdSlot);
@@ -362,11 +370,12 @@ bool CGame::Initialise(const char* datFile)
// for generic fallback
CustomPipes::SetTxdFindCallback();
#endif
+ LoadingScreen("Loading the Game", "Add Particles", nil);
CWorld::AddParticles();
CVehicleModelInfo::LoadVehicleColours();
CVehicleModelInfo::LoadEnvironmentMaps();
CTheZones::PostZoneCreation();
- LoadingScreen("Loading the Game", "Setup paths", GetRandomSplashScreen());
+ LoadingScreen("Loading the Game", "Setup paths", nil);
ThePaths.PreparePathData();
for (int i = 0; i < NUMPLAYERS; i++)
CWorld::Players[i].Clear();
@@ -382,10 +391,12 @@ bool CGame::Initialise(const char* datFile)
CStreaming::LoadInitialPeds();
CStreaming::RequestBigBuildings(LEVEL_GENERIC);
CStreaming::LoadAllRequestedModels(false);
+ CStreaming::RemoveIslandsNotUsed(currLevel);
printf("Streaming uses %zuK of its memory", CStreaming::ms_memoryUsed / 1024); // original modifier was %d
LoadingScreen("Loading the Game", "Load animations", GetRandomSplashScreen());
CAnimManager::LoadAnimFiles();
CStreaming::LoadInitialWeapons();
+ CStreaming::LoadAllRequestedModels(0);
CPed::Initialise();
CRouteNode::Initialise();
CEventList::Initialise();
@@ -449,6 +460,9 @@ bool CGame::Initialise(const char* datFile)
CCollision::ms_collisionInMemory = currLevel;
for (int i = 0; i < MAX_PADS; i++)
CPad::GetPad(i)->Clear(true);
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsUnknown(true);
+#endif
// TODO(Miami)
// DMAudio.SetStartingTrackPositions(1);
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
@@ -457,10 +471,16 @@ bool CGame::Initialise(const char* datFile)
bool CGame::ShutDown(void)
{
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsUnknown(false);
+#endif
CReplay::FinishPlayback();
+ CReplay::EmptyReplayBuffer();
CPlane::Shutdown();
CTrain::Shutdown();
CScriptPaths::Shutdown();
+ // TODO(Miami)
+ // CWaterCreatures::RemoveAll();
CSpecialFX::Shutdown();
#ifndef PS2
CGarages::Shutdown();
@@ -495,7 +515,7 @@ bool CGame::ShutDown(void)
CStreaming::Shutdown();
CTxdStore::GameShutdown();
CCollision::Shutdown();
- CWaterLevel::Shutdown();
+ CWaterLevel::DestroyWavyAtomic();
CRubbish::Shutdown();
CClouds::Shutdown();
CShadows::Shutdown();
@@ -505,7 +525,11 @@ bool CGame::ShutDown(void)
CParticle::Shutdown();
CPools::ShutDown();
CTxdStore::RemoveTxdSlot(gameTxdSlot);
+ CMBlur::MotionBlurClose();
CdStreamRemoveImages();
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsFinalShutdown();
+#endif
return true;
}
@@ -539,7 +563,10 @@ void CGame::ReInitGameObjectVariables(void)
CDraw::SetFOV(120.0f);
CDraw::ms_fLODDistance = 500.0f;
CStreaming::RequestBigBuildings(LEVEL_GENERIC);
+ CStreaming::RemoveIslandsNotUsed(LEVEL_BEACH);
+ CStreaming::RemoveIslandsNotUsed(LEVEL_MAINLAND);
CStreaming::LoadAllRequestedModels(false);
+ currArea = AREA_MAIN_MAP;
CPed::Initialise();
CEventList::Initialise();
CWeapon::InitialiseWeapons();
@@ -603,9 +630,13 @@ void CGame::ReloadIPLs(void)
void CGame::ShutDownForRestart(void)
{
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsUnknown(false);
+#endif
CReplay::FinishPlayback();
CReplay::EmptyReplayBuffer();
DMAudio.DestroyAllGameCreatedEntities();
+ CMovingThings::Shutdown();
for (int i = 0; i < NUMPLAYERS; i++)
CWorld::Players[i].Clear();
@@ -620,11 +651,10 @@ void CGame::ShutDownForRestart(void)
CRadar::RemoveRadarSections();
FrontEndMenuManager.UnloadTextures();
CParticleObject::RemoveAllExpireableParticleObjects();
- //CWaterCreatures::RemoveAll(); //TODO VC
+ //CWaterCreatures::RemoveAll(); //TODO(Miami)
CSetPieces::Init();
CPedType::Shutdown();
CSpecialFX::Shutdown();
- TidyUpMemory(true, false);
}
void CGame::InitialiseWhenRestarting(void)
@@ -649,13 +679,15 @@ void CGame::InitialiseWhenRestarting(void)
if ( FrontEndMenuManager.m_bWantToLoad == true )
{
RestoreForStartLoad();
- CStreaming::LoadScene(TheCamera.GetPosition());
}
ReInitGameObjectVariables();
if ( FrontEndMenuManager.m_bWantToLoad == true )
{
+ FrontEndMenuManager.m_bWantToLoad = false;
+ // TODO(Miami)
+ //InitRadioStationPositionList();
if ( GenericLoad() == true )
{
DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
@@ -670,6 +702,7 @@ void CGame::InitialiseWhenRestarting(void)
FrontEndMenuManager.MessageScreen("FED_LFL", true); // Loading save game has failed. The game will restart now.
}
+ TheCamera.SetFadeColour(0, 0, 0);
ShutDownForRestart();
CTimer::Stop();
CTimer::Initialise();
@@ -683,6 +716,9 @@ void CGame::InitialiseWhenRestarting(void)
CTimer::Update();
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsUnknown(true);
+#endif
}
void CGame::Process(void)
@@ -691,20 +727,20 @@ void CGame::Process(void)
#ifdef GTA_PS2
ProcessTidyUpMemory();
#endif
- TheCamera.SetMotionBlurAlpha(0);
- if (TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_SNIPER || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE)
- TheCamera.SetMotionBlur(0, 0, 0, 0, MOTION_BLUR_NONE);
#ifdef DEBUGMENU
DebugMenuProcess();
#endif
CCutsceneMgr::Update();
if (!CCutsceneMgr::IsCutsceneProcessing() && !CTimer::GetIsCodePaused())
FrontEndMenuManager.Process();
+ CTheZones::Update();
+ // DRM call in here
+ uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
CStreaming::Update();
+ uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;
CWindModifiers::Number = 0;
if (!CTimer::GetIsPaused())
{
- CTheZones::Update();
CSprite2d::SetRecipNearClip();
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -728,7 +764,13 @@ void CGame::Process(void)
CEventList::Update();
CParticle::Update();
gFireManager.Update();
- CPopulation::Update();
+ if (processTime >= 2) {
+ CPopulation::Update(false);
+ } else {
+ uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
+ CPopulation::Update(true);
+ processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;
+ }
CWeapon::UpdateWeapons();
if (!CCutsceneMgr::IsRunning())
CTheCarGenerators::Process();
@@ -761,9 +803,11 @@ void CGame::Process(void)
gPhoneInfo.Update();
if (!CReplay::IsPlayingBack())
{
- CCarCtrl::GenerateRandomCars();
+ if (processTime < 2)
+ CCarCtrl::GenerateRandomCars();
CRoadBlocks::GenerateRoadBlocks();
CCarCtrl::RemoveDistantCars();
+ CCarCtrl::RemoveCarsIfThePoolGetsFull();
}
}
}
@@ -794,16 +838,22 @@ CGame::CanSeeOutSideFromCurrArea(void)
void CGame::DrasticTidyUpMemory(bool)
{
+#ifdef USE_TEXTURE_POOL
+ // TODO
+#endif
#ifdef PS2
// meow
#endif
}
-void CGame::TidyUpMemory(bool, bool)
+void CGame::TidyUpMemory(bool unk1, bool unk2)
{
#ifdef PS2
// meow
#endif
+ if (unk2) {
+ DrasticTidyUpMemory(true); // parameter is unknown too
+ }
}
void CGame::ProcessTidyUpMemory(void)
diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp
index a255fb7d..1eb1513e 100644
--- a/src/core/Zones.cpp
+++ b/src/core/Zones.cpp
@@ -730,9 +730,9 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
InfoZoneArray[i].child = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].child);
InfoZoneArray[i].parent = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].parent);
InfoZoneArray[i].next = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].next);
- InfoZoneArray[i].child = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].child);
- InfoZoneArray[i].parent = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].parent);
- InfoZoneArray[i].next = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].next);
+ assert(InfoZoneArray[i].child == nil);
+ assert(InfoZoneArray[i].parent == nil);
+ assert(InfoZoneArray[i].next == nil);
}
for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++)
diff --git a/src/core/config.h b/src/core/config.h
index 62c3fa73..276ddefd 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -304,7 +304,6 @@ enum Config {
#define PED_SKIN // support for skinned geometry on peds
#define ANIMATE_PED_COL_MODEL
#define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
-// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER
// Camera
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 0009048d..5a31ad22 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -256,26 +256,11 @@ DoFade(void)
fadeColor.a = alpha;
}
- // This is CCamera::GetScreenRect in VC
- if(TheCamera.m_WideScreenOn
-#ifdef CUTSCENE_BORDERS_SWITCH
- && CMenuManager::m_PrefsCutsceneBorders
-#endif
- ){
- float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
- rect.left = 0.0f;
- rect.right = SCREEN_WIDTH;
- rect.top = y - SCREEN_SCALE_Y(22.0f);
- rect.bottom = SCREEN_HEIGHT - y - SCREEN_SCALE_Y(14.0f);
- }else{
- rect.left = 0.0f;
- rect.right = SCREEN_WIDTH;
- rect.top = 0.0f;
- rect.bottom = SCREEN_HEIGHT;
- }
+ TheCamera.GetScreenRect(rect);
CSprite2d::DrawRect(rect, fadeColor);
if(CDraw::FadeValue != 0 && TheCamera.m_FadeTargetIsSplashScreen){
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
fadeColor.r = 255;
fadeColor.g = 255;
fadeColor.b = 255;
@@ -954,11 +939,12 @@ Render2dStuff(void)
if(cammode == CCam::MODE_SNIPER ||
cammode == CCam::MODE_SNIPER_RUNABOUT ||
cammode == CCam::MODE_ROCKETLAUNCHER ||
- cammode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT)
+ cammode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT ||
+ cammode == CCam::MODE_CAMERA)
firstPersonWeapon = true;
// Draw black border for sniper and rocket launcher
- if((weaponType == WEAPONTYPE_SNIPERRIFLE || weaponType == WEAPONTYPE_ROCKETLAUNCHER) && firstPersonWeapon){
+ if((weaponType == WEAPONTYPE_SNIPERRIFLE || weaponType == WEAPONTYPE_ROCKETLAUNCHER || weaponType == WEAPONTYPE_LASERSCOPE) && firstPersonWeapon){
CRGBA black(0, 0, 0, 255);
// top and bottom strips
@@ -980,13 +966,17 @@ Render2dStuff(void)
CSceneEdit::Draw();
else
CHud::Draw();
+ // TODO(Miami)
+ // CSpecialFX::Render2DFXs();
CUserDisplay::OnscnTimer.ProcessForDisplay();
CMessages::Display();
CDarkel::DrawMessages();
CGarages::PrintMessages();
CPad::PrintErrorMessage();
CFont::DrawFonts();
+#ifndef MASTER
COcclusion::Render();
+#endif
#ifdef DEBUGMENU
DebugMenuRender();
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index ce34dc0f..0b80862e 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -429,7 +429,9 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Render", "Motion Blur", &CPostFX::MotionBlurOn, nil);
#endif
DebugMenuAddVar("Render", "Drunkness", &CMBlur::Drunkness, nil, 0.05f, 0, 1.0f);
+#ifndef MASTER
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDisplayOccDebugStuff, nil);
+#endif
#ifdef EXTENDED_PIPELINES
static const char *vehpipenames[] = { "MatFX", "Neo" };
e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil,
diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp
index 51c11775..9f938a56 100644
--- a/src/peds/CivilianPed.cpp
+++ b/src/peds/CivilianPed.cpp
@@ -23,6 +23,7 @@ CCivilianPed::CCivilianPed(ePedType pedtype, uint32 mi) : CPed(pedtype)
m_bAttractorUnk = (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 1.25f);
}
+// --MIAMI: Done
void
CCivilianPed::CivilianAI(void)
{
@@ -39,7 +40,13 @@ CCivilianPed::CivilianAI(void)
if (CTimer::GetTimeInMilliseconds() <= m_lookTimer)
return;
- uint32 closestThreatFlag = ScanForThreats();
+ ScanForDelayedResponseThreats();
+ if (!m_threatFlags || CTimer::GetTimeInMilliseconds() <= m_threatCheckTimer)
+ return;
+ CheckThreatValidity();
+ uint32 closestThreatFlag = m_threatFlags;
+ m_threatFlags = 0;
+ m_threatCheckTimer = 0;
if (closestThreatFlag == PED_FLAG_EXPLOSION) {
float angleToFace = CGeneral::GetRadianAngleBetweenPoints(
m_eventOrThreat.x, m_eventOrThreat.y,
@@ -53,18 +60,30 @@ CCivilianPed::CivilianAI(void)
}
return;
}
- uint32 closestThreatFlag = ScanForThreats();
+ ScanForDelayedResponseThreats();
+ if (!m_threatFlags || CTimer::GetTimeInMilliseconds() <= m_threatCheckTimer)
+ return;
+ CheckThreatValidity();
+ uint32 closestThreatFlag = m_threatFlags;
+ m_threatFlags = 0;
+ m_threatCheckTimer = 0;
if (closestThreatFlag == PED_FLAG_GUN) {
if (!m_threatEntity || !m_threatEntity->IsPed())
return;
CPed *threatPed = (CPed*)m_threatEntity;
float threatDistSqr = (m_threatEntity->GetPosition() - GetPosition()).MagnitudeSqr2D();
+ if (CharCreatedBy == MISSION_CHAR && bCrouchWhenScared) {
+ SetDuck(10000, true);
+ SetLookFlag(m_threatEntity, false);
+ SetLookTimer(500);
+ return;
+ }
if (m_pedStats->m_fear <= m_pedStats->m_lawfulness) {
if (m_pedStats->m_temper <= m_pedStats->m_fear) {
if (!threatPed->IsPlayer() || !RunToReportCrime(CRIME_POSSESSION_GUN)) {
- if (threatDistSqr < sq(10.0f)) {
- Say(SOUND_PED_FLEE_SPRINT);
+ if (threatDistSqr < sq(30.0f)) {
+ bMakeFleeScream = true;
SetFindPathAndFlee(m_threatEntity, 10000);
} else {
SetFindPathAndFlee(m_threatEntity->GetPosition(), 5000, true);
@@ -74,13 +93,16 @@ CCivilianPed::CivilianAI(void)
SetFindPathAndFlee(m_threatEntity, 5000);
if (threatDistSqr < sq(20.0f)) {
SetMoveState(PEDMOVE_RUN);
- Say(SOUND_PED_FLEE_SPRINT);
+ bMakeFleeScream = true;
} else {
SetMoveState(PEDMOVE_WALK);
}
+ } else if (threatPed->IsPlayer() && IsGangMember() && b158_80) {
+ SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, m_threatEntity);
+
} else if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
SetFindPathAndFlee(m_threatEntity, 5000);
- if (threatDistSqr < sq(10.0f)) {
+ if (threatDistSqr < sq(30.0f)) {
SetMoveState(PEDMOVE_RUN);
} else {
SetMoveState(PEDMOVE_WALK);
@@ -89,12 +111,12 @@ CCivilianPed::CivilianAI(void)
SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, m_threatEntity);
}
} else {
- if (threatDistSqr < sq(10.0f)) {
- Say(SOUND_PED_FLEE_SPRINT);
+ if (threatDistSqr < sq(30.0f)) {
+ bMakeFleeScream = true;
SetFindPathAndFlee(m_threatEntity, 10000);
SetMoveState(PEDMOVE_SPRINT);
} else {
- Say(SOUND_PED_FLEE_SPRINT);
+ bMakeFleeScream = false;
SetFindPathAndFlee(m_threatEntity, 5000);
SetMoveState(PEDMOVE_RUN);
}
@@ -103,7 +125,10 @@ CCivilianPed::CivilianAI(void)
SetLookTimer(500);
} else if (closestThreatFlag == PED_FLAG_DEADPEDS) {
float eventDistSqr = (m_pEventEntity->GetPosition() - GetPosition()).MagnitudeSqr2D();
- if (((CPed*)m_pEventEntity)->bIsDrowning || IsGangMember() && m_nPedType == ((CPed*)m_pEventEntity)->m_nPedType) {
+ if (CharCreatedBy == MISSION_CHAR && bCrouchWhenScared && eventDistSqr < sq(5.0f)) {
+ SetDuck(10000, true);
+
+ } else if (((CPed*)m_pEventEntity)->bIsDrowning || IsGangMember() && m_nPedType == ((CPed*)m_pEventEntity)->m_nPedType) {
if (eventDistSqr < sq(5.0f)) {
SetFindPathAndFlee(m_pEventEntity, 2000);
SetMoveState(PEDMOVE_RUN);
@@ -128,8 +153,11 @@ CCivilianPed::CivilianAI(void)
} else if (closestThreatFlag == PED_FLAG_EXPLOSION) {
CVector2D eventDistVec = m_eventOrThreat - GetPosition();
float eventDistSqr = eventDistVec.MagnitudeSqr();
- if (eventDistSqr < sq(20.0f)) {
- Say(SOUND_PED_FLEE_SPRINT);
+ if (CharCreatedBy == MISSION_CHAR && bCrouchWhenScared && eventDistSqr < sq(20.0f)) {
+ SetDuck(10000, true);
+
+ } else if (eventDistSqr < sq(20.0f)) {
+ bMakeFleeScream = true;
SetFlee(m_eventOrThreat, 2000);
float angleToFace = CGeneral::GetRadianAngleBetweenPoints(
m_eventOrThreat.x, m_eventOrThreat.y,
@@ -154,8 +182,11 @@ CCivilianPed::CivilianAI(void)
if (m_threatEntity && m_threatEntity->IsPed()) {
CPed *threatPed = (CPed*)m_threatEntity;
if (m_pedStats->m_fear <= 100 - threatPed->m_pedStats->m_temper && threatPed->m_nPedType != PEDTYPE_COP) {
- if (threatPed->GetWeapon(m_currentWeapon).IsTypeMelee() || !GetWeapon()->IsTypeMelee()) {
- if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
+ if (threatPed->GetWeapon()->IsTypeMelee() || !GetWeapon()->IsTypeMelee()) {
+ if (threatPed->IsPlayer() && IsGangMember() && b158_80) {
+ SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, m_threatEntity);
+
+ } else if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) {
SetFindPathAndFlee(m_threatEntity, 10000);
}
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 390c3ccd..0cc5eeaf 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -206,15 +206,12 @@ CPed::FlagToDestroyWhenNextProcessed(void)
m_pVehicleAnim = nil;
}
+// --MIAMI: Done
CPed::CPed(uint32 pedType) : m_pedIK(this)
{
#ifdef USE_CUTSCENE_SHADOW_FOR_PED
m_pRTShadow = nil;
#endif
- m_type = ENTITY_TYPE_PED;
- bPedPhysics = true;
- bUseCollisionRecords = true;
-
m_vecAnimMoveDelta.x = 0.0f;
m_vecAnimMoveDelta.y = 0.0f;
m_fHealth = 100.0f;
@@ -224,6 +221,12 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_soundStart = 0;
m_lastQueuedSound = SOUND_NO_SOUND;
m_queuedSound = SOUND_NO_SOUND;
+ m_canTalk = true;
+
+ m_type = ENTITY_TYPE_PED;
+ bPedPhysics = true;
+ bUseCollisionRecords = true;
+
m_objective = OBJECTIVE_NONE;
m_prevObjective = OBJECTIVE_NONE;
#ifdef FIX_BUGS
@@ -246,8 +249,8 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_pedFormation = FORMATION_UNDEFINED;
m_collidingThingTimer = 0;
m_nPedStateTimer = 0;
- m_actionX = 0;
- m_actionY = 0;
+ m_actionX = 0.0f;
+ m_actionY = 0.0f;
m_phoneTalkTimer = 0;
m_stateUnused = 0;
m_leaveCarTimer = 0;
@@ -315,11 +318,14 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_pathNodeTimer = 0;
m_pCurPathNode = nil;
+ m_threatFlags = 0;
+ m_threatCheckTimer = 0;
+ m_threatCheckInterval = CGeneral::GetRandomNumberInRange(250, 1000);
+
m_routeLastPoint = -1;
m_routeStartPoint = 0;
m_routePointsPassed = 0;
m_routeType = 0;
- m_bodyPartBleeding = -1;
m_fMass = 70.0f;
m_fTurnMass = 100.0f;
@@ -327,6 +333,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_fElasticity = 0.05f;
m_ceaseAttackTimer = 0;
+ m_bodyPartBleeding = -1;
bIsStanding = false;
bWasStanding = false;
@@ -355,7 +362,6 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bIsShooting = false;
bFindNewNodeAfterStateRestore = false;
- bHasACamera = false;
bGonnaInvestigateEvent = false;
bPedIsBleeding = false;
bStopAndShoot = false;
@@ -376,7 +382,6 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bWanderPathAfterExitingCar = false;
bIsLeader = false;
bDontDragMeOutCar = false;
- m_ped_flagF8 = false;
bWillBeQuickJacked = false;
bCancelEnteringCar = false;
bObstacleShowedUpDuringKillObjective = false;
@@ -405,23 +410,30 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bVehExitWillBeInstant = false;
bHasAlreadyBeenRecorded = false;
bFallenDown = false;
+#ifdef PED_SKIN
+ bDontAcceptIKLookAts = false;
+#endif
+ bReachedAttractorHeadingTarget = false;
+ bTurnedAroundOnAttractor = false;
#ifdef KANGAROO_CHEAT
m_ped_flagI80 = false;
#endif
- bReachedAttractorHeadingTarget = false;
- bTurnedAroundOnAttractor = false;
bHasAlreadyUsedAttractor = false;
+ b155_2 = false;
bCarPassenger = false;
+ b155_8 = false;
+ b155_10 = false;
bMiamiViceCop = false;
bMoneyHasBeenGivenByScript = false;
bHasBeenPhotographed = false;
bIsDrowning = false;
bDrownsInWater = true;
- bHeadStuckInCollision = false;
+ b156_4 = false;
bHeldHostageInCar = false;
bIsPlayerFriend = true;
+ bHeadStuckInCollision = false;
bDeadPedInFrontOfCar = false;
m_gangFlags = 0xFF;
@@ -442,10 +454,18 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bCollectBusFare = false;
bBoughtIceCream = false;
b158_40 = false;
+ b158_80 = false;
- if ((CGeneral::GetRandomNumber() & 3) == 0)
+ if (CGeneral::GetRandomNumber() & 3)
+ bHasACamera = false;
+ else
bHasACamera = true;
+ if (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) <= 0.95f)
+ b157_8 = false;
+ else
+ b157_8 = true;
+
m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this);
DMAudio.SetEntityStatus(m_audioEntityId, 1);
m_fearFlags = CPedType::GetThreats(m_nPedType);
@@ -486,14 +506,18 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_nPedMoney = random % 25;
if (m_nPedMoney == 23)
m_nPedMoney = 400;
- m_nExtendedRangeTimer = 0;
m_bleedCounter = 0;
+ m_nExtendedRangeTimer = 0;
+ m_vehicleInAccident = nil;
+ m_attractor = nil;
+ m_positionInQueue = -1;
#ifdef PED_SKIN
m_pWeaponModel = nil;
#endif
m_delayedSoundID = -1;
m_delayedSoundTimer = 0;
CPopulation::UpdatePedCount((ePedType)m_nPedType, false);
+ m_lastComment = -1;
}
// --MIAMI: Done
@@ -810,6 +834,7 @@ RecurseFrameChildrenVisibilityCB(RwFrame* frame, void* data)
return frame;
}
+// --MIAMI: Done
void
CPed::RemoveBodyPart(PedNode nodeId, int8 direction)
{
@@ -819,21 +844,8 @@ CPed::RemoveBodyPart(PedNode nodeId, int8 direction)
frame = m_pFrames[nodeId]->frame;
if (frame) {
if (CGame::nastyGame) {
-#ifdef PED_SKIN
- if(!IsClumpSkinned(GetClump()))
-#endif
- {
- if (nodeId != PED_HEAD)
- SpawnFlyingComponent(nodeId, direction);
-
- RecurseFrameChildrenVisibilityCB(frame, nil);
- }
- pos.x = 0.0f;
- pos.y = 0.0f;
- pos.z = 0.0f;
- TransformToNode(pos, PED_HEAD);
-
if (CEntity::GetIsOnScreen()) {
+ m_pedIK.GetComponentPosition(pos, nodeId);
CParticle::AddParticle(PARTICLE_TEST, pos,
CVector(0.0f, 0.0f, 0.0f),
nil, 0.1f, 0, 0, 0, 0);
@@ -904,10 +916,10 @@ CPed::OurPedCanSeeThisOne(CEntity *target, bool shootablesDoBlock)
CColPoint colpoint;
CEntity *ent;
- CVector2D dist = CVector2D(target->GetPosition()) - CVector2D(this->GetPosition());
+ CVector2D dist = CVector2D(target->GetPosition()) - CVector2D(GetPosition());
// Check if target is behind ped
- if (DotProduct2D(dist, CVector2D(this->GetForward())) < 0.0f)
+ if (DotProduct2D(dist, CVector2D(GetForward())) < 0.0f)
return false;
// Check if target is too far away
@@ -936,7 +948,7 @@ CPed::Avoid(void)
if (nearestPed && nearestPed->m_nPedState != PED_DEAD && nearestPed != m_pSeekTarget && nearestPed != m_pedInObjective) {
// Check if this ped wants to avoid the nearest one
- if (CPedType::GetAvoid(this->m_nPedType) & CPedType::GetFlag(nearestPed->m_nPedType)) {
+ if (CPedType::GetAvoid(m_nPedType) & CPedType::GetFlag(nearestPed->m_nPedType)) {
// Further codes checks whether the distance between us and ped will be equal or below 1.0, if we walk up to him by 1.25 meters.
// If so, we want to avoid it, so we turn our body 45 degree and look to somewhere else.
@@ -1712,10 +1724,10 @@ CPed::BeingDraggedFromCar(void)
bool dontRunAnim = false;
if (!m_pVehicleAnim) {
- CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 100.0f);
+ CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 1000.0f);
AssocGroupId assocGroup;
- if (m_pMyVehicle->IsBike()) {
+ if (m_pMyVehicle && m_pMyVehicle->IsBike()) {
enterAnim = ANIM_BIKE_HIT;
assocGroup = ((CBike*)m_pMyVehicle)->m_bikeAnimType;
@@ -1770,6 +1782,7 @@ CPed::BeingDraggedFromCar(void)
}
}
+// --MIAMI: Done
void
CPed::RestartNonPartialAnims(void)
{
@@ -4044,11 +4057,11 @@ CPed::CheckThreatValidity(void)
{
if (m_threatEntity && !IsEntityPointerValid(m_threatEntity)) {
m_threatFlags = 0;
- m_threatEntity = 0;
+ m_threatEntity = nil;
}
if (m_pEventEntity && !IsEntityPointerValid(m_pEventEntity)) {
m_threatFlags = 0;
- m_pEventEntity = 0;
+ m_pEventEntity = nil;
}
if (!m_threatEntity && !m_pEventEntity)
m_threatFlags = 0;
@@ -4137,6 +4150,7 @@ CPed::ClearAttackByRemovingAnim(void)
}
}
+// --MIAMI: Done
void
CPed::StopNonPartialAnims(void)
{
@@ -8546,16 +8560,20 @@ CPed::Wait(void)
&& CTimer::GetTimeInMilliseconds() <= m_nWaitTimer
&& animAssoc) {
- TurnBody();
+ if (pedWeLook)
+ TurnBody();
} else {
ClearWaitState();
m_nWaitTimer = 0;
if (m_pLookTarget && m_pLookTarget->IsPed()) {
-
if (m_nPedState != PED_FLEE_ENTITY && m_nPedState != PED_ATTACK) {
+ if (bCrouchWhenScared) {
+ if (bIsDucking) {
+ ClearDuck(false);
+ SetDuck(10000, true);
+ }
- if (m_pedStats->m_fear <= 100 - pedWeLook->m_pedStats->m_temper) {
-
+ } else if (m_pedStats->m_fear <= 100 - pedWeLook->m_pedStats->m_temper) {
if (GetWeapon()->IsTypeMelee()) {
#ifdef VC_PED_PORTS
if(m_pedStats->m_flags & STAT_GUN_PANIC) {
@@ -11937,9 +11955,10 @@ CPed::ProcessControl(void)
LookForSexyPeds();
LookForSexyCars();
}
+
if (!IsPlayer() && m_pMyVehicle->IsBoat()
&& FindPlayerPed()->m_pCurrentPhysSurface == m_pMyVehicle
- && CharCreatedBy != MISSION_CHAR || !bIsPlayerFriend) {
+ && (CharCreatedBy != MISSION_CHAR || !bIsPlayerFriend)) {
SetObjective(OBJECTIVE_KILL_CHAR_ON_BOAT, FindPlayerPed());
Say(SOUND_PED_CAR_JACKED);
}
@@ -12379,7 +12398,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
}
if (player != pedToDragOut) {
- pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, true);
+ pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, false);
if (pedToDragOut->IsGangMember())
pedToDragOut->RegisterThreatWithGangPeds(ped);
}
@@ -14097,19 +14116,32 @@ CPed::ProcessObjective(void)
GetPedAttractorManager()->BroadcastDeparture(this, m_attractor);
m_objectiveTimer = 0;
}
- }
- else {
+ } else {
m_objective = OBJECTIVE_NONE;
SetMoveState(PEDMOVE_STILL);
}
}
break;
+ case OBJECTIVE_WAIT_ON_FOOT_FOR_COP:
+ if (!m_pedInObjective) {
+ m_objective = OBJECTIVE_NONE;
+ SetWanderPath(CGeneral::GetRandomNumberInRange(0.f, 8.f));
+ } else if (m_pedInObjective->m_nPedType == PEDTYPE_COP && m_pedInObjective->m_nPedState == PED_DEAD) {
+ m_objective = OBJECTIVE_NONE;
+ SetWanderPath(CGeneral::GetRandomNumberInRange(0.f, 8.f));
+ m_pedInObjective = nil;
+ }
+ break;
case OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE:
+ if (m_leaveCarTimer >= CTimer::GetTimeInMilliseconds())
+ break;
+
if (InVehicle()) {
SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
bFleeAfterExitingCar = true;
} else if (m_nPedState != PED_FLEE_POS) {
- SetFlee(GetPosition(), 10000);
+ CVector2D fleePos = GetPosition();
+ SetFlee(fleePos, 10000);
bUsePedNodeSeek = true;
m_pNextPathNode = nil;
}
@@ -14125,11 +14157,13 @@ CPed::ProcessObjective(void)
}
float distWithTargetSc = distWithTarget.Magnitude();
if (2.0f * m_distanceToCountSeekDoneEx >= distWithTargetSc) {
- if (m_pedInObjective) {
+ if (m_pedInObjective && m_pedInObjective->m_nPedState != PED_DEAD) {
if (distWithTargetSc <= m_distanceToCountSeekDoneEx)
SetIdle();
- else
- SetSeek(m_vecSeekPosEx, m_distanceToCountSeekDoneEx);
+ else {
+ CVector seekPos = m_vecSeekPosEx;
+ SetSeek(seekPos, m_distanceToCountSeekDoneEx);
+ }
} else if (CTimer::GetTimeInMilliseconds() > m_lookTimer) {
int threatType = ScanForThreats();
SetLookTimer(CGeneral::GetRandomNumberInRange(500, 1500));
@@ -14141,15 +14175,16 @@ CPed::ProcessObjective(void)
}
}
} else {
- SetSeek(m_vecSeekPosEx, m_distanceToCountSeekDoneEx);
+ CVector seekPos = m_vecSeekPosEx;
+ SetSeek(seekPos, m_distanceToCountSeekDoneEx);
}
break;
}
case OBJECTIVE_WAIT_IN_CAR:
- m_nPedState = PED_DRIVING;
+ SetPedState(PED_DRIVING);
break;
case OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT:
- m_nPedState = PED_DRIVING;
+ SetPedState(PED_DRIVING);
break;
case OBJECTIVE_KILL_CHAR_ANY_MEANS:
{
@@ -14162,9 +14197,9 @@ CPed::ProcessObjective(void)
break;
}
if (InVehicle()) {
- if (distWithTarget.Magnitude() >= 20.0f
- || m_pMyVehicle->m_vecMoveSpeed.MagnitudeSqr() >= sq(0.02f)) {
- if (m_pMyVehicle->pDriver == this
+ if (distWithTarget.Magnitude() >= 20.0f || m_pMyVehicle->m_vecMoveSpeed.MagnitudeSqr() >= sq(0.02f)) {
+
+ if (((m_pMyVehicle->pDriver == this && m_pMyVehicle->AutoPilot.m_nCarMission == MISSION_NONE) || m_pMyVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE)
&& !m_pMyVehicle->m_nGettingInFlags) {
m_pMyVehicle->SetStatus(STATUS_PHYSICS);
m_pMyVehicle->AutoPilot.m_nPrevRouteNode = 0;
@@ -14179,9 +14214,7 @@ CPed::ProcessObjective(void)
}
} else {
bool targetHasVeh = m_pedInObjective->bInVehicle;
- if (!targetHasVeh
-// TODO(MIAMI): argument
- || targetHasVeh && m_pedInObjective->m_pMyVehicle->CanPedExitCar(false)) {
+ if (!targetHasVeh || targetHasVeh && m_pedInObjective->m_pMyVehicle->CanPedExitCar(false)) {
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0;
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
@@ -14197,7 +14230,7 @@ CPed::ProcessObjective(void)
float closestVehDist = 60.0f;
int16 lastVehicle;
CEntity* vehicles[8];
- CWorld::FindObjectsInRange(GetPosition(), 25.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
+ CWorld::FindObjectsInRange(GetPosition(), 30.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
CVehicle *foundVeh = nil;
for(int i = 0; i < lastVehicle; i++) {
CVehicle *nearVeh = (CVehicle*)vehicles[i];
@@ -14208,7 +14241,7 @@ CPed::ProcessObjective(void)
*/
CVector vehDistVec = nearVeh->GetPosition() - GetPosition();
if (vehDistVec.Magnitude() < closestVehDist && m_pedInObjective->m_pMyVehicle != nearVeh
- && nearVeh->CanPedOpenLocks(this)) {
+ && nearVeh->CanPedOpenLocks(this) && nearVeh->m_fHealth > 250.f) {
foundVeh = nearVeh;
closestVehDist = vehDistVec.Magnitude();
@@ -14231,7 +14264,14 @@ CPed::ProcessObjective(void)
int chosenCarClass;
CTheZones::GetZoneInfoForTimeOfDay(&ourPos, &zoneInfo);
int chosenModel = CCarCtrl::ChooseModel(&zoneInfo, &ourPos, &chosenCarClass);
- CAutomobile *newVeh = new CAutomobile(chosenModel, RANDOM_VEHICLE);
+ CVehicle *newVeh = nil;
+ if (chosenModel != -1) {
+ if (CModelInfo::IsBikeModel(chosenModel)) {
+ newVeh = new CBike(chosenModel, RANDOM_VEHICLE);
+ } else {
+ newVeh = new CAutomobile(chosenModel, RANDOM_VEHICLE);
+ }
+ }
if (newVeh) {
newVeh->GetMatrix().GetPosition() = ThePaths.m_pathNodes[closestNode].GetPosition();
newVeh->GetMatrix().GetPosition().z += 4.0f;
@@ -14299,6 +14339,8 @@ CPed::ProcessObjective(void)
time = 6000;
SetFindPathAndFlee(m_pedInObjective, time);
+ if (m_pedStats == CPedStats::ms_apPedStats[PEDSTAT_FIREMAN])
+ bMakeFleeScream = true;
}
break;
}
@@ -14382,7 +14424,7 @@ CPed::ProcessObjective(void)
SetSeek(posToGo, 1.0f);
if (distWithTarget.Magnitude() <= 3.0f) {
SetSeek(posToGo, 1.0f);
- if (m_pedInObjective->m_nMoveState != PEDMOVE_STILL)
+ if (m_pedInObjective && m_pedInObjective->m_nMoveState != PEDMOVE_STILL)
SetMoveState(m_pedInObjective->m_nMoveState);
} else {
SetSeek(posToGo, 1.0f);
@@ -14415,21 +14457,28 @@ CPed::ProcessObjective(void)
if (m_objectiveTimer && m_objectiveTimer < CTimer::GetTimeInMilliseconds()) {
if (!EnteringCar()) {
bool foundSeat = false;
- if (m_carInObjective->pPassengers[0] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RF) {
- if (m_carInObjective->pPassengers[1] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_LR) {
- if (m_carInObjective->pPassengers[2] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RR) {
- foundSeat = false;
+ if (m_carInObjective->IsBike()) {
+ if (!m_carInObjective->pPassengers[0] && !(m_carInObjective->m_nGettingInFlags & (CAR_DOOR_FLAG_RR | CAR_DOOR_FLAG_LR))) {
+ m_vehEnterType = CAR_DOOR_RR;
+ foundSeat = true;
+ }
+ } else {
+ if (m_carInObjective->pPassengers[0] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RF) {
+ if (m_carInObjective->pPassengers[1] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_LR) {
+ if (m_carInObjective->pPassengers[2] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RR) {
+ foundSeat = false;
+ } else {
+ m_vehEnterType = CAR_DOOR_RR;
+ foundSeat = true;
+ }
} else {
- m_vehEnterType = CAR_DOOR_RR;
+ m_vehEnterType = CAR_DOOR_LR;
foundSeat = true;
}
} else {
- m_vehEnterType = CAR_DOOR_LR;
+ m_vehEnterType = CAR_DOOR_RF;
foundSeat = true;
}
- } else {
- m_vehEnterType = CAR_DOOR_RF;
- foundSeat = true;
}
for (int i = 2; i < m_carInObjective->m_nNumMaxPassengers; ++i) {
if (!m_carInObjective->pPassengers[i] && !(m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RF)) {
@@ -14450,12 +14499,9 @@ CPed::ProcessObjective(void)
case OBJECTIVE_ENTER_CAR_AS_DRIVER:
{
if (!m_carInObjective || bInVehicle) {
-#ifdef VC_PED_PORTS
if (bInVehicle && m_pMyVehicle != m_carInObjective) {
SetExitCar(m_pMyVehicle, 0);
- } else
-#endif
- {
+ } else {
bObjectiveCompleted = true;
bScriptObjectiveCompleted = true;
RestorePreviousState();
@@ -14473,11 +14519,7 @@ CPed::ProcessObjective(void)
return;
}
if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) {
- if (m_carInObjective->pDriver
-#ifdef VC_PED_PORTS
- && !IsPlayer()
-#endif
- ) {
+ if (m_carInObjective->pDriver && !IsPlayer()) {
if (m_carInObjective->pDriver->m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS && m_carInObjective->pDriver != m_pedInObjective) {
SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, m_carInObjective);
m_carInObjective->bIsBeingCarJacked = false;
@@ -14486,9 +14528,7 @@ CPed::ProcessObjective(void)
}
} else if (m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
if (m_carInObjective->pDriver
-#ifdef VC_PED_PORTS
&& (CharCreatedBy != MISSION_CHAR || m_carInObjective->pDriver->CharCreatedBy != RANDOM_CHAR)
-#endif
) {
if (m_carInObjective->pDriver->m_nPedType == m_nPedType) {
SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, m_carInObjective);
@@ -14518,10 +14558,7 @@ CPed::ProcessObjective(void)
WarpPedToNearEntityOffScreen(m_carInObjective);
if (CharCreatedBy != MISSION_CHAR || m_prevObjective == OBJECTIVE_KILL_CHAR_ANY_MEANS
-#ifdef VC_PED_PORTS
- || IsPlayer() && !CPad::GetPad(0)->ArePlayerControlsDisabled()
-#endif
- ) {
+ || IsPlayer() && !CPad::GetPad(0)->ArePlayerControlsDisabled()) {
RestorePreviousObjective();
RestorePreviousState();
if (IsPedInControl())
@@ -15144,6 +15181,48 @@ CPed::ProcessObjective(void)
if (m_attractor && CWeather::Rain < 0.2f)
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
break;
+ case OBJECTIVE_KILL_CHAR_ON_BOAT:
+ SetPedStats(PEDSTAT_TOUGH_GUY);
+ if (bInVehicle) {
+ if (m_pedInObjective && m_pedInObjective->m_pCurrentPhysSurface != m_pMyVehicle) {
+ bObjectiveCompleted = true;
+ ClearObjective();
+ CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle);
+ m_pMyVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
+ m_pMyVehicle->AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * m_pMyVehicle->pHandling->Transmission.fUnkMaxVelocity;
+ m_pMyVehicle->SetStatus(STATUS_PHYSICS);
+ } else {
+ SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
+ }
+ } else if (m_pedInObjective && !m_pedInObjective->DyingOrDead() &&
+ (!m_pCurrentPhysSurface || !m_pedInObjective->m_pCurrentPhysSurface ||
+ m_pedInObjective->m_pCurrentPhysSurface == m_pCurrentPhysSurface)) {
+
+ CBoat *boatWeAreOn = nil;
+ if (m_pCurrentPhysSurface && m_pCurrentPhysSurface->IsVehicle() && ((CVehicle*)m_pCurrentPhysSurface)->IsBoat())
+ boatWeAreOn = (CBoat*)m_pCurrentPhysSurface;
+
+ if (boatWeAreOn) {
+ SetObjective(OBJECTIVE_RUN_TO_AREA, boatWeAreOn->GetPosition() - (boatWeAreOn->GetForward() * 10.f));
+ } else if (m_pedInObjective) {
+ SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, m_pedInObjective);
+ }
+ } else {
+ SetMoveAnim();
+ ClearLookFlag();
+ SetMoveAnim();
+ if (m_pCurrentPhysSurface && m_pCurrentPhysSurface->IsVehicle())
+ SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, m_pCurrentPhysSurface);
+ }
+ break;
+ case OBJECTIVE_SOLICIT_FOOT:
+ if (m_pedInObjective) {
+ if (m_objectiveTimer < CTimer::GetTimeInMilliseconds())
+ bScriptObjectiveCompleted = true;
+ } else {
+ bScriptObjectiveCompleted = true;
+ }
+ break;
case OBJECTIVE_WAIT_ON_FOOT_AT_BUS_STOP:
SetIdle();
if (m_attractor) {
@@ -15318,51 +15397,6 @@ CPed::SetExitTrain(CVehicle* train)
}
#endif
-#ifdef NEW_WALK_AROUND_ALGORITHM
-CVector
-LocalPosForWalkAround(CVector2D colMin, CVector2D colMax, int walkAround, uint32 enterDoorNode, bool itsVan) {
- switch (walkAround) {
- case 0:
- if (enterDoorNode == CAR_DOOR_LF)
- return CVector(colMin.x, colMax.y - 1.0f, 0.0f);
- case 1:
- return CVector(colMin.x, colMax.y, 0.0f);
- case 2:
- case 3:
- if (walkAround == 3 && enterDoorNode == CAR_DOOR_RF)
- return CVector(colMax.x, colMax.y - 1.0f, 0.0f);
-
- return CVector(colMax.x, colMax.y, 0.0f);
- case 4:
- if (enterDoorNode == CAR_DOOR_RR && !itsVan)
- return CVector(colMax.x, colMin.y + 1.0f, 0.0f);
- case 5:
- return CVector(colMax.x, colMin.y, 0.0f);
- case 6:
- case 7:
- if (walkAround == 7 && enterDoorNode == CAR_DOOR_LR && !itsVan)
- return CVector(colMin.x, colMin.y + 1.0f, 0.0f);
-
- return CVector(colMin.x, colMin.y, 0.0f);
- default:
- return CVector(0.0f, 0.0f, 0.0f);
- }
-}
-
-bool
-CanWeSeeTheCorner(CVector2D dist, CVector2D fwdOffset)
-{
- // because fov isn't important if dist is more then 5 unit, we want shortest way
- if (dist.Magnitude() > 5.0f)
- return true;
-
- if (DotProduct2D(dist, fwdOffset) < 0.0f)
- return false;
-
- return true;
-}
-#endif
-
// --MIAMI: Done
bool
CPed::SetDirectionToWalkAroundVehicle(CVehicle* veh)
@@ -15370,6 +15404,7 @@ CPed::SetDirectionToWalkAroundVehicle(CVehicle* veh)
return SetFollowPath(m_vecSeekPos, 0.0f, m_nMoveState, veh, m_pedInObjective, m_nMoveState == PEDMOVE_WALK ? 2000 : 250);
}
+// --MIAMI: Done
void
CPed::SetDirectionToWalkAroundObject(CEntity *obj)
{
@@ -15430,11 +15465,9 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
objUpsideDown = false;
}
float oldRotDest = m_fRotationDest;
-#ifndef NEW_WALK_AROUND_ALGORITHM
float angleToFaceObjCenter = (objColCenter - GetPosition()).Heading();
float angleDiffBtwObjCenterAndForward = CGeneral::LimitRadianAngle(dirToSet - angleToFaceObjCenter);
float objTopRightHeading = Atan2(adjustedColMax.x - adjustedColMin.x, adjustedColMax.y - adjustedColMin.y);
-#endif
if (IsPlayer()) {
if (FindPlayerPed()->m_fMoveSpeed <= 0.0f)
@@ -15478,16 +15511,9 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
bool collidingThingChanged = true;
CEntity *obstacle;
-#ifndef NEW_WALK_AROUND_ALGORITHM
if (!obj->IsVehicle() || objUpsideDown) {
collidingThingChanged = false;
- } else {
-#else
- CVector cornerToGo = CVector(10.0f, 10.0f, 10.0f);
- int dirToGo;
- m_walkAroundType = 0;
- int iWouldPreferGoingBack = 0; // 1:left 2:right
-#endif
+ } else {
float adjustedCheckInterval = 0.7f * checkIntervalInDist;
CVector posToCheck;
@@ -15508,25 +15534,6 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
entityOnTopLeftOfObj = 3;
}
}
-#ifdef NEW_WALK_AROUND_ALGORITHM
- else {
- CVector tl = obj->GetMatrix() * CVector(adjustedColMin.x, adjustedColMax.y, 0.0f) - GetPosition();
- if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) {
- cornerToGo = tl;
- m_walkAroundType = 1;
-
- if (m_vehEnterType == CAR_DOOR_LR)
- iWouldPreferGoingBack = 1;
- } else if(CanWeSeeTheCorner(tl, GetForward())){
- cornerToGo = tl;
- dirToGo = GetLocalDirection(tl);
- if (dirToGo == 1)
- m_walkAroundType = 0; // ALL of the next turns will be right turn
- else if (dirToGo == 3)
- m_walkAroundType = 1; // ALL of the next turns will be left turn
- }
- }
-#endif
// Top right of obj
posToCheck.x = adjustedColMax.x - adjustedCheckInterval;
@@ -15545,27 +15552,6 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
entityOnTopRightOfObj = 3;
}
}
-#ifdef NEW_WALK_AROUND_ALGORITHM
- else {
- CVector tr = obj->GetMatrix() * CVector(adjustedColMax.x, adjustedColMax.y, 0.0f) - GetPosition();
- if (tr.Magnitude2D() < cornerToGo.Magnitude2D()) {
- if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) {
- cornerToGo = tr;
- m_walkAroundType = 2;
-
- if (m_vehEnterType == CAR_DOOR_RR)
- iWouldPreferGoingBack = 2;
- } else if (CanWeSeeTheCorner(tr, GetForward())) {
- cornerToGo = tr;
- dirToGo = GetLocalDirection(tr);
- if (dirToGo == 1)
- m_walkAroundType = 2; // ALL of the next turns will be right turn
- else if (dirToGo == 3)
- m_walkAroundType = 3; // ALL of the next turns will be left turn
- }
- }
- }
-#endif
// Bottom right of obj
posToCheck.x = adjustedColMax.x - adjustedCheckInterval;
@@ -15584,26 +15570,6 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
entityOnBottomRightOfObj = 3;
}
}
-#ifdef NEW_WALK_AROUND_ALGORITHM
- else {
- CVector br = obj->GetMatrix() * CVector(adjustedColMax.x, adjustedColMin.y, 0.0f) - GetPosition();
- if (iWouldPreferGoingBack == 2)
- m_walkAroundType = 4;
- else if (br.Magnitude2D() < cornerToGo.Magnitude2D()) {
- if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) {
- cornerToGo = br;
- m_walkAroundType = 5;
- } else if (CanWeSeeTheCorner(br, GetForward())) {
- cornerToGo = br;
- dirToGo = GetLocalDirection(br);
- if (dirToGo == 1)
- m_walkAroundType = 4; // ALL of the next turns will be right turn
- else if (dirToGo == 3)
- m_walkAroundType = 5; // ALL of the next turns will be left turn
- }
- }
- }
-#endif
// Bottom left of obj
posToCheck.x = adjustedColMin.x + adjustedCheckInterval;
@@ -15622,26 +15588,55 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
entityOnBottomLeftOfObj = 3;
}
}
-#ifdef NEW_WALK_AROUND_ALGORITHM
- else {
- CVector bl = obj->GetMatrix() * CVector(adjustedColMin.x, adjustedColMin.y, 0.0f) - GetPosition();
- if (iWouldPreferGoingBack == 1)
- m_walkAroundType = 7;
- else if (bl.Magnitude2D() < cornerToGo.Magnitude2D()) {
- if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) {
- cornerToGo = bl;
- m_walkAroundType = 6;
- } else if (CanWeSeeTheCorner(bl, GetForward())) {
- cornerToGo = bl;
- dirToGo = GetLocalDirection(bl);
- if (dirToGo == 1)
- m_walkAroundType = 6; // ALL of the next turns will be right turn
- else if (dirToGo == 3)
- m_walkAroundType = 7; // ALL of the next turns will be left turn
- }
+ }
+
+ if (!entityOnTopLeftOfObj && !entityOnTopRightOfObj) {
+ CVector topLeftCorner(adjustedColMin.x - 0.3f, adjustedColMax.y + 0.3f, 0.0f);
+ topLeftCorner = objMat * topLeftCorner;
+ CVector topRightCorner(adjustedColMax.x + 0.3f, adjustedColMax.y + 0.3f, 0.0f);
+ topRightCorner = objMat * topRightCorner;
+ CColPoint foundCol;
+ CEntity *foundEnt;
+ if (CWorld::ProcessLineOfSight(topLeftCorner, topRightCorner, foundCol, foundEnt, true, true, false, true, false, false, false, false)) {
+ switch (foundEnt->GetType()) {
+ case ENTITY_TYPE_VEHICLE:
+ entityOnTopRightOfObj = 2;
+ entityOnTopLeftOfObj = 2;
+ break;
+ case ENTITY_TYPE_BUILDING:
+ entityOnTopRightOfObj = 1;
+ entityOnTopLeftOfObj = 1;
+ break;
+ case ENTITY_TYPE_OBJECT:
+ entityOnTopRightOfObj = 3;
+ entityOnTopLeftOfObj = 3;
+ break;
+ }
+ }
+ }
+ if (!entityOnBottomRightOfObj && !entityOnBottomLeftOfObj) {
+ CVector bottomRightCorner(adjustedColMax.x + 0.3f, adjustedColMin.y - 0.3f, 0.0f);
+ bottomRightCorner = objMat * bottomRightCorner;
+ CVector bottomLeftCorner(adjustedColMin.x - 0.3f, adjustedColMin.y - 0.3f, 0.0f);
+ bottomLeftCorner = objMat * bottomLeftCorner;
+ CColPoint foundCol;
+ CEntity* foundEnt;
+ if (CWorld::ProcessLineOfSight(bottomRightCorner, bottomLeftCorner, foundCol, foundEnt, true, true, false, true, false, false, false, false)) {
+ switch (foundEnt->GetType()) {
+ case ENTITY_TYPE_VEHICLE:
+ entityOnBottomLeftOfObj = 2;
+ entityOnBottomRightOfObj = 2;
+ break;
+ case ENTITY_TYPE_BUILDING:
+ entityOnBottomLeftOfObj = 1;
+ entityOnBottomRightOfObj = 1;
+ break;
+ case ENTITY_TYPE_OBJECT:
+ entityOnBottomLeftOfObj = 3;
+ entityOnBottomRightOfObj = 3;
+ break;
}
}
-#else
}
if (entityOnTopLeftOfObj && entityOnTopRightOfObj && entityOnBottomRightOfObj && entityOnBottomLeftOfObj) {
@@ -15713,7 +15708,6 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
m_walkAroundType = 0;
}
}
-#endif
}
m_collidingEntityWhileFleeing = obj;
m_collidingEntityWhileFleeing->RegisterReference((CEntity**) &m_collidingEntityWhileFleeing);
@@ -15723,56 +15717,6 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
CVector localPosToHead;
-#ifdef NEW_WALK_AROUND_ALGORITHM
- int nextWalkAround = m_walkAroundType;
- if (m_walkAroundType % 2 == 0) {
- nextWalkAround += 2;
- if (nextWalkAround > 6)
- nextWalkAround = 0;
- } else {
- nextWalkAround -= 2;
- if (nextWalkAround < 0)
- nextWalkAround = 7;
- }
-
- CVector nextPosToHead = objMat * LocalPosForWalkAround(adjustedColMin, adjustedColMax, nextWalkAround, goingToEnterCar ? m_vehEnterType : 0, goingToEnterCarAndItsVan);
- bool nextRouteIsClear = CWorld::GetIsLineOfSightClear(GetPosition(), nextPosToHead, true, true, true, true, true, true, false);
-
- if(nextRouteIsClear)
- m_walkAroundType = nextWalkAround;
- else {
- CVector posToHead = objMat * LocalPosForWalkAround(adjustedColMin, adjustedColMax, m_walkAroundType, goingToEnterCar ? m_vehEnterType : 0, goingToEnterCarAndItsVan);
- bool currentRouteIsClear = CWorld::GetIsLineOfSightClear(GetPosition(), posToHead,
- true, true, true, true, true, true, false);
-
- /* Either;
- * - Some obstacle came in and it's impossible to reach current destination
- * - We reached to the destination, but since next route is not clear, we're turning around us
- */
- if (!currentRouteIsClear ||
- ((posToHead - GetPosition()).Magnitude2D() < 0.8f &&
- !CWorld::GetIsLineOfSightClear(GetPosition() + GetForward(), nextPosToHead,
- true, true, true, true, true, true, false))) {
-
- // Change both target and direction (involves changing even/oddness)
- if (m_walkAroundType % 2 == 0) {
- m_walkAroundType -= 2;
- if (m_walkAroundType < 0)
- m_walkAroundType = 7;
- else
- m_walkAroundType += 1;
- } else {
- m_walkAroundType += 2;
- if (m_walkAroundType > 7)
- m_walkAroundType = 0;
- else
- m_walkAroundType -= 1;
- }
- }
- }
-
- localPosToHead = LocalPosForWalkAround(adjustedColMin, adjustedColMax, m_walkAroundType, goingToEnterCar ? m_vehEnterType : 0, goingToEnterCarAndItsVan);
-#else
if (Abs(angleDiffBtwObjCenterAndForward) < objTopRightHeading) {
if (goingToEnterCar) {
if (goingToEnterCarAndItsVan) {
@@ -15887,7 +15831,6 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
}
}
}
-#endif
if (objUpsideDown)
localPosToHead.x = localPosToHead.x * -1.0f;
@@ -15914,6 +15857,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 280.0f * dist * checkIntervalInTime;
}
+// --MIAMI: Done
int32
CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
{
@@ -15926,22 +15870,16 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
CColModel *ourCol = CModelInfo::GetModelInfo(GetModelIndex())->GetColModel();
CColModel *hisCol = CModelInfo::GetModelInfo(collidingEnt->GetModelIndex())->GetColModel();
- if (!bUsesCollision)
+ if (!bUsesCollision && !bJustCheckCollision)
return false;
if (collidingEnt->IsVehicle() && ((CVehicle*)collidingEnt)->IsBoat())
collidedWithBoat = true;
// ofc we're not vehicle
- if (!m_bIsVehicleBeingShifted && !bSkipLineCol
-#ifdef VC_PED_PORTS
- && !collidingEnt->IsPed()
-#endif
- ) {
+ if (!m_bIsVehicleBeingShifted && !bSkipLineCol && !collidingEnt->IsPed()) {
if (!bCollisionProcessed) {
-#ifdef VC_PED_PORTS
m_pCurrentPhysSurface = nil;
-#endif
if (bIsStanding) {
bIsStanding = false;
bWasStanding = true;
@@ -15963,16 +15901,11 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
}
if (CCollision::IsStoredPolyStillValidVerticalLine(pos, potentialGroundZ, intersectionPoint, &m_collPoly)) {
bStillOnValidPoly = true;
-#ifdef VC_PED_PORTS
if(!bHeadStuckInCollision || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
if (bHeadStuckInCollision)
bHeadStuckInCollision = false;
}
-#else
- GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
-#endif
-
m_vecMoveSpeed.z = 0.0f;
bIsStanding = true;
} else {
@@ -16016,9 +15949,6 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
intersectionPoint, minDist, false, false, &m_collPoly);
}
if (belowTorsoCollided) {
-#ifndef VC_PED_PORTS
- if (!collidingEnt->IsPed()) {
-#endif
if (!bIsStanding
|| FEET_OFFSET + intersectionPoint.point.z > GetPosition().z
|| collidedWithBoat && 3.12f + intersectionPoint.point.z > GetPosition().z) {
@@ -16041,15 +15971,12 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
bOnBoat = false;
}
}
-#ifdef VC_PED_PORTS
+
if (!bHeadStuckInCollision || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
if (bHeadStuckInCollision)
bHeadStuckInCollision = false;
}
-#else
- GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
-#endif
m_nSurfaceTouched = intersectionPoint.surfaceB;
if (m_nSurfaceTouched == SURFACE_STEEP_CLIFF) {
bHitSteepSlope = true;
@@ -16064,36 +15991,32 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
upperSpeedLimit *= 2.0f;
lowerSpeedLimit *= 1.5f;
}
- if (!bWasStanding) {
- if ((speed <= upperSpeedLimit /* || (bfFlagsL >> 5) & 1 */) && m_vecMoveSpeed.z >= lowerSpeedLimit
- || m_pCollidingEntity == collidingEnt) {
-
- if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL) && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) {
- InflictDamage(collidingEnt, WEAPONTYPE_FALL, 15.0f, PEDPIECE_TORSO, 2);
- }
- } else {
- float damage = 100.0f * Max(speed - 0.25f, 0.0f);
- float damage2 = damage;
- if (m_vecMoveSpeed.z < -0.25f)
- damage += (-0.25f - m_vecMoveSpeed.z) * 150.0f;
-
- uint8 dir = 2; // from backward
- if (m_vecMoveSpeed.x > 0.01f || m_vecMoveSpeed.x < -0.01f || m_vecMoveSpeed.y > 0.01f || m_vecMoveSpeed.y < -0.01f) {
- CVector2D offset = -m_vecMoveSpeed;
- dir = GetLocalDirection(offset);
- }
- InflictDamage(collidingEnt, WEAPONTYPE_FALL, damage, PEDPIECE_TORSO, dir);
- if (IsPlayer() && damage2 > 5.0f)
- Say(SOUND_PED_LAND);
+ CAnimBlendAssociation *fallAnim = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL);
+ if (!bWasStanding && speed > upperSpeedLimit && (!bPushedAlongByCar || m_vecMoveSpeed.z < lowerSpeedLimit)
+ && m_pCollidingEntity != collidingEnt) {
+
+ float damage = 100.0f * Max(speed - 0.25f, 0.0f);
+ float damage2 = damage;
+ if (m_vecMoveSpeed.z < -0.25f)
+ damage += (-0.25f - m_vecMoveSpeed.z) * 150.0f;
+
+ uint8 dir = 2; // from backward
+ if (m_vecMoveSpeed.x > 0.01f || m_vecMoveSpeed.x < -0.01f || m_vecMoveSpeed.y > 0.01f || m_vecMoveSpeed.y < -0.01f) {
+ CVector2D offset = -m_vecMoveSpeed;
+ dir = GetLocalDirection(offset);
}
+ if (CSurfaceTable::IsSoftLanding(intersectionPoint.surfaceB))
+ damage *= 0.5f;
+
+ InflictDamage(collidingEnt, WEAPONTYPE_FALL, damage, PEDPIECE_TORSO, dir);
+ if (IsPlayer() && damage2 > 5.0f)
+ Say(SOUND_PED_LAND);
+
+ } else if (!bWasStanding && fallAnim && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) {
+ InflictDamage(collidingEnt, WEAPONTYPE_FALL, 15.0f, PEDPIECE_TORSO, 2);
}
m_vecMoveSpeed.z = 0.0f;
bIsStanding = true;
-#ifndef VC_PED_PORTS
- } else {
- bOnBoat = false;
- }
-#endif
} else {
bOnBoat = false;
}
@@ -16111,22 +16034,18 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
bHasHitWall = true;
}
}
- if (collidingEnt->IsBuilding() || collidingEnt->IsStatic()) {
-
+ if (collidingEnt->IsBuilding() || collidingEnt->IsStatic()) {
if (bWasStanding) {
CVector sphereNormal;
float normalLength;
for(int sphere = 0; sphere < ourCollidedSpheres; sphere++) {
sphereNormal = collidingPoints[sphere].normal;
-#ifdef VC_PED_PORTS
if (sphereNormal.z >= -1.0f || !IsPlayer()) {
-#endif
normalLength = sphereNormal.Magnitude2D();
if (normalLength != 0.0f) {
sphereNormal.x = sphereNormal.x / normalLength;
sphereNormal.y = sphereNormal.y / normalLength;
}
-#ifdef VC_PED_PORTS
} else {
float speed = m_vecMoveSpeed.Magnitude2D();
sphereNormal.x = -m_vecMoveSpeed.x / Max(0.001f, speed);
@@ -16134,7 +16053,6 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
GetMatrix().GetPosition().z -= 0.05f;
bHeadStuckInCollision = true;
}
-#endif
sphereNormal.Normalise();
collidingPoints[sphere].normal = sphereNormal;
if (collidingPoints[sphere].surfaceB == SURFACE_STEEP_CLIFF)
@@ -16145,6 +16063,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
return ourCollidedSpheres;
}
+// --MIAMI: Done
void
CPed::SetFormation(eFormation type)
{
@@ -16439,15 +16358,6 @@ CPed::PreRender(void)
#ifdef PED_SKIN
if(IsClumpSkinned(GetClump())){
UpdateRpHAnim();
-
- if(bBodyPartJustCameOff && m_bodyPartBleeding == PED_HEAD){
- // scale head to 0 if shot off
- RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump());
- int32 idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_HEAD));
- RwMatrix *head = &RpHAnimHierarchyGetMatrixArray(hier)[idx];
- RwV3d zero = { 0.0f, 0.0f, 0.0f };
- RwMatrixScale(head, &zero, rwCOMBINEPRECONCAT);
- }
}
#endif
@@ -16522,6 +16432,17 @@ CPed::PreRender(void)
RwMatrixScale(upperArmR, &scale, rwCOMBINEPRECONCAT);
}
+ if (bBodyPartJustCameOff && m_bodyPartBleeding == PED_HEAD) {
+ // scale head to 0 if shot off
+ RpHAnimHierarchy* hier = GetAnimHierarchyFromSkinClump(GetClump());
+ int32 idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_HEAD));
+ RwMatrix* head = &RpHAnimHierarchyGetMatrixArray(hier)[idx];
+ RwV3d zero = { 0.0f, 0.0f, 0.0f };
+ RwMatrixScale(head, &zero, rwCOMBINEPRECONCAT);
+ }
+
+ // TODO(Miami): Some cheat??
+
if (bBodyPartJustCameOff && bIsPedDieAnimPlaying && m_bodyPartBleeding != -1 && (CTimer::GetFrameCounter() & 7) > 3) {
CVector bloodDir(0.0f, 0.0f, 0.0f);
CVector bloodPos(0.0f, 0.0f, 0.0f);
@@ -18713,88 +18634,12 @@ RecurseFrameChildrenToCloneCB(RwFrame *frame, void *data)
return newFrame;
}
+// --MIAMI: Done
CObject*
CPed::SpawnFlyingComponent(int pedNode, int8 direction)
{
- if (CObject::nNoTempObjects >= NUMTEMPOBJECTS)
- return nil;
-
-#ifdef PED_SKIN
- assert(!IsClumpSkinned(GetClump()));
-#endif
-
- CObject *obj = new CObject();
- if (!obj)
- return nil;
-
- RwFrame *frame = RwFrameCreate();
- RpClump *clump = RpClumpCreate();
- RpClumpSetFrame(clump, frame);
- RwMatrix *matrix = RwFrameGetLTM(m_pFrames[pedNode]->frame);
- *RwFrameGetMatrix(frame) = *matrix;
-
- flyingClumpTemp = clump;
- RwFrameForAllObjects(m_pFrames[pedNode]->frame, CloneAtomicToFrameCB, frame);
- RwFrameForAllChildren(m_pFrames[pedNode]->frame, RecurseFrameChildrenToCloneCB, frame);
- flyingClumpTemp = nil;
- switch (pedNode) {
- case PED_HEAD:
- // So popping head would have wheel collision. They disabled it anyway
- obj->SetModelIndexNoCreate(MI_CAR_WHEEL);
- break;
- case PED_UPPERARML:
- case PED_UPPERARMR:
- obj->SetModelIndexNoCreate(MI_BODYPARTB);
- obj->SetCenterOfMass(0.25f, 0.0f, 0.0f);
- break;
- case PED_UPPERLEGL:
- case PED_UPPERLEGR:
- obj->SetModelIndexNoCreate(MI_BODYPARTA);
- obj->SetCenterOfMass(0.4f, 0.0f, 0.0f);
- break;
- default:
- break;
- }
- obj->RefModelInfo(GetModelIndex());
- obj->AttachToRwObject((RwObject*)clump);
- obj->m_fMass = 15.0f;
- obj->m_fTurnMass = 5.0f;
- obj->m_fAirResistance = 0.99f;
- obj->m_fElasticity = 0.03f;
- obj->m_fBuoyancy = m_fMass*GRAVITY/0.75f;
- obj->ObjectCreatedBy = TEMP_OBJECT;
- obj->bIsStatic = false;
- obj->bIsPickup = false;
- obj->m_nSpecialCollisionResponseCases = COLLRESPONSE_SMALLBOX;
-
- // life time - the more objects the are, the shorter this one will live
- CObject::nNoTempObjects++;
- if (CObject::nNoTempObjects > 20)
- obj->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 12000;
- else if (CObject::nNoTempObjects > 10)
- obj->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 30000;
- else
- obj->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 60000;
-
- CVector localForcePos, forceDir;
-
- if (direction == 2) {
- obj->m_vecMoveSpeed = 0.03f * GetForward();
- obj->m_vecMoveSpeed.z = (CGeneral::GetRandomNumber() & 0x3F) * 0.001f;
- obj->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
- localForcePos = CVector(0.0f, 0.0f, 0.0f);
- forceDir = GetForward();
- } else {
- obj->m_vecMoveSpeed = -0.03f * GetForward();
- obj->m_vecMoveSpeed.z = (CGeneral::GetRandomNumber() & 0x3F) * 0.001f;
- obj->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
- localForcePos = CVector(0.0f, 0.0f, 0.0f);
- forceDir = -GetForward();
- }
- obj->ApplyTurnForce(forceDir, localForcePos);
- CWorld::Add(obj);
-
- return obj;
+ // VC doesn't have detachable limbs :shrug:
+ return nil;
}
// --MIAMI: Done
@@ -20107,7 +19952,7 @@ CPed::PedShuffle(void)
}
}
-// --MIAMI: Bike part is done
+// --MIAMI: Done
void
CPed::DriveVehicle(void)
{
@@ -20328,8 +20173,7 @@ CPed::DriveVehicle(void)
lDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_BOAT_L);
rDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_BOAT_R);
lbAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_BOAT_LB);
- }
- else if (m_pMyVehicle->bLowVehicle) {
+ } else if (m_pMyVehicle->bLowVehicle) {
sitAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_LSIT);
if (!sitAssoc || sitAssoc->blendAmount < 1.0f) {
@@ -20339,8 +20183,7 @@ CPed::DriveVehicle(void)
lDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_LOW_L);
lbAssoc = nil;
rDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_LOW_R);
- }
- else {
+ } else {
sitAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_SIT);
if (!sitAssoc || sitAssoc->blendAmount < 1.0f) {
@@ -20366,15 +20209,15 @@ CPed::DriveVehicle(void)
if (!driveByAssoc)
driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_LOW_R);
- if (m_pMyVehicle->bLowVehicle || m_pMyVehicle->m_fGasPedal >= 0.0f || driveByAssoc) {
+ if (m_pMyVehicle->bLowVehicle || m_pMyVehicle->m_fGasPedal >= 0.0f || driveByAssoc ||
+ m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI || m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE) {
if (steerAngle == 0.0f || driveByAssoc) {
if (lDriveAssoc)
lDriveAssoc->blendAmount = 0.0f;
if (rDriveAssoc)
rDriveAssoc->blendAmount = 0.0f;
- }
- else if (steerAngle <= 0.0f) {
+ } else if (steerAngle <= 0.0f) {
if (lDriveAssoc)
lDriveAssoc->blendAmount = 0.0f;
@@ -20387,8 +20230,7 @@ CPed::DriveVehicle(void)
else
CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_R);
- }
- else {
+ } else {
if (rDriveAssoc)
rDriveAssoc->blendAmount = 0.0f;
@@ -20404,8 +20246,7 @@ CPed::DriveVehicle(void)
if (lbAssoc)
lbAssoc->blendDelta = -4.0f;
- }
- else {
+ } else {
if ((TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::MODE_1STPERSON
|| TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking != LOOKING_LEFT)
@@ -20804,6 +20645,18 @@ CPed::KillCharOnFootArmed(CVector &ourPos, CVector &targetPos, CVector &distWith
vehOfTarget->RegisterReference((CEntity **) &m_pPointGunAt);
SetShootTimer(CGeneral::GetRandomNumberInRange(500, 2000));
+
+ CVector2D dirVehGoing = vehOfTarget->m_vecMoveSpeed;
+ if (dirVehGoing.Magnitude() > 0.2f) {
+ CVector2D vehDist = GetPosition() - vehOfTarget->GetPosition();
+ vehDist.Normalise();
+ dirVehGoing.Normalise();
+ if (DotProduct2D(vehDist, dirVehGoing) > 0.8f) {
+ SetAttackTimer(CGeneral::GetRandomNumberInRange(200, 500));
+ SetMoveState(PEDMOVE_STILL);
+ }
+ return ATTACK_IN_PROGRESS;
+ }
if (distWithTargetSc <= m_distanceToCountSeekDone) {
SetAttackTimer(CGeneral::GetRandomNumberInRange(200, 500));
SetMoveState(PEDMOVE_STILL);
@@ -20934,7 +20787,7 @@ CPed::KillCharOnFootArmed(CVector &ourPos, CVector &targetPos, CVector &distWith
if (m_pedInObjective)
m_pedInObjective->RegisterReference((CEntity**)&m_pPointGunAt);
- SetShootTimer(CGeneral::GetRandomNumberInRange(900.0f, 1500.0f));
+ SetShootTimer(CGeneral::GetRandomNumberInRange(600.0f, 1500.0f));
int time;
if (distWithTargetSc <= wepRangeAdjusted)
@@ -20951,7 +20804,7 @@ CPed::KillCharOnFootArmed(CVector &ourPos, CVector &targetPos, CVector &distWith
if (m_nPedState != PED_ATTACK && m_nPedState != PED_FIGHT) {
if (bNotAllowedToDuck && bKindaStayInSamePlace && !bIsDucking && bCrouchWhenShooting) {
- SetDuck(CGeneral::GetRandomNumberInRange(4000, 5000), false);
+ SetDuck(CGeneral::GetRandomNumberInRange(1000, 5000), false);
return CANT_ATTACK;
}
if (bObstacleShowedUpDuringKillObjective) {
@@ -20998,6 +20851,27 @@ CPed::KillCharOnFootArmed(CVector &ourPos, CVector &targetPos, CVector &distWith
return ATTACK_IN_PROGRESS;
}
+// --MIAMI: Done
+void
+CPed::ScanForDelayedResponseThreats(void)
+{
+ if (m_threatFlags)
+ return;
+
+ m_threatEntity = nil;
+ m_pEventEntity = nil;
+ m_threatFlags = ScanForThreats();
+ if (m_threatFlags) {
+ if (m_threatEntity || m_pEventEntity) {
+ m_threatCheckTimer = CTimer::GetTimeInMilliseconds() + m_threatCheckInterval;
+ return;
+ }
+ m_threatFlags = 0;
+ }
+ m_threatCheckTimer = 0;
+}
+
+// --MIAMI: Done
void
PlayRandomAnimationsFromAnimBlock(CPed* ped, AssocGroupId animGroup, uint32 first, uint32 amount)
{
@@ -21034,6 +20908,7 @@ PlayRandomAnimationsFromAnimBlock(CPed* ped, AssocGroupId animGroup, uint32 firs
}
}
+// --MIAMI: Done
bool
IsPedPointerValid_NotInWorld(CPed* pPed)
{
@@ -21049,6 +20924,7 @@ IsPedPointerValid_NotInWorld(CPed* pPed)
return true;
}
+// --MIAMI: Done
bool
IsPedPointerValid(CPed* pPed)
{
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 56244752..815d9c2d 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -455,17 +455,17 @@ public:
uint32 bTurnedAroundOnAttractor : 1;
uint32 bHasAlreadyUsedAttractor : 1;
- //uint32 b155_2
+ uint32 b155_2 : 1;
uint32 bCarPassenger : 1;
- //uint32 b155_8
- //uint32 b155_10
+ uint32 b155_8 : 1;
+ uint32 b155_10 : 1;
uint32 bMiamiViceCop : 1;
uint32 bMoneyHasBeenGivenByScript : 1; //
uint32 bHasBeenPhotographed : 1; //
uint32 bIsDrowning : 1;
uint32 bDrownsInWater : 1;
- //uint32 b156_4
+ uint32 b156_4 : 1;
uint32 bHeldHostageInCar : 1;
uint32 bIsPlayerFriend : 1;
uint32 bHeadStuckInCollision : 1;
@@ -475,7 +475,7 @@ public:
uint32 bDontFight : 1;
uint32 bDoomAim : 1;
uint32 bCanBeShotInVehicle : 1;
- //uint32 b157_8
+ uint32 b157_8 : 1;
uint32 bMakeFleeScream : 1;
uint32 bPushedAlongByCar : 1;
uint32 b157_40 : 1;
@@ -488,7 +488,7 @@ public:
uint32 bCollectBusFare : 1;
uint32 bBoughtIceCream : 1;
uint32 b158_40 : 1;
- //uint32 b158_80
+ uint32 b158_80 : 1;
// our own flags
uint32 m_ped_flagI80 : 1; // KANGAROO_CHEAT define makes use of this as cheat toggle
@@ -566,10 +566,9 @@ public:
bool bInVehicle;
float m_distanceToCountSeekDone;
float m_acceptableHeadingOffset;
+ CVehicle* m_vehicleInAccident;
CPedAttractor* m_attractor;
int32 m_positionInQueue;
- CVehicle* m_vehicleInAccident;
-
bool bRunningToPhone;
int16 m_phoneId;
eCrimeType m_crimeToReportOnPhone;
@@ -635,14 +634,16 @@ public:
float m_attachRotStep;
uint32 m_attachWepAmmo;
uint32 m_threatFlags;
- uint32 m_threatCheck;
- uint32 m_lastThreatCheck;
+ uint32 m_threatCheckTimer;
+ uint32 m_threatCheckInterval;
uint32 m_delayedSoundID;
uint32 m_delayedSoundTimer;
uint32 m_lastSoundStart;
uint32 m_soundStart;
uint16 m_lastQueuedSound;
uint16 m_queuedSound;
+ bool m_canTalk;
+ int32 m_lastComment;
CVector m_vecSeekPosEx; // used for OBJECTIVE_GUARD_SPOT
float m_distanceToCountSeekDoneEx; // used for OBJECTIVE_GUARD_SPOT
@@ -864,6 +865,7 @@ public:
void DriveVehicle();
void PositionAttachedPed();
bool CanUseTorsoWhenLooking();
+ void ScanForDelayedResponseThreats();
// Static methods
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 18c1ce04..35a09a4f 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -376,7 +376,7 @@ CPopulation::FindClosestZoneForCoors(CVector *coors, int *safeZoneOut, eLevelNam
}
void
-CPopulation::Update()
+CPopulation::Update(bool addPeds)
{
if (!CReplay::IsPlayingBack()) {
ManagePopulation();
@@ -392,7 +392,7 @@ CPopulation::Update()
ms_nTotalPeds = ms_nNumDummy + ms_nNumEmergency + ms_nNumCop
+ ms_nTotalGangPeds + ms_nNumCivFemale + ms_nNumCivMale;
ms_nTotalPeds -= ms_nTotalCarPassengerPeds;
- if (!CCutsceneMgr::IsRunning()) {
+ if (!CCutsceneMgr::IsRunning() && addPeds) {
float pcdm = PedCreationDistMultiplier();
AddToPopulation(pcdm * (MIN_CREATION_DIST * TheCamera.GenerationDistMultiplier),
pcdm * ((MIN_CREATION_DIST + CREATION_RANGE) * TheCamera.GenerationDistMultiplier),
diff --git a/src/peds/Population.h b/src/peds/Population.h
index eaf3eade..4ea45e7e 100644
--- a/src/peds/Population.h
+++ b/src/peds/Population.h
@@ -66,7 +66,7 @@ public:
static uint32 NumMiamiViceCops;
static void Initialise();
- static void Update(void);
+ static void Update(bool);
static void LoadPedGroups();
static void UpdatePedCount(ePedType, bool);
static void DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool);
diff --git a/src/render/Occlusion.cpp b/src/render/Occlusion.cpp
index c2f220e9..1ea9da50 100644
--- a/src/render/Occlusion.cpp
+++ b/src/render/Occlusion.cpp
@@ -29,7 +29,9 @@ bool gOccluderCoorsValid[8];
CVector gOccluderCoorsOnScreen[8];
CVector gOccluderCoors[8];
+#ifndef MASTER
bool bDisplayOccDebugStuff;
+#endif
void
COcclusion::Init(void)
@@ -39,7 +41,9 @@ COcclusion::Init(void)
NearbyList = -1;
ListWalkThroughFA = -1;
PreviousListWalkThroughFA = -1;
+#ifndef MASTER
bDisplayOccDebugStuff = false;
+#endif
}
void
@@ -436,6 +440,7 @@ bool COcclusion::IsPositionOccluded(CVector pos, float side) {
return false;
}
+#ifndef MASTER
#include "Lines.h"
RwIm2DVertex vertexbufferT[2];
@@ -476,3 +481,4 @@ void COcclusion::Render() {
DefinedState();
}
+#endif \ No newline at end of file
diff --git a/src/render/Occlusion.h b/src/render/Occlusion.h
index 9a415f88..8a444525 100644
--- a/src/render/Occlusion.h
+++ b/src/render/Occlusion.h
@@ -49,10 +49,14 @@ public:
static bool OccluderHidesBehind(CActiveOccluder *occl1, CActiveOccluder *occl2);
static bool IsAABoxOccluded(CVector pos, float width, float length, float height);
static bool IsPositionOccluded(CVector pos, float side);
+#ifndef MASTER
static void Render();
+#endif
};
bool CalcScreenCoors(CVector const &in, CVector *out, float *outw, float *outh);
bool CalcScreenCoors(CVector const &in, CVector *out);
+#ifndef MASTER
extern bool bDisplayOccDebugStuff;
+#endif \ No newline at end of file
diff --git a/src/render/PlayerSkin.cpp b/src/render/PlayerSkin.cpp
index b3e82cd9..261bbec0 100644
--- a/src/render/PlayerSkin.cpp
+++ b/src/render/PlayerSkin.cpp
@@ -99,7 +99,7 @@ CPlayerSkin::GetSkinTexture(const char *texName)
CTxdStore::PopCurrentTxd();
if (tex != nil) return tex;
- if (strcmp(DEFAULT_SKIN_NAME, texName) == 0)
+ if (strcmp(DEFAULT_SKIN_NAME, texName) == 0 || texName[0] == '\0')
sprintf(gString, "models\\generic\\player.bmp");
else
sprintf(gString, "skins\\%s.bmp", texName);
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index 9633e56c..07304b77 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -716,8 +716,10 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer)
}
#ifdef USE_TEXTURE_POOL
-WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); }
-WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); }
+WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x6271E0); }
+WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x627080); }
+WRAPPER void _TexturePoolsFinalShutdown() { EAXJMP(0x626F80); }
+WRAPPER void _TexturePoolsUnknown(bool) { EAXJMP(0x626F70); }
#endif
#ifdef LIBRW