From 618e379ebf306c5f42bbcf0fbd8236055ebcd6ce Mon Sep 17 00:00:00 2001 From: "DPT.Velaron" Date: Mon, 10 Dec 2018 13:18:54 +0200 Subject: [PATCH] Fixes --- cl_dll/StudioModelRenderer.h | 2 + cl_dll/entity.cpp | 2 +- cl_dll/tfc/ev_tfc.cpp | 8 +-- dlls/tfc/tf_wpn_axe.cpp | 114 +++++++++++++++++++++++++---------- dlls/tfc/tf_wpn_gl.cpp | 2 +- dlls/tfc/tf_wpn_rpg.cpp | 96 +++++++++++++++-------------- dlls/tfc/tf_wpn_sg.cpp | 2 +- dlls/tfc/weapons.h | 3 + 8 files changed, 143 insertions(+), 86 deletions(-) diff --git a/cl_dll/StudioModelRenderer.h b/cl_dll/StudioModelRenderer.h index 69d28a1e..97ba1fe0 100644 --- a/cl_dll/StudioModelRenderer.h +++ b/cl_dll/StudioModelRenderer.h @@ -96,6 +96,8 @@ public: // Process movement of player virtual void StudioProcessGait( entity_state_t *pplayer ); + virtual int ReturnDiguisedClass( int iPlayerIndex ); + public: // Client clock diff --git a/cl_dll/entity.cpp b/cl_dll/entity.cpp index 2a92fa2c..025a0d7b 100644 --- a/cl_dll/entity.cpp +++ b/cl_dll/entity.cpp @@ -532,7 +532,7 @@ void DLLEXPORT HUD_CreateEntities( void ) Game_AddObjects(); } -extern int g_bACSpinning[33]; +int g_bACSpinning[33]; /* ========================= diff --git a/cl_dll/tfc/ev_tfc.cpp b/cl_dll/tfc/ev_tfc.cpp index c5cbbe59..489e7ece 100644 --- a/cl_dll/tfc/ev_tfc.cpp +++ b/cl_dll/tfc/ev_tfc.cpp @@ -61,10 +61,10 @@ struct eventnode_s }; typedef eventnode_s eventnode_t; -pmtrace_t *gp_tr_decal[32]; -float g_flSpinDownTime[32]; -int g_bACSpinning[32]; -float g_flSpinUpTime[32]; +pmtrace_t *gp_tr_decal[33]; +extern float g_flSpinDownTime[33]; +extern int g_bACSpinning[33]; +extern float g_flSpinUpTime[33]; extern "C" { diff --git a/dlls/tfc/tf_wpn_axe.cpp b/dlls/tfc/tf_wpn_axe.cpp index 9b304f9f..42e317a7 100644 --- a/dlls/tfc/tf_wpn_axe.cpp +++ b/dlls/tfc/tf_wpn_axe.cpp @@ -6,40 +6,18 @@ #include "nodes.h" #include "player.h" #include "gamerules.h" +#include "tf_defs.h" LINK_ENTITY_TO_CLASS( tf_weapon_axe, CTFAxe ) void CTFAxe::Spawn() { Precache(); - m_iId = 5; m_iClip = -1; pev->solid = SOLID_TRIGGER; } -int CTFAxe::GetItemInfo( ItemInfo *p ) -{ - p->pszAmmo1 = 0; - p->pszName = STRING( pev->classname ); - p->iMaxAmmo1 = -1; - p->pszAmmo2 = 0; - p->iMaxAmmo2 = -1; - p->iSlot = 0; - p->iPosition = 3; - p->iFlags = 0; - p->iMaxClip = -1; - p->iId = 5; - p->iWeight = 0; - return 1; -} - -void CTFAxe::Holster() -{ - SendWeaponAnim(AXE_HOLSTER, 1); - m_pPlayer->m_flNextAttack = 0.5; -} - void CTFAxe::Precache() { PRECACHE_MODEL("models/v_umbrella.mdl"); @@ -53,43 +31,113 @@ void CTFAxe::Precache() PRECACHE_SOUND("weapons/cbar_hitbod2.wav"); PRECACHE_SOUND("weapons/cbar_hitbod3.wav"); PRECACHE_SOUND("weapons/cbar_miss1.wav"); - classid = 3; + classid = PC_SOLDIER; m_usAxe = PRECACHE_EVENT(1, "events/wpn/tf_axe.sc"); m_usAxeDecal = PRECACHE_EVENT(1, "events/wpn/tf_axedecal.sc"); } +int CTFAxe::GetItemInfo( ItemInfo *p ) +{ + p->pszAmmo1 = 0; + p->iMaxAmmo1 = -1; + p->pszName = STRING( pev->classname ); + p->pszAmmo2 = 0; + p->iMaxAmmo2 = -1; + p->iMaxClip = -1; + p->iSlot = 0; + p->iPosition = 3; + p->iFlags = 0; + p->iId = WEAPON_AXE; + p->iWeight = 0; + return 1; +} + +void CTFAxe::Holster() +{ + m_pPlayer->m_flNextAttack = 0.5; + SendWeaponAnim(AXE_HOLSTER, 1); +} + +BOOL CTFAxe::AxeHit(CBaseEntity *pTarget, Vector p_vecDir, TraceResult *ptr) +{ + ClearMultiDamage(); + if(m_pPlayer->pev->playerclass != PC_SPY) + { + pTarget->TraceAttack(m_pPlayer->pev, 20, p_vecDir, ptr, 128); + ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev); + return 1; + } + + if(pTarget->IsPlayer()) + { + UTIL_MakeVectors(pTarget->pev->v_angle); + UTIL_MakeVectors(m_pPlayer->pev->v_angle); + if(gpGlobals->v_right.x * gpGlobals->v_forward.y - gpGlobals->v_right.y * gpGlobals->v_forward.x <= 0.0) + { + pTarget->TraceAttack(m_pPlayer->pev, 40, p_vecDir, ptr, 128); + } + else + { + if(m_bHullHit) + { + pTarget->TraceAttack(m_pPlayer->pev, 120, p_vecDir, ptr, 128); + } + else + { + pTarget->TraceAttack(m_pPlayer->pev, 60, p_vecDir, ptr, 128); + } + } + } + else + { + pTarget->TraceAttack(m_pPlayer->pev, 20, p_vecDir, ptr, 128); + ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev); + return 1; + } + + ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev); + return 1; +} + BOOL CTFAxe::Deploy() { - if(m_pPlayer->pev->playerclass == 11) + if(m_pPlayer->pev->playerclass == PC_CIVILIAN) return DefaultDeploy( "models/v_umbrella.mdl", "models/p_umbrella.mdl", AXE_DRAW, "crowbar", 1 ); else return DefaultDeploy( "models/v_tfc_crowbar.mdl", "models/p_crowbar.mdl", AXE_DRAW, "crowbar", 1 ); } -//Velaron: finish this? + void CTFAxe::PrimaryAttack() { - vec3_t vecSrc, vecEnd; + Vector vecSrc, vecEnd; TraceResult tr; m_bHullHit = 0; UTIL_MakeVectors(m_pPlayer->pev->v_angle); vecSrc = m_pPlayer->GetGunPosition(); - vecEnd.x = gpGlobals->v_forward.x * 32.0 + vecSrc.x; - vecEnd.y = gpGlobals->v_forward.y * 32.0 + vecSrc.y; - vecEnd.z = gpGlobals->v_forward.z * 32.0 + vecSrc.z; + vecEnd = gpGlobals->v_forward * 32.0f + vecSrc; + UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, ENT(m_pPlayer->pev), &tr); PLAYBACK_EVENT_FULL(1, ENT(m_pPlayer->pev), m_usAxe, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, classid, 0, 0, 0); if ( tr.flFraction >= 1.0 ) { m_bHullHit = 1; - //m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.4; m_flNextPrimaryAttack = 1.0; m_flTimeWeaponIdle = 5; m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); return; } - m_flNextPrimaryAttack = 1.0; - m_flTimeWeaponIdle = 5; m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); + m_flTimeWeaponIdle = 5; + m_flNextPrimaryAttack = 1.0; + + if(!tr.pHit) + { + m_pPlayer->m_iWeaponVolume = 128; + } + else + { + m_pPlayer->m_iWeaponVolume = 512; + } } LINK_ENTITY_TO_CLASS( tf_weapon_spanner, CTFSpanner ) diff --git a/dlls/tfc/tf_wpn_gl.cpp b/dlls/tfc/tf_wpn_gl.cpp index 7bc1d8fa..6d1149dc 100644 --- a/dlls/tfc/tf_wpn_gl.cpp +++ b/dlls/tfc/tf_wpn_gl.cpp @@ -73,7 +73,7 @@ void CTFGrenadeLauncher::Reload() { if ( m_pPlayer->ammo_rockets > 0 ) { - if ( m_iClip != 6 && m_flNextReload <= 0.0 && m_flNextPrimaryAttack <= 0.0 ) + if ( m_iClip != 6 && m_flNextPrimaryAttack <= 0.0 ) //&& m_flNextReload <= 0.0 { if (m_fInSpecialReload) { diff --git a/dlls/tfc/tf_wpn_rpg.cpp b/dlls/tfc/tf_wpn_rpg.cpp index ffb1bc64..5219b2ee 100644 --- a/dlls/tfc/tf_wpn_rpg.cpp +++ b/dlls/tfc/tf_wpn_rpg.cpp @@ -58,14 +58,14 @@ void CTFRpg::Precache() void CTFRpg::Reload( void ) { - if ( m_pPlayer->ammo_rockets == 0 || m_iClip == 4 || m_flNextReload > 0.0 || m_flNextPrimaryAttack > 0.0) + if ( m_pPlayer->ammo_rockets == 0 || m_iClip == 4 || m_flNextPrimaryAttack > 0.0) // || m_flNextReload > 0.0 return; if ( m_fInSpecialReload ) { if ( m_fInSpecialReload == 1 ) { - if ( m_flTimeWeaponIdle <= gpGlobals->time ) + if ( m_flTimeWeaponIdle <= UTIL_WeaponTimeBase() ) { m_fInSpecialReload = 2; SendWeaponAnim(TFCRPG_RELCYCLE, 1); @@ -95,65 +95,69 @@ void CTFRpg::Reload( void ) void CTFRpg::WeaponIdle( void ) { + ResetEmptySound(); - if (m_flTimeWeaponIdle > 0.0) - return; - - if(m_iClip > 0) + if(m_flTimeWeaponIdle <= 0.0) { - if (!m_fInSpecialReload) + if(m_iClip) { - if (m_pPlayer->ammo_rockets > 0) + if(!m_fInSpecialReload) { - if(m_iClip == 0) - SendWeaponAnim(TFCRPG_FIDGET2, 1); + if(m_pPlayer->ammo_rockets) + { + m_flTimeWeaponIdle = 3.0; + /* + if(m_iClip < 1) + SendWeaponAnim(TFCRPG_FIDGET2, 1); + else + SendWeaponAnim(TFCRPG_FIDGET, 1); + */ + } else - SendWeaponAnim(TFCRPG_IDLE, 1); - m_flTimeWeaponIdle = 3; + m_flTimeWeaponIdle = 1.0; + return; + } + if(m_iClip == 4) + { + SendWeaponAnim(TFCRPG_RELEND, 1); + m_fInSpecialReload = 0; + m_flTimeWeaponIdle = 1.5; + return; + } + } + else if (!m_fInSpecialReload) + { + if(m_pPlayer->ammo_rockets > 0) + { + Reload(); + return; + } + if(m_pPlayer->ammo_rockets) + { + m_flTimeWeaponIdle = 3.0; + /* + if(m_iClip < 1) + SendWeaponAnim(TFCRPG_FIDGET2, 1); + else + SendWeaponAnim(TFCRPG_FIDGET, 1); + */ } else - m_flTimeWeaponIdle = 1; + m_flTimeWeaponIdle = 1.0; return; } - if (m_iClip == 4) - { - SendWeaponAnim(TFCRPG_RELEND, 1); - m_fInSpecialReload = 0; - m_flTimeWeaponIdle = 1.5; - return; - } - } - else if (!m_fInSpecialReload) - { - if (m_pPlayer->ammo_rockets > 0) + + if(m_pPlayer->ammo_rockets > 0) { Reload(); - return; + return; } - if (m_pPlayer->ammo_rockets > 0) - { - if(m_iClip == 0) - SendWeaponAnim(TFCRPG_FIDGET2, 1); - else - SendWeaponAnim(TFCRPG_IDLE, 1); - m_flTimeWeaponIdle = 3; - } - else - m_flTimeWeaponIdle = 1; + SendWeaponAnim(TFCRPG_RELEND, 1); + m_fInSpecialReload = 0; + m_flTimeWeaponIdle = 1.5; return; } - - if (m_pPlayer->ammo_rockets > 0) - { - Reload(); - return; - } - - SendWeaponAnim(TFCRPG_RELEND, 1); - m_fInSpecialReload = 0; - m_flTimeWeaponIdle = 1.5; - return; } BOOL CTFRpg::Deploy() diff --git a/dlls/tfc/tf_wpn_sg.cpp b/dlls/tfc/tf_wpn_sg.cpp index 9a5669a7..3763ed0b 100644 --- a/dlls/tfc/tf_wpn_sg.cpp +++ b/dlls/tfc/tf_wpn_sg.cpp @@ -118,7 +118,7 @@ void CTFShotgun::Reload( void ) { if ( m_pPlayer->ammo_buckshot >= m_iShellsReloaded ) { - if ( m_iClip != m_iMaxClipSize && m_flNextReload <= 0.0 && m_flNextPrimaryAttack <= 0.0 ) + if ( m_iClip != m_iMaxClipSize && m_flNextPrimaryAttack <= 0.0 ) // && m_flNextReload <= 0.0 { if (m_fInSpecialReload) { diff --git a/dlls/tfc/weapons.h b/dlls/tfc/weapons.h index 67b4ecd3..b78a8e05 100644 --- a/dlls/tfc/weapons.h +++ b/dlls/tfc/weapons.h @@ -463,8 +463,11 @@ public: int GetItemInfo(ItemInfo *p); BOOL CanHolster(void) {return 1;}; void Holster(void); + BOOL AxeHit(CBaseEntity *pTarget, Vector p_vecDir, TraceResult *ptr); BOOL Deploy(void); void PrimaryAttack(void); + int iItemSlot( void ) {return 1;} + int IsUseable( void ) {return 1;} int classid; BOOL m_bHullHit; unsigned short m_usAxe;