1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 16:00:02 +00:00

CGame done, Peds, fixes

This commit is contained in:
eray orçunus 2020-08-29 19:22:25 +03:00
parent 24e74f785e
commit 3e549a7d44
21 changed files with 480 additions and 503 deletions

View file

@ -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 )

View file

@ -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

View file

@ -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;

View file

@ -138,7 +138,7 @@ public:
void AddEntityToList(int32, uint8);
void RemoveEntityFromList(int32, uint8);
void Process();
void CheckIfCollisionHasLoadedForMissionObject();
void CheckIfCollisionHasLoadedForMissionObjects();
CPhysical* DoesThisEntityWaitForCollision(int i);
};

View file

@ -6,6 +6,8 @@
#include "Pools.h"
#include "World.h"
// --MIAMI: File done
CAccidentManager gAccidentManager;
CAccident*

View file

@ -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);

View file

@ -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();
}

View file

@ -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();

View file

@ -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())
{
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)

View file

@ -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

View file

@ -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();

View file

@ -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,

View file

@ -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);
}

File diff suppressed because it is too large Load diff

View file

@ -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);

View file

@ -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),

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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