From 44974ff28ff0226abf673a41fc383f12da67e1dc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 4 Sep 2009 22:25:46 +0000 Subject: [PATCH] - made menu dimming a mapping option but kept the CVARS as user override. SVN r1790 (trunk) --- docs/rh-log.txt | 5 ++++- src/gameconfigfile.cpp | 13 +++++++++---- src/gi.cpp | 2 ++ src/gi.h | 2 ++ src/v_video.cpp | 20 +++++++++++++++----- src/version.h | 2 +- wadsrc/static/mapinfo/chex.txt | 2 ++ wadsrc/static/mapinfo/doomcommon.txt | 2 ++ wadsrc/static/mapinfo/heretic.txt | 2 ++ wadsrc/static/mapinfo/hexen.txt | 2 ++ wadsrc/static/mapinfo/strife.txt | 2 ++ 11 files changed, 43 insertions(+), 11 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 6627d9e72..b2875688f 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ -September 3, 2009 (Changes by Graf Zahl) +September 5, 2009 (Changes by Graf Zahl) +- made menu dimming a mapping option but kept the CVARS as user override. + +September 3, 2009 (Changes by Graf Zahl) - fixed: Weapons must first check if they can be switched and afterwards if they can be fired. These checks were reversed. diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index c045a8702..173f7287a 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -65,7 +65,6 @@ extern HWND Window; EXTERN_CVAR (Bool, con_centernotify) EXTERN_CVAR (Int, msg0color) -EXTERN_CVAR (Color, dimcolor) EXTERN_CVAR (Color, color) EXTERN_CVAR (Float, dimamount) EXTERN_CVAR (Int, msgmidcolor) @@ -285,6 +284,15 @@ void FGameConfigFile::DoGlobalSetup () } } } + if (last < 209) + { + // menu dimming is now a gameinfo option so switch user override off + FBaseCVar *dim = FindCVar ("dimamount", NULL); + if (dim != NULL) + { + dim->ResetToDefault (); + } + } } } } @@ -639,7 +647,6 @@ void FGameConfigFile::SetRavenDefaults (bool isHexen) { con_centernotify.ResetToDefault (); msg0color.ResetToDefault (); - dimcolor.ResetToDefault (); color.ResetToDefault (); } @@ -650,8 +657,6 @@ void FGameConfigFile::SetRavenDefaults (bool isHexen) snd_pitched.SetGenericRepDefault (val, CVAR_Bool); val.Int = 9; msg0color.SetGenericRepDefault (val, CVAR_Int); - val.Int = 0x0000ff; - dimcolor.SetGenericRepDefault (val, CVAR_Int); val.Int = CR_WHITE; msgmidcolor.SetGenericRepDefault (val, CVAR_Int); val.Int = CR_YELLOW; diff --git a/src/gi.cpp b/src/gi.cpp index 42b0dd34f..f9ae66ea4 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -259,6 +259,8 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_BOOL(noloopfinalemusic, "noloopfinalemusic") GAMEINFOKEY_BOOL(drawreadthis, "drawreadthis") GAMEINFOKEY_BOOL(intermissioncounter, "intermissioncounter") + GAMEINFOKEY_COLOR(dimcolor, "dimcolor") + GAMEINFOKEY_FLOAT(dimamount, "dimamount") else { // ignore unkown keys. diff --git a/src/gi.h b/src/gi.h index 4642e02e0..99f08ff59 100644 --- a/src/gi.h +++ b/src/gi.h @@ -94,6 +94,8 @@ struct gameinfo_t FString backpacktype; FString statusbar; FString intermissionMusic; + DWORD dimcolor; + float dimamount; const char *GetFinalePage(unsigned int num) const; }; diff --git a/src/v_video.cpp b/src/v_video.cpp index 5387613f7..304a8ee44 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -168,11 +168,11 @@ CUSTOM_CVAR (Int, vid_refreshrate, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) } } -CUSTOM_CVAR (Float, dimamount, 0.2f, CVAR_ARCHIVE) +CUSTOM_CVAR (Float, dimamount, -1.f, CVAR_ARCHIVE) { - if (self < 0.f) + if (self < 0.f && self != -1.f) { - self = 0.f; + self = -1.f; } else if (self > 1.f) { @@ -296,14 +296,24 @@ void DCanvas::FlatFill (int left, int top, int right, int bottom, FTexture *src, void DCanvas::Dim (PalEntry color) { PalEntry dimmer; - float amount = dimamount; + float amount; + + if (dimamount >= 0) + { + dimmer = PalEntry(dimcolor); + amount = dimamount; + } + else + { + dimmer = gameinfo.dimcolor; + amount = gameinfo.dimamount; + } if (gameinfo.gametype == GAME_Hexen && gamestate == GS_DEMOSCREEN) { // On the Hexen title screen, the default dimming is not // enough to make the menus readable. amount = MIN (1.f, amount*2.f); } - dimmer = PalEntry(dimcolor); // Add the cvar's dimming on top of the color passed to the function if (color.a != 0) { diff --git a/src/version.h b/src/version.h index 510bcd0de..b473ea69a 100644 --- a/src/version.h +++ b/src/version.h @@ -59,7 +59,7 @@ // Version stored in the ini's [LastRun] section. // Bump it if you made some configuration change that you want to // be able to migrate in FGameConfigFile::DoGlobalSetup(). -#define LASTRUNVERSION "208" +#define LASTRUNVERSION "209" // Protocol version used in demos. // Bump it if you change existing DEM_ commands or add new ones. diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index a83a51bc4..dd39100fe 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -33,6 +33,8 @@ gameinfo weaponslot = 5, "ZorchPropulsor" weaponslot = 6, "PhasingZorcher" weaponslot = 7, "LAZDevice" + dimcolor = "ff d7 00" + dimamount = 0.2 } skill baby diff --git a/wadsrc/static/mapinfo/doomcommon.txt b/wadsrc/static/mapinfo/doomcommon.txt index 0d91265f9..01085df71 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -32,6 +32,8 @@ gameinfo weaponslot = 5, "RocketLauncher" weaponslot = 6, "PlasmaRifle" weaponslot = 7, "BFG9000" + dimcolor = "ff d7 00" + dimamount = 0.2 } skill baby diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index 057512d20..1e12e5856 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -33,6 +33,8 @@ gameinfo weaponslot = 5, "SkullRod" weaponslot = 6, "PhoenixRod" weaponslot = 7, "Mace" + dimcolor = "00 ff 00" + dimamount = 0.2 } skill baby diff --git a/wadsrc/static/mapinfo/hexen.txt b/wadsrc/static/mapinfo/hexen.txt index 9df6a7cef..da7477d80 100644 --- a/wadsrc/static/mapinfo/hexen.txt +++ b/wadsrc/static/mapinfo/hexen.txt @@ -33,6 +33,8 @@ gameinfo weaponslot = 2, "FWeapAxe", "CWeapStaff", "MWeapFrost" weaponslot = 3, "FWeapHammer", "CWeapFlame", "MWeapLightning" weaponslot = 4, "FWeapQuietus", "CWeapWraithverge", "MWeapBloodscourge" + dimcolor = "00 ff 00" + dimamount = 0.2 } skill baby diff --git a/wadsrc/static/mapinfo/strife.txt b/wadsrc/static/mapinfo/strife.txt index 59a15f1b0..e2162b63c 100644 --- a/wadsrc/static/mapinfo/strife.txt +++ b/wadsrc/static/mapinfo/strife.txt @@ -34,6 +34,8 @@ gameinfo weaponslot = 6, "FlameThrower" weaponslot = 7, "Mauler2", "Mauler" weaponslot = 8, "Sigil" + dimcolor = "ff d7 00" + dimamount = 0.2 } skill baby