mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- Added levelname to drawstring.
SVN r2292 (trunk)
This commit is contained in:
parent
178587fff2
commit
d719671579
1 changed files with 42 additions and 3 deletions
|
@ -514,7 +514,8 @@ class CommandDrawString : public SBarInfoCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CommandDrawString(SBarInfo *script) : SBarInfoCommand(script),
|
CommandDrawString(SBarInfo *script) : SBarInfoCommand(script),
|
||||||
shadow(false), spacing(0), font(NULL), translation(CR_UNTRANSLATED)
|
shadow(false), spacing(0), font(NULL), translation(CR_UNTRANSLATED),
|
||||||
|
value(CONSTANT), valueArg(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,8 +532,22 @@ class CommandDrawString : public SBarInfoCommand
|
||||||
sc.MustGetToken(',');
|
sc.MustGetToken(',');
|
||||||
translation = GetTranslation(sc);
|
translation = GetTranslation(sc);
|
||||||
sc.MustGetToken(',');
|
sc.MustGetToken(',');
|
||||||
sc.MustGetToken(TK_StringConst);
|
if(sc.CheckToken(TK_Identifier))
|
||||||
str = sc.String;
|
{
|
||||||
|
if(sc.Compare("levelname"))
|
||||||
|
{
|
||||||
|
value = LEVELNAME;
|
||||||
|
valueArg = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sc.ScriptError("Unknown string '%s'.", sc.String);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = CONSTANT;
|
||||||
|
sc.MustGetToken(TK_StringConst);
|
||||||
|
str = sc.String;
|
||||||
|
}
|
||||||
sc.MustGetToken(',');
|
sc.MustGetToken(',');
|
||||||
GetCoordinates(sc, fullScreenOffsets, x, y);
|
GetCoordinates(sc, fullScreenOffsets, x, y);
|
||||||
if(sc.CheckToken(',')) //spacing
|
if(sc.CheckToken(',')) //spacing
|
||||||
|
@ -547,13 +562,37 @@ class CommandDrawString : public SBarInfoCommand
|
||||||
else //monospaced, so just multiplay the character size
|
else //monospaced, so just multiplay the character size
|
||||||
x -= static_cast<int> ((font->GetCharWidth((int) script->spacingCharacter) + spacing) * str.Len());
|
x -= static_cast<int> ((font->GetCharWidth((int) script->spacingCharacter) + spacing) * str.Len());
|
||||||
}
|
}
|
||||||
|
void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged)
|
||||||
|
{
|
||||||
|
switch(value)
|
||||||
|
{
|
||||||
|
case LEVELNAME:
|
||||||
|
if(level.lumpnum != valueArg)
|
||||||
|
{
|
||||||
|
valueArg = level.lumpnum;
|
||||||
|
str = level.LevelName;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
|
enum ValueType
|
||||||
|
{
|
||||||
|
LEVELNAME,
|
||||||
|
|
||||||
|
CONSTANT
|
||||||
|
};
|
||||||
|
|
||||||
bool shadow;
|
bool shadow;
|
||||||
int spacing;
|
int spacing;
|
||||||
FFont *font;
|
FFont *font;
|
||||||
EColorRange translation;
|
EColorRange translation;
|
||||||
SBarInfoCoordinate x;
|
SBarInfoCoordinate x;
|
||||||
SBarInfoCoordinate y;
|
SBarInfoCoordinate y;
|
||||||
|
ValueType value;
|
||||||
|
int valueArg;
|
||||||
FString str;
|
FString str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue