mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 20:43:15 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
3e3a0cdc3d
3 changed files with 39 additions and 21 deletions
|
@ -306,7 +306,15 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
||||||
int y = sc.Number;
|
int y = sc.Number;
|
||||||
sc.MustGetStringName(",");
|
sc.MustGetStringName(",");
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
FListMenuItem *it = new FListMenuItemStaticText(x, y, sc.String, desc->mFont, desc->mFontColor, centered);
|
FString label = sc.String;
|
||||||
|
EColorRange cr = desc->mFontColor;
|
||||||
|
if (sc.CheckString(","))
|
||||||
|
{
|
||||||
|
sc.MustGetString();
|
||||||
|
cr = V_FindFontColor(sc.String);
|
||||||
|
if (cr == CR_UNTRANSLATED && !sc.Compare("untranslated")) cr = desc->mFontColor;
|
||||||
|
}
|
||||||
|
FListMenuItem *it = new FListMenuItemStaticText(x, y, label, desc->mFont, cr, centered);
|
||||||
desc->mItems.Push(it);
|
desc->mItems.Push(it);
|
||||||
}
|
}
|
||||||
else if (sc.Compare("PatchItem"))
|
else if (sc.Compare("PatchItem"))
|
||||||
|
@ -648,6 +656,21 @@ static void ParseOptionSettings(FScanner &sc)
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
|
static EColorRange ParseOptionColor(FScanner &sc, FOptionMenuDescriptor *desc)
|
||||||
|
{
|
||||||
|
EColorRange cr = OptionSettings.mFontColor;
|
||||||
|
if (sc.CheckString(","))
|
||||||
|
{
|
||||||
|
sc.MustGetString();
|
||||||
|
EColorRange cr = V_FindFontColor(sc.String);
|
||||||
|
if (cr == CR_UNTRANSLATED && !sc.Compare("untranslated") && isdigit(sc.String[0]))
|
||||||
|
{
|
||||||
|
if (strtol(sc.String, NULL, 0)) cr = OptionSettings.mFontColorHeader;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cr;
|
||||||
|
}
|
||||||
|
|
||||||
static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
||||||
{
|
{
|
||||||
sc.MustGetStringName("{");
|
sc.MustGetStringName("{");
|
||||||
|
@ -784,12 +807,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
||||||
{
|
{
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
FString label = sc.String;
|
FString label = sc.String;
|
||||||
bool cr = false;
|
EColorRange cr = ParseOptionColor(sc, desc);
|
||||||
if (sc.CheckString(","))
|
|
||||||
{
|
|
||||||
sc.MustGetNumber();
|
|
||||||
cr = !!sc.Number;
|
|
||||||
}
|
|
||||||
FOptionMenuItem *it = new FOptionMenuItemStaticText(label, cr);
|
FOptionMenuItem *it = new FOptionMenuItemStaticText(label, cr);
|
||||||
desc->mItems.Push(it);
|
desc->mItems.Push(it);
|
||||||
}
|
}
|
||||||
|
@ -803,12 +821,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
||||||
sc.MustGetStringName(",");
|
sc.MustGetStringName(",");
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
FName action = sc.String;
|
FName action = sc.String;
|
||||||
bool cr = false;
|
EColorRange cr = ParseOptionColor(sc, desc);
|
||||||
if (sc.CheckString(","))
|
|
||||||
{
|
|
||||||
sc.MustGetNumber();
|
|
||||||
cr = !!sc.Number;
|
|
||||||
}
|
|
||||||
FOptionMenuItem *it = new FOptionMenuItemStaticTextSwitchable(label, label2, action, cr);
|
FOptionMenuItem *it = new FOptionMenuItemStaticTextSwitchable(label, label2, action, cr);
|
||||||
desc->mItems.Push(it);
|
desc->mItems.Push(it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -486,6 +486,12 @@ public:
|
||||||
mColor = header ? OptionSettings.mFontColorHeader : OptionSettings.mFontColor;
|
mColor = header ? OptionSettings.mFontColorHeader : OptionSettings.mFontColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FOptionMenuItemStaticText(const char *label, EColorRange cr)
|
||||||
|
: FOptionMenuItem(label, NAME_None, true)
|
||||||
|
{
|
||||||
|
mColor = cr;
|
||||||
|
}
|
||||||
|
|
||||||
int Draw(FOptionMenuDescriptor *desc, int y, int indent, bool selected)
|
int Draw(FOptionMenuDescriptor *desc, int y, int indent, bool selected)
|
||||||
{
|
{
|
||||||
drawLabel(indent, y, mColor);
|
drawLabel(indent, y, mColor);
|
||||||
|
@ -512,10 +518,10 @@ class FOptionMenuItemStaticTextSwitchable : public FOptionMenuItem
|
||||||
int mCurrent;
|
int mCurrent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FOptionMenuItemStaticTextSwitchable(const char *label, const char *label2, FName action, bool header)
|
FOptionMenuItemStaticTextSwitchable(const char *label, const char *label2, FName action, EColorRange cr)
|
||||||
: FOptionMenuItem(label, action, true)
|
: FOptionMenuItem(label, action, true)
|
||||||
{
|
{
|
||||||
mColor = header? OptionSettings.mFontColorHeader : OptionSettings.mFontColor;
|
mColor = cr;
|
||||||
mAltText = label2;
|
mAltText = label2;
|
||||||
mCurrent = 0;
|
mCurrent = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,18 +38,17 @@ struct intercept_t
|
||||||
|
|
||||||
inline int P_PointOnLineSidePrecise(double x, double y, const line_t *line)
|
inline int P_PointOnLineSidePrecise(double x, double y, const line_t *line)
|
||||||
{
|
{
|
||||||
return (y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - x) * line->Delta().Y > -EQUAL_EPSILON;
|
return (y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - x) * line->Delta().Y > EQUAL_EPSILON;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int P_PointOnLineSidePrecise(const DVector2 &pt, const line_t *line)
|
inline int P_PointOnLineSidePrecise(const DVector2 &pt, const line_t *line)
|
||||||
{
|
{
|
||||||
return (pt.Y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - pt.X) * line->Delta().Y > -EQUAL_EPSILON;
|
return (pt.Y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - pt.X) * line->Delta().Y > EQUAL_EPSILON;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int P_PointOnLineSide (double x, double y, const line_t *line)
|
inline int P_PointOnLineSide (double x, double y, const line_t *line)
|
||||||
{
|
{
|
||||||
extern int P_VanillaPointOnLineSide(double x, double y, const line_t* line);
|
extern int P_VanillaPointOnLineSide(double x, double y, const line_t* line);
|
||||||
|
|
||||||
return i_compatflags2 & COMPATF2_POINTONLINE
|
return i_compatflags2 & COMPATF2_POINTONLINE
|
||||||
? P_VanillaPointOnLineSide(x, y, line) : P_PointOnLineSidePrecise(x, y, line);
|
? P_VanillaPointOnLineSide(x, y, line) : P_PointOnLineSidePrecise(x, y, line);
|
||||||
}
|
}
|
||||||
|
@ -73,12 +72,12 @@ inline int P_PointOnLineSide(const DVector2 & p, const line_t *line)
|
||||||
|
|
||||||
inline int P_PointOnDivlineSide(double x, double y, const divline_t *line)
|
inline int P_PointOnDivlineSide(double x, double y, const divline_t *line)
|
||||||
{
|
{
|
||||||
return (y - line->y) * line->dx + (line->x - x) * line->dy > -EQUAL_EPSILON;
|
return (y - line->y) * line->dx + (line->x - x) * line->dy > EQUAL_EPSILON;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int P_PointOnDivlineSide(const DVector2 &pos, const divline_t *line)
|
inline int P_PointOnDivlineSide(const DVector2 &pos, const divline_t *line)
|
||||||
{
|
{
|
||||||
return (pos.Y - line->y) * line->dx + (line->x - pos.X) * line->dy > -EQUAL_EPSILON;
|
return (pos.Y - line->y) * line->dx + (line->x - pos.X) * line->dy > EQUAL_EPSILON;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue