mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- fixed issues with option menu items.
- fixed the octal parser in strbin. - remove 'new' token because it gets in the way.
This commit is contained in:
parent
4562695854
commit
03283de4e8
10 changed files with 26 additions and 22 deletions
|
@ -1332,6 +1332,14 @@ DEFINE_ACTION_FUNCTION(_Console, HideConsole)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Console, Printf)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
FString s = FStringFormat(param, defaultparam, numparam, ret, numret);
|
||||
Printf("%s\n", s.GetChars());
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
|
||||
{
|
||||
int data1 = ev->data1;
|
||||
|
|
|
@ -192,7 +192,7 @@ DEFINE_ACTION_FUNCTION(_CVar, GetFloat)
|
|||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
|
||||
auto v = self->GetGenericRep(CVAR_Float);
|
||||
ACTION_RETURN_FLOAT(v.Int);
|
||||
ACTION_RETURN_FLOAT(v.Float);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_CVar, GetString)
|
||||
|
|
|
@ -614,16 +614,16 @@ int strbin (char *str)
|
|||
case '6':
|
||||
case '7':
|
||||
c = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
c <<= 3;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
p++;
|
||||
if (*p >= '0' && *p <= '7')
|
||||
c += *p-'0';
|
||||
c = (c << 3) + *p - '0';
|
||||
else
|
||||
{
|
||||
p--;
|
||||
break;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
*str++ = c;
|
||||
break;
|
||||
|
@ -717,16 +717,16 @@ FString strbin1 (const char *start)
|
|||
case '6':
|
||||
case '7':
|
||||
c = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
c <<= 3;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
p++;
|
||||
if (*p >= '0' && *p <= '7')
|
||||
c += *p-'0';
|
||||
c = (c << 3) + *p - '0';
|
||||
else
|
||||
{
|
||||
p--;
|
||||
break;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
result << c;
|
||||
break;
|
||||
|
|
|
@ -1402,7 +1402,7 @@ bool DMenuItemBase::GetValue(int i, int *pvalue)
|
|||
{
|
||||
IFVIRTUAL(DMenuItemBase, GetValue)
|
||||
{
|
||||
VMValue params[] = { (DObject*)this };
|
||||
VMValue params[] = { (DObject*)this, i };
|
||||
int retval[2];
|
||||
VMReturn ret[2]; ret[0].IntAt(&retval[0]); ret[1].IntAt(&retval[1]);
|
||||
GlobalVMStack.Call(func, params, countof(params), ret, 2, nullptr);
|
||||
|
|
|
@ -142,8 +142,6 @@ std2:
|
|||
'true' { RET(TK_True); }
|
||||
'false' { RET(TK_False); }
|
||||
'none' { RET(TK_None); }
|
||||
'new' { RET(TK_New); }
|
||||
'instanceof' { RET(TK_InstanceOf); }
|
||||
'auto' { RET(TK_Auto); }
|
||||
'exec' { RET(TK_Exec); }
|
||||
'property' { RET(TK_Property); }
|
||||
|
|
|
@ -81,7 +81,6 @@ xx(TK_ForEach, "'foreach'")
|
|||
xx(TK_True, "'true'")
|
||||
xx(TK_False, "'false'")
|
||||
xx(TK_None, "'none'")
|
||||
xx(TK_New, "'new'")
|
||||
xx(TK_InstanceOf, "'instanceof'")
|
||||
xx(TK_Auto, "'auto'")
|
||||
xx(TK_Exec, "'exec'")
|
||||
|
|
|
@ -1009,7 +1009,7 @@ DEFINE_ACTION_FUNCTION(FStringStruct, Replace)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static FString FStringFormat(VM_ARGS)
|
||||
FString FStringFormat(VM_ARGS)
|
||||
{
|
||||
assert(param[0].Type == REGT_STRING);
|
||||
FString fmtstring = param[0].s().GetChars();
|
||||
|
|
|
@ -1213,6 +1213,6 @@ class PFunction;
|
|||
VMFunction *FindVMFunction(PClass *cls, const char *name);
|
||||
#define DECLARE_VMFUNC(cls, name) static VMFunction *name; if (name == nullptr) name = FindVMFunction(RUNTIME_CLASS(cls), #name);
|
||||
|
||||
|
||||
FString FStringFormat(VM_ARGS);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -219,6 +219,7 @@ struct Console native
|
|||
{
|
||||
native static void HideConsole();
|
||||
native static void MidPrint(Font fontname, string textlabel, bool bold = false);
|
||||
native static vararg void Printf(string fmt, ...);
|
||||
native static void DoCommand(String cmd);
|
||||
}
|
||||
|
||||
|
|
|
@ -168,8 +168,7 @@ class OptionMenuItemSafeCommand : OptionMenuItemCommand
|
|||
String actionLabel = StringTable.localize(mLabel);
|
||||
|
||||
String FullString;
|
||||
FullString.Format("%s%s%s\n\n%s", TEXTCOLOR_WHITE, actionLabel, TEXTCOLOR_NORMAL, msg);
|
||||
|
||||
FullString = String.Format("%s%s%s\n\n%s", TEXTCOLOR_WHITE, actionLabel, TEXTCOLOR_NORMAL, msg);
|
||||
Menu.StartMessage(FullString, 0);
|
||||
return true;
|
||||
}
|
||||
|
@ -187,7 +186,7 @@ class OptionMenuItemOptionBase : OptionMenuItem
|
|||
Name mValues; // Entry in OptionValues table
|
||||
CVar mGrayCheck;
|
||||
int mCenter;
|
||||
|
||||
|
||||
const OP_VALUES = 0x11001;
|
||||
|
||||
protected void Init(String label, Name command, Name values, CVar graycheck, int center)
|
||||
|
@ -650,7 +649,7 @@ class OptionMenuSliderBase : OptionMenuItem
|
|||
|
||||
private void DrawSlider (int x, int y, double min, double max, double cur, int fracdigits, int indent)
|
||||
{
|
||||
String formater = String.format("%%.%f", fracdigits); // The format function cannot do the '%.*f' syntax.
|
||||
String formater = String.format("%%.%df", fracdigits); // The format function cannot do the '%.*f' syntax.
|
||||
String textbuf;
|
||||
double range;
|
||||
int maxlen = 0;
|
||||
|
@ -810,7 +809,7 @@ class OptionMenuItemColorPicker : OptionMenuItem
|
|||
{
|
||||
Super.Init(label, command);
|
||||
CVar cv = CVar.FindCVar(command);
|
||||
if (cv != null && cv.GetRealType() == CVar.CVAR_Color) cv = null;
|
||||
if (cv != null && cv.GetRealType() != CVar.CVAR_Color) cv = null;
|
||||
mCVar = cv;
|
||||
}
|
||||
|
||||
|
@ -823,7 +822,7 @@ class OptionMenuItemColorPicker : OptionMenuItem
|
|||
{
|
||||
int box_x = indent + CursorSpace();
|
||||
int box_y = y + CleanYfac_1;
|
||||
screen.Clear (box_x, box_y, box_x + 32*CleanXfac_1, box_y + OptionMenuSettings.mLinespacing*CleanYfac_1, -1, mCVar.GetInt() | 0xff000000);
|
||||
screen.Clear (box_x, box_y, box_x + 32*CleanXfac_1, box_y + OptionMenuSettings.mLinespacing*CleanYfac_1, mCVar.GetInt() | 0xff000000);
|
||||
}
|
||||
return indent;
|
||||
}
|
||||
|
@ -1102,7 +1101,6 @@ class OptionMenuItemTextField : OptionMenuFieldBase
|
|||
|
||||
//Menu* input = new DTextEnterMenu (Menu.CurrentMenu, mEditName, sizeof mEditName, 2, fromcontroller);
|
||||
//M_ActivateMenu(input);
|
||||
//OpenTextEnterMenu(mEditName, 2, fromcontroller); // needs a native workaround until menu creation is scriptable.
|
||||
return true;
|
||||
}
|
||||
else if (mkey == Menu.MKEY_Input)
|
||||
|
|
Loading…
Reference in a new issue