May 18, 2008 (SBarInfo Update #20)

- Added: hasweaponpiece command to check for custom weapon pieces.
- Added: usessecondaryammo command to check if the current weapon has a second
  ammo type.
- Most of SBarInfo's mugshot scripting can be used with the default Doom status
  bar.
- Fixed: By default drawmugshot would never come out of normal god mode state.
  In addition the state change to and from god mode was not quite as responsive
  as the original code.

SVN r980 (trunk)
This commit is contained in:
Christoph Oelckers 2008-05-18 15:48:03 +00:00
commit 35ea94c014
10 changed files with 338 additions and 329 deletions

View file

@ -95,6 +95,8 @@ static const char *SBarInfoRoutineLevel[] =
"playerclass",
"aspectratio",
"isselected",
"usessecondaryammo",
"hasweaponpiece",
"weaponammo", //event
"ininventory",
NULL
@ -140,7 +142,7 @@ void SBarInfo::ParseSBarInfo(int lump)
{
sc.MustGetToken(TK_StringConst);
int lump = Wads.CheckNumForFullName(sc.String, true);
if (lump == -1)
if (lump == -1)
sc.ScriptError("Lump '%s' not found", sc.String);
ParseSBarInfo(lump);
continue;
@ -229,7 +231,7 @@ void SBarInfo::ParseSBarInfo(int lump)
spacingCharacter = '\0';
sc.MustGetToken(',');
sc.MustGetToken(TK_StringConst); //Don't tell anyone we're just ignoring this ;)
}
}
sc.MustGetToken(';');
break;
case SBARINFO_LOWERHEALTHCAP:
@ -705,7 +707,11 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
{
cmd.special = GAME_Heretic;
}
if(sc.Compare("Doom") || sc.Compare("Heretic"))
else if(sc.Compare("Hexen"))
{
cmd.special = GAME_Hexen;
}
if(sc.Compare("Doom") || sc.Compare("Heretic") || sc.Compare("Hexen"))
{
sc.MustGetToken(',');
while(sc.CheckToken(TK_Identifier))
@ -1053,6 +1059,33 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.MustGetToken('{');
this->ParseSBarInfoBlock(sc, cmd.subBlock);
break;
case SBARINFO_USESSECONDARYAMMO:
if(sc.CheckToken(TK_Identifier))
{
if(sc.Compare("not"))
cmd.flags += SBARINFOEVENT_NOT;
else
sc.ScriptError("Exspected 'not' got '%s' instead.", sc.String);
}
sc.MustGetToken('{');
this->ParseSBarInfoBlock(sc, cmd.subBlock);
break;
case SBARINFO_HASWEAPONPIECE:
{
sc.MustGetToken(TK_Identifier);
const PClass* weapon = PClass::FindClass(sc.String);
if(weapon == NULL || !RUNTIME_CLASS(AWeapon)->IsAncestorOf(weapon)) //must be a weapon
sc.ScriptError("%s is not a kind of weapon.", sc.String);
cmd.setString(sc, sc.String, 0);
sc.MustGetToken(',');
sc.MustGetToken(TK_IntConst);
if(sc.Number < 1)
sc.ScriptError("Weapon piece number can not be less than 1.");
cmd.value = sc.Number;
sc.MustGetToken('{');
this->ParseSBarInfoBlock(sc, cmd.subBlock);
break;
}
case SBARINFO_WEAPONAMMO:
sc.MustGetToken(TK_Identifier);
if(sc.Compare("not"))