Skip to content

Commit

Permalink
game: client, server: Remove fov_cs_debug, Add fov_desired
Browse files Browse the repository at this point in the history
  • Loading branch information
tyabus committed Mar 30, 2024
1 parent 636b62d commit 3869b10
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
17 changes: 0 additions & 17 deletions game/client/cstrike15/c_cs_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,6 @@ extern ConVar mp_playerid_hold;

ConVar cl_camera_height_restriction_debug( "cl_camera_height_restriction_debug", "0", FCVAR_CHEAT | FCVAR_REPLICATED, "" );

//ConVar *sv_cheats = NULL;

ConVar fov_cs_debug( "fov_cs_debug", "0", FCVAR_REPLICATED | FCVAR_CHEAT, "Sets the view fov if cheats are on." );

#define FREEZECAM_LONGCAM_DIST 320 // over this amount, the camera will zoom close on target

#define sv_magazine_drop_physics 1
Expand Down Expand Up @@ -7340,19 +7336,6 @@ float C_CSPlayer::GetFOV( void ) const
{
float flCurFOV = BaseClass::GetFOV();

if ( flCurFOV == GetDefaultFOV() )
{
if ( !sv_cheats )
{
sv_cheats = cvar->FindVar( "sv_cheats" );
}

if ( sv_cheats->GetBool() && fov_cs_debug.GetInt() > 0 )
{
return fov_cs_debug.GetInt();
}
}

#ifdef IRONSIGHT
CWeaponCSBase *pWeapon = GetActiveCSWeapon();
if ( pWeapon )
Expand Down
1 change: 1 addition & 0 deletions game/client/cstrike15/clientmode_csnormal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ ConVar cl_draw_only_deathnotices( "cl_draw_only_deathnotices", "0", FCVAR_CHEAT,
ConVar cl_radar_square_with_scoreboard( "cl_radar_square_with_scoreboard", "1", FCVAR_ARCHIVE | FCVAR_RELEASE, "If set, the radar will toggle to square when the scoreboard is visible." );

ConVar default_fov( "default_fov", "90", FCVAR_CHEAT );
ConVar fov_desired( "fov_desired", "90", FCVAR_ARCHIVE | FCVAR_USERINFO, "Sets the base field-of-view.", true, MIN_FOV, true, MAX_FOV );

static IClientMode *g_pClientMode[ MAX_SPLITSCREEN_PLAYERS ];
IClientMode *GetClientMode()
Expand Down
7 changes: 2 additions & 5 deletions game/client/hltvcamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,6 @@ void C_HLTVCamera::Accelerate( Vector& wishdir, float wishspeed, float accel )
}
}

extern ConVar fov_cs_debug;
// movement code is a copy of CGameMovement::FullNoClipMove()
void C_HLTVCamera::CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float& fov)
{
Expand All @@ -707,8 +706,7 @@ void C_HLTVCamera::CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float&
{
eyeOrigin = m_vCamOrigin;
eyeAngles = m_aCamAngle;
//fov = m_flFOV;
fov = fov_cs_debug.GetInt() > 0 ? m_flFOV : CSGameRules()->DefaultFOV();
fov = m_flFOV;

if ( (m_vecSpecLerpIdealPos == m_vCamOrigin && m_angSpecLerpIdealAng == m_aCamAngle) || m_flSpecLerpEndTime <= gpGlobals->curtime )
{
Expand Down Expand Up @@ -818,8 +816,7 @@ void C_HLTVCamera::CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float&

eyeOrigin = m_vCamOrigin;
eyeAngles = m_aCamAngle;
//fov = m_flFOV;
fov = fov_cs_debug.GetInt() > 0 ? m_flFOV : CSGameRules()->DefaultFOV();
fov = m_flFOV;
}

void C_HLTVCamera::CalcFixedView(Vector& eyeOrigin, QAngle& eyeAngles, float& fov)
Expand Down
8 changes: 8 additions & 0 deletions game/shared/cstrike15/cs_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16323,6 +16323,14 @@ void CCSGameRules::ClientSettingsChanged( CBasePlayer *pPlayer )

//pCSPlayer->UpdateAppearanceIndex();

const char *pszFov = engine->GetClientConVarValue( pPlayer->entindex(), "fov_desired" );
if( pszFov )
{
int iFov = atoi( pszFov );
iFov = clamp( iFov, MIN_FOV, MAX_FOV );
pCSPlayer->SetDefaultFOV( iFov );
}

pCSPlayer->InitTeammatePreferredColor();
}
}
Expand Down
3 changes: 3 additions & 0 deletions game/shared/shareddefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ inline float FractionUnDucked( int msecs )

#define MAX_ITEMS 5 // hard coded item types

#define MAX_FOV 110
#define MIN_FOV 80

#define WEAPON_NOCLIP -1 // clip sizes set to this tell the weapon it doesn't use a clip

#define MAX_AMMO_TYPES 32 // ???
Expand Down

0 comments on commit 3869b10

Please sign in to comment.