M82A1 soon ready

This commit is contained in:
unknown 2024-09-07 02:05:14 +02:00
parent 0affff43d5
commit 17e392f0ee
13 changed files with 100 additions and 28 deletions

View file

@ -2419,6 +2419,7 @@ void CTempEnts::LevelInit()
m_pCS_556Shell = (model_t *)engine->LoadModel( "models/Shells/shell_556.mdl" );
m_pCS_762NATOShell = (model_t *)engine->LoadModel( "models/Shells/shell_762nato.mdl" );
m_pCS_338MAGShell = (model_t *)engine->LoadModel( "models/Shells/shell_338mag.mdl" );
m_pCS_50BMGShell = (model_t *)engine->LoadModel( "models/Shells/shell_50bmg.mdl" );
#endif
}
@ -2456,6 +2457,7 @@ void CTempEnts::Init (void)
m_pCS_556Shell = NULL;
m_pCS_762NATOShell = NULL;
m_pCS_338MAGShell = NULL;
m_pCS_50BMGShell = NULL;
#endif
// Clear out lists to start
@ -3361,6 +3363,10 @@ void CTempEnts::CSEjectBrass( const Vector &vecPosition, const QAngle &angVeloci
hitsound = TE_RIFLE_SHELL;
pModel = m_pCS_338MAGShell;
break;
case CS_SHELL_50BMG:
hitsound = TE_RIFLE_SHELL;
pModel = m_pCS_50BMGShell;
break;
}
#endif

View file

@ -27,7 +27,8 @@ enum
CS_SHELL_12GAUGE,
CS_SHELL_556,
CS_SHELL_762NATO,
CS_SHELL_338MAG
CS_SHELL_338MAG,
CS_SHELL_50BMG
};
#endif
@ -161,6 +162,7 @@ private:
struct model_t *m_pCS_556Shell;
struct model_t *m_pCS_762NATOShell;
struct model_t *m_pCS_338MAGShell;
struct model_t *m_pCS_50BMGShell;
#endif
// Internal methods also available to children

View file

@ -820,7 +820,7 @@ CSPlayerState C_CSPlayer::State_Get() const
float C_CSPlayer::GetMinFOV() const
{
// Min FOV for M82A1.
return 3;
return 1;
}

View file

@ -53,9 +53,15 @@ void CStrike_FX_EjectBrass_338Mag_Callback( const CEffectData &data )
CStrike_EjectBrass( CS_SHELL_338MAG, data );
}
void CStrike_FX_EjectBrass_50BMG_Callback( const CEffectData &data )
{
CStrike_EjectBrass( CS_SHELL_50BMG, data );
}
DECLARE_CLIENT_EFFECT( "EjectBrass_9mm", CStrike_FX_EjectBrass_9mm_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_12Gauge", CStrike_FX_EjectBrass_12Gauge_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_57", CStrike_FX_EjectBrass_57_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_556", CStrike_FX_EjectBrass_556_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_762Nato", CStrike_FX_EjectBrass_762Nato_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_338Mag", CStrike_FX_EjectBrass_338Mag_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_50BMG", CStrike_FX_EjectBrass_50BMG_Callback );

View file

@ -1316,16 +1316,17 @@ void CCSPlayer::CheatImpulseCommands( int iImpulse )
AddAccount( 16000 );
GiveAmmo( 250, BULLET_PLAYER_50AE );
GiveAmmo( 250, BULLET_PLAYER_762MM );
GiveAmmo( 250, BULLET_PLAYER_338MAG );
GiveAmmo( 250, BULLET_PLAYER_556MM );
GiveAmmo( 250, BULLET_PLAYER_556MM_BOX );
GiveAmmo( 250, BULLET_PLAYER_9MM );
GiveAmmo( 250, BULLET_PLAYER_BUCKSHOT );
GiveAmmo( 250, BULLET_PLAYER_45ACP );
GiveAmmo( 250, BULLET_PLAYER_357SIG );
GiveAmmo( 250, BULLET_PLAYER_57MM );
GiveAmmo( 13371, BULLET_PLAYER_50BMG );
GiveAmmo( 13371, BULLET_PLAYER_50AE );
GiveAmmo( 13371, BULLET_PLAYER_762MM );
GiveAmmo( 13371, BULLET_PLAYER_338MAG );
GiveAmmo( 13371, BULLET_PLAYER_556MM );
GiveAmmo( 13371, BULLET_PLAYER_556MM_BOX );
GiveAmmo( 13371, BULLET_PLAYER_9MM );
GiveAmmo( 13371, BULLET_PLAYER_BUCKSHOT );
GiveAmmo( 13371, BULLET_PLAYER_45ACP );
GiveAmmo( 13371, BULLET_PLAYER_357SIG );
GiveAmmo( 13371, BULLET_PLAYER_57MM );
gEvilImpulse101 = false;
}

