Fix gamma ramp and add hud_waypointblinking

- fix gamma ramp not working correctly on maps with no env_gamma entity
- add hud_waypointblinking
This commit is contained in:
pierow 2024-04-29 17:27:57 -04:00
parent 3b8049d226
commit f39297efcb
8 changed files with 43 additions and 5 deletions

View File

@ -229,6 +229,7 @@ void CHud :: Init( void )
CVAR_CREATE("hud_mapnamesBlue", "255", FCVAR_ARCHIVE); CVAR_CREATE("hud_mapnamesBlue", "255", FCVAR_ARCHIVE);
CVAR_CREATE("hud_nameinfo", "1", FCVAR_ARCHIVE); CVAR_CREATE("hud_nameinfo", "1", FCVAR_ARCHIVE);
CVAR_CREATE("hud_drawwaypoints", "2", FCVAR_ARCHIVE); CVAR_CREATE("hud_drawwaypoints", "2", FCVAR_ARCHIVE);
CVAR_CREATE("hud_waypointblinking", "0", FCVAR_ARCHIVE);
m_pSpriteList = NULL; m_pSpriteList = NULL;

View File

@ -175,7 +175,7 @@ void CPostProcessShader::DrawShader()
// If the map has no gamma value, override it with the cvar's value. // If the map has no gamma value, override it with the cvar's value.
else else
{ {
colorMultiplier = min(1.0f, scalarCvar); colorMultiplier = max(1.0f, scalarCvar);
} }
// Use shader. // Use shader.

View File

@ -1030,7 +1030,7 @@ void AvHGameplay::Spawn()
AvHGamma::AvHGamma() AvHGamma::AvHGamma()
{ {
this->mGammaScalar = 1.0f; this->mGammaScalar = kDefaultMapGamma;
} }
void AvHGamma::KeyValue(KeyValueData* pkvd) void AvHGamma::KeyValue(KeyValueData* pkvd)

View File

@ -770,7 +770,7 @@ bool AvHGamerules::CanPlayerBeKilled(CBasePlayer* inPlayer)
void AvHGamerules::CalculateMapGamma() void AvHGamerules::CalculateMapGamma()
{ {
// Set defaults // Set defaults
this->mCalculatedMapGamma = kDefaultMapGamma; //this->mCalculatedMapGamma = kDefaultMapGamma;
// Fetch from map extents entity if the map has one // Fetch from map extents entity if the map has one
FOR_ALL_ENTITIES(kwsGammaClassName, AvHGamma*) FOR_ALL_ENTITIES(kwsGammaClassName, AvHGamma*)
@ -2307,6 +2307,8 @@ void AvHGamerules::PostWorldPrecacheReset(bool inNewMap)
this->mMapExtents.ResetMapExtents(); this->mMapExtents.ResetMapExtents();
this->mCalculatedMapGamma = false; this->mCalculatedMapGamma = false;
this->mMapGamma = kDefaultMapGamma;
this->mMapGammaAlt = kDefaultMapGamma;
// TODO: Clear min/max map sizes? Others? // TODO: Clear min/max map sizes? Others?

View File

@ -2611,6 +2611,7 @@ void AvHHud::ResetGame(bool inMapChanged)
this->mHiveInfoList.clear(); this->mHiveInfoList.clear();
this->mShaderGamma = kDefaultMapGamma; this->mShaderGamma = kDefaultMapGamma;
this->mShaderGammaAlt = kDefaultMapGamma;
this->mDesiredGammaSlope = kDefaultMapGamma; this->mDesiredGammaSlope = kDefaultMapGamma;
this->mDesiredGammaSlopeAlt = kDefaultMapGamma; this->mDesiredGammaSlopeAlt = kDefaultMapGamma;
this->mRecordingLastFrame = false; this->mRecordingLastFrame = false;
@ -2821,7 +2822,24 @@ int AvHHud::MsgFunc_SetOrder(const char* pszName, int iSize, void* pbuf)
AvHChangeOrder(this->mOrders, theNewOrder); 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 // Give feedback on order
this->OrderNotification(theNewOrder); this->OrderNotification(theNewOrder);
@ -3875,6 +3893,8 @@ void AvHHud::Init(void)
this->mDrawCombatUpgradeMenu = false; this->mDrawCombatUpgradeMenu = false;
this->mDrawOrderOverlay = true; this->mDrawOrderOverlay = true;
this->mLastOrderLocation = Vector(0.0f, 0.0f, 0.0f);
this->mLastOrderIndex = -1;
this->mReInitHUD = false; this->mReInitHUD = false;
this->mLastHudStyle = 0; this->mLastHudStyle = 0;

View File

@ -889,6 +889,9 @@ private:
float mShaderGamma; float mShaderGamma;
float mShaderGammaAlt; float mShaderGammaAlt;
Vector mLastOrderLocation;
int mLastOrderIndex;
}; };
class CPostProcessShader class CPostProcessShader

View File

@ -1342,7 +1342,7 @@ void AvHHud::DrawOrders()
{ {
// Draw them blinking for soldiers, but always for commanders // Draw them blinking for soldiers, but always for commanders
float theFractionalLastUpdate = this->mTimeOfLastUpdate - (int)this->mTimeOfLastUpdate; 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(); OrderListType theOrders = this->GetOrderList();

View File

@ -236,6 +236,18 @@ DESCRIPTION INFO_OPTIONS
} }
{ "2.000000" } { "2.000000" }
} }
"hud_waypointblinking"
{
"Waypoint blinking"
{
LIST
"Never" "0"
"On map only" "1"
"On map and HUD" "2"
}
{ "1.000000" }
}
"hud_teamhealthalert" "hud_teamhealthalert"
{ {