mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
- removed the optional MAPINFO data handler and moved the 3 items still using it to the main parser file.
This thing made sense when GZDoom and ZDoom were separate projects to avoid having to change some core files for the added options. Now, with only 3 ones remaining, one for FraggleScript and two for Extradata the overhead here is just too high. The 3 variables can just be moved to level_info_t without carrying along this much baggage.
This commit is contained in:
parent
2edf02d731
commit
6ae417725f
7 changed files with 38 additions and 171 deletions
|
@ -887,7 +887,7 @@ void FParser::SF_Spawn(void)
|
|||
{
|
||||
t_return.value.mobj->Angles.Yaw = angle;
|
||||
|
||||
if (!DFraggleThinker::ActiveThinker->nocheckposition)
|
||||
if (!level.info->fs_nocheckposition)
|
||||
{
|
||||
if (!P_TestMobjLocation(t_return.value.mobj))
|
||||
{
|
||||
|
@ -3723,21 +3723,9 @@ void FParser::SF_SetColor(void)
|
|||
// set all sectors with tag
|
||||
FSSectorTagIterator itr(tagnum);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
if (!DFraggleThinker::ActiveThinker->setcolormaterial)
|
||||
{
|
||||
level.sectors[i].SetColor(color, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// little hack for testing the D64 color stuff.
|
||||
for (int j = 0; j < 4; j++) level.sectors[i].SetSpecialColor(j, color);
|
||||
// simulates 'nocoloredspritelighting' settings.
|
||||
int v = (color.r + color.g + color.b) / 3;
|
||||
v = (255 + v + v) / 3;
|
||||
level.sectors[i].SetSpecialColor(sector_t::sprites, v, v, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,56 +55,6 @@ public:
|
|||
bool ParseInfo(MapData * map);
|
||||
};
|
||||
|
||||
struct FFsOptions : public FOptionalMapinfoData
|
||||
{
|
||||
FFsOptions()
|
||||
{
|
||||
identifier = "fragglescript";
|
||||
nocheckposition = false;
|
||||
setcolormaterial = false;
|
||||
}
|
||||
virtual FOptionalMapinfoData *Clone() const
|
||||
{
|
||||
FFsOptions *newopt = new FFsOptions;
|
||||
newopt->identifier = identifier;
|
||||
newopt->nocheckposition = nocheckposition;
|
||||
newopt->setcolormaterial = setcolormaterial;
|
||||
return newopt;
|
||||
}
|
||||
bool nocheckposition;
|
||||
bool setcolormaterial;
|
||||
};
|
||||
|
||||
DEFINE_MAP_OPTION(fs_nocheckposition, false)
|
||||
{
|
||||
FFsOptions *opt = info->GetOptData<FFsOptions>("fragglescript");
|
||||
|
||||
if (parse.CheckAssign())
|
||||
{
|
||||
parse.sc.MustGetNumber();
|
||||
opt->nocheckposition = !!parse.sc.Number;
|
||||
}
|
||||
else
|
||||
{
|
||||
opt->nocheckposition = true;
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(fs_setcolormaterial, false)
|
||||
{
|
||||
FFsOptions *opt = info->GetOptData<FFsOptions>("fragglescript");
|
||||
|
||||
if (parse.CheckAssign())
|
||||
{
|
||||
parse.sc.MustGetNumber();
|
||||
opt->setcolormaterial = !!parse.sc.Number;
|
||||
}
|
||||
else
|
||||
{
|
||||
opt->setcolormaterial = true;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Process the lump to strip all unneeded information from it
|
||||
|
@ -308,18 +258,6 @@ bool FScriptLoader::ParseInfo(MapData * map)
|
|||
|
||||
if (drownflag==-1) drownflag = (level.maptype != MAPTYPE_DOOM || fsglobal);
|
||||
if (!drownflag) level.airsupply=0; // Legacy doesn't to water damage so we need to check if it has to be disabled here.
|
||||
|
||||
FFsOptions *opt = level.info->GetOptData<FFsOptions>("fragglescript", false);
|
||||
if (opt != NULL)
|
||||
{
|
||||
DFraggleThinker::ActiveThinker->nocheckposition = opt->nocheckposition;
|
||||
DFraggleThinker::ActiveThinker->setcolormaterial = opt->setcolormaterial;
|
||||
}
|
||||
else
|
||||
{
|
||||
DFraggleThinker::ActiveThinker->nocheckposition = false;
|
||||
DFraggleThinker::ActiveThinker->setcolormaterial = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -394,7 +394,6 @@ DFraggleThinker::DFraggleThinker()
|
|||
LevelScript->parent = global_script;
|
||||
GC::WriteBarrier(this, RunningScripts);
|
||||
GC::WriteBarrier(this, LevelScript);
|
||||
nocheckposition = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,8 +434,7 @@ void DFraggleThinker::Serialize(FSerializer &arc)
|
|||
Super::Serialize(arc);
|
||||
arc("levelscript", LevelScript)
|
||||
("runningscripts", RunningScripts)
|
||||
("spawnedthings", SpawnedThings)
|
||||
("nocheckposition", nocheckposition);
|
||||
("spawnedthings", SpawnedThings);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -681,8 +681,6 @@ public:
|
|||
TObjPtr<DFsScript*> LevelScript;
|
||||
TObjPtr<DRunningScript*> RunningScripts;
|
||||
TArray<TObjPtr<AActor*> > SpawnedThings;
|
||||
bool nocheckposition = false;
|
||||
bool setcolormaterial = false;
|
||||
|
||||
DFraggleThinker();
|
||||
void OnDestroy() override;
|
||||
|
|
|
@ -263,25 +263,6 @@ class DScroller;
|
|||
class FScanner;
|
||||
struct level_info_t;
|
||||
|
||||
struct FOptionalMapinfoData
|
||||
{
|
||||
FOptionalMapinfoData *Next = nullptr;
|
||||
FName identifier = NAME_None;
|
||||
virtual ~FOptionalMapinfoData() {}
|
||||
virtual FOptionalMapinfoData *Clone() const = 0;
|
||||
};
|
||||
|
||||
struct FOptionalMapinfoDataPtr
|
||||
{
|
||||
FOptionalMapinfoData *Ptr;
|
||||
|
||||
FOptionalMapinfoDataPtr() throw() : Ptr(NULL) {}
|
||||
~FOptionalMapinfoDataPtr() { if (Ptr!=NULL) delete Ptr; }
|
||||
FOptionalMapinfoDataPtr(const FOptionalMapinfoDataPtr &p) throw() : Ptr(p.Ptr->Clone()) {}
|
||||
FOptionalMapinfoDataPtr &operator= (FOptionalMapinfoDataPtr &p) throw() { Ptr = p.Ptr->Clone(); return *this; }
|
||||
};
|
||||
|
||||
typedef TMap<FName, FOptionalMapinfoDataPtr> FOptData;
|
||||
typedef TMap<int, FName> FMusicMap;
|
||||
|
||||
enum EMapType : int
|
||||
|
@ -398,7 +379,6 @@ struct level_info_t
|
|||
|
||||
double teamdamage;
|
||||
|
||||
FOptData optdata;
|
||||
FMusicMap MusicMap;
|
||||
|
||||
TArray<FSpecialAction> specialactions;
|
||||
|
@ -416,6 +396,10 @@ struct level_info_t
|
|||
FVector3 skyrotatevector;
|
||||
FVector3 skyrotatevector2;
|
||||
|
||||
FString EDName;
|
||||
FString acsName;
|
||||
bool fs_nocheckposition;
|
||||
|
||||
|
||||
level_info_t()
|
||||
{
|
||||
|
@ -434,24 +418,6 @@ struct level_info_t
|
|||
deferred.Clear();
|
||||
}
|
||||
level_info_t *CheckLevelRedirect ();
|
||||
|
||||
template<class T>
|
||||
T *GetOptData(FName id, bool create = true)
|
||||
{
|
||||
FOptionalMapinfoDataPtr *pdat = optdata.CheckKey(id);
|
||||
|
||||
if (pdat != NULL)
|
||||
{
|
||||
return static_cast<T*>(pdat->Ptr);
|
||||
}
|
||||
else if (create)
|
||||
{
|
||||
T *newobj = new T;
|
||||
optdata[id].Ptr = newobj;
|
||||
return newobj;
|
||||
}
|
||||
else return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1445,6 +1445,34 @@ DEFINE_MAP_OPTION(skyrotate2, false)
|
|||
info->skyrotatevector2.MakeUnit();
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(fs_nocheckposition, false)
|
||||
{
|
||||
if (parse.CheckAssign())
|
||||
{
|
||||
parse.sc.MustGetNumber();
|
||||
info->fs_nocheckposition = !!parse.sc.Number;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->fs_nocheckposition = true;
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(edata, false)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetString();
|
||||
info->EDName = parse.sc.String;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(loadacs, false)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetString();
|
||||
info->acsName = parse.sc.String;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// All flag based map options
|
||||
|
|
|
@ -50,42 +50,6 @@
|
|||
#include "maploader.h"
|
||||
|
||||
|
||||
struct FEDOptions : public FOptionalMapinfoData
|
||||
{
|
||||
FEDOptions()
|
||||
{
|
||||
identifier = "EData";
|
||||
}
|
||||
virtual FOptionalMapinfoData *Clone() const
|
||||
{
|
||||
FEDOptions *newopt = new FEDOptions;
|
||||
newopt->identifier = identifier;
|
||||
newopt->EDName = EDName;
|
||||
newopt->acsName = acsName;
|
||||
return newopt;
|
||||
}
|
||||
FString EDName;
|
||||
FString acsName;
|
||||
};
|
||||
|
||||
DEFINE_MAP_OPTION(edata, false)
|
||||
{
|
||||
FEDOptions *opt = info->GetOptData<FEDOptions>("EData");
|
||||
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetString();
|
||||
opt->EDName = parse.sc.String;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(loadacs, false)
|
||||
{
|
||||
FEDOptions *opt = info->GetOptData<FEDOptions>("EData");
|
||||
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetString();
|
||||
opt->acsName = parse.sc.String;
|
||||
}
|
||||
|
||||
static void parseLinedef(FScanner &sc, TMap<int, EDLinedef> &EDLines)
|
||||
{
|
||||
EDLinedef ld;
|
||||
|
@ -552,21 +516,9 @@ static void parseMapthing(FScanner &sc, TMap<int, EDMapthing> &EDThings)
|
|||
|
||||
void MapLoader::InitED()
|
||||
{
|
||||
FString filename;
|
||||
FString filename = Level->info->EDName;
|
||||
FScanner sc;
|
||||
|
||||
const char *arg = Args->CheckValue("-edf");
|
||||
|
||||
if (arg != nullptr) filename = arg;
|
||||
else
|
||||
{
|
||||
FEDOptions *opt = Level->info->GetOptData<FEDOptions>("EData", false);
|
||||
if (opt != nullptr)
|
||||
{
|
||||
filename = opt->EDName;
|
||||
}
|
||||
}
|
||||
|
||||
if (filename.IsEmpty()) return;
|
||||
int lump = Wads.CheckNumForFullName(filename, true, ns_global);
|
||||
if (lump == -1) return;
|
||||
|
@ -705,10 +657,9 @@ void MapLoader::ProcessEDSectors()
|
|||
|
||||
void MapLoader::LoadMapinfoACSLump()
|
||||
{
|
||||
FEDOptions *opt = Level->info->GetOptData<FEDOptions>("EData", false);
|
||||
if (opt != nullptr)
|
||||
if (Level->info->acsName.IsNotEmpty())
|
||||
{
|
||||
int lump = Wads.CheckNumForName(opt->acsName);
|
||||
int lump = Wads.CheckNumForName(Level->info->acsName);
|
||||
if (lump >= 0) FBehavior::StaticLoadModule(lump);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue