diff --git a/binary/dlls/game.cpp b/binary/dlls/game.cpp index f8ed3e9b..54942b6e 100644 --- a/binary/dlls/game.cpp +++ b/binary/dlls/game.cpp @@ -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 @@ -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); diff --git a/binary/dlls/game.h b/binary/dlls/game.h index 35ea8f2b..7189aa8a 100644 --- a/binary/dlls/game.h +++ b/binary/dlls/game.h @@ -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 diff --git a/binary/dlls/handgrenade.cpp b/binary/dlls/handgrenade.cpp index 9baa5b36..a79e0a6f 100644 --- a/binary/dlls/handgrenade.cpp +++ b/binary/dlls/handgrenade.cpp @@ -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 ); diff --git a/binary/dlls/player.cpp b/binary/dlls/player.cpp index 31a5775f..9245fc9e 100644 --- a/binary/dlls/player.cpp +++ b/binary/dlls/player.cpp @@ -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 ); @@ -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) @@ -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; diff --git a/binary/dlls/rpg.cpp b/binary/dlls/rpg.cpp index aa8077d8..295123f1 100644 --- a/binary/dlls/rpg.cpp +++ b/binary/dlls/rpg.cpp @@ -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; @@ -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(static_cast(m_hLauncher))->m_cActiveRockets--; } STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" ); @@ -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 ) { @@ -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; @@ -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; } @@ -590,6 +621,8 @@ void CRpg::WeaponIdle( void ) m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0; } + ResetEmptySound(); + SendWeaponAnim( iAnim ); } else diff --git a/binary/dlls/weapons.cpp b/binary/dlls/weapons.cpp index ec97b477..3a8fafd1 100644 --- a/binary/dlls/weapons.cpp +++ b/binary/dlls/weapons.cpp @@ -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 ); diff --git a/binary/dlls/weapons.h b/binary/dlls/weapons.h index 06fd8275..7d7348ec 100644 --- a/binary/dlls/weapons.h +++ b/binary/dlls/weapons.h @@ -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