mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
CON: Add if statements if(var(var)){a,b}(e).
Inspired by x86 assembly, these stand for "above" and "below", and perform unsigned versions of greater-than and less-than, respectively. Useful for testing array bounds. git-svn-id: https://svn.eduke32.com/eduke32@6640 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
190d71832a
commit
f228b68736
6 changed files with 176 additions and 0 deletions
|
@ -308,7 +308,11 @@ static tokenmap_t const vm_keywords[] =
|
|||
{ "ifspritepal", CON_IFSPRITEPAL },
|
||||
{ "ifsquished", CON_IFSQUISHED },
|
||||
{ "ifstrength", CON_IFSTRENGTH },
|
||||
{ "ifvara", CON_IFVARA },
|
||||
{ "ifvarae", CON_IFVARAE },
|
||||
{ "ifvarand", CON_IFVARAND },
|
||||
{ "ifvarb", CON_IFVARB },
|
||||
{ "ifvarbe", CON_IFVARBE },
|
||||
{ "ifvarboth", CON_IFVARBOTH },
|
||||
{ "ifvare", CON_IFVARE },
|
||||
{ "ifvareither", CON_IFVAREITHER },
|
||||
|
@ -318,7 +322,11 @@ static tokenmap_t const vm_keywords[] =
|
|||
{ "ifvarle", CON_IFVARLE },
|
||||
{ "ifvarn", CON_IFVARN },
|
||||
{ "ifvaror", CON_IFVAROR },
|
||||
{ "ifvarvara", CON_IFVARVARA },
|
||||
{ "ifvarvarae", CON_IFVARVARAE },
|
||||
{ "ifvarvarand", CON_IFVARVARAND },
|
||||
{ "ifvarvarb", CON_IFVARVARB },
|
||||
{ "ifvarvarbe", CON_IFVARVARBE },
|
||||
{ "ifvarvarboth", CON_IFVARVARBOTH },
|
||||
{ "ifvarvare", CON_IFVARVARE },
|
||||
{ "ifvarvareither", CON_IFVARVAREITHER },
|
||||
|
@ -534,6 +542,10 @@ static tokenmap_t const vm_keywords[] =
|
|||
{ "and", CON_ANDVARVAR },
|
||||
{ "or", CON_ORVARVAR },
|
||||
{ "xor", CON_XORVARVAR },
|
||||
{ "ifa", CON_IFVARVARA },
|
||||
{ "ifae", CON_IFVARVARAE },
|
||||
{ "ifb", CON_IFVARVARB },
|
||||
{ "ifbe", CON_IFVARVARBE },
|
||||
{ "ifl", CON_IFVARVARL },
|
||||
{ "ifle", CON_IFVARVARLE },
|
||||
{ "ifg", CON_IFVARVARG },
|
||||
|
@ -4638,6 +4650,10 @@ DO_DEFSTATE:
|
|||
case CON_IFVARVARE:
|
||||
case CON_IFVARVARLE:
|
||||
case CON_IFVARVARGE:
|
||||
case CON_IFVARVARA:
|
||||
case CON_IFVARVARB:
|
||||
case CON_IFVARVARAE:
|
||||
case CON_IFVARVARBE:
|
||||
case CON_IFVARVARBOTH:
|
||||
case CON_IFVARVARN:
|
||||
case CON_IFVARVARAND:
|
||||
|
@ -4688,6 +4704,10 @@ DO_DEFSTATE:
|
|||
case CON_IFVARLE:
|
||||
case CON_IFVARG:
|
||||
case CON_IFVARGE:
|
||||
case CON_IFVARA:
|
||||
case CON_IFVARAE:
|
||||
case CON_IFVARB:
|
||||
case CON_IFVARBE:
|
||||
case CON_IFVARE:
|
||||
case CON_IFVARN:
|
||||
case CON_IFVARAND:
|
||||
|
|
|
@ -1214,6 +1214,14 @@ enum ScriptKeywords_t
|
|||
CON_DIVRU, // 413
|
||||
CON_SWAPTRACKSLOT, // 414
|
||||
CON_PRELOADTRACKSLOTFORSWAP, // 415
|
||||
CON_IFVARA, // 416
|
||||
CON_IFVARVARA, // 417
|
||||
CON_IFVARAE, // 418
|
||||
CON_IFVARVARAE, // 419
|
||||
CON_IFVARB, // 420
|
||||
CON_IFVARVARB, // 421
|
||||
CON_IFVARBE, // 422
|
||||
CON_IFVARVARBE, // 423
|
||||
CON_END
|
||||
};
|
||||
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua
|
||||
|
|
|
@ -5205,6 +5205,38 @@ finish_qsprintf:
|
|||
VM_CONDITIONAL(tw);
|
||||
continue;
|
||||
|
||||
case CON_IFVARVARA:
|
||||
insptr++;
|
||||
tw = Gv_GetVarX(*insptr++);
|
||||
tw = ((uint32_t)tw > (uint32_t)Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
VM_CONDITIONAL(tw);
|
||||
continue;
|
||||
|
||||
case CON_IFVARVARAE:
|
||||
insptr++;
|
||||
tw = Gv_GetVarX(*insptr++);
|
||||
tw = ((uint32_t)tw >= (uint32_t)Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
VM_CONDITIONAL(tw);
|
||||
continue;
|
||||
|
||||
case CON_IFVARVARB:
|
||||
insptr++;
|
||||
tw = Gv_GetVarX(*insptr++);
|
||||
tw = ((uint32_t)tw < (uint32_t)Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
VM_CONDITIONAL(tw);
|
||||
continue;
|
||||
|
||||
case CON_IFVARVARBE:
|
||||
insptr++;
|
||||
tw = Gv_GetVarX(*insptr++);
|
||||
tw = ((uint32_t)tw <= (uint32_t)Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
VM_CONDITIONAL(tw);
|
||||
continue;
|
||||
|
||||
case CON_IFVARN:
|
||||
insptr++;
|
||||
tw = Gv_GetVarX(*insptr++);
|
||||
|
@ -5474,6 +5506,30 @@ finish_qsprintf:
|
|||
VM_CONDITIONAL(tw <= *insptr);
|
||||
continue;
|
||||
|
||||
case CON_IFVARA:
|
||||
insptr++;
|
||||
tw = Gv_GetVarX(*insptr++);
|
||||
VM_CONDITIONAL((uint32_t)tw > (uint32_t)*insptr);
|
||||
continue;
|
||||
|
||||
case CON_IFVARAE:
|
||||
insptr++;
|
||||
tw = Gv_GetVarX(*insptr++);
|
||||
VM_CONDITIONAL((uint32_t)tw >= (uint32_t)*insptr);
|
||||
continue;
|
||||
|
||||
case CON_IFVARB:
|
||||
insptr++;
|
||||
tw = Gv_GetVarX(*insptr++);
|
||||
VM_CONDITIONAL((uint32_t)tw < (uint32_t)*insptr);
|
||||
continue;
|
||||
|
||||
case CON_IFVARBE:
|
||||
insptr++;
|
||||
tw = Gv_GetVarX(*insptr++);
|
||||
VM_CONDITIONAL((uint32_t)tw <= (uint32_t)*insptr);
|
||||
continue;
|
||||
|
||||
case CON_IFPHEALTHL:
|
||||
insptr++;
|
||||
VM_CONDITIONAL(sprite[pPlayer->i].extra < *insptr);
|
||||
|
|
|
@ -163,6 +163,10 @@ const tokenmap_t altkeyw[] =
|
|||
{ "and", CON_ANDVARVAR },
|
||||
{ "or", CON_ORVARVAR },
|
||||
{ "xor", CON_XORVARVAR },
|
||||
{ "ifa", CON_IFVARVARA },
|
||||
{ "ifae", CON_IFVARVARAE },
|
||||
{ "ifb", CON_IFVARVARB },
|
||||
{ "ifbe", CON_IFVARVARBE },
|
||||
{ "ifl", CON_IFVARVARL },
|
||||
{ "ifle", CON_IFVARVARLE },
|
||||
{ "ifg", CON_IFVARVARG },
|
||||
|
@ -263,6 +267,10 @@ const char *keyw[] =
|
|||
"ifvarle",
|
||||
"ifvarg",
|
||||
"ifvarge",
|
||||
"ifvara",
|
||||
"ifvarae",
|
||||
"ifvarb",
|
||||
"ifvarbe",
|
||||
"ifvare",
|
||||
"ifvarn",
|
||||
"ifvarand",
|
||||
|
@ -277,6 +285,10 @@ const char *keyw[] =
|
|||
"ifvarvarle",
|
||||
"ifvarvarg",
|
||||
"ifvarvarge",
|
||||
"ifvarvara",
|
||||
"ifvarvarae",
|
||||
"ifvarvarb",
|
||||
"ifvarvarbe",
|
||||
"ifvarvare",
|
||||
"ifvarvarn",
|
||||
"ifvarvarand",
|
||||
|
|
|
@ -390,6 +390,10 @@ enum ScriptKeywords_t
|
|||
CON_IFVARLE,
|
||||
CON_IFVARG,
|
||||
CON_IFVARGE,
|
||||
CON_IFVARA,
|
||||
CON_IFVARAE,
|
||||
CON_IFVARB,
|
||||
CON_IFVARBE,
|
||||
CON_IFVARE,
|
||||
CON_IFVARN,
|
||||
CON_IFVARAND,
|
||||
|
@ -405,6 +409,10 @@ enum ScriptKeywords_t
|
|||
CON_IFVARVARLE,
|
||||
CON_IFVARVARG,
|
||||
CON_IFVARVARGE,
|
||||
CON_IFVARVARA,
|
||||
CON_IFVARVARAE,
|
||||
CON_IFVARVARB,
|
||||
CON_IFVARVARBE,
|
||||
CON_IFVARVARE,
|
||||
CON_IFVARVARN,
|
||||
CON_IFVARVARAND,
|
||||
|
|
|
@ -1096,6 +1096,46 @@ skip_check:
|
|||
}
|
||||
continue;
|
||||
|
||||
case CON_IFVARVARA:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
j = ((uint32_t)j > (uint32_t)Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
VM_DoConditional(j);
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_IFVARVARAE:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
j = ((uint32_t)j >= (uint32_t)Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
VM_DoConditional(j);
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_IFVARVARB:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
j = ((uint32_t)j < (uint32_t)Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
VM_DoConditional(j);
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_IFVARVARBE:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
j = ((uint32_t)j <= (uint32_t)Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
VM_DoConditional(j);
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_IFVARE:
|
||||
insptr++;
|
||||
{
|
||||
|
@ -1527,6 +1567,38 @@ badindex:
|
|||
}
|
||||
continue;
|
||||
|
||||
case CON_IFVARA:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
VM_DoConditional((uint32_t)j > (uint32_t)*insptr);
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_IFVARAE:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
VM_DoConditional((uint32_t)j >= (uint32_t)*insptr);
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_IFVARB:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
VM_DoConditional((uint32_t)j < (uint32_t)*insptr);
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_IFVARBE:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
VM_DoConditional((uint32_t)j <= (uint32_t)*insptr);
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_IFRND:
|
||||
VM_DoConditional(rnd(Gv_GetVarX(*(++insptr))));
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue