From f39297efcb613d2e12be5bb61ed12c71fea54aa5 Mon Sep 17 00:00:00 2001 From: pierow Date: Mon, 29 Apr 2024 17:27:57 -0400 Subject: [PATCH] Fix gamma ramp and add hud_waypointblinking - fix gamma ramp not working correctly on maps with no env_gamma entity - add hud_waypointblinking --- main/source/cl_dll/hud.cpp | 1 + main/source/cl_dll/shader.cpp | 2 +- main/source/mod/AvHEntities.cpp | 2 +- main/source/mod/AvHGamerules.cpp | 4 +++- main/source/mod/AvHHud.cpp | 22 +++++++++++++++++++++- main/source/mod/AvHHud.h | 3 +++ main/source/mod/AvHHudRender.cpp | 2 +- main/user.scr | 12 ++++++++++++ 8 files changed, 43 insertions(+), 5 deletions(-) diff --git a/main/source/cl_dll/hud.cpp b/main/source/cl_dll/hud.cpp index 6ab2af03..8f94e9b3 100644 --- a/main/source/cl_dll/hud.cpp +++ b/main/source/cl_dll/hud.cpp @@ -229,6 +229,7 @@ void CHud :: Init( void ) CVAR_CREATE("hud_mapnamesBlue", "255", FCVAR_ARCHIVE); CVAR_CREATE("hud_nameinfo", "1", FCVAR_ARCHIVE); CVAR_CREATE("hud_drawwaypoints", "2", FCVAR_ARCHIVE); + CVAR_CREATE("hud_waypointblinking", "0", FCVAR_ARCHIVE); m_pSpriteList = NULL; diff --git a/main/source/cl_dll/shader.cpp b/main/source/cl_dll/shader.cpp index 8a073fbc..f76cb5e0 100644 --- a/main/source/cl_dll/shader.cpp +++ b/main/source/cl_dll/shader.cpp @@ -175,7 +175,7 @@ void CPostProcessShader::DrawShader() // If the map has no gamma value, override it with the cvar's value. else { - colorMultiplier = min(1.0f, scalarCvar); + colorMultiplier = max(1.0f, scalarCvar); } // Use shader. diff --git a/main/source/mod/AvHEntities.cpp b/main/source/mod/AvHEntities.cpp index 752a59a8..811d0475 100644 --- a/main/source/mod/AvHEntities.cpp +++ b/main/source/mod/AvHEntities.cpp @@ -1030,7 +1030,7 @@ void AvHGameplay::Spawn() AvHGamma::AvHGamma() { - this->mGammaScalar = 1.0f; + this->mGammaScalar = kDefaultMapGamma; } void AvHGamma::KeyValue(KeyValueData* pkvd) diff --git a/main/source/mod/AvHGamerules.cpp b/main/source/mod/AvHGamerules.cpp index 5acbadde..00a6a472 100644 --- a/main/source/mod/AvHGamerules.cpp +++ b/main/source/mod/AvHGamerules.cpp @@ -770,7 +770,7 @@ bool AvHGamerules::CanPlayerBeKilled(CBasePlayer* inPlayer) void AvHGamerules::CalculateMapGamma() { // Set defaults - this->mCalculatedMapGamma = kDefaultMapGamma; + //this->mCalculatedMapGamma = kDefaultMapGamma; // Fetch from map extents entity if the map has one FOR_ALL_ENTITIES(kwsGammaClassName, AvHGamma*) @@ -2307,6 +2307,8 @@ void AvHGamerules::PostWorldPrecacheReset(bool inNewMap) this->mMapExtents.ResetMapExtents(); this->mCalculatedMapGamma = false; + this->mMapGamma = kDefaultMapGamma; + this->mMapGammaAlt = kDefaultMapGamma; // TODO: Clear min/max map sizes? Others? diff --git a/main/source/mod/AvHHud.cpp b/main/source/mod/AvHHud.cpp index 553ef7c4..3277bfbb 100644 --- a/main/source/mod/AvHHud.cpp +++ b/main/source/mod/AvHHud.cpp @@ -2611,6 +2611,7 @@ void AvHHud::ResetGame(bool inMapChanged) this->mHiveInfoList.clear(); this->mShaderGamma = kDefaultMapGamma; + this->mShaderGammaAlt = kDefaultMapGamma; this->mDesiredGammaSlope = kDefaultMapGamma; this->mDesiredGammaSlopeAlt = kDefaultMapGamma; this->mRecordingLastFrame = false; @@ -2821,7 +2822,24 @@ int AvHHud::MsgFunc_SetOrder(const char* pszName, int iSize, void* pbuf) AvHChangeOrder(this->mOrders, theNewOrder); - this->mDrawOrderOverlay = true; + // Check if it's the same order as the last one before setting the acknowledgement bool. Happens when respawning. + Vector newOrderLocation; + theNewOrder.GetLocation(newOrderLocation); + if (CVAR_GET_FLOAT("hud_drawwaypoints") == 2.0f) + { + if ((newOrderLocation != this->mLastOrderLocation && theNewOrder.GetTargetIndex() == -1) || theNewOrder.GetTargetIndex() != this->mLastOrderIndex) + { + this->mDrawOrderOverlay = true; + } + if (!this->mDrawOrderOverlay) + gEngfuncs.Con_Printf("waypoint trapped \n"); + } + else + { + this->mDrawOrderOverlay = true; + } + this->mLastOrderLocation = newOrderLocation; + this->mLastOrderIndex = theNewOrder.GetTargetIndex(); // Give feedback on order this->OrderNotification(theNewOrder); @@ -3875,6 +3893,8 @@ void AvHHud::Init(void) this->mDrawCombatUpgradeMenu = false; this->mDrawOrderOverlay = true; + this->mLastOrderLocation = Vector(0.0f, 0.0f, 0.0f); + this->mLastOrderIndex = -1; this->mReInitHUD = false; this->mLastHudStyle = 0; diff --git a/main/source/mod/AvHHud.h b/main/source/mod/AvHHud.h index 9d197ef1..44ab0e2a 100644 --- a/main/source/mod/AvHHud.h +++ b/main/source/mod/AvHHud.h @@ -889,6 +889,9 @@ private: float mShaderGamma; float mShaderGammaAlt; + Vector mLastOrderLocation; + int mLastOrderIndex; + }; class CPostProcessShader diff --git a/main/source/mod/AvHHudRender.cpp b/main/source/mod/AvHHudRender.cpp index 360d4e9f..0736dc7e 100644 --- a/main/source/mod/AvHHudRender.cpp +++ b/main/source/mod/AvHHudRender.cpp @@ -1342,7 +1342,7 @@ void AvHHud::DrawOrders() { // Draw them blinking for soldiers, but always for commanders float theFractionalLastUpdate = this->mTimeOfLastUpdate - (int)this->mTimeOfLastUpdate; - if((theFractionalLastUpdate > .25f) || (this->GetHUDUser3() == AVH_USER3_COMMANDER_PLAYER)) + if ((theFractionalLastUpdate > .25f || CVAR_GET_FLOAT("hud_waypointblinking") <= 1.0f) || (this->GetHUDUser3() == AVH_USER3_COMMANDER_PLAYER)) { OrderListType theOrders = this->GetOrderList(); diff --git a/main/user.scr b/main/user.scr index fecf0c99..e67c523a 100644 --- a/main/user.scr +++ b/main/user.scr @@ -236,6 +236,18 @@ DESCRIPTION INFO_OPTIONS } { "2.000000" } } + + "hud_waypointblinking" + { + "Waypoint blinking" + { + LIST + "Never" "0" + "On map only" "1" + "On map and HUD" "2" + } + { "1.000000" } + } "hud_teamhealthalert" {