Skip to content

Commit

Permalink
Merge branch 'master' into experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
sabianroberts committed Oct 28, 2024
2 parents df64bd0 + 0763b72 commit 4b37d92
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 26 deletions.
8 changes: 4 additions & 4 deletions binary/dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1686,12 +1686,12 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
item->m_iId = II.iId;
item->m_iClip = gun->m_iClip;

item->m_flTimeWeaponIdle = V_max( gun->m_flTimeWeaponIdle, -0.001 );
item->m_flNextPrimaryAttack = V_max( gun->m_flNextPrimaryAttack, -0.001 );
item->m_flNextSecondaryAttack = V_max( gun->m_flNextSecondaryAttack, -0.001 );
item->m_flTimeWeaponIdle = V_max( gun->m_flTimeWeaponIdle, -0.001f );
item->m_flNextPrimaryAttack = V_max( gun->m_flNextPrimaryAttack, -0.001f );
item->m_flNextSecondaryAttack = V_max( gun->m_flNextSecondaryAttack, -0.001f );
item->m_fInReload = gun->m_fInReload;
item->m_fInSpecialReload = gun->m_fInSpecialReload;
item->fuser1 = V_max( gun->pev->fuser1, -0.001 );
item->fuser1 = V_max( gun->pev->fuser1, -0.001f );
item->fuser2 = gun->m_flStartThrow;
item->fuser3 = gun->m_flReleaseThrow;
item->iuser1 = gun->m_chargeReady;
Expand Down
4 changes: 4 additions & 0 deletions binary/dlls/crowbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ int CCrowbar::Swing( int fFirst )

ClearMultiDamage( );

// JoshA: Changed from < -> <= to fix the full swing logic since client weapon prediction.
// -1.0f + 1.0f = 0.0f. UTIL_WeaponTimeBase is always 0 with client weapon prediction (0 time base vs curtime base)
if ((m_flNextPrimaryAttack + 1.0f <= UTIL_WeaponTimeBase()) || g_pGameRules->IsMultiplayer())

pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB );

ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
Expand Down
38 changes: 29 additions & 9 deletions binary/dlls/func_break.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,9 +935,14 @@ void CPushable :: Move( CBaseEntity *pOther, int push )

if ( pOther->IsPlayer() )
{
if ( push && !(pevToucher->button & (IN_FORWARD|IN_USE)) ) // Don't push unless the player is pushing forward and NOT use (pull)
// JoshA: Used to check for FORWARD too and logic was inverted
// from comment which seems wrong.
// Fixed to just check for USE being not set for PUSH.
// Should have the right effect.
if (push && !!(pevToucher->button & IN_USE)) // Don't push unless the player is not useing (pull)
return;
playerTouch = 1;

playerTouch = true;
}

float factor;
Expand All @@ -957,20 +962,35 @@ void CPushable :: Move( CBaseEntity *pOther, int push )
else
factor = 0.25;

pev->velocity.x += pevToucher->velocity.x * factor;
pev->velocity.y += pevToucher->velocity.y * factor;

