- Allow any parameterized SBarInfo value to use parentheses to help make the syntax a little more consistent.

SVN r3361 (trunk)
This commit is contained in:
Braden Obrzut 2012-02-16 05:01:17 +00:00
parent 25b73ac023
commit da974c3444
3 changed files with 57 additions and 20 deletions

View file

@ -65,6 +65,7 @@ class CommandDrawImage : public SBarInfoCommand
}
void Parse(FScanner &sc, bool fullScreenOffsets)
{
bool parenthesized = false;
bool getImage = true;
if(sc.CheckToken(TK_Identifier))
{
@ -83,6 +84,8 @@ class CommandDrawImage : public SBarInfoCommand
type = SIGIL;
else if(sc.Compare("hexenarmor"))
{
parenthesized = sc.CheckToken('(');
sc.MustGetToken(TK_Identifier);
if(sc.Compare("armor"))
type = HEXENARMOR_ARMOR;
@ -125,6 +128,8 @@ class CommandDrawImage : public SBarInfoCommand
sc.MustGetToken(TK_StringConst);
image = script->newImage(sc.String);
sprite.SetInvalid();
if(parenthesized) sc.MustGetToken(')');
}
sc.MustGetToken(',');
GetCoordinates(sc, fullScreenOffsets, imgx, imgy);
@ -636,19 +641,27 @@ class CommandDrawString : public SBarInfoCommand
strValue = LOGTEXT;
else if(sc.Compare("globalvar"))
{
bool parenthesized = sc.CheckToken('(');
strValue = GLOBALVAR;
sc.MustGetToken(TK_IntConst);
if(sc.Number < 0 || sc.Number >= NUM_GLOBALVARS)
sc.ScriptError("Global variable number out of range: %d", sc.Number);
valueArgument = sc.Number;
if(parenthesized) sc.MustGetToken(')');
}
else if(sc.Compare("globalarray"))
{
bool parenthesized = sc.CheckToken('(');
strValue = GLOBALARRAY;
sc.MustGetToken(TK_IntConst);
if(sc.Number < 0 || sc.Number >= NUM_GLOBALVARS)
sc.ScriptError("Global variable number out of range: %d", sc.Number);
valueArgument = sc.Number;
if(parenthesized) sc.MustGetToken(')');
}
else
sc.ScriptError("Unknown string '%s'.", sc.String);
@ -899,6 +912,8 @@ class CommandDrawNumber : public CommandDrawString
value = SCORE;
else if(sc.Compare("ammo")) //request the next string to be an ammo type
{
bool parenthesized = sc.CheckToken('(');
value = AMMO;
sc.MustGetToken(TK_Identifier);
inventoryItem = PClass::FindClass(sc.String);
@ -907,9 +922,13 @@ class CommandDrawNumber : public CommandDrawString
sc.ScriptMessage("'%s' is not a type of ammo.", sc.String);
inventoryItem = RUNTIME_CLASS(AAmmo);
}
if(parenthesized) sc.MustGetToken(')');
}
else if(sc.Compare("ammocapacity"))
{
bool parenthesized = sc.CheckToken('(');
value = AMMOCAPACITY;
sc.MustGetToken(TK_Identifier);
inventoryItem = PClass::FindClass(sc.String);
@ -918,6 +937,8 @@ class CommandDrawNumber : public CommandDrawString
sc.ScriptMessage("'%s' is not a type of ammo.", sc.String);
inventoryItem = RUNTIME_CLASS(AAmmo);
}
if(parenthesized) sc.MustGetToken(')');
}
else if(sc.Compare("frags"))
value = FRAGS;
@ -947,22 +968,32 @@ class CommandDrawNumber : public CommandDrawString
value = KEYS;
else if(sc.Compare("globalvar"))
{
bool parenthesized = sc.CheckToken('(');
value = GLOBALVAR;
sc.MustGetToken(TK_IntConst);
if(sc.Number < 0 || sc.Number >= NUM_GLOBALVARS)
sc.ScriptError("Global variable number out of range: %d", sc.Number);
valueArgument = sc.Number;
if(parenthesized) sc.MustGetToken(')');
}
else if(sc.Compare("globalarray")) //acts like variable[playernumber()]
{
bool parenthesized = sc.CheckToken('(');
value = GLOBALARRAY;
sc.MustGetToken(TK_IntConst);
if(sc.Number < 0 || sc.Number >= NUM_GLOBALVARS)
sc.ScriptError("Global variable number out of range: %d", sc.Number);
valueArgument = sc.Number;
if(parenthesized) sc.MustGetToken(')');
}
else if(sc.Compare("poweruptime"))
{
bool parenthesized = sc.CheckToken('(');
value = POWERUPTIME;
sc.MustGetToken(TK_Identifier);
inventoryItem = PClass::FindClass(sc.String);
@ -971,6 +1002,8 @@ class CommandDrawNumber : public CommandDrawString
sc.ScriptMessage("'%s' is not a type of PowerupGiver.", sc.String);
inventoryItem = RUNTIME_CLASS(APowerupGiver);
}
if(parenthesized) sc.MustGetToken(')');
}
else
{
@ -2310,6 +2343,8 @@ class CommandDrawBar : public SBarInfoCommand
type = AMMO2;
else if(sc.Compare("ammo")) //request the next string to be an ammo type
{
bool parenthesized = sc.CheckToken('(');
sc.MustGetToken(TK_Identifier);
type = AMMO;
data.inventoryItem = PClass::FindClass(sc.String);
@ -2318,6 +2353,8 @@ class CommandDrawBar : public SBarInfoCommand
sc.ScriptMessage("'%s' is not a type of ammo.", sc.String);
data.inventoryItem = RUNTIME_CLASS(AAmmo);
}
if(parenthesized) sc.MustGetToken(')');
}
else if(sc.Compare("frags"))
type = FRAGS;

