From 35ba99ed31efc173d2229d2ec4e22249a6d17967 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 25 Jul 2010 21:46:51 +0000 Subject: [PATCH] - Added Gez's automap enhancements but made the new key icon optional. SVN r2462 (trunk) --- src/am_map.cpp | 104 +++++++++++++++++++++++++++++++--------- src/d_dehacked.cpp | 2 +- src/g_shared/a_keys.cpp | 7 ++- src/m_options.cpp | 6 +++ 4 files changed, 95 insertions(+), 24 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 291a069d8..5883b9472 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -59,6 +59,7 @@ #include "am_map.h" #include "a_artifacts.h" #include "po_man.h" +#include "a_keys.h" struct AMColor { @@ -80,7 +81,7 @@ struct AMColor static AMColor Background, YourColor, WallColor, TSWallColor, FDWallColor, CDWallColor, ThingColor, - ThingColor_Item, ThingColor_Monster, ThingColor_Friend, + ThingColor_Item, ThingColor_CountItem, ThingColor_Monster, ThingColor_Friend, SecretWallColor, GridColor, XHairColor, NotSeenColor, LockedColor, @@ -171,12 +172,15 @@ 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 (Bool, am_showkeys, true, CVAR_ARCHIVE); CVAR (Color, am_thingcolor_friend, 0xfcfcfc, CVAR_ARCHIVE); CVAR (Color, am_thingcolor_monster, 0xfcfcfc, CVAR_ARCHIVE); CVAR (Color, am_thingcolor_item, 0xfcfcfc, CVAR_ARCHIVE); +CVAR (Color, am_thingcolor_citem, 0xfcfcfc, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_friend, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_monster, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_item, 0xe88800, CVAR_ARCHIVE); +CVAR (Color, am_ovthingcolor_citem, 0xe88800, CVAR_ARCHIVE); CVAR(Int, am_showsubsector, -1, 0); @@ -297,25 +301,22 @@ mline_t player_arrow[] = { { { -R+3*R/8, 0 }, { -R+R/8, R/4 } }, // >>---> { { -R+3*R/8, 0 }, { -R+R/8, -R/4 } } }; +#define NUMPLYRLINES (sizeof(player_arrow)/sizeof(mline_t)) mline_t player_arrow_raven[] = { - { { -R+R/4, 0 }, { 0, 0} }, // center line. - { { -R+R/4, R/8 }, { R, 0} }, // blade - { { -R+R/4, -R/8 }, { R, 0 } }, - { { -R+R/4, -R/4 }, { -R+R/4, R/4 } }, // crosspiece - { { -R+R/8, -R/4 }, { -R+R/8, R/4 } }, - { { -R+R/8, -R/4 }, { -R+R/4, -R/4} }, //crosspiece connectors - { { -R+R/8, R/4 }, { -R+R/4, R/4} }, - { { -R-R/4, R/8 }, { -R-R/4, -R/8 } }, //pommel - { { -R-R/4, R/8 }, { -R+R/8, R/8 } }, - { { -R-R/4, -R/8}, { -R+R/8, -R/8 } } - }; - -#undef R -#define NUMPLYRLINES (sizeof(player_arrow)/sizeof(mline_t)) + { { -R+R/4, 0 }, { 0, 0} }, // center line. + { { -R+R/4, R/8 }, { R, 0} }, // blade + { { -R+R/4, -R/8 }, { R, 0 } }, + { { -R+R/4, -R/4 }, { -R+R/4, R/4 } }, // crosspiece + { { -R+R/8, -R/4 }, { -R+R/8, R/4 } }, + { { -R+R/8, -R/4 }, { -R+R/4, -R/4} }, //crosspiece connectors + { { -R+R/8, R/4 }, { -R+R/4, R/4} }, + { { -R-R/4, R/8 }, { -R-R/4, -R/8 } }, //pommel + { { -R-R/4, R/8 }, { -R+R/8, R/8 } }, + { { -R-R/4, -R/8}, { -R+R/8, -R/8 } } +}; #define NUMPLYRLINES_RAVEN (sizeof(player_arrow_raven)/sizeof(mline_t)) -#define R ((8*PLAYERRADIUS)/7) mline_t cheat_player_arrow[] = { { { -R+R/8, 0 }, { R, 0 } }, // ----- { { R, 0 }, { R-R/2, R/6 } }, // -----> @@ -334,9 +335,9 @@ mline_t cheat_player_arrow[] = { { { R/6, -R/7 }, { R/6+R/32, -R/7-R/32 } }, { { R/6+R/32, -R/7-R/32 }, { R/6+R/10, -R/7 } } }; +#define NUMCHEATPLYRLINES (sizeof(cheat_player_arrow)/sizeof(mline_t)) #undef R -#define NUMCHEATPLYRLINES (sizeof(cheat_player_arrow)/sizeof(mline_t)) #define R (MAPUNIT) // [RH] Avoid lots of warnings without compiler-specific #pragmas @@ -353,9 +354,37 @@ mline_t thintriangle_guy[] = { L (1,0, -.5,.7), L (-.5,.7, -.5,-.7) }; +#define NUMTHINTRIANGLEGUYLINES (sizeof(thintriangle_guy)/sizeof(mline_t)) + +mline_t square_guy[] = { + L (0,1,1,0), + L (1,0,0,-1), + L (0,-1,-1,0), + L (-1,0,0,1) +}; +#define NUMSQUAREGUYLINES (sizeof(square_guy)/sizeof(mline_t)) + +#undef R +#define R (MAPUNIT) + +mline_t key_guy[] = { + L (-2, 0, -1.7, -0.5), + L (-1.7, -0.5, -1.5, -0.7), + L (-1.5, -0.7, -0.8, -0.5), + L (-0.8, -0.5, -0.6, 0), + L (-0.6, 0, -0.8, 0.5), + L (-1.5, 0.7, -0.8, 0.5), + L (-1.7, 0.5, -1.5, 0.7), + L (-2, 0, -1.7, 0.5), + L (-0.6, 0, 2, 0), + L (1.7, 0, 1.7, -1), + L (1.5, 0, 1.5, -1), + L (1.3, 0, 1.3, -1) +}; +#define NUMKEYGUYLINES (sizeof(key_guy)/sizeof(mline_t)) + #undef L #undef R -#define NUMTHINTRIANGLEGUYLINES (sizeof(thintriangle_guy)/sizeof(mline_t)) @@ -818,6 +847,7 @@ static void AM_initColors (bool overlayed) SecretWallColor = WallColor; SecretSectorColor.FromCVar (am_ovsecretsectorcolor); ThingColor_Item.FromCVar (am_ovthingcolor_item); + ThingColor_CountItem.FromCVar (am_ovthingcolor_citem); ThingColor_Friend.FromCVar (am_ovthingcolor_friend); ThingColor_Monster.FromCVar (am_ovthingcolor_monster); ThingColor.FromCVar (am_ovthingcolor); @@ -841,6 +871,7 @@ static void AM_initColors (bool overlayed) FDWallColor.FromCVar (am_fdwallcolor); CDWallColor.FromCVar (am_cdwallcolor); ThingColor_Item.FromCVar (am_thingcolor_item); + ThingColor_CountItem.FromCVar (am_thingcolor_citem); ThingColor_Friend.FromCVar (am_thingcolor_friend); ThingColor_Monster.FromCVar (am_thingcolor_monster); ThingColor.FromCVar (am_thingcolor); @@ -2027,11 +2058,40 @@ void AM_drawThings () if (t->flags & MF_FRIENDLY || !(t->flags & MF_COUNTKILL)) color = ThingColor_Friend; else color = ThingColor_Monster; } - else if (t->flags&MF_SPECIAL) color = ThingColor_Item; + else if (t->flags&MF_SPECIAL) + { + // Find the key's own color. + // Only works correctly if single-key locks have lower numbers than any-key locks. + // That is the case for all default keys, however. + if (t->IsKindOf(RUNTIME_CLASS(AKey))) + { + if (am_showkeys) + { + int P_GetMapColorForKey (AInventory * key); + int c = P_GetMapColorForKey(static_cast(t)); - AM_drawLineCharacter - (thintriangle_guy, NUMTHINTRIANGLEGUYLINES, - 16<= 0) color.FromRGB(RPART(c), GPART(c), BPART(c)); + else color = ThingColor_CountItem; + AM_drawLineCharacter(key_guy, NUMKEYGUYLINES, 16<flags&MF_COUNTITEM) + color = ThingColor_CountItem; + else + color = ThingColor_Item; + } + + if (color.Index != -1) + { + AM_drawLineCharacter + (thintriangle_guy, NUMTHINTRIANGLEGUYLINES, + 16<= 3) { diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index f896e6988..97c8296a4 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -952,7 +952,7 @@ static int PatchThing (int thingy) // compatibility, the upper bits are freed, but we have conflicts between the ZDoom bits // and the MBF bits. The only such flag exposed to DEHSUPP, though, is STEALTH -- the others // are not available through mnemonics, and aren't available either through their bit value. - // So if we find the STEALTH keyword, it's a ZDoom mod, otherwise assume assume FRIEND. + // So if we find the STEALTH keyword, it's a ZDoom mod, otherwise assume FRIEND. bool zdoomflags = false; char *strval; diff --git a/src/g_shared/a_keys.cpp b/src/g_shared/a_keys.cpp index 575d13592..c9139f76b 100644 --- a/src/g_shared/a_keys.cpp +++ b/src/g_shared/a_keys.cpp @@ -19,7 +19,12 @@ struct OneKey bool check(AActor * owner) { - return !!owner->FindInventory(key); + // P_GetMapColorForKey() checks the key directly + if (owner->IsKindOf (RUNTIME_CLASS(AKey))) + return owner->IsA(key); + // Other calls check an actor that may have a key in its inventory. + else + return !!owner->FindInventory(key); } }; diff --git a/src/m_options.cpp b/src/m_options.cpp index 324b45cc6..ddfd0f897 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -112,6 +112,7 @@ EXTERN_CVAR (Int, crosshair) EXTERN_CVAR (Bool, freelook) EXTERN_CVAR (Int, sv_smartaim) EXTERN_CVAR (Int, am_colorset) +EXTERN_CVAR (Bool, am_showkeys) EXTERN_CVAR (Int, vid_aspect) static void CalcIndent (menu_t *menu); @@ -579,6 +580,7 @@ static menuitem_t AutomapItems[] = { { discrete, "Show total time elapsed", {&am_showtotaltime}, {2.0}, {0.0}, {0.0}, {OnOff} }, { discrete, "Show secrets on map", {&am_map_secrets}, {3.0}, {0.0}, {0.0}, {SecretTypes} }, { discrete, "Draw map background", {&am_drawmapback}, {2.0}, {0.0}, {0.0}, {OnOff} }, + { discrete, "Show keys (cheat)", {&am_showkeys}, {2.0}, {0.0}, {0.0}, {OnOff} }, }; menu_t AutomapMenu = @@ -622,9 +624,11 @@ EXTERN_CVAR (Color, am_ovsecretsectorcolor) EXTERN_CVAR (Color, am_thingcolor_friend) EXTERN_CVAR (Color, am_thingcolor_monster) EXTERN_CVAR (Color, am_thingcolor_item) +EXTERN_CVAR (Color, am_thingcolor_citem) EXTERN_CVAR (Color, am_ovthingcolor_friend) EXTERN_CVAR (Color, am_ovthingcolor_monster) EXTERN_CVAR (Color, am_ovthingcolor_item) +EXTERN_CVAR (Color, am_ovthingcolor_citem) static menuitem_t MapColorsItems[] = { { rsafemore, "Restore default custom colors", {NULL}, {0}, {0}, {0}, {(value_t*)DefaultCustomColors} }, @@ -648,6 +652,7 @@ static menuitem_t MapColorsItems[] = { { colorpicker, "Monsters (for cheat)", {&am_thingcolor_monster}, {0}, {0}, {0}, {0} }, { colorpicker, "Friends (for cheat)", {&am_thingcolor_friend}, {0}, {0}, {0}, {0} }, { colorpicker, "Items (for cheat)", {&am_thingcolor_item}, {0}, {0}, {0}, {0} }, + { colorpicker, "Count Items (for cheat)", {&am_thingcolor_citem}, {0}, {0}, {0}, {0} }, { redtext, " ", {NULL}, {0}, {0}, {0}, {0} }, { colorpicker, "You (overlay)", {&am_ovyourcolor}, {0}, {0}, {0}, {0} }, { colorpicker, "1-sided walls (overlay)", {&am_ovwallcolor}, {0}, {0}, {0}, {0} }, @@ -659,6 +664,7 @@ static menuitem_t MapColorsItems[] = { { colorpicker, "Monsters (overlay) (for cheat)", {&am_ovthingcolor_monster}, {0}, {0}, {0}, {0} }, { colorpicker, "Friends (overlay) (for cheat)", {&am_ovthingcolor_friend}, {0}, {0}, {0}, {0} }, { colorpicker, "Items (overlay) (for cheat)", {&am_ovthingcolor_item}, {0}, {0}, {0}, {0} }, + { colorpicker, "Count Items (overlay) (for cheat)", {&am_ovthingcolor_citem}, {0}, {0}, {0}, {0} }, }; menu_t MapColorsMenu =