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 7baad90 + 5b8ae50 commit df64bd0
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 16 deletions.
2 changes: 2 additions & 0 deletions binary/dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ cvar_t spgausscharging = { "sv_sp_gauss_charging", "0", FCVAR_SERVER }; // only
// Engine Cvars
cvar_t *g_psv_gravity = NULL;
cvar_t *g_psv_aim = NULL;
cvar_t *g_psv_allow_autoaim = NULL;
cvar_t *g_footsteps = NULL;

//Macros to make skill cvars easier to define
Expand Down Expand Up @@ -613,6 +614,7 @@ void GameDLLInit( void )

g_psv_gravity = CVAR_GET_POINTER( "sv_gravity" );
g_psv_aim = CVAR_GET_POINTER( "sv_aim" );
g_psv_allow_autoaim = CVAR_GET_POINTER("sv_allow_autoaim");
g_footsteps = CVAR_GET_POINTER( "mp_footsteps" );

CVAR_REGISTER (&displaysoundlist);
Expand Down
1 change: 1 addition & 0 deletions binary/dlls/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ extern cvar_t spgausscharging;
// Engine Cvars
extern cvar_t *g_psv_gravity;
extern cvar_t *g_psv_aim;
extern cvar_t *g_psv_allow_autoaim;
extern cvar_t *g_footsteps;

#endif // GAME_H
7 changes: 4 additions & 3 deletions binary/dlls/handgrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ void CHandGrenade::WeaponIdle( void )
else
angThrow.x = -10 + angThrow.x * ( ( 90 + 10 ) / 90.0 );

float flVel = ( 90 - angThrow.x ) * 4;
if ( flVel > 500 )
flVel = 500;
static float flMultiplier = 6.5f;
float flVel = (90 - angThrow.x) * flMultiplier;
if (flVel > 1000)
flVel = 1000;

UTIL_MakeVectors( angThrow );

Expand Down
9 changes: 7 additions & 2 deletions binary/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,11 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )
WRITE_BYTE(0);
MESSAGE_END();

// Adrian: always make the players non-solid in multiplayer when they die
if (g_pGameRules->IsMultiplayer())
{
pev->solid = SOLID_NOT;
}

