Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sp/src/game/client/hl2/c_weapon__stubs_hl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ STUB_WEAPON_CLASS( weapon_arbeit_clipboard, WeaponArbeitClipboard, C_WeaponCitiz

STUB_WEAPON_CLASS( weapon_flechette_shotgun, WeaponFlechetteShotgun, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_stasis_grenade, WeaponStasisGrenade, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_plasma_smg2, WeaponSMG2Plasma, C_HLSelectFireMachineGun );
#endif


2 changes: 1 addition & 1 deletion sp/src/game/server/hl2/npc_vortigaunt_episodic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4278,7 +4278,7 @@ void CVortigauntChargeToken::SeekTouch( CBaseEntity *pOther )
if ( pNPC != NULL )
{
// Is this NPC friendly or hostile?
Disposition_t disposition = GetOwnerEntity()->MyNPCPointer()->IRelationType( pNPC );
Disposition_t disposition = GetOwnerEntity()->MyCombatCharacterPointer()->IRelationType( pNPC );

// Charge the suit's armor
if (disposition > D_FR )
Expand Down
48 changes: 45 additions & 3 deletions sp/src/game/server/mod/weapon_smg2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "rumble_shared.h"
#include "gamestats.h"
#include "particle_parse.h" // BREADMAN - particle muzzle
#include "npc_vortigaunt_episodic.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
Expand Down Expand Up @@ -70,9 +71,9 @@ class CWeaponSMG2 : public CHLSelectFireMachineGun

const WeaponProficiencyInfo_t *GetProficiencyValues();

void FireNPCPrimaryAttack( CBaseCombatCharacter *pOperator, Vector &vecShootOrigin, Vector &vecShootDir );
void Operator_ForceNPCFire( CBaseCombatCharacter *pOperator, bool bSecondary );
void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
virtual void FireNPCPrimaryAttack( CBaseCombatCharacter *pOperator, Vector &vecShootOrigin, Vector &vecShootDir );
virtual void Operator_ForceNPCFire( CBaseCombatCharacter *pOperator, bool bSecondary );
virtual void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator );

DECLARE_ACTTABLE();

Expand Down Expand Up @@ -148,6 +149,24 @@ acttable_t CWeaponSMG2::m_acttable[] =

IMPLEMENT_ACTTABLE(CWeaponSMG2);


class CWeaponSMG2Plasma : public CWeaponSMG2
{
public:
DECLARE_CLASS( CWeaponSMG2Plasma, CWeaponSMG2 );

DECLARE_SERVERCLASS();

virtual void FireBullets( const FireBulletsInfo_t &info );
virtual void FireNPCPrimaryAttack( CBaseCombatCharacter *pOperator, Vector &vecShootOrigin, Vector &vecShootDir );
};

IMPLEMENT_SERVERCLASS_ST( CWeaponSMG2Plasma, DT_WeaponSMG2Plasma )
END_SEND_TABLE()

LINK_ENTITY_TO_CLASS( weapon_plasma_smg2, CWeaponSMG2Plasma );
PRECACHE_WEAPON_REGISTER( weapon_plasma_smg2 );

//=========================================================
CWeaponSMG2::CWeaponSMG2( )
{
Expand All @@ -161,6 +180,7 @@ CWeaponSMG2::CWeaponSMG2( )
m_bAltFiresUnderwater = false;
}


//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -550,4 +570,26 @@ const WeaponProficiencyInfo_t *CWeaponSMG2::GetProficiencyValues()
COMPILE_TIME_ASSERT( ARRAYSIZE( proficiencyTable ) == WEAPON_PROFICIENCY_PERFECT + 1 );

return proficiencyTable;
}

void CWeaponSMG2Plasma::FireBullets( const FireBulletsInfo_t & info )
{
CVortigauntChargeToken * pToken = CVortigauntChargeToken::CreateChargeToken( info.m_vecSrc, GetOwner(), GetOwner()->GetEnemy() );
pToken->SetAbsVelocity( info.m_vecDirShooting * 512.0f );
pToken->SetNextThink( gpGlobals->curtime + 1.0f );
}

void CWeaponSMG2Plasma::FireNPCPrimaryAttack( CBaseCombatCharacter * pOperator, Vector & vecShootOrigin, Vector & vecShootDir )
{
// FIXME: use the returned number of bullets to account for >10hz firerate
WeaponSoundRealtime( SINGLE_NPC );

CSoundEnt::InsertSound( SOUND_COMBAT|SOUND_CONTEXT_GUNFIRE, pOperator->GetAbsOrigin(), SOUNDENT_VOLUME_MACHINEGUN, 0.2, pOperator, SOUNDENT_CHANNEL_WEAPON, pOperator->GetEnemy() );

FireBulletsInfo_t info( 1, vecShootOrigin, vecShootDir, pOperator->GetAttackSpread( this ), MAX_TRACE_LENGTH, m_iPrimaryAmmoType, true );

CWeaponSMG2Plasma::FireBullets( info );
pOperator->DoMuzzleFlash(); // Changing the shots doesn't help - just blows us up !

m_iClip1 = m_iClip1 - 1;
}