From 1b0756e170f7c75b4846c49e4cdc3d9343d0e497 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 1 May 2010 17:29:25 +0000 Subject: [PATCH] - added a am_showalllines cheat CVAR as countermeasure for maps that intentionally disable the full automap. SVN r2307 (trunk) --- src/am_map.cpp | 58 ++++++++++++++++++++++++++++++++++++++++--- src/b_bot.cpp | 2 -- src/c_cmds.cpp | 4 +-- src/c_dispatch.h | 2 ++ src/d_main.cpp | 1 - src/info.cpp | 1 - src/m_cheat.cpp | 1 - src/p_interaction.cpp | 1 - src/st_stuff.cpp | 1 - 9 files changed, 59 insertions(+), 12 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 28739c856..62af8ed67 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -177,6 +177,45 @@ CVAR (Color, am_ovthingcolor_friend, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_monster, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_item, 0xe88800, CVAR_ARCHIVE); +// Disable the ML_DONTDRAW line flag if x% of all lines in a map are flagged with it +// (To counter annoying mappers who think they are smart by making the automap unusable) +bool am_showallenabled; + +CUSTOM_CVAR (Int, am_showalllines, -1, 0) // This is a cheat so don't save it. +{ + int flagged = 0; + int total = 0; + if (self > 0) + { + for(int i=0;ifrontsector == line->backsector) continue; + + // disregard control sectors for deep water + if (line->frontsector->e->FakeFloor.Sectors.Size() > 0) continue; + + // disregard control sectors for 3D-floors + if (line->frontsector->e->XFloor.attached.Size() > 0) continue; + + total++; + if (line->flags & ML_DONTDRAW) flagged++; + } + am_showallenabled = (flagged * 100 / total >= self); + } + else if (self == 0) + { + am_showallenabled = true; + } + else + { + am_showallenabled = false; + } +} + + // drawing stuff #define AM_PANDOWNKEY KEY_DOWNARROW #define AM_PANUPKEY KEY_UPARROW @@ -946,6 +985,8 @@ void AM_LevelInit () if (scale_mtof > max_scale_mtof) scale_mtof = min_scale_mtof; scale_ftom = MapDiv(MAPUNIT, scale_mtof); + + am_showalllines.Callback(); } //============================================================================= @@ -1601,7 +1642,12 @@ void AM_drawWalls (bool allmap) if (am_cheat != 0 || (lines[i].flags & ML_MAPPED)) { if ((lines[i].flags & ML_DONTDRAW) && am_cheat == 0) - continue; + { + if (!am_showallenabled || CheckCheatmode(false)) + { + continue; + } + } if (AM_CheckSecret(&lines[i])) { @@ -1680,8 +1726,14 @@ void AM_drawWalls (bool allmap) } else if (allmap) { - if (!(lines[i].flags & ML_DONTDRAW)) - AM_drawMline(&l, NotSeenColor); + if ((lines[i].flags & ML_DONTDRAW) && am_cheat == 0) + { + if (!am_showallenabled || CheckCheatmode(false)) + { + continue; + } + } + AM_drawMline(&l, NotSeenColor); } } } diff --git a/src/b_bot.cpp b/src/b_bot.cpp index 3911264cd..cee4086ae 100644 --- a/src/b_bot.cpp +++ b/src/b_bot.cpp @@ -67,8 +67,6 @@ CCMD (removebots) Net_WriteByte (DEM_KILLBOTS); } -extern bool CheckCheatmode (); - CCMD (freeze) { if (CheckCheatmode ()) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 0567427cf..6d21a7922 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -80,11 +80,11 @@ CCMD (toggleconsole) C_ToggleConsole(); } -bool CheckCheatmode () +bool CheckCheatmode (bool printmsg) { if ((G_SkillProperty(SKILLP_DisableCheats) || netgame || deathmatch) && (!sv_cheats)) { - Printf ("sv_cheats must be true to enable this command.\n"); + if (printmsg) Printf ("sv_cheats must be true to enable this command.\n"); return true; } else diff --git a/src/c_dispatch.h b/src/c_dispatch.h index fb76f1aee..a19352d32 100644 --- a/src/c_dispatch.h +++ b/src/c_dispatch.h @@ -39,6 +39,8 @@ class FConfigFile; class APlayerPawn; +extern bool CheckCheatmode (bool printmsg = true); + void C_ExecCmdLineParams (); // Add commands to the console as if they were typed in. Can handle wait diff --git a/src/d_main.cpp b/src/d_main.cpp index 61e76da0d..65973e3c8 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -120,7 +120,6 @@ extern void M_SetDefaultMode (); extern void R_ExecuteSetViewSize (); extern void G_NewInit (); extern void SetupPlayerClasses (); -extern bool CheckCheatmode (); const IWADInfo *D_FindIWAD(TArray &wadfiles, const char *iwad, const char *basewad); // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- diff --git a/src/info.cpp b/src/info.cpp index 62556b1e9..1b49ce7dd 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -454,7 +454,6 @@ CCMD (dumpmapthings) FDoomEdMap::DumpMapThings (); } -bool CheckCheatmode (); static void SummonActor (int command, int command2, FCommandLine argv) { diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index a79ca3ad7..45175c50a 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -1062,7 +1062,6 @@ void cht_Suicide (player_t *plyr) } } -bool CheckCheatmode (); CCMD (mdk) { diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 6cdf86ab5..7dfd7398f 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1539,7 +1539,6 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage, return; } -bool CheckCheatmode (); CCMD (kill) { diff --git a/src/st_stuff.cpp b/src/st_stuff.cpp index 59b65ef85..08e6f0be4 100644 --- a/src/st_stuff.cpp +++ b/src/st_stuff.cpp @@ -293,7 +293,6 @@ static cheatseq_t SpecialCheats[] = }; -extern bool CheckCheatmode (); CVAR(Bool, allcheats, false, CVAR_ARCHIVE)