View file

@ -53,6 +53,16 @@ public:
LINK_ENTITY_TO_CLASS( ammo_50ae, CItemAmmo50AE );
//-----------------------------------------------------------------------------
class CItemAmmo50BMG : public CItemAmmo
{
public:
DECLARE_CLASS( CItemAmmo50BMG, CItemAmmo );
virtual const char * GetAmmoName( void ) const { return BULLET_PLAYER_50BMG; }
};
LINK_ENTITY_TO_CLASS( ammo_50bmg, CItemAmmo50BMG );
//-----------------------------------------------------------------------------
class CItemAmmo762MM : public CItemAmmo
{

View file

@ -363,12 +363,16 @@ public:
CheckAreasOverlappingBreakable( CBaseEntity *breakable )
{
m_breakable = breakable;
ICollideable *collideable = breakable->GetCollideable();
collideable->WorldSpaceSurroundingBounds( &m_breakableExtent.lo, &m_breakableExtent.hi );
const float expand = 10.0f;
m_breakableExtent.lo += Vector( -expand, -expand, -expand );
m_breakableExtent.hi += Vector( expand, expand, expand );
if ( m_breakable )
{
ICollideable* collideable = breakable->GetCollideable();
collideable->WorldSpaceSurroundingBounds( &m_breakableExtent.lo, &m_breakableExtent.hi );
const float expand = 10.0f;
m_breakableExtent.lo += Vector( -expand, -expand, -expand );
m_breakableExtent.hi += Vector( expand, expand, expand );
}
}
bool operator() ( CNavArea *area )

View file

@ -165,6 +165,7 @@ IMPLEMENT_NETWORKCLASS_ALIASED( CSGameRulesProxy, DT_CSGameRulesProxy )
ConVar ammo_50AE_max( "ammo_50AE_max", "35", FCVAR_REPLICATED );
ConVar ammo_50bmg_max( "ammo_50bmg_max", "18", FCVAR_REPLICATED );
ConVar ammo_762mm_max( "ammo_762mm_max", "90", FCVAR_REPLICATED );
ConVar ammo_556mm_max( "ammo_556mm_max", "90", FCVAR_REPLICATED );
ConVar ammo_556mm_box_max( "ammo_556mm_box_max", "200", FCVAR_REPLICATED );
@ -5076,6 +5077,7 @@ CAmmoDef* GetAmmoDef()
bInitted = true;
ammoDef.AddAmmoType( BULLET_PLAYER_50AE, DMG_BULLET, TRACER_LINE, 0, 0, "ammo_50AE_max", 2400 * BULLET_IMPULSE_EXAGGERATION, 0, 10, 14 );
ammoDef.AddAmmoType( BULLET_PLAYER_50BMG, DMG_BULLET, TRACER_LINE, 0, 0, "ammo_50bmg_max", 4800 * BULLET_IMPULSE_EXAGGERATION, 0, 30, 40 );
ammoDef.AddAmmoType( BULLET_PLAYER_762MM, DMG_BULLET, TRACER_LINE, 0, 0, "ammo_762mm_max", 2400 * BULLET_IMPULSE_EXAGGERATION, 0, 10, 14 );
ammoDef.AddAmmoType( BULLET_PLAYER_556MM, DMG_BULLET, TRACER_LINE, 0, 0, "ammo_556mm_max", 2400 * BULLET_IMPULSE_EXAGGERATION, 0, 10, 14 );
ammoDef.AddAmmoType( BULLET_PLAYER_556MM_BOX, DMG_BULLET, TRACER_LINE, 0, 0, "ammo_556mm_box_max",2400 * BULLET_IMPULSE_EXAGGERATION, 0, 10, 14 );
@ -5092,6 +5094,7 @@ CAmmoDef* GetAmmoDef()
//Adrian: I set all the prices to 0 just so the rest of the buy code works
//This should be revisited.
ammoDef.AddAmmoCost( BULLET_PLAYER_50AE, 0, 7 );
ammoDef.AddAmmoCost( BULLET_PLAYER_50BMG, 0, 6 );
ammoDef.AddAmmoCost( BULLET_PLAYER_762MM, 0, 30 );
ammoDef.AddAmmoCost( BULLET_PLAYER_556MM, 0, 30 );
ammoDef.AddAmmoCost( BULLET_PLAYER_556MM_BOX, 0, 30 );

View file

@ -235,6 +235,10 @@ float CCSPlayer::GetBulletDiameter(int iBulletType)
{
return MMToUnits(13.8f);
}
else if (IsAmmoType(iBulletType, BULLET_PLAYER_50BMG))
{
return MMToUnits(20.f);
}
else if (IsAmmoType(iBulletType, BULLET_PLAYER_762MM))
{
return MMToUnits(7.62f);
@ -292,6 +296,11 @@ void CCSPlayer::GetBulletTypeParameters(
fPenetrationPower = 39;
flPenetrationDistance = 5000.0;
}
else if ( IsAmmoType( iBulletType, BULLET_PLAYER_50BMG ) )
{
fPenetrationPower = 266.6f;
flPenetrationDistance = 150000.0;
}
else if ( IsAmmoType( iBulletType, BULLET_PLAYER_556MM ) ||
IsAmmoType( iBulletType, BULLET_PLAYER_556MM_BOX ) )
{
@ -455,6 +464,7 @@ void CCSPlayer::FireBullet(
float fCurrentDamage = iDamage; // damage of the bullet at it's current trajectory
float flCurrentDistance = 0.0; //distance that the bullet has traveled so far
float flLastCurrentDistance = 0.0; // Sometimes some maps are badly made and we need to check the distance we traveled.
Vector vecDirShooting, vecRight, vecUp;
AngleVectors( shootAngles, &vecDirShooting, &vecRight, &vecUp );
@ -468,6 +478,13 @@ void CCSPlayer::FireBullet(
GetBulletTypeParameters( iBulletType, flPenetrationPower, flPenetrationDistance, flBulletDiameter );
bool is50bmg = false;
if (IsAmmoType( iBulletType, BULLET_PLAYER_50BMG ))
{
is50bmg = true;
}
float flBulletRadius = flBulletDiameter / 2.0f;
Vector vecBulletRadiusMaxs(flBulletRadius);
@ -664,6 +681,9 @@ void CCSPlayer::FireBullet(
lastPlayerHit = ToBasePlayer(tr.m_pEnt);
// #ifdef GAME_DLL
// DevMsg("1: %i %f %f %f\n", iPenetration, flPenetrationDistance, flCurrentDistance, flPenetrationPower);
// #endif
if ( tr.fraction == 1.0f )
break; // we didn't hit anything, stop tracing shoot
@ -691,6 +711,11 @@ void CCSPlayer::FireBullet(
flDamageModifier = 0.99f;
}
if (is50bmg && iEnterMaterial >= 'A')
{
flPenetrationModifier = 1.0f;
}
if ( shouldDebugHitboxesOnHit )
{
#ifdef CLIENT_DLL
@ -825,6 +850,9 @@ void CCSPlayer::FireBullet(
#endif
// #ifdef GAME_DLL
// DevMsg("2: %i %f %f %f\n", iPenetration, flPenetrationDistance, flCurrentDistance, flPenetrationPower);
// #endif
// check if bullet can penetrate another entity
if ( iPenetration == 0 && !hitGrate )
break; // no, stop
@ -833,12 +861,20 @@ void CCSPlayer::FireBullet(
if ( iPenetration < 0 )
break;
// #ifdef GAME_DLL
// DevMsg("3: %i %f %f %f\n", iPenetration, flPenetrationDistance, flCurrentDistance, flPenetrationPower);
// #endif
Vector penetrationEnd;
float flMaxPenetrationDistance = is50bmg ? 1024.0f : 128.0f;
// try to penetrate object, maximum penetration is 128 inch
if ( !TraceToExit( tr.endpos, vecDir, penetrationEnd, 24, 128 ) )
if ( !TraceToExit( tr.endpos, vecDir, penetrationEnd, 24, flMaxPenetrationDistance ) )
break;
// #ifdef GAME_DLL
// DevMsg("4: %i %f %f %f\n", iPenetration, flPenetrationDistance, flCurrentDistance, flPenetrationPower);
// #endif
// find exact penetration exit
trace_t exitTr;
UTIL_TraceHull( penetrationEnd, tr.endpos, vecBulletRadiusMins, vecBulletRadiusMaxs, CS_MASK_SHOOT|CONTENTS_HITBOX, NULL, &exitTr );
@ -872,6 +908,9 @@ void CCSPlayer::FireBullet(
if ( flTraceDistance > ( flPenetrationPower * flPenetrationModifier ) )
break; // bullet hasn't enough power to penetrate this distance
// #ifdef GAME_DLL
// DevMsg("5: %i %f %f %f\n", iPenetration, flPenetrationDistance, flCurrentDistance, flPenetrationPower);
// #endif
// penetration was successful
// bullet did penetrate object, exit Decal

View file

@ -262,6 +262,9 @@ int GetShellForAmmoType( const char *ammoname )
if ( !Q_strcmp( BULLET_PLAYER_57MM, ammoname ) )
return CS_SHELL_57;
if ( !Q_strcmp( BULLET_PLAYER_50BMG, ammoname ) )
return CS_SHELL_50BMG;
// default 9 mm
return CS_SHELL_9MM;
}

View file

@ -33,6 +33,7 @@ class CCSPlayer;
// These are the names of the ammo types that go in the CAmmoDefs and that the
// weapon script files reference.
#define BULLET_PLAYER_50BMG "BULLET_PLAYER_50BMG"
#define BULLET_PLAYER_50AE "BULLET_PLAYER_50AE"
#define BULLET_PLAYER_762MM "BULLET_PLAYER_762MM"
#define BULLET_PLAYER_556MM "BULLET_PLAYER_556MM"

View file

@ -1,10 +1,5 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "vstdlib/random.h"
#include "weapon_csbasegun.h"
@ -30,7 +25,7 @@ enum FOVContext_t
FOV_MAX
};
static constexpr int FOVValues[FOV_MAX] = { 40, 10, 3 };
static constexpr int FOVValues[FOV_MAX] = { 40, 10, 1 };
#ifdef M82A1_UNZOOM
ConVar sv_m82a1unzoomdelay(
@ -115,7 +110,7 @@ void CWeaponM82A1::Spawn()
void CWeaponM82A1::SecondaryAttack()
{
const float kZoomTime = 0.15f;
const float kZoomTime = 0.2f;
CCSPlayer *pPlayer = GetPlayerOwner();
@ -202,7 +197,7 @@ float CWeaponM82A1::GetInaccuracy() const
fSpread = 0.0f;
else
fSpread = 0.0f;
fSpread = 0.002f;
return fSpread;
}
@ -235,7 +230,9 @@ void CWeaponM82A1::PrimaryAttack()
}
QAngle angle = pPlayer->GetPunchAngle();
angle.x -= 5;
RandomSeed( pPlayer->GetPredictionRandomSeed() );
angle.x -= 15 + RandomFloat( 2, 8 );
angle.y -= static_cast< float >( RandomInt( -1, 1 ) ) * RandomFloat( 2, 4 );
pPlayer->SetPunchAngle( angle );
}

Binary file not shown.