mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Mapster32: style-cleanup check_spritelist_consistency() and VM_Execute(): 'for'.
DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@5018 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a1a79b001e
commit
7742d5a40a
2 changed files with 38 additions and 34 deletions
|
@ -730,7 +730,7 @@ static int32_t csc_s, csc_i;
|
||||||
// 1: corrupt, 0: OK
|
// 1: corrupt, 0: OK
|
||||||
static int32_t check_spritelist_consistency()
|
static int32_t check_spritelist_consistency()
|
||||||
{
|
{
|
||||||
int32_t s, i, ournumsprites=0;
|
int32_t ournumsprites=0;
|
||||||
static uint8_t havesprite[MAXSPRITES>>3];
|
static uint8_t havesprite[MAXSPRITES>>3];
|
||||||
|
|
||||||
csc_s = csc_i = -1;
|
csc_s = csc_i = -1;
|
||||||
|
@ -738,7 +738,7 @@ static int32_t check_spritelist_consistency()
|
||||||
if (Numsprites < 0 || Numsprites > MAXSPRITES)
|
if (Numsprites < 0 || Numsprites > MAXSPRITES)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (i=0; i<MAXSPRITES; i++)
|
for (int i=0; i<MAXSPRITES; i++)
|
||||||
{
|
{
|
||||||
const int32_t sectnum=sprite[i].sectnum, statnum=sprite[i].statnum;
|
const int32_t sectnum=sprite[i].sectnum, statnum=sprite[i].statnum;
|
||||||
|
|
||||||
|
@ -764,8 +764,9 @@ static int32_t check_spritelist_consistency()
|
||||||
|
|
||||||
Bmemset(havesprite, 0, (Numsprites+7)>>3);
|
Bmemset(havesprite, 0, (Numsprites+7)>>3);
|
||||||
|
|
||||||
for (s=0; s<numsectors; s++)
|
for (int s=0; s<numsectors; s++)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
csc_s = s;
|
csc_s = s;
|
||||||
|
|
||||||
for (i=headspritesect[s]; i>=0; i=nextspritesect[i])
|
for (i=headspritesect[s]; i>=0; i=nextspritesect[i])
|
||||||
|
@ -789,7 +790,7 @@ static int32_t check_spritelist_consistency()
|
||||||
}
|
}
|
||||||
|
|
||||||
csc_s = -1;
|
csc_s = -1;
|
||||||
for (i=0; i<MAXSPRITES; i++)
|
for (int i=0; i<MAXSPRITES; i++)
|
||||||
{
|
{
|
||||||
csc_i = i;
|
csc_i = i;
|
||||||
|
|
||||||
|
@ -800,8 +801,9 @@ static int32_t check_spritelist_consistency()
|
||||||
|
|
||||||
// STATUS LIST -- we now clear havesprite[] bits
|
// STATUS LIST -- we now clear havesprite[] bits
|
||||||
|
|
||||||
for (s=0; s<MAXSTATUS; s++)
|
for (int s=0; s<MAXSTATUS; s++)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
csc_s = s;
|
csc_s = s;
|
||||||
|
|
||||||
for (i=headspritestat[s]; i>=0; i=nextspritestat[i])
|
for (i=headspritestat[s]; i>=0; i=nextspritestat[i])
|
||||||
|
@ -827,7 +829,7 @@ static int32_t check_spritelist_consistency()
|
||||||
}
|
}
|
||||||
|
|
||||||
csc_s = -1;
|
csc_s = -1;
|
||||||
for (i=0; i<Numsprites; i++)
|
for (int i=0; i<Numsprites; i++)
|
||||||
{
|
{
|
||||||
csc_i = i;
|
csc_i = i;
|
||||||
|
|
||||||
|
|
|
@ -1265,19 +1265,19 @@ skip_check:
|
||||||
case CON_FOR: // special-purpose iteration
|
case CON_FOR: // special-purpose iteration
|
||||||
insptr++;
|
insptr++;
|
||||||
{
|
{
|
||||||
int32_t var = *insptr++, how=*insptr++, ii, jj;
|
const int32_t var = *insptr++, how = *insptr++;
|
||||||
int32_t parm2 = how<=ITER_DRAWNSPRITES ? 0 : Gv_GetVarX(*insptr++);
|
const int32_t parm2 = how<=ITER_DRAWNSPRITES ? 0 : Gv_GetVarX(*insptr++);
|
||||||
instype *end = insptr + *insptr, *beg = ++insptr;
|
instype *const end = insptr + *insptr, *const beg = ++insptr;
|
||||||
int32_t vm_i_bak = vm.g_i;
|
const int32_t vm_i_bak = vm.g_i;
|
||||||
tspritetype *vm_sp_bak = vm.g_sp;
|
tspritetype *const vm_sp_bak = vm.g_sp;
|
||||||
int16_t endwall;
|
|
||||||
|
|
||||||
if (vm.flags&VMFLAG_ERROR) continue;
|
if (vm.flags&VMFLAG_ERROR)
|
||||||
|
continue;
|
||||||
|
|
||||||
switch (how)
|
switch (how)
|
||||||
{
|
{
|
||||||
case ITER_ALLSPRITES:
|
case ITER_ALLSPRITES:
|
||||||
for (jj=0; jj<MAXSPRITES && !vm.flags; jj++)
|
for (int jj=0; jj<MAXSPRITES && !vm.flags; jj++)
|
||||||
{
|
{
|
||||||
if (sprite[jj].statnum == MAXSTATUS)
|
if (sprite[jj].statnum == MAXSTATUS)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1289,7 +1289,7 @@ skip_check:
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ITER_ALLSECTORS:
|
case ITER_ALLSECTORS:
|
||||||
for (jj=0; jj<numsectors && !vm.flags; jj++)
|
for (int jj=0; jj<numsectors && !vm.flags; jj++)
|
||||||
{
|
{
|
||||||
Gv_SetVarX(var, jj);
|
Gv_SetVarX(var, jj);
|
||||||
insptr = beg;
|
insptr = beg;
|
||||||
|
@ -1297,7 +1297,7 @@ skip_check:
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ITER_ALLWALLS:
|
case ITER_ALLWALLS:
|
||||||
for (jj=0; jj<numwalls && !vm.flags; jj++)
|
for (int jj=0; jj<numwalls && !vm.flags; jj++)
|
||||||
{
|
{
|
||||||
Gv_SetVarX(var, jj);
|
Gv_SetVarX(var, jj);
|
||||||
insptr = beg;
|
insptr = beg;
|
||||||
|
@ -1306,7 +1306,7 @@ skip_check:
|
||||||
break;
|
break;
|
||||||
case ITER_ACTIVELIGHTS:
|
case ITER_ACTIVELIGHTS:
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
for (jj=0; jj<PR_MAXLIGHTS; jj++)
|
for (int jj=0; jj<PR_MAXLIGHTS; jj++)
|
||||||
{
|
{
|
||||||
if (!prlights[jj].flags.active)
|
if (!prlights[jj].flags.active)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1321,9 +1321,9 @@ skip_check:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITER_SELSPRITES:
|
case ITER_SELSPRITES:
|
||||||
for (ii=0; ii<highlightcnt && !vm.flags; ii++)
|
for (int ii=0; ii<highlightcnt && !vm.flags; ii++)
|
||||||
{
|
{
|
||||||
jj = highlight[ii];
|
int jj = highlight[ii];
|
||||||
if (jj&0xc000)
|
if (jj&0xc000)
|
||||||
{
|
{
|
||||||
jj &= (MAXSPRITES-1);
|
jj &= (MAXSPRITES-1);
|
||||||
|
@ -1336,18 +1336,18 @@ skip_check:
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ITER_SELSECTORS:
|
case ITER_SELSECTORS:
|
||||||
for (ii=0; ii<highlightsectorcnt && !vm.flags; ii++)
|
for (int ii=0; ii<highlightsectorcnt && !vm.flags; ii++)
|
||||||
{
|
{
|
||||||
jj=highlightsector[ii];
|
int jj=highlightsector[ii];
|
||||||
Gv_SetVarX(var, jj);
|
Gv_SetVarX(var, jj);
|
||||||
insptr = beg;
|
insptr = beg;
|
||||||
VM_Execute(1);
|
VM_Execute(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ITER_SELWALLS:
|
case ITER_SELWALLS:
|
||||||
for (ii=0; ii<highlightcnt && !vm.flags; ii++)
|
for (int ii=0; ii<highlightcnt && !vm.flags; ii++)
|
||||||
{
|
{
|
||||||
jj=highlight[ii];
|
int jj=highlight[ii];
|
||||||
if (jj&0xc000)
|
if (jj&0xc000)
|
||||||
continue;
|
continue;
|
||||||
Gv_SetVarX(var, jj);
|
Gv_SetVarX(var, jj);
|
||||||
|
@ -1356,7 +1356,7 @@ skip_check:
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ITER_DRAWNSPRITES:
|
case ITER_DRAWNSPRITES:
|
||||||
for (ii=0; ii<spritesortcnt && !vm.flags; ii++)
|
for (int ii=0; ii<spritesortcnt && !vm.flags; ii++)
|
||||||
{
|
{
|
||||||
vm.g_sp = (tspritetype *)&sprite[MAXSPRITES-1];
|
vm.g_sp = (tspritetype *)&sprite[MAXSPRITES-1];
|
||||||
Bmemcpy(&sprite[MAXSPRITES-1], &tsprite[ii], sizeof(tspritetype));
|
Bmemcpy(&sprite[MAXSPRITES-1], &tsprite[ii], sizeof(tspritetype));
|
||||||
|
@ -1369,7 +1369,7 @@ skip_check:
|
||||||
case ITER_SPRITESOFSECTOR:
|
case ITER_SPRITESOFSECTOR:
|
||||||
if (parm2 < 0 || parm2 >= MAXSECTORS)
|
if (parm2 < 0 || parm2 >= MAXSECTORS)
|
||||||
goto badindex;
|
goto badindex;
|
||||||
for (jj=headspritesect[parm2]; jj>=0 && !vm.flags; jj=nextspritesect[jj])
|
for (int jj=headspritesect[parm2]; jj>=0 && !vm.flags; jj=nextspritesect[jj])
|
||||||
{
|
{
|
||||||
Gv_SetVarX(var, jj);
|
Gv_SetVarX(var, jj);
|
||||||
vm.g_i = jj;
|
vm.g_i = jj;
|
||||||
|
@ -1381,7 +1381,7 @@ skip_check:
|
||||||
case ITER_WALLSOFSECTOR:
|
case ITER_WALLSOFSECTOR:
|
||||||
if (parm2 < 0 || parm2 >= MAXSECTORS)
|
if (parm2 < 0 || parm2 >= MAXSECTORS)
|
||||||
goto badindex;
|
goto badindex;
|
||||||
for (jj=sector[parm2].wallptr, endwall=jj+sector[parm2].wallnum-1;
|
for (int jj=sector[parm2].wallptr, endwall=jj+sector[parm2].wallnum-1;
|
||||||
jj<=endwall && !vm.flags; jj++)
|
jj<=endwall && !vm.flags; jj++)
|
||||||
{
|
{
|
||||||
Gv_SetVarX(var, jj);
|
Gv_SetVarX(var, jj);
|
||||||
|
@ -1392,7 +1392,8 @@ skip_check:
|
||||||
case ITER_LOOPOFWALL:
|
case ITER_LOOPOFWALL:
|
||||||
if (parm2 < 0 || parm2 >= numwalls)
|
if (parm2 < 0 || parm2 >= numwalls)
|
||||||
goto badindex;
|
goto badindex;
|
||||||
jj = parm2;
|
{
|
||||||
|
int jj = parm2;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Gv_SetVarX(var, jj);
|
Gv_SetVarX(var, jj);
|
||||||
|
@ -1401,9 +1402,10 @@ skip_check:
|
||||||
jj = wall[jj].point2;
|
jj = wall[jj].point2;
|
||||||
}
|
}
|
||||||
while (jj != parm2 && !vm.flags);
|
while (jj != parm2 && !vm.flags);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ITER_RANGE:
|
case ITER_RANGE:
|
||||||
for (jj=0; jj<parm2 && !vm.flags; jj++)
|
for (int jj=0; jj<parm2 && !vm.flags; jj++)
|
||||||
{
|
{
|
||||||
Gv_SetVarX(var, jj);
|
Gv_SetVarX(var, jj);
|
||||||
insptr = beg;
|
insptr = beg;
|
||||||
|
|
Loading…
Reference in a new issue