Merge remote-tracking branch 'origin/master' into miami
# Conflicts: # src/control/RoadBlocks.cpp # src/core/Collision.h # src/core/Pad.cpp # src/core/SurfaceTable.h # src/core/main.cpp # src/core/re3.cpp # src/peds/Population.cpp # src/render/Fluff.cpp # src/render/Shadows.cpp # src/render/Shadows.h # src/render/Sprite2d.cpp # src/weapons/BulletInfo.cpp
This commit is contained in:
@@ -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
|
||||
bPlayerSniperBullet = false;
|
||||
for (int i = 0; i < NUM_BULLETS; i++) {
|
||||
CBulletInfo* pBullet = &gaBulletInfo[i];
|
||||
@@ -83,8 +98,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;
|
||||
}
|
||||
if (CGame::nastyGame) {
|
||||
@@ -130,6 +152,9 @@ void CBulletInfo::Update(void)
|
||||
}
|
||||
}
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
#endif
|
||||
vecNewPos = point.point;
|
||||
}
|
||||
}
|
||||
@@ -144,6 +169,9 @@ void CBulletInfo::Update(void)
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
#endif
|
||||
vecNewPos = point.point;
|
||||
#endif
|
||||
}
|
||||
@@ -163,6 +191,9 @@ void CBulletInfo::Update(void)
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
#endif
|
||||
vecNewPos = point.point;
|
||||
#endif
|
||||
}
|
||||
@@ -213,8 +244,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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user