mirror of
https://github.com/halpz/re3.git
synced 2025-07-15 09:18:12 +00:00
Peds, eSound and PedState enum, fixes
This commit is contained in:
@ -824,9 +824,6 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
||||
int32 accuracy = shooterPed->m_wepAccuracy;
|
||||
int32 inaccuracy = 100-accuracy;
|
||||
|
||||
if ( accuracy != 100 )
|
||||
FindPlayerPed(); //what ?
|
||||
|
||||
CPed *threatAttack = (CPed*)shooterPed->m_pPointGunAt;
|
||||
if ( threatAttack->IsPed() )
|
||||
{
|
||||
@ -911,10 +908,19 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
||||
}
|
||||
}
|
||||
|
||||
if ( victim && shooter->IsPed() && victim == ((CPed*)shooter)->m_leader )
|
||||
return false;
|
||||
if (victim && shooter->IsPed())
|
||||
{
|
||||
if (victim == ((CPed*)shooter)->m_leader)
|
||||
return false;
|
||||
|
||||
CEventList::RegisterEvent(EVENT_GUNSHOT, EVENT_ENTITY_PED, shooter, (CPed *)shooter, 1000);
|
||||
if (victim->IsPed() && ((CPed*)shooter)->IsGangMember() && !((CPed*)victim)->CanBeDamagedByThisGangMember((CPed*)shooter))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (shooter->IsPed())
|
||||
CEventList::RegisterEvent(EVENT_GUNSHOT, EVENT_ENTITY_PED, shooter, (CPed*)shooter, 1000);
|
||||
else if (shooter->IsVehicle() && ((CVehicle*)shooter)->pDriver)
|
||||
CEventList::RegisterEvent(EVENT_GUNSHOT, EVENT_ENTITY_VEHICLE, shooter, ((CVehicle*)shooter)->pDriver, 1000);
|
||||
|
||||
if ( shooter == FindPlayerPed() )
|
||||
{
|
||||
@ -935,59 +941,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
||||
|
||||
if ( info->m_nFiringRate >= 50 && !(++counter & 1) )
|
||||
{
|
||||
CPointLights::AddLight(CPointLights::LIGHT_POINT,
|
||||
*fireSource, CVector(0.0f, 0.0f, 0.0f), 5.0f,
|
||||
1.0f, 0.8f, 0.0f, CPointLights::FOG_NONE, false);
|
||||
|
||||
CVector gunflashPos = *fireSource;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.08f);
|
||||
gunflashPos += CVector(0.06f*ahead.x, 0.06f*ahead.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.06f);
|
||||
gunflashPos += CVector(0.06f*ahead.x, 0.06f*ahead.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.06f);
|
||||
|
||||
gunflashPos = *fireSource;
|
||||
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
||||
gunflashPos.z += 0.04f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||
gunflashPos.z += 0.04f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
gunflashPos.z += 0.03f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
|
||||
gunflashPos = *fireSource;
|
||||
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
||||
gunflashPos.z -= 0.04f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||
gunflashPos.z -= 0.04f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
gunflashPos.z -= 0.03f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
|
||||
CVector offset = CrossProduct(CVector(ahead.x, ahead.y, 0.0f), CVector(0.0f, 0.0f, 5.0f));
|
||||
offset.Normalise2D();
|
||||
|
||||
gunflashPos = *fireSource;
|
||||
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
||||
gunflashPos += CVector(0.06f*offset.x, 0.06f*offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||
gunflashPos += CVector(0.04f*offset.x, 0.04f*offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.03f);
|
||||
gunflashPos += CVector(0.03f*offset.x, 0.03f*offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
|
||||
gunflashPos = *fireSource;
|
||||
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
||||
gunflashPos -= CVector(0.06f*offset.x, 0.06f*offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||
gunflashPos -= CVector(0.04f*offset.x, 0.04f*offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.03f);
|
||||
gunflashPos -= CVector(0.03f*offset.x, 0.03f*offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
|
||||
CVector gunsmokePos = *fireSource;
|
||||
float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
|
||||
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(ahead.x*rnd, ahead.y*rnd, 0.0f));
|
||||
AddGunFlashBigGuns(*fireSource, *fireSource + target);
|
||||
|
||||
CVector gunshellPos = *fireSource;
|
||||
gunshellPos -= CVector(0.65f*ahead.x, 0.65f*ahead.y, 0.0f);
|
||||
@ -2761,6 +2715,71 @@ CWeapon::ProcessLineOfSight(CVector const &point1, CVector const &point2, CColPo
|
||||
return CWorld::ProcessLineOfSight(point1, point2, point, entity, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, ignoreSomeObjects);
|
||||
}
|
||||
|
||||
void
|
||||
CWeapon::AddGunFlashBigGuns(CVector start, CVector end)
|
||||
{
|
||||
CPointLights::AddLight(CPointLights::LIGHT_POINT,
|
||||
start, CVector(0.0f, 0.0f, 0.0f), 5.0f,
|
||||
1.0f, 0.8f, 0.0f, CPointLights::FOG_NONE, false);
|
||||
CVector gunflashPos = start;
|
||||
|
||||
CVector shootVec = end - start;
|
||||
|
||||
// Wtf did you do there R*?
|
||||
shootVec.Normalise();
|
||||
CVector2D ahead = shootVec;
|
||||
ahead.Normalise();
|
||||
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.08f);
|
||||
gunflashPos += CVector(0.06f * ahead.x, 0.06f * ahead.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.06f);
|
||||
gunflashPos += CVector(0.06f * ahead.x, 0.06f * ahead.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.06f);
|
||||
|
||||
gunflashPos = start;
|
||||
gunflashPos += CVector(-0.1f * ahead.x, -0.1f * ahead.y, 0.0f);
|
||||
gunflashPos.z += 0.04f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||
gunflashPos.z += 0.04f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
gunflashPos.z += 0.03f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
|
||||
gunflashPos = start;
|
||||
gunflashPos += CVector(-0.1f * ahead.x, -0.1f * ahead.y, 0.0f);
|
||||
gunflashPos.z -= 0.04f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||
gunflashPos.z -= 0.04f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
gunflashPos.z -= 0.03f;
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
|
||||
CVector offset = CrossProduct(CVector(ahead.x, ahead.y, 0.0f), CVector(0.0f, 0.0f, 5.0f));
|
||||
offset.Normalise2D();
|
||||
|
||||
gunflashPos = start;
|
||||
gunflashPos += CVector(-0.1f * ahead.x, -0.1f * ahead.y, 0.0f);
|
||||
gunflashPos += CVector(0.06f * offset.x, 0.06f * offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||
gunflashPos += CVector(0.04f * offset.x, 0.04f * offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.03f);
|
||||
gunflashPos += CVector(0.03f * offset.x, 0.03f * offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
|
||||
gunflashPos = start;
|
||||
gunflashPos += CVector(-0.1f * ahead.x, -0.1f * ahead.y, 0.0f);
|
||||
gunflashPos -= CVector(0.06f * offset.x, 0.06f * offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||
gunflashPos -= CVector(0.04f * offset.x, 0.04f * offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.03f);
|
||||
gunflashPos -= CVector(0.03f * offset.x, 0.03f * offset.y, 0.0f);
|
||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||
|
||||
CVector gunsmokePos = start;
|
||||
float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
|
||||
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(ahead.x * rnd, ahead.y * rnd, 0.0f));
|
||||
}
|
||||
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
|
||||
#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
bool HitsGround(CEntity *holder, CVector *fireSource, CEntity *aimingTo);
|
||||
static void BlowUpExplosiveThings(CEntity *thing);
|
||||
bool HasWeaponAmmoToBeUsed(void);
|
||||
static void AddGunFlashBigGuns(CVector, CVector);
|
||||
|
||||
static bool IsShotgun(int weapon) { return weapon == WEAPONTYPE_SHOTGUN || weapon == WEAPONTYPE_SPAS12_SHOTGUN || weapon == WEAPONTYPE_STUBBY_SHOTGUN; }
|
||||
|
||||
|
Reference in New Issue
Block a user