- added a am_showalllines cheat CVAR as countermeasure for maps that intentionally disable the full automap.

SVN r2307 (trunk)
This commit is contained in:
Christoph Oelckers 2010-05-01 17:29:25 +00:00
parent d070e04ff6
commit 1b0756e170
9 changed files with 59 additions and 12 deletions

View file

@ -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;i<numlines;i++)
{
line_t *line = &lines[i];
// disregard intra-sector lines
if (line->frontsector == 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);
}
}
}

View file

@ -67,8 +67,6 @@ CCMD (removebots)
Net_WriteByte (DEM_KILLBOTS);
}
extern bool CheckCheatmode ();
CCMD (freeze)
{
if (CheckCheatmode ())

View file

@ -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

View file

@ -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

View file

@ -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<FString> &wadfiles, const char *iwad, const char *basewad);
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------

View file

@ -454,7 +454,6 @@ CCMD (dumpmapthings)
FDoomEdMap::DumpMapThings ();
}
bool CheckCheatmode ();
static void SummonActor (int command, int command2, FCommandLine argv)
{

View file

@ -1062,7 +1062,6 @@ void cht_Suicide (player_t *plyr)
}
}
bool CheckCheatmode ();
CCMD (mdk)
{

View file

@ -1539,7 +1539,6 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage,
return;
}
bool CheckCheatmode ();
CCMD (kill)
{

View file

@ -293,7 +293,6 @@ static cheatseq_t SpecialCheats[] =
};
extern bool CheckCheatmode ();
CVAR(Bool, allcheats, false, CVAR_ARCHIVE)