- rrra_specialstats.

This commit is contained in:
Christoph Oelckers 2020-10-22 22:21:40 +02:00
parent 63646e7c5c
commit 0ec7732bd4

View file

@ -1969,12 +1969,11 @@ void movetransports_r(void)
static void rrra_specialstats() static void rrra_specialstats()
{ {
int i, j; Collision coll;
DukeStatIterator it(117);
StatIterator it(117); while (auto act = it.Next())
while ((i = it.NextIndex()) >= 0)
{ {
auto s = &sprite[i]; auto s = &act->s;
if (s->hitag > 2) if (s->hitag > 2)
s->hitag = 0; s->hitag = 0;
if ((s->picnum == RRTILE8488 || s->picnum == RRTILE8490) && s->hitag != 2) if ((s->picnum == RRTILE8488 || s->picnum == RRTILE8490) && s->hitag != 2)
@ -1999,17 +1998,17 @@ static void rrra_specialstats()
s->extra--; s->extra--;
if (s->extra <= -104) if (s->extra <= -104)
{ {
fi.spawn(i, s->lotag); spawn(act, s->lotag);
deletesprite(i); deletesprite(act);
} }
} }
j = fi.movesprite(i, 0, 0, s->extra * 2, CLIPMASK0); movesprite_ex(act, 0, 0, s->extra * 2, CLIPMASK0, coll);
} }
it.Reset(118); it.Reset(118);
while ((i = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
auto s = &sprite[i]; auto s = &act->s;
if (s->hitag > 1) if (s->hitag > 1)
s->hitag = 0; s->hitag = 0;
if (s->hitag == 0) if (s->hitag == 0)
@ -2024,7 +2023,7 @@ static void rrra_specialstats()
if (s->extra <= -20) if (s->extra <= -20)
s->hitag = 0; s->hitag = 0;
} }
j = fi.movesprite(i, 0, 0, s->extra, CLIPMASK0); movesprite_ex(act, 0, 0, s->extra, CLIPMASK0, coll);
} }
if (ps[screenpeek].MamaEnd > 0) if (ps[screenpeek].MamaEnd > 0)
@ -2038,11 +2037,11 @@ static void rrra_specialstats()
if (enemysizecheat > 0) if (enemysizecheat > 0)
{ {
short ti; DukeSpriteIterator it;
for (ti = 0; ti < MAXSPRITES; ti++) while (auto act = it.Next())
{ {
auto tispr = &sprite[ti]; auto s = &act->s;
switch (tispr->picnum) switch (s->picnum)
{ {
//case 4049: //case 4049:
//case 4050: //case 4050:
@ -2084,15 +2083,15 @@ static void rrra_specialstats()
case MAMA: case MAMA:
if (enemysizecheat == 3) if (enemysizecheat == 3)
{ {
tispr->xrepeat = tispr->xrepeat << 1; s->xrepeat <<= 1;
tispr->yrepeat = tispr->yrepeat << 1; s->yrepeat <<= 1;
tispr->clipdist = mulscale7(tispr->xrepeat, tilesiz[tispr->picnum].x); s->clipdist = mulscale7(s->xrepeat, tilesiz[s->picnum].x);
} }
else if (enemysizecheat == 2) else if (enemysizecheat == 2)
{ {
tispr->xrepeat = tispr->xrepeat >> 1; s->xrepeat >>= 1;
tispr->yrepeat = tispr->yrepeat >> 1; s->yrepeat >>= 1;
tispr->clipdist = mulscale7(tispr->xrepeat, tilesiz[tispr->picnum].y); s->clipdist = mulscale7(s->xrepeat, tilesiz[s->picnum].y);
} }
break; break;
} }
@ -2102,9 +2101,9 @@ static void rrra_specialstats()
} }
it.Reset(121); it.Reset(121);
while ((i = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
auto s = &sprite[i]; auto s = &act->s;
s->extra++; s->extra++;
if (s->extra < 100) if (s->extra < 100)
{ {
@ -2115,7 +2114,7 @@ static void rrra_specialstats()
s->picnum = PIG + 7; s->picnum = PIG + 7;
s->extra = 1; s->extra = 1;
} }
fi.movesprite(i, 0, 0, -300, CLIPMASK0); movesprite_ex(act, 0, 0, -300, CLIPMASK0, coll);
if (sector[s->sectnum].ceilingz + (4 << 8) > s->z) if (sector[s->sectnum].ceilingz + (4 << 8) > s->z)
{ {
s->picnum = 0; s->picnum = 0;
@ -2124,51 +2123,51 @@ static void rrra_specialstats()
} }
else if (s->extra == 200) else if (s->extra == 200)
{ {
setsprite(i, s->x, s->y, sector[s->sectnum].floorz - 10); setsprite(act, s->x, s->y, sector[s->sectnum].floorz - 10);
s->extra = 1; s->extra = 1;
s->picnum = PIG + 11; s->picnum = PIG + 11;
fi.spawn(i, TRANSPORTERSTAR); spawn(act, TRANSPORTERSTAR);
} }
} }
it.Reset(119); it.Reset(119);
while ((i = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
auto s = &sprite[i]; auto s = &act->s;
if (s->hitag > 0) if (s->hitag > 0)
{ {
if (s->extra == 0) if (s->extra == 0)
{ {
s->hitag--; s->hitag--;
s->extra = 150; s->extra = 150;
fi.spawn(i, RABBIT); spawn(act, RABBIT);
} }
else else
s->extra--; s->extra--;
} }
} }
it.Reset(116); it.Reset(116);
while ((i = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
auto s = &sprite[i]; auto s = &act->s;
if (s->extra) if (s->extra)
{ {
if (s->extra == s->lotag) if (s->extra == s->lotag)
S_PlaySound(183); S_PlaySound(183);
s->extra--; s->extra--;
j = fi.movesprite(i, int j = movesprite_ex(act,
(s->hitag * sintable[(s->ang + 512) & 2047]) >> 14, (s->hitag * sintable[(s->ang + 512) & 2047]) >> 14,
(s->hitag * sintable[s->ang & 2047]) >> 14, (s->hitag * sintable[s->ang & 2047]) >> 14,
s->hitag << 1, CLIPMASK0); s->hitag << 1, CLIPMASK0, coll);
if (j > 0) if (j > 0)
{ {
S_PlayActorSound(PIPEBOMB_EXPLODE, i); S_PlayActorSound(PIPEBOMB_EXPLODE, act);
deletesprite(i); deletesprite(act);
} }
if (s->extra == 0) if (s->extra == 0)
{ {
S_PlaySound(215); S_PlaySound(215);
deletesprite(i); deletesprite(act);
earthquaketime = 32; earthquaketime = 32;
SetPlayerPal(&ps[myconnectindex], PalEntry(32, 32, 32, 48)); SetPlayerPal(&ps[myconnectindex], PalEntry(32, 32, 32, 48));
} }
@ -2176,9 +2175,9 @@ static void rrra_specialstats()
} }
it.Reset(115); it.Reset(115);
while ((i = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
auto s = &sprite[i]; auto s = &act->s;
if (s->extra) if (s->extra)
{ {
if (s->picnum != RRTILE8162) if (s->picnum != RRTILE8162)
@ -2201,9 +2200,9 @@ static void rrra_specialstats()
else else
{ {
s->picnum = RRTILE8162 + 2; s->picnum = RRTILE8162 + 2;
fi.spawn(i, BATTERYAMMO); spawn(act, BATTERYAMMO);
ps[screenpeek].SlotWin |= 1; ps[screenpeek].SlotWin |= 1;
S_PlayActorSound(52, i); S_PlayActorSound(52, act);
} }
} }
else if (rvar < 120) else if (rvar < 120)
@ -2215,9 +2214,9 @@ static void rrra_specialstats()
else else
{ {
s->picnum = RRTILE8162 + 6; s->picnum = RRTILE8162 + 6;
fi.spawn(i, HEAVYHBOMB); spawn(act, HEAVYHBOMB);
ps[screenpeek].SlotWin |= 2; ps[screenpeek].SlotWin |= 2;
S_PlayActorSound(52, i); S_PlayActorSound(52, act);
} }
} }
else if (rvar < 126) else if (rvar < 126)
@ -2229,9 +2228,9 @@ static void rrra_specialstats()
else else
{ {
s->picnum = RRTILE8162 + 5; s->picnum = RRTILE8162 + 5;
fi.spawn(i, SIXPAK); spawn(act, SIXPAK);
ps[screenpeek].SlotWin |= 4; ps[screenpeek].SlotWin |= 4;
S_PlayActorSound(52, i); S_PlayActorSound(52, act);
} }
} }
else else
@ -2243,9 +2242,9 @@ static void rrra_specialstats()
else else
{ {
s->picnum = RRTILE8162 + 4; s->picnum = RRTILE8162 + 4;
fi.spawn(i, ATOMICHEALTH); spawn(act, ATOMICHEALTH);
ps[screenpeek].SlotWin |= 8; ps[screenpeek].SlotWin |= 8;
S_PlayActorSound(52, i); S_PlayActorSound(52, act);
} }
} }
} }
@ -2253,9 +2252,9 @@ static void rrra_specialstats()
} }
it.Reset(122); it.Reset(122);
while ((i = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
auto s = &sprite[i]; auto s = &act->s;
if (s->extra) if (s->extra)
{ {
if (s->picnum != RRTILE8589) if (s->picnum != RRTILE8589)
@ -2278,9 +2277,9 @@ static void rrra_specialstats()
else else
{ {
s->picnum = RRTILE8589 + 5; s->picnum = RRTILE8589 + 5;
fi.spawn(i, BATTERYAMMO); spawn(act, BATTERYAMMO);
ps[screenpeek].SlotWin |= 1; ps[screenpeek].SlotWin |= 1;
S_PlayActorSound(342, i); S_PlayActorSound(342, act);
} }
} }
else if (rvar < 120) else if (rvar < 120)
@ -2292,9 +2291,9 @@ static void rrra_specialstats()
else else
{ {
s->picnum = RRTILE8589 + 6; s->picnum = RRTILE8589 + 6;
fi.spawn(i, HEAVYHBOMB); spawn(act, HEAVYHBOMB);
ps[screenpeek].SlotWin |= 2; ps[screenpeek].SlotWin |= 2;
S_PlayActorSound(342, i); S_PlayActorSound(342, act);
} }
} }
else if (rvar < 126) else if (rvar < 126)
@ -2306,9 +2305,9 @@ static void rrra_specialstats()
else else
{ {
s->picnum = RRTILE8589 + 2; s->picnum = RRTILE8589 + 2;
fi.spawn(i, SIXPAK); spawn(act, SIXPAK);
ps[screenpeek].SlotWin |= 4; ps[screenpeek].SlotWin |= 4;
S_PlayActorSound(342, i); S_PlayActorSound(342, act);
} }
} }
else else
@ -2320,9 +2319,9 @@ static void rrra_specialstats()
else else
{ {
s->picnum = RRTILE8589 + 3; s->picnum = RRTILE8589 + 3;
fi.spawn(i, ATOMICHEALTH); spawn(act, ATOMICHEALTH);
ps[screenpeek].SlotWin |= 8; ps[screenpeek].SlotWin |= 8;
S_PlayActorSound(342, i); S_PlayActorSound(342, act);
} }
} }
} }
@ -2330,12 +2329,11 @@ static void rrra_specialstats()
} }
it.Reset(123); it.Reset(123);
while ((i = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
auto s = &sprite[i]; if (act->s.lotag == 5)
if (s->lotag == 5)
if (!S_CheckSoundPlaying(330)) if (!S_CheckSoundPlaying(330))
S_PlayActorSound(330, i); S_PlayActorSound(330, act);
} }
} }