From 0997c608f2dc1e7c74ef2ccbb15e92647a283b88 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 30 Jan 2010 09:17:44 +0000 Subject: [PATCH] - added a secret sector color to automap overlay. - added a score display to both alt HUD and sbarinfo. - simplified code for AltHud status values display. SVN r2141 (trunk) --- src/am_map.cpp | 4 +- src/g_shared/sbarinfo_commands.cpp | 6 +++ src/g_shared/shared_hud.cpp | 75 ++++++++++++------------------ src/m_options.cpp | 2 + 4 files changed, 40 insertions(+), 47 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index da5a495ef..8f6871f99 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -167,6 +167,7 @@ CVAR (Color, am_ovtelecolor, 0xffff00, CVAR_ARCHIVE); CVAR (Color, am_intralevelcolor, 0x0000ff, CVAR_ARCHIVE); CVAR (Color, am_interlevelcolor, 0xff0000, CVAR_ARCHIVE); CVAR (Color, am_secretsectorcolor, 0xff00ff, CVAR_ARCHIVE); +CVAR (Color, am_ovsecretsectorcolor,0x00ffff, CVAR_ARCHIVE); CVAR (Int, am_map_secrets, 1, CVAR_ARCHIVE); CVAR (Bool, am_drawmapback, true, CVAR_ARCHIVE); CVAR (Color, am_thingcolor_friend, 0xfcfcfc, CVAR_ARCHIVE); @@ -770,7 +771,8 @@ static void AM_initColors (bool overlayed) { YourColor.FromCVar (am_ovyourcolor); WallColor.FromCVar (am_ovwallcolor); - SecretSectorColor = SecretWallColor = WallColor; + SecretWallColor = WallColor; + SecretSectorColor.FromCVar (am_ovsecretsectorcolor); ThingColor_Item.FromCVar (am_ovthingcolor_item); ThingColor_Friend.FromCVar (am_ovthingcolor_friend); ThingColor_Monster.FromCVar (am_ovthingcolor_monster); diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index eac92d86c..ebc6dad46 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -599,6 +599,8 @@ class CommandDrawNumber : public CommandDrawString value = AMMO1; else if(sc.Compare("ammo2")) value = AMMO2; + else if(sc.Compare("score")) + value = SCORE; else if(sc.Compare("ammo")) //request the next string to be an ammo type { value = AMMO; @@ -798,6 +800,9 @@ class CommandDrawNumber : public CommandDrawString case SECRETS: num = level.found_secrets; break; + case SCORE: + num = statusBar->CPlayer->mo->Score; + break; case TOTALSECRETS: num = level.total_secrets; break; @@ -925,6 +930,7 @@ class CommandDrawNumber : public CommandDrawString POWERUPTIME, AIRTIME, SELECTEDINVENTORY, + SCORE, CONSTANT }; diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index b2efa1d13..87664c204 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -67,6 +67,7 @@ CVAR (Bool, hud_showsecrets, true,CVAR_ARCHIVE); // Show secrets on HUD CVAR (Bool, hud_showmonsters, true,CVAR_ARCHIVE); // Show monster stats on HUD CVAR (Bool, hud_showitems, false,CVAR_ARCHIVE); // Show item stats on HUD CVAR (Bool, hud_showstats, false, CVAR_ARCHIVE); // for stamina and accuracy. +CVAR (Bool, hud_showscore, false, CVAR_ARCHIVE); // for user maintained score CVAR (Int, hud_ammo_red, 25, CVAR_ARCHIVE) // ammo percent less than which status is red CVAR (Int, hud_ammo_yellow, 50, CVAR_ARCHIVE) // ammo percent less is yellow more green @@ -98,6 +99,7 @@ static FTexture * fragpic; // Frags icon static FTexture * invgems[4]; // Inventory arrows static int hudwidth, hudheight; // current width/height for HUD display +static int statspace; void AM_GetPosition(fixed_t & x, fixed_t & y); @@ -198,37 +200,35 @@ static void DrawHudNumber(FFont *font, int color, int num, int x, int y, int tra // //=========================================================================== +static void DrawStatLine(int x, int &y, const char *prefix, const char *string) +{ + y -= SmallFont->GetHeight()-1; + screen->DrawText(SmallFont, hudcolor_statnames, x, y, prefix, + DTA_KeepRatio, true, + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); + + screen->DrawText(SmallFont, hudcolor_stats, x+statspace, y, string, + DTA_KeepRatio, true, + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); +} + static void DrawStatus(player_t * CPlayer, int x, int y) { char tempstr[50]; - int space; + + if (hud_showscore) + { + mysnprintf(tempstr, countof(tempstr), "%i ", CPlayer->mo->Score); + DrawStatLine(x, y, "Sc:", tempstr); + } if (hud_showstats) { - space = SmallFont->StringWidth("Ac: "); - - y -= SmallFont->GetHeight()-1; - screen->DrawText(SmallFont, hudcolor_statnames, x, y, "Ac:", - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); - mysnprintf(tempstr, countof(tempstr), "%i ", CPlayer->accuracy); - screen->DrawText(SmallFont, hudcolor_stats, x+space, y, tempstr, - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); - - y-=SmallFont->GetHeight()-1; - screen->DrawText(SmallFont, hudcolor_statnames, x, y, "St:", - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); - + DrawStatLine(x, y, "Ac:", tempstr); mysnprintf(tempstr, countof(tempstr), "%i ", CPlayer->stamina); - screen->DrawText(SmallFont, hudcolor_stats, x+space, y, tempstr, - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); + DrawStatLine(x, y, "St:", tempstr); } - else - space=SmallFont->StringWidth("K: "); if (!deathmatch) { @@ -236,41 +236,20 @@ static void DrawStatus(player_t * CPlayer, int x, int y) // work in cooperative hub games if (hud_showsecrets) { - y -= SmallFont->GetHeight()-1; - screen->DrawText(SmallFont, hudcolor_statnames, x, y, "S:", - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); - mysnprintf(tempstr, countof(tempstr), "%i/%i ", multiplayer? CPlayer->secretcount : level.found_secrets, level.total_secrets); - screen->DrawText(SmallFont, hudcolor_stats, x+space, y, tempstr, - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); + DrawStatLine(x, y, "S:", tempstr); } if (hud_showitems) { - y -= SmallFont->GetHeight()-1; - screen->DrawText(SmallFont, hudcolor_statnames, x, y, "I:", - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); - mysnprintf(tempstr, countof(tempstr), "%i/%i ", multiplayer? CPlayer->itemcount : level.found_items, level.total_items); - screen->DrawText(SmallFont, hudcolor_stats, x+space, y, tempstr, - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); + DrawStatLine(x, y, "I:", tempstr); } if (hud_showmonsters) { - y -= SmallFont->GetHeight()-1; - screen->DrawText(SmallFont, hudcolor_statnames, x, y, "K:", - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); - mysnprintf(tempstr, countof(tempstr), "%i/%i ", multiplayer? CPlayer->killcount : level.killed_monsters, level.total_monsters); - screen->DrawText(SmallFont, hudcolor_stats, x+space, y, tempstr, - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); + DrawStatLine(x, y, "K:", tempstr); } } } @@ -931,6 +910,10 @@ void HUD_InitHud() KeyTypes.Clear(); UnassignedKeyTypes.Clear(); + statspace = SmallFont->StringWidth("Ac:"); + + + // Now read custom icon overrides int lump, lastlump = 0; diff --git a/src/m_options.cpp b/src/m_options.cpp index 8b49e96ac..9c8199757 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -609,6 +609,7 @@ EXTERN_CVAR (Color, am_ovtelecolor) EXTERN_CVAR (Color, am_intralevelcolor) EXTERN_CVAR (Color, am_interlevelcolor) EXTERN_CVAR (Color, am_secretsectorcolor) +EXTERN_CVAR (Color, am_ovsecretsectorcolor) EXTERN_CVAR (Color, am_thingcolor_friend) EXTERN_CVAR (Color, am_thingcolor_monster) EXTERN_CVAR (Color, am_thingcolor_item) @@ -644,6 +645,7 @@ static menuitem_t MapColorsItems[] = { { colorpicker, "2-sided walls (overlay)", {&am_ovotherwallscolor},{0}, {0}, {0}, {0} }, { colorpicker, "Not-yet-seen walls (overlay)", {&am_ovunseencolor}, {0}, {0}, {0}, {0} }, { colorpicker, "Teleporter (overlay)", {&am_ovtelecolor}, {0}, {0}, {0}, {0} }, + { colorpicker, "Secret sector (overlay)", {&am_ovsecretsectorcolor}, {0}, {0}, {0}, {0} }, { colorpicker, "Actors (overlay) (for cheat)", {&am_ovthingcolor}, {0}, {0}, {0}, {0} }, { colorpicker, "Monsters (overlay) (for cheat)", {&am_ovthingcolor_monster}, {0}, {0}, {0}, {0} }, { colorpicker, "Friends (overlay) (for cheat)", {&am_ovthingcolor_friend}, {0}, {0}, {0}, {0} },