mirror of
https://github.com/ENSL/NS.git
synced 2024-11-22 04:31:12 +00:00
HL25 fixes
-Add new widescreen method and exploit prevention -disable old widescreen method and exploit prevention -force sv_rollangle 0 -add sv_widescreenclamp to limit fov expansion to 16:9
This commit is contained in:
parent
bf34643be3
commit
0e88d368b9
9 changed files with 109 additions and 40 deletions
|
@ -41,47 +41,46 @@ int CHud::UpdateClientData(client_data_t *cdata, float time)
|
||||||
|
|
||||||
Think();
|
Think();
|
||||||
|
|
||||||
//cdata->fov = m_iFOV;
|
cdata->fov = m_iFOV;
|
||||||
|
|
||||||
float width = ScreenWidth();
|
//// Horizontal+ widescreen view correction - Removed after HL25 update
|
||||||
float height = ScreenHeight();
|
//float width = ScreenWidth();
|
||||||
|
//float height = ScreenHeight();
|
||||||
|
|
||||||
// Horizontal+ widescreen view correction - engine uses vertical- cropping
|
//// Cvar to let players use old widescreen. Only allow it to change when not alive so it can't be used as a zoom toggle.
|
||||||
|
//if (!gHUD.GetIsAlive(false))
|
||||||
|
//{
|
||||||
|
// wstoggle = CVAR_GET_FLOAT("cl_widescreen") != 0;
|
||||||
|
//}
|
||||||
|
|
||||||
// Cvar to let players use old widescreen. Only allow it to change when not alive so it can't be used as a zoom toggle.
|
//if (wstoggle)
|
||||||
if (!gHUD.GetIsAlive(false))
|
//{
|
||||||
{
|
// m_wsFOV = atanf(tan(m_iFOV * M_PI / 360) * 0.75 * width / height) * 360 / M_PI;
|
||||||
wstoggle = CVAR_GET_FLOAT("cl_widescreen") != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wstoggle)
|
// //clamp for game balance
|
||||||
{
|
// if (m_iFOV == 105 && m_wsFOV > 121)
|
||||||
m_wsFOV = atanf(tan(m_iFOV * M_PI / 360) * 0.75 * width / height) * 360 / M_PI;
|
// {
|
||||||
|
// m_wsFOV = 120;
|
||||||
|
// }
|
||||||
|
// else if (m_iFOV == 100 && m_wsFOV > 117)
|
||||||
|
// {
|
||||||
|
// m_wsFOV = 116;
|
||||||
|
// }
|
||||||
|
// else if (m_iFOV == 90 && m_wsFOV > 107)
|
||||||
|
// {
|
||||||
|
// m_wsFOV = 106;
|
||||||
|
// }
|
||||||
|
// else if (m_wsFOV < 90)
|
||||||
|
// {
|
||||||
|
// m_wsFOV = 90;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// m_wsFOV = m_iFOV;
|
||||||
|
//}
|
||||||
|
|
||||||
//clamp for game balance
|
//cdata->fov = m_wsFOV;
|
||||||
if (m_iFOV == 105 && m_wsFOV > 121)
|
|
||||||
{
|
|
||||||
m_wsFOV = 120;
|
|
||||||
}
|
|
||||||
else if (m_iFOV == 100 && m_wsFOV > 117)
|
|
||||||
{
|
|
||||||
m_wsFOV = 116;
|
|
||||||
}
|
|
||||||
else if (m_iFOV == 90 && m_wsFOV > 107)
|
|
||||||
{
|
|
||||||
m_wsFOV = 106;
|
|
||||||
}
|
|
||||||
else if (m_wsFOV < 90)
|
|
||||||
{
|
|
||||||
m_wsFOV = 90;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_wsFOV = m_iFOV;
|
|
||||||
}
|
|
||||||
|
|
||||||
cdata->fov = m_wsFOV;
|
|
||||||
|
|
||||||
CL_ResetButtonBits( m_iKeyBits );
|
CL_ResetButtonBits( m_iKeyBits );
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ cvar_t *cl_dynamiclights;
|
||||||
cvar_t *r_dynamic;
|
cvar_t *r_dynamic;
|
||||||
cvar_t *cl_buildmessages;
|
cvar_t *cl_buildmessages;
|
||||||
cvar_t *cl_particleinfo;
|
cvar_t *cl_particleinfo;
|
||||||
cvar_t *cl_widescreen;
|
//cvar_t *cl_widescreen;
|
||||||
cvar_t *cl_ambientsound;
|
cvar_t *cl_ambientsound;
|
||||||
cvar_t *senslock;
|
cvar_t *senslock;
|
||||||
cvar_t *hud_style;
|
cvar_t *hud_style;
|
||||||
|
@ -1638,7 +1638,7 @@ void InitInput (void)
|
||||||
cl_cmhotkeys = gEngfuncs.pfnRegisterVariable ( kvCMHotkeys, "qwerasdfzxcv", FCVAR_ARCHIVE );
|
cl_cmhotkeys = gEngfuncs.pfnRegisterVariable ( kvCMHotkeys, "qwerasdfzxcv", FCVAR_ARCHIVE );
|
||||||
//cl_forcedefaultfov = gEngfuncs.pfnRegisterVariable ( kvForceDefaultFOV, "0", FCVAR_ARCHIVE );
|
//cl_forcedefaultfov = gEngfuncs.pfnRegisterVariable ( kvForceDefaultFOV, "0", FCVAR_ARCHIVE );
|
||||||
cl_particleinfo = gEngfuncs.pfnRegisterVariable ( kvParticleInfo, "0", FCVAR_ARCHIVE );
|
cl_particleinfo = gEngfuncs.pfnRegisterVariable ( kvParticleInfo, "0", FCVAR_ARCHIVE );
|
||||||
cl_widescreen = gEngfuncs.pfnRegisterVariable ( kvWidescreen, "1", FCVAR_ARCHIVE );
|
//cl_widescreen = gEngfuncs.pfnRegisterVariable ( kvWidescreen, "1", FCVAR_ARCHIVE );
|
||||||
cl_ambientsound = gEngfuncs.pfnRegisterVariable ( kvAmbientSound, "0", FCVAR_ARCHIVE);
|
cl_ambientsound = gEngfuncs.pfnRegisterVariable ( kvAmbientSound, "0", FCVAR_ARCHIVE);
|
||||||
senslock = gEngfuncs.pfnRegisterVariable ("senslock", "0", FCVAR_ARCHIVE);
|
senslock = gEngfuncs.pfnRegisterVariable ("senslock", "0", FCVAR_ARCHIVE);
|
||||||
hud_style = gEngfuncs.pfnRegisterVariable ("hud_style", "1", FCVAR_ARCHIVE);
|
hud_style = gEngfuncs.pfnRegisterVariable ("hud_style", "1", FCVAR_ARCHIVE);
|
||||||
|
|
|
@ -182,7 +182,14 @@ void CreatePickingRay( int mousex, int mousey, Vector& outVecPickingRay )
|
||||||
|
|
||||||
// char gDebugMessage[256];
|
// char gDebugMessage[256];
|
||||||
|
|
||||||
float fovDegrees = gHUD.m_wsFOV;
|
//float fovDegrees = gHUD.m_wsFOV;
|
||||||
|
bool wideScreen = CVAR_GET_FLOAT("gl_widescreen_yfov");
|
||||||
|
float fovDegrees = gHUD.m_iFOV;
|
||||||
|
//Adjust for widescreen FOV
|
||||||
|
if (wideScreen)
|
||||||
|
{
|
||||||
|
fovDegrees = atanf(tan(gHUD.m_iFOV * M_PI / 360) * 0.75f * ScreenWidth() / ScreenHeight()) * 360 / M_PI;
|
||||||
|
}
|
||||||
|
|
||||||
//cl_entity_s* theLocalEntity = gEngfuncs.GetLocalPlayer();
|
//cl_entity_s* theLocalEntity = gEngfuncs.GetLocalPlayer();
|
||||||
//Vector vecRenderOrigin = theLocalEntity->origin;
|
//Vector vecRenderOrigin = theLocalEntity->origin;
|
||||||
|
|
|
@ -123,6 +123,7 @@ cvar_t avh_mapvoteratio = {kvMapVoteRatio, ".6", FCVAR_SERVER};
|
||||||
cvar_t avh_blockscripts = {kvBlockScripts, "1", FCVAR_SERVER};
|
cvar_t avh_blockscripts = {kvBlockScripts, "1", FCVAR_SERVER};
|
||||||
cvar_t avh_jumpmode = {kvJumpMode, "1", FCVAR_SERVER};
|
cvar_t avh_jumpmode = {kvJumpMode, "1", FCVAR_SERVER};
|
||||||
cvar_t avh_version = {kvVersion, "330", FCVAR_SERVER};
|
cvar_t avh_version = {kvVersion, "330", FCVAR_SERVER};
|
||||||
|
cvar_t avh_widescreenclamp = {kvWidescreenClamp, "0", FCVAR_SERVER};
|
||||||
//playtest cvars
|
//playtest cvars
|
||||||
cvar_t avh_fastjp = {kvfastjp, "0", FCVAR_SERVER};
|
cvar_t avh_fastjp = {kvfastjp, "0", FCVAR_SERVER};
|
||||||
cvar_t avh_randomrfk = {kvRandomRfk, "1", FCVAR_SERVER};
|
cvar_t avh_randomrfk = {kvRandomRfk, "1", FCVAR_SERVER};
|
||||||
|
@ -239,6 +240,7 @@ void GameDLLInit( void )
|
||||||
CVAR_REGISTER (&avh_blockscripts);
|
CVAR_REGISTER (&avh_blockscripts);
|
||||||
CVAR_REGISTER (&avh_jumpmode);
|
CVAR_REGISTER (&avh_jumpmode);
|
||||||
CVAR_REGISTER (&avh_version);
|
CVAR_REGISTER (&avh_version);
|
||||||
|
CVAR_REGISTER (&avh_widescreenclamp);
|
||||||
//playtest cvars
|
//playtest cvars
|
||||||
CVAR_REGISTER (&avh_fastjp);
|
CVAR_REGISTER (&avh_fastjp);
|
||||||
CVAR_REGISTER (&avh_randomrfk);
|
CVAR_REGISTER (&avh_randomrfk);
|
||||||
|
@ -270,5 +272,8 @@ void GameDLLInit( void )
|
||||||
CVAR_REGISTER (&avh_uplink);
|
CVAR_REGISTER (&avh_uplink);
|
||||||
CVAR_REGISTER (&avh_killdelay);
|
CVAR_REGISTER (&avh_killdelay);
|
||||||
|
|
||||||
|
//Remove HL25 addition of roll angle in code so servers don't need to update configs.
|
||||||
|
CVAR_SET_FLOAT("sv_rollangle", 0.0f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ extern cvar_t* cl_musicdir;
|
||||||
// :
|
// :
|
||||||
#define kvCMHotKeys "cl_cmhotkeys"
|
#define kvCMHotKeys "cl_cmhotkeys"
|
||||||
//#define kvForceDefaultFOV "cl_forcedefaultfov"
|
//#define kvForceDefaultFOV "cl_forcedefaultfov"
|
||||||
#define kvWidescreen "cl_widescreen"
|
//#define kvWidescreen "cl_widescreen"
|
||||||
#define kvAmbientSound "cl_ambientsound"
|
#define kvAmbientSound "cl_ambientsound"
|
||||||
#define kvCenterEntityID "cl_centerentityid"
|
#define kvCenterEntityID "cl_centerentityid"
|
||||||
#define kvHighDetail "cl_highdetail"
|
#define kvHighDetail "cl_highdetail"
|
||||||
|
|
|
@ -338,6 +338,8 @@ AvHGamerules::AvHGamerules() : mTeamA(TEAM_ONE), mTeamB(TEAM_TWO)
|
||||||
RegisterServerVariable(avh_cheats);
|
RegisterServerVariable(avh_cheats);
|
||||||
RegisterServerVariable(&avh_structurelimit);
|
RegisterServerVariable(&avh_structurelimit);
|
||||||
RegisterServerVariable(&avh_version);
|
RegisterServerVariable(&avh_version);
|
||||||
|
RegisterServerVariable(&avh_widescreenclamp);
|
||||||
|
|
||||||
//playtest cvars
|
//playtest cvars
|
||||||
RegisterServerVariable(&avh_fastjp);
|
RegisterServerVariable(&avh_fastjp);
|
||||||
RegisterServerVariable(&avh_randomrfk);
|
RegisterServerVariable(&avh_randomrfk);
|
||||||
|
|
|
@ -4883,6 +4883,8 @@ cvar_t *lightgamma = NULL;
|
||||||
cvar_t *texgamma = NULL;
|
cvar_t *texgamma = NULL;
|
||||||
cvar_t *r_detailtextures = NULL;
|
cvar_t *r_detailtextures = NULL;
|
||||||
cvar_t *gl_max_size = NULL;
|
cvar_t *gl_max_size = NULL;
|
||||||
|
cvar_t *gl_widescreen_yfov = NULL;
|
||||||
|
cvar_t *sv_widescreenclamp = NULL;
|
||||||
|
|
||||||
void AvHHud::InitExploitPrevention() {
|
void AvHHud::InitExploitPrevention() {
|
||||||
gl_monolights = gEngfuncs.pfnGetCvarPointer("gl_monolights");
|
gl_monolights = gEngfuncs.pfnGetCvarPointer("gl_monolights");
|
||||||
|
@ -4897,6 +4899,7 @@ void AvHHud::InitExploitPrevention() {
|
||||||
texgamma = gEngfuncs.pfnGetCvarPointer("texgamma");
|
texgamma = gEngfuncs.pfnGetCvarPointer("texgamma");
|
||||||
r_detailtextures = gEngfuncs.pfnGetCvarPointer("r_detailtextures");
|
r_detailtextures = gEngfuncs.pfnGetCvarPointer("r_detailtextures");
|
||||||
gl_max_size = gEngfuncs.pfnGetCvarPointer("gl_max_size");
|
gl_max_size = gEngfuncs.pfnGetCvarPointer("gl_max_size");
|
||||||
|
gl_widescreen_yfov = gEngfuncs.pfnGetCvarPointer("gl_widescreen_yfov");
|
||||||
|
|
||||||
ForceCvar("gl_monolights", gl_monolights, 0.0f);
|
ForceCvar("gl_monolights", gl_monolights, 0.0f);
|
||||||
ForceCvar("gl_overbright", gl_overbright, 0.0f);
|
ForceCvar("gl_overbright", gl_overbright, 0.0f);
|
||||||
|
@ -4922,6 +4925,11 @@ void AvHHud::InitExploitPrevention() {
|
||||||
if(texgamma && texgamma->value > 5.0) {
|
if(texgamma && texgamma->value > 5.0) {
|
||||||
ForceCvar("texgamma", texgamma, 5.0f);
|
ForceCvar("texgamma", texgamma, 5.0f);
|
||||||
}
|
}
|
||||||
|
RemoveAlias("gl_widescreen_yfov");
|
||||||
|
if (gl_widescreen_yfov)
|
||||||
|
{
|
||||||
|
mWideScreen = gl_widescreen_yfov->value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4952,6 +4960,48 @@ void AvHHud::UpdateExploitPrevention()
|
||||||
if(texgamma && texgamma->value > 5.0) {
|
if(texgamma && texgamma->value > 5.0) {
|
||||||
ForceCvar("texgamma", texgamma, 5.0f);
|
ForceCvar("texgamma", texgamma, 5.0f);
|
||||||
}
|
}
|
||||||
|
//Widescreen exploit prevention
|
||||||
|
if (gViewPort)
|
||||||
|
{
|
||||||
|
if (gHUD.GetIsAlive(false))
|
||||||
|
{
|
||||||
|
if (gl_widescreen_yfov && gl_widescreen_yfov->value == 0 && mWideScreen) {
|
||||||
|
ForceCvar("gl_widescreen_yfov", gl_widescreen_yfov, 1.0f);
|
||||||
|
mWideScreenChanged = true;
|
||||||
|
gEngfuncs.pfnCenterPrint("The Widescreen FOV\n will change after death\n");
|
||||||
|
}
|
||||||
|
if (gl_widescreen_yfov && gl_widescreen_yfov->value != 0 && !mWideScreen) {
|
||||||
|
ForceCvar("gl_widescreen_yfov", gl_widescreen_yfov, 0);
|
||||||
|
mWideScreenChanged = true;
|
||||||
|
gEngfuncs.pfnCenterPrint("The Widescreen FOV\n will change after death\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (mWideScreenChanged)
|
||||||
|
{
|
||||||
|
mWideScreen = !mWideScreen;
|
||||||
|
ForceCvar("gl_widescreen_yfov", gl_widescreen_yfov, (float)mWideScreen);
|
||||||
|
mWideScreenChanged = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mWideScreen = gl_widescreen_yfov->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//sv_widescreenclamp is to prevent abuse of ultra-widescreen FOVs in competitive play.
|
||||||
|
if ((ScreenWidth() / ScreenHeight()) > 1.8f)
|
||||||
|
{
|
||||||
|
if (this->GetServerVariableFloat(kvWidescreenClamp) != 0 && gl_widescreen_yfov && gl_widescreen_yfov->value != 0)
|
||||||
|
{
|
||||||
|
ForceCvar("gl_widescreen_yfov", gl_widescreen_yfov, 0);
|
||||||
|
gEngfuncs.pfnCenterPrint("This aspect ratio is not allowed\n on this server\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//else if (gl_widescreen_yfov)
|
||||||
|
//{
|
||||||
|
// mWideScreen = gl_widescreen_yfov->value;
|
||||||
|
// gEngfuncs.Con_Printf("init mwidescreen from update %d\n", mWideScreen);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvHHud::UpdateAlienUI(float inCurrentTime)
|
void AvHHud::UpdateAlienUI(float inCurrentTime)
|
||||||
|
|
|
@ -876,6 +876,9 @@ private:
|
||||||
|
|
||||||
static bool sShowMap;
|
static bool sShowMap;
|
||||||
|
|
||||||
|
bool mWideScreen;
|
||||||
|
bool mWideScreenChanged;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -96,6 +96,7 @@ extern cvar_t *violence_agibs;
|
||||||
extern cvar_t avh_killdelay;
|
extern cvar_t avh_killdelay;
|
||||||
extern cvar_t *showtriggers;
|
extern cvar_t *showtriggers;
|
||||||
extern cvar_t avh_version;
|
extern cvar_t avh_version;
|
||||||
|
extern cvar_t avh_widescreenclamp;
|
||||||
//playtest cvars
|
//playtest cvars
|
||||||
extern cvar_t avh_fastjp;
|
extern cvar_t avh_fastjp;
|
||||||
extern cvar_t avh_randomrfk;
|
extern cvar_t avh_randomrfk;
|
||||||
|
@ -149,6 +150,8 @@ float ns_cvar_float(const cvar_t *cvar);
|
||||||
#define kvBlockScripts "mp_blockscripts"
|
#define kvBlockScripts "mp_blockscripts"
|
||||||
#define kvJumpMode "sv_jumpmode"
|
#define kvJumpMode "sv_jumpmode"
|
||||||
#define kvVersion "sv_nsversion"
|
#define kvVersion "sv_nsversion"
|
||||||
|
#define kvWidescreenClamp "sv_widescreenclamp"
|
||||||
|
|
||||||
//playtest cvars
|
//playtest cvars
|
||||||
#define kvfastjp "sv_fastjp"
|
#define kvfastjp "sv_fastjp"
|
||||||
#define kvRandomRfk "mp_randomresfromkill"
|
#define kvRandomRfk "mp_randomresfromkill"
|
||||||
|
|
Loading…
Reference in a new issue