diff --git a/sp/src/game/client/hl2/c_weapon__stubs_hl2.cpp b/sp/src/game/client/hl2/c_weapon__stubs_hl2.cpp index 0671bbce4ef..8d606485bf2 100644 --- a/sp/src/game/client/hl2/c_weapon__stubs_hl2.cpp +++ b/sp/src/game/client/hl2/c_weapon__stubs_hl2.cpp @@ -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 diff --git a/sp/src/game/server/hl2/npc_vortigaunt_episodic.cpp b/sp/src/game/server/hl2/npc_vortigaunt_episodic.cpp index 65d23587153..18f7633574d 100644 --- a/sp/src/game/server/hl2/npc_vortigaunt_episodic.cpp +++ b/sp/src/game/server/hl2/npc_vortigaunt_episodic.cpp @@ -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 ) diff --git a/sp/src/game/server/mod/weapon_smg2.cpp b/sp/src/game/server/mod/weapon_smg2.cpp index a45ef997a44..f0dd3f659af 100644 --- a/sp/src/game/server/mod/weapon_smg2.cpp +++ b/sp/src/game/server/mod/weapon_smg2.cpp @@ -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" @@ -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(); @@ -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( ) { @@ -161,6 +180,7 @@ CWeaponSMG2::CWeaponSMG2( ) m_bAltFiresUnderwater = false; } + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- @@ -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; } \ No newline at end of file