mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 05:31:00 +00:00
- Fixed: Allow string constants in SBarInfo whenever an actor name is required. The only exception is drawing the inventory icon with drawimage since it would be ambiguous, so I would advise using valid identifiers for class names even if it isn't required. Parenthesized syntax is required to use this feature where applicable.
SVN r3677 (trunk)
This commit is contained in:
parent
ab737220f0
commit
9b7e44c026
1 changed files with 170 additions and 144 deletions
|
@ -315,7 +315,10 @@ class CommandDrawSwitchableImage : public CommandDrawImage
|
|||
}
|
||||
void Parse(FScanner &sc, bool fullScreenOffsets)
|
||||
{
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
if(sc.TokenType == TK_Identifier)
|
||||
{
|
||||
if(sc.Compare("weaponslot"))
|
||||
{
|
||||
condition = WEAPONSLOT;
|
||||
|
@ -339,7 +342,8 @@ class CommandDrawSwitchableImage : public CommandDrawImage
|
|||
armorType[0] = FName(sc.String).GetIndex();
|
||||
GetOperation(sc, conditionalOperator[0], conditionalValue[0]);
|
||||
}
|
||||
else
|
||||
}
|
||||
if(condition == INVENTORY)
|
||||
{
|
||||
inventoryItem[0] = sc.String;
|
||||
const PClass* item = PClass::FindClass(sc.String);
|
||||
|
@ -905,7 +909,11 @@ class CommandDrawNumber : public CommandDrawString
|
|||
}
|
||||
else
|
||||
{
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
value = INVENTORY;
|
||||
if(sc.TokenType == TK_Identifier)
|
||||
{
|
||||
if(sc.Compare("health"))
|
||||
value = HEALTH;
|
||||
else if(sc.Compare("armor"))
|
||||
|
@ -925,6 +933,7 @@ class CommandDrawNumber : public CommandDrawString
|
|||
bool parenthesized = sc.CheckToken('(');
|
||||
|
||||
value = AMMO;
|
||||
if(!parenthesized || !sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
inventoryItem = PClass::FindClass(sc.String);
|
||||
if(inventoryItem == NULL || !RUNTIME_CLASS(AAmmo)->IsAncestorOf(inventoryItem)) //must be a kind of ammo
|
||||
|
@ -940,6 +949,7 @@ class CommandDrawNumber : public CommandDrawString
|
|||
bool parenthesized = sc.CheckToken('(');
|
||||
|
||||
value = AMMOCAPACITY;
|
||||
if(!parenthesized || !sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
inventoryItem = PClass::FindClass(sc.String);
|
||||
if(inventoryItem == NULL || !RUNTIME_CLASS(AAmmo)->IsAncestorOf(inventoryItem)) //must be a kind of ammo
|
||||
|
@ -1005,6 +1015,7 @@ class CommandDrawNumber : public CommandDrawString
|
|||
bool parenthesized = sc.CheckToken('(');
|
||||
|
||||
value = POWERUPTIME;
|
||||
if(!parenthesized || !sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
inventoryItem = PClass::FindClass(sc.String);
|
||||
if(inventoryItem == NULL || !RUNTIME_CLASS(APowerupGiver)->IsAncestorOf(inventoryItem))
|
||||
|
@ -1015,9 +1026,9 @@ class CommandDrawNumber : public CommandDrawString
|
|||
|
||||
if(parenthesized) sc.MustGetToken(')');
|
||||
}
|
||||
else
|
||||
}
|
||||
if(value == INVENTORY)
|
||||
{
|
||||
value = INVENTORY;
|
||||
inventoryItem = PClass::FindClass(sc.String);
|
||||
if(inventoryItem == NULL || !RUNTIME_CLASS(AInventory)->IsAncestorOf(inventoryItem)) //must be a kind of ammo
|
||||
{
|
||||
|
@ -2369,6 +2380,7 @@ class CommandDrawBar : public SBarInfoCommand
|
|||
{
|
||||
bool parenthesized = sc.CheckToken('(');
|
||||
|
||||
if(!parenthesized || !sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
type = AMMO;
|
||||
data.inventoryItem = PClass::FindClass(sc.String);
|
||||
|
@ -2394,7 +2406,10 @@ class CommandDrawBar : public SBarInfoCommand
|
|||
type = SAVEPERCENT;
|
||||
else if(sc.Compare("poweruptime"))
|
||||
{
|
||||
bool parenthesized = sc.CheckToken('(');
|
||||
|
||||
type = POWERUPTIME;
|
||||
if(!parenthesized || !sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
data.inventoryItem = PClass::FindClass(sc.String);
|
||||
if(data.inventoryItem == NULL || !RUNTIME_CLASS(APowerupGiver)->IsAncestorOf(data.inventoryItem))
|
||||
|
@ -2402,6 +2417,8 @@ class CommandDrawBar : public SBarInfoCommand
|
|||
sc.ScriptMessage("'%s' is not a type of PowerupGiver.", sc.String);
|
||||
data.inventoryItem = RUNTIME_CLASS(APowerupGiver);
|
||||
}
|
||||
|
||||
if(parenthesized) sc.MustGetToken(')');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2619,7 +2636,7 @@ class CommandDrawBar : public SBarInfoCommand
|
|||
{
|
||||
bool extendedSyntax = sc.CheckToken('(');
|
||||
|
||||
if(sc.CheckToken(TK_Identifier)) //comparing reference
|
||||
if(sc.CheckToken(TK_Identifier) || (extendedSyntax && sc.CheckToken(TK_StringConst))) //comparing reference
|
||||
{
|
||||
data.inventoryItem = PClass::FindClass(sc.String);
|
||||
if(data.inventoryItem == NULL || !RUNTIME_CLASS(AInventory)->IsAncestorOf(data.inventoryItem)) //must be a kind of inventory
|
||||
|
@ -2700,7 +2717,6 @@ class CommandIsSelected : public SBarInfoCommandFlowControl
|
|||
|
||||
void Parse(FScanner &sc, bool fullScreenOffsets)
|
||||
{
|
||||
//Using StringConst instead of Identifieres is deperecated!
|
||||
if(sc.CheckToken(TK_Identifier))
|
||||
{
|
||||
if(sc.Compare("not"))
|
||||
|
@ -2817,6 +2833,7 @@ class CommandPlayerType : public SBarInfoCommandFlowControl
|
|||
|
||||
void Parse(FScanner &sc, bool fullScreenOffsets)
|
||||
{
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
do
|
||||
{
|
||||
|
@ -2834,7 +2851,7 @@ class CommandPlayerType : public SBarInfoCommandFlowControl
|
|||
if(!sc.CheckToken(','))
|
||||
break;
|
||||
}
|
||||
while(sc.CheckToken(TK_Identifier));
|
||||
while(sc.CheckToken(TK_Identifier) || sc.CheckToken(TK_StringConst));
|
||||
SBarInfoCommandFlowControl::Parse(sc, fullScreenOffsets);
|
||||
}
|
||||
void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged)
|
||||
|
@ -2870,6 +2887,7 @@ class CommandHasWeaponPiece : public SBarInfoCommandFlowControl
|
|||
|
||||
void Parse(FScanner &sc, bool fullScreenOffsets)
|
||||
{
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
weapon = PClass::FindClass(sc.String);
|
||||
if(weapon == NULL || !RUNTIME_CLASS(AWeapon)->IsAncestorOf(weapon)) //must be a weapon
|
||||
|
@ -3055,10 +3073,12 @@ class CommandWeaponAmmo : public SBarInfoCommandFlowControl
|
|||
|
||||
void Parse(FScanner &sc, bool fullScreenOffsets)
|
||||
{
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
if(sc.Compare("not"))
|
||||
if(sc.Compare("not") && sc.TokenType == TK_Identifier)
|
||||
{
|
||||
negate = true;
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
}
|
||||
for(int i = 0;i < 2;i++)
|
||||
|
@ -3073,11 +3093,13 @@ class CommandWeaponAmmo : public SBarInfoCommandFlowControl
|
|||
if(sc.CheckToken(TK_OrOr))
|
||||
{
|
||||
conditionAnd = false;
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
}
|
||||
else if(sc.CheckToken(TK_AndAnd))
|
||||
{
|
||||
conditionAnd = true;
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
}
|
||||
else
|
||||
|
@ -3158,10 +3180,12 @@ class CommandInInventory : public SBarInfoCommandFlowControl
|
|||
|
||||
void Parse(FScanner &sc, bool fullScreenOffsets)
|
||||
{
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
if(sc.Compare("not"))
|
||||
if(sc.Compare("not") && sc.TokenType == TK_Identifier)
|
||||
{
|
||||
negate = true;
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
}
|
||||
for(int i = 0;i < 2;i++)
|
||||
|
@ -3182,11 +3206,13 @@ class CommandInInventory : public SBarInfoCommandFlowControl
|
|||
if(sc.CheckToken(TK_OrOr))
|
||||
{
|
||||
conditionAnd = false;
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
}
|
||||
else if(sc.CheckToken(TK_AndAnd))
|
||||
{
|
||||
conditionAnd = true;
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue