- added FDARI's Default/global damagetype properties submission.

SVN r3523 (trunk)
This commit is contained in:
Christoph Oelckers 2012-04-07 12:11:17 +00:00
commit 81eef71067
5 changed files with 161 additions and 14 deletions

View file

@ -1179,7 +1179,50 @@ static void ParseActor(FScanner &sc)
sc.SetCMode (false);
}
//==========================================================================
//
// Reads a damage definition
//
//==========================================================================
static void ParseDamageDefinition(FScanner &sc)
{
sc.SetCMode (true); // This may be 100% irrelevant for such a simple syntax, but I don't know
// Get DamageType
sc.MustGetString();
FName damageType = sc.String;
DamageTypeDefinition dtd;
sc.MustGetToken('{');
while (sc.MustGetAnyToken(), sc.TokenType != '}')
{
if (sc.Compare("FACTOR"))
{
sc.MustGetFloat();
dtd.DefaultFactor = (fixed_t)sc.Float;
if (!dtd.DefaultFactor) dtd.ReplaceFactor = true; // Multiply by 0 yields 0: FixedMul(damage, FixedMul(factor, 0)) is more wasteful than FixedMul(factor, 0)
}
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);
sc.SetCMode (false); // (set to true earlier in function)
}
//==========================================================================
//
@ -1263,6 +1306,11 @@ void ParseDecorate (FScanner &sc)
ParseOldDecoration (sc, DEF_Projectile);
break;
}
else if (sc.Compare("DAMAGETYPE"))
{
ParseDamageDefinition(sc);
break;
}
default:
sc.RestorePos(pos);
ParseOldDecoration(sc, DEF_Decoration);