- movefallers.

This commit is contained in:
Christoph Oelckers 2020-10-22 19:31:06 +02:00
parent 7e8be10b04
commit d9b6be83b3
2 changed files with 46 additions and 55 deletions

View file

@ -942,53 +942,50 @@ int ifhitbyweapon_d(DDukeActor *actor)
void movefallers_d(void) void movefallers_d(void)
{ {
short sect; short sect;
int i, j, x; int j, x;
StatIterator iti(STAT_FALLER); DukeStatIterator iti(STAT_FALLER);
while ((i = iti.NextIndex()) >= 0) while (auto act = iti.Next())
{ {
auto s = &sprite[i]; auto s = &act->s;
auto ht = &hittype[i];
sect = s->sectnum; sect = s->sectnum;
if (ht->temp_data[0] == 0) if (act->temp_data[0] == 0)
{ {
s->z -= (16 << 8); s->z -= (16 << 8);
ht->temp_data[1] = s->ang; act->temp_data[1] = s->ang;
x = s->extra; x = s->extra;
j = fi.ifhitbyweapon(&hittype[i]); j = fi.ifhitbyweapon(act);
if (j >= 0) if (j >= 0)
{ {
if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER) if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER)
{ {
if (s->extra <= 0) if (s->extra <= 0)
{ {
ht->temp_data[0] = 1; act->temp_data[0] = 1;
StatIterator itj(STAT_FALLER); DukeStatIterator itj(STAT_FALLER);
while ((j = itj.NextIndex()) >= 0) while (auto a2 = itj.Next())
{ {
auto sj = &sprite[j]; if (a2->s.hitag == s->hitag)
if (sj->hitag == s->hitag)
{ {
hittype[j].temp_data[0] = 1; a2->temp_data[0] = 1;
sj->cstat &= (65535 - 64); a2->s.cstat &= (65535 - 64);
if (sj->picnum == CEILINGSTEAM || sj->picnum == STEAM) if (a2->s.picnum == CEILINGSTEAM || a2->s.picnum == STEAM)
sj->cstat |= 32768; a2->s.cstat |= 32768;
} }
} }
} }
} }
else else
{ {
ht->extra = 0; act->extra = 0;
s->extra = x; s->extra = x;
} }
} }
s->ang = ht->temp_data[1]; s->ang = act->temp_data[1];
s->z += (16 << 8); s->z += (16 << 8);
} }
else if (ht->temp_data[0] == 1) else if (act->temp_data[0] == 1)
{ {
if (s->lotag > 0) if (s->lotag > 0)
{ {
@ -1004,7 +1001,7 @@ void movefallers_d(void)
if (s->xvel > 0) if (s->xvel > 0)
{ {
s->xvel -= 8; s->xvel -= 8;
ssp(i,CLIPMASK0); ssp(act, CLIPMASK0);
} }
if (fi.floorspace(s->sectnum)) x = 0; if (fi.floorspace(s->sectnum)) x = 0;
@ -1026,8 +1023,8 @@ void movefallers_d(void)
if ((sector[sect].floorz - s->z) < (16 << 8)) if ((sector[sect].floorz - s->z) < (16 << 8))
{ {
j = 1 + (krand() & 7); j = 1 + (krand() & 7);
for (x = 0; x < j; x++) RANDOMSCRAP(s, i); for (x = 0; x < j; x++) RANDOMSCRAP(act);
deletesprite(i); deletesprite(act);
} }
} }
} }

View file

@ -801,55 +801,48 @@ void respawn_rrra(DDukeActor* oldact, DDukeActor* newact)
void movefallers_r(void) void movefallers_r(void)
{ {
short sect, j; DukeStatIterator it(STAT_FALLER);
spritetype* s; while (auto act = it.Next())
int x;
StatIterator it(STAT_FALLER);
int i;
while ((i = it.NextIndex()) >= 0)
{ {
s = &sprite[i]; auto s = &act->s;
int sect = s->sectnum;
sect = s->sectnum; if (act->temp_data[0] == 0)
if (hittype[i].temp_data[0] == 0)
{ {
s->z -= (16 << 8); s->z -= (16 << 8);
hittype[i].temp_data[1] = s->ang; act->temp_data[1] = s->ang;
x = s->extra; int x = s->extra;
j = fi.ifhitbyweapon(&hittype[i]); int j = fi.ifhitbyweapon(act);
if (j >= 0) if (j >= 0)
{ {
if (j == RPG || (isRRRA() && j == RPG2) || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER) if (j == RPG || (isRRRA() && j == RPG2) || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER)
{ {
if (s->extra <= 0) if (s->extra <= 0)
{ {
hittype[i].temp_data[0] = 1; act->temp_data[0] = 1;
StatIterator it(STAT_FALLER); DukeStatIterator it(STAT_FALLER);
while ((j = it.NextIndex()) >= 0) while (auto ac2 = it.Next())
{ {
auto sj = &sprite[j]; if (ac2->s.hitag == s->hitag)
if (sj->hitag == sprite[i].hitag)
{ {
hittype[j].temp_data[0] = 1; ac2->temp_data[0] = 1;
sj->cstat &= (65535 - 64); ac2->s.cstat &= (65535 - 64);
if (sj->picnum == CEILINGSTEAM || sj->picnum == STEAM) if (ac2->s.picnum == CEILINGSTEAM || ac2->s.picnum == STEAM)
sj->cstat |= 32768; ac2->s.cstat |= 32768;
} }
} }
} }
} }
else else
{ {
hittype[i].extra = 0; act->extra = 0;
s->extra = x; s->extra = x;
} }
} }
s->ang = hittype[i].temp_data[1]; s->ang = act->temp_data[1];
s->z += (16 << 8); s->z += (16 << 8);
} }
else if (hittype[i].temp_data[0] == 1) else if (act->temp_data[0] == 1)
{ {
if (s->lotag > 0) if (s->lotag > 0)
{ {
@ -862,9 +855,10 @@ void movefallers_r(void)
if (s->xvel > 0) if (s->xvel > 0)
{ {
s->xvel -= 2; s->xvel -= 2;
ssp(i, CLIPMASK0); ssp(act, CLIPMASK0);
} }
int x;
if (fi.floorspace(s->sectnum)) x = 0; if (fi.floorspace(s->sectnum)) x = 0;
else else
{ {
@ -883,9 +877,9 @@ void movefallers_r(void)
} }
if ((sector[sect].floorz - s->z) < (16 << 8)) if ((sector[sect].floorz - s->z) < (16 << 8))
{ {
j = 1 + (krand() & 7); int j = 1 + (krand() & 7);
for (x = 0; x < j; x++) RANDOMSCRAP(s, i); for (x = 0; x < j; x++) RANDOMSCRAP(act);
deletesprite(i); deletesprite(act);
} }
} }
} }