m32script: fix some commands breaking too early in case of a failed validation.

If one next instruction happened to be interpreted, madness would ensue,
because the pointer wouldn't be aligned on the "opcode" part anymore.
Also, with "seti", set current sprite index only after a successful validation.

git-svn-id: https://svn.eduke32.com/eduke32@2591 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-04-05 19:49:30 +00:00
parent 607774a982
commit c01109c483
2 changed files with 22 additions and 17 deletions

View file

@ -287,8 +287,8 @@ defstate fiddlewithlights
ifaimingsprite set k 1 else set k 0
ife k 1 ife sprite[searchwall].picnum SECTOREFFECTOR
ifge sprite[searchwall].lotag 49 ifle sprite[searchwall].lotag 50
set k 0
ifge sprite[searchwall].lotag 49 ifle sprite[searchwall].lotag 50
set k 0
ife k 1
{

View file

@ -2809,47 +2809,52 @@ dodefault:
// vvv CURSPR
case CON_SETI:
{
int32_t newcurspritei;
insptr++;
vm.g_i = Gv_GetVarX(*insptr++);
X_ERROR_INVALIDCI();
newcurspritei = Gv_GetVarX(*insptr++);
X_ERROR_INVALIDSPRI(newcurspritei);
vm.g_i = newcurspritei;
vm.g_sp = &sprite[vm.g_i];
continue;
}
case CON_SIZEAT:
insptr++;
insptr += 3;
X_ERROR_INVALIDSP();
vm.g_sp->xrepeat = (uint8_t) Gv_GetVarX(*insptr++);
vm.g_sp->yrepeat = (uint8_t) Gv_GetVarX(*insptr++);
vm.g_sp->xrepeat = (uint8_t) Gv_GetVarX(*(insptr-2));
vm.g_sp->yrepeat = (uint8_t) Gv_GetVarX(*(insptr-1));
continue;
case CON_CSTAT:
insptr++;
insptr += 2;
X_ERROR_INVALIDSP();
vm.g_sp->cstat = (int16_t) *insptr++;
vm.g_sp->cstat = (int16_t) *(insptr-1);
continue;
case CON_CSTATOR:
insptr++;
insptr += 2;
X_ERROR_INVALIDSP();
vm.g_sp->cstat |= (int16_t) Gv_GetVarX(*insptr++);
vm.g_sp->cstat |= (int16_t) Gv_GetVarX(*(insptr-1));
continue;
case CON_CLIPDIST:
insptr++;
insptr += 2;
X_ERROR_INVALIDSP();
vm.g_sp->clipdist = (int16_t) Gv_GetVarX(*insptr++);
vm.g_sp->clipdist = (uint8_t) Gv_GetVarX(*(insptr-1));
continue;
case CON_SPRITEPAL:
insptr++;
insptr += 2;
X_ERROR_INVALIDSP();
vm.g_sp->pal = Gv_GetVarX(*insptr++);
vm.g_sp->pal = Gv_GetVarX(*(insptr-1));
continue;
case CON_CACTOR:
insptr++;
insptr += 2;
X_ERROR_INVALIDSP();
vm.g_sp->picnum = Gv_GetVarX(*insptr++);
vm.g_sp->picnum = Gv_GetVarX(*(insptr-1));
continue;
case CON_SPGETLOTAG: