weapon cosmetic fix

This commit is contained in:
Fire-Head 2020-04-15 19:43:16 +03:00
parent 7c13d72edc
commit 85fe445fef

View File

@ -32,26 +32,28 @@
uint16 gReloadSampleTime[WEAPONTYPE_TOTAL_INVENTORY_WEAPONS] =
{
/*UNARMED*/ 0,
/*BASEBALLBAT*/ 0,
/*COLT45*/ 250,
/*UZI*/ 400,
/*SHOTGUN*/ 650,
/*AK47*/ 300,
/*M16*/ 300,
/*SNIPERRIFLE*/ 423,
/*ROCKETLAUNCHER*/ 400,
/*FLAMETHROWER*/ 0,
/*MOLOTOV*/ 0,
/*GRENADE*/ 0,
/*DETONATOR*/ 0
0, // UNARMED
0, // BASEBALLBAT
250, // COLT45
400, // UZI
650, // SHOTGUN
300, // AK47
300, // M16
423, // SNIPERRIFLE
400, // ROCKETLAUNCHER
0, // FLAMETHROWER
0, // MOLOTOV
0, // GRENADE
0, // DETONATOR
0 // WEAPONTYPE_HELICANNON
};
CWeaponInfo *
CWeapon::GetInfo()
{
CWeaponInfo *info = CWeaponInfo::GetWeaponInfo(m_eWeaponType);
ASSERT(info!=NULL);
ASSERT(info!=nil);
return info;
}
@ -101,7 +103,7 @@ CWeapon::Initialise(eWeaponType type, int32 ammo)
bool
CWeapon::Fire(CEntity *shooter, CVector *fireSource)
{
ASSERT(shooter!=NULL);
ASSERT(shooter!=nil);
CVector fireOffset(0.0f, 0.0f, 0.6f);
CVector *source = fireSource;
@ -164,7 +166,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
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();
@ -188,7 +190,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
if ( m_eWeaponType == WEAPONTYPE_GRENADE )
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 power = clamp((distToTarget-10.0f)*0.02f, 0.2f, 1.0f);
@ -304,7 +306,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
bool
CWeapon::FireFromCar(CAutomobile *shooter, bool left)
{
ASSERT(shooter!=NULL);
ASSERT(shooter!=nil);
if ( m_eWeaponState != WEAPONSTATE_READY && m_eWeaponState != WEAPONSTATE_FIRING )
return false;
@ -343,7 +345,7 @@ CWeapon::FireFromCar(CAutomobile *shooter, bool left)
bool
CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
{
ASSERT(shooter!=NULL);
ASSERT(shooter!=nil);
CWeaponInfo *info = GetInfo();
@ -358,7 +360,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
for ( int32 i = 0; i < shooterPed->m_numNearPeds; i++ )
{
CPed *victimPed = shooterPed->m_nearPeds[i];
ASSERT(victimPed!=NULL);
ASSERT(victimPed!=nil);
if ( (victimPed->m_nPedType != shooterPed->m_nPedType || victimPed == shooterPed->m_pSeekTarget)
&& victimPed != shooterPed->m_leader || !(CGeneral::GetRandomNumber() & 31) )
@ -369,7 +371,6 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
if ( victimPed->OnGround() || !victimPed->IsPedHeadAbovePos(-0.3f) )
victimPedCol = &CTempColModels::ms_colModelPedGroundHit;
ASSERT(victimPedCol!=NULL);
float victimPedRadius = victimPed->GetBoundRadius() + info->m_fRadius;
if ( victimPed->bUsesCollision || victimPed->Dead() || victimPed->Driving() )
@ -398,7 +399,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
if ( collided )
{
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);
@ -497,14 +498,14 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
bool
CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
{
ASSERT(shooter!=NULL);
ASSERT(fireSource!=NULL);
ASSERT(shooter!=nil);
ASSERT(fireSource!=nil);
CWeaponInfo *info = GetInfo();
CVector source, target;
CColPoint point;
CEntity *victim = NULL;
CEntity *victim = nil;
float heading = RADTODEG(shooter->GetForward().Heading());
float angle = DEGTORAD(heading);
@ -587,7 +588,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
if ( CHeli::TestBulletCollision(&src, &trgt, &bulletPos, 4) )
{
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
@ -615,7 +616,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
if ( CHeli::TestBulletCollision(fireSource, &target, &bulletPos, 4) )
{
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;
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);
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);
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);
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;
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);
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);
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);
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 += 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), NULL, 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), NULL, 0.02f);
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), NULL, 0.02f);
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), NULL, 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), NULL, 0.02f);
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), 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));
offset.Normalise2D();
@ -708,20 +709,20 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
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), 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);
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);
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 += 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), 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);
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);
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;
float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
@ -748,19 +749,19 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
if ( shooterMoving )
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);
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);
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);
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);
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);
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);
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;
float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
@ -786,16 +787,16 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
if ( shooterMoving )
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);
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);
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;
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.15f, ahead.y*0.15f, 0.0f), NULL, 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.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), nil, 0.015f);
CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(ahead.x*0.20f, ahead.y*0.20f, 0.0f), nil, 0.025f);
CVector gunshellPos = *fireSource;
gunshellPos -= CVector(0.2f*ahead.x, 0.2f*ahead.y, 0.0f);
@ -815,9 +816,9 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
void
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;
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;
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
{
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,
CVector *source, CVector *target, CColPoint *point, CVector2D ahead)
{
ASSERT(shooter!=NULL);
ASSERT(source!=NULL);
ASSERT(target!=NULL);
ASSERT(point!=NULL);
ASSERT(shooter!=nil);
ASSERT(source!=nil);
ASSERT(target!=nil);
ASSERT(point!=nil);
CWeaponInfo *info = GetInfo();
@ -859,7 +860,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
CVector traceTarget = *target;
CBulletTraces::AddTrace(source, &traceTarget);
if ( shooter != NULL )
if ( shooter != nil )
{
if ( shooter == FindPlayerPed() )
{
@ -908,7 +909,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
victimPed->ClearAttackByRemovingAnim();
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->blendDelta = 8.0f;
@ -924,7 +925,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
victimPed->ClearAttackByRemovingAnim();
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->blendDelta = 8.0f;
@ -1106,8 +1107,8 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
bool
CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
{
ASSERT(shooter!=NULL);
ASSERT(fireSource!=NULL);
ASSERT(shooter!=nil);
ASSERT(fireSource!=nil);
CWeaponInfo *info = GetInfo();
@ -1119,18 +1120,18 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
CVector gunflashPos = *fireSource;
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);
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);
CParticle::AddParticle(PARTICLE_GUNFLASH, gunflashPos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.2f);
CParticle::AddParticle(PARTICLE_GUNFLASH, *fireSource, CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f);
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), nil, 0.0f);
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.15f, rotOffset.y*0.15f, 0.0f), NULL, 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.25f, rotOffset.y*0.25f, 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), nil, 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), nil, 0.1f);
CEventList::RegisterEvent(EVENT_GUNSHOT, EVENT_ENTITY_PED, shooter, (CPed*)shooter, 1000);
@ -1139,7 +1140,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
float shooterAngle;
if ( shooter->IsPed() && ((CPed*)shooter)->m_pPointGunAt != NULL )
if ( shooter->IsPed() && ((CPed*)shooter)->m_pPointGunAt != nil )
{
CEntity *threatAttack = ((CPed*)shooter)->m_pPointGunAt;
shooterAngle = CGeneral::GetAngleBetweenPoints(threatAttack->GetPosition().x, threatAttack->GetPosition().y,
@ -1180,7 +1181,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
{
CPed *shooterPed = (CPed *)shooter;
if ( shooterPed->m_pPointGunAt == NULL )
if ( shooterPed->m_pPointGunAt == nil )
DoDoomAiming(shooter, fireSource, &target);
else
{
@ -1229,7 +1230,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
if ( cantStandup )
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 )
CEventList::RegisterEvent(EVENT_SHOOT_COP, EVENT_ENTITY_PED, victim, (CPed*)shooter, 10000);
@ -1361,8 +1362,8 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
bool
CWeapon::FireProjectile(CEntity *shooter, CVector *fireSource, float power)
{
ASSERT(shooter!=NULL);
ASSERT(fireSource!=NULL);
ASSERT(shooter!=nil);
ASSERT(fireSource!=nil);
CVector source, target;
@ -1418,7 +1419,7 @@ CWeapon::FireProjectile(CEntity *shooter, CVector *fireSource, float power)
source = shooter->GetPosition() - shooter->GetForward();
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);
else
CProjectileInfo::RemoveNotAdd(shooter, m_eWeaponType, *fireSource);
@ -1453,8 +1454,8 @@ CWeapon::GenerateFlameThrowerParticles(CVector pos, CVector dir)
bool
CWeapon::FireAreaEffect(CEntity *shooter, CVector *fireSource)
{
ASSERT(shooter!=NULL);
ASSERT(fireSource!=NULL);
ASSERT(shooter!=nil);
ASSERT(fireSource!=nil);
CWeaponInfo *info = GetInfo();
@ -1486,7 +1487,7 @@ CWeapon::FireAreaEffect(CEntity *shooter, CVector *fireSource)
bool
CWeapon::FireSniper(CEntity *shooter)
{
ASSERT(shooter!=NULL);
ASSERT(shooter!=nil);
int16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
if (!( mode == CCam::MODE_M16_1STPERSON
@ -1504,7 +1505,7 @@ CWeapon::FireSniper(CEntity *shooter)
#endif
CCam *cam = &TheCamera.Cams[TheCamera.ActiveCam];
ASSERT(cam!=NULL);
ASSERT(cam!=nil);
CVector source = cam->Source;
CVector dir = cam->Front;
@ -1536,7 +1537,7 @@ CWeapon::FireSniper(CEntity *shooter)
bool
CWeapon::FireM16_1stPerson(CEntity *shooter)
{
ASSERT(shooter!=NULL);
ASSERT(shooter!=nil);
int16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
@ -1561,14 +1562,14 @@ CWeapon::FireM16_1stPerson(CEntity *shooter)
CWorld::bIncludeDeadPeds = true;
CCam *cam = &TheCamera.Cams[TheCamera.ActiveCam];
ASSERT(cam!=NULL);
ASSERT(cam!=nil);
CVector source = cam->Source;
CVector target = cam->Front*info->m_fRange + source;
ProcessLineOfSight(source, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, true, false);
CWorld::bIncludeDeadPeds = false;
CWorld::pIgnoreEntity = NULL;
CWorld::pIgnoreEntity = nil;
CWorld::bIncludeCarTyres = false;
CVector2D front(cam->Front.x, cam->Front.y);
@ -1688,7 +1689,7 @@ CWeapon::FireInstantHitFromCar(CAutomobile *shooter, bool left)
victimPed->ClearAttackByRemovingAnim();
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->blendDelta = 8.0f;
@ -1769,9 +1770,9 @@ CWeapon::FireInstantHitFromCar(CAutomobile *shooter, bool left)
void
CWeapon::DoDoomAiming(CEntity *shooter, CVector *source, CVector *target)
{
ASSERT(shooter!=NULL);
ASSERT(source!=NULL);
ASSERT(target !=NULL);
ASSERT(shooter!=nil);
ASSERT(source!=nil);
ASSERT(target !=nil);
#ifndef FIX_BUGS
CEntity entity; // unused
@ -1791,7 +1792,7 @@ CWeapon::DoDoomAiming(CEntity *shooter, CVector *source, CVector *target)
for ( int32 i = 0; i < lastEntity; i++ )
{
CEntity *victim = entities[i];
ASSERT(victim!=NULL);
ASSERT(victim!=nil);
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 )
{
CEntity *victim = entities[closestEntity];
ASSERT(victim !=NULL);
ASSERT(victim !=nil);
float distToTarget = (*target - *source).Magnitude2D();
float distToSource = (victim->GetPosition() - *source).Magnitude2D();
@ -1839,10 +1840,10 @@ CWeapon::DoDoomAiming(CEntity *shooter, CVector *source, CVector *target)
void
CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CVector *target)
{
ASSERT(shooter!=NULL);
ASSERT(driver!=NULL);
ASSERT(source!=NULL);
ASSERT(target!=NULL);
ASSERT(shooter!=nil);
ASSERT(driver!=nil);
ASSERT(source!=nil);
ASSERT(target!=nil);
#ifndef FIX_BUGS
CEntity entity; // unused
@ -1861,7 +1862,7 @@ CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CV
{
CEntity *victim = entities[i];
ASSERT(victim!=NULL);
ASSERT(victim!=nil);
if ( shooter != victim && driver != victim )
{
@ -1896,7 +1897,7 @@ CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CV
if ( closestEntityDist < DOOMAUTOAIMING_MAXDIST )
{
CEntity *victim = entities[closestEntity];
ASSERT(victim!=NULL);
ASSERT(victim!=nil);
float distToTarget = (*target - *source).Magnitude2D();
float distToSource = (victim->GetPosition() - *source).Magnitude2D();
@ -1908,9 +1909,9 @@ CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CV
void
CWeapon::DoDriveByAutoAiming(CEntity *shooter, CVector *source, CVector *target)
{
ASSERT(shooter!=NULL);
ASSERT(source!=NULL);
ASSERT(target!=NULL);
ASSERT(shooter!=nil);
ASSERT(source!=nil);
ASSERT(target!=nil);
#ifndef FIX_BUGS
CEntity entity; // unused
@ -1930,7 +1931,7 @@ CWeapon::DoDriveByAutoAiming(CEntity *shooter, CVector *source, CVector *target)
for ( int32 i = 0; i < lastEntity; i++ )
{
CEntity *victim = entities[i];
ASSERT(victim!=NULL);
ASSERT(victim!=nil);
if ( shooter != victim )
{
@ -1949,7 +1950,7 @@ CWeapon::DoDriveByAutoAiming(CEntity *shooter, CVector *source, CVector *target)
if ( closestEntityDist < DRIVEBYAUTOAIMING_MAXDIST )
{
CEntity *victim = entities[closestEntity];
ASSERT(victim!=NULL);
ASSERT(victim!=nil);
float distToTarget = (*source - *target).Magnitude();
float distToSource = (*source - victim->GetPosition()).Magnitude();
@ -2025,8 +2026,8 @@ CWeapon::Update(int32 audioEntity)
void
FireOneInstantHitRound(CVector *source, CVector *target, int32 damage)
{
ASSERT(source!=NULL);
ASSERT(target!=NULL);
ASSERT(source!=nil);
ASSERT(target!=nil);
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();
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->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;
@ -2081,7 +2082,7 @@ FireOneInstantHitRound(CVector *source, CVector *target, int32 damage)
}
}
else if ( victim->IsVehicle() )
((CVehicle *)victim)->InflictDamage(NULL, WEAPONTYPE_UZI, damage);
((CVehicle *)victim)->InflictDamage(nil, WEAPONTYPE_UZI, damage);
//BUG ? no CGlass::WasGlassHitByBullet
switch ( victim->m_type )
@ -2141,9 +2142,9 @@ CWeapon::IsType2Handed(void)
void
CWeapon::MakePedsJumpAtShot(CPhysical *shooter, CVector *source, CVector *target)
{
ASSERT(shooter!=NULL);
ASSERT(source!=NULL);
ASSERT(target!=NULL);
ASSERT(shooter!=nil);
ASSERT(source!=nil);
ASSERT(target!=nil);
float minx = min(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
CWeapon::HitsGround(CEntity *holder, CVector *fireSource, CEntity *aimingTo)
{
ASSERT(holder!=NULL);
ASSERT(aimingTo!=NULL);
ASSERT(holder!=nil);
ASSERT(aimingTo!=nil);
if (!holder->IsPed() || !((CPed*)holder)->m_pSeekTarget)
return false;
@ -2193,7 +2194,7 @@ CWeapon::HitsGround(CEntity *holder, CVector *fireSource, CEntity *aimingTo)
source = holder->GetMatrix() * adjustedOffset;
CEntity *aimEntity = aimingTo ? aimingTo : ((CPed*)holder)->m_pSeekTarget;
ASSERT(aimEntity!=NULL);
ASSERT(aimEntity!=nil);
target = aimEntity->GetPosition();
target.z += 0.6f;