mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 04:10:00 +00:00
Merge pull request #474 from Nick007J/master
Bug fixes, mostly replay; added RegisterReference for player ped pointer
This commit is contained in:
commit
0f07a323c9
|
@ -12,6 +12,9 @@
|
||||||
#include "AudioScriptObject.h"
|
#include "AudioScriptObject.h"
|
||||||
#include "RpAnimBlend.h"
|
#include "RpAnimBlend.h"
|
||||||
#include "AnimBlendAssociation.h"
|
#include "AnimBlendAssociation.h"
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
#include "Replay.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
CPhoneInfo gPhoneInfo;
|
CPhoneInfo gPhoneInfo;
|
||||||
|
|
||||||
|
@ -45,6 +48,10 @@ isPhoneAvailable(int m_phoneId)
|
||||||
void
|
void
|
||||||
CPhoneInfo::Update(void)
|
CPhoneInfo::Update(void)
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (CReplay::IsPlayingBack())
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
CPlayerPed *player = FindPlayerPed();
|
CPlayerPed *player = FindPlayerPed();
|
||||||
CPlayerInfo *playerInfo = &CWorld::Players[CWorld::PlayerInFocus];
|
CPlayerInfo *playerInfo = &CWorld::Players[CWorld::PlayerInFocus];
|
||||||
if (bDisplayingPhoneMessage && CTimer::GetTimeInMilliseconds() > PhoneEnableControlsTimer) {
|
if (bDisplayingPhoneMessage && CTimer::GetTimeInMilliseconds() > PhoneEnableControlsTimer) {
|
||||||
|
|
|
@ -68,8 +68,8 @@ bool CReplay::bReplayEnabled = true;
|
||||||
uint32 CReplay::SlowMotion;
|
uint32 CReplay::SlowMotion;
|
||||||
uint32 CReplay::FramesActiveLookAroundCam;
|
uint32 CReplay::FramesActiveLookAroundCam;
|
||||||
bool CReplay::bDoLoadSceneWhenDone;
|
bool CReplay::bDoLoadSceneWhenDone;
|
||||||
CPtrList CReplay::WorldPtrList;
|
CPtrNode* CReplay::WorldPtrList;
|
||||||
CPtrList CReplay::BigBuildingPtrList;
|
CPtrNode* CReplay::BigBuildingPtrList;
|
||||||
CWanted CReplay::PlayerWanted;
|
CWanted CReplay::PlayerWanted;
|
||||||
CPlayerInfo CReplay::PlayerInfo;
|
CPlayerInfo CReplay::PlayerInfo;
|
||||||
uint32 CReplay::Time1;
|
uint32 CReplay::Time1;
|
||||||
|
@ -101,6 +101,9 @@ bool CReplay::bPlayerInRCBuggy;
|
||||||
float CReplay::fDistanceLookAroundCam;
|
float CReplay::fDistanceLookAroundCam;
|
||||||
float CReplay::fBetaAngleLookAroundCam;
|
float CReplay::fBetaAngleLookAroundCam;
|
||||||
float CReplay::fAlphaAngleLookAroundCam;
|
float CReplay::fAlphaAngleLookAroundCam;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
int CReplay::nHandleOfPlayerPed[NUMPLAYERS];
|
||||||
|
#endif
|
||||||
|
|
||||||
static void(*CBArray[])(CAnimBlendAssociation*, void*) =
|
static void(*CBArray[])(CAnimBlendAssociation*, void*) =
|
||||||
{
|
{
|
||||||
|
@ -275,7 +278,7 @@ void CReplay::RecordThisFrame(void)
|
||||||
continue;
|
continue;
|
||||||
memory_required += sizeof(tBulletTracePacket);
|
memory_required += sizeof(tBulletTracePacket);
|
||||||
}
|
}
|
||||||
memory_required += sizeof(tEndOfFramePacket);
|
memory_required += sizeof(tEndOfFramePacket) + 1; // 1 for Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
||||||
if (Record.m_nOffset + memory_required > REPLAYBUFFERSIZE) {
|
if (Record.m_nOffset + memory_required > REPLAYBUFFERSIZE) {
|
||||||
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
||||||
BufferStatus[Record.m_bSlot] = REPLAYBUFFER_PLAYBACK;
|
BufferStatus[Record.m_bSlot] = REPLAYBUFFER_PLAYBACK;
|
||||||
|
@ -1108,6 +1111,10 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca
|
||||||
|
|
||||||
void CReplay::StoreStuffInMem(void)
|
void CReplay::StoreStuffInMem(void)
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
for (int i = 0; i < NUMPLAYERS; i++)
|
||||||
|
nHandleOfPlayerPed[i] = CPools::GetPedPool()->GetIndex(CWorld::Players[i].m_pPed);
|
||||||
|
#endif
|
||||||
CPools::GetVehiclePool()->Store(pBuf0, pBuf1);
|
CPools::GetVehiclePool()->Store(pBuf0, pBuf1);
|
||||||
CPools::GetPedPool()->Store(pBuf2, pBuf3);
|
CPools::GetPedPool()->Store(pBuf2, pBuf3);
|
||||||
CPools::GetObjectPool()->Store(pBuf4, pBuf5);
|
CPools::GetObjectPool()->Store(pBuf4, pBuf5);
|
||||||
|
@ -1116,8 +1123,8 @@ void CReplay::StoreStuffInMem(void)
|
||||||
CPools::GetDummyPool()->Store(pBuf10, pBuf11);
|
CPools::GetDummyPool()->Store(pBuf10, pBuf11);
|
||||||
pWorld1 = new uint8[sizeof(CSector) * NUMSECTORS_X * NUMSECTORS_Y];
|
pWorld1 = new uint8[sizeof(CSector) * NUMSECTORS_X * NUMSECTORS_Y];
|
||||||
memcpy(pWorld1, CWorld::GetSector(0, 0), NUMSECTORS_X * NUMSECTORS_Y * sizeof(CSector));
|
memcpy(pWorld1, CWorld::GetSector(0, 0), NUMSECTORS_X * NUMSECTORS_Y * sizeof(CSector));
|
||||||
WorldPtrList = CWorld::GetMovingEntityList();
|
WorldPtrList = CWorld::GetMovingEntityList().first; // why
|
||||||
BigBuildingPtrList = CWorld::GetBigBuildingList(LEVEL_NONE);
|
BigBuildingPtrList = CWorld::GetBigBuildingList(LEVEL_NONE).first;
|
||||||
pPickups = new uint8[sizeof(CPickup) * NUMPICKUPS];
|
pPickups = new uint8[sizeof(CPickup) * NUMPICKUPS];
|
||||||
memcpy(pPickups, CPickups::aPickUps, NUMPICKUPS * sizeof(CPickup));
|
memcpy(pPickups, CPickups::aPickUps, NUMPICKUPS * sizeof(CPickup));
|
||||||
pReferences = new uint8[(sizeof(CReference) * NUMREFERENCES)];
|
pReferences = new uint8[(sizeof(CReference) * NUMREFERENCES)];
|
||||||
|
@ -1162,8 +1169,8 @@ void CReplay::RestoreStuffFromMem(void)
|
||||||
memcpy(CWorld::GetSector(0, 0), pWorld1, sizeof(CSector) * NUMSECTORS_X * NUMSECTORS_Y);
|
memcpy(CWorld::GetSector(0, 0), pWorld1, sizeof(CSector) * NUMSECTORS_X * NUMSECTORS_Y);
|
||||||
delete[] pWorld1;
|
delete[] pWorld1;
|
||||||
pWorld1 = nil;
|
pWorld1 = nil;
|
||||||
CWorld::GetMovingEntityList() = WorldPtrList;
|
CWorld::GetMovingEntityList().first = WorldPtrList;
|
||||||
CWorld::GetBigBuildingList(LEVEL_NONE) = BigBuildingPtrList;
|
CWorld::GetBigBuildingList(LEVEL_NONE).first = BigBuildingPtrList;
|
||||||
memcpy(CPickups::aPickUps, pPickups, sizeof(CPickup) * NUMPICKUPS);
|
memcpy(CPickups::aPickUps, pPickups, sizeof(CPickup) * NUMPICKUPS);
|
||||||
delete[] pPickups;
|
delete[] pPickups;
|
||||||
pPickups = nil;
|
pPickups = nil;
|
||||||
|
@ -1178,6 +1185,14 @@ void CReplay::RestoreStuffFromMem(void)
|
||||||
memcpy(CRadar::ms_RadarTrace, pRadarBlips, sizeof(sRadarTrace) * NUMRADARBLIPS);
|
memcpy(CRadar::ms_RadarTrace, pRadarBlips, sizeof(sRadarTrace) * NUMRADARBLIPS);
|
||||||
delete[] pRadarBlips;
|
delete[] pRadarBlips;
|
||||||
pRadarBlips = nil;
|
pRadarBlips = nil;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
for (int i = 0; i < NUMPLAYERS; i++) {
|
||||||
|
CPlayerPed* pPlayerPed = (CPlayerPed*)CPools::GetPedPool()->GetAt(nHandleOfPlayerPed[i]);
|
||||||
|
assert(pPlayerPed);
|
||||||
|
CWorld::Players[i].m_pPed = pPlayerPed;
|
||||||
|
pPlayerPed->RegisterReference((CEntity**)&CWorld::Players[i].m_pPed);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
FindPlayerPed()->m_pWanted = new CWanted(PlayerWanted);
|
FindPlayerPed()->m_pWanted = new CWanted(PlayerWanted);
|
||||||
CWorld::Players[0] = PlayerInfo;
|
CWorld::Players[0] = PlayerInfo;
|
||||||
int i = CPools::GetPedPool()->GetSize();
|
int i = CPools::GetPedPool()->GetSize();
|
||||||
|
@ -1393,8 +1408,8 @@ void CReplay::SaveReplayToHD(void)
|
||||||
for (first = (current + 1) % NUM_REPLAYBUFFERS; ; first = (first + 1) % NUM_REPLAYBUFFERS)
|
for (first = (current + 1) % NUM_REPLAYBUFFERS; ; first = (first + 1) % NUM_REPLAYBUFFERS)
|
||||||
if (BufferStatus[first] == REPLAYBUFFER_RECORD || BufferStatus[first] == REPLAYBUFFER_PLAYBACK)
|
if (BufferStatus[first] == REPLAYBUFFER_RECORD || BufferStatus[first] == REPLAYBUFFER_PLAYBACK)
|
||||||
break;
|
break;
|
||||||
for(int i = first;; i = (i + 1) % NUM_REPLAYBUFFERS){
|
for(int i = first; ; i = (i + 1) % NUM_REPLAYBUFFERS){
|
||||||
CFileMgr::Write(fw, (char*)Buffers[first], sizeof(Buffers[first]));
|
CFileMgr::Write(fw, (char*)Buffers[i], sizeof(Buffers[i]));
|
||||||
if (BufferStatus[i] == REPLAYBUFFER_RECORD)
|
if (BufferStatus[i] == REPLAYBUFFER_RECORD)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@ class CReplay
|
||||||
int8 velocityX;
|
int8 velocityX;
|
||||||
int8 velocityY;
|
int8 velocityY;
|
||||||
int8 velocityZ;
|
int8 velocityZ;
|
||||||
union{
|
union {
|
||||||
int8 car_gun;
|
int8 car_gun;
|
||||||
int8 wheel_state;
|
int8 wheel_state;
|
||||||
};
|
};
|
||||||
|
@ -208,25 +208,25 @@ private:
|
||||||
static uint8 Mode;
|
static uint8 Mode;
|
||||||
static CAddressInReplayBuffer Record;
|
static CAddressInReplayBuffer Record;
|
||||||
static CAddressInReplayBuffer Playback;
|
static CAddressInReplayBuffer Playback;
|
||||||
static uint8 *pBuf0;
|
static uint8* pBuf0;
|
||||||
static CAutomobile *pBuf1;
|
static CAutomobile* pBuf1;
|
||||||
static uint8 *pBuf2;
|
static uint8* pBuf2;
|
||||||
static CPlayerPed *pBuf3;
|
static CPlayerPed* pBuf3;
|
||||||
static uint8 *pBuf4;
|
static uint8* pBuf4;
|
||||||
static CCutsceneHead *pBuf5;
|
static CCutsceneHead* pBuf5;
|
||||||
static uint8 *pBuf6;
|
static uint8* pBuf6;
|
||||||
static CPtrNode *pBuf7;
|
static CPtrNode* pBuf7;
|
||||||
static uint8 *pBuf8;
|
static uint8* pBuf8;
|
||||||
static CEntryInfoNode *pBuf9;
|
static CEntryInfoNode* pBuf9;
|
||||||
static uint8 *pBuf10;
|
static uint8* pBuf10;
|
||||||
static CDummyPed *pBuf11;
|
static CDummyPed* pBuf11;
|
||||||
static uint8 *pRadarBlips;
|
static uint8* pRadarBlips;
|
||||||
static uint8 *pStoredCam;
|
static uint8* pStoredCam;
|
||||||
static uint8 *pWorld1;
|
static uint8* pWorld1;
|
||||||
static CReference *pEmptyReferences;
|
static CReference* pEmptyReferences;
|
||||||
static CStoredDetailedAnimationState *pPedAnims;
|
static CStoredDetailedAnimationState* pPedAnims;
|
||||||
static uint8 *pPickups;
|
static uint8* pPickups;
|
||||||
static uint8 *pReferences;
|
static uint8* pReferences;
|
||||||
static uint8 BufferStatus[NUM_REPLAYBUFFERS];
|
static uint8 BufferStatus[NUM_REPLAYBUFFERS];
|
||||||
static uint8 Buffers[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE];
|
static uint8 Buffers[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE];
|
||||||
static bool bPlayingBackFromFile;
|
static bool bPlayingBackFromFile;
|
||||||
|
@ -234,8 +234,8 @@ private:
|
||||||
static uint32 SlowMotion;
|
static uint32 SlowMotion;
|
||||||
static uint32 FramesActiveLookAroundCam;
|
static uint32 FramesActiveLookAroundCam;
|
||||||
static bool bDoLoadSceneWhenDone;
|
static bool bDoLoadSceneWhenDone;
|
||||||
static CPtrList WorldPtrList;
|
static CPtrNode* WorldPtrList;
|
||||||
static CPtrList BigBuildingPtrList;
|
static CPtrNode* BigBuildingPtrList;
|
||||||
static CWanted PlayerWanted;
|
static CWanted PlayerWanted;
|
||||||
static CPlayerInfo PlayerInfo;
|
static CPlayerInfo PlayerInfo;
|
||||||
static uint32 Time1;
|
static uint32 Time1;
|
||||||
|
@ -267,6 +267,9 @@ private:
|
||||||
static float fDistanceLookAroundCam;
|
static float fDistanceLookAroundCam;
|
||||||
static float fAlphaAngleLookAroundCam;
|
static float fAlphaAngleLookAroundCam;
|
||||||
static float fBetaAngleLookAroundCam;
|
static float fBetaAngleLookAroundCam;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
static int nHandleOfPlayerPed[NUMPLAYERS];
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(void);
|
||||||
|
|
|
@ -2490,6 +2490,10 @@ CCamera::TryToStartNewCamMode(int obbeMode)
|
||||||
TakeControl(FindPlayerEntity(), CCam::MODE_CAM_ON_A_STRING, JUMP_CUT, CAMCONTROL_OBBE);
|
TakeControl(FindPlayerEntity(), CCam::MODE_CAM_ON_A_STRING, JUMP_CUT, CAMCONTROL_OBBE);
|
||||||
return true;
|
return true;
|
||||||
case OBBE_COPCAR:
|
case OBBE_COPCAR:
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (CReplay::IsPlayingBack())
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
|
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
|
||||||
return false;
|
return false;
|
||||||
if(FindPlayerVehicle() == nil)
|
if(FindPlayerVehicle() == nil)
|
||||||
|
@ -2514,6 +2518,10 @@ CCamera::TryToStartNewCamMode(int obbeMode)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case OBBE_COPCAR_WHEEL:
|
case OBBE_COPCAR_WHEEL:
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (CReplay::IsPlayingBack())
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
|
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
|
||||||
return false;
|
return false;
|
||||||
if(FindPlayerVehicle() == nil)
|
if(FindPlayerVehicle() == nil)
|
||||||
|
|
|
@ -41,6 +41,10 @@ CPlayerInfo::SetPlayerSkin(char *skin)
|
||||||
CVector&
|
CVector&
|
||||||
CPlayerInfo::GetPos()
|
CPlayerInfo::GetPos()
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (!m_pPed)
|
||||||
|
return TheCamera.GetPosition();
|
||||||
|
#endif
|
||||||
if (m_pPed->InVehicle())
|
if (m_pPed->InVehicle())
|
||||||
return m_pPed->m_pMyVehicle->GetPosition();
|
return m_pPed->m_pMyVehicle->GetPosition();
|
||||||
return m_pPed->GetPosition();
|
return m_pPed->GetPosition();
|
||||||
|
@ -342,6 +346,10 @@ CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1,
|
||||||
void
|
void
|
||||||
CPlayerInfo::Process(void)
|
CPlayerInfo::Process(void)
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (CReplay::IsPlayingBack())
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
// Unused taxi feature. Gives you a dollar for every second with a passenger. Can be toggled via 0x29A opcode.
|
// Unused taxi feature. Gives you a dollar for every second with a passenger. Can be toggled via 0x29A opcode.
|
||||||
bool startTaxiTimer = true;
|
bool startTaxiTimer = true;
|
||||||
if (m_bUnusedTaxiThing && m_pPed->bInVehicle) {
|
if (m_bUnusedTaxiThing && m_pPed->bInVehicle) {
|
||||||
|
|
|
@ -26,8 +26,17 @@ CReferences::RemoveReferencesToPlayer(void)
|
||||||
{
|
{
|
||||||
if(FindPlayerVehicle())
|
if(FindPlayerVehicle())
|
||||||
FindPlayerVehicle()->ResolveReferences();
|
FindPlayerVehicle()->ResolveReferences();
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (FindPlayerPed()) {
|
||||||
|
CPlayerPed* pPlayerPed = FindPlayerPed();
|
||||||
|
FindPlayerPed()->ResolveReferences();
|
||||||
|
CWorld::Players[CWorld::PlayerInFocus].m_pPed = pPlayerPed;
|
||||||
|
pPlayerPed->RegisterReference((CEntity**)&CWorld::Players[CWorld::PlayerInFocus].m_pPed);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if(FindPlayerPed())
|
if(FindPlayerPed())
|
||||||
FindPlayerPed()->ResolveReferences();
|
FindPlayerPed()->ResolveReferences();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
#include "CutsceneMgr.h"
|
#include "CutsceneMgr.h"
|
||||||
#include "CdStream.h"
|
#include "CdStream.h"
|
||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
#include "Replay.h"
|
||||||
|
#endif
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
bool CStreaming::ms_disableStreaming;
|
bool CStreaming::ms_disableStreaming;
|
||||||
|
@ -280,7 +283,11 @@ CStreaming::Update(void)
|
||||||
!requestedSubway &&
|
!requestedSubway &&
|
||||||
!CGame::playingIntro &&
|
!CGame::playingIntro &&
|
||||||
ms_numModelsRequested < 5 &&
|
ms_numModelsRequested < 5 &&
|
||||||
!CRenderer::m_loadingPriority){
|
!CRenderer::m_loadingPriority
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
&& !CReplay::IsPlayingBack()
|
||||||
|
#endif
|
||||||
|
){
|
||||||
StreamVehiclesAndPeds();
|
StreamVehiclesAndPeds();
|
||||||
StreamZoneModels(FindPlayerCoors());
|
StreamZoneModels(FindPlayerCoors());
|
||||||
}
|
}
|
||||||
|
@ -1248,7 +1255,11 @@ CStreaming::StreamVehiclesAndPeds(void)
|
||||||
static int modelQualityClass = 0;
|
static int modelQualityClass = 0;
|
||||||
|
|
||||||
if(CRecordDataForGame::IsRecording() ||
|
if(CRecordDataForGame::IsRecording() ||
|
||||||
CRecordDataForGame::IsPlayingBack())
|
CRecordDataForGame::IsPlayingBack()
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
|| CReplay::IsPlayingBack()
|
||||||
|
#endif
|
||||||
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(FindPlayerPed()->m_pWanted->AreSwatRequired()){
|
if(FindPlayerPed()->m_pWanted->AreSwatRequired()){
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "Hud.h"
|
#include "Hud.h"
|
||||||
#include "PlayerPed.h"
|
#include "PlayerPed.h"
|
||||||
|
#include "Replay.h"
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
|
@ -115,6 +116,10 @@ CUserDisplay::Init()
|
||||||
void
|
void
|
||||||
CUserDisplay::Process()
|
CUserDisplay::Process()
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (CReplay::IsPlayingBack())
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
PlaceName.Process();
|
PlaceName.Process();
|
||||||
OnscnTimer.Process();
|
OnscnTimer.Process();
|
||||||
Pager.Process();
|
Pager.Process();
|
||||||
|
|
|
@ -1386,6 +1386,10 @@ FindPlayerEntity(void)
|
||||||
CVector
|
CVector
|
||||||
FindPlayerCoors(void)
|
FindPlayerCoors(void)
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (CReplay::IsPlayingBack())
|
||||||
|
return TheCamera.GetPosition();
|
||||||
|
#endif
|
||||||
CPlayerPed *ped = FindPlayerPed();
|
CPlayerPed *ped = FindPlayerPed();
|
||||||
if(ped->InVehicle())
|
if(ped->InVehicle())
|
||||||
return ped->m_pMyVehicle->GetPosition();
|
return ped->m_pMyVehicle->GetPosition();
|
||||||
|
@ -1396,6 +1400,11 @@ FindPlayerCoors(void)
|
||||||
CVector &
|
CVector &
|
||||||
FindPlayerSpeed(void)
|
FindPlayerSpeed(void)
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
static CVector vecTmpVector(0.0f, 0.0f, 0.0f);
|
||||||
|
if (CReplay::IsPlayingBack())
|
||||||
|
return vecTmpVector;
|
||||||
|
#endif
|
||||||
CPlayerPed *ped = FindPlayerPed();
|
CPlayerPed *ped = FindPlayerPed();
|
||||||
if(ped->InVehicle())
|
if(ped->InVehicle())
|
||||||
return ped->m_pMyVehicle->m_vecMoveSpeed;
|
return ped->m_pMyVehicle->m_vecMoveSpeed;
|
||||||
|
@ -1406,6 +1415,9 @@ FindPlayerSpeed(void)
|
||||||
CVector &
|
CVector &
|
||||||
FindPlayerCentreOfWorld(int32 player)
|
FindPlayerCentreOfWorld(int32 player)
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if(CReplay::IsPlayingBack()) return TheCamera.GetPosition();
|
||||||
|
#endif
|
||||||
if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
|
if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
|
||||||
if(CWorld::Players[player].m_pRemoteVehicle) return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
|
if(CWorld::Players[player].m_pRemoteVehicle) return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
|
||||||
if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
|
if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
|
||||||
|
@ -1415,6 +1427,9 @@ FindPlayerCentreOfWorld(int32 player)
|
||||||
CVector &
|
CVector &
|
||||||
FindPlayerCentreOfWorld_NoSniperShift(void)
|
FindPlayerCentreOfWorld_NoSniperShift(void)
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (CReplay::IsPlayingBack()) return TheCamera.GetPosition();
|
||||||
|
#endif
|
||||||
if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
|
if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
|
||||||
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
|
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
|
||||||
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();
|
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();
|
||||||
|
|
|
@ -135,6 +135,9 @@ CPlayerPed::SetupPlayerPed(int32 index)
|
||||||
{
|
{
|
||||||
CPlayerPed *player = new CPlayerPed();
|
CPlayerPed *player = new CPlayerPed();
|
||||||
CWorld::Players[index].m_pPed = player;
|
CWorld::Players[index].m_pPed = player;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
player->RegisterReference((CEntity**)&CWorld::Players[index].m_pPed);
|
||||||
|
#endif
|
||||||
|
|
||||||
player->SetOrientation(0.0f, 0.0f, 0.0f);
|
player->SetOrientation(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
#include "Weather.h"
|
#include "Weather.h"
|
||||||
#include "ModelIndices.h"
|
#include "ModelIndices.h"
|
||||||
#include "RenderBuffer.h"
|
#include "RenderBuffer.h"
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
#include "Replay.h"
|
||||||
|
#endif
|
||||||
#include "PointLights.h"
|
#include "PointLights.h"
|
||||||
#include "SpecialFX.h"
|
#include "SpecialFX.h"
|
||||||
#include "Shadows.h"
|
#include "Shadows.h"
|
||||||
|
@ -1609,6 +1612,10 @@ CShadows::CalcPedShadowValues(CVector vecLightDir,
|
||||||
void
|
void
|
||||||
CShadows::RenderExtraPlayerShadows(void)
|
CShadows::RenderExtraPlayerShadows(void)
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (CReplay::IsPlayingBack())
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
if ( CTimeCycle::GetLightShadowStrength() != 0 )
|
if ( CTimeCycle::GetLightShadowStrength() != 0 )
|
||||||
{
|
{
|
||||||
CVehicle *pCar = FindPlayerVehicle();
|
CVehicle *pCar = FindPlayerVehicle();
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "HandlingMgr.h"
|
#include "HandlingMgr.h"
|
||||||
#include "Heli.h"
|
#include "Heli.h"
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
#include "Replay.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -428,89 +431,95 @@ CHeli::ProcessControl(void)
|
||||||
// Search light and shooting
|
// Search light and shooting
|
||||||
if(m_heliStatus == HELI_STATUS_FLY_AWAY || m_heliType == HELI_TYPE_CATALINA || CCullZones::PlayerNoRain())
|
if(m_heliStatus == HELI_STATUS_FLY_AWAY || m_heliType == HELI_TYPE_CATALINA || CCullZones::PlayerNoRain())
|
||||||
m_fSearchLightIntensity = 0.0f;
|
m_fSearchLightIntensity = 0.0f;
|
||||||
else{
|
else {
|
||||||
// Update search light history once every 1000ms
|
// Update search light history once every 1000ms
|
||||||
int timeDiff = CTimer::GetTimeInMilliseconds() - m_nSearchLightTimer;
|
int timeDiff = CTimer::GetTimeInMilliseconds() - m_nSearchLightTimer;
|
||||||
while(timeDiff > 1000){
|
while (timeDiff > 1000) {
|
||||||
for(i = 5; i > 0; i--){
|
for (i = 5; i > 0; i--) {
|
||||||
m_aSearchLightHistoryX[i] = m_aSearchLightHistoryX[i-1];
|
m_aSearchLightHistoryX[i] = m_aSearchLightHistoryX[i - 1];
|
||||||
m_aSearchLightHistoryY[i] = m_aSearchLightHistoryY[i-1];
|
m_aSearchLightHistoryY[i] = m_aSearchLightHistoryY[i - 1];
|
||||||
}
|
}
|
||||||
m_aSearchLightHistoryX[0] = FindPlayerCoors().x + FindPlayerSpeed().x*50.0f*(m_nHeliId+2);
|
m_aSearchLightHistoryX[0] = FindPlayerCoors().x + FindPlayerSpeed().x * 50.0f * (m_nHeliId + 2);
|
||||||
m_aSearchLightHistoryY[0] = FindPlayerCoors().y + FindPlayerSpeed().y*50.0f*(m_nHeliId+2);
|
m_aSearchLightHistoryY[0] = FindPlayerCoors().y + FindPlayerSpeed().y * 50.0f * (m_nHeliId + 2);
|
||||||
|
|
||||||
timeDiff -= 1000;
|
timeDiff -= 1000;
|
||||||
m_nSearchLightTimer += 1000;
|
m_nSearchLightTimer += 1000;
|
||||||
}
|
}
|
||||||
assert(timeDiff <= 1000);
|
assert(timeDiff <= 1000);
|
||||||
float f1 = timeDiff/1000.0f;
|
float f1 = timeDiff / 1000.0f;
|
||||||
float f2 = 1.0f - f1;
|
float f2 = 1.0f - f1;
|
||||||
m_fSearchLightX = m_aSearchLightHistoryX[m_nHeliId+2]*f2 + m_aSearchLightHistoryX[m_nHeliId+2-1]*f1;
|
m_fSearchLightX = m_aSearchLightHistoryX[m_nHeliId + 2] * f2 + m_aSearchLightHistoryX[m_nHeliId + 2 - 1] * f1;
|
||||||
m_fSearchLightY = m_aSearchLightHistoryY[m_nHeliId+2]*f2 + m_aSearchLightHistoryY[m_nHeliId+2-1]*f1;
|
m_fSearchLightY = m_aSearchLightHistoryY[m_nHeliId + 2] * f2 + m_aSearchLightHistoryY[m_nHeliId + 2 - 1] * f1;
|
||||||
|
|
||||||
float searchLightDist = (CVector2D(m_fSearchLightX, m_fSearchLightY) - GetPosition()).Magnitude();
|
float searchLightDist = (CVector2D(m_fSearchLightX, m_fSearchLightY) - GetPosition()).Magnitude();
|
||||||
if(searchLightDist > 60.0f)
|
if (searchLightDist > 60.0f)
|
||||||
m_fSearchLightIntensity = 0.0f;
|
m_fSearchLightIntensity = 0.0f;
|
||||||
else if(searchLightDist < 40.0f)
|
else if (searchLightDist < 40.0f)
|
||||||
m_fSearchLightIntensity = 1.0f;
|
m_fSearchLightIntensity = 1.0f;
|
||||||
else
|
else
|
||||||
m_fSearchLightIntensity = 1.0f - (40.0f-searchLightDist)/40.0f;
|
m_fSearchLightIntensity = 1.0f - (40.0f - searchLightDist) / 40.0f;
|
||||||
|
|
||||||
if(m_fSearchLightIntensity < 0.9f || sq(FindPlayerCoors().x-m_fSearchLightX) + sq(FindPlayerCoors().y-m_fSearchLightY) > sq(7.0f))
|
if (m_fSearchLightIntensity < 0.9f || sq(FindPlayerCoors().x - m_fSearchLightX) + sq(FindPlayerCoors().y - m_fSearchLightY) > sq(7.0f))
|
||||||
m_nShootTimer = CTimer::GetTimeInMilliseconds();
|
m_nShootTimer = CTimer::GetTimeInMilliseconds();
|
||||||
else if(CTimer::GetTimeInMilliseconds() > m_nPoliceShoutTimer){
|
else if (CTimer::GetTimeInMilliseconds() > m_nPoliceShoutTimer) {
|
||||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_PED_HELI_PLAYER_FOUND, 0.0f);
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_PED_HELI_PLAYER_FOUND, 0.0f);
|
||||||
m_nPoliceShoutTimer = CTimer::GetTimeInMilliseconds() + 4500 + (CGeneral::GetRandomNumber()&0xFFF);
|
m_nPoliceShoutTimer = CTimer::GetTimeInMilliseconds() + 4500 + (CGeneral::GetRandomNumber() & 0xFFF);
|
||||||
}
|
}
|
||||||
|
#ifdef FIX_BUGS
|
||||||
// Shoot
|
if (!CReplay::IsPlayingBack())
|
||||||
int shootTimeout;
|
#endif
|
||||||
if(m_heliType == HELI_TYPE_RANDOM){
|
{
|
||||||
switch(FindPlayerPed()->m_pWanted->m_nWantedLevel){
|
// Shoot
|
||||||
case 0:
|
int shootTimeout;
|
||||||
case 1:
|
if (m_heliType == HELI_TYPE_RANDOM) {
|
||||||
case 2: shootTimeout = 999999; break;
|
switch (FindPlayerPed()->m_pWanted->m_nWantedLevel) {
|
||||||
case 3: shootTimeout = 10000; break;
|
case 0:
|
||||||
case 4: shootTimeout = 5000; break;
|
case 1:
|
||||||
case 5: shootTimeout = 3500; break;
|
case 2: shootTimeout = 999999; break;
|
||||||
case 6: shootTimeout = 2000; break;
|
case 3: shootTimeout = 10000; break;
|
||||||
}
|
case 4: shootTimeout = 5000; break;
|
||||||
if(CCullZones::NoPolice())
|
case 5: shootTimeout = 3500; break;
|
||||||
shootTimeout /= 2;
|
case 6: shootTimeout = 2000; break;
|
||||||
}else
|
|
||||||
shootTimeout = 1500;
|
|
||||||
|
|
||||||
if(FindPlayerPed()->m_pWanted->IsIgnored())
|
|
||||||
m_nShootTimer = CTimer::GetTimeInMilliseconds();
|
|
||||||
else{
|
|
||||||
// Check if line of sight is clear
|
|
||||||
if(CTimer::GetTimeInMilliseconds() > m_nShootTimer + shootTimeout &&
|
|
||||||
CTimer::GetPreviousTimeInMilliseconds() <= m_nShootTimer + shootTimeout){
|
|
||||||
if(CWorld::GetIsLineOfSightClear(GetPosition(), FindPlayerCoors(), true, false, false, false, false, false)){
|
|
||||||
if(m_heliStatus == HELI_STATUS_HOVER2)
|
|
||||||
m_heliStatus = HELI_STATUS_HOVER;
|
|
||||||
}else{
|
|
||||||
m_nShootTimer = CTimer::GetTimeInMilliseconds();
|
|
||||||
if(m_heliStatus == HELI_STATUS_HOVER)
|
|
||||||
m_heliStatus = HELI_STATUS_HOVER2;
|
|
||||||
}
|
}
|
||||||
|
if (CCullZones::NoPolice())
|
||||||
|
shootTimeout /= 2;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
shootTimeout = 1500;
|
||||||
|
|
||||||
// Shoot!
|
if (FindPlayerPed()->m_pWanted->IsIgnored())
|
||||||
if(CTimer::GetTimeInMilliseconds() > m_nShootTimer + shootTimeout &&
|
m_nShootTimer = CTimer::GetTimeInMilliseconds();
|
||||||
CTimer::GetTimeInMilliseconds() > m_nLastShotTime + 200){
|
else {
|
||||||
CVector shotTarget = FindPlayerCoors();
|
// Check if line of sight is clear
|
||||||
// some inaccuracy
|
if (CTimer::GetTimeInMilliseconds() > m_nShootTimer + shootTimeout &&
|
||||||
shotTarget.x += ((CGeneral::GetRandomNumber()&0xFF)-128)/50.0f;
|
CTimer::GetPreviousTimeInMilliseconds() <= m_nShootTimer + shootTimeout) {
|
||||||
shotTarget.y += ((CGeneral::GetRandomNumber()&0xFF)-128)/50.0f;
|
if (CWorld::GetIsLineOfSightClear(GetPosition(), FindPlayerCoors(), true, false, false, false, false, false)) {
|
||||||
CVector direction = FindPlayerCoors() - GetPosition();
|
if (m_heliStatus == HELI_STATUS_HOVER2)
|
||||||
direction.Normalise();
|
m_heliStatus = HELI_STATUS_HOVER;
|
||||||
shotTarget += 3.0f*direction;
|
}
|
||||||
CVector shotSource = GetPosition();
|
else {
|
||||||
shotSource += 3.0f*direction;
|
m_nShootTimer = CTimer::GetTimeInMilliseconds();
|
||||||
FireOneInstantHitRound(&shotSource, &shotTarget, 20);
|
if (m_heliStatus == HELI_STATUS_HOVER)
|
||||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f);
|
m_heliStatus = HELI_STATUS_HOVER2;
|
||||||
m_nLastShotTime = CTimer::GetTimeInMilliseconds();
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shoot!
|
||||||
|
if (CTimer::GetTimeInMilliseconds() > m_nShootTimer + shootTimeout &&
|
||||||
|
CTimer::GetTimeInMilliseconds() > m_nLastShotTime + 200) {
|
||||||
|
CVector shotTarget = FindPlayerCoors();
|
||||||
|
// some inaccuracy
|
||||||
|
shotTarget.x += ((CGeneral::GetRandomNumber() & 0xFF) - 128) / 50.0f;
|
||||||
|
shotTarget.y += ((CGeneral::GetRandomNumber() & 0xFF) - 128) / 50.0f;
|
||||||
|
CVector direction = FindPlayerCoors() - GetPosition();
|
||||||
|
direction.Normalise();
|
||||||
|
shotTarget += 3.0f * direction;
|
||||||
|
CVector shotSource = GetPosition();
|
||||||
|
shotSource += 3.0f * direction;
|
||||||
|
FireOneInstantHitRound(&shotSource, &shotTarget, 20);
|
||||||
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f);
|
||||||
|
m_nLastShotTime = CTimer::GetTimeInMilliseconds();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -825,7 +834,11 @@ CHeli::UpdateHelis(void)
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
// Spawn new police helis
|
// Spawn new police helis
|
||||||
int numHelisRequired = FindPlayerPed()->m_pWanted->NumOfHelisRequired();
|
int numHelisRequired =
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
CReplay::IsPlayingBack() ? 0 :
|
||||||
|
#endif
|
||||||
|
FindPlayerPed()->m_pWanted->NumOfHelisRequired();
|
||||||
if(CStreaming::HasModelLoaded(MI_CHOPPER) && CTimer::GetTimeInMilliseconds() > TestForNewRandomHelisTimer){
|
if(CStreaming::HasModelLoaded(MI_CHOPPER) && CTimer::GetTimeInMilliseconds() > TestForNewRandomHelisTimer){
|
||||||
// Spawn a police heli
|
// Spawn a police heli
|
||||||
TestForNewRandomHelisTimer = CTimer::GetTimeInMilliseconds() + 15000;
|
TestForNewRandomHelisTimer = CTimer::GetTimeInMilliseconds() + 15000;
|
||||||
|
|
Loading…
Reference in a new issue