// UNDONE: Put this in, but add FFADE_PERMANENT and make fade time 8.8 instead of 4.12
// UTIL_ScreenFade( edict(), Vector(128,0,0), 6, 15, 255, FFADE_OUT | FFADE_MODULATE );
Expand Down Expand Up @@ -5262,7 +5267,7 @@ Vector CBasePlayer::GetAutoaimVectorFromPoint(const Vector& vecSrc, float flDelt
// m_vecAutoAim = m_vecAutoAim * 0.99;

// Don't send across network if sv_aim is 0
if (g_psv_aim->value != 0)
if (g_psv_aim->value != 0 && g_psv_allow_autoaim != 0)
{
if (m_vecAutoAim.x != m_lastx ||
m_vecAutoAim.y != m_lasty)
Expand Down Expand Up @@ -5294,7 +5299,7 @@ Vector CBasePlayer :: AutoaimDeflection( Vector &vecSrc, float flDist, float flD
edict_t *bestent;
TraceResult tr;

if ( g_psv_aim->value == 0 )
if (g_psv_aim->value == 0 || g_psv_allow_autoaim->value == 0)
{
m_fOnTarget = FALSE;
return g_vecZero;
Expand Down
51 changes: 42 additions & 9 deletions binary/dlls/rpg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ CRpgRocket *CRpgRocket::CreateRpgRocket( Vector vecOrigin, Vector vecAngles, CBa
pRocket->pev->angles = vecAngles;
pRocket->Spawn();
pRocket->SetTouch( &CRpgRocket::RocketTouch );
pRocket->m_pLauncher = pLauncher;// remember what RPG fired me.
pRocket->m_pLauncher->m_cActiveRockets++;// register this missile as active for the launcher
pRocket->m_hLauncher = pLauncher;// remember what RPG fired me.
pLauncher->m_cActiveRockets++;// register this missile as active for the launcher
pRocket->pev->owner = pOwner->edict();

return pRocket;
Expand Down Expand Up @@ -156,10 +156,10 @@ void CRpgRocket :: Spawn( void )
//=========================================================
void CRpgRocket :: RocketTouch ( CBaseEntity *pOther )
{
if ( m_pLauncher )
if ( m_hLauncher )
{
// my launcher is still around, tell it I'm dead.
m_pLauncher->m_cActiveRockets--;
static_cast<CRpg*>(static_cast<CBaseEntity*>(m_hLauncher))->m_cActiveRockets--;
}

STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" );
Expand Down Expand Up @@ -208,6 +208,13 @@ void CRpgRocket :: IgniteThink( void )
pev->nextthink = gpGlobals->time + 0.1;
}

CRpg* CRpgRocket::GetLauncher()
{
if (!m_hLauncher)
return NULL;

return (CRpg*)((CBaseEntity*)m_hLauncher);
}

void CRpgRocket :: FollowThink( void )
{
Expand All @@ -225,8 +232,16 @@ void CRpgRocket :: FollowThink( void )
// Examine all entities within a reasonable radius
while ((pOther = UTIL_FindEntityByClassname( pOther, "laser_spot" )) != NULL)
{
UTIL_TraceLine ( pev->origin, pOther->pev->origin, dont_ignore_monsters, ENT(pev), &tr );
// ALERT( at_console, "%f\n", tr.flFraction );
Vector vSpotLocation = pOther->pev->origin;

/*if (UTIL_PointContents(vSpotLocation) == CONTENTS_SKY)
{
ALERT(at_console, "laser spot is in the sky...\n");
}*/

UTIL_TraceLine(pev->origin, vSpotLocation, dont_ignore_monsters, ENT(pev), &tr);
//ALERT(at_console, "fraction: %f\n", tr.flFraction);

if (tr.flFraction >= 0.90)
{
vecDir = pOther->pev->origin - pev->origin;
Expand Down Expand Up @@ -278,15 +293,31 @@ void CRpgRocket :: FollowThink( void )
Detonate( );
//++ BulliT
//Fixes the bug where it won't auto reload when it explodes coming out of the water
if (m_pLauncher)
if (m_hLauncher)
{
// my launcher is still around, tell it I'm dead.
m_pLauncher->m_cActiveRockets--;
m_hLauncher->m_cActiveRockets--;
}
//-- Martin Webrant
}
}
// ALERT( at_console, "%.0f\n", flSpeed );
if (GetLauncher())
{
float flDistance = (pev->origin - GetLauncher()->pev->origin).Length();
// if we've travelled more than max distance the player can send a spot, stop tracking the original launcher (allow it to reload)
if (flDistance > 8192.0f || gpGlobals->time - m_flIgniteTime > 6.0f)
{
// ALERT(at_console, "RPG too far (%f)!\n", flDistance);
GetLauncher()->m_cActiveRockets--;
m_hLauncher = NULL;
}
//ALERT(at_console, "%.0f, m_pLauncher: %u, flDistance: %f\n", flSpeed, GetLauncher(), flDistance);
}
if ((UTIL_PointContents(pev->origin) == CONTENTS_SKY))
{
//ALERT( at_console, "Rocket is in the sky, detonating...\n");
Detonate();
}

pev->nextthink = gpGlobals->time + 0.1;
}
Expand Down Expand Up @@ -590,6 +621,8 @@ void CRpg::WeaponIdle( void )
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0;
}

ResetEmptySound();

SendWeaponAnim( iAnim );
}
else
Expand Down
2 changes: 1 addition & 1 deletion binary/dlls/weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ IMPLEMENT_SAVERESTORE( CRpg, CBasePlayerWeapon );
TYPEDESCRIPTION CRpgRocket::m_SaveData[] =
{
DEFINE_FIELD( CRpgRocket, m_flIgniteTime, FIELD_TIME ),
DEFINE_FIELD( CRpgRocket, m_pLauncher, FIELD_CLASSPTR ),
DEFINE_FIELD( CRpgRocket, m_hLauncher, FIELD_CLASSPTR ),
};
IMPLEMENT_SAVERESTORE( CRpgRocket, CGrenade );

Expand Down
4 changes: 3 additions & 1 deletion binary/dlls/weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,11 @@ class CRpgRocket : public CGrenade
void EXPORT RocketTouch( CBaseEntity *pOther );
static CRpgRocket *CreateRpgRocket( Vector vecOrigin, Vector vecAngles, CBaseEntity *pOwner, CRpg *pLauncher );

CRpg* GetLauncher();

int m_iTrail;
float m_flIgniteTime;
CRpg *m_pLauncher;// pointer back to the launcher that fired me.
CRpg *m_hLauncher;// pointer back to the launcher that fired me.
};

class CGauss : public CBasePlayerWeapon
Expand Down

0 comments on commit df64bd0

Please sign in to comment.