Restore previous behavior of "allsprites" iterator for CON_FOR and add "allspritesbystat" and "allspritesbysect"

git-svn-id: https://svn.eduke32.com/eduke32@6635 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-01-31 04:13:31 +00:00
parent 9c408fc26c
commit d9a5b4aa13
3 changed files with 28 additions and 0 deletions

View file

@ -1344,6 +1344,8 @@ const memberlabel_t PalDataLabels[]=
const tokenmap_t iter_tokens [] =
{
{ "allsprites", ITER_ALLSPRITES },
{ "allspritesbystat",ITER_ALLSPRITESBYSTAT },
{ "allspritesbysect",ITER_ALLSPRITESBYSECT },
{ "allsectors", ITER_ALLSECTORS },
{ "allwalls", ITER_ALLWALLS },
{ "activelights", ITER_ACTIVELIGHTS },

View file

@ -781,6 +781,8 @@ enum ProjectileLabel_t
enum IterationTypes_t
{
ITER_ALLSPRITES,
ITER_ALLSPRITESBYSTAT,
ITER_ALLSPRITESBYSECT,
ITER_ALLSECTORS,
ITER_ALLWALLS,
ITER_ACTIVELIGHTS,

View file

@ -5275,6 +5275,17 @@ finish_qsprintf:
switch (iterType)
{
case ITER_ALLSPRITES:
for (native_t jj=0; jj<MAXSPRITES; ++jj)
{
if (sprite[jj].statnum == MAXSTATUS)
continue;
Gv_SetVarX(returnVar, jj);
insptr = pNext;
VM_Execute(0);
}
break;
case ITER_ALLSPRITESBYSTAT:
for (native_t statNum=0; statNum<MAXSTATUS; ++statNum)
{
for (native_t jj=headspritestat[statNum]; jj>=0;)
@ -5287,6 +5298,19 @@ finish_qsprintf:
}
}
break;
case ITER_ALLSPRITESBYSECT:
for (native_t sectNum=0; sectNum<numsectors; ++sectNum)
{
for (native_t jj=headspritesect[sectNum]; jj>=0;)
{
int const kk=nextspritesect[jj];
Gv_SetVarX(returnVar, jj);
insptr = pNext;
VM_Execute(0);
jj=kk;
}
}
break;
case ITER_ALLSECTORS:
for (native_t jj=0; jj<numsectors; ++jj)
{