- converted the rest of actors/shared.

- moved damagetype definitions to MAPINFO. These were in DECORATE which is not correct. The old code is left for compatibility.
This commit is contained in:
Christoph Oelckers 2016-10-14 10:46:15 +02:00
commit 9e2830a3db
44 changed files with 1042 additions and 794 deletions

View file

@ -110,6 +110,7 @@ struct FMapInfoParser
void ParseAMColors(bool);
FName CheckEndSequence();
FName ParseEndGame();
void ParseDamageDefinition();
};
#define DEFINE_MAP_OPTION(name, old) \

View file

@ -1873,6 +1873,18 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i
sc.ScriptError("doomednums definitions not supported with old MAPINFO syntax");
}
}
else if (sc.Compare("damagetype"))
{
if (format_type != FMT_Old)
{
format_type = FMT_New;
ParseDamageDefinition();
}
else
{
sc.ScriptError("damagetype definitions not supported with old MAPINFO syntax");
}
}
else if (sc.Compare("spawnnums"))
{
if (format_type != FMT_Old)

View file

@ -817,3 +817,43 @@ int DamageTypeDefinition::ApplyMobjDamageFactor(int damage, FName type, DmgFacto
double factor = GetMobjDamageFactor(type, factors);
return int(damage * factor);
}
//==========================================================================
//
// Reads a damage definition
//
//==========================================================================
void FMapInfoParser::ParseDamageDefinition()
{
sc.MustGetString();
FName damageType = sc.String;
DamageTypeDefinition dtd;
ParseOpenBrace();
while (sc.MustGetAnyToken(), sc.TokenType != '}')
{
if (sc.Compare("FACTOR"))
{
sc.MustGetStringName("=");
sc.MustGetFloat();
dtd.DefaultFactor = sc.Float;
if (dtd.DefaultFactor == 0) dtd.ReplaceFactor = true;
}
else if (sc.Compare("REPLACEFACTOR"))
{
dtd.ReplaceFactor = true;
}
else if (sc.Compare("NOARMOR"))
{
dtd.NoArmor = true;
}
else
{
sc.ScriptError("Unexpected data (%s) in damagetype definition.", sc.String);
}
}
dtd.Apply(damageType);
}

View file

@ -433,6 +433,11 @@ FStateLabels *FStateDefinitions::CreateStateLabelList(TArray<FStateDefine> & sta
void FStateDefinitions::InstallStates(PClassActor *info, AActor *defaults)
{
if (defaults == nullptr)
{
I_Error("Called InstallStates without actor defaults in %s", info->TypeName.GetChars());
}
// First ensure we have a valid spawn state.
FState *state = FindState("Spawn");