Squeeze performance option, minor fixes
Fixes are already in miami
This commit is contained in:
parent
a786dd45a4
commit
e14252914e
@ -105,6 +105,10 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
|
||||
void
|
||||
CRoadBlocks::GenerateRoadBlocks(void)
|
||||
{
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (FindPlayerPed()->m_pWanted->m_RoadblockDensity == 0)
|
||||
return;
|
||||
#endif
|
||||
CMatrix offsetMatrix;
|
||||
uint32 frame = CTimer::GetFrameCounter() & 0xF;
|
||||
int16 nRoadblockNode = (int16)(NUMROADBLOCKS * frame) / 16;
|
||||
|
@ -53,6 +53,10 @@ CAccidentManager::ReportAccident(CPed *ped)
|
||||
void
|
||||
CAccidentManager::Update()
|
||||
{
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
// Handled after injury registered.
|
||||
return;
|
||||
#endif
|
||||
int32 e;
|
||||
if (CEventList::GetEvent(EVENT_INJURED_PED, &e)) {
|
||||
CPed *ped = CPools::GetPed(gaEvent[e].entityRef);
|
||||
|
@ -1,5 +1,4 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "config.h"
|
||||
|
||||
class CPed;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "Game.h" // for eLevelName
|
||||
|
||||
// If you spawn many tanks at once, you will see that collisions of two entity exceeds 32.
|
||||
#ifdef FIX_BUGS
|
||||
#if defined(FIX_BUGS) && !defined(SQUEEZE_PERFORMANCE)
|
||||
#define MAX_COLLISION_POINTS 64
|
||||
#else
|
||||
#define MAX_COLLISION_POINTS 32
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "Messages.h"
|
||||
#include "Text.h"
|
||||
#include "main.h"
|
||||
#include "Accident.h"
|
||||
|
||||
int32 CEventList::ms_nFirstFreeSlotIndex;
|
||||
CEvent gaEvent[NUMEVENTS];
|
||||
@ -63,6 +64,13 @@ CEventList::RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent
|
||||
int ref;
|
||||
bool copsDontCare;
|
||||
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (type == EVENT_INJURED_PED) {
|
||||
gAccidentManager.ReportAccident((CPed*)ent);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
copsDontCare = false;
|
||||
switch(entityType){
|
||||
case EVENT_ENTITY_PED:
|
||||
|
@ -106,6 +106,7 @@ int gameTxdSlot;
|
||||
|
||||
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
||||
void DoRWStuffEndOfFrame(void);
|
||||
#ifdef PS2_MENU
|
||||
void MessageScreen(char *msg)
|
||||
{
|
||||
//TODO: stretch_screen
|
||||
@ -139,6 +140,7 @@ void MessageScreen(char *msg)
|
||||
|
||||
DoRWStuffEndOfFrame();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
CGame::InitialiseOnceBeforeRW(void)
|
||||
@ -431,6 +433,7 @@ bool CGame::Initialise(const char* datFile)
|
||||
if ( !TheMemoryCard.m_bWantToLoad )
|
||||
{
|
||||
#endif
|
||||
LoadingScreen("Loading the Game", "Start script", nil);
|
||||
CTheScripts::StartTestScript();
|
||||
CTheScripts::Process();
|
||||
TheCamera.Process();
|
||||
|
@ -1104,7 +1104,9 @@ void CPad::UpdatePads(void)
|
||||
if ( bUpdate )
|
||||
{
|
||||
GetPad(0)->Update(0);
|
||||
#ifndef SQUEEZE_PERFORMANCE
|
||||
GetPad(1)->Update(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(MASTER) && !defined(XINPUT)
|
||||
|
@ -1941,6 +1941,11 @@ CWorld::Process(void)
|
||||
} else {
|
||||
for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
|
||||
CEntity *movingEnt = (CEntity *)node->item;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (movingEnt->bRemoveFromWorld) {
|
||||
RemoveEntityInsteadOfProcessingIt(movingEnt);
|
||||
} else
|
||||
#endif
|
||||
if(movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP &&
|
||||
RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
|
||||
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(),
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "Clock.h"
|
||||
#include "Text.h"
|
||||
#include "World.h"
|
||||
#include "Timer.h"
|
||||
|
||||
eLevelName CTheZones::m_CurrLevel;
|
||||
CZone *CTheZones::m_pPlayersZone;
|
||||
@ -122,6 +123,10 @@ CTheZones::Init(void)
|
||||
void
|
||||
CTheZones::Update(void)
|
||||
{
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (CTimer::GetFrameCounter() % 5 != 0)
|
||||
return;
|
||||
#endif
|
||||
CVector pos;
|
||||
pos = FindPlayerCoors();
|
||||
m_pPlayersZone = FindSmallestZonePosition(&pos);
|
||||
|
@ -282,4 +282,13 @@ enum Config {
|
||||
#ifndef AUDIO_OAL // is not working yet for openal
|
||||
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
||||
#endif
|
||||
//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS
|
||||
//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS
|
||||
|
||||
|
||||
//#define SQUEEZE_PERFORMANCE
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
#undef PS2_ALPHA_TEST
|
||||
#undef NO_ISLAND_LOADING
|
||||
#define PC_PARTICLE
|
||||
#define VC_PED_PORTS // To not process collisions always. But should be tested if that's really beneficial
|
||||
#endif
|
@ -816,7 +816,9 @@ RenderScene(void)
|
||||
DefinedState();
|
||||
CWaterLevel::RenderWater();
|
||||
CRenderer::RenderFadingInEntities();
|
||||
#ifndef SQUEEZE_PERFORMANCE
|
||||
CRenderer::RenderVehiclesButNotBoats();
|
||||
#endif
|
||||
CWeather::RenderRainStreaks();
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
|
||||
SetCurrentWeapon(WEAPONTYPE_UZI);
|
||||
m_fArmour = 50.0f;
|
||||
m_wepSkills = 32; /* TODO: what is this? seems unused */
|
||||
m_wepAccuracy = 64;
|
||||
m_wepAccuracy = 68;
|
||||
break;
|
||||
case COP_ARMY:
|
||||
SetModelIndex(MI_ARMY);
|
||||
@ -479,7 +479,7 @@ CCopPed::CopAI(void)
|
||||
SetAttack(playerOrHisVeh);
|
||||
SetShootTimer(CGeneral::GetRandomNumberInRange(500, 1000));
|
||||
}
|
||||
SetAttackTimer(CGeneral::GetRandomNumberInRange(100, 300));
|
||||
SetAttackTimer(CGeneral::GetRandomNumberInRange(200, 300));
|
||||
}
|
||||
SetMoveState(PEDMOVE_STILL);
|
||||
}
|
||||
|
@ -1104,7 +1104,11 @@ CPopulation::ManagePopulation(void)
|
||||
}
|
||||
|
||||
int pedPoolSize = CPools::GetPedPool()->GetSize();
|
||||
#ifndef SQUEEZE_PERFORMANCE
|
||||
for (int poolIndex = pedPoolSize-1; poolIndex >= 0; poolIndex--) {
|
||||
#else
|
||||
for (int poolIndex = (pedPoolSize * (frameMod32 + 1) / 32) - 1; poolIndex >= pedPoolSize * frameMod32 / 32; poolIndex--) {
|
||||
#endif
|
||||
CPed *ped = CPools::GetPedPool()->GetSlot(poolIndex);
|
||||
|
||||
if (ped && !ped->IsPlayer() && ped->CanBeDeleted() && !ped->bInVehicle) {
|
||||
@ -1117,6 +1121,13 @@ CPopulation::ManagePopulation(void)
|
||||
}
|
||||
|
||||
float dist = (ped->GetPosition() - playerPos).Magnitude2D();
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (dist > 50.f)
|
||||
ped->bUsesCollision = false;
|
||||
else
|
||||
ped->bUsesCollision = true;
|
||||
#endif
|
||||
|
||||
bool pedIsFarAway = false;
|
||||
if (PedCreationDistMultiplier() * (PED_REMOVE_DIST_SPECIAL * TheCamera.GenerationDistMultiplier) < dist
|
||||
|| (!ped->bCullExtraFarAway && PedCreationDistMultiplier() * PED_REMOVE_DIST * TheCamera.GenerationDistMultiplier < dist)
|
||||
|
@ -152,9 +152,9 @@ void CMovingThings::Shutdown()
|
||||
|
||||
void CMovingThings::Update()
|
||||
{
|
||||
const int TIME_SPAN = 64; // frames to process all aMovingThings
|
||||
|
||||
int16 i;
|
||||
#ifndef SQUEEZE_PERFORMANCE
|
||||
const int TIME_SPAN = 64; // frames to process all aMovingThings
|
||||
|
||||
int block = CTimer::GetFrameCounter() % TIME_SPAN;
|
||||
|
||||
@ -167,6 +167,7 @@ void CMovingThings::Update()
|
||||
if (aMovingThings[i].m_nHidden == 0)
|
||||
aMovingThings[i].Update();
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
|
||||
{
|
||||
|
@ -68,8 +68,8 @@ class CFont
|
||||
static int16 Size[MAX_FONTS][193];
|
||||
#endif
|
||||
static int16 NewLine;
|
||||
static CSprite2d Sprite[MAX_FONTS];
|
||||
public:
|
||||
static CSprite2d Sprite[MAX_FONTS];
|
||||
static CFontDetails Details;
|
||||
|
||||
static void Initialise(void);
|
||||
|
@ -73,8 +73,12 @@ CRenderer::PreRender(void)
|
||||
for(i = 0; i < ms_nNoOfVisibleEntities; i++)
|
||||
ms_aVisibleEntityPtrs[i]->PreRender();
|
||||
|
||||
for(i = 0; i < ms_nNoOfInVisibleEntities; i++)
|
||||
for (i = 0; i < ms_nNoOfInVisibleEntities; i++) {
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (ms_aInVisibleEntityPtrs[i]->IsVehicle() && ((CVehicle*)ms_aInVisibleEntityPtrs[i])->IsHeli())
|
||||
#endif
|
||||
ms_aInVisibleEntityPtrs[i]->PreRender();
|
||||
}
|
||||
|
||||
for(node = CVisibilityPlugins::m_alphaEntityList.head.next;
|
||||
node != &CVisibilityPlugins::m_alphaEntityList.tail;
|
||||
|
@ -4,7 +4,11 @@ class CVehicle;
|
||||
|
||||
enum {
|
||||
// NB: not all values are allowed, check the code
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
NUM_RUBBISH_SHEETS = 32
|
||||
#else
|
||||
NUM_RUBBISH_SHEETS = 64
|
||||
#endif
|
||||
};
|
||||
|
||||
class COneSheet
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "Draw.h"
|
||||
#include "Camera.h"
|
||||
#include "Sprite2d.h"
|
||||
#include "Font.h"
|
||||
|
||||
RwIm2DVertex CSprite2d::maVertices[8];
|
||||
float CSprite2d::RecipNearClip;
|
||||
@ -27,14 +28,18 @@ CSprite2d::InitPerFrame(void)
|
||||
mCurrentBank = 0;
|
||||
for(i = 0; i < 10; i++)
|
||||
mCurrentSprite[i] = 0;
|
||||
#ifndef SQUEEZE_PERFORMANCE
|
||||
for(i = 0; i < 10; i++)
|
||||
mpBankTextures[i] = nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
int32
|
||||
CSprite2d::GetBank(int32 n, RwTexture *tex)
|
||||
{
|
||||
#ifndef SQUEEZE_PERFORMANCE
|
||||
mpBankTextures[mCurrentBank] = tex;
|
||||
#endif
|
||||
mCurrentSprite[mCurrentBank] = 0;
|
||||
mBankStart[mCurrentBank+1] = mBankStart[mCurrentBank] + n;
|
||||
return mCurrentBank++;
|
||||
@ -59,8 +64,12 @@ CSprite2d::DrawBank(int32 bank)
|
||||
{
|
||||
if(mCurrentSprite[bank] == 0)
|
||||
return;
|
||||
#ifndef SQUEEZE_PERFORMANCE
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER,
|
||||
mpBankTextures[bank] ? RwTextureGetRaster(mpBankTextures[bank]) : nil);
|
||||
#else
|
||||
CFont::Sprite[bank].SetRenderState();
|
||||
#endif
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
|
||||
RwIm2DRenderPrimitive(rwPRIMTYPETRILIST, &maBankVertices[6*mBankStart[bank]], 6*mCurrentSprite[bank]);
|
||||
|
@ -24,6 +24,10 @@
|
||||
#include "World.h"
|
||||
#include "SurfaceTable.h"
|
||||
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
uint32 bulletInfoInUse;
|
||||
#endif
|
||||
|
||||
#define BULLET_LIFETIME (1000)
|
||||
#define NUM_PED_BLOOD_PARTICLES (8)
|
||||
#define BLOOD_PARTICLE_OFFSET (CVector(0.0f, 0.0f, 0.0f))
|
||||
@ -47,6 +51,9 @@ void CBulletInfo::Initialise(void)
|
||||
gaBulletInfo[i].m_pSource = nil;
|
||||
}
|
||||
debug("CBulletInfo ready\n");
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CBulletInfo::Shutdown(void)
|
||||
@ -71,11 +78,19 @@ bool CBulletInfo::AddBullet(CEntity* pSource, eWeaponType type, CVector vecPosit
|
||||
gaBulletInfo[i].m_vecSpeed = vecSpeed;
|
||||
gaBulletInfo[i].m_fTimer = CTimer::GetTimeInMilliseconds() + BULLET_LIFETIME;
|
||||
gaBulletInfo[i].m_bInUse = true;
|
||||
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse++;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
void CBulletInfo::Update(void)
|
||||
{
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (bulletInfoInUse == 0)
|
||||
return;
|
||||
#endif
|
||||
bool bAddSound = true;
|
||||
bPlayerSniperBullet = false;
|
||||
for (int i = 0; i < NUM_BULLETS; i++) {
|
||||
@ -84,8 +99,12 @@ void CBulletInfo::Update(void)
|
||||
pBullet->m_pSource = nil;
|
||||
if (!pBullet->m_bInUse)
|
||||
continue;
|
||||
if (CTimer::GetTimeInMilliseconds() > pBullet->m_fTimer)
|
||||
if (CTimer::GetTimeInMilliseconds() > pBullet->m_fTimer) {
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
#endif
|
||||
}
|
||||
CVector vecOldPos = pBullet->m_vecPosition;
|
||||
CVector vecNewPos = pBullet->m_vecPosition + pBullet->m_vecSpeed * CTimer::GetTimeStep() * 0.5f;
|
||||
CWorld::bIncludeCarTyres = true;
|
||||
@ -108,6 +127,9 @@ void CBulletInfo::Update(void)
|
||||
pPed->InflictDamage(pBullet->m_pSource, pBullet->m_eWeaponType, pBullet->m_nDamage, (ePedPieceTypes)point.pieceB, pPed->GetLocalDirection(pPed->GetPosition() - point.point));
|
||||
CEventList::RegisterEvent(pPed->m_nPedType == PEDTYPE_COP ? EVENT_SHOOT_COP : EVENT_SHOOT_PED, EVENT_ENTITY_PED, pPed, (CPed*)pBullet->m_pSource, 1000);
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
#endif
|
||||
vecNewPos = point.point;
|
||||
}
|
||||
else {
|
||||
@ -134,6 +156,9 @@ void CBulletInfo::Update(void)
|
||||
}
|
||||
}
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
#endif
|
||||
vecNewPos = point.point;
|
||||
}
|
||||
}
|
||||
@ -148,6 +173,9 @@ void CBulletInfo::Update(void)
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
#endif
|
||||
vecNewPos = point.point;
|
||||
#endif
|
||||
}
|
||||
@ -167,6 +195,9 @@ void CBulletInfo::Update(void)
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
#endif
|
||||
vecNewPos = point.point;
|
||||
#endif
|
||||
}
|
||||
@ -217,8 +248,12 @@ void CBulletInfo::Update(void)
|
||||
}
|
||||
pBullet->m_vecPosition = vecNewPos;
|
||||
if (pBullet->m_vecPosition.x < -MAP_BORDER || pBullet->m_vecPosition.x > MAP_BORDER ||
|
||||
pBullet->m_vecPosition.y < -MAP_BORDER || pBullet->m_vecPosition.y > MAP_BORDER)
|
||||
pBullet->m_vecPosition.y < -MAP_BORDER || pBullet->m_vecPosition.y > MAP_BORDER) {
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,10 @@
|
||||
#include "Weapon.h"
|
||||
#include "World.h"
|
||||
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
uint32 projectileInUse;
|
||||
#endif
|
||||
|
||||
CProjectileInfo gaProjectileInfo[NUM_PROJECTILES];
|
||||
CProjectile *CProjectileInfo::ms_apProjectile[NUM_PROJECTILES];
|
||||
|
||||
@ -30,6 +34,10 @@ CProjectileInfo::Initialise()
|
||||
}
|
||||
|
||||
debug("CProjectileInfo ready\n");
|
||||
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
projectileInUse = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -154,6 +162,10 @@ CProjectileInfo::AddProjectile(CEntity *entity, eWeaponType weapon, CVector pos,
|
||||
ms_apProjectile[i]->m_fElasticity = elasticity;
|
||||
ms_apProjectile[i]->m_nSpecialCollisionResponseCases = SpecialCollisionResponseCase;
|
||||
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
projectileInUse++;
|
||||
#endif
|
||||
|
||||
gaProjectileInfo[i].m_bInUse = true;
|
||||
CWorld::Add(ms_apProjectile[i]);
|
||||
|
||||
@ -165,6 +177,9 @@ void
|
||||
CProjectileInfo::RemoveProjectile(CProjectileInfo *info, CProjectile *projectile)
|
||||
{
|
||||
RemoveNotAdd(info->m_pSource, info->m_eWeaponType, projectile->GetPosition());
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
projectileInUse--;
|
||||
#endif
|
||||
|
||||
info->m_bInUse = false;
|
||||
CWorld::Remove(projectile);
|
||||
@ -192,6 +207,11 @@ CProjectileInfo::RemoveNotAdd(CEntity *entity, eWeaponType weaponType, CVector p
|
||||
void
|
||||
CProjectileInfo::Update()
|
||||
{
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (projectileInUse == 0)
|
||||
return;
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(gaProjectileInfo); i++) {
|
||||
if (!gaProjectileInfo[i].m_bInUse) continue;
|
||||
|
||||
@ -200,6 +220,10 @@ CProjectileInfo::Update()
|
||||
gaProjectileInfo[i].m_pSource = nil;
|
||||
|
||||
if (ms_apProjectile[i] == nil) {
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
projectileInUse--;
|
||||
#endif
|
||||
|
||||
gaProjectileInfo[i].m_bInUse = false;
|
||||
continue;
|
||||
}
|
||||
@ -252,6 +276,10 @@ CProjectileInfo::IsProjectileInRange(float x1, float x2, float y1, float y2, flo
|
||||
if (pos.x >= x1 && pos.x <= x2 && pos.y >= y1 && pos.y <= y2 && pos.z >= z1 && pos.z <= z2) {
|
||||
result = true;
|
||||
if (remove) {
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
projectileInUse--;
|
||||
#endif
|
||||
|
||||
gaProjectileInfo[i].m_bInUse = false;
|
||||
CWorld::Remove(ms_apProjectile[i]);
|
||||
delete ms_apProjectile[i];
|
||||
@ -266,8 +294,17 @@ CProjectileInfo::IsProjectileInRange(float x1, float x2, float y1, float y2, flo
|
||||
void
|
||||
CProjectileInfo::RemoveAllProjectiles()
|
||||
{
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (projectileInUse == 0)
|
||||
return;
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(ms_apProjectile); i++) {
|
||||
if (gaProjectileInfo[i].m_bInUse) {
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
projectileInUse--;
|
||||
#endif
|
||||
|
||||
gaProjectileInfo[i].m_bInUse = false;
|
||||
CWorld::Remove(ms_apProjectile[i]);
|
||||
delete ms_apProjectile[i];
|
||||
@ -278,12 +315,21 @@ CProjectileInfo::RemoveAllProjectiles()
|
||||
bool
|
||||
CProjectileInfo::RemoveIfThisIsAProjectile(CObject *object)
|
||||
{
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (projectileInUse == 0)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
int i = 0;
|
||||
while (ms_apProjectile[i++] != object) {
|
||||
if (i >= ARRAY_SIZE(ms_apProjectile))
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
projectileInUse--;
|
||||
#endif
|
||||
|
||||
gaProjectileInfo[i].m_bInUse = false;
|
||||
CWorld::Remove(ms_apProjectile[i]);
|
||||
delete ms_apProjectile[i];
|
||||
|
@ -13,6 +13,9 @@
|
||||
CShotInfo gaShotInfo[NUMSHOTINFOS];
|
||||
float CShotInfo::ms_afRandTable[20];
|
||||
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
uint32 shotInfoInUse;
|
||||
#endif
|
||||
|
||||
/*
|
||||
Used for flamethrower. I don't know why it's name is CShotInfo.
|
||||
@ -41,6 +44,9 @@ CShotInfo::Initialise()
|
||||
nextVal += 0.005f;
|
||||
}
|
||||
debug("CShotInfo ready\n");
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
shotInfoInUse = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
@ -54,6 +60,10 @@ CShotInfo::AddShot(CEntity *sourceEntity, eWeaponType weapon, CVector startPos,
|
||||
if (slot == ARRAY_SIZE(gaShotInfo))
|
||||
return false;
|
||||
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
shotInfoInUse++;
|
||||
#endif
|
||||
|
||||
gaShotInfo[slot].m_inUse = true;
|
||||
gaShotInfo[slot].m_weapon = weapon;
|
||||
gaShotInfo[slot].m_startPos = startPos;
|
||||
@ -87,6 +97,10 @@ CShotInfo::Shutdown()
|
||||
void
|
||||
CShotInfo::Update()
|
||||
{
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (shotInfoInUse == 0)
|
||||
return;
|
||||
#endif
|
||||
for (int slot = 0; slot < ARRAY_SIZE(gaShotInfo); slot++) {
|
||||
CShotInfo &shot = gaShotInfo[slot];
|
||||
if (shot.m_sourceEntity && shot.m_sourceEntity->IsPed() && !((CPed*)shot.m_sourceEntity)->IsPointerValid())
|
||||
@ -96,8 +110,12 @@ CShotInfo::Update()
|
||||
continue;
|
||||
|
||||
CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo(shot.m_weapon);
|
||||
if (CTimer::GetTimeInMilliseconds() > shot.m_timeout)
|
||||
if (CTimer::GetTimeInMilliseconds() > shot.m_timeout) {
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
shotInfoInUse--;
|
||||
#endif
|
||||
shot.m_inUse = false;
|
||||
}
|
||||
|
||||
if (weaponInfo->m_bSlowsDown)
|
||||
shot.m_areaAffected *= pow(0.96, CTimer::GetTimeStep()); // FRAMERATE
|
||||
|
Loading…
Reference in New Issue
Block a user