From 5a95c997d19552ee8d9ab568890621b9856977f6 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 12 Feb 2012 02:45:48 +0000 Subject: [PATCH] - Added keys on the automap for Heretic in easy mode, courtesy of Gez. SVN r3356 (trunk) --- src/am_map.cpp | 55 +++++++++++++++++++++++++++- src/g_level.h | 4 +- src/g_skill.cpp | 9 +++++ wadsrc/static/maparrows/ravenkey.txt | 9 +++++ wadsrc/static/mapinfo/heretic.txt | 1 + 5 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 wadsrc/static/maparrows/ravenkey.txt diff --git a/src/am_map.cpp b/src/am_map.cpp index 1c5415a992..44b6da619b 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -308,6 +308,7 @@ struct islope_t static TArray MapArrow; static TArray CheatMapArrow; static TArray CheatKey; +static TArray EasyKey; #define R (MAPUNIT) // [RH] Avoid lots of warnings without compiler-specific #pragmas @@ -536,10 +537,12 @@ void AM_StaticInit() MapArrow.Clear(); CheatMapArrow.Clear(); CheatKey.Clear(); + EasyKey.Clear(); if (gameinfo.mMapArrow.IsNotEmpty()) AM_ParseArrow(MapArrow, gameinfo.mMapArrow); if (gameinfo.mCheatMapArrow.IsNotEmpty()) AM_ParseArrow(CheatMapArrow, gameinfo.mCheatMapArrow); AM_ParseArrow(CheatKey, "maparrows/key.txt"); + AM_ParseArrow(EasyKey, "maparrows/ravenkey.txt"); if (MapArrow.Size() == 0) I_FatalError("No automap arrow defined"); char namebuf[9]; @@ -2261,6 +2264,49 @@ void AM_drawPlayers () // //============================================================================= +void AM_drawKeys () +{ + AMColor color; + mpoint_t p; + angle_t angle; + + TThinkerIterator it; + AKey *key; + + while ((key = it.Next()) != NULL) + { + p.x = key->x >> FRACTOMAPBITS; + p.y = key->y >> FRACTOMAPBITS; + angle = key->angle; + + if (am_rotate == 1 || (am_rotate == 2 && viewactive)) + { + AM_rotatePoint (&p.x, &p.y); + angle += ANG90 - players[consoleplayer].camera->angle; + } + + color = ThingColor; + if (key->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. + int P_GetMapColorForKey (AInventory * key); + int c = P_GetMapColorForKey(key); + + if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c)); + else color = ThingColor_CountItem; + AM_drawLineCharacter(&EasyKey[0], EasyKey.Size(), 0, 0, color, p.x, p.y); + } + } +} + +//============================================================================= +// +// +// +//============================================================================= + void AM_drawThings () { AMColor color; @@ -2299,7 +2345,12 @@ void AM_drawThings () // That is the case for all default keys, however. if (t->IsKindOf(RUNTIME_CLASS(AKey))) { - if (am_showkeys) + if (G_SkillProperty(SKILLP_EasyKey)) + { + // Already drawn by AM_drawKeys(), so don't draw again + color.Index = -1; + } + else if (am_showkeys) { int P_GetMapColorForKey (AInventory * key); int c = P_GetMapColorForKey(static_cast(t)); @@ -2521,6 +2572,8 @@ void AM_Drawer () AM_drawWalls(allmap); AM_drawPlayers(); + if (G_SkillProperty(SKILLP_EasyKey)) + AM_drawKeys(); if (am_cheat >= 2 || allthings) AM_drawThings(); diff --git a/src/g_level.h b/src/g_level.h index 4b70f595aa..10dc15eb8c 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -545,7 +545,8 @@ enum ESkillProperty SKILLP_MonsterHealth, SKILLP_FriendlyHealth, SKILLP_NoPain, - SKILLP_ArmorFactor + SKILLP_ArmorFactor, + SKILLP_EasyKey, }; int G_SkillProperty(ESkillProperty prop); const char * G_SkillName(); @@ -564,6 +565,7 @@ struct FSkillInfo bool AutoUseHealth; bool EasyBossBrain; + bool EasyKey; int RespawnCounter; int RespawnLimit; fixed_t Aggressiveness; diff --git a/src/g_skill.cpp b/src/g_skill.cpp index cac38563a9..46b9a1702a 100644 --- a/src/g_skill.cpp +++ b/src/g_skill.cpp @@ -66,6 +66,7 @@ void FMapInfoParser::ParseSkill () skill.FastMonsters = false; skill.DisableCheats = false; skill.EasyBossBrain = false; + skill.EasyKey = false; skill.AutoUseHealth = false; skill.RespawnCounter = 0; skill.RespawnLimit = 0; @@ -125,6 +126,10 @@ void FMapInfoParser::ParseSkill () { skill.EasyBossBrain = true; } + else if (sc.Compare ("easykey")) + { + skill.EasyKey = true; + } else if (sc.Compare("autousehealth")) { skill.AutoUseHealth = true; @@ -351,6 +356,9 @@ int G_SkillProperty(ESkillProperty prop) case SKILLP_EasyBossBrain: return AllSkills[gameskill].EasyBossBrain; + case SKILLP_EasyKey: + return AllSkills[gameskill].EasyKey; + case SKILLP_SpawnFilter: return AllSkills[gameskill].SpawnFilter; @@ -428,6 +436,7 @@ FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other) DisableCheats = other.DisableCheats; AutoUseHealth = other.AutoUseHealth; EasyBossBrain = other.EasyBossBrain; + EasyKey = other.EasyKey; RespawnCounter= other.RespawnCounter; RespawnLimit= other.RespawnLimit; Aggressiveness= other.Aggressiveness; diff --git a/wadsrc/static/maparrows/ravenkey.txt b/wadsrc/static/maparrows/ravenkey.txt new file mode 100644 index 0000000000..d66a64345c --- /dev/null +++ b/wadsrc/static/maparrows/ravenkey.txt @@ -0,0 +1,9 @@ +( 0, 0 ), ( 0.25, -0.5 ) +( 0.25, -0.5 ), ( 0.5, -0.5 ) +( 0.5, -0.5 ), ( 0.5, 0.5 ) +( 0.5, 0.5 ), ( 0.25, 0.5 ) +( 0.25, 0.5 ), ( 0, 0 ) // handle part type thing +( 0, 0 ), ( -1, 0 ) // stem +( -1, 0 ), ( -1, -0.5 ) // end lockpick part +( -0.75, 0 ), ( -0.75, -0.25 ) + diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index 84dd4552d4..196e81c502 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -75,6 +75,7 @@ skill baby EasyBossBrain SpawnFilter = Baby Name = "$MNU_WETNURSE" + EasyKey } skill easy