mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +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;
|
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)
|
static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
|
||||||
{
|
{
|
||||||
int data1 = ev->data1;
|
int data1 = ev->data1;
|
||||||
|
|
|
@ -192,7 +192,7 @@ DEFINE_ACTION_FUNCTION(_CVar, GetFloat)
|
||||||
{
|
{
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
|
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
|
||||||
auto v = self->GetGenericRep(CVAR_Float);
|
auto v = self->GetGenericRep(CVAR_Float);
|
||||||
ACTION_RETURN_FLOAT(v.Int);
|
ACTION_RETURN_FLOAT(v.Float);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(_CVar, GetString)
|
DEFINE_ACTION_FUNCTION(_CVar, GetString)
|
||||||
|
|
|
@ -614,16 +614,16 @@ int strbin (char *str)
|
||||||
case '6':
|
case '6':
|
||||||
case '7':
|
case '7':
|
||||||
c = 0;
|
c = 0;
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 2; i++)
|
||||||
c <<= 3;
|
{
|
||||||
|
p++;
|
||||||
if (*p >= '0' && *p <= '7')
|
if (*p >= '0' && *p <= '7')
|
||||||
c += *p-'0';
|
c = (c << 3) + *p - '0';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p--;
|
p--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
*str++ = c;
|
*str++ = c;
|
||||||
break;
|
break;
|
||||||
|
@ -717,16 +717,16 @@ FString strbin1 (const char *start)
|
||||||
case '6':
|
case '6':
|
||||||
case '7':
|
case '7':
|
||||||
c = 0;
|
c = 0;
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 2; i++)
|
||||||
c <<= 3;
|
{
|
||||||
|
p++;
|
||||||
if (*p >= '0' && *p <= '7')
|
if (*p >= '0' && *p <= '7')
|
||||||
c += *p-'0';
|
c = (c << 3) + *p - '0';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p--;
|
p--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
result << c;
|
result << c;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1402,7 +1402,7 @@ bool DMenuItemBase::GetValue(int i, int *pvalue)
|
||||||
{
|
{
|
||||||
IFVIRTUAL(DMenuItemBase, GetValue)
|
IFVIRTUAL(DMenuItemBase, GetValue)
|
||||||
{
|
{
|
||||||
VMValue params[] = { (DObject*)this };
|
VMValue params[] = { (DObject*)this, i };
|
||||||
int retval[2];
|
int retval[2];
|
||||||
VMReturn ret[2]; ret[0].IntAt(&retval[0]); ret[1].IntAt(&retval[1]);
|
VMReturn ret[2]; ret[0].IntAt(&retval[0]); ret[1].IntAt(&retval[1]);
|
||||||
GlobalVMStack.Call(func, params, countof(params), ret, 2, nullptr);
|
GlobalVMStack.Call(func, params, countof(params), ret, 2, nullptr);
|
||||||
|
|
|
@ -142,8 +142,6 @@ std2:
|
||||||
'true' { RET(TK_True); }
|
'true' { RET(TK_True); }
|
||||||
'false' { RET(TK_False); }
|
'false' { RET(TK_False); }
|
||||||
'none' { RET(TK_None); }
|
'none' { RET(TK_None); }
|
||||||
'new' { RET(TK_New); }
|
|
||||||
'instanceof' { RET(TK_InstanceOf); }
|
|
||||||
'auto' { RET(TK_Auto); }
|
'auto' { RET(TK_Auto); }
|
||||||
'exec' { RET(TK_Exec); }
|
'exec' { RET(TK_Exec); }
|
||||||
'property' { RET(TK_Property); }
|
'property' { RET(TK_Property); }
|
||||||
|
|
|
@ -81,7 +81,6 @@ xx(TK_ForEach, "'foreach'")
|
||||||
xx(TK_True, "'true'")
|
xx(TK_True, "'true'")
|
||||||
xx(TK_False, "'false'")
|
xx(TK_False, "'false'")
|
||||||
xx(TK_None, "'none'")
|
xx(TK_None, "'none'")
|
||||||
xx(TK_New, "'new'")
|
|
||||||
xx(TK_InstanceOf, "'instanceof'")
|
xx(TK_InstanceOf, "'instanceof'")
|
||||||
xx(TK_Auto, "'auto'")
|
xx(TK_Auto, "'auto'")
|
||||||
xx(TK_Exec, "'exec'")
|
xx(TK_Exec, "'exec'")
|
||||||
|
|
|
@ -1009,7 +1009,7 @@ DEFINE_ACTION_FUNCTION(FStringStruct, Replace)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FString FStringFormat(VM_ARGS)
|
FString FStringFormat(VM_ARGS)
|
||||||
{
|
{
|
||||||
assert(param[0].Type == REGT_STRING);
|
assert(param[0].Type == REGT_STRING);
|
||||||
FString fmtstring = param[0].s().GetChars();
|
FString fmtstring = param[0].s().GetChars();
|
||||||
|
|
|
@ -1213,6 +1213,6 @@ class PFunction;
|
||||||
VMFunction *FindVMFunction(PClass *cls, const char *name);
|
VMFunction *FindVMFunction(PClass *cls, const char *name);
|
||||||
#define DECLARE_VMFUNC(cls, name) static VMFunction *name; if (name == nullptr) name = FindVMFunction(RUNTIME_CLASS(cls), #name);
|
#define DECLARE_VMFUNC(cls, name) static VMFunction *name; if (name == nullptr) name = FindVMFunction(RUNTIME_CLASS(cls), #name);
|
||||||
|
|
||||||
|
FString FStringFormat(VM_ARGS);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -219,6 +219,7 @@ struct Console native
|
||||||
{
|
{
|
||||||
native static void HideConsole();
|
native static void HideConsole();
|
||||||
native static void MidPrint(Font fontname, string textlabel, bool bold = false);
|
native static void MidPrint(Font fontname, string textlabel, bool bold = false);
|
||||||
|
native static vararg void Printf(string fmt, ...);
|
||||||
native static void DoCommand(String cmd);
|
native static void DoCommand(String cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,8 +168,7 @@ class OptionMenuItemSafeCommand : OptionMenuItemCommand
|
||||||
String actionLabel = StringTable.localize(mLabel);
|
String actionLabel = StringTable.localize(mLabel);
|
||||||
|
|
||||||
String FullString;
|
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);
|
Menu.StartMessage(FullString, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +186,7 @@ class OptionMenuItemOptionBase : OptionMenuItem
|
||||||
Name mValues; // Entry in OptionValues table
|
Name mValues; // Entry in OptionValues table
|
||||||
CVar mGrayCheck;
|
CVar mGrayCheck;
|
||||||
int mCenter;
|
int mCenter;
|
||||||
|
|
||||||
const OP_VALUES = 0x11001;
|
const OP_VALUES = 0x11001;
|
||||||
|
|
||||||
protected void Init(String label, Name command, Name values, CVar graycheck, int center)
|
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)
|
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;
|
String textbuf;
|
||||||
double range;
|
double range;
|
||||||
int maxlen = 0;
|
int maxlen = 0;
|
||||||
|
@ -810,7 +809,7 @@ class OptionMenuItemColorPicker : OptionMenuItem
|
||||||
{
|
{
|
||||||
Super.Init(label, command);
|
Super.Init(label, command);
|
||||||
CVar cv = CVar.FindCVar(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;
|
mCVar = cv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,7 +822,7 @@ class OptionMenuItemColorPicker : OptionMenuItem
|
||||||
{
|
{
|
||||||
int box_x = indent + CursorSpace();
|
int box_x = indent + CursorSpace();
|
||||||
int box_y = y + CleanYfac_1;
|
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;
|
return indent;
|
||||||
}
|
}
|
||||||
|
@ -1102,7 +1101,6 @@ class OptionMenuItemTextField : OptionMenuFieldBase
|
||||||
|
|
||||||
//Menu* input = new DTextEnterMenu (Menu.CurrentMenu, mEditName, sizeof mEditName, 2, fromcontroller);
|
//Menu* input = new DTextEnterMenu (Menu.CurrentMenu, mEditName, sizeof mEditName, 2, fromcontroller);
|
||||||
//M_ActivateMenu(input);
|
//M_ActivateMenu(input);
|
||||||
//OpenTextEnterMenu(mEditName, 2, fromcontroller); // needs a native workaround until menu creation is scriptable.
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (mkey == Menu.MKEY_Input)
|
else if (mkey == Menu.MKEY_Input)
|
||||||
|
|
Loading…
Reference in a new issue