// This used to be added every 'frame', but to be consistent at high fps,
// now act as if it's added at a constant rate with a fudge factor.
extern cvar_t sv_pushable_fixed_tick_fudge;
if (!push && sv_pushable_fixed_tick_fudge.value >= 0.0f)
{
factor *= gpGlobals->frametime * sv_pushable_fixed_tick_fudge.value;
}
// JoshA: Always apply this if pushing, or if under the player's velocity.
if (push || (abs(pev->velocity.x) < abs(pevToucher->velocity.x - pevToucher->velocity.x * factor)))
pev->velocity.x += pevToucher->velocity.x * factor;
if (push || (abs(pev->velocity.y) < abs(pevToucher->velocity.y - pevToucher->velocity.y * factor)))
pev->velocity.y += pevToucher->velocity.y * factor;
float length = sqrt( pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y );
if ( push && (length > MaxSpeed()) )
if ( length > MaxSpeed() )
{
pev->velocity.x = (pev->velocity.x * MaxSpeed() / length );
pev->velocity.y = (pev->velocity.y * MaxSpeed() / length );
}
if ( playerTouch )
{
pevToucher->velocity.x = pev->velocity.x;
pevToucher->velocity.y = pev->velocity.y;
if ( (gpGlobals->time - m_soundTime) > 0.7 )
// JoshA: Match the player to our pushable's velocity.
// Previously this always happened, but it should only
// happen if the player is pushing (or rather, being pushed.)
// This either stops the player in their tracks or nudges them along.
if (push)
{
pevToucher->velocity.x = pev->velocity.x;
pevToucher->velocity.y = pev->velocity.y;
} if ( (gpGlobals->time - m_soundTime) > 0.7 )
{
m_soundTime = gpGlobals->time;
if ( length > 0 && FBitSet(pev->flags,FL_ONGROUND) )
Expand Down
5 changes: 4 additions & 1 deletion binary/dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ cvar_t sv_aura_regeneration_wait = { "sv_aura_regeneration_wait", "0.03", FCVAR_

// END Cvars for Skill Level settings

cvar_t sv_pushable_fixed_tick_fudge = { "sv_pushable_fixed_tick_fudge", "15" };

// Register your console variables here
// This gets called one time when the game is initialied
void GameDLLInit( void )
Expand Down Expand Up @@ -1169,7 +1171,8 @@ void GameDLLInit( void )
CVAR_REGISTER(&sv_aura_regeneration_wait);

// END REGISTER CVARS FOR SKILL LEVEL STUFF
//

CVAR_REGISTER(&sv_pushable_fixed_tick_fudge);

//++ BulliT
AgInitGame();
Expand Down
7 changes: 7 additions & 0 deletions binary/dlls/gauss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,13 @@ void CGauss::Fire(Vector vecOrigSrc, Vector vecDir, float flDamage)
if (pEntity->pev->takedamage)
{
ClearMultiDamage();

// if you hurt yourself clear the headshot bit
if (m_pPlayer->pev == pEntity->pev)
{
tr.iHitgroup = 0;
}

pEntity->TraceAttack(m_pPlayer->pev, flDamage, vecDir, &tr, DMG_BULLET);
ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev);
}
Expand Down
8 changes: 4 additions & 4 deletions binary/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3188,17 +3188,17 @@ void CBasePlayer::PostThink()

if ( gun && gun->UseDecrement() )
{
gun->m_flNextPrimaryAttack = V_max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0 );
gun->m_flNextSecondaryAttack = V_max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001 );
gun->m_flNextPrimaryAttack = V_max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0f );
gun->m_flNextSecondaryAttack = V_max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001f );

if ( gun->m_flTimeWeaponIdle != 1000 )
{
gun->m_flTimeWeaponIdle = V_max( gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001 );
gun->m_flTimeWeaponIdle = V_max( gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001f );
}

if ( gun->pev->fuser1 != 1000 )
{
gun->pev->fuser1 = V_max( gun->pev->fuser1 - gpGlobals->frametime, -0.001 );
gun->pev->fuser1 = V_max( gun->pev->fuser1 - gpGlobals->frametime, -0.001f );
}

// Only decrement if not flagged as NO_DECREMENT
Expand Down
17 changes: 9 additions & 8 deletions binary/pm_shared/pm_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2859,6 +2859,15 @@ void PM_CheckParamters( void )
pmove->maxspeed = V_min( maxspeed, pmove->maxspeed );
}

// Slow down, I'm pulling it! (a box maybe) but only when I'm standing on ground
//
// JoshA: Moved this to CheckParamters rather than working on the velocity,
// as otherwise it affects every integration step incorrectly.
if ((pmove->onground != -1) && (pmove->cmd.buttons & IN_USE))
{
pmove->maxspeed *= 1.0f / 3.0f;
}

if ( ( spd != 0.0 ) &&
( spd > pmove->maxspeed ) )
{
Expand Down Expand Up @@ -3031,14 +3040,6 @@ void PM_PlayerMove ( qboolean server )
}
}

#if !defined( _TFC )
// Slow down, I'm pulling it! (a box maybe) but only when I'm standing on ground
if ( ( pmove->onground != -1 ) && ( pmove->cmd.buttons & IN_USE) )
{
VectorScale( pmove->velocity, 0.3, pmove->velocity );
}
#endif

// Handle movement
switch ( pmove->movetype )
{
Expand Down

0 comments on commit 4b37d92

Please sign in to comment.