From 2a1da4775164fb5b32d9267d9ea6975324d9ffcc Mon Sep 17 00:00:00 2001 From: RAINBOW2000 Date: Sat, 4 Feb 2017 23:03:51 +0300 Subject: [PATCH] ... --- dlls/Android.mk | 4 +- dlls/bigsmoke.cpp | 10 +- dlls/cbase.h | 1 - dlls/client.cpp | 2 +- dlls/combat.cpp | 6 - dlls/cross.cpp | 485 ---------------------------------------------- dlls/crowbar.cpp | 10 +- dlls/evilsci.cpp | 1 - dlls/glock2.cpp | 259 ------------------------- dlls/hammer.cpp | 280 ++++++++++++++++++++++++++ dlls/katana.cpp | 8 +- dlls/mp5.cpp | 2 +- dlls/needle.cpp | 226 +-------------------- dlls/pepsigun.cpp | 2 +- dlls/player.cpp | 1 + dlls/rock.cpp | 6 +- dlls/rpg.cpp | 27 +-- dlls/sawnoff.cpp | 8 +- dlls/sniper.cpp | 18 +- dlls/weapons.cpp | 1 - dlls/weapons.h | 6 +- 21 files changed, 346 insertions(+), 1017 deletions(-) delete mode 100644 dlls/cross.cpp delete mode 100644 dlls/glock2.cpp create mode 100644 dlls/hammer.cpp diff --git a/dlls/Android.mk b/dlls/Android.mk index 9929618c..7f5412b5 100644 --- a/dlls/Android.mk +++ b/dlls/Android.mk @@ -31,14 +31,12 @@ LOCAL_C_INCLUDES := $(SDL_PATH)/include \ LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \ bonewheel.cpp \ sawnoff.cpp \ - cross.cpp \ + hammer.cpp \ bigsmoke.cpp \ pepsigun.cpp \ needle.cpp \ katana.cpp \ evilsci.cpp \ - sniper.cpp \ - glock2.cpp \ mariozombie.cpp \ megachav.cpp \ pink_panthera.cpp \ diff --git a/dlls/bigsmoke.cpp b/dlls/bigsmoke.cpp index 412c4f96..d0d21a60 100644 --- a/dlls/bigsmoke.cpp +++ b/dlls/bigsmoke.cpp @@ -263,7 +263,7 @@ void CBigSmoke::HandleAnimEvent( MonsterEvent_t *pEvent ) case ISLAVE_AE_CLAW: { // SOUND HERE! - CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.slaveDmgClaw, DMG_SLASH ); + CBaseEntity *pHurt = CheckTraceHullAttack( 71, 1, DMG_BULLET ); if( pHurt ) { if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) ) @@ -283,7 +283,7 @@ void CBigSmoke::HandleAnimEvent( MonsterEvent_t *pEvent ) break; case ISLAVE_AE_CLAWRAKE: { - CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.slaveDmgClawrake, DMG_SLASH ); + CBaseEntity *pHurt = CheckTraceHullAttack( 70, 1, DMG_BULLET ); if( pHurt ) { if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) ) @@ -514,7 +514,7 @@ void CBigSmoke::Precache() int CBigSmoke::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { // don't slash one of your own - if( ( bitsDamageType & DMG_SLASH ) && pevAttacker && IRelationship( Instance( pevAttacker ) ) < R_DL ) + if( ( bitsDamageType & DMG_BULLET ) && pevAttacker && IRelationship( Instance( pevAttacker ) ) < R_DL ) return 0; m_afMemory |= bits_MEMORY_PROVOKED; @@ -523,7 +523,7 @@ int CBigSmoke::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, floa void CBigSmoke::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { - if( bitsDamageType & DMG_SHOCK ) + if( bitsDamageType & DMG_BULLET ) return; CSquadMonster::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType ); @@ -759,7 +759,7 @@ void CBigSmoke::ZapBeam( int side ) pEntity = CBaseEntity::Instance( tr.pHit ); if( pEntity != NULL && pEntity->pev->takedamage ) { - pEntity->TraceAttack( pev, 3, vecAim, &tr, DMG_SHOCK ); + pEntity->TraceAttack( pev, 1, vecAim, &tr, DMG_BULLET ); } } diff --git a/dlls/cbase.h b/dlls/cbase.h index 6c1248c2..8e4d2f3e 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -341,7 +341,6 @@ public: int ammo_hornets; int ammo_argrens; int ammo_snipars; - int ammo_pepsi; //Special stuff for grenades and satchels. float m_flStartThrow; float m_flReleaseThrow; diff --git a/dlls/client.cpp b/dlls/client.cpp index 6fe41065..89f45420 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -1,3 +1,4 @@ + /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. @@ -1602,7 +1603,6 @@ void UpdateClientData( const struct edict_s *ent, int sendweapons, struct client cd->ammo_cells = pl->ammo_uranium; cd->vuser2.x = pl->ammo_hornets; cd->vuser2.y = pl->ammo_snipars; - cd->vuser2.z = pl->ammo_pepsi; if( pl->m_pActiveItem ) { diff --git a/dlls/combat.cpp b/dlls/combat.cpp index ceb0e217..3a59844f 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -1535,12 +1535,6 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi case BULLET_PLAYER_357: pEntity->TraceAttack( pevAttacker, gSkillData.plrDmg357, vecDir, &tr, DMG_BULLET ); break; - case BULLET_PLAYER_SNIPARS: - pEntity->TraceAttack( pevAttacker, 200, vecDir, &tr, DMG_BULLET ); - break; - case BULLET_PLAYER_PEPSI: - pEntity->TraceAttack( pevAttacker, 200, vecDir, &tr, DMG_BULLET ); - break; case BULLET_NONE: // FIX pEntity->TraceAttack( pevAttacker, 50, vecDir, &tr, DMG_CLUB ); TEXTURETYPE_PlaySound( &tr, vecSrc, vecEnd, iBulletType ); diff --git a/dlls/cross.cpp b/dlls/cross.cpp deleted file mode 100644 index 488f2001..00000000 --- a/dlls/cross.cpp +++ /dev/null @@ -1,485 +0,0 @@ -#if !defined( OEM_BUILD ) && !defined( HLDEMO_BUILD ) - -#include "extdll.h" -#include "util.h" -#include "cbase.h" -#include "monsters.h" -#include "weapons.h" -#include "nodes.h" -#include "player.h" -#include "gamerules.h" - -#ifndef CLIENT_DLL -#define BOLT_AIR_VELOCITY 1300 -#define BOLT_WATER_VELOCITY 1300 - - -class CCrowbar2 : public CBasePlayerWeapon -{ -public: - void Spawn( void ); - void Precache( void ); - int iItemSlot( ) { return 3; } - int GetItemInfo(ItemInfo *p); - - void FireBolt( void ); - void FireSniperBolt( void ); - void PrimaryAttack( void ); - int AddToPlayer( CBasePlayer *pPlayer ); - BOOL Deploy( ); - void Holster( int skiplocal = 0 ); - void WeaponIdle( void ); - - int m_fInZoom; // don't save this - - virtual BOOL UseDecrement( void ) - { - return FALSE; - } - -private: - unsigned short m_usCrossbow12; - unsigned short m_usCrossbow22; -}; - - - -// UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS() -// -// OVERLOADS SOME ENTVARS: -// -// speed - the ideal magnitude of my velocity -class CCrowbar2Bolt : public CBaseEntity -{ - void Spawn( void ); - void Precache( void ); - int Classify( void ); - void EXPORT BubbleThink( void ); - void EXPORT BoltTouch( CBaseEntity *pOther ); - void EXPORT ExplodeThink( void ); - - int m_iTrail; - -public: - static CCrowbar2Bolt *BoltCreate( void ); -}; - -LINK_ENTITY_TO_CLASS( crowbar2_bolt, CCrowbar2Bolt ) - -CCrowbar2Bolt *CCrowbar2Bolt::BoltCreate( void ) -{ - // Create a new entity with CCrossbowBolt private data - CCrowbar2Bolt *pBolt = GetClassPtr( (CCrowbar2Bolt *)NULL ); - pBolt->pev->classname = MAKE_STRING( "crossbow_bolt" ); // g-cont. enable save\restore - pBolt->Spawn(); - - return pBolt; -} - -void CCrowbar2Bolt::Spawn() -{ - Precache(); - pev->movetype = MOVETYPE_FLY; - pev->solid = SOLID_BBOX; - - pev->gravity = 300; - - SET_MODEL( ENT( pev ), "models/w_hammer.mdl" ); - - UTIL_SetOrigin( pev, pev->origin ); - UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) ); - - SetTouch( &CCrowbar2Bolt::BoltTouch ); - SetThink( &CCrowbar2Bolt::BubbleThink ); - pev->nextthink = gpGlobals->time + 0.2; -} - -void CCrowbar2Bolt::Precache() -{ - PRECACHE_MODEL( "models/w_hammer.mdl" ); - PRECACHE_SOUND( "weapons/hammer_hitbod1.wav" ); - PRECACHE_SOUND( "weapons/hammer_hitbod2.wav" ); - PRECACHE_SOUND( "weapons/g_bounce2.wav" ); - PRECACHE_SOUND( "fvox/beep.wav" ); - m_iTrail = PRECACHE_MODEL( "sprites/streak.spr" ); -} - -int CCrowbar2Bolt::Classify( void ) -{ - return CLASS_NONE; -} - -void CCrowbar2Bolt::BoltTouch( CBaseEntity *pOther ) -{ - SetTouch( NULL ); - SetThink( NULL ); - - if( pOther->pev->takedamage ) - { - TraceResult tr = UTIL_GetGlobalTrace(); - entvars_t *pevOwner; - - pevOwner = VARS( pev->owner ); - - // UNDONE: this needs to call TraceAttack instead - ClearMultiDamage(); - - if( pOther->IsPlayer() ) - { - pOther->TraceAttack( pevOwner, 259, pev->velocity.Normalize(), &tr, DMG_ALWAYSGIB ); - } - else - { - pOther->TraceAttack( pevOwner, 259, pev->velocity.Normalize(), &tr, DMG_BULLET | DMG_ALWAYSGIB ); - } - - ApplyMultiDamage( pev, pevOwner ); - - pev->velocity = Vector( 0, 0, 0 ); - // play body "thwack" sound - switch( RANDOM_LONG( 0, 1 ) ) - { - case 0: - EMIT_SOUND( ENT( pev ), CHAN_BODY, "weapons/hammer_hitbod.wav", 1, ATTN_NORM ); - break; - case 1: - EMIT_SOUND( ENT( pev ), CHAN_BODY, "weapons/hammer_hitbod.wav", 1, ATTN_NORM ); - break; - } - - if( !g_pGameRules->IsMultiplayer() ) - { - Killed( pev, GIB_ALWAYS ); - } - } - else - { - EMIT_SOUND_DYN( ENT( pev ), CHAN_BODY, "weapons/hammer_hit.wav", RANDOM_FLOAT( 0.95, 1.0 ), ATTN_NORM, 0, 98 + RANDOM_LONG( 0, 7 ) ); - - SetThink( &CBaseEntity::SUB_Remove ); - pev->nextthink = gpGlobals->time;// this will get changed below if the bolt is allowed to stick in what it hit. - - if( FClassnameIs( pOther->pev, "worldspawn" ) ) - { - // if what we hit is static architecture, can stay around for a while. - Vector vecDir = pev->velocity.Normalize(); - UTIL_SetOrigin( pev, pev->origin - vecDir * 12 ); - pev->angles = UTIL_VecToAngles( vecDir ); - pev->solid = SOLID_NOT; - pev->movetype = MOVETYPE_FLY; - pev->velocity = Vector( 0, 0, 0 ); - pev->avelocity.z = 0; - pev->angles.z = RANDOM_LONG( 180,360 ); - pev->nextthink = gpGlobals->time + 10.0; - } - else if( pOther->pev->movetype == MOVETYPE_PUSH || pOther->pev->movetype == MOVETYPE_PUSHSTEP ) - { - Vector vecDir = pev->velocity.Normalize(); - UTIL_SetOrigin( pev, pev->origin - vecDir * 12 ); - pev->angles = UTIL_VecToAngles( vecDir ); - pev->solid = SOLID_NOT; - pev->velocity = Vector( 0, 0, 0 ); - pev->avelocity.z = 0; - pev->angles.z = RANDOM_LONG( 0, 180 ); - pev->nextthink = gpGlobals->time + 10.0; - - } - - if( UTIL_PointContents( pev->origin ) != CONTENTS_WATER ) - { - UTIL_Sparks( pev->origin ); - } - } - - -} - -void CCrowbar2Bolt::BubbleThink( void ) -{ - pev->nextthink = gpGlobals->time + 0.1; - - if( pev->waterlevel == 0 ) - return; - - UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1, pev->origin, 1 ); -} - -void CCrowbar2Bolt::ExplodeThink( void ) -{ - int iContents = UTIL_PointContents( pev->origin ); - int iScale; - - pev->dmg = 40; - iScale = 10; - - MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin ); - WRITE_BYTE( TE_EXPLOSION ); - WRITE_COORD( pev->origin.x ); - WRITE_COORD( pev->origin.y ); - WRITE_COORD( pev->origin.z ); - if( iContents != CONTENTS_WATER ) - { - WRITE_SHORT( g_sModelIndexFireball ); - } - else - { - WRITE_SHORT( g_sModelIndexWExplosion ); - } - WRITE_BYTE( iScale ); // scale * 10 - WRITE_BYTE( 15 ); // framerate - WRITE_BYTE( TE_EXPLFLAG_NONE ); - MESSAGE_END(); - - entvars_t *pevOwner; - - if( pev->owner ) - pevOwner = VARS( pev->owner ); - else - pevOwner = NULL; - - pev->owner = NULL; // can't traceline attack owner if this is set - - ::RadiusDamage( pev->origin, pev, pevOwner, pev->dmg, 128, CLASS_NONE, DMG_BLAST | DMG_ALWAYSGIB ); - - UTIL_Remove( this ); -} -#endif - -enum crowbar_e -{ - CROSSBOW_IDLE = 0, - CROSSBOW_DRAW, - CROSSBOW_HOLSTER, - CROSSBOW_ATTACK1HIT -}; - -LINK_ENTITY_TO_CLASS( weapon_hammer, CCrowbar2 ) - -void CCrowbar2::Spawn() -{ - Precache(); - m_iId = WEAPON_HAMMER; - SET_MODEL( ENT( pev ), "models/w_hammer.mdl" ); - - m_iDefaultAmmo = -1; - - FallInit();// get ready to fall down. -} - -int CCrowbar2::AddToPlayer( CBasePlayer *pPlayer ) -{ - if( CBasePlayerWeapon::AddToPlayer( pPlayer ) ) - { - MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev ); - WRITE_BYTE( m_iId ); - MESSAGE_END(); - return TRUE; - } - return FALSE; -} - -void CCrowbar2::Precache( void ) -{ - PRECACHE_MODEL( "models/w_hammer.mdl" ); - PRECACHE_MODEL( "models/v_hammer.mdl" ); - PRECACHE_MODEL( "models/p_hammer.mdl" ); - - PRECACHE_SOUND( "g_bounce2.wav" ); - - UTIL_PrecacheOther( "crowbar2_bolt" ); - - m_usCrossbow12 = PRECACHE_EVENT( 1, "events/crowbar.sc" ); - m_usCrossbow22 = PRECACHE_EVENT( 1, "events/crowbar.sc" ); -} - -int CCrowbar2::GetItemInfo( ItemInfo *p ) -{ - p->pszName = STRING( pev->classname ); - p->pszAmmo1 = NULL; - p->iMaxAmmo1 = -1; - p->pszAmmo2 = NULL; - p->iMaxAmmo2 = -1; - p->iMaxClip = -1; - p->iSlot = 0; - p->iPosition = 4; - p->iId = WEAPON_HAMMER; - p->iFlags = 0; - p->iWeight = -10; - return 1; -} - -BOOL CCrowbar2::Deploy() -{ - if( m_iClip ) - return DefaultDeploy( "models/v_hammer.mdl", "models/p_hammer.mdl", CROSSBOW_DRAW, "bow" ); - return DefaultDeploy( "models/v_hammer.mdl", "models/p_hammer.mdl", CROSSBOW_DRAW, "bow" ); -} - -void CCrowbar2::Holster( int skiplocal /* = 0 */ ) -{ - m_fInReload = FALSE;// cancel any reload in progress. - - if( m_fInZoom ) - { - SecondaryAttack(); - } - - m_pPlayer->m_flNextAttack = gpGlobals->time + 0.5; - if( m_iClip ) -{ - SendWeaponAnim( CROSSBOW_HOLSTER ); -} - -} - -void CCrowbar2::PrimaryAttack( void ) -{ -#ifdef CLIENT_DLL - if( m_fInZoom && bIsMultiplayer() ) -#else - if( m_fInZoom && g_pGameRules->IsMultiplayer() ) -#endif - { - FireSniperBolt(); - return; - } - - FireBolt(); -} - -// this function only gets called in multiplayer -void CCrowbar2::FireSniperBolt() -{ - m_flNextPrimaryAttack = gpGlobals->time + 0.35; - - - TraceResult tr; - - m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME; - - int flags; -#if defined( CLIENT_WEAPONS ) - flags = FEV_NOTHOST; -#else - flags = 0; -#endif - - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usCrossbow22, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 ); - - // player "shoot" animation - m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); - - Vector anglesAim = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle; - UTIL_MakeVectors( anglesAim ); - Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2; - Vector vecDir = gpGlobals->v_forward; - - UTIL_TraceLine( vecSrc, vecSrc + vecDir * 8192, dont_ignore_monsters, m_pPlayer->edict(), &tr ); - -#ifndef CLIENT_DLL - if( tr.pHit->v.takedamage ) - { - ClearMultiDamage(); - CBaseEntity::Instance( tr.pHit )->TraceAttack( m_pPlayer->pev, 120, vecDir, &tr, DMG_BULLET | DMG_ALWAYSGIB ); - ApplyMultiDamage( pev, m_pPlayer->pev ); - } -#endif -} - -void CCrowbar2::FireBolt() -{ - TraceResult tr; - - m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME; - - - int flags; -#if defined( CLIENT_WEAPONS ) - flags = FEV_NOTHOST; -#else - flags = 0; -#endif - - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usCrossbow12, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 ); - - // player "shoot" animation - m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); - - Vector anglesAim = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle; - UTIL_MakeVectors( anglesAim ); - - anglesAim.x = -anglesAim.x; - Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2; - Vector vecDir = gpGlobals->v_forward; - -#ifndef CLIENT_DLL - CCrowbar2Bolt *pBolt = CCrowbar2Bolt::BoltCreate(); - pBolt->pev->origin = vecSrc; - pBolt->pev->angles = anglesAim; - pBolt->pev->owner = m_pPlayer->edict(); - - if( m_pPlayer->pev->waterlevel == 3 ) - { - pBolt->pev->velocity = vecDir * BOLT_WATER_VELOCITY; - pBolt->pev->speed = BOLT_WATER_VELOCITY; - } - else - { - pBolt->pev->velocity = vecDir * BOLT_AIR_VELOCITY; - pBolt->pev->speed = BOLT_AIR_VELOCITY; - } - pBolt->pev->avelocity.z = 10; -#endif - - if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) - // HEV suit - indicate out of ammo condition - m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 ); - - m_flNextPrimaryAttack = gpGlobals->time + 0.35; - - m_flNextSecondaryAttack = gpGlobals->time + 0.35; - - if( m_iClip != 0 ) - m_flTimeWeaponIdle = gpGlobals->time + 5.0; - else - m_flTimeWeaponIdle = gpGlobals->time + 0.75; -} - - -void CCrowbar2::WeaponIdle( void ) -{ - m_pPlayer->GetAutoaimVector( AUTOAIM_2DEGREES ); // get the autoaim vector but ignore it; used for autoaim crosshair in DM - - ResetEmptySound(); - - if( m_flTimeWeaponIdle < gpGlobals->time ) - { - float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 ); - if( flRand <= 0.75 ) - { - if( m_iClip ) - { - SendWeaponAnim( CROSSBOW_IDLE ); - } - else - { - SendWeaponAnim( CROSSBOW_IDLE ); - } - m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); - } - else - { - if( m_iClip ) - { - m_flTimeWeaponIdle = gpGlobals->time + 90.0 / 30.0; - } - else - { - m_flTimeWeaponIdle = gpGlobals->time + 80.0 / 30.0; - } - m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); - } - } -} - -#endif diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index b94ef568..19a36cfe 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -156,19 +156,19 @@ void CCrowbar::SecondaryAttack( void ) switch( RANDOM_LONG( 0, 3 ) ) { case 0: - EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "taunts/taunt1.wav", 1, ATTN_NORM, 0, 85 + RANDOM_LONG( 0, 0x1f ) ); + EMIT_SOUND( ENT( pev ), CHAN_ITEM, "taunts/taunt3", 1, ATTN_NORM ); break; case 1: - EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "taunts/taunt2.wav", 1, ATTN_NORM, 0, 85 + RANDOM_LONG( 0, 0x1f ) ); + EMIT_SOUND( ENT( pev ), CHAN_ITEM, "taunts/taunt2.wav", 1, ATTN_NORM ); break; case 2: - EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "taunts/taunt3.wav", 1, ATTN_NORM, 0, 85 + RANDOM_LONG( 0, 0x1f ) ); + EMIT_SOUND( ENT( pev ), CHAN_ITEM, "taunts/taunt4.wav", 1, ATTN_NORM ); break; case 3: - EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/pepsigun_shoot.wav", 1, ATTN_NORM, 0, 85 + RANDOM_LONG( 0, 0x1f ) ); + EMIT_SOUND( ENT( pev ), CHAN_ITEM, "taunts/taunt1.wav", 1, ATTN_NORM ); break; }; - m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2; + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2.5; } void CCrowbar::Smack() diff --git a/dlls/evilsci.cpp b/dlls/evilsci.cpp index d512f5be..6abdb6d2 100644 --- a/dlls/evilsci.cpp +++ b/dlls/evilsci.cpp @@ -190,7 +190,6 @@ void CEvisci::Precache() int i; PRECACHE_MODEL( "models/evilsci.mdl" ); - } //========================================================= diff --git a/dlls/glock2.cpp b/dlls/glock2.cpp deleted file mode 100644 index 18e83667..00000000 --- a/dlls/glock2.cpp +++ /dev/null @@ -1,259 +0,0 @@ -#include "extdll.h" -#include "util.h" -#include "cbase.h" -#include "monsters.h" -#include "weapons.h" -#include "nodes.h" -#include "player.h" - -enum glock_e -{ - GLOCK_IDLE1 = 0, - GLOCK_IDLE2, - GLOCK_IDLE3, - GLOCK_SHOOT, - GLOCK_SHOOT_EMPTY, - GLOCK_RELOAD, - GLOCK_RELOAD_NOT_EMPTY, - GLOCK_DRAW, - GLOCK_HOLSTER, - GLOCK_ADD_SILENCER -}; - -class CGlock2 : public CBasePlayerWeapon -{ -public: - void Spawn( void ); - void Precache( void ); - int iItemSlot( void ) { return 2; } - int GetItemInfo(ItemInfo *p); - - void PrimaryAttack( void ); - void SecondaryAttack( void ); - void GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim ); - BOOL Deploy( void ); - void Reload( void ); - void WeaponIdle( void ); - - virtual BOOL UseDecrement( void ) - { - return FALSE; - } - -private: - int m_iShell; - - unsigned short m_usFireGlock1; - unsigned short m_usFireGlock2; -}; - -LINK_ENTITY_TO_CLASS( weapon_glock2, CGlock2 ) - -void CGlock2::Spawn() -{ - pev->classname = MAKE_STRING( "weapon_glock2" ); // hack to allow for old names - Precache(); - m_iId = WEAPON_GLOCK2; - SET_MODEL( ENT( pev ), "models/w_9mmhandgun.mdl" ); - - m_iDefaultAmmo = GLOCK_DEFAULT_GIVE; - - FallInit();// get ready to fall down. -} - -void CGlock2::Precache( void ) -{ - PRECACHE_MODEL( "models/v_9mmhandgun.mdl" ); - PRECACHE_MODEL( "models/w_9mmhandgun.mdl" ); - PRECACHE_MODEL( "models/p_9mmhandgun.mdl" ); - - m_iShell = PRECACHE_MODEL( "models/shell.mdl" );// brass shell - - PRECACHE_SOUND( "items/9mmclip1.wav" ); - PRECACHE_SOUND( "items/9mmclip2.wav" ); - - PRECACHE_SOUND( "weapons/pl_gun1.wav" );//silenced handgun - PRECACHE_SOUND( "weapons/pl_gun2.wav" );//silenced handgun - PRECACHE_SOUND( "weapons/pl_gun3.wav" );//handgun - - m_usFireGlock1 = PRECACHE_EVENT( 1, "events/glock1.sc" ); - m_usFireGlock2 = PRECACHE_EVENT( 1, "events/glock2.sc" ); -} - -int CGlock2::GetItemInfo( ItemInfo *p ) -{ - p->pszName = STRING( pev->classname ); - p->pszAmmo1 = "snipars"; - p->iMaxAmmo1 = _9MM_MAX_CARRY; - p->pszAmmo2 = NULL; - p->iMaxAmmo2 = -1; - p->iMaxClip = GLOCK_MAX_CLIP; - p->iSlot = 1; - p->iPosition = 2; - p->iFlags = 0; - p->iId = m_iId = WEAPON_GLOCK2; - p->iWeight = GLOCK_WEIGHT; - - return 1; -} - -BOOL CGlock2::Deploy() -{ - // pev->body = 1; - return DefaultDeploy( "models/v_9mmhandgun.mdl", "models/p_9mmhandgun.mdl", GLOCK_DRAW, "onehanded", /*UseDecrement() ? 1 : 0*/ 0 ); -} - -void CGlock2::SecondaryAttack( void ) -{ - GlockFire( 0.1, 0.2, FALSE ); -} - -void CGlock2::PrimaryAttack( void ) -{ - GlockFire( 0.01, 0.3, TRUE ); -} - -void CGlock2::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim ) -{ - if( m_iClip <= 0 ) - { - if( m_fFireOnEmpty ) - { - PlayEmptySound(); - m_flNextPrimaryAttack = gpGlobals->time + 0.2; - } - - return; - } - - m_iClip--; - - m_pPlayer->pev->effects = (int)( m_pPlayer->pev->effects ) | EF_MUZZLEFLASH; - - int flags; -#if defined( CLIENT_WEAPONS ) - flags = FEV_NOTHOST; -#else - flags = 0; -#endif - // player "shoot" animation - m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); - - // silenced - if( pev->body == 1 ) - { - m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME; - m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH; - } - else - { - // non-silenced - m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; - m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH; - } - - Vector vecSrc = m_pPlayer->GetGunPosition(); - Vector vecAiming; - - if( fUseAutoAim ) - { - vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES ); - } - else - { - vecAiming = gpGlobals->v_forward; - } - - Vector vecDir; - vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_9MM, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); - - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireGlock1 : m_usFireGlock2, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 ); - - m_flNextPrimaryAttack = m_flNextSecondaryAttack = gpGlobals->time + flCycleTime; - - if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) - // HEV suit - indicate out of ammo condition - m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 ); - - m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); -} - -void CGlock2::Reload( void ) -{ - if( m_pPlayer->ammo_snipars <= 0 ) - return; - - int iResult; - - if( m_iClip == 0 ) - iResult = DefaultReload( 17, GLOCK_RELOAD, 1.5 ); - else - iResult = DefaultReload( 17, GLOCK_RELOAD_NOT_EMPTY, 1.5 ); - - if( iResult ) - { - m_flTimeWeaponIdle = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); - } -} - -void CGlock2::WeaponIdle( void ) -{ - ResetEmptySound(); - - m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES ); - - if( m_flTimeWeaponIdle > gpGlobals->time ) - return; - - // only idle if the slid isn't back - if( m_iClip != 0 ) - { - int iAnim; - float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0, 1.0 ); - - if( flRand <= 0.3 + 0 * 0.75 ) - { - iAnim = GLOCK_IDLE3; - m_flTimeWeaponIdle = gpGlobals->time + 49.0 / 16; - } - else if( flRand <= 0.6 + 0 * 0.875 ) - { - iAnim = GLOCK_IDLE1; - m_flTimeWeaponIdle = gpGlobals->time + 60.0 / 16.0; - } - else - { - iAnim = GLOCK_IDLE2; - m_flTimeWeaponIdle = gpGlobals->time + 40.0 / 16.0; - } - SendWeaponAnim( iAnim, 1 ); - } -} - -class CGlock2Ammo : public CBasePlayerAmmo -{ - void Spawn( void ) - { - Precache(); - SET_MODEL( ENT( pev ), "models/w_9mmclip.mdl" ); - CBasePlayerAmmo::Spawn(); - } - - void Precache( void ) - { - PRECACHE_MODEL( "models/w_9mmclip.mdl" ); - PRECACHE_SOUND( "items/9mmclip1.wav" ); - } - - BOOL AddAmmo( CBaseEntity *pOther ) - { - if( pOther->GiveAmmo( AMMO_GLOCKCLIP_GIVE, "9mm", _9MM_MAX_CARRY ) != -1 ) - { - EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM ); - return TRUE; - } - return FALSE; - } -}; - -LINK_ENTITY_TO_CLASS( ammo_snipars, CGlock2Ammo ) diff --git a/dlls/hammer.cpp b/dlls/hammer.cpp new file mode 100644 index 00000000..890e46b8 --- /dev/null +++ b/dlls/hammer.cpp @@ -0,0 +1,280 @@ +/*** +Dicks +***/ + +#include "extdll.h" +#include "util.h" +#include "cbase.h" +#include "monsters.h" +#include "weapons.h" +#include "nodes.h" +#include "player.h" +#include "gamerules.h" + +#define CROWBAR_BODYHIT_VOLUME 128 +#define CROWBAR_WALLHIT_VOLUME 512 + +class CHammer : public CBasePlayerWeapon +{ +public: + void Spawn( void ); + void Precache( void ); + int iItemSlot( void ) { return 1; } + void EXPORT SwingAgain( void ); + void EXPORT Smack( void ); + int GetItemInfo(ItemInfo *p); + + void PrimaryAttack( void ); + int Swing( int fFirst ); + BOOL Deploy( void ); + void Holster( int skiplocal = 0 ); + int m_iSwing; + TraceResult m_trHit; + + virtual BOOL UseDecrement( void ) + { +#if defined( CLIENT_WEAPONS ) + return TRUE; +#else + return FALSE; +#endif + } +private: +}; + +LINK_ENTITY_TO_CLASS( weapon_hammer, CHammer ) + +enum crowbar_e +{ + CROWBAR_IDLE = 0, + CROWBAR_DRAW, + CROWBAR_ATTACK +}; + + +void CHammer::Spawn( ) +{ + Precache(); + m_iId = WEAPON_HAMMER; + SET_MODEL( ENT( pev ), "models/w_hammer.mdl" ); + m_iClip = -1; + + FallInit();// get ready to fall down. +} + +void CHammer::Precache( void ) +{ + PRECACHE_MODEL( "models/v_hammer.mdl" ); + PRECACHE_MODEL( "models/w_hammer.mdl" ); + PRECACHE_MODEL( "models/p_hammer.mdl" ); + PRECACHE_SOUND( "weapons/hammer_hit.wav" ); + PRECACHE_SOUND( "weapons/hammer_hitbod.wav" ); +} + +int CHammer::GetItemInfo( ItemInfo *p ) +{ + p->pszName = STRING( pev->classname ); + p->pszAmmo1 = NULL; + p->iMaxAmmo1 = -1; + p->pszAmmo2 = NULL; + p->iMaxAmmo2 = -1; + p->iMaxClip = WEAPON_NOCLIP; + p->iSlot = 0; + p->iPosition = 3; + p->iId = WEAPON_HAMMER; + p->iWeight = 10; + return 1; +} + +BOOL CHammer::Deploy() +{ + return DefaultDeploy( "models/v_hammer.mdl", "models/p_hammer.mdl", CROWBAR_DRAW, "hammer" ); +} + +void CHammer::Holster( int skiplocal /* = 0 */ ) +{ + m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1; +} + +void FindHullIntersection69( const Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity ) +{ + int i, j, k; + float distance; + float *minmaxs[2] = {mins, maxs}; + TraceResult tmpTrace; + Vector vecHullEnd = tr.vecEndPos; + Vector vecEnd; + + distance = 1e6f; + + vecHullEnd = vecSrc + ( ( vecHullEnd - vecSrc ) * 2 ); + UTIL_TraceLine( vecSrc, vecHullEnd, dont_ignore_monsters, pEntity, &tmpTrace ); + if( tmpTrace.flFraction < 1.0 ) + { + tr = tmpTrace; + return; + } + + for( i = 0; i < 2; i++ ) + { + for( j = 0; j < 2; j++ ) + { + for( k = 0; k < 2; k++ ) + { + vecEnd.x = vecHullEnd.x + minmaxs[i][0]; + vecEnd.y = vecHullEnd.y + minmaxs[j][1]; + vecEnd.z = vecHullEnd.z + minmaxs[k][2]; + + UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, pEntity, &tmpTrace ); + if( tmpTrace.flFraction < 1.0 ) + { + float thisDistance = ( tmpTrace.vecEndPos - vecSrc ).Length(); + if( thisDistance < distance ) + { + tr = tmpTrace; + distance = thisDistance; + } + } + } + } + } +} + +void CHammer::PrimaryAttack() +{ + if( !Swing( 1 ) ) + { + SetThink( &CCrowbar::SwingAgain ); + pev->nextthink = gpGlobals->time + 1; + } +} + +void CHammer::Smack() +{ + DecalGunshot( &m_trHit, BULLET_PLAYER_CROWBAR ); +} + +void CHammer::SwingAgain( void ) +{ + Swing( 0 ); +} + +int CHammer::Swing( int fFirst ) +{ + int fDidHit = FALSE; + + TraceResult tr; + + UTIL_MakeVectors( m_pPlayer->pev->v_angle ); + Vector vecSrc = m_pPlayer->GetGunPosition(); + Vector vecEnd = vecSrc + gpGlobals->v_forward * 32; + + UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr ); + +#ifndef CLIENT_DLL + if( tr.flFraction >= 1.0 ) + { + UTIL_TraceHull( vecSrc, vecEnd, dont_ignore_monsters, head_hull, ENT( m_pPlayer->pev ), &tr ); + if( tr.flFraction < 1.0 ) + { + // Calculate the point of intersection of the line (or hull) and the object we hit + // This is and approximation of the "best" intersection + CBaseEntity *pHit = CBaseEntity::Instance( tr.pHit ); + if( !pHit || pHit->IsBSPModel() ) + FindHullIntersection69( vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlayer->edict() ); + vecEnd = tr.vecEndPos; // This is the point on the actual surface (the hull could have hit space) + } + } +#endif +// PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usCrowbar, +//0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0, +// 0.0, 0, 0.0 ); + SendWeaponAnim( CROWBAR_ATTACK ); +m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH; +pev->effects |= EF_MUZZLEFLASH; + if( tr.flFraction >= 1.0 ) + { + if( fFirst ) + { + // miss + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1; + + // player "shoot" animation + m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); + } + } + else + { + SendWeaponAnim( CROWBAR_ATTACK); + + // player "shoot" animation + m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); + +#ifndef CLIENT_DLL + // hit + fDidHit = TRUE; + CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit ); + + ClearMultiDamage(); + + if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() ) + { + // first swing does full damage + pEntity->TraceAttack( m_pPlayer->pev, 50, gpGlobals->v_forward, &tr, DMG_CLUB | DMG_ALWAYSGIB ); + } + else + { + // subsequent swings do half + pEntity->TraceAttack( m_pPlayer->pev, 50, gpGlobals->v_forward, &tr, DMG_CLUB | DMG_ALWAYSGIB ); + } + ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev ); + + // play thwack, smack, or dong sound + float flVol = 1.0; + int fHitWorld = TRUE; + + if( pEntity ) + { + if( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE ) + { + // play thwack or smack sound + EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/hammer_hitbod.wav", 1, ATTN_NORM ); + m_pPlayer->m_iWeaponVolume = CROWBAR_BODYHIT_VOLUME; + if( !pEntity->IsAlive() ) + return TRUE; + else + flVol = 0.1; + + fHitWorld = FALSE; + } + } + + // play texture hit sound + // UNDONE: Calculate the correct point of intersection when we hit with the hull instead of the line + + if( fHitWorld ) + { + float fvolbar = TEXTURETYPE_PlaySound( &tr, vecSrc, vecSrc + ( vecEnd - vecSrc ) * 2, BULLET_PLAYER_CROWBAR ); + + if( g_pGameRules->IsMultiplayer() ) + { + // override the volume here, cause we don't play texture sounds in multiplayer, + // and fvolbar is going to be 0 from the above call. + + fvolbar = 1; + } + EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/hammer_hit.wav", fvolbar, ATTN_NORM, 0, 98 + RANDOM_LONG( 0, 3 ) ); + + // delay the decal a bit + m_trHit = tr; + } + + m_pPlayer->m_iWeaponVolume = flVol * CROWBAR_WALLHIT_VOLUME; +#endif + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1; + + SetThink( &CCrowbar::Smack ); + pev->nextthink = UTIL_WeaponTimeBase() + 0.3; + } + return fDidHit; +} diff --git a/dlls/katana.cpp b/dlls/katana.cpp index 7bd53164..01e1ddca 100644 --- a/dlls/katana.cpp +++ b/dlls/katana.cpp @@ -101,7 +101,7 @@ int CKatana::GetItemInfo( ItemInfo *p ) p->iMaxAmmo2 = -1; p->iMaxClip = WEAPON_NOCLIP; p->iSlot = 0; - p->iPosition = 1; + p->iPosition = 2; p->iId = WEAPON_KATANA; p->iWeight = CROWBAR_WEIGHT; return 1; @@ -109,10 +109,10 @@ int CKatana::GetItemInfo( ItemInfo *p ) BOOL CKatana::Deploy() { - return DefaultDeploy( "models/v_katana.mdl", "models/p_katana.mdl", CROWBAR_DRAW, "katana" ); - EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/katana_draw.wav", 1, ATTN_NORM ); +int ret = DefaultDeploy( "models/v_katana.mdl", "models/p_katana.mdl", CROWBAR_DRAW, "katana" );EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/katana_draw.wav", 1, ATTN_NORM ); +return ret; } - + void CKatana::Holster( int skiplocal /* = 0 */ ) { m_pPlayer->m_flNextAttack = gpGlobals->time + 0.5; diff --git a/dlls/mp5.cpp b/dlls/mp5.cpp index 5e7a0ce9..eadabef0 100644 --- a/dlls/mp5.cpp +++ b/dlls/mp5.cpp @@ -228,7 +228,7 @@ void CMP5::SecondaryAttack( void ) PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usMP52 ); m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1; - m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.1; + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.15; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5;// idle pretty soon after shooting. if( !m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] ) diff --git a/dlls/needle.cpp b/dlls/needle.cpp index d7feb73c..9b3184ed 100644 --- a/dlls/needle.cpp +++ b/dlls/needle.cpp @@ -31,23 +31,21 @@ public: void Spawn( void ); void Precache( void ); int iItemSlot( void ) { return 1; } - void EXPORT SwingAgain( void ); - void EXPORT Smack( void ); int GetItemInfo(ItemInfo *p); void PrimaryAttack( void ); - int Swing( int fFirst ); BOOL Deploy( void ); void Holster( int skiplocal = 0 ); - int m_iSwing; - TraceResult m_trHit; virtual BOOL UseDecrement( void ) { +#if defined( CLIENT_WEAPONS ) + return TRUE; +#else return FALSE; +#endif } private: - unsigned short m_usNeedle; }; @@ -77,8 +75,6 @@ void CNeedle::Precache( void ) PRECACHE_MODEL( "models/w_needle.mdl" ); PRECACHE_MODEL( "models/p_needle.mdl" ); PRECACHE_SOUND( "weapons/needleshot.wav" ); - - m_usNeedle = PRECACHE_EVENT( 1, "events/crowbar.sc" ); } int CNeedle::GetItemInfo( ItemInfo *p ) @@ -90,7 +86,7 @@ int CNeedle::GetItemInfo( ItemInfo *p ) p->iMaxAmmo2 = -1; p->iMaxClip = WEAPON_NOCLIP; p->iSlot = 0; - p->iPosition = 2; + p->iPosition = 1; p->iId = WEAPON_NEEDLE; p->iWeight = CROWBAR_WEIGHT; return 1; @@ -103,219 +99,15 @@ BOOL CNeedle::Deploy() void CNeedle::Holster( int skiplocal /* = 0 */ ) { - m_pPlayer->m_flNextAttack = gpGlobals->time + 0.5; + m_pPlayer->m_flNextAttack = gpGlobals->time + 1; SendWeaponAnim( NEEDLE_IDLE1 ); } void CNeedle::PrimaryAttack() { SendWeaponAnim( NEEDLE_GIVESHOT ); - EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/needleshot.wav", 1, ATTN_NORM, 0, 85 + RANDOM_LONG( 0, 0x1f ) ); - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 3; -} - - -void CNeedle::Smack() -{ - DecalGunshot( &m_trHit, BULLET_PLAYER_CROWBAR ); -} - -void CNeedle::SwingAgain( void ) -{ - Swing( 0 ); -} - -void FindHullIntersection2( const Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity ) -{ - int i, j, k; - float distance; - float *minmaxs[2] = {mins, maxs}; - TraceResult tmpTrace; - Vector vecHullEnd = tr.vecEndPos; - Vector vecEnd; - - distance = 1e6f; - - vecHullEnd = vecSrc + ( ( vecHullEnd - vecSrc ) * 2 ); - UTIL_TraceLine( vecSrc, vecHullEnd, dont_ignore_monsters, pEntity, &tmpTrace ); - if( tmpTrace.flFraction < 1.0 ) - { - tr = tmpTrace; - return; - } - - for( i = 0; i < 2; i++ ) - { - for( j = 0; j < 2; j++ ) - { - for( k = 0; k < 2; k++ ) - { - vecEnd.x = vecHullEnd.x + minmaxs[i][0]; - vecEnd.y = vecHullEnd.y + minmaxs[j][1]; - vecEnd.z = vecHullEnd.z + minmaxs[k][2]; - - UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, pEntity, &tmpTrace ); - if( tmpTrace.flFraction < 1.0 ) - { - float thisDistance = ( tmpTrace.vecEndPos - vecSrc ).Length(); - if( thisDistance < distance ) - { - tr = tmpTrace; - distance = thisDistance; - } - } - } - } - } +EMIT_SOUND( ENT( pev ), CHAN_ITEM, "weapons/needleshot.wav", 1, ATTN_NORM ); + + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 8; } - -int CNeedle::Swing( int fFirst ) -{ - int fDidHit = FALSE; - - TraceResult tr; - - UTIL_MakeVectors( m_pPlayer->pev->v_angle ); - Vector vecSrc = m_pPlayer->GetGunPosition(); - Vector vecEnd = vecSrc + gpGlobals->v_forward * 32; - - UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr ); - -#ifndef CLIENT_DLL - if( tr.flFraction >= 1.0 ) - { - UTIL_TraceHull( vecSrc, vecEnd, dont_ignore_monsters, head_hull, ENT( m_pPlayer->pev ), &tr ); - if( tr.flFraction < 1.0 ) - { - // Calculate the point of intersection of the line (or hull) and the object we hit - // This is and approximation of the "best" intersection - CBaseEntity *pHit = CBaseEntity::Instance( tr.pHit ); - if( !pHit || pHit->IsBSPModel() ) -FindHullIntersection2( vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlayer->edict() ); - vecEnd = tr.vecEndPos; // This is the point on the actual surface (the hull could have hit space) - } - } -#endif - PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usNeedle, - 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0, - 0.0, 0, 0.0 ); - - if( tr.flFraction >= 1.0 ) - { - if( fFirst ) - { - // miss - m_flNextPrimaryAttack = gpGlobals->time + 0.5; - - // player "shoot" animation - m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); - } - } - else - { - switch( ( ( m_iSwing++ ) % 2 ) + 1 ) - { - case 0: - SendWeaponAnim( NEEDLE_IDLE1 ); - break; - case 1: - SendWeaponAnim( NEEDLE_IDLE1 ); - break; - case 2: - SendWeaponAnim( NEEDLE_IDLE1 ); - break; - } - - // player "shoot" animation - m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); - -#ifndef CLIENT_DLL - // hit - fDidHit = TRUE; - CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit ); - - ClearMultiDamage(); - - if( ( m_flNextPrimaryAttack + 1 < gpGlobals->time ) || g_pGameRules->IsMultiplayer() ) - { - // first swing does full damage - pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB ); - } - else - { - // subsequent swings do half - pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar / 2, gpGlobals->v_forward, &tr, DMG_CLUB ); - } - ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev ); - - // play thwack, smack, or dong sound - float flVol = 1.0; - int fHitWorld = TRUE; - - if( pEntity ) - { - if( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE ) - { - // play thwack or smack sound - switch( RANDOM_LONG( 0, 2 ) ) - { - case 0: - EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1, ATTN_NORM ); - break; - case 1: - EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1, ATTN_NORM ); - break; - case 2: - EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1, ATTN_NORM ); - break; - } - m_pPlayer->m_iWeaponVolume = NEEDLE_BODYHIT_VOLUME; - if( !pEntity->IsAlive() ) - return TRUE; - else - flVol = 0.1; - - fHitWorld = FALSE; - } - } - - // play texture hit sound - // UNDONE: Calculate the correct point of intersection when we hit with the hull instead of the line - - if( fHitWorld ) - { - float fvolbar = TEXTURETYPE_PlaySound( &tr, vecSrc, vecSrc + ( vecEnd - vecSrc ) * 2, BULLET_PLAYER_CROWBAR ); - - if( g_pGameRules->IsMultiplayer() ) - { - // override the volume here, cause we don't play texture sounds in multiplayer, - // and fvolbar is going to be 0 from the above call. - - fvolbar = 1; - } - - // also play crowbar strike - switch( RANDOM_LONG( 0, 1 ) ) - { - case 0: - EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hit1.wav", fvolbar, ATTN_NORM, 0, 98 + RANDOM_LONG( 0, 3 ) ); - break; - case 1: - EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hit2.wav", fvolbar, ATTN_NORM, 0, 98 + RANDOM_LONG( 0, 3 ) ); - break; - } - - // delay the decal a bit - m_trHit = tr; - } - - m_pPlayer->m_iWeaponVolume = flVol * NEEDLE_WALLHIT_VOLUME; -#endif - m_flNextPrimaryAttack = gpGlobals->time + 0.25; - - SetThink( &CNeedle::Smack ); - pev->nextthink = gpGlobals->time + 0.2; - } - return fDidHit; -} diff --git a/dlls/pepsigun.cpp b/dlls/pepsigun.cpp index 4631dec6..f9c9d7f2 100644 --- a/dlls/pepsigun.cpp +++ b/dlls/pepsigun.cpp @@ -7,7 +7,7 @@ #include "player.h" #include "gamerules.h" -#define WEAPON_PEPSIGUN 22 +#define WEAPON_PEPSIGUN 21 class CPepsigun : public CBasePlayerWeapon { diff --git a/dlls/player.cpp b/dlls/player.cpp index 7f16f8c2..3c7e78fa 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -3353,6 +3353,7 @@ void CBasePlayer::CheatImpulseCommands( int iImpulse ) GiveNamedItem( "item_suit" ); GiveNamedItem( "item_battery" ); GiveNamedItem( "weapon_crowbar" ); + GiveNamedItem( "weapon_hammer" ); GiveNamedItem( "weapon_9mmhandgun" ); GiveNamedItem( "ammo_9mmclip" ); GiveNamedItem( "weapon_shotgun" ); diff --git a/dlls/rock.cpp b/dlls/rock.cpp index efa9f799..2a284a8c 100644 --- a/dlls/rock.cpp +++ b/dlls/rock.cpp @@ -25,7 +25,7 @@ // special deathmatch shotgun spreads #define VECTOR_CONE_DM_SHOTGUN Vector( 0.08716, 0.04362, 0.00 )// 10 degrees by 5 degrees #define VECTOR_CONE_DM_DOUBLESHOTGUN Vector( 0.17365, 0.04362, 0.00 ) // 20 degrees by 5 degrees -#define WEAPON_ROCK 21 +#define WEAPON_ROCK 20 enum shotgun_e { @@ -118,11 +118,11 @@ void CRock::PrimaryAttack() Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16; Vector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity; - CGrenadeRock::ShootTimed( m_pPlayer->pev, vecSrc, vecThrow, 300000000000 ); + CGrenadeRock::ShootTimed( m_pPlayer->pev, vecSrc, vecThrow * 1.5, 300000000000 ); SendWeaponAnim( PEPSIGUN_THROW ); m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75; + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75; m_fInSpecialReload = 0; diff --git a/dlls/rpg.cpp b/dlls/rpg.cpp index e2dd3cc7..22a14fe7 100644 --- a/dlls/rpg.cpp +++ b/dlls/rpg.cpp @@ -284,7 +284,7 @@ void CRpg::Reload( void ) // Set the next attack time into the future so that WeaponIdle will get called more often // than reload, allowing the RPG LTD to be updated - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.7; if( m_cActiveRockets && m_fSpotActive ) { @@ -323,11 +323,11 @@ void CRpg::Spawn() #endif { // more default ammo in multiplay. - m_iDefaultAmmo = RPG_DEFAULT_GIVE * 2; + m_iDefaultAmmo = 128 * 2; } else { - m_iDefaultAmmo = RPG_DEFAULT_GIVE; + m_iDefaultAmmo = 128; } FallInit();// get ready to fall down. @@ -354,10 +354,10 @@ int CRpg::GetItemInfo( ItemInfo *p ) { p->pszName = STRING( pev->classname ); p->pszAmmo1 = "rockets"; - p->iMaxAmmo1 = ROCKET_MAX_CARRY; + p->iMaxAmmo1 = 2560; p->pszAmmo2 = NULL; p->iMaxAmmo2 = -1; - p->iMaxClip = RPG_MAX_CLIP; + p->iMaxClip = -1; p->iSlot = 3; p->iPosition = 0; p->iId = m_iId = WEAPON_RPG; @@ -404,7 +404,7 @@ void CRpg::Holster( int skiplocal /* = 0 */ ) { m_fInReload = FALSE;// cancel any reload in progress. - m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; + m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.65; SendWeaponAnim( RPG_HOLSTER1 ); @@ -457,16 +457,17 @@ void CRpg::PrimaryAttack() EMIT_SOUND_DYN( edict(), CHAN_WEAPON, "weapons/rocketfire1.wav", 0.9, ATTN_NORM, 0, PITCH_NORM ); EMIT_SOUND_DYN( edict(), CHAN_ITEM, "weapons/glauncher.wav", 0.7, ATTN_NORM, 0, PITCH_NORM ); SendWeaponAnim( RPG_FIRE2 + 1 - gun ); - m_iClip--; + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--; - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.35; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.35; + + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.45; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.45; gun = !gun; } else { PlayEmptySound(); - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.3; + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; } UpdateSpot(); } @@ -570,14 +571,14 @@ class CRpgAmmo : public CBasePlayerAmmo #endif { // hand out more ammo per rocket in multiplayer. - iGive = AMMO_RPGCLIP_GIVE * 2; + iGive = 128 * 2; } else { - iGive = AMMO_RPGCLIP_GIVE; + iGive = 128; } - if( pOther->GiveAmmo( iGive, "rockets", ROCKET_MAX_CARRY ) != -1 ) + if( pOther->GiveAmmo( iGive, "rockets", 2560 ) != -1 ) { EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM ); return TRUE; diff --git a/dlls/sawnoff.cpp b/dlls/sawnoff.cpp index 848415f4..18d5cd03 100644 --- a/dlls/sawnoff.cpp +++ b/dlls/sawnoff.cpp @@ -184,12 +184,12 @@ void CSawnoff::PrimaryAttack() if( g_pGameRules->IsMultiplayer() ) #endif { - vecDir = m_pPlayer->FireBulletsPlayer( 30, vecSrc, vecAiming, VECTOR_CONE_DM_SAWNOFF, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + vecDir = m_pPlayer->FireBulletsPlayer( 10, vecSrc, vecAiming, VECTOR_CONE_DM_SAWNOFF, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); } else { // regular old, untouched spread. - vecDir = m_pPlayer->FireBulletsPlayer( 30, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + vecDir = m_pPlayer->FireBulletsPlayer( 10, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); } PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSingleFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); @@ -255,12 +255,12 @@ void CSawnoff::SecondaryAttack( void ) #endif { // tuned for deathmatch - vecDir = m_pPlayer->FireBulletsPlayer( 60, vecSrc, vecAiming, VECTOR_CONE_DM_DOUBLESAWNOFF, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + vecDir = m_pPlayer->FireBulletsPlayer( 20, vecSrc, vecAiming, VECTOR_CONE_DM_DOUBLESAWNOFF, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); } else { // untouched default single player - vecDir = m_pPlayer->FireBulletsPlayer( 60, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + vecDir = m_pPlayer->FireBulletsPlayer( 20, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); } PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usDoubleFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); diff --git a/dlls/sniper.cpp b/dlls/sniper.cpp index 51a34cd6..0b2767c3 100644 --- a/dlls/sniper.cpp +++ b/dlls/sniper.cpp @@ -12,10 +12,15 @@ #include "nodes.h" #include "soundent.h" - +#define WEAPON_SNIPARS 18 class CSnipars : public CBasePlayerWeapon { public: +#ifndef CLIENT_DLL + int Save( CSave &save ); + int Restore( CRestore &restore ); + static TYPEDESCRIPTION m_SaveData[]; +#endif void Spawn( void ); void Precache( void ); int iItemSlot( void ) { return 2; } @@ -41,6 +46,14 @@ private: //unsigned short m_usFireSniper; }; +TYPEDESCRIPTION CSnipars::m_SaveData[] = +{ +DEFINE_FIELD( CSnipars, m_flSoundDelay, FIELD_FLOAT ), +DEFINE_FIELD( CSnipars, m_fInZoom, FIELD_INTEGER ), +}; + +IMPLEMENT_SAVERESTORE( CSnipars, CBasePlayerWeapon ) + enum sniper_e { SNIPARS_IDLE = 0, @@ -67,6 +80,7 @@ int CSnipars::GetItemInfo(ItemInfo *p) return 1; } +DEFINE_FIELD( CSnipars, m_fInZoom, FIELD_INTEGER ), int CSnipars::AddToPlayer( CBasePlayer *pPlayer ) { @@ -213,7 +227,7 @@ void CSnipars::Shoot( float flSpread , float flCycleTime, BOOL fUseAutoAim ) vecAiming = gpGlobals->v_forward; } - Vector vecDir = m_pPlayer->FireBulletsPlayer( 3, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_SNIPARS, 0, 3, m_pPlayer->pev, m_pPlayer->random_seed ); + Vector vecDir = m_pPlayer->FireBulletsPlayer( 3, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_9MM, 0, 50, m_pPlayer->pev, m_pPlayer->random_seed ); //PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usFireSniper, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 ); pev->effects |= EF_MUZZLEFLASH; diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index fe667b15..b8e5bae2 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -308,7 +308,6 @@ void W_Precache( void ) //needle UTIL_PrecacheOtherWeapon( "weapon_needle"); - UTIL_PrecacheOtherWeapon( "weapon_glock2"); // crowbar UTIL_PrecacheOtherWeapon( "weapon_crowbar" ); diff --git a/dlls/weapons.h b/dlls/weapons.h index f99046ce..181d3ebd 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -95,9 +95,7 @@ public: #define WEAPON_SNARK 15 #define WEAPON_SAWNOFF 16 #define WEAPON_NEEDLE 17 -#define WEAPON_SNIPARS 18 -#define WEAPON_GLOCK2 19 -#define WEAPON_KATANA 20 +#define WEAPON_KATANA 24 #define WEAPON_HAMMER 23 @@ -210,8 +208,6 @@ typedef enum BULLET_PLAYER_357, // python BULLET_PLAYER_BUCKSHOT, // shotgun BULLET_PLAYER_CROWBAR, // crowbar swipe - BULLET_PLAYER_SNIPARS, - BULLET_PLAYER_PEPSI, BULLET_MONSTER_9MM, BULLET_MONSTER_MP5,