summaryrefslogtreecommitdiffstats
path: root/src/weapons
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-13 16:55:12 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-13 16:55:12 +0200
commitd4265884966496f3e1ab64cb61097555e43a549c (patch)
tree960d3b27ea4f34958599bfc26fe3dc07e34f03ba /src/weapons
parentped attractor: start (diff)
parentMerge branch 'master' into miami (diff)
downloadre3-d4265884966496f3e1ab64cb61097555e43a549c.tar
re3-d4265884966496f3e1ab64cb61097555e43a549c.tar.gz
re3-d4265884966496f3e1ab64cb61097555e43a549c.tar.bz2
re3-d4265884966496f3e1ab64cb61097555e43a549c.tar.lz
re3-d4265884966496f3e1ab64cb61097555e43a549c.tar.xz
re3-d4265884966496f3e1ab64cb61097555e43a549c.tar.zst
re3-d4265884966496f3e1ab64cb61097555e43a549c.zip
Diffstat (limited to 'src/weapons')
-rw-r--r--src/weapons/BulletInfo.cpp1
-rw-r--r--src/weapons/ProjectileInfo.cpp3
-rw-r--r--src/weapons/Weapon.cpp36
-rw-r--r--src/weapons/WeaponInfo.cpp10
4 files changed, 39 insertions, 11 deletions
diff --git a/src/weapons/BulletInfo.cpp b/src/weapons/BulletInfo.cpp
index 92d98a50..389e7486 100644
--- a/src/weapons/BulletInfo.cpp
+++ b/src/weapons/BulletInfo.cpp
@@ -200,6 +200,7 @@ void CBulletInfo::Update(void)
case ENTITY_TYPE_VEHICLE:
DMAudio.PlayOneShot(((CVehicle*)pHitEntity)->m_audioEntityId, SOUND_WEAPON_HIT_VEHICLE, 1.0f);
break;
+ default: break;
}
}
CGlass::WasGlassHitByBullet(pHitEntity, point.point);
diff --git a/src/weapons/ProjectileInfo.cpp b/src/weapons/ProjectileInfo.cpp
index 8297d953..47bc65ac 100644
--- a/src/weapons/ProjectileInfo.cpp
+++ b/src/weapons/ProjectileInfo.cpp
@@ -116,6 +116,7 @@ CProjectileInfo::AddProjectile(CEntity *entity, eWeaponType weapon, CVector pos,
elasticity = 0.5f;
break;
}
+ default: break;
}
int i = 0;
@@ -137,6 +138,7 @@ CProjectileInfo::AddProjectile(CEntity *entity, eWeaponType weapon, CVector pos,
case WEAPONTYPE_GRENADE:
ms_apProjectile[i] = new CProjectile(MI_GRENADE);
break;
+ default: break;
}
if (ms_apProjectile[i] == nil)
@@ -183,6 +185,7 @@ CProjectileInfo::RemoveNotAdd(CEntity *entity, eWeaponType weaponType, CVector p
case WEAPONTYPE_ROCKETLAUNCHER:
CExplosion::AddExplosion(nil, entity, EXPLOSION_ROCKET, pos, 0);
break;
+ default: break;
}
}
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index f64368f6..8ce39ceb 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -806,6 +806,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
break;
}
+ default: break;
}
DoBulletImpact(shooter, victim, fireSource, &target, &point, ahead);
@@ -997,9 +998,13 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
for ( int32 i = 0; i < 16; i++ )
CParticle::AddParticle(PARTICLE_SPARK, point->point, point->normal*0.05f);
- CVector dist = point->point - (*source);
- CVector offset = dist - Max(0.2f*dist.Magnitude(), 2.0f) * CVector(ahead.x, ahead.y, 0.0f);
- CVector smokePos = *source + offset;
+#ifndef FIX_BUGS
+ CVector dist = point->point - (*source);
+ CVector offset = dist - Max(0.2f * dist.Magnitude(), 2.0f) * CVector(ahead.x, ahead.y, 0.0f);
+ CVector smokePos = *source + offset;
+#else
+ CVector smokePos = point->point;
+#endif // !FIX_BUGS
smokePos.x += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
smokePos.y += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
@@ -1016,9 +1021,13 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
for ( int32 i = 0; i < 16; i++ )
CParticle::AddParticle(PARTICLE_SPARK, point->point, point->normal*0.05f);
+#ifndef FIX_BUGS
CVector dist = point->point - (*source);
CVector offset = dist - Max(0.2f*dist.Magnitude(), 0.5f) * CVector(ahead.x, ahead.y, 0.0f);
- CVector smokePos = *source + offset;
+ CVector smokePos = *source + offset;
+#else
+ CVector smokePos = point->point;
+#endif // !FIX_BUGS
CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f));
@@ -1062,6 +1071,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
break;
}
+ default: break;
}
}
@@ -1093,6 +1103,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
PlayOneShotScriptObject(SCRIPT_SOUND_BULLET_HIT_GROUND_3, point->point);
break;
}
+ default: break;
}
}
else
@@ -1230,7 +1241,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
if ( cantStandup )
victimPed->SetFall(1500, AnimationId(ANIM_KO_SKID_FRONT + localDir), false);
- victimPed->InflictDamage(nil, m_eWeaponType, info->m_nDamage, (ePedPieceTypes)point.pieceB, localDir);
+ victimPed->InflictDamage(shooter, 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);
@@ -1265,9 +1276,13 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
for ( int32 i = 0; i < 16; i++ )
CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal*0.05f);
+#ifndef FIX_BUGS
CVector dist = point.point - (*fireSource);
CVector offset = dist - Max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
CVector smokePos = *fireSource + offset;
+#else
+ CVector smokePos = point.point;
+#endif
CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f));
@@ -1280,9 +1295,13 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
for ( int32 i = 0; i < 16; i++ )
CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal*0.05f);
+#ifndef FIX_BUGS
CVector dist = point.point - (*fireSource);
CVector offset = dist - Max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
- CVector smokePos = *fireSource + offset;
+ CVector smokePos = *fireSource + offset;
+#else
+ CVector smokePos = point.point;
+#endif
smokePos.x += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
smokePos.y += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
@@ -1312,6 +1331,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
break;
}
+ default: break;
}
}
@@ -1343,6 +1363,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
PlayOneShotScriptObject(SCRIPT_SOUND_BULLET_HIT_GROUND_3, point.point);
break;
}
+ default: break;
}
}
else
@@ -1752,6 +1773,7 @@ CWeapon::FireInstantHitFromCar(CAutomobile *shooter, bool left)
PlayOneShotScriptObject(SCRIPT_SOUND_BULLET_HIT_GROUND_3, point.point);
break;
}
+ default: break;
}
}
else
@@ -2021,6 +2043,7 @@ CWeapon::Update(int32 audioEntity)
break;
}
+ default: break;
}
}
@@ -2115,6 +2138,7 @@ FireOneInstantHitRound(CVector *source, CVector *target, int32 damage)
PlayOneShotScriptObject(SCRIPT_SOUND_BULLET_HIT_GROUND_3, point.point);
break;
}
+ default: break;
}
}
else
diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp
index aec9c69a..c4ab75d2 100644
--- a/src/weapons/WeaponInfo.cpp
+++ b/src/weapons/WeaponInfo.cpp
@@ -105,8 +105,8 @@ CWeaponInfo::LoadWeaponData(void)
sscanf(
&line[lp],
"%s %s %f %d %d %d %d %f %f %f %f %f %f %f %s %s %f %f %f %f %d %d",
- &weaponName,
- &fireType,
+ weaponName,
+ fireType,
&range,
&firingRate,
&reload,
@@ -119,8 +119,8 @@ CWeaponInfo::LoadWeaponData(void)
&fireOffsetX,
&fireOffsetY,
&fireOffsetZ,
- &animToPlay,
- &anim2ToPlay,
+ animToPlay,
+ anim2ToPlay,
&animLoopStart,
&animLoopEnd,
&delayBetweenAnimAndFire,
@@ -201,4 +201,4 @@ CWeaponInfo::Shutdown(void)
{
debug("Shutting down CWeaponInfo...\n");
debug("CWeaponInfo shut down\n");
-} \ No newline at end of file
+}