diff options
Diffstat (limited to '')
-rw-r--r-- | src/weapons/Weapon.cpp | 258 | ||||
-rw-r--r-- | src/weapons/Weapon.h | 2 | ||||
-rw-r--r-- | src/weapons/WeaponInfo.cpp | 18 | ||||
-rw-r--r-- | src/weapons/WeaponType.h | 25 |
4 files changed, 239 insertions, 64 deletions
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 4c1f1c52..17cee83a 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -29,11 +29,13 @@ #include "WaterLevel.h" #include "WeaponInfo.h" #include "World.h" +#include "SurfaceTable.h" // TODO(Miami) #define AUDIO_NOT_READY -uint16 gReloadSampleTime[WEAPONTYPE_LAST_WEAPONTYPE] = +// TODO(Miami): Those are mostly placeholders!!! +uint16 gReloadSampleTime[] = { 0, // UNARMED 0, @@ -49,10 +51,14 @@ uint16 gReloadSampleTime[WEAPONTYPE_LAST_WEAPONTYPE] = 0, 0, // GRENADE 0, // DETONATEGRENADE + 0, // TEARGAS 0, // MOLOTOV 0, // ROCKET 250, // COLT45 + 250, // PYTHON 650, // SHOTGUN + 650, // SPAS12 SHOTGUN + 650, // STUBBY SHOTGUN 400, // TEC9 400, // UZIhec 400, // SILENCED_INGRAM @@ -60,10 +66,14 @@ uint16 gReloadSampleTime[WEAPONTYPE_LAST_WEAPONTYPE] = 300, // M16 300, // AK47 423, // SNIPERRIFLE + 423, // LASERSCOPE 400, // ROCKETLAUNCHER 0, // FLAMETHROWER + 0, // M60 + 0, // MINIGUN 0, // DETONATOR - 0 // HELICANNON + 0, // HELICANNON + 0 // CAMERA }; CWeaponInfo * @@ -176,6 +186,8 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource) switch ( m_eWeaponType ) { case WEAPONTYPE_SHOTGUN: + case WEAPONTYPE_SPAS12_SHOTGUN: + case WEAPONTYPE_STUBBY_SHOTGUN: { addFireRateAsDelay = true; fired = FireShotgun(shooter, source); @@ -184,12 +196,15 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource) } case WEAPONTYPE_COLT45: + case WEAPONTYPE_PYTHON: case WEAPONTYPE_UZI: case WEAPONTYPE_TEC9: case WEAPONTYPE_SILENCED_INGRAM: case WEAPONTYPE_MP5: - case WEAPONTYPE_AK47: - case WEAPONTYPE_M16: + case WEAPONTYPE_M4: + case WEAPONTYPE_RUGER: + case WEAPONTYPE_M60: + case WEAPONTYPE_MINIGUN: case WEAPONTYPE_HELICANNON: { if ((TheCamera.PlayerWeaponMode.Mode == CCam::MODE_HELICANNON_1STPERSON || TheCamera.PlayerWeaponMode.Mode == CCam::MODE_M16_1STPERSON) @@ -204,6 +219,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource) } case WEAPONTYPE_SNIPERRIFLE: + case WEAPONTYPE_LASERSCOPE: { fired = FireSniper(shooter); @@ -230,6 +246,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource) case WEAPONTYPE_MOLOTOV: case WEAPONTYPE_GRENADE: case WEAPONTYPE_DETONATOR_GRENADE: + case WEAPONTYPE_TEARGAS: { if ( shooter == FindPlayerPed() ) { @@ -800,7 +817,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource) CPed *threatAttack = (CPed*)shooterPed->m_pPointGunAt; if ( threatAttack->IsPed() ) { - threatAttack->m_pedIK.GetComponentPosition(target, PED_MID); + threatAttack->m_pedIK.GetComponentPosition((RwV3d)target, PED_MID); threatAttack->ReactToPointGun(shooter); } else @@ -842,7 +859,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource) CWorld::bIncludeDeadPeds = false; int32 rotSpeed = 1; - if ( m_eWeaponType == WEAPONTYPE_M16 ) + if ( m_eWeaponType == WEAPONTYPE_M4 ) rotSpeed = 4; CVector bulletPos; @@ -870,7 +887,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource) ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, true, false); int32 rotSpeed = 1; - if ( m_eWeaponType == WEAPONTYPE_M16 ) + if ( m_eWeaponType == WEAPONTYPE_M4 ) rotSpeed = 4; CVector bulletPos; @@ -895,10 +912,10 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource) switch ( m_eWeaponType ) { - case WEAPONTYPE_M16: - case WEAPONTYPE_AK47: - // case WEAPONTYPE_M60: - // case WEAPONTYPE_MINIGUN: + case WEAPONTYPE_M4: + case WEAPONTYPE_RUGER: + case WEAPONTYPE_M60: + case WEAPONTYPE_MINIGUN: case WEAPONTYPE_HELICANNON: { static uint8 counter = 0; @@ -1011,6 +1028,9 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource) } case WEAPONTYPE_COLT45: + case WEAPONTYPE_PYTHON: + case WEAPONTYPE_SNIPERRIFLE: + case WEAPONTYPE_LASERSCOPE: { CPointLights::AddLight(CPointLights::LIGHT_POINT, *fireSource, CVector(0.0f, 0.0f, 0.0f), 5.0f, @@ -1124,7 +1144,8 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim, } else { - if ( m_eWeaponType == WEAPONTYPE_SHOTGUN || m_eWeaponType == WEAPONTYPE_HELICANNON ) + if ( IsShotgun(m_eWeaponType) || m_eWeaponType == WEAPONTYPE_HELICANNON + || m_eWeaponType == WEAPONTYPE_M60 || m_eWeaponType == WEAPONTYPE_PYTHON) { posOffset.Normalise(); victimPed->bIsStanding = false; @@ -1149,7 +1170,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim, asoc->blendAmount = 0.0f; asoc->blendDelta = 8.0f; - if ( m_eWeaponType == WEAPONTYPE_AK47 || m_eWeaponType == WEAPONTYPE_M16 ) + if ( m_eWeaponType == WEAPONTYPE_M4 ) victimPlayer->m_nHitAnimDelayTimer = CTimer::GetTimeInMilliseconds() + 2500; else victimPlayer->m_nHitAnimDelayTimer = CTimer::GetTimeInMilliseconds() + 1000; @@ -1178,7 +1199,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim, if ( CGame::nastyGame ) { uint8 bloodAmount = 8; - if ( m_eWeaponType == WEAPONTYPE_SHOTGUN || m_eWeaponType == WEAPONTYPE_HELICANNON ) + if ( IsShotgun(m_eWeaponType) || m_eWeaponType == WEAPONTYPE_HELICANNON ) bloodAmount = 32; CVector dir = (point->point - victim->GetPosition()) * 0.01f; @@ -1394,10 +1415,35 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) else shooterAngle = RADTODEG(shooter->GetForward().Heading()); + int shootsAtOnce; + int checkObstacleOnShootNo; + float angleRange; + switch (m_eWeaponType) { + case WEAPONTYPE_SHOTGUN: + angleRange = DEGTORAD(9.0f); + checkObstacleOnShootNo = 1; + shootsAtOnce = 3; + break; + case WEAPONTYPE_SPAS12_SHOTGUN: + angleRange = DEGTORAD(6.0f); + checkObstacleOnShootNo = 1; + shootsAtOnce = 3; + break; + case WEAPONTYPE_STUBBY_SHOTGUN: + angleRange = DEGTORAD(18.0f); + checkObstacleOnShootNo = 2; + shootsAtOnce = 5; + break; + default: + break; + } + bool statUpdated = false; + float halfAngleRange = angleRange / 2.f; + float angleBetweenTwoShot = angleRange / (shootsAtOnce - 1.f); - for ( int32 i = 0; i < 5; i++ ) // five shoots at once + for ( int32 i = 0; i < shootsAtOnce; i++ ) { - float shootAngle = DEGTORAD(7.5f*i + shooterAngle - 15.0f); + float shootAngle = DEGTORAD(RADTODEG(halfAngleRange - angleBetweenTwoShot * i) + shooterAngle); CVector2D shootRot(-Sin(shootAngle), Cos(shootAngle)); CVector source, target; @@ -1409,12 +1455,17 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) TheCamera.Find3rdPersonCamTargetVector(1.0f, *fireSource, source, target); CVector Left = CrossProduct(TheCamera.Cams[TheCamera.ActiveCam].Front, TheCamera.Cams[TheCamera.ActiveCam].Up); - float f = float(i - 2) * (DEGTORAD(7.5f) / 2); + float f = (i - (shootsAtOnce / 2)) * angleBetweenTwoShot; target = f * Left + target - source; target *= info->m_fRange; target += source; + CWorld::bIncludeDeadPeds = true; + //bProcessVehicleWheels = true; // TODO(Miami): bProcessVehicleWheels + //bProcessPedsOnBoatsAndBikes = true; // TODO(Miami): bProcessPedsOnBoatsAndBikes - 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, false, false); // TODO(Miami): New parameter: ,true); + CWorld::bIncludeDeadPeds = false; + //bProcessVehicleWheels = false; // TODO(Miami): bProcessVehicleWheels } else { @@ -1430,24 +1481,84 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) DoDoomAiming(shooter, fireSource, &target); else { - float distToTarget = (shooterPed->m_pPointGunAt->GetPosition() - (*fireSource)).Magnitude2D(); - target.z += info->m_fRange / distToTarget * (shooterPed->m_pPointGunAt->GetPosition().z - target.z); + CVector pos; + if (shooterPed->m_pPointGunAt->IsPed()) { + ((CPed*)shooterPed->m_pPointGunAt)->m_pedIK.GetComponentPosition((RwV3d)pos, PED_MID); + } else { + pos = ((CPed*)shooterPed->m_pPointGunAt)->GetPosition(); + } + + float distToTarget = (pos - (*fireSource)).Magnitude2D(); + target.z += info->m_fRange / distToTarget * (pos.z - target.z); } } + if (shooter == FindPlayerPed()) + CWorld::bIncludeDeadPeds = true; - ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, true, false); + //bProcessPedsOnBoatsAndBikes = true; // TODO(Miami): bProcessPedsOnBoatsAndBikes + ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, false, false); // TODO(Miami): New parameter: ,true); + CWorld::bIncludeDeadPeds = false; } + //bProcessPedsOnBoatsAndBikes = false; // TODO(Miami): bProcessPedsOnBoatsAndBikes if ( victim ) { CGlass::WasGlassHitByBullet(victim, point.point); + CWeapon::BlowUpExplosiveThings(victim); + if (i == checkObstacleOnShootNo) + { + if (shooter) + { + if (shooter->IsPed() && !((CPed*)shooter)->IsPlayer()) + { + CPed *shooterPed = (CPed*)shooter; + CEntity *guyWePointGun = shooterPed->m_pPointGunAt; + if (guyWePointGun) + { + if (victim != guyWePointGun) + { + float distWithAim = (guyWePointGun->GetPosition() - shooter->GetPosition()).Magnitude(); + float distWithBullet = (point.point - shooter->GetPosition()).Magnitude(); + if (distWithAim > 0.1f && distWithBullet > 0.1f) + { + // Normalize + CVector aimDir = (guyWePointGun->GetPosition() - shooter->GetPosition()) * (1.0f / distWithAim); + CVector bulletDir = (point.point - shooter->GetPosition()) * (1.0f / distWithBullet); + + float dotProd = DotProduct(aimDir, bulletDir); + float aimAndBulletAngle; + if (dotProd <= 0.35f) + aimAndBulletAngle = PI; + else + aimAndBulletAngle = Acos(dotProd); + if (aimAndBulletAngle <= DEGTORAD(45.0f) && (aimAndBulletAngle <= DEGTORAD(15.0f) || distWithBullet / distWithAim >= 0.75f) && distWithBullet / distWithAim >= 0.99f) + { + shooterPed->bObstacleShowedUpDuringKillObjective = false; + shooterPed->m_shotTime = 0; + } + else + { + shooterPed->bObstacleShowedUpDuringKillObjective = true; + shooterPed->m_shootTimer = 0; + shooterPed->m_shotTime = CTimer::GetTimeInMilliseconds(); + if (distWithAim >= 10.0f) + shooterPed->SetAttackTimer(3000); + else + shooterPed->SetAttackTimer(1500); + } + } + } + } + } + } + } CBulletTraces::AddTrace(fireSource, &point.point); if ( victim->IsPed() ) { CPed *victimPed = (CPed *)victim; - if ( !victimPed->OnGround() && victim != shooter && victimPed->DoesLOSBulletHitPed(point) ) + if ( !victimPed->DyingOrDead() && victim != shooter ) { bool cantStandup = true; @@ -1460,7 +1571,8 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) posOffset.Normalise(); - if ( victimPed->m_getUpTimer > (CTimer::GetTimeInMilliseconds() - 3000) ) + if ( victimPed->m_getUpTimer > (CTimer::GetTimeInMilliseconds() - 3000) || + !victimPed->bCanBeShotInVehicle) cantStandup = false; if ( victimPed->bIsStanding && cantStandup ) @@ -1485,7 +1597,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) if ( CGame::nastyGame ) { uint8 bloodAmount = 8; - if ( m_eWeaponType == WEAPONTYPE_SHOTGUN ) + if ( m_eWeaponType == WEAPONTYPE_SHOTGUN || m_eWeaponType == WEAPONTYPE_SPAS12_SHOTGUN || m_eWeaponType == WEAPONTYPE_STUBBY_SHOTGUN) bloodAmount = 32; CVector dir = (point.point - victim->GetPosition()) * 0.01f; @@ -1497,6 +1609,36 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) CParticle::AddParticle(PARTICLE_BLOOD_SMALL, point.point, dir); } } + } else { + if (CGame::nastyGame) + { + CVector dir = (point.point - victim->GetPosition()) * 0.01f; + dir.z = 0.01f; + + if (victimPed->GetIsOnScreen()) + { + for (uint8 i = 0; i < 8; i++) + CParticle::AddParticle(PARTICLE_BLOOD_SMALL, point.point + CVector(0.0f, 0.0f, 0.15f), dir); + } + if (victimPed->Dead()) + { + CAnimBlendAssociation *hitAssoc; + if (RpAnimBlendClumpGetFirstAssociation(victimPed->GetClump(), ASSOC_FRONTAL)) + { + hitAssoc = CAnimManager::BlendAnimation(victimPed->GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT_F, 8.0f); + } + else + { + hitAssoc = CAnimManager::BlendAnimation(victimPed->GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT, 8.0f); + } + if (hitAssoc) + { + hitAssoc->SetCurrentTime(0.0f); + hitAssoc->SetRun(); + hitAssoc->flags &= ~ASSOC_DELETEFADEDOUT; + } + } + } } } else @@ -1505,21 +1647,29 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) { case ENTITY_TYPE_VEHICLE: { - ((CVehicle *)victim)->InflictDamage(shooter, m_eWeaponType, info->m_nDamage); + if (point.pieceB >= SURFACE_STREET_LIGHT && point.pieceB <= SURFACE_METAL_FENCE) { + ((CVehicle*)victim)->BurstTyre(point.pieceB); // TODO(Miami): New parameter: ,true); - for ( int32 i = 0; i < 16; i++ ) - CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal*0.05f); + for (int32 i = 0; i < 4; i++) + CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, point.point, point.normal * 0.05f); + } + else + { + ((CVehicle*)victim)->InflictDamage(shooter, m_eWeaponType, info->m_nDamage); + + 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 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; + CVector smokePos = point.point; #endif - CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f)); - + CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f)); + } break; } @@ -1549,13 +1699,15 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) if ( !victimObject->bInfiniteMass ) { - if ( victimObject->IsStatic() && victimObject->m_fUprootLimit <= 0.0f ) + bool notStatic = !victimObject->IsStatic(); + if ( notStatic && victimObject->m_fUprootLimit <= 0.0f ) { victimObject->bIsStatic = false; victimObject->AddToMovingList(); } - if ( !victimObject->IsStatic()) + notStatic = !victimObject->IsStatic(); + if ( !notStatic ) { CVector moveForce = point.normal*-5.0f; victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z); @@ -1578,17 +1730,29 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) } case ENTITY_TYPE_VEHICLE: { + if (!statUpdated) { + //CStats::NumBulletsHit++; // TODO(Miami): Stats + statUpdated = true; + } DMAudio.PlayOneShot(((CPhysical*)victim)->m_audioEntityId, SOUND_WEAPON_HIT_VEHICLE, 1.0f); break; } case ENTITY_TYPE_PED: { + if (!statUpdated) { + //CStats::NumBulletsHit++; // TODO(Miami): Stats + statUpdated = true; + } DMAudio.PlayOneShot(((CPhysical*)victim)->m_audioEntityId, SOUND_WEAPON_HIT_PED, 1.0f); ((CPed*)victim)->Say(SOUND_PED_BULLET_HIT); break; } case ENTITY_TYPE_OBJECT: { + if (!statUpdated) { + //CStats::NumBulletsHit++; // TODO(Miami): Stats + statUpdated = true; + } PlayOneShotScriptObject(SCRIPT_SOUND_BULLET_HIT_GROUND_2, point.point); break; } @@ -1837,8 +2001,7 @@ CWeapon::FireM16_1stPerson(CEntity *shooter) CVector bulletPos; - // TODO(Miami): M60 - if ( CHeli::TestBulletCollision(&source, &target, &bulletPos, (/*m_eWeaponType == WEAPONTYPE_M60 || */ m_eWeaponType == WEAPONTYPE_HELICANNON ? 20 : 4)) ) + if ( CHeli::TestBulletCollision(&source, &target, &bulletPos, (m_eWeaponType == WEAPONTYPE_M60 || m_eWeaponType == WEAPONTYPE_HELICANNON ? 20 : 4)) ) { for ( int32 i = 0; i < 16; i++ ) CParticle::AddParticle(PARTICLE_SPARK, bulletPos, CVector(0.0f, 0.0f, 0.0f)); @@ -1848,15 +2011,14 @@ CWeapon::FireM16_1stPerson(CEntity *shooter) { CPad::GetPad(0)->StartShake_Distance(240, 128, FindPlayerPed()->GetPosition().x, FindPlayerPed()->GetPosition().y, FindPlayerPed()->GetPosition().z); - // TODO(Miami) float mult; switch (m_eWeaponType) { - case WEAPONTYPE_M16: // case WEAPONTYPE_M4: + case WEAPONTYPE_M4: case WEAPONTYPE_HELICANNON: - // case WEAPONTYPE_M60: + case WEAPONTYPE_M60: mult = 0.0003f; break; - case WEAPONTYPE_AK47: // case WEAPONTYPE_RUGER: + case WEAPONTYPE_RUGER: mult = 0.00015f; break; default: @@ -2260,9 +2422,9 @@ CWeapon::Update(int32 audioEntity, CPed *pedToAdjustSound) case WEAPONSTATE_FIRING: { - if ( m_eWeaponType == WEAPONTYPE_SHOTGUN && AEHANDLE_IS_OK(audioEntity) ) + if ( IsShotgun(m_eWeaponType) && AEHANDLE_IS_OK(audioEntity) ) { - uint32 timePassed = m_nTimer - gReloadSampleTime[WEAPONTYPE_SHOTGUN]; + uint32 timePassed = m_nTimer - gReloadSampleTime[m_eWeaponType]; if ( CTimer::GetPreviousTimeInMilliseconds() < timePassed && CTimer::GetTimeInMilliseconds() >= timePassed ) DMAudio.PlayOneShot(audioEntity, SOUND_WEAPON_RELOAD, 0.0f); } @@ -2280,7 +2442,7 @@ CWeapon::Update(int32 audioEntity, CPed *pedToAdjustSound) case WEAPONSTATE_RELOADING: { - if ( AEHANDLE_IS_OK(audioEntity) && m_eWeaponType < WEAPONTYPE_LAST_WEAPONTYPE ) + if ( AEHANDLE_IS_OK(audioEntity) && m_eWeaponType < WEAPONTYPE_TOTALWEAPONS) { CAnimBlendAssociation *reloadAssoc = nil; if (pedToAdjustSound) { @@ -2461,11 +2623,9 @@ CWeapon::IsTypeMelee(void) bool CWeapon::IsType2Handed(void) { - // TODO(Miami): Uncomment - return m_eWeaponType == WEAPONTYPE_FLAMETHROWER || m_eWeaponType == WEAPONTYPE_HELICANNON || /* m_eWeaponType == WEAPONTYPE_M60 */ - m_eWeaponType == WEAPONTYPE_M16 || - (m_eWeaponType >= WEAPONTYPE_SHOTGUN && m_eWeaponType < WEAPONTYPE_TEC9) || // Shotguns - m_eWeaponType == WEAPONTYPE_AK47 || m_eWeaponType == WEAPONTYPE_SNIPERRIFLE /*|| m_eWeaponType == WEAPONTYPE_LASERSCOPE*/; + return m_eWeaponType == WEAPONTYPE_FLAMETHROWER || m_eWeaponType == WEAPONTYPE_HELICANNON || m_eWeaponType == WEAPONTYPE_M60 || + m_eWeaponType == WEAPONTYPE_M4 || IsShotgun(m_eWeaponType) || + m_eWeaponType == WEAPONTYPE_RUGER || m_eWeaponType == WEAPONTYPE_SNIPERRIFLE || m_eWeaponType == WEAPONTYPE_LASERSCOPE; } void diff --git a/src/weapons/Weapon.h b/src/weapons/Weapon.h index f6228b32..b4ed93c3 100644 --- a/src/weapons/Weapon.h +++ b/src/weapons/Weapon.h @@ -68,6 +68,8 @@ public: static void BlowUpExplosiveThings(CEntity *thing); bool HasWeaponAmmoToBeUsed(void); + static bool IsShotgun(int weapon) { return weapon == WEAPONTYPE_SHOTGUN || weapon == WEAPONTYPE_SPAS12_SHOTGUN || weapon == WEAPONTYPE_STUBBY_SHOTGUN; } + static bool ProcessLineOfSight(CVector const &point1, CVector const &point2, CColPoint &point, CEntity *&entity, eWeaponType type, CEntity *shooter, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects); #ifdef COMPATIBLE_SAVES diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp index d5e759b9..104fa2ec 100644 --- a/src/weapons/WeaponInfo.cpp +++ b/src/weapons/WeaponInfo.cpp @@ -12,6 +12,7 @@ // Yeah... int32 CWeaponInfo::ms_aMaxAmmoForWeapon[WEAPONTYPE_TOTALWEAPONS] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1 }; CWeaponInfo CWeaponInfo::ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS]; @@ -32,21 +33,29 @@ static char ms_aWeaponNames[][32] = { "Chainsaw", "Grenade", "DetonateGrenade", + "TearGas", "Molotov", "Rocket", "Colt45", + "Python", "Shotgun", + "Spas12Shotgun", + "StubbyShotgun", "Tec9", "Uzi", "SilencedIngram", "Mp5", - "M16", - "AK47", + "m4", + "Ruger", "SniperRifle", + "LaserScope", "RocketLauncher", "FlameThrower", + "M60", + "Minigun", "Detonator", "HeliCannon", + "Camera", }; CWeaponInfo* @@ -223,9 +232,7 @@ CWeaponInfo::LoadWeaponData(void) ms_apWeaponInfos[weaponType].m_nWeaponSlot = weaponSlot; - // TODO(Miami): Enable once weapons are done - if (animLoopEnd < 98.0f && weaponType != WEAPONTYPE_FLAMETHROWER && weaponType != WEAPONTYPE_SHOTGUN - /*&& weaponType != 20 && weaponType != 21*/) + if (animLoopEnd < 98.0f && weaponType != WEAPONTYPE_FLAMETHROWER && !CWeapon::IsShotgun(weaponType)) ms_apWeaponInfos[weaponType].m_nFiringRate = ((ms_apWeaponInfos[weaponType].m_fAnimLoopEnd - ms_apWeaponInfos[weaponType].m_fAnimLoopStart) * 900.0f); if (weaponType == WEAPONTYPE_DETONATOR || weaponType == WEAPONTYPE_HELICANNON) @@ -263,6 +270,7 @@ CWeaponInfo::FindWeaponFireType(char *name) if (strcmp(name, "INSTANT_HIT") == 0) return WEAPON_FIRE_INSTANT_HIT; if (strcmp(name, "PROJECTILE") == 0) return WEAPON_FIRE_PROJECTILE; if (strcmp(name, "AREA_EFFECT") == 0) return WEAPON_FIRE_AREA_EFFECT; + if (strcmp(name, "CAMERA") == 0) return WEAPON_FIRE_CAMERA; Error("Unknown weapon fire type, WeaponInfo.cpp"); return WEAPON_FIRE_INSTANT_HIT; } diff --git a/src/weapons/WeaponType.h b/src/weapons/WeaponType.h index 4b8be40f..65d715ec 100644 --- a/src/weapons/WeaponType.h +++ b/src/weapons/WeaponType.h @@ -1,6 +1,5 @@ #pragma once -// --MIAMI: TODO enum eWeaponType { WEAPONTYPE_UNARMED, @@ -17,23 +16,31 @@ enum eWeaponType WEAPONTYPE_CHAINSAW, WEAPONTYPE_GRENADE, WEAPONTYPE_DETONATOR_GRENADE, + WEAPONTYPE_TEARGAS, WEAPONTYPE_MOLOTOV, WEAPONTYPE_ROCKET, WEAPONTYPE_COLT45, + WEAPONTYPE_PYTHON, WEAPONTYPE_SHOTGUN, + WEAPONTYPE_SPAS12_SHOTGUN, + WEAPONTYPE_STUBBY_SHOTGUN, WEAPONTYPE_TEC9, WEAPONTYPE_UZI, WEAPONTYPE_SILENCED_INGRAM, WEAPONTYPE_MP5, - WEAPONTYPE_M16, - WEAPONTYPE_AK47, + WEAPONTYPE_M4, + WEAPONTYPE_RUGER, WEAPONTYPE_SNIPERRIFLE, + WEAPONTYPE_LASERSCOPE, WEAPONTYPE_ROCKETLAUNCHER, WEAPONTYPE_FLAMETHROWER, + WEAPONTYPE_M60, + WEAPONTYPE_MINIGUN, WEAPONTYPE_DETONATOR, WEAPONTYPE_HELICANNON, - WEAPONTYPE_LAST_WEAPONTYPE, - WEAPONTYPE_HEALTH, + WEAPONTYPE_CAMERA, + WEAPONTYPE_TOTALWEAPONS = 37, + WEAPONTYPE_HEALTH = 37, WEAPONTYPE_ARMOUR, WEAPONTYPE_RAMMEDBYCAR, WEAPONTYPE_RUNOVERBYCAR, @@ -42,10 +49,8 @@ enum eWeaponType WEAPONTYPE_DROWNING, WEAPONTYPE_FALL, WEAPONTYPE_UNIDENTIFIED, - - WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE, - WEAPONTYPE_ANYMELEE = 46, - WEAPONTYPE_ANYWEAPON = 47 + WEAPONTYPE_ANYMELEE, + WEAPONTYPE_ANYWEAPON }; enum { @@ -57,7 +62,7 @@ enum eWeaponFire { WEAPON_FIRE_INSTANT_HIT, WEAPON_FIRE_PROJECTILE, WEAPON_FIRE_AREA_EFFECT, - WEAPON_FIRE_USE + WEAPON_FIRE_CAMERA }; // Taken from MTA SA, seems it's unchanged |