weapon cosmetic fix
This commit is contained in:
parent
7c13d72edc
commit
85fe445fef
@ -32,26 +32,28 @@
|
|||||||
|
|
||||||
uint16 gReloadSampleTime[WEAPONTYPE_TOTAL_INVENTORY_WEAPONS] =
|
uint16 gReloadSampleTime[WEAPONTYPE_TOTAL_INVENTORY_WEAPONS] =
|
||||||
{
|
{
|
||||||
/*UNARMED*/ 0,
|
0, // UNARMED
|
||||||
/*BASEBALLBAT*/ 0,
|
0, // BASEBALLBAT
|
||||||
/*COLT45*/ 250,
|
250, // COLT45
|
||||||
/*UZI*/ 400,
|
400, // UZI
|
||||||
/*SHOTGUN*/ 650,
|
650, // SHOTGUN
|
||||||
/*AK47*/ 300,
|
300, // AK47
|
||||||
/*M16*/ 300,
|
300, // M16
|
||||||
/*SNIPERRIFLE*/ 423,
|
423, // SNIPERRIFLE
|
||||||
/*ROCKETLAUNCHER*/ 400,
|
400, // ROCKETLAUNCHER
|
||||||
/*FLAMETHROWER*/ 0,
|
0, // FLAMETHROWER
|
||||||
/*MOLOTOV*/ 0,
|
0, // MOLOTOV
|
||||||
/*GRENADE*/ 0,
|
0, // GRENADE
|
||||||
/*DETONATOR*/ 0
|
0, // DETONATOR
|
||||||
|
|
||||||
|
0 // WEAPONTYPE_HELICANNON
|
||||||
};
|
};
|
||||||
|
|
||||||
CWeaponInfo *
|
CWeaponInfo *
|
||||||
CWeapon::GetInfo()
|
CWeapon::GetInfo()
|
||||||
{
|
{
|
||||||
CWeaponInfo *info = CWeaponInfo::GetWeaponInfo(m_eWeaponType);
|
CWeaponInfo *info = CWeaponInfo::GetWeaponInfo(m_eWeaponType);
|
||||||
ASSERT(info!=NULL);
|
ASSERT(info!=nil);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +103,7 @@ CWeapon::Initialise(eWeaponType type, int32 ammo)
|
|||||||
bool
|
bool
|
||||||
CWeapon::Fire(CEntity *shooter, CVector *fireSource)
|
CWeapon::Fire(CEntity *shooter, CVector *fireSource)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
|
|
||||||
CVector fireOffset(0.0f, 0.0f, 0.6f);
|
CVector fireOffset(0.0f, 0.0f, 0.6f);
|
||||||
CVector *source = fireSource;
|
CVector *source = fireSource;
|
||||||
@ -164,7 +166,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
|
|||||||
|
|
||||||
case WEAPONTYPE_ROCKETLAUNCHER:
|
case WEAPONTYPE_ROCKETLAUNCHER:
|
||||||
{
|
{
|
||||||
if ( shooter->IsPed() && ((CPed*)shooter)->m_pSeekTarget != NULL )
|
if ( shooter->IsPed() && ((CPed*)shooter)->m_pSeekTarget != nil )
|
||||||
{
|
{
|
||||||
float distToTarget = (shooter->GetPosition() - ((CPed*)shooter)->m_pSeekTarget->GetPosition()).Magnitude();
|
float distToTarget = (shooter->GetPosition() - ((CPed*)shooter)->m_pSeekTarget->GetPosition()).Magnitude();
|
||||||
|
|
||||||
@ -188,7 +190,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
|
|||||||
if ( m_eWeaponType == WEAPONTYPE_GRENADE )
|
if ( m_eWeaponType == WEAPONTYPE_GRENADE )
|
||||||
CStats::KgsOfExplosivesUsed++;
|
CStats::KgsOfExplosivesUsed++;
|
||||||
}
|
}
|
||||||
else if ( shooter->IsPed() && ((CPed*)shooter)->m_pSeekTarget != NULL )
|
else if ( shooter->IsPed() && ((CPed*)shooter)->m_pSeekTarget != nil )
|
||||||
{
|
{
|
||||||
float distToTarget = (shooter->GetPosition() - ((CPed*)shooter)->m_pSeekTarget->GetPosition()).Magnitude();
|
float distToTarget = (shooter->GetPosition() - ((CPed*)shooter)->m_pSeekTarget->GetPosition()).Magnitude();
|
||||||
float power = clamp((distToTarget-10.0f)*0.02f, 0.2f, 1.0f);
|
float power = clamp((distToTarget-10.0f)*0.02f, 0.2f, 1.0f);
|
||||||
@ -304,7 +306,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
|
|||||||
bool
|
bool
|
||||||
CWeapon::FireFromCar(CAutomobile *shooter, bool left)
|
CWeapon::FireFromCar(CAutomobile *shooter, bool left)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
|
|
||||||
if ( m_eWeaponState != WEAPONSTATE_READY && m_eWeaponState != WEAPONSTATE_FIRING )
|
if ( m_eWeaponState != WEAPONSTATE_READY && m_eWeaponState != WEAPONSTATE_FIRING )
|
||||||
return false;
|
return false;
|
||||||
@ -343,7 +345,7 @@ CWeapon::FireFromCar(CAutomobile *shooter, bool left)
|
|||||||
bool
|
bool
|
||||||
CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
|
CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
|
|
||||||
CWeaponInfo *info = GetInfo();
|
CWeaponInfo *info = GetInfo();
|
||||||
|
|
||||||
@ -358,7 +360,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
|
|||||||
for ( int32 i = 0; i < shooterPed->m_numNearPeds; i++ )
|
for ( int32 i = 0; i < shooterPed->m_numNearPeds; i++ )
|
||||||
{
|
{
|
||||||
CPed *victimPed = shooterPed->m_nearPeds[i];
|
CPed *victimPed = shooterPed->m_nearPeds[i];
|
||||||
ASSERT(victimPed!=NULL);
|
ASSERT(victimPed!=nil);
|
||||||
|
|
||||||
if ( (victimPed->m_nPedType != shooterPed->m_nPedType || victimPed == shooterPed->m_pSeekTarget)
|
if ( (victimPed->m_nPedType != shooterPed->m_nPedType || victimPed == shooterPed->m_pSeekTarget)
|
||||||
&& victimPed != shooterPed->m_leader || !(CGeneral::GetRandomNumber() & 31) )
|
&& victimPed != shooterPed->m_leader || !(CGeneral::GetRandomNumber() & 31) )
|
||||||
@ -369,7 +371,6 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
|
|||||||
if ( victimPed->OnGround() || !victimPed->IsPedHeadAbovePos(-0.3f) )
|
if ( victimPed->OnGround() || !victimPed->IsPedHeadAbovePos(-0.3f) )
|
||||||
victimPedCol = &CTempColModels::ms_colModelPedGroundHit;
|
victimPedCol = &CTempColModels::ms_colModelPedGroundHit;
|
||||||
|
|
||||||
ASSERT(victimPedCol!=NULL);
|
|
||||||
|
|
||||||
float victimPedRadius = victimPed->GetBoundRadius() + info->m_fRadius;
|
float victimPedRadius = victimPed->GetBoundRadius() + info->m_fRadius;
|
||||||
if ( victimPed->bUsesCollision || victimPed->Dead() || victimPed->Driving() )
|
if ( victimPed->bUsesCollision || victimPed->Dead() || victimPed->Driving() )
|
||||||
@ -398,7 +399,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
|
|||||||
if ( collided )
|
if ( collided )
|
||||||
{
|
{
|
||||||
float victimPedHealth = victimPed->m_fHealth;
|
float victimPedHealth = victimPed->m_fHealth;
|
||||||
CVector bloodPos = fireSource + collisionDist*0.7f;
|
CVector bloodPos = fireSource + (collisionDist*0.7f);
|
||||||
|
|
||||||
CVector2D posOffset(shooterPed->GetPosition().x-victimPedPos.x, shooterPed->GetPosition().y-victimPedPos.y);
|
CVector2D posOffset(shooterPed->GetPosition().x-victimPedPos.x, shooterPed->GetPosition().y-victimPedPos.y);
|
||||||
|
|
||||||
@ -497,14 +498,14 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
|
|||||||
bool
|
bool
|
||||||
CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
ASSERT(fireSource!=NULL);
|
ASSERT(fireSource!=nil);
|
||||||
|
|
||||||
CWeaponInfo *info = GetInfo();
|
CWeaponInfo *info = GetInfo();
|
||||||
|
|
||||||
CVector source, target;
|
CVector source, target;
|
||||||
CColPoint point;
|
CColPoint point;
|
||||||
CEntity *victim = NULL;
|
CEntity *victim = nil;
|
||||||
|
|
||||||
float heading = RADTODEG(shooter->GetForward().Heading());
|
float heading = RADTODEG(shooter->GetForward().Heading());
|
||||||
float angle = DEGTORAD(heading);
|
float angle = DEGTORAD(heading);
|
||||||
@ -587,7 +588,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
|||||||
if ( CHeli::TestBulletCollision(&src, &trgt, &bulletPos, 4) )
|
if ( CHeli::TestBulletCollision(&src, &trgt, &bulletPos, 4) )
|
||||||
{
|
{
|
||||||
for ( int32 i = 0; i < 16; i++ )
|
for ( int32 i = 0; i < 16; i++ )
|
||||||
CParticle::AddParticle(PARTICLE_SPARK, bulletPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, rotSpeed);
|
CParticle::AddParticle(PARTICLE_SPARK, bulletPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, rotSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -615,7 +616,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
|||||||
if ( CHeli::TestBulletCollision(fireSource, &target, &bulletPos, 4) )
|
if ( CHeli::TestBulletCollision(fireSource, &target, &bulletPos, 4) )
|
||||||
{
|
{
|
||||||
for ( int32 i = 0; i < 16; i++ )
|
for ( int32 i = 0; i < 16; i++ )
|
||||||
CParticle::AddParticle(PARTICLE_SPARK, bulletPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, rotSpeed);
|
CParticle::AddParticle(PARTICLE_SPARK, bulletPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, rotSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,13 +646,13 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
|||||||
|
|
||||||
CVector gunflashPos = *fireSource;
|
CVector gunflashPos = *fireSource;
|
||||||
gunflashPos += CVector(0.06f*ahead.x, 0.06f*ahead.y, 0.0f);
|
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), NULL, 0.10f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.10f);
|
||||||
gunflashPos += CVector(0.06f*ahead.x, 0.06f*ahead.y, 0.0f);
|
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), NULL, 0.08f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.08f);
|
||||||
gunflashPos += CVector(0.05f*ahead.x, 0.05f*ahead.y, 0.0f);
|
gunflashPos += CVector(0.05f*ahead.x, 0.05f*ahead.y, 0.0f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.06f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.06f);
|
||||||
gunflashPos += CVector(0.04f*ahead.x, 0.04f*ahead.y, 0.0f);
|
gunflashPos += CVector(0.04f*ahead.x, 0.04f*ahead.y, 0.0f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.04f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||||
|
|
||||||
CVector gunsmokePos = *fireSource;
|
CVector gunsmokePos = *fireSource;
|
||||||
float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
|
float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
|
||||||
@ -678,29 +679,29 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
|||||||
1.0f, 0.8f, 0.0f, CPointLights::FOG_NONE, false);
|
1.0f, 0.8f, 0.0f, CPointLights::FOG_NONE, false);
|
||||||
|
|
||||||
CVector gunflashPos = *fireSource;
|
CVector gunflashPos = *fireSource;
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.08f);
|
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);
|
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), NULL, 0.06f);
|
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);
|
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), NULL, 0.06f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.06f);
|
||||||
|
|
||||||
gunflashPos = *fireSource;
|
gunflashPos = *fireSource;
|
||||||
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
||||||
gunflashPos.z += 0.04f;
|
gunflashPos.z += 0.04f;
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.04f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||||
gunflashPos.z += 0.04f;
|
gunflashPos.z += 0.04f;
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.02f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||||
gunflashPos.z += 0.03f;
|
gunflashPos.z += 0.03f;
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.02f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||||
|
|
||||||
gunflashPos = *fireSource;
|
gunflashPos = *fireSource;
|
||||||
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
||||||
gunflashPos.z -= 0.04f;
|
gunflashPos.z -= 0.04f;
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.04f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||||
gunflashPos.z -= 0.04f;
|
gunflashPos.z -= 0.04f;
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.02f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||||
gunflashPos.z -= 0.03f;
|
gunflashPos.z -= 0.03f;
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.02f);
|
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));
|
CVector offset = CrossProduct(CVector(ahead.x, ahead.y, 0.0f), CVector(0.0f, 0.0f, 5.0f));
|
||||||
offset.Normalise2D();
|
offset.Normalise2D();
|
||||||
@ -708,20 +709,20 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
|||||||
gunflashPos = *fireSource;
|
gunflashPos = *fireSource;
|
||||||
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
||||||
gunflashPos += CVector(0.06f*offset.x, 0.06f*offset.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), NULL, 0.04f);
|
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);
|
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), NULL, 0.03f);
|
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);
|
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), NULL, 0.02f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||||
|
|
||||||
gunflashPos = *fireSource;
|
gunflashPos = *fireSource;
|
||||||
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
|
||||||
gunflashPos -= CVector(0.06f*offset.x, 0.06f*offset.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), NULL, 0.04f);
|
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);
|
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), NULL, 0.03f);
|
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);
|
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), NULL, 0.02f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||||
|
|
||||||
CVector gunsmokePos = *fireSource;
|
CVector gunsmokePos = *fireSource;
|
||||||
float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
|
float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
|
||||||
@ -748,19 +749,19 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
|||||||
if ( shooterMoving )
|
if ( shooterMoving )
|
||||||
gunflashPos += CVector(1.5f*vel.x, 1.5f*vel.y, 0.0f);
|
gunflashPos += CVector(1.5f*vel.x, 1.5f*vel.y, 0.0f);
|
||||||
|
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.07f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.07f);
|
||||||
gunflashPos += CVector(0.06f*ahead.x, 0.06f*ahead.y, 0.0f);
|
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), NULL, 0.05f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.05f);
|
||||||
gunflashPos += CVector(0.04f*ahead.x, 0.04f*ahead.y, 0.0f);
|
gunflashPos += CVector(0.04f*ahead.x, 0.04f*ahead.y, 0.0f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.04f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||||
gunflashPos += CVector(0.04f*ahead.x, 0.04f*ahead.y, 0.0f);
|
gunflashPos += CVector(0.04f*ahead.x, 0.04f*ahead.y, 0.0f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.03f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.03f);
|
||||||
gunflashPos += CVector(0.03f*ahead.x, 0.03f*ahead.y, 0.0f);
|
gunflashPos += CVector(0.03f*ahead.x, 0.03f*ahead.y, 0.0f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.03f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.03f);
|
||||||
gunflashPos += CVector(0.03f*ahead.x, 0.03f*ahead.y, 0.0f);
|
gunflashPos += CVector(0.03f*ahead.x, 0.03f*ahead.y, 0.0f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.02f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||||
gunflashPos += CVector(0.02f*ahead.x, 0.02f*ahead.y, 0.0f);
|
gunflashPos += CVector(0.02f*ahead.x, 0.02f*ahead.y, 0.0f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.01f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.01f);
|
||||||
|
|
||||||
CVector gunsmokePos = *fireSource;
|
CVector gunsmokePos = *fireSource;
|
||||||
float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
|
float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
|
||||||
@ -786,16 +787,16 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
|||||||
if ( shooterMoving )
|
if ( shooterMoving )
|
||||||
gunflashPos += CVector(1.5f*vel.x, 1.5f*vel.y, 0.0f);
|
gunflashPos += CVector(1.5f*vel.x, 1.5f*vel.y, 0.0f);
|
||||||
|
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.06f);
|
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);
|
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), NULL, 0.04f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
|
||||||
gunflashPos += CVector(0.04f*ahead.x, 0.04f*ahead.y, 0.0f);
|
gunflashPos += CVector(0.04f*ahead.x, 0.04f*ahead.y, 0.0f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.02f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
|
||||||
|
|
||||||
CVector gunsmokePos = *fireSource;
|
CVector gunsmokePos = *fireSource;
|
||||||
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(ahead.x*0.10f, ahead.y*0.10f, 0.0f), NULL, 0.005f);
|
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(ahead.x*0.10f, ahead.y*0.10f, 0.0f), nil, 0.005f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(ahead.x*0.15f, ahead.y*0.15f, 0.0f), NULL, 0.015f);
|
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(ahead.x*0.15f, ahead.y*0.15f, 0.0f), nil, 0.015f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(ahead.x*0.20f, ahead.y*0.20f, 0.0f), NULL, 0.025f);
|
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(ahead.x*0.20f, ahead.y*0.20f, 0.0f), nil, 0.025f);
|
||||||
|
|
||||||
CVector gunshellPos = *fireSource;
|
CVector gunshellPos = *fireSource;
|
||||||
gunshellPos -= CVector(0.2f*ahead.x, 0.2f*ahead.y, 0.0f);
|
gunshellPos -= CVector(0.2f*ahead.x, 0.2f*ahead.y, 0.0f);
|
||||||
@ -815,9 +816,9 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
|||||||
void
|
void
|
||||||
CWeapon::AddGunshell(CEntity *shooter, CVector const &source, CVector2D const &direction, float size)
|
CWeapon::AddGunshell(CEntity *shooter, CVector const &source, CVector2D const &direction, float size)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
|
|
||||||
if ( shooter == NULL)
|
if ( shooter == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CVector dir(direction.x*0.05f, direction.y*0.05f, CGeneral::GetRandomNumberInRange(0.02f, 0.08f));
|
CVector dir(direction.x*0.05f, direction.y*0.05f, CGeneral::GetRandomNumberInRange(0.02f, 0.08f));
|
||||||
@ -832,12 +833,12 @@ CWeapon::AddGunshell(CEntity *shooter, CVector const &source, CVector2D const &d
|
|||||||
prevEntityPosition = entityPosition;
|
prevEntityPosition = entityPosition;
|
||||||
|
|
||||||
CParticle::AddParticle(PARTICLE_GUNSHELL_FIRST,
|
CParticle::AddParticle(PARTICLE_GUNSHELL_FIRST,
|
||||||
source, dir, NULL, size, CGeneral::GetRandomNumberInRange(-20.0f, 20.0f));
|
source, dir, nil, size, CGeneral::GetRandomNumberInRange(-20.0f, 20.0f));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CParticle::AddParticle(PARTICLE_GUNSHELL,
|
CParticle::AddParticle(PARTICLE_GUNSHELL,
|
||||||
source, dir, NULL, size, CGeneral::GetRandomNumberInRange(-20.0f, 20.0f));
|
source, dir, nil, size, CGeneral::GetRandomNumberInRange(-20.0f, 20.0f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,10 +846,10 @@ void
|
|||||||
CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
|
CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
|
||||||
CVector *source, CVector *target, CColPoint *point, CVector2D ahead)
|
CVector *source, CVector *target, CColPoint *point, CVector2D ahead)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
ASSERT(source!=NULL);
|
ASSERT(source!=nil);
|
||||||
ASSERT(target!=NULL);
|
ASSERT(target!=nil);
|
||||||
ASSERT(point!=NULL);
|
ASSERT(point!=nil);
|
||||||
|
|
||||||
CWeaponInfo *info = GetInfo();
|
CWeaponInfo *info = GetInfo();
|
||||||
|
|
||||||
@ -859,7 +860,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
|
|||||||
CVector traceTarget = *target;
|
CVector traceTarget = *target;
|
||||||
CBulletTraces::AddTrace(source, &traceTarget);
|
CBulletTraces::AddTrace(source, &traceTarget);
|
||||||
|
|
||||||
if ( shooter != NULL )
|
if ( shooter != nil )
|
||||||
{
|
{
|
||||||
if ( shooter == FindPlayerPed() )
|
if ( shooter == FindPlayerPed() )
|
||||||
{
|
{
|
||||||
@ -908,7 +909,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
|
|||||||
victimPed->ClearAttackByRemovingAnim();
|
victimPed->ClearAttackByRemovingAnim();
|
||||||
|
|
||||||
CAnimBlendAssociation *asoc = CAnimManager::AddAnimation(victimPed->GetClump(), ASSOCGRP_STD, AnimationId(ANIM_SHOT_FRONT_PARTIAL + localDir));
|
CAnimBlendAssociation *asoc = CAnimManager::AddAnimation(victimPed->GetClump(), ASSOCGRP_STD, AnimationId(ANIM_SHOT_FRONT_PARTIAL + localDir));
|
||||||
ASSERT(asoc!=NULL);
|
ASSERT(asoc!=nil);
|
||||||
|
|
||||||
asoc->blendAmount = 0.0f;
|
asoc->blendAmount = 0.0f;
|
||||||
asoc->blendDelta = 8.0f;
|
asoc->blendDelta = 8.0f;
|
||||||
@ -924,7 +925,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
|
|||||||
victimPed->ClearAttackByRemovingAnim();
|
victimPed->ClearAttackByRemovingAnim();
|
||||||
|
|
||||||
CAnimBlendAssociation *asoc = CAnimManager::AddAnimation(victimPed->GetClump(), ASSOCGRP_STD, AnimationId(ANIM_SHOT_FRONT_PARTIAL + localDir));
|
CAnimBlendAssociation *asoc = CAnimManager::AddAnimation(victimPed->GetClump(), ASSOCGRP_STD, AnimationId(ANIM_SHOT_FRONT_PARTIAL + localDir));
|
||||||
ASSERT(asoc!=NULL);
|
ASSERT(asoc!=nil);
|
||||||
|
|
||||||
asoc->blendAmount = 0.0f;
|
asoc->blendAmount = 0.0f;
|
||||||
asoc->blendDelta = 8.0f;
|
asoc->blendDelta = 8.0f;
|
||||||
@ -1106,8 +1107,8 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
|
|||||||
bool
|
bool
|
||||||
CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
ASSERT(fireSource!=NULL);
|
ASSERT(fireSource!=nil);
|
||||||
|
|
||||||
CWeaponInfo *info = GetInfo();
|
CWeaponInfo *info = GetInfo();
|
||||||
|
|
||||||
@ -1119,18 +1120,18 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
|||||||
|
|
||||||
CVector gunflashPos = *fireSource;
|
CVector gunflashPos = *fireSource;
|
||||||
gunflashPos += CVector(rotOffset.x*0.1f, rotOffset.y*0.1f, 0.0f);
|
gunflashPos += CVector(rotOffset.x*0.1f, rotOffset.y*0.1f, 0.0f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f);
|
||||||
gunflashPos += CVector(rotOffset.x*0.1f, rotOffset.y*0.1f, 0.0f);
|
gunflashPos += CVector(rotOffset.x*0.1f, rotOffset.y*0.1f, 0.0f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.15f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.15f);
|
||||||
gunflashPos += CVector(rotOffset.x*0.1f, rotOffset.y*0.1f, 0.0f);
|
gunflashPos += CVector(rotOffset.x*0.1f, rotOffset.y*0.1f, 0.0f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.2f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.2f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH, *fireSource, CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f);
|
CParticle::AddParticle(PARTICLE_GUNFLASH, *fireSource, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f);
|
||||||
|
|
||||||
CVector gunsmokePos = *fireSource;
|
CVector gunsmokePos = *fireSource;
|
||||||
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(rotOffset.x*0.10f, rotOffset.y*0.10f, 0.0f), NULL, 0.1f);
|
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(rotOffset.x*0.10f, rotOffset.y*0.10f, 0.0f), nil, 0.1f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(rotOffset.x*0.15f, rotOffset.y*0.15f, 0.0f), NULL, 0.1f);
|
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(rotOffset.x*0.15f, rotOffset.y*0.15f, 0.0f), nil, 0.1f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(rotOffset.x*0.20f, rotOffset.y*0.20f, 0.0f), NULL, 0.1f);
|
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(rotOffset.x*0.20f, rotOffset.y*0.20f, 0.0f), nil, 0.1f);
|
||||||
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(rotOffset.x*0.25f, rotOffset.y*0.25f, 0.0f), NULL, 0.1f);
|
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(rotOffset.x*0.25f, rotOffset.y*0.25f, 0.0f), nil, 0.1f);
|
||||||
|
|
||||||
CEventList::RegisterEvent(EVENT_GUNSHOT, EVENT_ENTITY_PED, shooter, (CPed*)shooter, 1000);
|
CEventList::RegisterEvent(EVENT_GUNSHOT, EVENT_ENTITY_PED, shooter, (CPed*)shooter, 1000);
|
||||||
|
|
||||||
@ -1139,7 +1140,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
|||||||
|
|
||||||
float shooterAngle;
|
float shooterAngle;
|
||||||
|
|
||||||
if ( shooter->IsPed() && ((CPed*)shooter)->m_pPointGunAt != NULL )
|
if ( shooter->IsPed() && ((CPed*)shooter)->m_pPointGunAt != nil )
|
||||||
{
|
{
|
||||||
CEntity *threatAttack = ((CPed*)shooter)->m_pPointGunAt;
|
CEntity *threatAttack = ((CPed*)shooter)->m_pPointGunAt;
|
||||||
shooterAngle = CGeneral::GetAngleBetweenPoints(threatAttack->GetPosition().x, threatAttack->GetPosition().y,
|
shooterAngle = CGeneral::GetAngleBetweenPoints(threatAttack->GetPosition().x, threatAttack->GetPosition().y,
|
||||||
@ -1180,7 +1181,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
|||||||
{
|
{
|
||||||
CPed *shooterPed = (CPed *)shooter;
|
CPed *shooterPed = (CPed *)shooter;
|
||||||
|
|
||||||
if ( shooterPed->m_pPointGunAt == NULL )
|
if ( shooterPed->m_pPointGunAt == nil )
|
||||||
DoDoomAiming(shooter, fireSource, &target);
|
DoDoomAiming(shooter, fireSource, &target);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1229,7 +1230,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
|||||||
if ( cantStandup )
|
if ( cantStandup )
|
||||||
victimPed->SetFall(1500, AnimationId(ANIM_KO_SKID_FRONT + localDir), false);
|
victimPed->SetFall(1500, AnimationId(ANIM_KO_SKID_FRONT + localDir), false);
|
||||||
|
|
||||||
victimPed->InflictDamage(NULL, m_eWeaponType, info->m_nDamage, (ePedPieceTypes)point.pieceB, localDir);
|
victimPed->InflictDamage(nil, m_eWeaponType, info->m_nDamage, (ePedPieceTypes)point.pieceB, localDir);
|
||||||
|
|
||||||
if ( victimPed->m_nPedType == PEDTYPE_COP )
|
if ( victimPed->m_nPedType == PEDTYPE_COP )
|
||||||
CEventList::RegisterEvent(EVENT_SHOOT_COP, EVENT_ENTITY_PED, victim, (CPed*)shooter, 10000);
|
CEventList::RegisterEvent(EVENT_SHOOT_COP, EVENT_ENTITY_PED, victim, (CPed*)shooter, 10000);
|
||||||
@ -1361,8 +1362,8 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
|||||||
bool
|
bool
|
||||||
CWeapon::FireProjectile(CEntity *shooter, CVector *fireSource, float power)
|
CWeapon::FireProjectile(CEntity *shooter, CVector *fireSource, float power)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
ASSERT(fireSource!=NULL);
|
ASSERT(fireSource!=nil);
|
||||||
|
|
||||||
CVector source, target;
|
CVector source, target;
|
||||||
|
|
||||||
@ -1418,7 +1419,7 @@ CWeapon::FireProjectile(CEntity *shooter, CVector *fireSource, float power)
|
|||||||
source = shooter->GetPosition() - shooter->GetForward();
|
source = shooter->GetPosition() - shooter->GetForward();
|
||||||
source.z -= 0.4f;
|
source.z -= 0.4f;
|
||||||
|
|
||||||
if ( !CWorld::TestSphereAgainstWorld(source, 0.5f, NULL, false, false, true, false, false, false) )
|
if ( !CWorld::TestSphereAgainstWorld(source, 0.5f, nil, false, false, true, false, false, false) )
|
||||||
CProjectileInfo::AddProjectile(shooter, m_eWeaponType, source, 0.0f);
|
CProjectileInfo::AddProjectile(shooter, m_eWeaponType, source, 0.0f);
|
||||||
else
|
else
|
||||||
CProjectileInfo::RemoveNotAdd(shooter, m_eWeaponType, *fireSource);
|
CProjectileInfo::RemoveNotAdd(shooter, m_eWeaponType, *fireSource);
|
||||||
@ -1453,8 +1454,8 @@ CWeapon::GenerateFlameThrowerParticles(CVector pos, CVector dir)
|
|||||||
bool
|
bool
|
||||||
CWeapon::FireAreaEffect(CEntity *shooter, CVector *fireSource)
|
CWeapon::FireAreaEffect(CEntity *shooter, CVector *fireSource)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
ASSERT(fireSource!=NULL);
|
ASSERT(fireSource!=nil);
|
||||||
|
|
||||||
CWeaponInfo *info = GetInfo();
|
CWeaponInfo *info = GetInfo();
|
||||||
|
|
||||||
@ -1486,7 +1487,7 @@ CWeapon::FireAreaEffect(CEntity *shooter, CVector *fireSource)
|
|||||||
bool
|
bool
|
||||||
CWeapon::FireSniper(CEntity *shooter)
|
CWeapon::FireSniper(CEntity *shooter)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
|
|
||||||
int16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
|
int16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
|
||||||
if (!( mode == CCam::MODE_M16_1STPERSON
|
if (!( mode == CCam::MODE_M16_1STPERSON
|
||||||
@ -1504,7 +1505,7 @@ CWeapon::FireSniper(CEntity *shooter)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
CCam *cam = &TheCamera.Cams[TheCamera.ActiveCam];
|
CCam *cam = &TheCamera.Cams[TheCamera.ActiveCam];
|
||||||
ASSERT(cam!=NULL);
|
ASSERT(cam!=nil);
|
||||||
|
|
||||||
CVector source = cam->Source;
|
CVector source = cam->Source;
|
||||||
CVector dir = cam->Front;
|
CVector dir = cam->Front;
|
||||||
@ -1536,7 +1537,7 @@ CWeapon::FireSniper(CEntity *shooter)
|
|||||||
bool
|
bool
|
||||||
CWeapon::FireM16_1stPerson(CEntity *shooter)
|
CWeapon::FireM16_1stPerson(CEntity *shooter)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
|
|
||||||
int16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
|
int16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
|
||||||
|
|
||||||
@ -1561,14 +1562,14 @@ CWeapon::FireM16_1stPerson(CEntity *shooter)
|
|||||||
CWorld::bIncludeDeadPeds = true;
|
CWorld::bIncludeDeadPeds = true;
|
||||||
|
|
||||||
CCam *cam = &TheCamera.Cams[TheCamera.ActiveCam];
|
CCam *cam = &TheCamera.Cams[TheCamera.ActiveCam];
|
||||||
ASSERT(cam!=NULL);
|
ASSERT(cam!=nil);
|
||||||
|
|
||||||
CVector source = cam->Source;
|
CVector source = cam->Source;
|
||||||
CVector target = cam->Front*info->m_fRange + source;
|
CVector target = cam->Front*info->m_fRange + source;
|
||||||
|
|
||||||
ProcessLineOfSight(source, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, true, false);
|
ProcessLineOfSight(source, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, true, false);
|
||||||
CWorld::bIncludeDeadPeds = false;
|
CWorld::bIncludeDeadPeds = false;
|
||||||
CWorld::pIgnoreEntity = NULL;
|
CWorld::pIgnoreEntity = nil;
|
||||||
CWorld::bIncludeCarTyres = false;
|
CWorld::bIncludeCarTyres = false;
|
||||||
|
|
||||||
CVector2D front(cam->Front.x, cam->Front.y);
|
CVector2D front(cam->Front.x, cam->Front.y);
|
||||||
@ -1688,7 +1689,7 @@ CWeapon::FireInstantHitFromCar(CAutomobile *shooter, bool left)
|
|||||||
victimPed->ClearAttackByRemovingAnim();
|
victimPed->ClearAttackByRemovingAnim();
|
||||||
|
|
||||||
CAnimBlendAssociation *asoc = CAnimManager::AddAnimation(victimPed->GetClump(), ASSOCGRP_STD, AnimationId(ANIM_SHOT_FRONT_PARTIAL + localDir));
|
CAnimBlendAssociation *asoc = CAnimManager::AddAnimation(victimPed->GetClump(), ASSOCGRP_STD, AnimationId(ANIM_SHOT_FRONT_PARTIAL + localDir));
|
||||||
ASSERT(asoc!=NULL);
|
ASSERT(asoc!=nil);
|
||||||
asoc->blendAmount = 0.0f;
|
asoc->blendAmount = 0.0f;
|
||||||
asoc->blendDelta = 8.0f;
|
asoc->blendDelta = 8.0f;
|
||||||
|
|
||||||
@ -1769,9 +1770,9 @@ CWeapon::FireInstantHitFromCar(CAutomobile *shooter, bool left)
|
|||||||
void
|
void
|
||||||
CWeapon::DoDoomAiming(CEntity *shooter, CVector *source, CVector *target)
|
CWeapon::DoDoomAiming(CEntity *shooter, CVector *source, CVector *target)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
ASSERT(source!=NULL);
|
ASSERT(source!=nil);
|
||||||
ASSERT(target !=NULL);
|
ASSERT(target !=nil);
|
||||||
|
|
||||||
#ifndef FIX_BUGS
|
#ifndef FIX_BUGS
|
||||||
CEntity entity; // unused
|
CEntity entity; // unused
|
||||||
@ -1791,7 +1792,7 @@ CWeapon::DoDoomAiming(CEntity *shooter, CVector *source, CVector *target)
|
|||||||
for ( int32 i = 0; i < lastEntity; i++ )
|
for ( int32 i = 0; i < lastEntity; i++ )
|
||||||
{
|
{
|
||||||
CEntity *victim = entities[i];
|
CEntity *victim = entities[i];
|
||||||
ASSERT(victim!=NULL);
|
ASSERT(victim!=nil);
|
||||||
|
|
||||||
if ( (CEntity*)shooterPed != victim && shooterPed->CanSeeEntity(victim, DEGTORAD(22.5f)) )
|
if ( (CEntity*)shooterPed != victim && shooterPed->CanSeeEntity(victim, DEGTORAD(22.5f)) )
|
||||||
{
|
{
|
||||||
@ -1820,7 +1821,7 @@ CWeapon::DoDoomAiming(CEntity *shooter, CVector *source, CVector *target)
|
|||||||
if ( closestEntityDist < DOOMAUTOAIMING_MAXDIST )
|
if ( closestEntityDist < DOOMAUTOAIMING_MAXDIST )
|
||||||
{
|
{
|
||||||
CEntity *victim = entities[closestEntity];
|
CEntity *victim = entities[closestEntity];
|
||||||
ASSERT(victim !=NULL);
|
ASSERT(victim !=nil);
|
||||||
|
|
||||||
float distToTarget = (*target - *source).Magnitude2D();
|
float distToTarget = (*target - *source).Magnitude2D();
|
||||||
float distToSource = (victim->GetPosition() - *source).Magnitude2D();
|
float distToSource = (victim->GetPosition() - *source).Magnitude2D();
|
||||||
@ -1839,10 +1840,10 @@ CWeapon::DoDoomAiming(CEntity *shooter, CVector *source, CVector *target)
|
|||||||
void
|
void
|
||||||
CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CVector *target)
|
CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CVector *target)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
ASSERT(driver!=NULL);
|
ASSERT(driver!=nil);
|
||||||
ASSERT(source!=NULL);
|
ASSERT(source!=nil);
|
||||||
ASSERT(target!=NULL);
|
ASSERT(target!=nil);
|
||||||
|
|
||||||
#ifndef FIX_BUGS
|
#ifndef FIX_BUGS
|
||||||
CEntity entity; // unused
|
CEntity entity; // unused
|
||||||
@ -1861,7 +1862,7 @@ CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CV
|
|||||||
{
|
{
|
||||||
CEntity *victim = entities[i];
|
CEntity *victim = entities[i];
|
||||||
|
|
||||||
ASSERT(victim!=NULL);
|
ASSERT(victim!=nil);
|
||||||
|
|
||||||
if ( shooter != victim && driver != victim )
|
if ( shooter != victim && driver != victim )
|
||||||
{
|
{
|
||||||
@ -1896,7 +1897,7 @@ CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CV
|
|||||||
if ( closestEntityDist < DOOMAUTOAIMING_MAXDIST )
|
if ( closestEntityDist < DOOMAUTOAIMING_MAXDIST )
|
||||||
{
|
{
|
||||||
CEntity *victim = entities[closestEntity];
|
CEntity *victim = entities[closestEntity];
|
||||||
ASSERT(victim!=NULL);
|
ASSERT(victim!=nil);
|
||||||
|
|
||||||
float distToTarget = (*target - *source).Magnitude2D();
|
float distToTarget = (*target - *source).Magnitude2D();
|
||||||
float distToSource = (victim->GetPosition() - *source).Magnitude2D();
|
float distToSource = (victim->GetPosition() - *source).Magnitude2D();
|
||||||
@ -1908,9 +1909,9 @@ CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CV
|
|||||||
void
|
void
|
||||||
CWeapon::DoDriveByAutoAiming(CEntity *shooter, CVector *source, CVector *target)
|
CWeapon::DoDriveByAutoAiming(CEntity *shooter, CVector *source, CVector *target)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
ASSERT(source!=NULL);
|
ASSERT(source!=nil);
|
||||||
ASSERT(target!=NULL);
|
ASSERT(target!=nil);
|
||||||
|
|
||||||
#ifndef FIX_BUGS
|
#ifndef FIX_BUGS
|
||||||
CEntity entity; // unused
|
CEntity entity; // unused
|
||||||
@ -1930,7 +1931,7 @@ CWeapon::DoDriveByAutoAiming(CEntity *shooter, CVector *source, CVector *target)
|
|||||||
for ( int32 i = 0; i < lastEntity; i++ )
|
for ( int32 i = 0; i < lastEntity; i++ )
|
||||||
{
|
{
|
||||||
CEntity *victim = entities[i];
|
CEntity *victim = entities[i];
|
||||||
ASSERT(victim!=NULL);
|
ASSERT(victim!=nil);
|
||||||
|
|
||||||
if ( shooter != victim )
|
if ( shooter != victim )
|
||||||
{
|
{
|
||||||
@ -1949,7 +1950,7 @@ CWeapon::DoDriveByAutoAiming(CEntity *shooter, CVector *source, CVector *target)
|
|||||||
if ( closestEntityDist < DRIVEBYAUTOAIMING_MAXDIST )
|
if ( closestEntityDist < DRIVEBYAUTOAIMING_MAXDIST )
|
||||||
{
|
{
|
||||||
CEntity *victim = entities[closestEntity];
|
CEntity *victim = entities[closestEntity];
|
||||||
ASSERT(victim!=NULL);
|
ASSERT(victim!=nil);
|
||||||
|
|
||||||
float distToTarget = (*source - *target).Magnitude();
|
float distToTarget = (*source - *target).Magnitude();
|
||||||
float distToSource = (*source - victim->GetPosition()).Magnitude();
|
float distToSource = (*source - victim->GetPosition()).Magnitude();
|
||||||
@ -2025,8 +2026,8 @@ CWeapon::Update(int32 audioEntity)
|
|||||||
void
|
void
|
||||||
FireOneInstantHitRound(CVector *source, CVector *target, int32 damage)
|
FireOneInstantHitRound(CVector *source, CVector *target, int32 damage)
|
||||||
{
|
{
|
||||||
ASSERT(source!=NULL);
|
ASSERT(source!=nil);
|
||||||
ASSERT(target!=NULL);
|
ASSERT(target!=nil);
|
||||||
|
|
||||||
CParticle::AddParticle(PARTICLE_GUNFLASH, *source, CVector(0.0f, 0.0f, 0.0f));
|
CParticle::AddParticle(PARTICLE_GUNFLASH, *source, CVector(0.0f, 0.0f, 0.0f));
|
||||||
|
|
||||||
@ -2055,11 +2056,11 @@ FireOneInstantHitRound(CVector *source, CVector *target, int32 damage)
|
|||||||
victimPed->ClearAttackByRemovingAnim();
|
victimPed->ClearAttackByRemovingAnim();
|
||||||
|
|
||||||
CAnimBlendAssociation *asoc = CAnimManager::AddAnimation(victimPed->GetClump(), ASSOCGRP_STD, AnimationId(ANIM_SHOT_FRONT_PARTIAL + localDir));
|
CAnimBlendAssociation *asoc = CAnimManager::AddAnimation(victimPed->GetClump(), ASSOCGRP_STD, AnimationId(ANIM_SHOT_FRONT_PARTIAL + localDir));
|
||||||
ASSERT(asoc!=NULL);
|
ASSERT(asoc!=nil);
|
||||||
asoc->blendAmount = 0.0f;
|
asoc->blendAmount = 0.0f;
|
||||||
asoc->blendDelta = 8.0f;
|
asoc->blendDelta = 8.0f;
|
||||||
|
|
||||||
victimPed->InflictDamage(NULL, WEAPONTYPE_UZI, damage, (ePedPieceTypes)point.pieceB, localDir);
|
victimPed->InflictDamage(nil, WEAPONTYPE_UZI, damage, (ePedPieceTypes)point.pieceB, localDir);
|
||||||
|
|
||||||
pos.z += 0.8f;
|
pos.z += 0.8f;
|
||||||
|
|
||||||
@ -2081,7 +2082,7 @@ FireOneInstantHitRound(CVector *source, CVector *target, int32 damage)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( victim->IsVehicle() )
|
else if ( victim->IsVehicle() )
|
||||||
((CVehicle *)victim)->InflictDamage(NULL, WEAPONTYPE_UZI, damage);
|
((CVehicle *)victim)->InflictDamage(nil, WEAPONTYPE_UZI, damage);
|
||||||
//BUG ? no CGlass::WasGlassHitByBullet
|
//BUG ? no CGlass::WasGlassHitByBullet
|
||||||
|
|
||||||
switch ( victim->m_type )
|
switch ( victim->m_type )
|
||||||
@ -2141,9 +2142,9 @@ CWeapon::IsType2Handed(void)
|
|||||||
void
|
void
|
||||||
CWeapon::MakePedsJumpAtShot(CPhysical *shooter, CVector *source, CVector *target)
|
CWeapon::MakePedsJumpAtShot(CPhysical *shooter, CVector *source, CVector *target)
|
||||||
{
|
{
|
||||||
ASSERT(shooter!=NULL);
|
ASSERT(shooter!=nil);
|
||||||
ASSERT(source!=NULL);
|
ASSERT(source!=nil);
|
||||||
ASSERT(target!=NULL);
|
ASSERT(target!=nil);
|
||||||
|
|
||||||
float minx = min(source->x, target->x) - 2.0f;
|
float minx = min(source->x, target->x) - 2.0f;
|
||||||
float maxx = max(source->x, target->x) + 2.0f;
|
float maxx = max(source->x, target->x) + 2.0f;
|
||||||
@ -2172,8 +2173,8 @@ CWeapon::MakePedsJumpAtShot(CPhysical *shooter, CVector *source, CVector *target
|
|||||||
bool
|
bool
|
||||||
CWeapon::HitsGround(CEntity *holder, CVector *fireSource, CEntity *aimingTo)
|
CWeapon::HitsGround(CEntity *holder, CVector *fireSource, CEntity *aimingTo)
|
||||||
{
|
{
|
||||||
ASSERT(holder!=NULL);
|
ASSERT(holder!=nil);
|
||||||
ASSERT(aimingTo!=NULL);
|
ASSERT(aimingTo!=nil);
|
||||||
|
|
||||||
if (!holder->IsPed() || !((CPed*)holder)->m_pSeekTarget)
|
if (!holder->IsPed() || !((CPed*)holder)->m_pSeekTarget)
|
||||||
return false;
|
return false;
|
||||||
@ -2193,7 +2194,7 @@ CWeapon::HitsGround(CEntity *holder, CVector *fireSource, CEntity *aimingTo)
|
|||||||
source = holder->GetMatrix() * adjustedOffset;
|
source = holder->GetMatrix() * adjustedOffset;
|
||||||
|
|
||||||
CEntity *aimEntity = aimingTo ? aimingTo : ((CPed*)holder)->m_pSeekTarget;
|
CEntity *aimEntity = aimingTo ? aimingTo : ((CPed*)holder)->m_pSeekTarget;
|
||||||
ASSERT(aimEntity!=NULL);
|
ASSERT(aimEntity!=nil);
|
||||||
|
|
||||||
target = aimEntity->GetPosition();
|
target = aimEntity->GetPosition();
|
||||||
target.z += 0.6f;
|
target.z += 0.6f;
|
||||||
|
Loading…
Reference in New Issue
Block a user