diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index c705f359..7c8f3d6f 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -776,7 +776,6 @@ int EV_TFC_IsAllyTeam( int iTeam1, int iTeam2 ) return 0; } - //====================== // PAR21 START //====================== diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index fb57d107..60ca5e4c 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -357,7 +357,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; 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 ); diff --git a/cmake/LibraryNaming.cmake b/cmake/LibraryNaming.cmake index f4e3d4b0..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() @@ -92,7 +95,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}") 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 ); } diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index e182a24a..566cbe89 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -322,7 +322,8 @@ void CCrowbar::Swing() m_pPlayer->m_iWeaponVolume = (int)( flVol * CROWBAR_WALLHIT_VOLUME ); SetThink( &CCrowbar::Smack ); - pev->nextthink = gpGlobals->time + 0.1f; + + pev->nextthink = gpGlobals->time + 0.2f; #endif } #ifdef CROWBAR_IDLE_ANIM diff --git a/dlls/game.cpp b/dlls/game.cpp index fd106db3..ab92757a 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 }; diff --git a/dlls/gauss.cpp b/dlls/gauss.cpp index ab16f1e2..bbaab766 100644 --- a/dlls/gauss.cpp +++ b/dlls/gauss.cpp @@ -123,12 +123,6 @@ int CXS::GetItemInfo( ItemInfo *p ) return 1; } -BOOL CXS::IsUseable() -{ - // Currently charging, allow the player to fire it first. - Solokiller - return CBasePlayerWeapon::IsUseable() || m_fInAttack != 0; -} - BOOL CXS::Deploy() { return DefaultDeploy( "models/v_xs.mdl", "models/p_gauss.mdl", XS_DRAW, "gauss" ); @@ -228,22 +222,6 @@ void CXS::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_iClip <= 0 ) - { - // out of ammo! force the gun to fire - StartFire(); - m_fInAttack = 0; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.2f; - 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 ) { @@ -263,6 +241,16 @@ void CXS::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.0f; + 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. @@ -440,10 +428,6 @@ void CXS::WeaponIdle( void ) StartFire(); m_fInAttack = 0; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.2f; - - // Need to set m_flNextPrimaryAttack so the weapon gets a chance to complete its secondary fire animation. - Solokiller - if( m_iClip <= 0 ) - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5f; } else { 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; diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index 1bff3516..6672283b 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -710,12 +710,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 @@ -731,10 +731,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 diff --git a/dlls/player.cpp b/dlls/player.cpp index 34d624b7..dc463552 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -1181,23 +1181,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; + } } } diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index 0934fd66..9c22c441 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; } diff --git a/dlls/shotgun.cpp b/dlls/shotgun.cpp index f63dbddd..e47153b5 100644 --- a/dlls/shotgun.cpp +++ b/dlls/shotgun.cpp @@ -222,7 +222,7 @@ void CShotgun::Reload( void ) } } -void CShotgun::WeaponTick() +void CShotgun::ItemPostFrame( void ) { if( m_flPumpTime && m_flPumpTime < gpGlobals->time ) { @@ -230,6 +230,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/squadmonster.cpp b/dlls/squadmonster.cpp index cbf3f19f..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; @@ -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 ) { diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index 2561d531..729b2181 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -2353,8 +2353,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 ) ) ) { diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index a0892611..eb46b393 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -572,8 +572,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. @@ -865,16 +863,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 ) { - if( m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] <= 0 && iMaxAmmo1() != -1 ) + return TRUE; + } + + if( m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] > 0 ) + { + return TRUE; + } + + if( pszAmmo2() ) + { + // 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 0341e9a4..1c472f3e 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -284,7 +284,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 ); @@ -569,8 +568,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; 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")