mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 13:31:37 +00:00
- added a 'protrusion' property to SBARINFO so that the map name display can properly be handled here as well. Until now it was only working for scripted status bars.
This commit is contained in:
parent
4fcea96a1c
commit
bb12dabe2b
5 changed files with 43 additions and 0 deletions
|
@ -386,6 +386,7 @@ enum //Key words
|
||||||
SBARINFO_STATUSBAR,
|
SBARINFO_STATUSBAR,
|
||||||
SBARINFO_MUGSHOT,
|
SBARINFO_MUGSHOT,
|
||||||
SBARINFO_CREATEPOPUP,
|
SBARINFO_CREATEPOPUP,
|
||||||
|
SBARINFO_PROTRUSION,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum //Bar types
|
enum //Bar types
|
||||||
|
@ -414,6 +415,7 @@ static const char *SBarInfoTopLevel[] =
|
||||||
"statusbar",
|
"statusbar",
|
||||||
"mugshot",
|
"mugshot",
|
||||||
"createpopup",
|
"createpopup",
|
||||||
|
"protrusion",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -743,6 +745,21 @@ void SBarInfo::ParseSBarInfo(int lump)
|
||||||
sc.MustGetToken(';');
|
sc.MustGetToken(';');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SBARINFO_PROTRUSION:
|
||||||
|
{
|
||||||
|
double lastvalue = -DBL_EPSILON;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
sc.MustGetToken(TK_FloatConst);
|
||||||
|
if (sc.Float <= lastvalue) sc.ScriptError("Protrusion factors must be in ascending order");
|
||||||
|
lastvalue = sc.Float;
|
||||||
|
sc.MustGetToken(',');
|
||||||
|
sc.MustGetToken(TK_IntConst);
|
||||||
|
protrusions.Push({ lastvalue, sc.Number });
|
||||||
|
} while (sc.CheckToken(','));
|
||||||
|
sc.MustGetToken(';');
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1160,6 +1177,17 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _GetProtrusion(double scalefac)
|
||||||
|
{
|
||||||
|
int returnval = 0;
|
||||||
|
for (auto &prot : script->protrusions)
|
||||||
|
{
|
||||||
|
if (prot.first > scalefac) break;
|
||||||
|
returnval = prot.second;
|
||||||
|
}
|
||||||
|
return returnval;
|
||||||
|
}
|
||||||
|
|
||||||
//draws an image with the specified flags
|
//draws an image with the specified flags
|
||||||
void DrawGraphic(FTexture* texture, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, double Alpha, bool fullScreenOffsets, bool translate=false, bool dim=false, int offsetflags=0, bool alphaMap=false, int forceWidth=-1, int forceHeight=-1, const double *clip = nulclip, bool clearDontDraw=false) const
|
void DrawGraphic(FTexture* texture, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, double Alpha, bool fullScreenOffsets, bool translate=false, bool dim=false, int offsetflags=0, bool alphaMap=false, int forceWidth=-1, int forceHeight=-1, const double *clip = nulclip, bool clearDontDraw=false) const
|
||||||
{
|
{
|
||||||
|
@ -1538,6 +1566,12 @@ DEFINE_ACTION_FUNCTION(DSBarInfo, ShowPop)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(DSBarInfo, GetProtrusion)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(DSBarInfo);
|
||||||
|
PARAM_FLOAT(scalefac);
|
||||||
|
ACTION_RETURN_INT(self->_GetProtrusion(scalefac));
|
||||||
|
}
|
||||||
|
|
||||||
DBaseStatusBar *CreateCustomStatusBar(int scriptno)
|
DBaseStatusBar *CreateCustomStatusBar(int scriptno)
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,6 +101,7 @@ struct SBarInfo
|
||||||
bool completeBorder;
|
bool completeBorder;
|
||||||
bool lowerHealthCap;
|
bool lowerHealthCap;
|
||||||
char spacingCharacter;
|
char spacingCharacter;
|
||||||
|
TArray<std::pair<double, int>> protrusions;
|
||||||
MonospaceAlignment spacingAlignment;
|
MonospaceAlignment spacingAlignment;
|
||||||
int interpolationSpeed;
|
int interpolationSpeed;
|
||||||
int armorInterpolationSpeed;
|
int armorInterpolationSpeed;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
height 42;
|
height 42;
|
||||||
|
protrusion 0.7, 8;
|
||||||
monospacefonts true, "0", center;
|
monospacefonts true, "0", center;
|
||||||
|
|
||||||
statusbar fullscreen, fullscreenoffsets
|
statusbar fullscreen, fullscreenoffsets
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
height 38;
|
height 38;
|
||||||
|
protrusion 0.0, 12, 0.85, 28;
|
||||||
monospacefonts true, "0", center;
|
monospacefonts true, "0", center;
|
||||||
|
|
||||||
statusbar fullscreen, fullscreenoffsets
|
statusbar fullscreen, fullscreenoffsets
|
||||||
|
|
|
@ -8,6 +8,7 @@ struct SBarInfo native ui
|
||||||
native bool MustDrawLog(int state);
|
native bool MustDrawLog(int state);
|
||||||
native void Tick();
|
native void Tick();
|
||||||
native void ShowPop(int popnum);
|
native void ShowPop(int popnum);
|
||||||
|
native int GetProtrusion(double scalefac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,5 +63,10 @@ class SBarInfoWrapper : BaseStatusBar
|
||||||
core.ShowPop(popnum);
|
core.ShowPop(popnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override int GetProtrusion(double scaleratio) const
|
||||||
|
{
|
||||||
|
return core.GetProtrusion(scaleratio);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue