Browse Source

Fix desert eagle.

opforfixed
Night Owl 7 years ago
parent
commit
3f0dbba90c
  1. 2
      cl_dll/ev_hldm.cpp
  2. 287
      dlls/gearbox/eagle.cpp
  3. 4
      dlls/weapons.cpp
  4. 40
      dlls/weapons.h

2
cl_dll/ev_hldm.cpp

@ -1951,7 +1951,7 @@ void EV_FireEagle( event_args_t *args ) @@ -1951,7 +1951,7 @@ void EV_FireEagle( event_args_t *args )
EV_MuzzleFlash();
gEngfuncs.pEventAPI->EV_WeaponAnimation( EAGLE_SHOOT, 1 );
V_PunchAxis( 0, -10.0 );
V_PunchAxis( 0, -4.0 );
}
// Play fire sound.

287
dlls/gearbox/eagle.cpp

@ -1,17 +1,10 @@ @@ -1,17 +1,10 @@
/***
*
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
//========= Copyright © 2004-2008, Raven City Team, All rights reserved. ============//
// //
// Purpose: //
// //
// $NoKeywords: $ //
//===================================================================================//
//Modifided by Lost_Gamer_
#include "extdll.h"
#include "util.h"
@ -21,26 +14,30 @@ @@ -21,26 +14,30 @@
#include "nodes.h"
#include "player.h"
enum eagle_e {
EAGLE_IDLE1 = 0,
EAGLE_IDLE2,
EAGLE_IDLE3,
EAGLE_IDLE4,
EAGLE_IDLE5,
EAGLE_SHOOT,
EAGLE_SHOOT_EMPTY,
EAGLE_RELOAD,
EAGLE_RELOAD_NOT_EMPTY,
EAGLE_DRAW,
EAGLE_HOLSTER,
enum deagle_e {
DEAGLE_IDLE1 = 0,
DEAGLE_IDLE2,
DEAGLE_IDLE3,
DEAGLE_IDLE4,
DEAGLE_IDLE5,
DEAGLE_SHOOT,
DEAGLE_SHOOT_EMPTY,
DEAGLE_RELOAD,
DEAGLE_RELOAD_NOT_EMPTY,
DEAGLE_DRAW,
DEAGLE_HOLSTER
};
LINK_ENTITY_TO_CLASS( weapon_eagle, CEagle )
LINK_ENTITY_TO_CLASS(weapon_eagle, CEagle);
#ifndef CLIENT_DLL
LINK_ENTITY_TO_CLASS( eagle_laser, CLaserSpot )
#endif
void CEagle::Spawn()
void CEagle::Spawn( void )
{
Precache();
pev->classname = MAKE_STRING("weapon_eagle"); // hack to allow for old names
Precache( );
m_iId = WEAPON_EAGLE;
SET_MODEL(ENT(pev), "models/w_desert_eagle.mdl");
@ -50,20 +47,20 @@ void CEagle::Spawn() @@ -50,20 +47,20 @@ void CEagle::Spawn()
}
void CEagle::Precache(void)
void CEagle::Precache( void )
{
UTIL_PrecacheOther( "eagle_laser" );
PRECACHE_MODEL("models/v_desert_eagle.mdl");
PRECACHE_MODEL("models/w_desert_eagle.mdl");
PRECACHE_MODEL("models/p_desert_eagle.mdl");
m_iShell = PRECACHE_MODEL ("models/shell.mdl");// brass shell
m_iShell = PRECACHE_MODEL("models/shell.mdl");// brass shell
PRECACHE_SOUND("weapons/desert_eagle_fire.wav");
PRECACHE_SOUND("weapons/desert_eagle_reload.wav");
PRECACHE_SOUND("weapons/desert_eagle_sight.wav");
PRECACHE_SOUND("weapons/desert_eagle_sight2.wav");
PRECACHE_SOUND ("weapons/desert_eagle_reload.wav");
PRECACHE_SOUND ("weapons/desert_eagle_fire.wav");
PRECACHE_SOUND ("weapons/desert_eagle_sight.wav");
PRECACHE_SOUND ("weapons/desert_eagle_sight2.wav");
m_usFireEagle = PRECACHE_EVENT(1, "events/eagle.sc");
m_usEagle = PRECACHE_EVENT( 1, "events/eagle.sc" );
}
int CEagle::GetItemInfo(ItemInfo *p)
@ -83,68 +80,71 @@ int CEagle::GetItemInfo(ItemInfo *p) @@ -83,68 +80,71 @@ int CEagle::GetItemInfo(ItemInfo *p)
return 1;
}
BOOL CEagle::Deploy()
BOOL CEagle::Deploy( )
{
return DefaultDeploy("models/v_desert_eagle.mdl", "models/p_desert_eagle.mdl", EAGLE_DRAW, "eagle", UseDecrement());
return DefaultDeploy( "models/v_desert_eagle.mdl", "models/p_desert_eagle.mdl", DEAGLE_DRAW, "onehanded", 0 );
}
void CEagle::Holster(int skiplocal /* = 0 */)
void CEagle::Holster( int skiplocal /* = 0 */ )
{
m_fInReload = FALSE;// cancel any reload in progress.
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
SendWeaponAnim( DEAGLE_HOLSTER );
SendWeaponAnim(EAGLE_HOLSTER);
#ifndef CLIENT_DLL
if (m_pSpot)
if (m_pEagleLaser)
{
m_pSpot->Killed(NULL, GIB_NEVER);
m_pSpot = NULL;
m_pEagleLaser->Killed( NULL, GIB_NEVER );
m_pEagleLaser = NULL;
}
#endif
}
void CEagle::SecondaryAttack(void)
void CEagle::SecondaryAttack()
{
m_fSpotActive = !m_fSpotActive;
#ifndef CLIENT_DLL
if (!m_fSpotActive && m_pSpot)
m_fEagleLaserActive = ! m_fEagleLaserActive;
if (!m_fEagleLaserActive && m_pEagleLaser)
{
m_pSpot->Killed(NULL, GIB_NORMAL);
m_pSpot = NULL;
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/desert_eagle_sight2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
m_pEagleLaser->Killed( NULL, GIB_NORMAL );
m_pEagleLaser = NULL;
}
#endif
if (m_fSpotActive)
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/desert_eagle_sight.wav", 1, ATTN_NORM);
else
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/desert_eagle_sight2.wav", 1, ATTN_NORM);
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.2;
{
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/desert_eagle_sight.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
}
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
}
void CEagle::PrimaryAttack(void)
void CEagle::PrimaryAttack()
{
if (m_iClip <= 0)
{
if (m_fFireOnEmpty)
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay(0.2);
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2;
}
return;
}
// don't fire underwater
if (m_pPlayer->pev->waterlevel == 3)
{
UpdateSpot( );
PlayEmptySound( );
m_flNextPrimaryAttack = UTIL_WeaponTimeBase()+ 0.15;
return;
}
UpdateSpot( );
float flSpread = 0.01;
m_iClip--;
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
int flags;
BOOL m_fLaserOn;
#if defined( CLIENT_WEAPONS )
flags = FEV_NOTHOST;
@ -153,136 +153,147 @@ void CEagle::PrimaryAttack(void) @@ -153,136 +153,147 @@ void CEagle::PrimaryAttack(void)
#endif
// player "shoot" animation
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
Vector vecSrc = m_pPlayer->GetGunPosition();
Vector vecSrc = m_pPlayer->GetGunPosition( );
Vector vecAiming;
const Vector& vecSpread = VECTOR_CONE_2DEGREES;
float flCycleTime;
vecAiming = gpGlobals->v_forward;
if (!m_fSpotActive)
Vector vecDir;
if (m_pEagleLaser)
{
vecAiming = m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
flCycleTime = 0.25f;
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed );
m_flNextPrimaryAttack = UTIL_WeaponTimeBase()+ 0.5;
#ifndef CLIENT_DLL
m_pEagleLaser->Suspend( 0.6 );
#endif
m_fLaserOn = TRUE;
}
else
{
vecAiming = gpGlobals->v_forward;
flCycleTime = 0.5f;
flSpread = 0.1;
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed );
m_flNextPrimaryAttack = UTIL_WeaponTimeBase()+ 0.22;
m_fLaserOn = FALSE;
}
Vector vecDir;
vecDir = m_pPlayer->FireBulletsPlayer(1, vecSrc, vecAiming, (m_fSpotActive) ? VECTOR_CONE_1DEGREES : VECTOR_CONE_10DEGREES, 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed);
PLAYBACK_EVENT_FULL(flags, m_pPlayer->edict(), m_usFireEagle, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, (m_iClip == 0) ? 1 : 0, 0);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEagle, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, flSpread, flSpread, ( m_iClip == 0 ) ? 1 : 0, 0 );
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 = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15);
UpdateSpot();
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}
void CEagle::Reload(void)
void CEagle::Reload( void )
{
if (m_pPlayer->ammo_357 <= 0)
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == EAGLE_MAX_CLIP)
return;
if (m_fSpotActive)
if ( m_pEagleLaser && m_fEagleLaserActive )
{
SecondaryAttack();
#ifndef CLIENT_DLL
m_pEagleLaser->Suspend( 1.6 );
#endif
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.5;
}
int iResult;
if (m_iClip == 0)
iResult = DefaultReload(EAGLE_MAX_CLIP, EAGLE_RELOAD, 1.5);
iResult = DefaultReload( EAGLE_MAX_CLIP, DEAGLE_RELOAD, 1.5 );
else
iResult = DefaultReload(EAGLE_MAX_CLIP, EAGLE_RELOAD_NOT_EMPTY, 1.5);
iResult = DefaultReload( EAGLE_MAX_CLIP, DEAGLE_RELOAD_NOT_EMPTY, 1.5 );
if (iResult)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}
}
void CEagle::UpdateSpot( void )
{
#ifndef CLIENT_DLL
if (m_fEagleLaserActive)
{
if (!m_pEagleLaser)
{
m_pEagleLaser = CLaserSpot::CreateSpot();
m_pEagleLaser->pev->classname = MAKE_STRING("eagle_laser");
m_pEagleLaser->pev->scale = 0.5;
}
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
Vector vecSrc = m_pPlayer->GetGunPosition( );;
Vector vecAiming = gpGlobals->v_forward;
TraceResult tr;
UTIL_TraceLine ( vecSrc, vecSrc + vecAiming * 8192, dont_ignore_monsters, ENT(m_pPlayer->pev), &tr );
UTIL_SetOrigin( m_pEagleLaser->pev, tr.vecEndPos );
void CEagle::WeaponIdle(void)
{
UpdateSpot();
if ( UTIL_PointContents(tr.vecEndPos) == CONTENT_SKY )
{
UTIL_Remove( m_pEagleLaser );
m_pEagleLaser = FALSE;
}
ResetEmptySound();
}
#endif
}
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
void CEagle::WeaponIdle( void )
{
UpdateSpot( );
if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase() )
{
ResetEmptySound( );
m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES );
// 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);
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0, 1.0 );
if (flRand <= 0.2)
if (m_pEagleLaser)
{
iAnim = EAGLE_IDLE1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f;
if (flRand > 0.5 )
{
iAnim = DEAGLE_IDLE5;//Done
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;
}
else if (flRand <= 0.4)
else
{
iAnim = EAGLE_IDLE2;
iAnim = DEAGLE_IDLE4;//Done
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f;
}
else if (flRand <= 0.6)
}
else
{
if (flRand <= 0.3 )
{
iAnim = EAGLE_IDLE3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.6f;
iAnim = DEAGLE_IDLE1;//Done
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f;
}
else if (flRand <= 0.8)
else if (flRand <= 0.6 )
{
iAnim = EAGLE_IDLE4;
iAnim = DEAGLE_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f;
}
else
{
iAnim = EAGLE_IDLE5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
iAnim = DEAGLE_IDLE3;//Done
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.63f;
}
SendWeaponAnim(iAnim, 1);
}
}
void CEagle::UpdateSpot(void)
{
#ifndef CLIENT_DLL
if (m_fSpotActive)
{
if (!m_pSpot)
{
m_pSpot = CLaserSpot::CreateSpot();
SendWeaponAnim( iAnim, UseDecrement() ? 1 : 0 );
}
UTIL_MakeVectors(m_pPlayer->pev->v_angle);
Vector vecSrc = m_pPlayer->GetGunPosition();
Vector vecAiming = gpGlobals->v_forward;
TraceResult tr;
UTIL_TraceLine(vecSrc, vecSrc + vecAiming * 8192, dont_ignore_monsters, ENT(m_pPlayer->pev), &tr);
UTIL_SetOrigin(m_pSpot->pev, tr.vecEndPos);
}
#endif
}

4
dlls/weapons.cpp

@ -1619,8 +1619,9 @@ IMPLEMENT_SAVERESTORE( CDisplacer, CBasePlayerWeapon ) @@ -1619,8 +1619,9 @@ IMPLEMENT_SAVERESTORE( CDisplacer, CBasePlayerWeapon )
TYPEDESCRIPTION CEagle::m_SaveData[] =
{
DEFINE_FIELD( CEagle, m_fSpotActive, FIELD_INTEGER ),
DEFINE_FIELD( CEagle, m_fEagleLaserActive, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CEagle, CBasePlayerWeapon )
TYPEDESCRIPTION CGrapple::m_SaveData[] =
@ -1641,7 +1642,6 @@ TYPEDESCRIPTION CM249::m_SaveData[] = @@ -1641,7 +1642,6 @@ TYPEDESCRIPTION CM249::m_SaveData[] =
};
IMPLEMENT_SAVERESTORE( CM249, CBasePlayerWeapon )
TYPEDESCRIPTION CPipeWrench::m_SaveData[] =
{
DEFINE_FIELD( CPipeWrench, m_iFirestate, FIELD_INTEGER ),

40
dlls/weapons.h

@ -1107,30 +1107,27 @@ private: @@ -1107,30 +1107,27 @@ private:
class CEagle : public CBasePlayerWeapon
{
public:
#ifndef CLIENT_DLL
int Save(CSave &save);
int Restore(CRestore &restore);
int Save( CSave &save );
int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
#endif
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 2; }
int GetItemInfo( ItemInfo *p );
void Spawn(void);
void Precache(void);
int iItemSlot(void) { return 2; }
int GetItemInfo(ItemInfo *p);
void PrimaryAttack(void);
void SecondaryAttack(void);
BOOL Deploy(void);
void Holster(int skiplocal = 0);
void Reload(void);
void WeaponIdle(void);
void UpdateSpot(void);
BOOL ShouldWeaponIdle(void) { return TRUE; };
void PrimaryAttack( void );
void SecondaryAttack( void );
BOOL Deploy( void );
void Holster( int skiplocal = 0 );
void Reload( void );
void WeaponIdle( void );
virtual BOOL UseDecrement(void)
void UpdateSpot( void );
CLaserSpot *m_pEagleLaser;
int m_fEagleLaserActive;
virtual BOOL UseDecrement( void )
{
#if defined( CLIENT_WEAPONS )
return TRUE;
@ -1139,13 +1136,10 @@ public: @@ -1139,13 +1136,10 @@ public:
#endif
}
CLaserSpot *m_pSpot;
int m_fSpotActive;
private:
int m_iShell;
unsigned short m_usFireEagle;
unsigned short m_usEagle;
};
class CGrappleTonguetip;

Loading…
Cancel
Save