From e3ec6cc19f7c8de78ef76e584e6fff166ae4a49b Mon Sep 17 00:00:00 2001 From: Night Owl Date: Fri, 26 Oct 2018 00:33:44 +0500 Subject: [PATCH] Do not use client weapons. --- cl_dll/CMakeLists.txt | 18 +----------------- cl_dll/hl/hl_weapons.cpp | 38 -------------------------------------- dlls/CMakeLists.txt | 2 -- dlls/crowbar.cpp | 6 +++--- dlls/glock.cpp | 2 +- dlls/mp5.cpp | 6 +++--- dlls/noffice/torch.cpp | 4 ++-- dlls/shotgun.cpp | 6 +++--- 8 files changed, 13 insertions(+), 69 deletions(-) diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index dd108283..da0f1c7c 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -26,7 +26,7 @@ project (CLDLL) set (CLDLL_LIBRARY client) -add_definitions(-DCLIENT_WEAPONS -DCLIENT_DLL) +add_definitions(-DCLIENT_DLL) if(NOT MSVC) add_compile_options(-fno-exceptions) # GCC/Clang flag @@ -51,22 +51,6 @@ set (CLDLL_SOURCES noffice/pain.cpp noffice/cinematic.cpp noffice/deathvision.cpp - ../dlls/noffice/torch.cpp - ../dlls/noffice/holster.cpp -# ../dlls/crossbow.cpp - ../dlls/crowbar.cpp -# ../dlls/egon.cpp -# ../dlls/gauss.cpp -# ../dlls/handgrenade.cpp -# ../dlls/hornetgun.cpp - ../dlls/mp5.cpp -# ../dlls/python.cpp - ../dlls/rpg.cpp -# ../dlls/satchel.cpp - ../dlls/shotgun.cpp -# ../dlls/squeakgrenade.cpp - ../dlls/tripmine.cpp - ../dlls/glock.cpp ev_hldm.cpp hl/hl_baseentity.cpp hl/hl_events.cpp diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index ea4f32c6..c394f229 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -53,12 +53,6 @@ int g_irunninggausspred = 0; vec3_t previousorigin; // HLDM Weapon placeholder entities. -CHolster g_Holster; -CTorch g_Torch; -CGlock g_Glock; -CCrowbar g_Crowbar; -CMP5 g_Mp5; -CShotgun g_Shotgun; /* ====================== @@ -592,14 +586,6 @@ void HUD_InitClientWeapons( void ) // Allocate a slot for the local player HUD_PrepEntity( &player, NULL ); - - // Allocate slot(s) for each weapon that we are going to be predicting - HUD_PrepEntity( &g_Holster, &player ); - HUD_PrepEntity( &g_Torch, &player ); - HUD_PrepEntity( &g_Glock, &player ); - HUD_PrepEntity( &g_Crowbar, &player ); - HUD_PrepEntity( &g_Mp5, &player ); - HUD_PrepEntity( &g_Shotgun, &player ); } /* @@ -659,30 +645,6 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm // Get current clock gpGlobals->time = time; - // Fill in data based on selected weapon - // FIXME, make this a method in each weapon? where you pass in an entity_state_t *? - switch( from->client.m_iId ) - { - case WEAPON_HOLSTER: - pWeapon = &g_Holster; - break; - case WEAPON_TORCH: - pWeapon = &g_Torch; - break; - case WEAPON_CROWBAR: - pWeapon = &g_Crowbar; - break; - case WEAPON_GLOCK: - pWeapon = &g_Glock; - break; - case WEAPON_MP5: - pWeapon = &g_Mp5; - break; - case WEAPON_SHOTGUN: - pWeapon = &g_Shotgun; - break; - } - // Store pointer to our destination entity_state_t so we can get our origin, etc. from it // for setting up events on the client g_finalstate = to; diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index adf76df8..63c27c12 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -25,8 +25,6 @@ project (SVDLL) set (SVDLL_LIBRARY server) -add_definitions(-DCLIENT_WEAPONS) - if(NOT MSVC) add_compile_options(-fno-exceptions) # GCC/Clang flag add_compile_options(-Wno-invalid-offsetof) # GCC/Clang flag diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index f3b13058..1e72f844 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -217,7 +217,7 @@ int CCrowbar::Swing( int fFirst ) if( fFirst ) { // miss - m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 ); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5 ; // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); } @@ -320,7 +320,7 @@ int CCrowbar::Swing( int fFirst ) SetThink( &CCrowbar::Smack ); pev->nextthink = UTIL_WeaponTimeBase() + 0.2; #endif - m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 ); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; } return fDidHit; } @@ -343,7 +343,7 @@ void CCrowbar::WeaponIdle( void ) m_flReleaseThrow = 0; m_flStartThrow = 0; - m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 ); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5; return; } diff --git a/dlls/glock.cpp b/dlls/glock.cpp index e08aed3e..928f4ca2 100644 --- a/dlls/glock.cpp +++ b/dlls/glock.cpp @@ -155,7 +155,7 @@ void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim ) else { PlayEmptySound(); - m_flNextPrimaryAttack = GetNextAttackDelay( 0.2 ); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2; } return; diff --git a/dlls/mp5.cpp b/dlls/mp5.cpp index 63093bbd..7ad134d2 100644 --- a/dlls/mp5.cpp +++ b/dlls/mp5.cpp @@ -139,14 +139,14 @@ void CMP5::PrimaryAttack() if( m_pPlayer->pev->waterlevel == 3 ) { PlayEmptySound(); - m_flNextPrimaryAttack = 0.15; + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15; return; } if( m_iClip <= 0 ) { PlayEmptySound(); - m_flNextPrimaryAttack = 0.15; + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15; return; } @@ -190,7 +190,7 @@ void CMP5::PrimaryAttack() // HEV suit - indicate out of ammo condition m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 ); - m_flNextPrimaryAttack = GetNextAttackDelay( 0.1 ); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1; if( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() ) m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1; diff --git a/dlls/noffice/torch.cpp b/dlls/noffice/torch.cpp index 16477af3..fbd28aab 100644 --- a/dlls/noffice/torch.cpp +++ b/dlls/noffice/torch.cpp @@ -183,7 +183,7 @@ void CTorch::PrimaryAttack() PLAYBACK_EVENT_FULL(flags, m_pPlayer->edict(), m_usTorch, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, m_fIsOn, 0); - m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(0.2); + m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.2; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); @@ -326,4 +326,4 @@ void CTorch::UpdateSpot(void) } } #endif -} \ No newline at end of file +} diff --git a/dlls/shotgun.cpp b/dlls/shotgun.cpp index 563b5c0f..40180420 100644 --- a/dlls/shotgun.cpp +++ b/dlls/shotgun.cpp @@ -132,7 +132,7 @@ void CShotgun::PrimaryAttack() if( m_pPlayer->pev->waterlevel == 3 ) { PlayEmptySound(); - m_flNextPrimaryAttack = GetNextAttackDelay( 0.15 ); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15; return; } @@ -187,7 +187,7 @@ void CShotgun::PrimaryAttack() m_flPumpTime = gpGlobals->time + 0.5; - m_flNextPrimaryAttack = GetNextAttackDelay( 0.75 ); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75; m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75; if( m_iClip != 0 ) m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0; @@ -216,7 +216,7 @@ void CShotgun::Reload( void ) m_fInSpecialReload = 1; m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.6; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6; - m_flNextPrimaryAttack = GetNextAttackDelay( 1.0 ); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.0; m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0; return; }