mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- added spawn number parser to .DEF.
This is for mapping actor classes to whatever the games use to decide what kind of actor a sprite is.
This commit is contained in:
parent
d9fee902de
commit
cbd8de36a9
2 changed files with 51 additions and 0 deletions
|
@ -2226,6 +2226,39 @@ static void parseDefineQAV(FScanner& sc, FScriptPosition& pos)
|
|||
fileSystem.CreatePathlessCopy(fn, res_id, 0);
|
||||
}
|
||||
|
||||
static void parseSpawnClasses(FScanner& sc, FScriptPosition& pos)
|
||||
{
|
||||
FString fn;
|
||||
int res_id = -1;
|
||||
int numframes = -1;
|
||||
bool interpolate = false;
|
||||
|
||||
sc.SetCMode(true);
|
||||
if (!sc.CheckString("{"))
|
||||
{
|
||||
pos.Message(MSG_ERROR, "spawnclasses:'{' expected, unable to continue");
|
||||
sc.SetCMode(false);
|
||||
return;
|
||||
}
|
||||
while (!sc.CheckString("}"))
|
||||
{
|
||||
int num = -1;
|
||||
int base = -1;
|
||||
FName cname;
|
||||
sc.GetNumber(num, true);
|
||||
sc.MustGetStringName("=");
|
||||
sc.MustGetString();
|
||||
cname = sc.String;
|
||||
if (sc.CheckString(","))
|
||||
{
|
||||
sc.GetNumber(base, true);
|
||||
}
|
||||
|
||||
// todo: check for proper base class
|
||||
spawnMap.Insert(num, { cname, nullptr, base });
|
||||
}
|
||||
sc.SetCMode(false);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -2318,6 +2351,8 @@ static const dispatch basetokens[] =
|
|||
{ "newgamechoices", parseEmptyBlock },
|
||||
{ "rffdefineid", parseRffDefineId },
|
||||
{ "defineqav", parseDefineQAV },
|
||||
|
||||
{ "spawnclasses", parseSpawnClasses },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
|
|
|
@ -263,3 +263,19 @@ enum gameaction_t : int
|
|||
ga_fullconsole,
|
||||
};
|
||||
extern gameaction_t gameaction;
|
||||
|
||||
struct SpawnRec
|
||||
{
|
||||
FName clsname;
|
||||
PClass* cls;
|
||||
int param;
|
||||
|
||||
PClass* Class()
|
||||
{
|
||||
if (!cls && clsname != NAME_None) cls = PClass::FindClass(clsname);
|
||||
clsname = NAME_None;
|
||||
return cls;
|
||||
}
|
||||
};
|
||||
using SpawnMap = TMap<int, SpawnRec>;
|
||||
inline SpawnMap spawnMap;
|
||||
|
|
Loading…
Reference in a new issue