- added Gez's anti-crossinclude submission but made some changes. Cross-includes overriding core files will produce fatal errors but cross-includes between PWADs will be tolerated. For DECORATE a command line override switch exists so that for testing the error can be disabled.

SVN r2400 (trunk)
This commit is contained in:
Christoph Oelckers 2010-07-01 09:35:39 +00:00
parent 853b8f8963
commit 6df5e6f9cb
5 changed files with 59 additions and 16 deletions

View file

@ -1209,8 +1209,11 @@ void D_DoAdvanceDemo (void)
case 2:
pagetic = (int)(gameinfo.pageTime * TICRATE);
gamestate = GS_DEMOSCREEN;
if (gameinfo.creditPages.Size() > 0)
{
pagename = gameinfo.creditPages[pagecount];
pagecount = (pagecount+1) % gameinfo.creditPages.Size();
}
demosequence = 1;
break;
}

View file

@ -51,6 +51,8 @@
#include "doomstat.h"
#include "d_player.h"
#include "autosegs.h"
#include "version.h"
#include "v_text.h"
int FindEndSequence (int type, const char *picname);
@ -1865,6 +1867,15 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i
{
sc.ScriptError("include file '%s' not found", sc.String);
}
if (Wads.GetLumpFile(sc.LumpNum) != Wads.GetLumpFile(inclump))
{
// Do not allow overriding includes from the default MAPINFO
if (Wads.GetLumpFile(sc.LumpNum) == 0)
{
I_FatalError("File %s is overriding core lump %s.",
Wads.GetWadFullName(Wads.GetLumpFile(inclump)), sc.String);
}
}
FScanner saved_sc = sc;
ParseMapInfo(inclump, gamedefaults, defaultinfo);
sc = saved_sc;
@ -1956,12 +1967,18 @@ void G_ParseMapInfo (const char *basemapinfo)
atterm(ClearEpisodes);
// Parse the default MAPINFO for the current game.
// Parse the default MAPINFO for the current game. This lump *MUST* come from zdoom.pk3.
if (basemapinfo != NULL)
{
FMapInfoParser parse;
level_info_t defaultinfo;
parse.ParseMapInfo(Wads.GetNumForFullName(basemapinfo), gamedefaults, defaultinfo);
int baselump = Wads.GetNumForFullName(basemapinfo);
if (Wads.GetLumpFile(baselump) > 0)
{
I_FatalError("File %s is overriding core lump %s.",
Wads.GetWadFullName(Wads.GetLumpFile(baselump)), basemapinfo);
}
parse.ParseMapInfo(baselump, gamedefaults, defaultinfo);
}
static const char *mapinfonames[] = { "MAPINFO", "ZMAPINFO", NULL };

View file

@ -58,6 +58,7 @@
#include "v_palette.h"
#include "p_acs.h"
#include "gstrings.h"
#include "version.h"
#define ARTIFLASH_OFFSET (statusBar->invBarOffset+6)
enum
@ -469,6 +470,7 @@ void SBarInfo::ParseSBarInfo(int lump)
ParseSBarInfo(lump);
continue;
}
int baselump = -2;
switch(sc.MustMatchString(SBarInfoTopLevel))
{
case SBARINFO_BASE:
@ -477,24 +479,15 @@ void SBarInfo::ParseSBarInfo(int lump)
sc.MustGetToken(TK_Identifier);
if(sc.Compare("Doom"))
{
int lump = Wads.CheckNumForFullName("sbarinfo/doom.txt", true);
if(lump == -1)
sc.ScriptError("Standard Doom Status Bar not found.");
ParseSBarInfo(lump);
baselump = Wads.CheckNumForFullName("sbarinfo/doom.txt", true);
}
else if(sc.Compare("Heretic"))
{
int lump = Wads.CheckNumForFullName("sbarinfo/heretic.txt", true);
if(lump == -1)
sc.ScriptError("Standard Heretic Status Bar not found.");
ParseSBarInfo(lump);
baselump = Wads.CheckNumForFullName("sbarinfo/heretic.txt", true);
}
else if(sc.Compare("Hexen"))
{
int lump = Wads.CheckNumForFullName("sbarinfo/hexen.txt", true);
if(lump == -1)
sc.ScriptError("Standard Hexen Status Bar not found.");
ParseSBarInfo(lump);
baselump = Wads.CheckNumForFullName("sbarinfo/hexen.txt", true);
}
else if(sc.Compare("Strife"))
gameType = GAME_Strife;
@ -502,6 +495,20 @@ void SBarInfo::ParseSBarInfo(int lump)
gameType = GAME_Any;
else
sc.ScriptError("Bad game name: %s", sc.String);
// If one of the standard status bar should be loaded, baselump has been set to a different value.
if (baselump != -2)
{
if(baselump == -1)
{
sc.ScriptError("Standard %s status bar not found.", sc.String);
}
else if (Wads.GetLumpFile(baselump) > 0)
{
I_FatalError("File %s is overriding core lump sbarinfo/%s.txt.",
Wads.GetWadFullName(Wads.GetLumpFile(baselump)), sc.String);
}
ParseSBarInfo(baselump);
}
sc.MustGetToken(';');
break;
case SBARINFO_HEIGHT:

View file

@ -1293,6 +1293,9 @@ void M_DrawFrame (int left, int top, int width, int height)
{
FTexture *p;
const gameborder_t *border = gameinfo.border;
// Sanity check for incomplete gameinfo
if (border == NULL)
return;
int offset = border->offset;
int right = left + width;
int bottom = top + height;

View file

@ -52,6 +52,9 @@
#include "thingdef_exp.h"
#include "w_wad.h"
#include "v_video.h"
#include "version.h"
#include "v_text.h"
#include "m_argv.h"
void ParseOldDecoration(FScanner &sc, EDefinitionType def);
@ -1199,6 +1202,16 @@ void ParseDecorate (FScanner &sc)
case TK_Include:
{
sc.MustGetString();
// This check needs to remain overridable for testing purposes.
if (Wads.GetLumpFile(sc.LumpNum) == 0 && !Args->CheckParm("-allowdecoratecrossincludes"))
{
int includefile = Wads.GetLumpFile(Wads.CheckNumForFullName(sc.String, true));
if (includefile != 0)
{
I_FatalError("File %s is overriding core lump %s.",
Wads.GetWadFullName(includefile), sc.String);
}
}
FScanner newscanner;
newscanner.Open(sc.String);
ParseDecorate(newscanner);