- movecrack, movefireext, moveviewscreen.

This commit is contained in:
Christoph Oelckers 2020-10-22 19:40:14 +02:00
parent a4ac7764de
commit dc75037d01
2 changed files with 52 additions and 58 deletions

View file

@ -1208,26 +1208,25 @@ static void movetripbomb(DDukeActor *actor)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void movecrack(int i) static void movecrack(DDukeActor* actor)
{ {
auto s = &sprite[i]; auto s = &actor->s;
auto t = &hittype[i].temp_data[0]; int* t = &actor->temp_data[0];
if (s->hitag > 0) if (s->hitag > 0)
{ {
t[0] = s->cstat; t[0] = s->cstat;
t[1] = s->ang; t[1] = s->ang;
int j = fi.ifhitbyweapon(&hittype[i]); int j = fi.ifhitbyweapon(actor);
if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER) if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER)
{ {
StatIterator it(STAT_STANDABLE); DukeStatIterator it(STAT_STANDABLE);
while ((j = it.NextIndex()) >= 0) while (auto a1 = it.Next())
{ {
auto sj = &sprite[j]; if (s->hitag == a1->s.hitag && (a1->s.picnum == OOZFILTER || a1->s.picnum == SEENINE))
if (s->hitag == sj->hitag && (sj->picnum == OOZFILTER || sj->picnum == SEENINE)) if (a1->s.shade != -32)
if (sj->shade != -32) a1->s.shade = -32;
sj->shade = -32;
} }
detonate(i, EXPLOSION2); detonate(actor, EXPLOSION2);
} }
else else
{ {
@ -1244,46 +1243,43 @@ static void movecrack(int i)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void movefireext(int i) static void movefireext(DDukeActor* actor)
{ {
int j = fi.ifhitbyweapon(&hittype[i]); int j = fi.ifhitbyweapon(actor);
if (j == -1) return; if (j == -1) return;
auto s = &sprite[i]; int* t = &actor->temp_data[0];
auto t = &hittype[i].temp_data[0];
for (int k = 0; k < 16; k++) for (int k = 0; k < 16; k++)
{ {
j = EGS(sprite[i].sectnum, sprite[i].x, sprite[i].y, sprite[i].z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (sprite[i].zvel >> 2), i, 5); auto spawned = EGS(actor->s.sectnum, actor->s.x, actor->s.y, actor->s.z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->s.zvel >> 2), actor, 5);
sprite[j].pal = 2; spawned->s.pal = 2;
} }
fi.spawn(i, EXPLOSION2); spawn(actor, EXPLOSION2);
S_PlayActorSound(PIPEBOMB_EXPLODE, i); S_PlayActorSound(PIPEBOMB_EXPLODE, actor);
S_PlayActorSound(GLASS_HEAVYBREAK, i); S_PlayActorSound(GLASS_HEAVYBREAK, actor);
if (s->hitag > 0) if (actor->s.hitag > 0)
{ {
StatIterator it(STAT_STANDABLE); DukeStatIterator it(STAT_STANDABLE);
int j; while (auto a1 = it.Next())
while ((j = it.NextIndex()) >= 0)
{ {
auto sj = &sprite[j]; if (actor->s.hitag == a1->s.hitag && (a1->s.picnum == OOZFILTER || a1->s.picnum == SEENINE))
if (s->hitag == sj->hitag && (sj->picnum == OOZFILTER || sj->picnum == SEENINE)) if (a1->s.shade != -32)
if (sj->shade != -32) a1->s.shade = -32;
sj->shade = -32;
} }
int x = s->extra; int x = actor->s.extra;
fi.spawn(i, EXPLOSION2); spawn(actor, EXPLOSION2);
fi.hitradius(&hittype[i], pipebombblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x); fi.hitradius(actor, pipebombblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x);
S_PlayActorSound(PIPEBOMB_EXPLODE, i); S_PlayActorSound(PIPEBOMB_EXPLODE, actor);
detonate(i, EXPLOSION2); detonate(actor, EXPLOSION2);
} }
else else
{ {
fi.hitradius(&hittype[i], seenineblastradius, 10, 15, 20, 25); fi.hitradius(actor, seenineblastradius, 10, 15, 20, 25);
deletesprite(i); deletesprite(actor);
} }
} }
@ -1293,27 +1289,26 @@ static void movefireext(int i)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void moveviewscreen(int i) static void moveviewscreen(DDukeActor* actor)
{ {
auto s = &sprite[i]; if (actor->s.xrepeat == 0) deletesprite(actor);
if (s->xrepeat == 0) deletesprite(i);
else else
{ {
int x; int x;
findplayer(s, &x); findplayer(&actor->s, &x);
if (x < 2048) if (x < 2048)
{ {
#if 0 #if 0
if (sprite[i].yvel == 1) if (actor->s.yvel == 1)
camsprite = i; camsprite = i;
#endif #endif
} }
else if (camsprite != -1 && hittype[i].temp_data[0] == 1) else if (camsprite != -1 && actor->temp_data[0] == 1)
{ {
camsprite = -1; camsprite = -1;
s->yvel = 0; actor->s.yvel = 0;
hittype[i].temp_data[0] = 0; actor->temp_data[0] = 0;
} }
} }
} }
@ -1478,12 +1473,12 @@ void movestandables_d(void)
else if (picnum >= CRACK1 && picnum <= CRACK1 + 3) else if (picnum >= CRACK1 && picnum <= CRACK1 + 3)
{ {
movecrack(i); movecrack(&hittype[i]);
} }
else if (picnum == FIREEXT) else if (picnum == FIREEXT)
{ {
movefireext(i); movefireext(&hittype[i]);
} }
else if (picnum == OOZFILTER || picnum == SEENINE || picnum == SEENINEDEAD || picnum == (SEENINEDEAD + 1)) else if (picnum == OOZFILTER || picnum == SEENINE || picnum == SEENINEDEAD || picnum == (SEENINEDEAD + 1))
@ -1498,7 +1493,7 @@ void movestandables_d(void)
else if (picnum == VIEWSCREEN || picnum == VIEWSCREEN2) else if (picnum == VIEWSCREEN || picnum == VIEWSCREEN2)
{ {
moveviewscreen(i); moveviewscreen(&hittype[i]);
} }
else if (picnum == TRASH) else if (picnum == TRASH)

View file

@ -898,26 +898,25 @@ void movefallers_r(void)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void movecrack(int i) static void movecrack(DDukeActor* actor)
{ {
auto s = &sprite[i]; auto s = &actor->s;
auto t = &hittype[i].temp_data[0]; int* t = &actor->temp_data[0];
if (s->hitag > 0) if (s->hitag > 0)
{ {
t[0] = s->cstat; t[0] = s->cstat;
t[1] = s->ang; t[1] = s->ang;
int j = fi.ifhitbyweapon(&hittype[i]); int j = fi.ifhitbyweapon(actor);
if (j == RPG || (isRRRA() && j == RPG2) || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER) if (j == RPG || (isRRRA() && j == RPG2) || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER)
{ {
StatIterator it(STAT_STANDABLE); DukeStatIterator it(STAT_STANDABLE);
while ((j = it.NextIndex()) >= 0) while (auto a1 = it.Next())
{ {
auto sj = &sprite[j]; if (s->hitag == a1->s.hitag && (a1->s.picnum == OOZFILTER || a1->s.picnum == SEENINE))
if (s->hitag == sj->hitag && (sj->picnum == OOZFILTER || sj->picnum == SEENINE)) if (a1->s.shade != -32)
if (sj->shade != -32) a1->s.shade = -32;
sj->shade = -32;
} }
detonate(i, EXPLOSION2); detonate(actor, EXPLOSION2);
} }
else else
{ {
@ -1036,7 +1035,7 @@ void movestandables_r(void)
else if (picnum >= CRACK1 && picnum <= CRACK1 + 3) else if (picnum >= CRACK1 && picnum <= CRACK1 + 3)
{ {
movecrack(i); movecrack(&hittype[i]);
} }
else if (picnum == OOZFILTER || picnum == SEENINE || picnum == SEENINEDEAD || picnum == (SEENINEDEAD + 1)) else if (picnum == OOZFILTER || picnum == SEENINE || picnum == SEENINEDEAD || picnum == (SEENINEDEAD + 1))