mirror of
https://github.com/halpz/re3.git
synced 2025-06-29 11:36:25 +00:00
Merge branch 'master' into garages_dev
This commit is contained in:
@ -90,7 +90,7 @@ uint32 (&aCarsToKeepTime)[MAX_CARS_TO_KEEP] = *(uint32(*)[MAX_CARS_TO_KEEP])*(ui
|
||||
void
|
||||
CCarCtrl::GenerateRandomCars()
|
||||
{
|
||||
if (CCutsceneMgr::IsCutsceneProcessing())
|
||||
if (CCutsceneMgr::IsRunning())
|
||||
return;
|
||||
if (NumRandomCars < 30){
|
||||
if (CountDownToCarsAtStart == 0){
|
||||
|
@ -242,7 +242,7 @@ void CCarGenerator::Load(uint8 *&buffer)
|
||||
|
||||
void CTheCarGenerators::Process()
|
||||
{
|
||||
if (FindPlayerTrain() || CCutsceneMgr::IsRunning())
|
||||
if (FindPlayerTrain() || CCutsceneMgr::IsCutsceneProcessing())
|
||||
return;
|
||||
if (++CTheCarGenerators::ProcessCounter == 4)
|
||||
CTheCarGenerators::ProcessCounter = 0;
|
||||
|
@ -1,294 +1,294 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "GameLogic.h"
|
||||
#include "Clock.h"
|
||||
#include "Stats.h"
|
||||
#include "Pickups.h"
|
||||
#include "Timer.h"
|
||||
#include "Streaming.h"
|
||||
#include "CutsceneMgr.h"
|
||||
#include "World.h"
|
||||
#include "PlayerPed.h"
|
||||
#include "Wanted.h"
|
||||
#include "Camera.h"
|
||||
#include "Messages.h"
|
||||
#include "CarCtrl.h"
|
||||
#include "Restart.h"
|
||||
#include "Pad.h"
|
||||
#include "References.h"
|
||||
#include "Fire.h"
|
||||
#include "Script.h"
|
||||
#include "Garages.h"
|
||||
|
||||
uint8 CGameLogic::ActivePlayers; // 0x95CD5E
|
||||
|
||||
void
|
||||
CGameLogic::InitAtStartOfGame()
|
||||
{
|
||||
ActivePlayers = 1;
|
||||
}
|
||||
|
||||
void
|
||||
CGameLogic::PassTime(uint32 time)
|
||||
{
|
||||
int32 minutes, hours, days;
|
||||
|
||||
minutes = time + CClock::GetMinutes();
|
||||
hours = CClock::GetHours();
|
||||
|
||||
for (; minutes >= 60; minutes -= 60)
|
||||
hours++;
|
||||
|
||||
if (hours > 23) {
|
||||
days = CStats::DaysPassed;
|
||||
for (; hours >= 24; hours -= 24)
|
||||
days++;
|
||||
CStats::DaysPassed = days;
|
||||
}
|
||||
|
||||
CClock::SetGameClock(hours, minutes);
|
||||
CPickups::PassTime(time * 1000);
|
||||
}
|
||||
|
||||
void
|
||||
CGameLogic::SortOutStreamingAndMemory(const CVector &pos)
|
||||
{
|
||||
CTimer::Stop();
|
||||
CStreaming::FlushRequestList();
|
||||
CStreaming::DeleteRwObjectsAfterDeath(pos);
|
||||
CStreaming::RemoveUnusedModelsInLoadedList();
|
||||
CGame::DrasticTidyUpMemory(true);
|
||||
CStreaming::LoadScene(pos);
|
||||
CTimer::Update();
|
||||
}
|
||||
|
||||
void
|
||||
CGameLogic::Update()
|
||||
{
|
||||
CVector vecRestartPos;
|
||||
float fRestartFloat;
|
||||
|
||||
if (CCutsceneMgr::IsCutsceneProcessing()) return;
|
||||
|
||||
CPlayerInfo &pPlayerInfo = CWorld::Players[CWorld::PlayerInFocus];
|
||||
switch (pPlayerInfo.m_WBState) {
|
||||
case WBSTATE_PLAYING:
|
||||
if (pPlayerInfo.m_pPed->m_nPedState == PED_DEAD) {
|
||||
pPlayerInfo.m_pPed->ClearAdrenaline();
|
||||
pPlayerInfo.KillPlayer();
|
||||
}
|
||||
if (pPlayerInfo.m_pPed->m_nPedState == PED_ARRESTED) {
|
||||
pPlayerInfo.m_pPed->ClearAdrenaline();
|
||||
pPlayerInfo.ArrestPlayer();
|
||||
}
|
||||
break;
|
||||
case WBSTATE_WASTED:
|
||||
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) {
|
||||
TheCamera.SetFadeColour(200, 200, 200);
|
||||
TheCamera.Fade(2.0f, FADE_OUT);
|
||||
}
|
||||
|
||||
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
|
||||
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
|
||||
if (pPlayerInfo.m_bGetOutOfHospitalFree) {
|
||||
pPlayerInfo.m_bGetOutOfHospitalFree = false;
|
||||
} else {
|
||||
pPlayerInfo.m_nMoney = max(0, pPlayerInfo.m_nMoney - 1000);
|
||||
pPlayerInfo.m_pPed->ClearWeapons();
|
||||
}
|
||||
|
||||
if (pPlayerInfo.m_pPed->bInVehicle) {
|
||||
CVehicle *pVehicle = pPlayerInfo.m_pPed->m_pMyVehicle;
|
||||
if (pVehicle != nil) {
|
||||
if (pVehicle->pDriver == pPlayerInfo.m_pPed) {
|
||||
pVehicle->pDriver = nil;
|
||||
if (pVehicle->m_status != STATUS_WRECKED)
|
||||
pVehicle->m_status = STATUS_ABANDONED;
|
||||
} else
|
||||
pVehicle->RemovePassenger(pPlayerInfo.m_pPed);
|
||||
}
|
||||
}
|
||||
CEventList::Initialise();
|
||||
CMessages::ClearMessages();
|
||||
CCarCtrl::ClearInterestingVehicleList();
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
|
||||
CRestart::FindClosestHospitalRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
|
||||
CRestart::OverrideHospitalLevel = LEVEL_NONE;
|
||||
CRestart::OverridePoliceStationLevel = LEVEL_NONE;
|
||||
PassTime(720);
|
||||
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
|
||||
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
|
||||
TheCamera.m_fCamShakeForce = 0.0f;
|
||||
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
|
||||
CPad::GetPad(0)->StopShaking(0);
|
||||
CReferences::RemoveReferencesToPlayer();
|
||||
CCarCtrl::CountDownToCarsAtStart = 2;
|
||||
CPad::GetPad(CWorld::PlayerInFocus)->DisablePlayerControls = PLAYERCONTROL_ENABLED;
|
||||
if (CRestart::bFadeInAfterNextDeath) {
|
||||
TheCamera.SetFadeColour(200, 200, 200);
|
||||
TheCamera.Fade(4.0f, FADE_IN);
|
||||
} else CRestart::bFadeInAfterNextDeath = true;
|
||||
}
|
||||
break;
|
||||
case WBSTATE_BUSTED:
|
||||
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) {
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(2.0f, FADE_OUT);
|
||||
}
|
||||
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
|
||||
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
|
||||
int takeMoney;
|
||||
|
||||
switch (pPlayerInfo.m_pPed->m_pWanted->m_nWantedLevel) {
|
||||
case 0:
|
||||
case 1:
|
||||
takeMoney = 100;
|
||||
break;
|
||||
case 2:
|
||||
takeMoney = 200;
|
||||
break;
|
||||
case 3:
|
||||
takeMoney = 400;
|
||||
break;
|
||||
case 4:
|
||||
takeMoney = 600;
|
||||
break;
|
||||
case 5:
|
||||
takeMoney = 900;
|
||||
break;
|
||||
case 6:
|
||||
takeMoney = 1500;
|
||||
break;
|
||||
}
|
||||
if (pPlayerInfo.m_bGetOutOfJailFree) {
|
||||
pPlayerInfo.m_bGetOutOfJailFree = false;
|
||||
} else {
|
||||
pPlayerInfo.m_nMoney = max(0, pPlayerInfo.m_nMoney - takeMoney);
|
||||
pPlayerInfo.m_pPed->ClearWeapons();
|
||||
}
|
||||
|
||||
if (pPlayerInfo.m_pPed->bInVehicle) {
|
||||
CVehicle *pVehicle = pPlayerInfo.m_pPed->m_pMyVehicle;
|
||||
if (pVehicle != nil) {
|
||||
if (pVehicle->pDriver == pPlayerInfo.m_pPed) {
|
||||
pVehicle->pDriver = nil;
|
||||
if (pVehicle->m_status != STATUS_WRECKED)
|
||||
pVehicle->m_status = STATUS_ABANDONED;
|
||||
}
|
||||
else
|
||||
pVehicle->RemovePassenger(pPlayerInfo.m_pPed);
|
||||
}
|
||||
}
|
||||
CEventList::Initialise();
|
||||
CMessages::ClearMessages();
|
||||
CCarCtrl::ClearInterestingVehicleList();
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
|
||||
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
|
||||
CRestart::OverrideHospitalLevel = LEVEL_NONE;
|
||||
CRestart::OverridePoliceStationLevel = LEVEL_NONE;
|
||||
PassTime(720);
|
||||
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
|
||||
pPlayerInfo.m_pPed->ClearWeapons();
|
||||
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
|
||||
TheCamera.m_fCamShakeForce = 0.0f;
|
||||
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
|
||||
CPad::GetPad(0)->StopShaking(0);
|
||||
CReferences::RemoveReferencesToPlayer();
|
||||
CCarCtrl::CountDownToCarsAtStart = 2;
|
||||
CPad::GetPad(CWorld::PlayerInFocus)->DisablePlayerControls = PLAYERCONTROL_ENABLED;
|
||||
if (CRestart::bFadeInAfterNextArrest) {
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(4.0f, FADE_IN);
|
||||
} else CRestart::bFadeInAfterNextArrest = true;
|
||||
}
|
||||
break;
|
||||
case WBSTATE_FAILED_CRITICAL_MISSION:
|
||||
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800 && CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800) {
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(2.0f, FADE_OUT);
|
||||
}
|
||||
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
|
||||
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
|
||||
if (pPlayerInfo.m_pPed->bInVehicle) {
|
||||
CVehicle *pVehicle = pPlayerInfo.m_pPed->m_pMyVehicle;
|
||||
if (pVehicle != nil) {
|
||||
if (pVehicle->pDriver == pPlayerInfo.m_pPed) {
|
||||
pVehicle->pDriver = nil;
|
||||
if (pVehicle->m_status != STATUS_WRECKED)
|
||||
pVehicle->m_status = STATUS_ABANDONED;
|
||||
} else
|
||||
pVehicle->RemovePassenger(pPlayerInfo.m_pPed);
|
||||
}
|
||||
}
|
||||
CEventList::Initialise();
|
||||
CMessages::ClearMessages();
|
||||
CCarCtrl::ClearInterestingVehicleList();
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
|
||||
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
|
||||
CRestart::OverridePoliceStationLevel = LEVEL_NONE;
|
||||
CRestart::OverrideHospitalLevel = LEVEL_NONE;
|
||||
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
|
||||
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
|
||||
TheCamera.m_fCamShakeForce = 0.0f;
|
||||
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
|
||||
CPad::GetPad(0)->StopShaking(0);
|
||||
CReferences::RemoveReferencesToPlayer();
|
||||
CCarCtrl::CountDownToCarsAtStart = 2;
|
||||
CPad::GetPad(CWorld::PlayerInFocus)->DisablePlayerControls = PLAYERCONTROL_ENABLED;
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(4.0f, FADE_IN);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector pos, float angle)
|
||||
{
|
||||
pPlayerPed->m_fHealth = 100.0f;
|
||||
pPlayerPed->m_fArmour = 0.0f;
|
||||
pPlayerPed->bIsVisible = true;
|
||||
pPlayerPed->m_bloodyFootprintCountOrDeathTime = 0;
|
||||
pPlayerPed->bDoBloodyFootprints = false;
|
||||
pPlayerPed->ClearAdrenaline();
|
||||
pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina;
|
||||
if (pPlayerPed->m_pFire)
|
||||
pPlayerPed->m_pFire->Extinguish();
|
||||
pPlayerPed->bInVehicle = false;
|
||||
pPlayerPed->m_pMyVehicle = nil;
|
||||
pPlayerPed->m_pVehicleAnim = nil;
|
||||
pPlayerPed->m_pWanted->Reset();
|
||||
pPlayerPed->RestartNonPartialAnims();
|
||||
pPlayerPed->GetPlayerInfoForThisPlayerPed()->MakePlayerSafe(false);
|
||||
pPlayerPed->bRemoveFromWorld = false;
|
||||
pPlayerPed->ClearWeaponTarget();
|
||||
pPlayerPed->SetInitialState();
|
||||
CCarCtrl::ClearInterestingVehicleList();
|
||||
|
||||
pos.z += 1.0f;
|
||||
pPlayerPed->Teleport(pos);
|
||||
pPlayerPed->SetMoveSpeed(CVector(0.0f, 0.0f, 0.0f));
|
||||
|
||||
pPlayerPed->m_fRotationCur = DEGTORAD(angle);
|
||||
pPlayerPed->m_fRotationDest = pPlayerPed->m_fRotationCur;
|
||||
pPlayerPed->SetHeading(pPlayerPed->m_fRotationCur);
|
||||
CTheScripts::ClearSpaceForMissionEntity(pos, pPlayerPed);
|
||||
CWorld::ClearExcitingStuffFromArea(pos, 4000.0, 1);
|
||||
pPlayerPed->RestoreHeadingRate();
|
||||
TheCamera.SetCameraDirectlyInFrontForFollowPed_CamOnAString();
|
||||
CReferences::RemoveReferencesToPlayer();
|
||||
CGarages::PlayerArrestedOrDied();
|
||||
CStats::CheckPointReachedUnsuccessfully();
|
||||
CWorld::Remove(pPlayerPed);
|
||||
CWorld::Add(pPlayerPed);
|
||||
}
|
||||
|
||||
#include "GameLogic.h"
|
||||
#include "Clock.h"
|
||||
#include "Stats.h"
|
||||
#include "Pickups.h"
|
||||
#include "Timer.h"
|
||||
#include "Streaming.h"
|
||||
#include "CutsceneMgr.h"
|
||||
#include "World.h"
|
||||
#include "PlayerPed.h"
|
||||
#include "Wanted.h"
|
||||
#include "Camera.h"
|
||||
#include "Messages.h"
|
||||
#include "CarCtrl.h"
|
||||
#include "Restart.h"
|
||||
#include "Pad.h"
|
||||
#include "References.h"
|
||||
#include "Fire.h"
|
||||
#include "Script.h"
|
||||
#include "Garages.h"
|
||||
|
||||
uint8 CGameLogic::ActivePlayers; // 0x95CD5E
|
||||
|
||||
void
|
||||
CGameLogic::InitAtStartOfGame()
|
||||
{
|
||||
ActivePlayers = 1;
|
||||
}
|
||||
|
||||
void
|
||||
CGameLogic::PassTime(uint32 time)
|
||||
{
|
||||
int32 minutes, hours, days;
|
||||
|
||||
minutes = time + CClock::GetMinutes();
|
||||
hours = CClock::GetHours();
|
||||
|
||||
for (; minutes >= 60; minutes -= 60)
|
||||
hours++;
|
||||
|
||||
if (hours > 23) {
|
||||
days = CStats::DaysPassed;
|
||||
for (; hours >= 24; hours -= 24)
|
||||
days++;
|
||||
CStats::DaysPassed = days;
|
||||
}
|
||||
|
||||
CClock::SetGameClock(hours, minutes);
|
||||
CPickups::PassTime(time * 1000);
|
||||
}
|
||||
|
||||
void
|
||||
CGameLogic::SortOutStreamingAndMemory(const CVector &pos)
|
||||
{
|
||||
CTimer::Stop();
|
||||
CStreaming::FlushRequestList();
|
||||
CStreaming::DeleteRwObjectsAfterDeath(pos);
|
||||
CStreaming::RemoveUnusedModelsInLoadedList();
|
||||
CGame::DrasticTidyUpMemory(true);
|
||||
CStreaming::LoadScene(pos);
|
||||
CTimer::Update();
|
||||
}
|
||||
|
||||
void
|
||||
CGameLogic::Update()
|
||||
{
|
||||
CVector vecRestartPos;
|
||||
float fRestartFloat;
|
||||
|
||||
if (CCutsceneMgr::IsCutsceneProcessing()) return;
|
||||
|
||||
CPlayerInfo &pPlayerInfo = CWorld::Players[CWorld::PlayerInFocus];
|
||||
switch (pPlayerInfo.m_WBState) {
|
||||
case WBSTATE_PLAYING:
|
||||
if (pPlayerInfo.m_pPed->m_nPedState == PED_DEAD) {
|
||||
pPlayerInfo.m_pPed->ClearAdrenaline();
|
||||
pPlayerInfo.KillPlayer();
|
||||
}
|
||||
if (pPlayerInfo.m_pPed->m_nPedState == PED_ARRESTED) {
|
||||
pPlayerInfo.m_pPed->ClearAdrenaline();
|
||||
pPlayerInfo.ArrestPlayer();
|
||||
}
|
||||
break;
|
||||
case WBSTATE_WASTED:
|
||||
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) {
|
||||
TheCamera.SetFadeColour(200, 200, 200);
|
||||
TheCamera.Fade(2.0f, FADE_OUT);
|
||||
}
|
||||
|
||||
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
|
||||
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
|
||||
if (pPlayerInfo.m_bGetOutOfHospitalFree) {
|
||||
pPlayerInfo.m_bGetOutOfHospitalFree = false;
|
||||
} else {
|
||||
pPlayerInfo.m_nMoney = max(0, pPlayerInfo.m_nMoney - 1000);
|
||||
pPlayerInfo.m_pPed->ClearWeapons();
|
||||
}
|
||||
|
||||
if (pPlayerInfo.m_pPed->bInVehicle) {
|
||||
CVehicle *pVehicle = pPlayerInfo.m_pPed->m_pMyVehicle;
|
||||
if (pVehicle != nil) {
|
||||
if (pVehicle->pDriver == pPlayerInfo.m_pPed) {
|
||||
pVehicle->pDriver = nil;
|
||||
if (pVehicle->m_status != STATUS_WRECKED)
|
||||
pVehicle->m_status = STATUS_ABANDONED;
|
||||
} else
|
||||
pVehicle->RemovePassenger(pPlayerInfo.m_pPed);
|
||||
}
|
||||
}
|
||||
CEventList::Initialise();
|
||||
CMessages::ClearMessages();
|
||||
CCarCtrl::ClearInterestingVehicleList();
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
|
||||
CRestart::FindClosestHospitalRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
|
||||
CRestart::OverrideHospitalLevel = LEVEL_NONE;
|
||||
CRestart::OverridePoliceStationLevel = LEVEL_NONE;
|
||||
PassTime(720);
|
||||
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
|
||||
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
|
||||
TheCamera.m_fCamShakeForce = 0.0f;
|
||||
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
|
||||
CPad::GetPad(0)->StopShaking(0);
|
||||
CReferences::RemoveReferencesToPlayer();
|
||||
CCarCtrl::CountDownToCarsAtStart = 2;
|
||||
CPad::GetPad(CWorld::PlayerInFocus)->DisablePlayerControls = PLAYERCONTROL_ENABLED;
|
||||
if (CRestart::bFadeInAfterNextDeath) {
|
||||
TheCamera.SetFadeColour(200, 200, 200);
|
||||
TheCamera.Fade(4.0f, FADE_IN);
|
||||
} else CRestart::bFadeInAfterNextDeath = true;
|
||||
}
|
||||
break;
|
||||
case WBSTATE_BUSTED:
|
||||
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) {
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(2.0f, FADE_OUT);
|
||||
}
|
||||
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
|
||||
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
|
||||
int takeMoney;
|
||||
|
||||
switch (pPlayerInfo.m_pPed->m_pWanted->m_nWantedLevel) {
|
||||
case 0:
|
||||
case 1:
|
||||
takeMoney = 100;
|
||||
break;
|
||||
case 2:
|
||||
takeMoney = 200;
|
||||
break;
|
||||
case 3:
|
||||
takeMoney = 400;
|
||||
break;
|
||||
case 4:
|
||||
takeMoney = 600;
|
||||
break;
|
||||
case 5:
|
||||
takeMoney = 900;
|
||||
break;
|
||||
case 6:
|
||||
takeMoney = 1500;
|
||||
break;
|
||||
}
|
||||
if (pPlayerInfo.m_bGetOutOfJailFree) {
|
||||
pPlayerInfo.m_bGetOutOfJailFree = false;
|
||||
} else {
|
||||
pPlayerInfo.m_nMoney = max(0, pPlayerInfo.m_nMoney - takeMoney);
|
||||
pPlayerInfo.m_pPed->ClearWeapons();
|
||||
}
|
||||
|
||||
if (pPlayerInfo.m_pPed->bInVehicle) {
|
||||
CVehicle *pVehicle = pPlayerInfo.m_pPed->m_pMyVehicle;
|
||||
if (pVehicle != nil) {
|
||||
if (pVehicle->pDriver == pPlayerInfo.m_pPed) {
|
||||
pVehicle->pDriver = nil;
|
||||
if (pVehicle->m_status != STATUS_WRECKED)
|
||||
pVehicle->m_status = STATUS_ABANDONED;
|
||||
}
|
||||
else
|
||||
pVehicle->RemovePassenger(pPlayerInfo.m_pPed);
|
||||
}
|
||||
}
|
||||
CEventList::Initialise();
|
||||
CMessages::ClearMessages();
|
||||
CCarCtrl::ClearInterestingVehicleList();
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
|
||||
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
|
||||
CRestart::OverrideHospitalLevel = LEVEL_NONE;
|
||||
CRestart::OverridePoliceStationLevel = LEVEL_NONE;
|
||||
PassTime(720);
|
||||
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
|
||||
pPlayerInfo.m_pPed->ClearWeapons();
|
||||
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
|
||||
TheCamera.m_fCamShakeForce = 0.0f;
|
||||
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
|
||||
CPad::GetPad(0)->StopShaking(0);
|
||||
CReferences::RemoveReferencesToPlayer();
|
||||
CCarCtrl::CountDownToCarsAtStart = 2;
|
||||
CPad::GetPad(CWorld::PlayerInFocus)->DisablePlayerControls = PLAYERCONTROL_ENABLED;
|
||||
if (CRestart::bFadeInAfterNextArrest) {
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(4.0f, FADE_IN);
|
||||
} else CRestart::bFadeInAfterNextArrest = true;
|
||||
}
|
||||
break;
|
||||
case WBSTATE_FAILED_CRITICAL_MISSION:
|
||||
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800 && CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800) {
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(2.0f, FADE_OUT);
|
||||
}
|
||||
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
|
||||
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
|
||||
if (pPlayerInfo.m_pPed->bInVehicle) {
|
||||
CVehicle *pVehicle = pPlayerInfo.m_pPed->m_pMyVehicle;
|
||||
if (pVehicle != nil) {
|
||||
if (pVehicle->pDriver == pPlayerInfo.m_pPed) {
|
||||
pVehicle->pDriver = nil;
|
||||
if (pVehicle->m_status != STATUS_WRECKED)
|
||||
pVehicle->m_status = STATUS_ABANDONED;
|
||||
} else
|
||||
pVehicle->RemovePassenger(pPlayerInfo.m_pPed);
|
||||
}
|
||||
}
|
||||
CEventList::Initialise();
|
||||
CMessages::ClearMessages();
|
||||
CCarCtrl::ClearInterestingVehicleList();
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
|
||||
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
|
||||
CRestart::OverridePoliceStationLevel = LEVEL_NONE;
|
||||
CRestart::OverrideHospitalLevel = LEVEL_NONE;
|
||||
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
|
||||
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
|
||||
TheCamera.m_fCamShakeForce = 0.0f;
|
||||
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
|
||||
CPad::GetPad(0)->StopShaking(0);
|
||||
CReferences::RemoveReferencesToPlayer();
|
||||
CCarCtrl::CountDownToCarsAtStart = 2;
|
||||
CPad::GetPad(CWorld::PlayerInFocus)->DisablePlayerControls = PLAYERCONTROL_ENABLED;
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(4.0f, FADE_IN);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector pos, float angle)
|
||||
{
|
||||
pPlayerPed->m_fHealth = 100.0f;
|
||||
pPlayerPed->m_fArmour = 0.0f;
|
||||
pPlayerPed->bIsVisible = true;
|
||||
pPlayerPed->m_bloodyFootprintCountOrDeathTime = 0;
|
||||
pPlayerPed->bDoBloodyFootprints = false;
|
||||
pPlayerPed->ClearAdrenaline();
|
||||
pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina;
|
||||
if (pPlayerPed->m_pFire)
|
||||
pPlayerPed->m_pFire->Extinguish();
|
||||
pPlayerPed->bInVehicle = false;
|
||||
pPlayerPed->m_pMyVehicle = nil;
|
||||
pPlayerPed->m_pVehicleAnim = nil;
|
||||
pPlayerPed->m_pWanted->Reset();
|
||||
pPlayerPed->RestartNonPartialAnims();
|
||||
pPlayerPed->GetPlayerInfoForThisPlayerPed()->MakePlayerSafe(false);
|
||||
pPlayerPed->bRemoveFromWorld = false;
|
||||
pPlayerPed->ClearWeaponTarget();
|
||||
pPlayerPed->SetInitialState();
|
||||
CCarCtrl::ClearInterestingVehicleList();
|
||||
|
||||
pos.z += 1.0f;
|
||||
pPlayerPed->Teleport(pos);
|
||||
pPlayerPed->SetMoveSpeed(CVector(0.0f, 0.0f, 0.0f));
|
||||
|
||||
pPlayerPed->m_fRotationCur = DEGTORAD(angle);
|
||||
pPlayerPed->m_fRotationDest = pPlayerPed->m_fRotationCur;
|
||||
pPlayerPed->SetHeading(pPlayerPed->m_fRotationCur);
|
||||
CTheScripts::ClearSpaceForMissionEntity(pos, pPlayerPed);
|
||||
CWorld::ClearExcitingStuffFromArea(pos, 4000.0, 1);
|
||||
pPlayerPed->RestoreHeadingRate();
|
||||
TheCamera.SetCameraDirectlyInFrontForFollowPed_CamOnAString();
|
||||
CReferences::RemoveReferencesToPlayer();
|
||||
CGarages::PlayerArrestedOrDied();
|
||||
CStats::CheckPointReachedUnsuccessfully();
|
||||
CWorld::Remove(pPlayerPed);
|
||||
CWorld::Add(pPlayerPed);
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4213F0, &CGameLogic::InitAtStartOfGame, PATCH_JUMP);
|
||||
InjectHook(0x421C00, &CGameLogic::PassTime, PATCH_JUMP);
|
||||
InjectHook(0x421A20, &CGameLogic::SortOutStreamingAndMemory, PATCH_JUMP);
|
||||
InjectHook(0x421400, &CGameLogic::Update, PATCH_JUMP);
|
||||
InjectHook(0x421A60, &CGameLogic::RestorePlayerStuffDuringResurrection, PATCH_JUMP);
|
||||
InjectHook(0x421A60, &CGameLogic::RestorePlayerStuffDuringResurrection, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -1,13 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
class CGameLogic
|
||||
{
|
||||
public:
|
||||
static void InitAtStartOfGame();
|
||||
static void PassTime(uint32 time);
|
||||
static void SortOutStreamingAndMemory(const CVector &pos);
|
||||
static void Update();
|
||||
static void RestorePlayerStuffDuringResurrection(class CPlayerPed *pPlayerPed, CVector pos, float angle);
|
||||
|
||||
static uint8 ActivePlayers;
|
||||
#pragma once
|
||||
|
||||
class CGameLogic
|
||||
{
|
||||
public:
|
||||
static void InitAtStartOfGame();
|
||||
static void PassTime(uint32 time);
|
||||
static void SortOutStreamingAndMemory(const CVector &pos);
|
||||
static void Update();
|
||||
static void RestorePlayerStuffDuringResurrection(class CPlayerPed *pPlayerPed, CVector pos, float angle);
|
||||
|
||||
static uint8 ActivePlayers;
|
||||
};
|
@ -1,7 +1,7 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "Gangs.h"
|
||||
#include "Gangs.h"
|
||||
#include "Weapon.h"
|
||||
|
||||
//CGangInfo(&CGangs::Gang)[NUM_GANGS] = *(CGangInfo(*)[NUM_GANGS])*(uintptr*)0x6EDF78;
|
||||
@ -57,20 +57,20 @@ void CGangs::SaveAllGangData(uint8 *buf, uint32 *size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
|
||||
*size = SAVE_HEADER_SIZE + sizeof(Gang);
|
||||
*size = SAVE_HEADER_SIZE + sizeof(Gang);
|
||||
WriteSaveHeader(buf, 'G','N','G','\0', *size - SAVE_HEADER_SIZE);
|
||||
for (int i = 0; i < NUM_GANGS; i++)
|
||||
WriteSaveBuf(buf, Gang[i]);
|
||||
|
||||
for (int i = 0; i < NUM_GANGS; i++)
|
||||
WriteSaveBuf(buf, Gang[i]);
|
||||
|
||||
VALIDATESAVEBUF(*size);
|
||||
}
|
||||
|
||||
void CGangs::LoadAllGangData(uint8 *buf, uint32 size)
|
||||
{
|
||||
Initialise();
|
||||
|
||||
INITSAVEBUF
|
||||
// original: SkipSaveBuf(buf, SAVE_HEADER_SIZE);
|
||||
Initialise();
|
||||
|
||||
INITSAVEBUF
|
||||
// original: SkipSaveBuf(buf, SAVE_HEADER_SIZE);
|
||||
CheckSaveHeader(buf, 'G','N','G','\0', size - SAVE_HEADER_SIZE);
|
||||
|
||||
for (int i = 0; i < NUM_GANGS; i++)
|
||||
|
@ -1,49 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
COUNTER_DISPLAY_NUMBER,
|
||||
COUNTER_DISPLAY_BAR,
|
||||
};
|
||||
|
||||
class COnscreenTimerEntry
|
||||
{
|
||||
public:
|
||||
uint32 m_nTimerOffset;
|
||||
uint32 m_nCounterOffset;
|
||||
char m_aTimerText[10];
|
||||
char m_aCounterText[10];
|
||||
uint16 m_nType;
|
||||
char m_bCounterBuffer[42];
|
||||
char m_bTimerBuffer[42];
|
||||
bool m_bTimerProcessed;
|
||||
bool m_bCounterProcessed;
|
||||
|
||||
void Process();
|
||||
bool ProcessForDisplay();
|
||||
|
||||
void ProcessForDisplayClock();
|
||||
void ProcessForDisplayCounter();
|
||||
};
|
||||
|
||||
static_assert(sizeof(COnscreenTimerEntry) == 0x74, "COnscreenTimerEntry: error");
|
||||
|
||||
class COnscreenTimer
|
||||
{
|
||||
public:
|
||||
COnscreenTimerEntry m_sEntries[NUMONSCREENTIMERENTRIES];
|
||||
bool m_bProcessed;
|
||||
bool m_bDisabled;
|
||||
|
||||
void Init();
|
||||
void Process();
|
||||
void ProcessForDisplay();
|
||||
|
||||
void ClearCounter(uint32 offset);
|
||||
void ClearClock(uint32 offset);
|
||||
|
||||
void AddCounter(uint32 offset, uint16 type, char* text);
|
||||
void AddClock(uint32 offset, char* text);
|
||||
};
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
COUNTER_DISPLAY_NUMBER,
|
||||
COUNTER_DISPLAY_BAR,
|
||||
};
|
||||
|
||||
class COnscreenTimerEntry
|
||||
{
|
||||
public:
|
||||
uint32 m_nTimerOffset;
|
||||
uint32 m_nCounterOffset;
|
||||
char m_aTimerText[10];
|
||||
char m_aCounterText[10];
|
||||
uint16 m_nType;
|
||||
char m_bCounterBuffer[42];
|
||||
char m_bTimerBuffer[42];
|
||||
bool m_bTimerProcessed;
|
||||
bool m_bCounterProcessed;
|
||||
|
||||
void Process();
|
||||
bool ProcessForDisplay();
|
||||
|
||||
void ProcessForDisplayClock();
|
||||
void ProcessForDisplayCounter();
|
||||
};
|
||||
|
||||
static_assert(sizeof(COnscreenTimerEntry) == 0x74, "COnscreenTimerEntry: error");
|
||||
|
||||
class COnscreenTimer
|
||||
{
|
||||
public:
|
||||
COnscreenTimerEntry m_sEntries[NUMONSCREENTIMERENTRIES];
|
||||
bool m_bProcessed;
|
||||
bool m_bDisabled;
|
||||
|
||||
void Init();
|
||||
void Process();
|
||||
void ProcessForDisplay();
|
||||
|
||||
void ClearCounter(uint32 offset);
|
||||
void ClearClock(uint32 offset);
|
||||
|
||||
void AddCounter(uint32 offset, uint16 type, char* text);
|
||||
void AddClock(uint32 offset, char* text);
|
||||
};
|
||||
|
||||
static_assert(sizeof(COnscreenTimer) == 0x78, "COnscreenTimer: error");
|
File diff suppressed because it is too large
Load Diff
@ -1,124 +1,124 @@
|
||||
#pragma once
|
||||
#include "Weapon.h"
|
||||
|
||||
enum ePickupType : uint8
|
||||
{
|
||||
PICKUP_NONE = 0,
|
||||
PICKUP_IN_SHOP,
|
||||
PICKUP_ON_STREET,
|
||||
PICKUP_ONCE,
|
||||
PICKUP_ONCE_TIMEOUT,
|
||||
PICKUP_COLLECTABLE1,
|
||||
PICKUP_IN_SHOP_OUT_OF_STOCK,
|
||||
PICKUP_MONEY,
|
||||
PICKUP_MINE_INACTIVE,
|
||||
PICKUP_MINE_ARMED,
|
||||
PICKUP_NAUTICAL_MINE_INACTIVE,
|
||||
PICKUP_NAUTICAL_MINE_ARMED,
|
||||
PICKUP_FLOATINGPACKAGE,
|
||||
PICKUP_FLOATINGPACKAGE_FLOATING,
|
||||
PICKUP_ON_STREET_SLOW,
|
||||
PICKUP_NUMOFTYPES
|
||||
};
|
||||
|
||||
class CEntity;
|
||||
class CObject;
|
||||
class CVehicle;
|
||||
class CPlayerPed;
|
||||
|
||||
class CPickup
|
||||
{
|
||||
public:
|
||||
ePickupType m_eType;
|
||||
bool m_bRemoved;
|
||||
uint16 m_nQuantity;
|
||||
CObject *m_pObject;
|
||||
uint32 m_nTimer;
|
||||
int16 m_eModelIndex;
|
||||
uint16 m_nIndex;
|
||||
CVector m_vecPos;
|
||||
|
||||
CObject *GiveUsAPickUpObject(int32 handle);
|
||||
bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId);
|
||||
private:
|
||||
bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; }
|
||||
inline bool CanBePickedUp(CPlayerPed *player);
|
||||
void RemoveKeepType();
|
||||
void Remove();
|
||||
};
|
||||
|
||||
static_assert(sizeof(CPickup) == 0x1C, "CPickup: error");
|
||||
|
||||
struct tPickupMessage
|
||||
{
|
||||
CVector2D m_pos;
|
||||
eWeaponType m_weaponType;
|
||||
CVector2D m_dist;
|
||||
CRGBA m_color;
|
||||
uint8 m_bOutOfStock : 1;
|
||||
uint8 m_quantity;
|
||||
};
|
||||
|
||||
class CPickups
|
||||
{
|
||||
static int32 aPickUpsCollected[NUMCOLLECTEDPICKUPS];
|
||||
static int16 CollectedPickUpIndex;
|
||||
static int16 NumMessages;
|
||||
static tPickupMessage aMessages[NUMPICKUPMESSAGES];
|
||||
public:
|
||||
static void Init();
|
||||
static void Update();
|
||||
static void RenderPickUpText();
|
||||
static void DoCollectableEffects(CEntity *ent);
|
||||
static void DoMoneyEffects(CEntity *ent);
|
||||
static void DoMineEffects(CEntity *ent);
|
||||
static void DoPickUpEffects(CEntity *ent);
|
||||
static int32 GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quantity);
|
||||
static int32 GenerateNewOne_WeaponType(CVector pos, eWeaponType weaponType, uint8 type, uint32 quantity);
|
||||
static void RemovePickUp(int32 pickupIndex);
|
||||
static void RemoveAllFloatingPickups();
|
||||
static void AddToCollectedPickupsArray(int32 index);
|
||||
static bool IsPickUpPickedUp(int32 pickupId);
|
||||
static int32 ModelForWeapon(eWeaponType weaponType);
|
||||
static enum eWeaponType WeaponForModel(int32 model);
|
||||
static int32 FindColourIndexForWeaponMI(int32 model);
|
||||
static int32 GetActualPickupIndex(int32 index);
|
||||
static int32 GetNewUniquePickupIndex(int32 slot);
|
||||
static void PassTime(uint32 time);
|
||||
static bool GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex);
|
||||
static void Load(uint8 *buf, uint32 size);
|
||||
static void Save(uint8 *buf, uint32 *size);
|
||||
|
||||
static CPickup(&aPickUps)[NUMPICKUPS];
|
||||
|
||||
// unused
|
||||
static bool &bPickUpcamActivated;
|
||||
static CVehicle *&pPlayerVehicle;
|
||||
static CVector &StaticCamCoors;
|
||||
static uint32 &StaticCamStartTime;
|
||||
};
|
||||
|
||||
extern uint16 AmmoForWeapon[20];
|
||||
extern uint16 AmmoForWeapon_OnStreet[20];
|
||||
extern uint16 CostOfWeapon[20];
|
||||
|
||||
class CPacManPickups
|
||||
{
|
||||
public:
|
||||
static void Init(void);
|
||||
static void Update(void);
|
||||
static void GeneratePMPickUps(CVector, float, int16, uint8);
|
||||
static void GeneratePMPickUpsForRace(int32);
|
||||
static void GenerateOnePMPickUp(CVector);
|
||||
static void Render(void);
|
||||
static void DoCleanUpPacManStuff(void);
|
||||
static void StartPacManRace(int32);
|
||||
static void StartPacManRecord(void);
|
||||
static uint32 QueryPowerPillsEatenInRace(void);
|
||||
static void ResetPowerPillsEatenInRace(void);
|
||||
static void CleanUpPacManStuff(void);
|
||||
static void StartPacManScramble(CVector, float, int16);
|
||||
static uint32 QueryPowerPillsCarriedByPlayer(void);
|
||||
static void ResetPowerPillsCarriedByPlayer(void);
|
||||
|
||||
};
|
||||
#pragma once
|
||||
#include "Weapon.h"
|
||||
|
||||
enum ePickupType : uint8
|
||||
{
|
||||
PICKUP_NONE = 0,
|
||||
PICKUP_IN_SHOP,
|
||||
PICKUP_ON_STREET,
|
||||
PICKUP_ONCE,
|
||||
PICKUP_ONCE_TIMEOUT,
|
||||
PICKUP_COLLECTABLE1,
|
||||
PICKUP_IN_SHOP_OUT_OF_STOCK,
|
||||
PICKUP_MONEY,
|
||||
PICKUP_MINE_INACTIVE,
|
||||
PICKUP_MINE_ARMED,
|
||||
PICKUP_NAUTICAL_MINE_INACTIVE,
|
||||
PICKUP_NAUTICAL_MINE_ARMED,
|
||||
PICKUP_FLOATINGPACKAGE,
|
||||
PICKUP_FLOATINGPACKAGE_FLOATING,
|
||||
PICKUP_ON_STREET_SLOW,
|
||||
PICKUP_NUMOFTYPES
|
||||
};
|
||||
|
||||
class CEntity;
|
||||
class CObject;
|
||||
class CVehicle;
|
||||
class CPlayerPed;
|
||||
|
||||
class CPickup
|
||||
{
|
||||
public:
|
||||
ePickupType m_eType;
|
||||
bool m_bRemoved;
|
||||
uint16 m_nQuantity;
|
||||
CObject *m_pObject;
|
||||
uint32 m_nTimer;
|
||||
int16 m_eModelIndex;
|
||||
uint16 m_nIndex;
|
||||
CVector m_vecPos;
|
||||
|
||||
CObject *GiveUsAPickUpObject(int32 handle);
|
||||
bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId);
|
||||
private:
|
||||
bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; }
|
||||
inline bool CanBePickedUp(CPlayerPed *player);
|
||||
void RemoveKeepType();
|
||||
void Remove();
|
||||
};
|
||||
|
||||
static_assert(sizeof(CPickup) == 0x1C, "CPickup: error");
|
||||
|
||||
struct tPickupMessage
|
||||
{
|
||||
CVector2D m_pos;
|
||||
eWeaponType m_weaponType;
|
||||
CVector2D m_dist;
|
||||
CRGBA m_color;
|
||||
uint8 m_bOutOfStock : 1;
|
||||
uint8 m_quantity;
|
||||
};
|
||||
|
||||
class CPickups
|
||||
{
|
||||
static int32 aPickUpsCollected[NUMCOLLECTEDPICKUPS];
|
||||
static int16 CollectedPickUpIndex;
|
||||
static int16 NumMessages;
|
||||
static tPickupMessage aMessages[NUMPICKUPMESSAGES];
|
||||
public:
|
||||
static void Init();
|
||||
static void Update();
|
||||
static void RenderPickUpText();
|
||||
static void DoCollectableEffects(CEntity *ent);
|
||||
static void DoMoneyEffects(CEntity *ent);
|
||||
static void DoMineEffects(CEntity *ent);
|
||||
static void DoPickUpEffects(CEntity *ent);
|
||||
static int32 GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quantity);
|
||||
static int32 GenerateNewOne_WeaponType(CVector pos, eWeaponType weaponType, uint8 type, uint32 quantity);
|
||||
static void RemovePickUp(int32 pickupIndex);
|
||||
static void RemoveAllFloatingPickups();
|
||||
static void AddToCollectedPickupsArray(int32 index);
|
||||
static bool IsPickUpPickedUp(int32 pickupId);
|
||||
static int32 ModelForWeapon(eWeaponType weaponType);
|
||||
static enum eWeaponType WeaponForModel(int32 model);
|
||||
static int32 FindColourIndexForWeaponMI(int32 model);
|
||||
static int32 GetActualPickupIndex(int32 index);
|
||||
static int32 GetNewUniquePickupIndex(int32 slot);
|
||||
static void PassTime(uint32 time);
|
||||
static bool GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex);
|
||||
static void Load(uint8 *buf, uint32 size);
|
||||
static void Save(uint8 *buf, uint32 *size);
|
||||
|
||||
static CPickup(&aPickUps)[NUMPICKUPS];
|
||||
|
||||
// unused
|
||||
static bool &bPickUpcamActivated;
|
||||
static CVehicle *&pPlayerVehicle;
|
||||
static CVector &StaticCamCoors;
|
||||
static uint32 &StaticCamStartTime;
|
||||
};
|
||||
|
||||
extern uint16 AmmoForWeapon[20];
|
||||
extern uint16 AmmoForWeapon_OnStreet[20];
|
||||
extern uint16 CostOfWeapon[20];
|
||||
|
||||
class CPacManPickups
|
||||
{
|
||||
public:
|
||||
static void Init(void);
|
||||
static void Update(void);
|
||||
static void GeneratePMPickUps(CVector, float, int16, uint8);
|
||||
static void GeneratePMPickUpsForRace(int32);
|
||||
static void GenerateOnePMPickUp(CVector);
|
||||
static void Render(void);
|
||||
static void DoCleanUpPacManStuff(void);
|
||||
static void StartPacManRace(int32);
|
||||
static void StartPacManRecord(void);
|
||||
static uint32 QueryPowerPillsEatenInRace(void);
|
||||
static void ResetPowerPillsEatenInRace(void);
|
||||
static void CleanUpPacManStuff(void);
|
||||
static void StartPacManScramble(CVector, float, int16);
|
||||
static uint32 QueryPowerPillsCarriedByPlayer(void);
|
||||
static void ResetPowerPillsCarriedByPlayer(void);
|
||||
|
||||
};
|
||||
|
@ -1,22 +1,22 @@
|
||||
#include "common.h"
|
||||
#include "PowerPoints.h"
|
||||
|
||||
// Some cut beta feature
|
||||
|
||||
void CPowerPoint::Update()
|
||||
{}
|
||||
|
||||
void CPowerPoints::Init()
|
||||
{}
|
||||
|
||||
void CPowerPoints::Update()
|
||||
{}
|
||||
|
||||
void CPowerPoints::GenerateNewOne(float, float, float, float, float, float, uint8)
|
||||
{}
|
||||
|
||||
void CPowerPoints::Save(uint8**, uint32*)
|
||||
{}
|
||||
|
||||
void CPowerPoints::Load(uint8*, uint32)
|
||||
#include "common.h"
|
||||
#include "PowerPoints.h"
|
||||
|
||||
// Some cut beta feature
|
||||
|
||||
void CPowerPoint::Update()
|
||||
{}
|
||||
|
||||
void CPowerPoints::Init()
|
||||
{}
|
||||
|
||||
void CPowerPoints::Update()
|
||||
{}
|
||||
|
||||
void CPowerPoints::GenerateNewOne(float, float, float, float, float, float, uint8)
|
||||
{}
|
||||
|
||||
void CPowerPoints::Save(uint8**, uint32*)
|
||||
{}
|
||||
|
||||
void CPowerPoints::Load(uint8*, uint32)
|
||||
{}
|
@ -1,26 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
POWERPOINT_NONE = 0,
|
||||
POWERPOINT_HEALTH,
|
||||
POWERPOINT_HIDEOUT_INDUSTRIAL,
|
||||
POWERPOINT_HIDEOUT_COMMERCIAL,
|
||||
POWERPOINT_HIDEOUT_SUBURBAN
|
||||
};
|
||||
|
||||
class CPowerPoint
|
||||
{
|
||||
public:
|
||||
void Update();
|
||||
};
|
||||
|
||||
class CPowerPoints
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
static void Update();
|
||||
static void GenerateNewOne(float, float, float, float, float, float, uint8);
|
||||
static void Save(uint8**, uint32*);
|
||||
static void Load(uint8*, uint32);
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
POWERPOINT_NONE = 0,
|
||||
POWERPOINT_HEALTH,
|
||||
POWERPOINT_HIDEOUT_INDUSTRIAL,
|
||||
POWERPOINT_HIDEOUT_COMMERCIAL,
|
||||
POWERPOINT_HIDEOUT_SUBURBAN
|
||||
};
|
||||
|
||||
class CPowerPoint
|
||||
{
|
||||
public:
|
||||
void Update();
|
||||
};
|
||||
|
||||
class CPowerPoints
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
static void Update();
|
||||
static void GenerateNewOne(float, float, float, float, float, float, uint8);
|
||||
static void Save(uint8**, uint32*);
|
||||
static void Load(uint8*, uint32);
|
||||
};
|
@ -1129,8 +1129,8 @@ void CReplay::StoreStuffInMem(void)
|
||||
pEmptyReferences = CReferences::pEmptyList;
|
||||
pStoredCam = new uint8[sizeof(CCamera)];
|
||||
memcpy(pStoredCam, &TheCamera, sizeof(CCamera));
|
||||
pRadarBlips = new uint8[sizeof(CBlip) * NUMRADARBLIPS];
|
||||
memcpy(pRadarBlips, CRadar::ms_RadarTrace, NUMRADARBLIPS * sizeof(CBlip));
|
||||
pRadarBlips = new uint8[sizeof(sRadarTrace) * NUMRADARBLIPS];
|
||||
memcpy(pRadarBlips, CRadar::ms_RadarTrace, NUMRADARBLIPS * sizeof(sRadarTrace));
|
||||
PlayerWanted = *FindPlayerPed()->m_pWanted;
|
||||
PlayerInfo = CWorld::Players[0];
|
||||
Time1 = CTimer::GetTimeInMilliseconds();
|
||||
@ -1179,7 +1179,7 @@ void CReplay::RestoreStuffFromMem(void)
|
||||
memcpy(&TheCamera, pStoredCam, sizeof(CCamera));
|
||||
delete[] pStoredCam;
|
||||
pStoredCam = nil;
|
||||
memcpy(CRadar::ms_RadarTrace, pRadarBlips, sizeof(CBlip) * NUMRADARBLIPS);
|
||||
memcpy(CRadar::ms_RadarTrace, pRadarBlips, sizeof(sRadarTrace) * NUMRADARBLIPS);
|
||||
delete[] pRadarBlips;
|
||||
pRadarBlips = nil;
|
||||
FindPlayerPed()->m_pWanted = new CWanted(PlayerWanted);
|
||||
|
@ -21,234 +21,234 @@ CVector(&CRestart::PoliceRestartPoints)[NUM_RESTART_POINTS] = *(CVector(*)[NUM_R
|
||||
float(&CRestart::PoliceRestartHeadings)[NUM_RESTART_POINTS] = *(float(*)[NUM_RESTART_POINTS])*(uintptr*)0x6F1D20;
|
||||
uint16 &CRestart::NumberOfPoliceRestarts = *(uint16*)0x95CC44;
|
||||
|
||||
void
|
||||
CRestart::Initialise()
|
||||
{
|
||||
OverridePoliceStationLevel = LEVEL_NONE;
|
||||
OverrideHospitalLevel = LEVEL_NONE;
|
||||
bFadeInAfterNextArrest = true;
|
||||
bFadeInAfterNextDeath = true;
|
||||
OverrideHeading = 0.0f;
|
||||
OverridePosition = CVector(0.0f, 0.0f, 0.0f);
|
||||
bOverrideRestart = false;
|
||||
NumberOfPoliceRestarts = 0;
|
||||
NumberOfHospitalRestarts = 0;
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
HospitalRestartPoints[i] = CVector(0.0f, 0.0f, 0.0f);
|
||||
HospitalRestartHeadings[i] = 0.0f;
|
||||
PoliceRestartPoints[i] = CVector(0.0f, 0.0f, 0.0f);
|
||||
PoliceRestartHeadings[i] = 0.0f;
|
||||
}
|
||||
void
|
||||
CRestart::Initialise()
|
||||
{
|
||||
OverridePoliceStationLevel = LEVEL_NONE;
|
||||
OverrideHospitalLevel = LEVEL_NONE;
|
||||
bFadeInAfterNextArrest = true;
|
||||
bFadeInAfterNextDeath = true;
|
||||
OverrideHeading = 0.0f;
|
||||
OverridePosition = CVector(0.0f, 0.0f, 0.0f);
|
||||
bOverrideRestart = false;
|
||||
NumberOfPoliceRestarts = 0;
|
||||
NumberOfHospitalRestarts = 0;
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
HospitalRestartPoints[i] = CVector(0.0f, 0.0f, 0.0f);
|
||||
HospitalRestartHeadings[i] = 0.0f;
|
||||
PoliceRestartPoints[i] = CVector(0.0f, 0.0f, 0.0f);
|
||||
PoliceRestartHeadings[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CRestart::AddHospitalRestartPoint(const CVector &pos, float heading)
|
||||
{
|
||||
HospitalRestartPoints[NumberOfHospitalRestarts] = pos;
|
||||
HospitalRestartHeadings[NumberOfHospitalRestarts++] = heading;
|
||||
void
|
||||
CRestart::AddHospitalRestartPoint(const CVector &pos, float heading)
|
||||
{
|
||||
HospitalRestartPoints[NumberOfHospitalRestarts] = pos;
|
||||
HospitalRestartHeadings[NumberOfHospitalRestarts++] = heading;
|
||||
}
|
||||
|
||||
void
|
||||
CRestart::AddPoliceRestartPoint(const CVector &pos, float heading)
|
||||
{
|
||||
PoliceRestartPoints[NumberOfPoliceRestarts] = pos;
|
||||
PoliceRestartHeadings[NumberOfPoliceRestarts++] = heading;
|
||||
void
|
||||
CRestart::AddPoliceRestartPoint(const CVector &pos, float heading)
|
||||
{
|
||||
PoliceRestartPoints[NumberOfPoliceRestarts] = pos;
|
||||
PoliceRestartHeadings[NumberOfPoliceRestarts++] = heading;
|
||||
}
|
||||
|
||||
void
|
||||
CRestart::OverrideNextRestart(const CVector &pos, float heading)
|
||||
{
|
||||
bOverrideRestart = true;
|
||||
OverridePosition = pos;
|
||||
OverrideHeading = heading;
|
||||
void
|
||||
CRestart::OverrideNextRestart(const CVector &pos, float heading)
|
||||
{
|
||||
bOverrideRestart = true;
|
||||
OverridePosition = pos;
|
||||
OverrideHeading = heading;
|
||||
}
|
||||
|
||||
void
|
||||
CRestart::CancelOverrideRestart()
|
||||
{
|
||||
bOverrideRestart = false;
|
||||
void
|
||||
CRestart::CancelOverrideRestart()
|
||||
{
|
||||
bOverrideRestart = false;
|
||||
}
|
||||
|
||||
void
|
||||
CRestart::FindClosestHospitalRestartPoint(const CVector &pos, CVector *outPos, float *outHeading)
|
||||
{
|
||||
if (bOverrideRestart) {
|
||||
*outPos = OverridePosition;
|
||||
*outHeading = OverrideHeading;
|
||||
CancelOverrideRestart();
|
||||
return;
|
||||
}
|
||||
|
||||
eLevelName curlevel = CTheZones::FindZoneForPoint(pos);
|
||||
float fMinDist = 16000000.0f;
|
||||
int closestPoint = NUM_RESTART_POINTS;
|
||||
|
||||
// find closest point on this level
|
||||
for (int i = 0; i < NumberOfHospitalRestarts; i++) {
|
||||
if (CTheZones::FindZoneForPoint(HospitalRestartPoints[i]) == (OverrideHospitalLevel != LEVEL_NONE ? OverrideHospitalLevel : curlevel)) {
|
||||
float dist = (pos - HospitalRestartPoints[i]).MagnitudeSqr();
|
||||
if (fMinDist >= dist) {
|
||||
fMinDist = dist;
|
||||
closestPoint = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we didn't find anything, find closest point on any level
|
||||
if (closestPoint == NUM_RESTART_POINTS) {
|
||||
for (int i = 0; i < NumberOfHospitalRestarts; i++) {
|
||||
float dist = (pos - HospitalRestartPoints[i]).MagnitudeSqr();
|
||||
if (fMinDist >= dist) {
|
||||
fMinDist = dist;
|
||||
closestPoint = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we still didn't find anything, find closest path node
|
||||
if (closestPoint == NUM_RESTART_POINTS) {
|
||||
*outPos = ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, PATH_PED, 999999.9f)].pos;
|
||||
*outHeading = 0.0f;
|
||||
printf("Couldn't find a hospital restart zone near the player %f %f %f->%f %f %f\n", pos.x, pos.y, pos.z, outPos->x, outPos->y, outPos->z);
|
||||
} else {
|
||||
*outPos = HospitalRestartPoints[closestPoint];
|
||||
*outHeading = HospitalRestartHeadings[closestPoint];
|
||||
}
|
||||
void
|
||||
CRestart::FindClosestHospitalRestartPoint(const CVector &pos, CVector *outPos, float *outHeading)
|
||||
{
|
||||
if (bOverrideRestart) {
|
||||
*outPos = OverridePosition;
|
||||
*outHeading = OverrideHeading;
|
||||
CancelOverrideRestart();
|
||||
return;
|
||||
}
|
||||
|
||||
eLevelName curlevel = CTheZones::FindZoneForPoint(pos);
|
||||
float fMinDist = 16000000.0f;
|
||||
int closestPoint = NUM_RESTART_POINTS;
|
||||
|
||||
// find closest point on this level
|
||||
for (int i = 0; i < NumberOfHospitalRestarts; i++) {
|
||||
if (CTheZones::FindZoneForPoint(HospitalRestartPoints[i]) == (OverrideHospitalLevel != LEVEL_NONE ? OverrideHospitalLevel : curlevel)) {
|
||||
float dist = (pos - HospitalRestartPoints[i]).MagnitudeSqr();
|
||||
if (fMinDist >= dist) {
|
||||
fMinDist = dist;
|
||||
closestPoint = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we didn't find anything, find closest point on any level
|
||||
if (closestPoint == NUM_RESTART_POINTS) {
|
||||
for (int i = 0; i < NumberOfHospitalRestarts; i++) {
|
||||
float dist = (pos - HospitalRestartPoints[i]).MagnitudeSqr();
|
||||
if (fMinDist >= dist) {
|
||||
fMinDist = dist;
|
||||
closestPoint = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we still didn't find anything, find closest path node
|
||||
if (closestPoint == NUM_RESTART_POINTS) {
|
||||
*outPos = ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, PATH_PED, 999999.9f)].pos;
|
||||
*outHeading = 0.0f;
|
||||
printf("Couldn't find a hospital restart zone near the player %f %f %f->%f %f %f\n", pos.x, pos.y, pos.z, outPos->x, outPos->y, outPos->z);
|
||||
} else {
|
||||
*outPos = HospitalRestartPoints[closestPoint];
|
||||
*outHeading = HospitalRestartHeadings[closestPoint];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CRestart::FindClosestPoliceRestartPoint(const CVector &pos, CVector *outPos, float *outHeading)
|
||||
{
|
||||
if (bOverrideRestart) {
|
||||
*outPos = OverridePosition;
|
||||
*outHeading = OverrideHeading;
|
||||
CancelOverrideRestart();
|
||||
return;
|
||||
}
|
||||
|
||||
eLevelName curlevel = CTheZones::FindZoneForPoint(pos);
|
||||
float fMinDist = 16000000.0f;
|
||||
int closestPoint = NUM_RESTART_POINTS;
|
||||
|
||||
// find closest point on this level
|
||||
for (int i = 0; i < NumberOfPoliceRestarts; i++) {
|
||||
if (CTheZones::FindZoneForPoint(PoliceRestartPoints[i]) == (OverridePoliceStationLevel != LEVEL_NONE ? OverridePoliceStationLevel : curlevel)) {
|
||||
float dist = (pos - PoliceRestartPoints[i]).MagnitudeSqr();
|
||||
if (fMinDist >= dist) {
|
||||
fMinDist = dist;
|
||||
closestPoint = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we didn't find anything, find closest point on any level
|
||||
if (closestPoint == NUM_RESTART_POINTS) {
|
||||
for (int i = 0; i < NumberOfPoliceRestarts; i++) {
|
||||
float dist = (pos - PoliceRestartPoints[i]).MagnitudeSqr();
|
||||
if (fMinDist >= dist) {
|
||||
fMinDist = dist;
|
||||
closestPoint = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we still didn't find anything, find closest path node
|
||||
if (closestPoint == NUM_RESTART_POINTS) {
|
||||
printf("Couldn't find a police restart zone near the player\n");
|
||||
*outPos = ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, PATH_PED, 999999.9f)].pos;
|
||||
*outHeading = 0.0f;
|
||||
} else {
|
||||
*outPos = PoliceRestartPoints[closestPoint];
|
||||
*outHeading = PoliceRestartHeadings[closestPoint];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CRestart::LoadAllRestartPoints(uint8 *buf, uint32 size)
|
||||
{
|
||||
Initialise();
|
||||
|
||||
INITSAVEBUF
|
||||
CheckSaveHeader(buf, 'R','S','T','\0', size - SAVE_HEADER_SIZE);
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
HospitalRestartPoints[i] = ReadSaveBuf<CVector>(buf);
|
||||
HospitalRestartHeadings[i] = ReadSaveBuf<float>(buf);
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
PoliceRestartPoints[i] = ReadSaveBuf<CVector>(buf);
|
||||
PoliceRestartHeadings[i] = ReadSaveBuf<float>(buf);
|
||||
}
|
||||
|
||||
NumberOfHospitalRestarts = ReadSaveBuf<uint16>(buf);
|
||||
NumberOfPoliceRestarts = ReadSaveBuf<uint16>(buf);
|
||||
bOverrideRestart = ReadSaveBuf<bool>(buf);
|
||||
|
||||
// skip something unused
|
||||
ReadSaveBuf<uint8>(buf);
|
||||
ReadSaveBuf<uint16>(buf);
|
||||
|
||||
OverridePosition = ReadSaveBuf<CVector>(buf);
|
||||
OverrideHeading = ReadSaveBuf<float>(buf);
|
||||
bFadeInAfterNextDeath = ReadSaveBuf<bool>(buf);
|
||||
bFadeInAfterNextArrest = ReadSaveBuf<bool>(buf);
|
||||
OverrideHospitalLevel = ReadSaveBuf<uint8>(buf);
|
||||
OverridePoliceStationLevel = ReadSaveBuf<uint8>(buf);
|
||||
VALIDATESAVEBUF(size);
|
||||
}
|
||||
|
||||
void
|
||||
CRestart::SaveAllRestartPoints(uint8 *buf, uint32 *size)
|
||||
{
|
||||
*size = SAVE_HEADER_SIZE
|
||||
+ sizeof(HospitalRestartPoints)
|
||||
+ sizeof(HospitalRestartHeadings)
|
||||
+ sizeof(PoliceRestartPoints)
|
||||
+ sizeof(PoliceRestartHeadings)
|
||||
+ sizeof(NumberOfHospitalRestarts)
|
||||
+ sizeof(NumberOfPoliceRestarts)
|
||||
+ sizeof(bOverrideRestart)
|
||||
+ sizeof(uint8)
|
||||
+ sizeof(uint16)
|
||||
+ sizeof(OverridePosition)
|
||||
+ sizeof(OverrideHeading)
|
||||
+ sizeof(bFadeInAfterNextDeath)
|
||||
+ sizeof(bFadeInAfterNextArrest)
|
||||
+ sizeof(OverrideHospitalLevel)
|
||||
+ sizeof(OverridePoliceStationLevel); // == 292
|
||||
|
||||
INITSAVEBUF
|
||||
WriteSaveHeader(buf, 'R','S','T','\0', *size - SAVE_HEADER_SIZE);
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
WriteSaveBuf(buf, HospitalRestartPoints[i]);
|
||||
WriteSaveBuf(buf, HospitalRestartHeadings[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
WriteSaveBuf(buf, PoliceRestartPoints[i]);
|
||||
WriteSaveBuf(buf, PoliceRestartHeadings[i]);
|
||||
}
|
||||
|
||||
WriteSaveBuf(buf, NumberOfHospitalRestarts);
|
||||
WriteSaveBuf(buf, NumberOfPoliceRestarts);
|
||||
WriteSaveBuf(buf, bOverrideRestart);
|
||||
|
||||
WriteSaveBuf(buf, (uint8)0);
|
||||
WriteSaveBuf(buf, (uint16)0);
|
||||
|
||||
WriteSaveBuf(buf, OverridePosition);
|
||||
WriteSaveBuf(buf, OverrideHeading);
|
||||
WriteSaveBuf(buf, bFadeInAfterNextDeath);
|
||||
WriteSaveBuf(buf, bFadeInAfterNextArrest);
|
||||
WriteSaveBuf(buf, OverrideHospitalLevel);
|
||||
WriteSaveBuf(buf, OverridePoliceStationLevel);
|
||||
VALIDATESAVEBUF(*size);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CRestart::FindClosestPoliceRestartPoint(const CVector &pos, CVector *outPos, float *outHeading)
|
||||
{
|
||||
if (bOverrideRestart) {
|
||||
*outPos = OverridePosition;
|
||||
*outHeading = OverrideHeading;
|
||||
CancelOverrideRestart();
|
||||
return;
|
||||
}
|
||||
|
||||
eLevelName curlevel = CTheZones::FindZoneForPoint(pos);
|
||||
float fMinDist = 16000000.0f;
|
||||
int closestPoint = NUM_RESTART_POINTS;
|
||||
|
||||
// find closest point on this level
|
||||
for (int i = 0; i < NumberOfPoliceRestarts; i++) {
|
||||
if (CTheZones::FindZoneForPoint(PoliceRestartPoints[i]) == (OverridePoliceStationLevel != LEVEL_NONE ? OverridePoliceStationLevel : curlevel)) {
|
||||
float dist = (pos - PoliceRestartPoints[i]).MagnitudeSqr();
|
||||
if (fMinDist >= dist) {
|
||||
fMinDist = dist;
|
||||
closestPoint = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we didn't find anything, find closest point on any level
|
||||
if (closestPoint == NUM_RESTART_POINTS) {
|
||||
for (int i = 0; i < NumberOfPoliceRestarts; i++) {
|
||||
float dist = (pos - PoliceRestartPoints[i]).MagnitudeSqr();
|
||||
if (fMinDist >= dist) {
|
||||
fMinDist = dist;
|
||||
closestPoint = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we still didn't find anything, find closest path node
|
||||
if (closestPoint == NUM_RESTART_POINTS) {
|
||||
printf("Couldn't find a police restart zone near the player\n");
|
||||
*outPos = ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, PATH_PED, 999999.9f)].pos;
|
||||
*outHeading = 0.0f;
|
||||
} else {
|
||||
*outPos = PoliceRestartPoints[closestPoint];
|
||||
*outHeading = PoliceRestartHeadings[closestPoint];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CRestart::LoadAllRestartPoints(uint8 *buf, uint32 size)
|
||||
{
|
||||
Initialise();
|
||||
|
||||
INITSAVEBUF
|
||||
CheckSaveHeader(buf, 'R','S','T','\0', size - SAVE_HEADER_SIZE);
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
HospitalRestartPoints[i] = ReadSaveBuf<CVector>(buf);
|
||||
HospitalRestartHeadings[i] = ReadSaveBuf<float>(buf);
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
PoliceRestartPoints[i] = ReadSaveBuf<CVector>(buf);
|
||||
PoliceRestartHeadings[i] = ReadSaveBuf<float>(buf);
|
||||
}
|
||||
|
||||
NumberOfHospitalRestarts = ReadSaveBuf<uint16>(buf);
|
||||
NumberOfPoliceRestarts = ReadSaveBuf<uint16>(buf);
|
||||
bOverrideRestart = ReadSaveBuf<bool>(buf);
|
||||
|
||||
// skip something unused
|
||||
ReadSaveBuf<uint8>(buf);
|
||||
ReadSaveBuf<uint16>(buf);
|
||||
|
||||
OverridePosition = ReadSaveBuf<CVector>(buf);
|
||||
OverrideHeading = ReadSaveBuf<float>(buf);
|
||||
bFadeInAfterNextDeath = ReadSaveBuf<bool>(buf);
|
||||
bFadeInAfterNextArrest = ReadSaveBuf<bool>(buf);
|
||||
OverrideHospitalLevel = ReadSaveBuf<uint8>(buf);
|
||||
OverridePoliceStationLevel = ReadSaveBuf<uint8>(buf);
|
||||
VALIDATESAVEBUF(size);
|
||||
}
|
||||
|
||||
void
|
||||
CRestart::SaveAllRestartPoints(uint8 *buf, uint32 *size)
|
||||
{
|
||||
*size = SAVE_HEADER_SIZE
|
||||
+ sizeof(HospitalRestartPoints)
|
||||
+ sizeof(HospitalRestartHeadings)
|
||||
+ sizeof(PoliceRestartPoints)
|
||||
+ sizeof(PoliceRestartHeadings)
|
||||
+ sizeof(NumberOfHospitalRestarts)
|
||||
+ sizeof(NumberOfPoliceRestarts)
|
||||
+ sizeof(bOverrideRestart)
|
||||
+ sizeof(uint8)
|
||||
+ sizeof(uint16)
|
||||
+ sizeof(OverridePosition)
|
||||
+ sizeof(OverrideHeading)
|
||||
+ sizeof(bFadeInAfterNextDeath)
|
||||
+ sizeof(bFadeInAfterNextArrest)
|
||||
+ sizeof(OverrideHospitalLevel)
|
||||
+ sizeof(OverridePoliceStationLevel); // == 292
|
||||
|
||||
INITSAVEBUF
|
||||
WriteSaveHeader(buf, 'R','S','T','\0', *size - SAVE_HEADER_SIZE);
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
WriteSaveBuf(buf, HospitalRestartPoints[i]);
|
||||
WriteSaveBuf(buf, HospitalRestartHeadings[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
WriteSaveBuf(buf, PoliceRestartPoints[i]);
|
||||
WriteSaveBuf(buf, PoliceRestartHeadings[i]);
|
||||
}
|
||||
|
||||
WriteSaveBuf(buf, NumberOfHospitalRestarts);
|
||||
WriteSaveBuf(buf, NumberOfPoliceRestarts);
|
||||
WriteSaveBuf(buf, bOverrideRestart);
|
||||
|
||||
WriteSaveBuf(buf, (uint8)0);
|
||||
WriteSaveBuf(buf, (uint16)0);
|
||||
|
||||
WriteSaveBuf(buf, OverridePosition);
|
||||
WriteSaveBuf(buf, OverrideHeading);
|
||||
WriteSaveBuf(buf, bFadeInAfterNextDeath);
|
||||
WriteSaveBuf(buf, bFadeInAfterNextArrest);
|
||||
WriteSaveBuf(buf, OverrideHospitalLevel);
|
||||
WriteSaveBuf(buf, OverridePoliceStationLevel);
|
||||
VALIDATESAVEBUF(*size);
|
||||
}
|
||||
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x435E20, &CRestart::Initialise, PATCH_JUMP);
|
||||
InjectHook(0x436100, &CRestart::AddHospitalRestartPoint, PATCH_JUMP);
|
||||
@ -258,5 +258,5 @@ STARTPATCHES
|
||||
InjectHook(0x4361A0, &CRestart::FindClosestHospitalRestartPoint, PATCH_JUMP);
|
||||
InjectHook(0x436450, &CRestart::FindClosestPoliceRestartPoint, PATCH_JUMP);
|
||||
InjectHook(0x436B20, &CRestart::LoadAllRestartPoints, PATCH_JUMP);
|
||||
InjectHook(0x436700, &CRestart::SaveAllRestartPoints, PATCH_JUMP);
|
||||
InjectHook(0x436700, &CRestart::SaveAllRestartPoints, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -91,10 +91,10 @@ uint8 (&CTheScripts::ScriptSpace)[SIZE_SCRIPT_SPACE] = *(uint8(*)[SIZE_SCRIPT_SP
|
||||
CRunningScript(&CTheScripts::ScriptsArray)[MAX_NUM_SCRIPTS] = *(CRunningScript(*)[MAX_NUM_SCRIPTS])*(uintptr*)0x6F5C08;
|
||||
int32(&CTheScripts::BaseBriefIdForContact)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x880200;
|
||||
int32(&CTheScripts::OnAMissionForContactFlag)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x8622F0;
|
||||
CTextLine (&CTheScripts::IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES] = *(CTextLine (*)[MAX_NUM_INTRO_TEXT_LINES])*(uintptr*)0x70EA68;
|
||||
CScriptRectangle (&CTheScripts::IntroRectangles)[MAX_NUM_INTRO_RECTANGLES] = *(CScriptRectangle (*)[MAX_NUM_INTRO_RECTANGLES])*(uintptr*)0x72D108;
|
||||
intro_text_line (&CTheScripts::IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES] = *(intro_text_line (*)[MAX_NUM_INTRO_TEXT_LINES])*(uintptr*)0x70EA68;
|
||||
intro_script_rectangle (&CTheScripts::IntroRectangles)[MAX_NUM_INTRO_RECTANGLES] = *(intro_script_rectangle (*)[MAX_NUM_INTRO_RECTANGLES])*(uintptr*)0x72D108;
|
||||
CSprite2d (&CTheScripts::ScriptSprites)[MAX_NUM_SCRIPT_SRPITES] = *(CSprite2d(*)[MAX_NUM_SCRIPT_SRPITES])*(uintptr*)0x72B090;
|
||||
CScriptSphere(&CTheScripts::ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES] = *(CScriptSphere(*)[MAX_NUM_SCRIPT_SPHERES])*(uintptr*)0x727D60;
|
||||
script_sphere_struct(&CTheScripts::ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES] = *(script_sphere_struct(*)[MAX_NUM_SCRIPT_SPHERES])*(uintptr*)0x727D60;
|
||||
tCollectiveData(&CTheScripts::CollectiveArray)[MAX_NUM_COLLECTIVES] = *(tCollectiveData(*)[MAX_NUM_COLLECTIVES])*(uintptr*)0x6FA008;
|
||||
tUsedObject(&CTheScripts::UsedObjectArray)[MAX_NUM_USED_OBJECTS] = *(tUsedObject(*)[MAX_NUM_USED_OBJECTS])*(uintptr*)0x6E69C8;
|
||||
int32(&CTheScripts::MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS] = *(int32(*)[MAX_NUM_MISSION_SCRIPTS])*(uintptr*)0x6F0558;
|
||||
@ -313,7 +313,7 @@ bool CUpsideDownCarCheck::HasCarBeenUpsideDownForAWhile(int32 id)
|
||||
return false;
|
||||
}
|
||||
|
||||
void CStuckCarCheckEntry::Reset()
|
||||
void stuck_car_data::Reset()
|
||||
{
|
||||
m_nVehicleIndex = -1;
|
||||
m_vecPos = CVector(-5000.0f, -5000.0f, -5000.0f);
|
||||
@ -8442,7 +8442,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||
CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]];
|
||||
CPad::GetPad(ScriptParams[0])->DisablePlayerControls |= PLAYERCONTROL_DISABLED_80;
|
||||
pPlayerInfo->MakePlayerSafe(true);
|
||||
CCutsceneMgr::SetRunning(true);
|
||||
CCutsceneMgr::StartCutsceneProcessing();
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_USE_TEXT_COMMANDS:
|
||||
@ -11373,15 +11373,15 @@ void CTheScripts::ClearSpaceForMissionEntity(const CVector& pos, CEntity* pEntit
|
||||
continue;
|
||||
CEntity* pFound = aEntities[i];
|
||||
int cols;
|
||||
if (CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel()->numLines <= 0)
|
||||
cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel(),
|
||||
pFound->GetMatrix(), *CModelInfo::GetModelInfo(pFound->GetModelIndex())->GetColModel(), aTempColPoints, nil, nil);
|
||||
if (pEntity->GetColModel()->numLines <= 0)
|
||||
cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *pEntity->GetColModel(),
|
||||
pFound->GetMatrix(), *pFound->GetColModel(), aTempColPoints, nil, nil);
|
||||
else {
|
||||
float lines[4];
|
||||
lines[0] = lines[1] = lines[2] = lines[3] = 1.0f;
|
||||
CColPoint tmp;
|
||||
cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel(),
|
||||
pFound->GetMatrix(), *CModelInfo::GetModelInfo(pFound->GetModelIndex())->GetColModel(), aTempColPoints, &tmp, lines);
|
||||
CColPoint tmp[4];
|
||||
cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *pEntity->GetColModel(),
|
||||
pFound->GetMatrix(), *pFound->GetColModel(), aTempColPoints,tmp, lines);
|
||||
}
|
||||
if (cols <= 0)
|
||||
continue;
|
||||
|
@ -15,22 +15,25 @@ class CRunningScript;
|
||||
|
||||
#define KEY_LENGTH_IN_SCRIPT 8
|
||||
|
||||
struct CScriptRectangle
|
||||
struct intro_script_rectangle
|
||||
{
|
||||
bool m_bIsUsed;
|
||||
bool m_bBeforeFade;
|
||||
int16 m_nTextureId;
|
||||
CRect m_sRect;
|
||||
CRGBA m_sColor;
|
||||
|
||||
intro_script_rectangle() { }
|
||||
~intro_script_rectangle() { }
|
||||
};
|
||||
|
||||
static_assert(sizeof(CScriptRectangle) == 0x18, "Script.h: error");
|
||||
static_assert(sizeof(intro_script_rectangle) == 0x18, "Script.h: error");
|
||||
|
||||
enum {
|
||||
SCRIPT_TEXT_MAX_LENGTH = 500
|
||||
};
|
||||
|
||||
struct CTextLine
|
||||
struct intro_text_line
|
||||
{
|
||||
float m_fScaleX;
|
||||
float m_fScaleY;
|
||||
@ -50,6 +53,9 @@ struct CTextLine
|
||||
float m_fAtY;
|
||||
wchar m_Text[SCRIPT_TEXT_MAX_LENGTH];
|
||||
|
||||
intro_text_line() { }
|
||||
~intro_text_line() { }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_fScaleX = 0.48f;
|
||||
@ -72,15 +78,17 @@ struct CTextLine
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(sizeof(CTextLine) == 0x414, "Script.h: error");
|
||||
static_assert(sizeof(intro_text_line) == 0x414, "Script.h: error");
|
||||
|
||||
struct CScriptSphere
|
||||
struct script_sphere_struct
|
||||
{
|
||||
bool m_bInUse;
|
||||
uint16 m_Index;
|
||||
uint32 m_Id;
|
||||
CVector m_vecCenter;
|
||||
float m_fRadius;
|
||||
|
||||
script_sphere_struct() { }
|
||||
};
|
||||
|
||||
struct CStoredLine
|
||||
@ -145,7 +153,7 @@ public:
|
||||
bool HasCarBeenUpsideDownForAWhile(int32);
|
||||
};
|
||||
|
||||
struct CStuckCarCheckEntry
|
||||
struct stuck_car_data
|
||||
{
|
||||
int32 m_nVehicleIndex;
|
||||
CVector m_vecPos;
|
||||
@ -154,12 +162,13 @@ struct CStuckCarCheckEntry
|
||||
uint32 m_nStuckTime;
|
||||
bool m_bStuck;
|
||||
|
||||
stuck_car_data() { }
|
||||
inline void Reset();
|
||||
};
|
||||
|
||||
class CStuckCarCheck
|
||||
{
|
||||
CStuckCarCheckEntry m_sCars[MAX_STUCK_CAR_CHECKS];
|
||||
stuck_car_data m_sCars[MAX_STUCK_CAR_CHECKS];
|
||||
|
||||
public:
|
||||
void Init();
|
||||
@ -235,10 +244,10 @@ class CTheScripts
|
||||
static CRunningScript(&ScriptsArray)[MAX_NUM_SCRIPTS];
|
||||
static int32(&BaseBriefIdForContact)[MAX_NUM_CONTACTS];
|
||||
static int32(&OnAMissionForContactFlag)[MAX_NUM_CONTACTS];
|
||||
static CTextLine(&IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES];
|
||||
static CScriptRectangle(&IntroRectangles)[MAX_NUM_INTRO_RECTANGLES];
|
||||
static intro_text_line(&IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES];
|
||||
static intro_script_rectangle(&IntroRectangles)[MAX_NUM_INTRO_RECTANGLES];
|
||||
static CSprite2d(&ScriptSprites)[MAX_NUM_SCRIPT_SRPITES];
|
||||
static CScriptSphere(&ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES];
|
||||
static script_sphere_struct(&ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES];
|
||||
static tCollectiveData(&CollectiveArray)[MAX_NUM_COLLECTIVES];
|
||||
static tUsedObject(&UsedObjectArray)[MAX_NUM_USED_OBJECTS];
|
||||
static int32(&MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS];
|
||||
|
Reference in New Issue
Block a user