mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- Fixed: If a log popup is defined, it should not draw the default log message.
- Fixed: The counters in draw(selected)inventory(bar) should not have been limited to 3 characters. - Added: drawshadow() to drawinventorybar. - Added: itemflash to drawselectedinventory to use Strife's cursor fade. - Added: time and logtext to drawstring. In addition a linebreaks(size) flag was added. SVN r2928 (trunk)
This commit is contained in:
parent
394a37421a
commit
45f3ef91d3
2 changed files with 85 additions and 8 deletions
|
@ -1080,6 +1080,11 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MustDrawLog (EHudState state)
|
||||||
|
{
|
||||||
|
return script->huds[STBAR_POPUPLOG]->NumCommands() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
void SetMugShotState (const char *state_name, bool wait_till_done, bool reset)
|
void SetMugShotState (const char *state_name, bool wait_till_done, bool reset)
|
||||||
{
|
{
|
||||||
script->MugShot.SetState(state_name, wait_till_done, reset);
|
script->MugShot.SetState(state_name, wait_till_done, reset);
|
||||||
|
|
|
@ -520,15 +520,25 @@ class CommandDrawString : public SBarInfoCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CommandDrawString(SBarInfo *script) : SBarInfoCommand(script),
|
CommandDrawString(SBarInfo *script) : SBarInfoCommand(script),
|
||||||
shadow(false), shadowX(2), shadowY(2), spacing(0), font(NULL),
|
lineBreaks(false), breakWidth(320), shadow(false), shadowX(2),
|
||||||
translation(CR_UNTRANSLATED), cache(-1), strValue(CONSTANT),
|
shadowY(2), spacing(0), font(NULL), translation(CR_UNTRANSLATED),
|
||||||
valueArgument(0), alignment (ALIGN_RIGHT)
|
cache(-1), strValue(CONSTANT), valueArgument(0), alignment(ALIGN_RIGHT)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar)
|
void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar)
|
||||||
{
|
{
|
||||||
statusBar->DrawString(font, str.GetChars(), x, y, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), translation, spacing, shadow, shadowX, shadowY);
|
if(lineBreaks)
|
||||||
|
{
|
||||||
|
FBrokenLines *lines = V_BreakLines(font, breakWidth, str.GetChars());
|
||||||
|
for(int i = 0;lines[i].Width >= 0;i++)
|
||||||
|
{
|
||||||
|
statusBar->DrawString(font, lines[i].Text, x, y+i*(font->GetHeight()+4), block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), translation, spacing, shadow, shadowX, shadowY);
|
||||||
|
}
|
||||||
|
V_FreeBrokenLines(lines);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
statusBar->DrawString(font, str.GetChars(), x, y, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), translation, spacing, shadow, shadowX, shadowY);
|
||||||
}
|
}
|
||||||
void Parse(FScanner &sc, bool fullScreenOffsets)
|
void Parse(FScanner &sc, bool fullScreenOffsets)
|
||||||
{
|
{
|
||||||
|
@ -562,6 +572,10 @@ class CommandDrawString : public SBarInfoCommand
|
||||||
strValue = WEAPONTAG;
|
strValue = WEAPONTAG;
|
||||||
else if(sc.Compare("inventorytag"))
|
else if(sc.Compare("inventorytag"))
|
||||||
strValue = INVENTORYTAG;
|
strValue = INVENTORYTAG;
|
||||||
|
else if(sc.Compare("time"))
|
||||||
|
strValue = TIME;
|
||||||
|
else if(sc.Compare("logtext"))
|
||||||
|
strValue = LOGTEXT;
|
||||||
else if(sc.Compare("globalvar"))
|
else if(sc.Compare("globalvar"))
|
||||||
{
|
{
|
||||||
strValue = GLOBALVAR;
|
strValue = GLOBALVAR;
|
||||||
|
@ -627,6 +641,14 @@ class CommandDrawString : public SBarInfoCommand
|
||||||
}
|
}
|
||||||
shadow = true;
|
shadow = true;
|
||||||
}
|
}
|
||||||
|
else if(sc.Compare("linebreaks"))
|
||||||
|
{
|
||||||
|
sc.MustGetToken('(');
|
||||||
|
sc.MustGetToken(TK_IntConst);
|
||||||
|
breakWidth = sc.Number;
|
||||||
|
sc.MustGetToken(')');
|
||||||
|
lineBreaks = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sc.ScriptError("Unknown flag '%s'.", sc.String);
|
sc.ScriptError("Unknown flag '%s'.", sc.String);
|
||||||
if(!sc.CheckToken('|') && !sc.CheckToken(',')) break;
|
if(!sc.CheckToken('|') && !sc.CheckToken(',')) break;
|
||||||
|
@ -722,6 +744,12 @@ class CommandDrawString : public SBarInfoCommand
|
||||||
RealignString();
|
RealignString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TIME:
|
||||||
|
str.Format("%02d:%02d:%02d", (level.time/TICRATE)/3600, ((level.time/TICRATE)%3600)/60, (level.time/TICRATE)%60);
|
||||||
|
break;
|
||||||
|
case LOGTEXT:
|
||||||
|
str = statusBar->CPlayer->LogText;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -769,10 +797,14 @@ class CommandDrawString : public SBarInfoCommand
|
||||||
INVENTORYTAG,
|
INVENTORYTAG,
|
||||||
GLOBALVAR,
|
GLOBALVAR,
|
||||||
GLOBALARRAY,
|
GLOBALARRAY,
|
||||||
|
TIME,
|
||||||
|
LOGTEXT,
|
||||||
|
|
||||||
CONSTANT
|
CONSTANT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool lineBreaks;
|
||||||
|
int breakWidth;
|
||||||
bool shadow;
|
bool shadow;
|
||||||
int shadowX;
|
int shadowX;
|
||||||
int shadowY;
|
int shadowY;
|
||||||
|
@ -1338,6 +1370,7 @@ class CommandDrawSelectedInventory : public SBarInfoCommandFlowControl, private
|
||||||
CommandDrawImage(script), CommandDrawNumber(script), alternateOnEmpty(false),
|
CommandDrawImage(script), CommandDrawNumber(script), alternateOnEmpty(false),
|
||||||
artiflash(false), alwaysShowCounter(false)
|
artiflash(false), alwaysShowCounter(false)
|
||||||
{
|
{
|
||||||
|
length = INT_MAX; // Counter size
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar)
|
void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar)
|
||||||
|
@ -1353,7 +1386,15 @@ class CommandDrawSelectedInventory : public SBarInfoCommandFlowControl, private
|
||||||
translatable, false, offset);
|
translatable, false, offset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if(itemflash && itemflashFade)
|
||||||
|
{
|
||||||
|
fixed_t flashAlpha = fixed_t(((double) block->Alpha() / (double) FRACUNIT) * ((double) itemflashFade / (double) OPAQUE) * FRACUNIT);
|
||||||
|
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgCURSOR], imgx-4, imgy+2, block->XOffset(), block->YOffset(), flashAlpha, block->FullScreenOffsets(),
|
||||||
|
translatable, false, offset);
|
||||||
|
}
|
||||||
CommandDrawImage::Draw(block, statusBar);
|
CommandDrawImage::Draw(block, statusBar);
|
||||||
|
}
|
||||||
if(alwaysShowCounter || statusBar->CPlayer->mo->InvSel->Amount != 1)
|
if(alwaysShowCounter || statusBar->CPlayer->mo->InvSel->Amount != 1)
|
||||||
CommandDrawNumber::Draw(block, statusBar);
|
CommandDrawNumber::Draw(block, statusBar);
|
||||||
}
|
}
|
||||||
|
@ -1371,6 +1412,8 @@ class CommandDrawSelectedInventory : public SBarInfoCommandFlowControl, private
|
||||||
artiflash = true;
|
artiflash = true;
|
||||||
else if(sc.Compare("alwaysshowcounter"))
|
else if(sc.Compare("alwaysshowcounter"))
|
||||||
alwaysShowCounter = true;
|
alwaysShowCounter = true;
|
||||||
|
else if(sc.Compare("itemflash"))
|
||||||
|
itemflash = true;
|
||||||
else if(sc.Compare("center"))
|
else if(sc.Compare("center"))
|
||||||
offset = CENTER;
|
offset = CENTER;
|
||||||
else if(sc.Compare("centerbottom"))
|
else if(sc.Compare("centerbottom"))
|
||||||
|
@ -1430,6 +1473,12 @@ class CommandDrawSelectedInventory : public SBarInfoCommandFlowControl, private
|
||||||
|
|
||||||
if(artiflashTick > 0)
|
if(artiflashTick > 0)
|
||||||
artiflashTick--;
|
artiflashTick--;
|
||||||
|
if(itemflashFade > 0)
|
||||||
|
{
|
||||||
|
itemflashFade -= FRACUNIT/14;
|
||||||
|
if(itemflashFade < 0)
|
||||||
|
itemflashFade = 0;
|
||||||
|
}
|
||||||
|
|
||||||
SetTruth(statusBar->CPlayer->mo->InvSel == NULL || (level.flags & LEVEL_NOINVENTORYBAR), block, statusBar);
|
SetTruth(statusBar->CPlayer->mo->InvSel == NULL || (level.flags & LEVEL_NOINVENTORYBAR), block, statusBar);
|
||||||
|
|
||||||
|
@ -1437,15 +1486,18 @@ class CommandDrawSelectedInventory : public SBarInfoCommandFlowControl, private
|
||||||
CommandDrawNumber::Tick(block, statusBar, hudChanged);
|
CommandDrawNumber::Tick(block, statusBar, hudChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Flash() { artiflashTick = 4; }
|
static void Flash() { artiflashTick = 4; itemflashFade = FRACUNIT*3/4; }
|
||||||
protected:
|
protected:
|
||||||
bool alternateOnEmpty;
|
bool alternateOnEmpty;
|
||||||
bool artiflash;
|
bool artiflash;
|
||||||
bool alwaysShowCounter;
|
bool alwaysShowCounter;
|
||||||
|
bool itemflash;
|
||||||
|
|
||||||
static int artiflashTick;
|
static int artiflashTick;
|
||||||
|
static fixed_t itemflashFade;
|
||||||
};
|
};
|
||||||
int CommandDrawSelectedInventory::artiflashTick = 4;
|
int CommandDrawSelectedInventory::artiflashTick = 4;
|
||||||
|
int CommandDrawSelectedInventory::itemflashFade = FRACUNIT*3/4;
|
||||||
|
|
||||||
void DSBarInfo::FlashItem(const PClass *itemtype)
|
void DSBarInfo::FlashItem(const PClass *itemtype)
|
||||||
{
|
{
|
||||||
|
@ -1754,7 +1806,8 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
CommandDrawInventoryBar(SBarInfo *script) : SBarInfoCommand(script),
|
CommandDrawInventoryBar(SBarInfo *script) : SBarInfoCommand(script),
|
||||||
style(STYLE_Doom), size(7), alwaysShow(false), noArtibox(false),
|
style(STYLE_Doom), size(7), alwaysShow(false), noArtibox(false),
|
||||||
noArrows(false), alwaysShowCounter(false), translucent(false),
|
noArrows(false), alwaysShowCounter(false), translucent(false),
|
||||||
vertical(false), counters(NULL), font(NULL), translation(CR_GOLD),
|
vertical(false), shadow(false), shadowX(2), shadowY(2),
|
||||||
|
counters(NULL), font(NULL), translation(CR_GOLD),
|
||||||
fontSpacing(0)
|
fontSpacing(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1858,6 +1911,19 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
{
|
{
|
||||||
if(sc.Compare("alwaysshow"))
|
if(sc.Compare("alwaysshow"))
|
||||||
alwaysShow = true;
|
alwaysShow = true;
|
||||||
|
else if(sc.Compare("drawshadow"))
|
||||||
|
{
|
||||||
|
if(sc.CheckToken('('))
|
||||||
|
{
|
||||||
|
sc.MustGetToken(TK_IntConst);
|
||||||
|
shadowX = sc.Number;
|
||||||
|
sc.MustGetToken(',');
|
||||||
|
sc.MustGetToken(TK_IntConst);
|
||||||
|
shadowY = sc.Number;
|
||||||
|
sc.MustGetToken(')');
|
||||||
|
}
|
||||||
|
shadow = true;
|
||||||
|
}
|
||||||
else if(sc.Compare("noartibox"))
|
else if(sc.Compare("noartibox"))
|
||||||
noArtibox = true;
|
noArtibox = true;
|
||||||
else if(sc.Compare("noarrows"))
|
else if(sc.Compare("noarrows"))
|
||||||
|
@ -1926,7 +1992,10 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
counters[i]->spacing = fontSpacing;
|
counters[i]->spacing = fontSpacing;
|
||||||
counters[i]->whenNotZero = !alwaysShowCounter;
|
counters[i]->whenNotZero = !alwaysShowCounter;
|
||||||
counters[i]->drawValue = counters[i]->value = CommandDrawNumber::CONSTANT;
|
counters[i]->drawValue = counters[i]->value = CommandDrawNumber::CONSTANT;
|
||||||
counters[i]->length = 3;
|
counters[i]->length = INT_MAX;
|
||||||
|
counters[i]->shadow = shadow;
|
||||||
|
counters[i]->shadowX = shadowX;
|
||||||
|
counters[i]->shadowY = shadowY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1951,6 +2020,9 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
bool alwaysShowCounter;
|
bool alwaysShowCounter;
|
||||||
bool translucent;
|
bool translucent;
|
||||||
bool vertical;
|
bool vertical;
|
||||||
|
bool shadow;
|
||||||
|
int shadowX;
|
||||||
|
int shadowY;
|
||||||
SBarInfoCoordinate x;
|
SBarInfoCoordinate x;
|
||||||
SBarInfoCoordinate y;
|
SBarInfoCoordinate y;
|
||||||
CommandDrawNumber* *counters;
|
CommandDrawNumber* *counters;
|
||||||
|
|
Loading…
Reference in a new issue