From b16001bc1a5aee5e548b9d4e701e4c3296fa6604 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Mon, 10 May 2021 06:10:35 +0300 Subject: [PATCH 01/18] possible crash fix for DeathNotice --- dlls/multiplay_gamerules.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index 5a4b14e0..137b3eeb 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -709,12 +709,12 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, const char *tau = "tau_cannon"; const char *gluon = "gluon gun"; - if( pKiller->flags & FL_CLIENT ) + if( pevInflictor ) { - killer_index = ENTINDEX( ENT( pKiller ) ); - - if( pevInflictor ) + if( pKiller->flags & FL_CLIENT ) { + killer_index = ENTINDEX( ENT( pKiller ) ); + if( pevInflictor == pKiller ) { // If the inflictor is the killer, then it must be their current weapon doing the damage @@ -730,10 +730,10 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, killer_weapon_name = STRING( pevInflictor->classname ); // it's just that easy } } - } - else - { - killer_weapon_name = STRING( pevInflictor->classname ); + else + { + killer_weapon_name = STRING( pevInflictor->classname ); + } } // strip the monster_* or weapon_* from the inflictor's classname From de65256d866bb58459681c7e8425db07bbef870d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D1=81=D0=BB=D0=B0=D0=B2=20?= =?UTF-8?q?=D0=A1=D1=83=D1=85=D0=BE=D0=B2?= <22411953+Vladislav4KZ@users.noreply.github.com> Date: Wed, 26 May 2021 23:13:43 +0600 Subject: [PATCH 02/18] cmake: fix build Fix the error: Unknown CMake command "elif" --- cmake/LibraryNaming.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/LibraryNaming.cmake b/cmake/LibraryNaming.cmake index f4e3d4b0..26866447 100644 --- a/cmake/LibraryNaming.cmake +++ b/cmake/LibraryNaming.cmake @@ -92,7 +92,7 @@ endif() if(BUILDOS STREQUAL "android") set(POSTFIX "") # force disable for Android, as Android ports aren't distributed in normal way and doesn't follow library naming -elif(BUILDOS AND BUILDARCH) +elseif(BUILDOS AND BUILDARCH) set(POSTFIX "_${BUILDOS}_${BUILDARCH}") elseif(BUILDARCH) set(POSTFIX "_${BUILDARCH}") From e4dd9192cc9cdbc3737c46b11c3fac42dda5ffee Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 1 Jun 2021 17:38:24 +0300 Subject: [PATCH 03/18] client: fix scoreboard not setting IN_SCORE bit in usercmd --- cl_dll/input.cpp | 6 ++++++ cl_dll/scoreboard.cpp | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cl_dll/input.cpp b/cl_dll/input.cpp index eab15acf..76659a94 100644 --- a/cl_dll/input.cpp +++ b/cl_dll/input.cpp @@ -645,11 +645,13 @@ void IN_Impulse( void ) void IN_ScoreDown( void ) { KeyDown( &in_score ); + gHUD.m_Scoreboard.UserCmd_ShowScores(); } void IN_ScoreUp( void ) { KeyUp( &in_score ); + gHUD.m_Scoreboard.UserCmd_HideScores(); } void IN_MLookUp( void ) @@ -1082,6 +1084,10 @@ void InitInput( void ) gEngfuncs.pfnAddCommand( "-reload", IN_ReloadUp ); gEngfuncs.pfnAddCommand( "+alt1", IN_Alt1Down ); gEngfuncs.pfnAddCommand( "-alt1", IN_Alt1Up ); + gEngfuncs.pfnAddCommand( "+score", IN_ScoreDown ); + gEngfuncs.pfnAddCommand( "-score", IN_ScoreUp ); + gEngfuncs.pfnAddCommand( "+showscores", IN_ScoreDown ); + gEngfuncs.pfnAddCommand( "-showscores", IN_ScoreUp ); gEngfuncs.pfnAddCommand( "+graph", IN_GraphDown ); gEngfuncs.pfnAddCommand( "-graph", IN_GraphUp ); gEngfuncs.pfnAddCommand( "+break", IN_BreakDown ); diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp index 721980f3..b5b2ae31 100644 --- a/cl_dll/scoreboard.cpp +++ b/cl_dll/scoreboard.cpp @@ -51,8 +51,8 @@ int CHudScoreboard::Init( void ) gHUD.AddHudElem( this ); // Hook messages & commands here - HOOK_COMMAND( "+showscores", ShowScores ); - HOOK_COMMAND( "-showscores", HideScores ); + // HOOK_COMMAND( "+showscores", ShowScores ); + // HOOK_COMMAND( "-showscores", HideScores ); HOOK_MESSAGE( ScoreInfo ); HOOK_MESSAGE( TeamScore ); From 7fdc58743d1c3a4de6489232a233cf6f3a1b7a28 Mon Sep 17 00:00:00 2001 From: exstrim401 Date: Sat, 5 Jun 2021 12:48:51 +0500 Subject: [PATCH 04/18] Haiku OS support (#170) * Haiku OS support * Add Haiku OS to CMake LibraryNaming --- cmake/LibraryNaming.cmake | 3 +++ public/build.h | 4 ++++ scripts/waifulib/library_naming.py | 3 +++ 3 files changed, 10 insertions(+) diff --git a/cmake/LibraryNaming.cmake b/cmake/LibraryNaming.cmake index 26866447..db50422e 100644 --- a/cmake/LibraryNaming.cmake +++ b/cmake/LibraryNaming.cmake @@ -29,6 +29,7 @@ check_symbol_exists(XASH_MOBILE_PLATFORM "build.h" XASH_MOBILE_PLATFORM) check_symbol_exists(XASH_MSVC "build.h" XASH_MSVC) check_symbol_exists(XASH_NETBSD "build.h" XASH_NETBSD) check_symbol_exists(XASH_OPENBSD "build.h" XASH_OPENBSD) +check_symbol_exists(XASH_HAIKU "build.h" XASH_HAIKU) check_symbol_exists(XASH_WIN32 "build.h" XASH_WIN32) check_symbol_exists(XASH_WIN64 "build.h" XASH_WIN64) check_symbol_exists(XASH_X86 "build.h" XASH_X86) @@ -45,6 +46,8 @@ elseif(XASH_NETBSD) set(BUILDOS "netbsd") elseif(XASH_OPENBSD) set(BUILDOS "openbsd") +elseif(XASH_HAIKU) + set(BUILDOS "haiku") elseif(XASH_EMSCRIPTEN) set(BUILDOS "emscripten") else() diff --git a/public/build.h b/public/build.h index 043a11cd..e23265ce 100644 --- a/public/build.h +++ b/public/build.h @@ -67,6 +67,7 @@ For more information, please refer to #undef XASH_MSVC #undef XASH_NETBSD #undef XASH_OPENBSD +#undef XASH_HAIKU #undef XASH_WIN32 #undef XASH_WIN64 #undef XASH_X86 @@ -115,6 +116,9 @@ For more information, please refer to #elif defined __WATCOMC__ && defined __DOS__ #define XASH_DOS4GW 1 #define XASH_LITTLE_ENDIAN +#elif defined __HAIKU__ + #define XASH_HAIKU 1 + #define XASH_POSIX 1 #else #error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug" #endif diff --git a/scripts/waifulib/library_naming.py b/scripts/waifulib/library_naming.py index 6ee9a725..baf2ee71 100644 --- a/scripts/waifulib/library_naming.py +++ b/scripts/waifulib/library_naming.py @@ -47,6 +47,7 @@ DEFINES = [ 'XASH_MSVC', 'XASH_NETBSD', 'XASH_OPENBSD', +'XASH_HAIKU', 'XASH_WIN32', 'XASH_WIN64', 'XASH_X86', @@ -79,6 +80,8 @@ def configure(conf): buildos = "emscripten" elif conf.env.XASH_DOS4GW: buildos = "dos4gw" # unused, just in case + elif conf.env.XASH_HAIKU: + buildos = "haiku" else: conf.fatal("Place your operating system name in build.h and library_naming.py!\n" "If this is a mistake, try to fix conditions above and report a bug") From 2de4e7ab003d5b1674d12525f5aefb1e57a49fa3 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sat, 5 Jun 2021 19:18:33 +0500 Subject: [PATCH 05/18] Fix scientist's sound mask. Same as https://github.com/ValveSoftware/halflife/issues/2982. --- dlls/scientist.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index e679770a..e04fabea 100644 --- a/dlls/scientist.cpp +++ b/dlls/scientist.cpp @@ -761,6 +761,9 @@ int CScientist::ISoundMask( void ) { return bits_SOUND_WORLD | bits_SOUND_COMBAT | + bits_SOUND_CARCASS | + bits_SOUND_MEAT | + bits_SOUND_GARBAGE | bits_SOUND_DANGER | bits_SOUND_PLAYER; } From 8c45ae9bb2eb5efd4999e1e39f6b34daeefa9ae7 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sat, 5 Jun 2021 20:02:32 +0500 Subject: [PATCH 06/18] Fix underwater breathing sounds when player not fully in the water. Same as https://github.com/ValveSoftware/halflife/issues/3110. --- dlls/player.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/dlls/player.cpp b/dlls/player.cpp index fc264cc9..6f5f2541 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -1198,23 +1198,26 @@ void CBasePlayer::WaterMove() } // make bubbles - air = (int)( pev->air_finished - gpGlobals->time ); - if( !RANDOM_LONG( 0, 0x1f ) && RANDOM_LONG( 0, AIRTIME - 1 ) >= air ) + if( pev->waterlevel == 3 ) { - switch( RANDOM_LONG( 0, 3 ) ) + air = (int)( pev->air_finished - gpGlobals->time ); + if( !RANDOM_LONG( 0, 0x1f ) && RANDOM_LONG( 0, AIRTIME - 1 ) >= air ) { - case 0: - EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim1.wav", 0.8, ATTN_NORM ); - break; - case 1: - EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim2.wav", 0.8, ATTN_NORM ); - break; - case 2: - EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim3.wav", 0.8, ATTN_NORM ); - break; - case 3: - EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim4.wav", 0.8, ATTN_NORM ); - break; + switch( RANDOM_LONG( 0, 3 ) ) + { + case 0: + EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim1.wav", 0.8, ATTN_NORM ); + break; + case 1: + EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim2.wav", 0.8, ATTN_NORM ); + break; + case 2: + EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim3.wav", 0.8, ATTN_NORM ); + break; + case 3: + EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim4.wav", 0.8, ATTN_NORM ); + break; + } } } From 2c7e07ef490a7ba5d466a299ac77a04ce623e6da Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sat, 5 Jun 2021 20:13:07 +0500 Subject: [PATCH 07/18] Fix egon beam color. Same as https://github.com/ValveSoftware/halflife/issues/3033. --- cl_dll/ev_hldm.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index f5e512ea..0db780f7 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -1373,7 +1373,7 @@ void EV_FireRpg( event_args_t *args ) //====================== //====================== -// EGON END +// EGON START //====================== enum egon_e { @@ -1502,10 +1502,11 @@ void EV_EgonFire( event_args_t *args ) float g = 50.0f; float b = 125.0f; - if( IEngineStudio.IsHardware() ) + // if( IEngineStudio.IsHardware() ) { - r /= 100.0f; - g /= 100.0f; + r /= 255.0f; + g /= 255.0f; + b /= 255.0f; } pBeam = gEngfuncs.pEfxAPI->R_BeamEntPoint( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 3.5, 0.2, 0.7, 55, 0, 0, r, g, b ); From 6274c601febb5cacf82500a4aa4dae926debda47 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sat, 5 Jun 2021 20:20:22 +0500 Subject: [PATCH 08/18] Fix trigger_camera fps dependency. Same as https://github.com/ValveSoftware/halflife/issues/2924. --- dlls/triggers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index 2c0888c9..a4bcbbc7 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -2318,8 +2318,8 @@ void CTriggerCamera::FollowTarget() if( dy > 180 ) dy = dy - 360; - pev->avelocity.x = dx * 40 * gpGlobals->frametime; - pev->avelocity.y = dy * 40 * gpGlobals->frametime; + pev->avelocity.x = dx * 40 * 0.01f; + pev->avelocity.y = dy * 40 * 0.01f; if( !( FBitSet( pev->spawnflags, SF_CAMERA_PLAYER_TAKECONTROL ) ) ) { From ea9eb82646957a892f10796c13efac73f8687a5e Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sat, 5 Jun 2021 20:56:57 +0500 Subject: [PATCH 09/18] Set monsteryawspeedfix cvar to 1 by default. --- dlls/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/game.cpp b/dlls/game.cpp index 72d0b75f..1207a089 100644 --- a/dlls/game.cpp +++ b/dlls/game.cpp @@ -35,7 +35,7 @@ cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER }; cvar_t selfgauss = { "selfgauss", "1", FCVAR_SERVER }; cvar_t chargerfix = { "chargerfix", "0", FCVAR_SERVER }; cvar_t satchelfix = { "satchelfix", "0", FCVAR_SERVER }; -cvar_t monsteryawspeedfix = { "monsteryawspeedfix", "0", FCVAR_SERVER }; +cvar_t monsteryawspeedfix = { "monsteryawspeedfix", "1", FCVAR_SERVER }; cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER }; cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER }; cvar_t aimcrosshair = { "mp_autocrosshair","1", FCVAR_SERVER }; From 9fecfb50f352764f13266117b5882e2d33a996c8 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 16 Mar 2021 18:53:50 +0300 Subject: [PATCH 10/18] Merge https://github.com/Solokiller/halflife-updated/commit/2ca64e11b05b1f3f62af9640636f891b7c38cc8c --- dlls/buttons.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/buttons.cpp b/dlls/buttons.cpp index 8344c814..87e08ce7 100644 --- a/dlls/buttons.cpp +++ b/dlls/buttons.cpp @@ -637,7 +637,7 @@ void DoSpark( entvars_t *pev, const Vector &location ) void CBaseButton::ButtonSpark( void ) { SetThink( &CBaseButton::ButtonSpark ); - pev->nextthink = gpGlobals->time + 0.1f + RANDOM_FLOAT( 0.0f, 1.5f );// spark again at random interval + pev->nextthink = pev->ltime + 0.1f + RANDOM_FLOAT( 0.0f, 1.5f );// spark again at random interval DoSpark( pev, pev->mins ); } From 397286021c1e1c6c67dca45f3420c0fb8c8d28fb Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Thu, 11 Feb 2021 02:34:07 +0300 Subject: [PATCH 11/18] Try fixing occasional bug with missing mp5 reload animation when holding primary attack after clip was depleted --- cl_dll/hl/hl_weapons.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index 754fd594..43485100 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -372,7 +372,7 @@ void CBasePlayerWeapon::ItemPostFrame( void ) m_fFireOnEmpty = FALSE; // weapon is useable. Reload if empty and weapon has waited as long as it has to after firing - if( m_iClip == 0 && !( iFlags() & ITEM_FLAG_NOAUTORELOAD ) && m_flNextPrimaryAttack < 0.0f ) + if( m_iClip == 0 && !( iFlags() & ITEM_FLAG_NOAUTORELOAD ) && m_flNextPrimaryAttack <= 0.0f ) { Reload(); return; From 464a678b3311b18d31c8d628ac53c930f819e46c Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sun, 6 Jun 2021 02:40:52 +0500 Subject: [PATCH 12/18] Remove WeaponTick and override ItemPostFrame instead. --- dlls/shotgun.cpp | 4 +++- dlls/weapons.cpp | 2 -- dlls/weapons.h | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dlls/shotgun.cpp b/dlls/shotgun.cpp index 90ec7e8c..9c84c5c2 100644 --- a/dlls/shotgun.cpp +++ b/dlls/shotgun.cpp @@ -302,7 +302,7 @@ void CShotgun::Reload( void ) } } -void CShotgun::WeaponTick() +void CShotgun::ItemPostFrame( void ) { if( m_flPumpTime && m_flPumpTime < gpGlobals->time ) { @@ -310,6 +310,8 @@ void CShotgun::WeaponTick() EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/scock1.wav", 1, ATTN_NORM, 0, 95 + RANDOM_LONG( 0, 0x1f ) ); m_flPumpTime = 0; } + + CBasePlayerWeapon::ItemPostFrame(); } void CShotgun::WeaponIdle( void ) diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index a69ba196..42e1f6ce 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -602,8 +602,6 @@ BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted ) void CBasePlayerWeapon::ItemPostFrame( void ) { - WeaponTick(); - if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= UTIL_WeaponTimeBase() ) ) { // complete the reload. diff --git a/dlls/weapons.h b/dlls/weapons.h index 312f5531..d1051883 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -319,7 +319,6 @@ public: virtual void PrimaryAttack( void ) { return; } // do "+ATTACK" virtual void SecondaryAttack( void ) { return; } // do "+ATTACK2" virtual void Reload( void ) { return; } // do "+RELOAD" - virtual void WeaponTick() {} // Always called at beginning of ItemPostFrame. - Solokiller virtual void WeaponIdle( void ) { return; } // called when no buttons pressed virtual int UpdateClientData( CBasePlayer *pPlayer ); // sends hud info to client dll, if things have changed virtual void RetireWeapon( void ); @@ -639,8 +638,8 @@ public: void SecondaryAttack( void ); BOOL Deploy( ); void Reload( void ); - void WeaponTick(); void WeaponIdle( void ); + void ItemPostFrame( void ); int m_fInReload; float m_flNextReload; int m_iShell; From 593c9185aa2d43d56bacd67599a0843342bea02d Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sun, 6 Jun 2021 02:48:22 +0500 Subject: [PATCH 13/18] Do not override IsUseable for mp5. Merge https://github.com/Solokiller/halflife-updated/commit/a9b1d9cda8e063258fc9291ada671c09ef71472b. --- dlls/mp5.cpp | 6 ------ dlls/weapons.cpp | 32 +++++++++++++++++++++++++++----- dlls/weapons.h | 1 - 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/dlls/mp5.cpp b/dlls/mp5.cpp index fcfbd179..47d0a24d 100644 --- a/dlls/mp5.cpp +++ b/dlls/mp5.cpp @@ -270,12 +270,6 @@ void CMP5::WeaponIdle( void ) m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); // how long till we do this again. } -BOOL CMP5::IsUseable() -{ - //Can be used if the player has AR grenades. - Solokiller - return CBasePlayerWeapon::IsUseable() || m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] > 0; -} - class CMP5AmmoClip : public CBasePlayerAmmo { void Spawn( void ) diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 42e1f6ce..88c91a36 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -897,16 +897,38 @@ BOOL CBasePlayerWeapon::AddSecondaryAmmo( int iCount, char *szName, int iMax ) //========================================================= BOOL CBasePlayerWeapon::IsUseable( void ) { - if( m_iClip <= 0 ) + if( m_iClip > 0 ) + { + return TRUE; + } + + // Player has unlimited ammo for this weapon or does not use magazines + if( iMaxAmmo1() == WEAPON_NOCLIP ) + { + return TRUE; + } + + if( m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] > 0 ) + { + return TRUE; + } + + if( pszAmmo2() ) { - if( m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] <= 0 && iMaxAmmo1() != -1 ) + // Player has unlimited ammo for this weapon or does not use magazines + if( iMaxAmmo2() == WEAPON_NOCLIP ) { - // clip is empty (or nonexistant) and the player has no more ammo of this type. - return FALSE; + return TRUE; + } + + if( m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()] > 0 ) + { + return TRUE; } } - return TRUE; + // clip is empty (or nonexistant) and the player has no more ammo of this type. + return FALSE; } BOOL CBasePlayerWeapon::CanDeploy( void ) diff --git a/dlls/weapons.h b/dlls/weapons.h index d1051883..a3870299 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -568,7 +568,6 @@ public: BOOL Deploy( void ); void Reload( void ); void WeaponIdle( void ); - BOOL IsUseable(); float m_flNextAnimTime; int m_iShell; From 2c9cb0c645b8e8b4014760063406e8c447929d91 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sun, 6 Jun 2021 03:48:55 +0500 Subject: [PATCH 14/18] Revert "Merge https://github.com/SamVanheer/HLEnhanced/commit/33413807d0ca23f3d9121e45f5584cb5be98751b" This reverts commit 19bdc1d01b7287cd61b58fb7b7bdb6953caa50a8. --- dlls/gauss.cpp | 36 ++++++++++-------------------------- dlls/weapons.h | 2 +- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/dlls/gauss.cpp b/dlls/gauss.cpp index 96345ad2..50707dfe 100644 --- a/dlls/gauss.cpp +++ b/dlls/gauss.cpp @@ -124,12 +124,6 @@ int CGauss::GetItemInfo( ItemInfo *p ) return 1; } -BOOL CGauss::IsUseable() -{ - // Currently charging, allow the player to fire it first. - Solokiller - return CBasePlayerWeapon::IsUseable() || m_fInAttack != 0; -} - BOOL CGauss::Deploy() { m_pPlayer->m_flPlayAftershock = 0.0; @@ -231,22 +225,6 @@ void CGauss::SecondaryAttack() } else { - // Moved to before the ammo burn. - // Because we drained 1 when m_InAttack == 0, then 1 again now before checking if we're out of ammo, - // this resuled in the player having -1 ammo, which in turn caused CanDeploy to think it could be deployed. - // This will need to be fixed further down the line by preventing negative ammo unless explicitly required (infinite ammo?), - // But this check will prevent the problem for now. - Solokiller - // TODO: investigate further. - if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) - { - // out of ammo! force the gun to fire - StartFire(); - m_fInAttack = 0; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f; - m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1; - return; - } - // during the charging process, eat one bit of ammo every once in a while if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flNextAmmoBurn && m_pPlayer->m_flNextAmmoBurn != 1000 ) { @@ -266,6 +244,16 @@ void CGauss::SecondaryAttack() } } + if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) + { + // out of ammo! force the gun to fire + StartFire(); + m_fInAttack = 0; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0; + m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1; + return; + } + if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flAmmoStartCharge ) { // don't eat any more ammo after gun is fully charged. @@ -583,10 +571,6 @@ void CGauss::WeaponIdle( void ) StartFire(); m_fInAttack = 0; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; - - // Need to set m_flNextPrimaryAttack so the weapon gets a chance to complete its secondary fire animation. - Solokiller - if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5f; } else { diff --git a/dlls/weapons.h b/dlls/weapons.h index a3870299..ad8f2fe4 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -745,7 +745,7 @@ public: int iItemSlot( void ) { return 4; } int GetItemInfo(ItemInfo *p); int AddToPlayer( CBasePlayer *pPlayer ); - BOOL IsUseable(); + BOOL Deploy( void ); void Holster( int skiplocal = 0 ); From 7a999bf987becaa268e50c6e40a609c949fff699 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 2 Jun 2021 02:10:30 +0300 Subject: [PATCH 15/18] Check before SetEnemy in squad monster --- dlls/squadmonster.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/squadmonster.cpp b/dlls/squadmonster.cpp index cbf3f19f..60479878 100644 --- a/dlls/squadmonster.cpp +++ b/dlls/squadmonster.cpp @@ -256,7 +256,10 @@ void CSquadMonster::SquadMakeEnemy( CBaseEntity *pEnemy ) if( pMember ) { // reset members who aren't activly engaged in fighting - if( pMember->m_hEnemy != pEnemy && !pMember->HasConditions( bits_COND_SEE_ENEMY ) ) + if( pMember->m_hEnemy != pEnemy && !pMember->HasConditions( bits_COND_SEE_ENEMY ) + && ( pMember->m_pSchedule && (pMember->m_pSchedule->iInterruptMask & bits_COND_NEW_ENEMY) ) + // My enemy might be not an enemy for member of my squad, e.g. if I was provoked by player. + && pMember->IRelationship(pEnemy) >= R_DL ) { if( pMember->m_hEnemy != 0 ) { From 59508d66da0ce01f596d43573dbf46a4c43c8111 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Thu, 13 May 2021 01:27:10 +0300 Subject: [PATCH 16/18] Allow special beam color for houndeye squad of size 5 --- dlls/houndeye.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/houndeye.cpp b/dlls/houndeye.cpp index ba388b63..0333ca21 100644 --- a/dlls/houndeye.cpp +++ b/dlls/houndeye.cpp @@ -514,6 +514,7 @@ void CHoundeye::WriteBeamColor( void ) bBlue = 255; break; case 4: + case 5: bRed = 62; bGreen = 33; bBlue = 211; From b4502f71336a08f3f2c72b7b061b2838a149a11b Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sun, 9 May 2021 04:36:02 +0300 Subject: [PATCH 17/18] Fix removing squad member --- dlls/squadmonster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/squadmonster.cpp b/dlls/squadmonster.cpp index 60479878..d168d732 100644 --- a/dlls/squadmonster.cpp +++ b/dlls/squadmonster.cpp @@ -167,7 +167,7 @@ void CSquadMonster::SquadRemove( CSquadMonster *pRemove ) { for( int i = 0; i < MAX_SQUAD_MEMBERS - 1; i++ ) { - if( pSquadLeader->m_hSquadMember[i] == this ) + if( pSquadLeader->m_hSquadMember[i] == pRemove ) { pSquadLeader->m_hSquadMember[i] = NULL; break; From 06dd8a63cd2999e401fe03ce00dcfcabad3820a1 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sun, 6 Jun 2021 04:11:36 +0500 Subject: [PATCH 18/18] Double promotion fix. --- dlls/gauss.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/gauss.cpp b/dlls/gauss.cpp index 50707dfe..c9352e8e 100644 --- a/dlls/gauss.cpp +++ b/dlls/gauss.cpp @@ -249,7 +249,7 @@ void CGauss::SecondaryAttack() // out of ammo! force the gun to fire StartFire(); m_fInAttack = 0; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f; m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1; return; }