- SE14 part 1

Doing this in smaller chunks because this function requires quite extensive adjustments.
This commit is contained in:
Christoph Oelckers 2020-11-01 07:51:50 +01:00
parent 1ce2600a43
commit e13b61f496

View file

@ -2794,8 +2794,9 @@ void handle_se01(DDukeActor *actor)
void handle_se14(int i, bool checkstat, int RPG, int JIBS6) void handle_se14(int i, bool checkstat, int RPG, int JIBS6)
{ {
spritetype* s = &sprite[i]; auto actor = &hittype[i];
auto t = &hittype[i].temp_data[0]; auto s = &actor->s;
int* t = &actor->temp_data[0];
auto sc = &sector[s->sectnum]; auto sc = &sector[s->sectnum];
int st = s->lotag; int st = s->lotag;
int sh = s->hitag; int sh = s->hitag;
@ -2837,24 +2838,24 @@ void handle_se14(int i, bool checkstat, int RPG, int JIBS6)
{ {
if (statstate) if (statstate)
{ {
if (!S_CheckSoundPlaying(hittype[i].lastvx)) if (!S_CheckSoundPlaying(actor->lastvx))
S_PlayActorSound(hittype[i].lastvx, i); S_PlayActorSound(actor->lastvx, actor);
} }
if ((!checkstat || !statstate) && (ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat & 1) && rnd(8))) if ((!checkstat || !statstate) && (ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat & 1) && rnd(8)))
{ {
int p = findplayer(s, &x); int p = findplayer(&actor->s, &x);
if (x < 20480) if (x < 20480)
{ {
j = s->ang; j = s->ang;
s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy); s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy);
fi.shoot(i, RPG); fi.shoot(actor->GetIndex(), RPG);
s->ang = j; s->ang = j;
} }
} }
} }
if (s->xvel <= 64 && statstate) if (s->xvel <= 64 && statstate)
S_StopSound(hittype[i].lastvx, i); S_StopSound(actor->lastvx, actor);
if ((sc->floorz - sc->ceilingz) < (108 << 8)) if ((sc->floorz - sc->ceilingz) < (108 << 8))
{ {
@ -2870,7 +2871,7 @@ void handle_se14(int i, bool checkstat, int RPG, int JIBS6)
ps[p].posy = s->y; ps[p].posy = s->y;
ps[p].cursectnum = s->sectnum; ps[p].cursectnum = s->sectnum;
setsprite(ps[p].i, s->x, s->y, s->z); setsprite(ps[p].GetActor(), s->pos);
quickkill(&ps[p]); quickkill(&ps[p]);
} }
} }
@ -2935,8 +2936,8 @@ void handle_se14(int i, bool checkstat, int RPG, int JIBS6)
} }
} }
ms(i); ms(actor);
setsprite(i, s->x, s->y, s->z); setsprite(actor, s->pos);
if ((sc->floorz - sc->ceilingz) < (108 << 8)) if ((sc->floorz - sc->ceilingz) < (108 << 8))
{ {