1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-22 17:35:29 +00:00

replays bug fix

This commit is contained in:
Nikolay Korolev 2020-04-18 23:50:37 +03:00
parent 522d14814f
commit c4cd45d47c
12 changed files with 198 additions and 96 deletions

View file

@ -12,6 +12,9 @@
#include "AudioScriptObject.h"
#include "RpAnimBlend.h"
#include "AnimBlendAssociation.h"
#ifdef FIX_BUGS
#include "Replay.h"
#endif
CPhoneInfo gPhoneInfo;
@ -45,6 +48,10 @@ isPhoneAvailable(int m_phoneId)
void
CPhoneInfo::Update(void)
{
#ifdef FIX_BUGS
if (CReplay::IsPlayingBack())
return;
#endif
CPlayerPed *player = FindPlayerPed();
CPlayerInfo *playerInfo = &CWorld::Players[CWorld::PlayerInFocus];
if (bDisplayingPhoneMessage && CTimer::GetTimeInMilliseconds() > PhoneEnableControlsTimer) {

View file

@ -68,8 +68,8 @@ bool CReplay::bReplayEnabled = true;
uint32 CReplay::SlowMotion;
uint32 CReplay::FramesActiveLookAroundCam;
bool CReplay::bDoLoadSceneWhenDone;
CPtrList CReplay::WorldPtrList;
CPtrList CReplay::BigBuildingPtrList;
CPtrNode* CReplay::WorldPtrList;
CPtrNode* CReplay::BigBuildingPtrList;
CWanted CReplay::PlayerWanted;
CPlayerInfo CReplay::PlayerInfo;
uint32 CReplay::Time1;
@ -101,6 +101,9 @@ bool CReplay::bPlayerInRCBuggy;
float CReplay::fDistanceLookAroundCam;
float CReplay::fBetaAngleLookAroundCam;
float CReplay::fAlphaAngleLookAroundCam;
#ifdef FIX_BUGS
int CReplay::nHandleOfPlayerPed[NUMPLAYERS];
#endif
static void(*CBArray[])(CAnimBlendAssociation*, void*) =
{
@ -275,7 +278,7 @@ void CReplay::RecordThisFrame(void)
continue;
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) {
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
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)
{
#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::GetPedPool()->Store(pBuf2, pBuf3);
CPools::GetObjectPool()->Store(pBuf4, pBuf5);
@ -1116,8 +1123,8 @@ void CReplay::StoreStuffInMem(void)
CPools::GetDummyPool()->Store(pBuf10, pBuf11);
pWorld1 = new uint8[sizeof(CSector) * NUMSECTORS_X * NUMSECTORS_Y];
memcpy(pWorld1, CWorld::GetSector(0, 0), NUMSECTORS_X * NUMSECTORS_Y * sizeof(CSector));
WorldPtrList = CWorld::GetMovingEntityList();
BigBuildingPtrList = CWorld::GetBigBuildingList(LEVEL_NONE);
WorldPtrList = CWorld::GetMovingEntityList().first; // why
BigBuildingPtrList = CWorld::GetBigBuildingList(LEVEL_NONE).first;
pPickups = new uint8[sizeof(CPickup) * NUMPICKUPS];
memcpy(pPickups, CPickups::aPickUps, NUMPICKUPS * sizeof(CPickup));
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);
delete[] pWorld1;
pWorld1 = nil;
CWorld::GetMovingEntityList() = WorldPtrList;
CWorld::GetBigBuildingList(LEVEL_NONE) = BigBuildingPtrList;
CWorld::GetMovingEntityList().first = WorldPtrList;
CWorld::GetBigBuildingList(LEVEL_NONE).first = BigBuildingPtrList;
memcpy(CPickups::aPickUps, pPickups, sizeof(CPickup) * NUMPICKUPS);
delete[] pPickups;
pPickups = nil;
@ -1178,6 +1185,14 @@ void CReplay::RestoreStuffFromMem(void)
memcpy(CRadar::ms_RadarTrace, pRadarBlips, sizeof(sRadarTrace) * NUMRADARBLIPS);
delete[] pRadarBlips;
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);
CWorld::Players[0] = PlayerInfo;
int i = CPools::GetPedPool()->GetSize();
@ -1393,8 +1408,8 @@ void CReplay::SaveReplayToHD(void)
for (first = (current + 1) % NUM_REPLAYBUFFERS; ; first = (first + 1) % NUM_REPLAYBUFFERS)
if (BufferStatus[first] == REPLAYBUFFER_RECORD || BufferStatus[first] == REPLAYBUFFER_PLAYBACK)
break;
for(int i = first;; i = (i + 1) % NUM_REPLAYBUFFERS){
CFileMgr::Write(fw, (char*)Buffers[first], sizeof(Buffers[first]));
for(int i = first; ; i = (i + 1) % NUM_REPLAYBUFFERS){
CFileMgr::Write(fw, (char*)Buffers[i], sizeof(Buffers[i]));
if (BufferStatus[i] == REPLAYBUFFER_RECORD)
break;
}

View file

@ -192,7 +192,7 @@ class CReplay
int8 velocityX;
int8 velocityY;
int8 velocityZ;
union{
union {
int8 car_gun;
int8 wheel_state;
};
@ -208,25 +208,25 @@ private:
static uint8 Mode;
static CAddressInReplayBuffer Record;
static CAddressInReplayBuffer Playback;
static uint8 *pBuf0;
static CAutomobile *pBuf1;
static uint8 *pBuf2;
static CPlayerPed *pBuf3;
static uint8 *pBuf4;
static CCutsceneHead *pBuf5;
static uint8 *pBuf6;
static CPtrNode *pBuf7;
static uint8 *pBuf8;
static CEntryInfoNode *pBuf9;
static uint8 *pBuf10;
static CDummyPed *pBuf11;
static uint8 *pRadarBlips;
static uint8 *pStoredCam;
static uint8 *pWorld1;
static CReference *pEmptyReferences;
static CStoredDetailedAnimationState *pPedAnims;
static uint8 *pPickups;
static uint8 *pReferences;
static uint8* pBuf0;
static CAutomobile* pBuf1;
static uint8* pBuf2;
static CPlayerPed* pBuf3;
static uint8* pBuf4;
static CCutsceneHead* pBuf5;
static uint8* pBuf6;
static CPtrNode* pBuf7;
static uint8* pBuf8;
static CEntryInfoNode* pBuf9;
static uint8* pBuf10;
static CDummyPed* pBuf11;
static uint8* pRadarBlips;
static uint8* pStoredCam;
static uint8* pWorld1;
static CReference* pEmptyReferences;
static CStoredDetailedAnimationState* pPedAnims;
static uint8* pPickups;
static uint8* pReferences;
static uint8 BufferStatus[NUM_REPLAYBUFFERS];
static uint8 Buffers[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE];
static bool bPlayingBackFromFile;
@ -234,8 +234,8 @@ private:
static uint32 SlowMotion;
static uint32 FramesActiveLookAroundCam;
static bool bDoLoadSceneWhenDone;
static CPtrList WorldPtrList;
static CPtrList BigBuildingPtrList;
static CPtrNode* WorldPtrList;
static CPtrNode* BigBuildingPtrList;
static CWanted PlayerWanted;
static CPlayerInfo PlayerInfo;
static uint32 Time1;
@ -267,6 +267,9 @@ private:
static float fDistanceLookAroundCam;
static float fAlphaAngleLookAroundCam;
static float fBetaAngleLookAroundCam;
#ifdef FIX_BUGS
static int nHandleOfPlayerPed[NUMPLAYERS];
#endif
public:
static void Init(void);

View file

@ -2490,6 +2490,10 @@ CCamera::TryToStartNewCamMode(int obbeMode)
TakeControl(FindPlayerEntity(), CCam::MODE_CAM_ON_A_STRING, JUMP_CUT, CAMCONTROL_OBBE);
return true;
case OBBE_COPCAR:
#ifdef FIX_BUGS
if (CReplay::IsPlayingBack())
return false;
#endif
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
return false;
if(FindPlayerVehicle() == nil)
@ -2514,6 +2518,10 @@ CCamera::TryToStartNewCamMode(int obbeMode)
}
return false;
case OBBE_COPCAR_WHEEL:
#ifdef FIX_BUGS
if (CReplay::IsPlayingBack())
return false;
#endif
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
return false;
if(FindPlayerVehicle() == nil)

View file

@ -41,6 +41,10 @@ CPlayerInfo::SetPlayerSkin(char *skin)
CVector&
CPlayerInfo::GetPos()
{
#ifdef FIX_BUGS
if (!m_pPed)
return TheCamera.GetPosition();
#endif
if (m_pPed->InVehicle())
return m_pPed->m_pMyVehicle->GetPosition();
return m_pPed->GetPosition();
@ -342,6 +346,10 @@ CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1,
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.
bool startTaxiTimer = true;
if (m_bUnusedTaxiThing && m_pPed->bInVehicle) {

View file

@ -26,8 +26,17 @@ CReferences::RemoveReferencesToPlayer(void)
{
if(FindPlayerVehicle())
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())
FindPlayerPed()->ResolveReferences();
#endif
}
void

View file

@ -28,6 +28,9 @@
#include "CutsceneMgr.h"
#include "CdStream.h"
#include "Streaming.h"
#ifdef FIX_BUGS
#include "Replay.h"
#endif
#include "main.h"
bool CStreaming::ms_disableStreaming;
@ -280,7 +283,11 @@ CStreaming::Update(void)
!requestedSubway &&
!CGame::playingIntro &&
ms_numModelsRequested < 5 &&
!CRenderer::m_loadingPriority){
!CRenderer::m_loadingPriority
#ifdef FIX_BUGS
&& !CReplay::IsPlayingBack()
#endif
){
StreamVehiclesAndPeds();
StreamZoneModels(FindPlayerCoors());
}
@ -1248,7 +1255,11 @@ CStreaming::StreamVehiclesAndPeds(void)
static int modelQualityClass = 0;
if(CRecordDataForGame::IsRecording() ||
CRecordDataForGame::IsPlayingBack())
CRecordDataForGame::IsPlayingBack()
#ifdef FIX_BUGS
|| CReplay::IsPlayingBack()
#endif
)
return;
if(FindPlayerPed()->m_pWanted->AreSwatRequired()){

View file

@ -3,6 +3,7 @@
#include "Hud.h"
#include "PlayerPed.h"
#include "Replay.h"
#include "Text.h"
#include "User.h"
#include "Vehicle.h"
@ -115,6 +116,10 @@ CUserDisplay::Init()
void
CUserDisplay::Process()
{
#ifdef FIX_BUGS
if (CReplay::IsPlayingBack())
return;
#endif
PlaceName.Process();
OnscnTimer.Process();
Pager.Process();

View file

@ -1386,6 +1386,10 @@ FindPlayerEntity(void)
CVector
FindPlayerCoors(void)
{
#ifdef FIX_BUGS
if (CReplay::IsPlayingBack())
return TheCamera.GetPosition();
#endif
CPlayerPed *ped = FindPlayerPed();
if(ped->InVehicle())
return ped->m_pMyVehicle->GetPosition();
@ -1396,6 +1400,11 @@ FindPlayerCoors(void)
CVector &
FindPlayerSpeed(void)
{
#ifdef FIX_BUGS
static CVector vecTmpVector(0.0f, 0.0f, 0.0f);
if (CReplay::IsPlayingBack())
return vecTmpVector;
#endif
CPlayerPed *ped = FindPlayerPed();
if(ped->InVehicle())
return ped->m_pMyVehicle->m_vecMoveSpeed;
@ -1406,6 +1415,9 @@ FindPlayerSpeed(void)
CVector &
FindPlayerCentreOfWorld(int32 player)
{
#ifdef FIX_BUGS
if(CReplay::IsPlayingBack()) return TheCamera.GetPosition();
#endif
if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
if(CWorld::Players[player].m_pRemoteVehicle) return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
@ -1415,6 +1427,9 @@ FindPlayerCentreOfWorld(int32 player)
CVector &
FindPlayerCentreOfWorld_NoSniperShift(void)
{
#ifdef FIX_BUGS
if (CReplay::IsPlayingBack()) return TheCamera.GetPosition();
#endif
if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();

View file

@ -135,6 +135,7 @@ CPlayerPed::SetupPlayerPed(int32 index)
{
CPlayerPed *player = new CPlayerPed();
CWorld::Players[index].m_pPed = player;
player->RegisterReference((CEntity**)&CWorld::Players[index].m_pPed);
player->SetOrientation(0.0f, 0.0f, 0.0f);

View file

@ -13,6 +13,9 @@
#include "Weather.h"
#include "ModelIndices.h"
#include "RenderBuffer.h"
#ifdef FIX_BUGS
#include "Replay.h"
#endif
#include "PointLights.h"
#include "SpecialFX.h"
#include "Shadows.h"
@ -1609,6 +1612,10 @@ CShadows::CalcPedShadowValues(CVector vecLightDir,
void
CShadows::RenderExtraPlayerShadows(void)
{
#ifdef FIX_BUGS
if (CReplay::IsPlayingBack())
return;
#endif
if ( CTimeCycle::GetLightShadowStrength() != 0 )
{
CVehicle *pCar = FindPlayerVehicle();

View file

@ -24,6 +24,9 @@
#include "Object.h"
#include "HandlingMgr.h"
#include "Heli.h"
#ifdef FIX_BUGS
#include "Replay.h"
#endif
enum
{
@ -428,89 +431,95 @@ CHeli::ProcessControl(void)
// Search light and shooting
if(m_heliStatus == HELI_STATUS_FLY_AWAY || m_heliType == HELI_TYPE_CATALINA || CCullZones::PlayerNoRain())
m_fSearchLightIntensity = 0.0f;
else{
else {
// Update search light history once every 1000ms
int timeDiff = CTimer::GetTimeInMilliseconds() - m_nSearchLightTimer;
while(timeDiff > 1000){
for(i = 5; i > 0; i--){
m_aSearchLightHistoryX[i] = m_aSearchLightHistoryX[i-1];
m_aSearchLightHistoryY[i] = m_aSearchLightHistoryY[i-1];
while (timeDiff > 1000) {
for (i = 5; i > 0; i--) {
m_aSearchLightHistoryX[i] = m_aSearchLightHistoryX[i - 1];
m_aSearchLightHistoryY[i] = m_aSearchLightHistoryY[i - 1];
}
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_aSearchLightHistoryX[0] = FindPlayerCoors().x + FindPlayerSpeed().x * 50.0f * (m_nHeliId + 2);
m_aSearchLightHistoryY[0] = FindPlayerCoors().y + FindPlayerSpeed().y * 50.0f * (m_nHeliId + 2);
timeDiff -= 1000;
m_nSearchLightTimer += 1000;
}
assert(timeDiff <= 1000);
float f1 = timeDiff/1000.0f;
float f1 = timeDiff / 1000.0f;
float f2 = 1.0f - 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_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;
float searchLightDist = (CVector2D(m_fSearchLightX, m_fSearchLightY) - GetPosition()).Magnitude();
if(searchLightDist > 60.0f)
if (searchLightDist > 60.0f)
m_fSearchLightIntensity = 0.0f;
else if(searchLightDist < 40.0f)
else if (searchLightDist < 40.0f)
m_fSearchLightIntensity = 1.0f;
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();
else if(CTimer::GetTimeInMilliseconds() > m_nPoliceShoutTimer){
else if (CTimer::GetTimeInMilliseconds() > m_nPoliceShoutTimer) {
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);
}
// Shoot
int shootTimeout;
if(m_heliType == HELI_TYPE_RANDOM){
switch(FindPlayerPed()->m_pWanted->m_nWantedLevel){
case 0:
case 1:
case 2: shootTimeout = 999999; break;
case 3: shootTimeout = 10000; break;
case 4: shootTimeout = 5000; break;
case 5: shootTimeout = 3500; break;
case 6: shootTimeout = 2000; break;
}
if(CCullZones::NoPolice())
shootTimeout /= 2;
}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;
#ifdef FIX_BUGS
if (!CReplay::IsPlayingBack())
#endif
{
// Shoot
int shootTimeout;
if (m_heliType == HELI_TYPE_RANDOM) {
switch (FindPlayerPed()->m_pWanted->m_nWantedLevel) {
case 0:
case 1:
case 2: shootTimeout = 999999; break;
case 3: shootTimeout = 10000; break;
case 4: shootTimeout = 5000; break;
case 5: shootTimeout = 3500; break;
case 6: shootTimeout = 2000; break;
}
if (CCullZones::NoPolice())
shootTimeout /= 2;
}
else
shootTimeout = 1500;
// 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();
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;
}
}
// 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;
// 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){
// Spawn a police heli
TestForNewRandomHelisTimer = CTimer::GetTimeInMilliseconds() + 15000;