View file

@ -79,15 +79,15 @@ statusbar normal // Standard Doom Status bar
drawswitchableimage keyslot 3 && 6, "nullimage", "STKEYS1", "STKEYS4", "STKEYS7", 239, 181;
drawswitchableimage keyslot 1 && 4, "nullimage", "STKEYS2", "STKEYS5", "STKEYS8", 239, 191;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo Clip, 288, 173;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo Shell, 288, 179;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo RocketAmmo, 288, 185;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo Cell, 288, 191;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo(Clip), 288, 173;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo(Shell), 288, 179;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo(RocketAmmo), 288, 185;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo(Cell), 288, 191;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity Clip, 314, 173;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity Shell, 314, 179;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity RocketAmmo, 314, 185;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity Cell, 314, 191;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity(Clip), 314, 173;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity(Shell), 314, 179;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity(RocketAmmo), 314, 185;
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity(Cell), 314, 191;
gamemode deathmatch, teamgame
{
drawnumber 2, HUDFONT_DOOM, untranslated, frags, 138, 171;

View file

@ -44,8 +44,8 @@ statusbar fullscreen, fullscreenoffsets
drawimage "MANABRT2", -17, -15;
else
drawimage "MANADIM2", -17, -15;
drawnumber 2147483647, HUDFONT_RAVEN, untranslated, ammo Mana1, drawshadow(1, 1), -21, -30, 1;
drawnumber 2147483647, HUDFONT_RAVEN, untranslated, ammo Mana2, drawshadow(1, 1), -21, -15, 1;
drawnumber 2147483647, HUDFONT_RAVEN, untranslated, ammo(Mana1), drawshadow(1, 1), -21, -30, 1;
drawnumber 2147483647, HUDFONT_RAVEN, untranslated, ammo(Mana2), drawshadow(1, 1), -21, -15, 1;
}
}
@ -73,25 +73,25 @@ statusbar Normal
weaponammo Mana1
{
drawimage "MANABRT1", 77, 164;
drawbar "MANAVL1", "nullimage", ammo Mana1, vertical, 94, 164, 1;
drawbar "MANAVL1", "nullimage", ammo(Mana1), vertical, 94, 164, 1;
}
else
{
drawimage "MANADIM1", 77, 164;
drawbar "MANAVL1D", "nullimage", ammo Mana1, vertical, 94, 164, 1;
drawbar "MANAVL1D", "nullimage", ammo(Mana1), vertical, 94, 164, 1;
}
weaponammo Mana2
{
drawimage "MANABRT2", 110, 164;
drawbar "MANAVL2", "nullimage", ammo Mana2, vertical, 102, 164, 1;
drawbar "MANAVL2", "nullimage", ammo(Mana2), vertical, 102, 164, 1;
}
else
{
drawimage "MANADIM2", 110, 164;
drawbar "MANAVL2D", "nullimage", ammo Mana2, vertical, 102, 164, 1;
drawbar "MANAVL2D", "nullimage", ammo(Mana2), vertical, 102, 164, 1;
}
drawnumber 3, INDEXFONT_RAVEN, untranslated, ammo Mana1, 91, 181;
drawnumber 3, INDEXFONT_RAVEN, untranslated, ammo Mana2, 123, 181;
drawnumber 3, INDEXFONT_RAVEN, untranslated, ammo(Mana1), 91, 181;
drawnumber 3, INDEXFONT_RAVEN, untranslated, ammo(Mana2), 123, 181;
}
else //Weapon doesn't use ammo draw an alternative
{
@ -207,10 +207,10 @@ statusbar Automap
drawimage "H2BAR", 0, 135;
drawimage "KEYBAR", 38, 162;
drawkeybar 5, horizontal, 20, 46, 164;
drawimage hexenarmor armor, "ARMSLOT1", 150, 164;
drawimage hexenarmor shield, "ARMSLOT2", 181, 164;
drawimage hexenarmor helm, "ARMSLOT3", 212, 164;
drawimage hexenarmor amulet, "ARMSLOT4", 243, 164;
drawimage hexenarmor(armor, "ARMSLOT1"), 150, 164;
drawimage hexenarmor(shield, "ARMSLOT2"), 181, 164;
drawimage hexenarmor(helm, "ARMSLOT3"), 212, 164;
drawimage hexenarmor(amulet, "ARMSLOT4"), 243, 164;
// Also draw the life gem here
playertype FighterPlayer