From 38bb95920e9316a8a7b65e2f5d7250447b390fac Mon Sep 17 00:00:00 2001 From: mittorn Date: Mon, 21 Mar 2016 16:07:17 +0600 Subject: [PATCH] gravgun code --- dlls/Android.mk | 1 + dlls/cbase.h | 1 + dlls/multiplay_gamerules.cpp | 1 + dlls/prop.cpp | 8 +++++++- dlls/weapons.cpp | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/Android.mk b/dlls/Android.mk index 81b15c1e..f405bd77 100644 --- a/dlls/Android.mk +++ b/dlls/Android.mk @@ -125,6 +125,7 @@ LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \ xen.cpp \ zombie.cpp \ prop.cpp \ + gravgun.cpp \ ../pm_shared/pm_debug.c \ ../pm_shared/pm_math.c \ ../pm_shared/pm_shared.c \ diff --git a/dlls/cbase.h b/dlls/cbase.h index 1aefe687..b0c5943b 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -213,6 +213,7 @@ public: } virtual void Blocked( CBaseEntity *pOther ) { if (m_pfnBlocked) (this->*m_pfnBlocked)( pOther ); }; + virtual CBaseEntity * TouchGravGun( CBaseEntity *attacker ){ return NULL; }; // allow engine to allocate instance data void *operator new( size_t stAllocateBlock, entvars_t *pev ) { diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index 2e2cab75..35a034da 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -574,6 +574,7 @@ void CHalfLifeMultiplay :: PlayerSpawn( CBasePlayer *pPlayer ) pPlayer->GiveNamedItem( "weapon_crowbar" ); pPlayer->GiveNamedItem( "weapon_9mmhandgun" ); pPlayer->GiveAmmo( 68, "9mm", _9MM_MAX_CARRY );// 4 full reloads + pPlayer->GiveNamedItem( "weapon_gravgun" ); } } diff --git a/dlls/prop.cpp b/dlls/prop.cpp index 86b1bf8a..227eb116 100644 --- a/dlls/prop.cpp +++ b/dlls/prop.cpp @@ -88,6 +88,12 @@ public: virtual void BounceSound(void); virtual int BloodColor(void) { return DONT_BLEED; } virtual void Killed(entvars_t *pevAttacker, int iGib); + virtual CBaseEntity * TouchGravGun( CBaseEntity *attacker ) + { + m_owner2 = attacker->edict(); + m_attacker = attacker->edict(); + return attacker; + } void CheckRotate(); void EXPORT RespawnThink(); void EXPORT AngleThink(); @@ -1063,7 +1069,7 @@ int CProp::TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flD if ( !(pev->spawnflags & SF_PROP_BREAKABLE ) ) return 0; if ( pev->health <= 0 ) - return; + return 0; // Breakables take double damage from the crowbar if ( bitsDamageType & DMG_CLUB ) flDamage *= 2; diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 264edb88..35e8626c 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -384,6 +384,7 @@ void W_Precache(void) UTIL_PrecacheOtherWeapon( "weapon_hornetgun" ); #endif + UTIL_PrecacheOtherWeapon( "weapon_gravgun" ); #if !defined( OEM_BUILD ) && !defined( HLDEMO_BUILD ) if ( g_pGameRules->IsDeathmatch() )