- handle_se11-13.

This commit is contained in:
Christoph Oelckers 2020-10-22 00:20:47 +02:00
parent 83a9d99bd9
commit b585192721
4 changed files with 51 additions and 58 deletions

View file

@ -3651,10 +3651,10 @@ void handle_se10(DDukeActor* actor, const int* specialtags)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void handle_se11(int i) void handle_se11(DDukeActor *actor)
{ {
spritetype* s = &sprite[i]; auto s = &actor->s;
auto t = &hittype[i].temp_data[0]; 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;
@ -3673,27 +3673,26 @@ void handle_se11(int i)
for (int j = startwall; j < endwall; j++) for (int j = startwall; j < endwall; j++)
{ {
StatIterator it(STAT_ACTOR); DukeStatIterator it(STAT_ACTOR);
int k; while (auto ac = it.Next())
while ((k = it.NextIndex()) >= 0)
{ {
auto sk = &sprite[k]; auto sk = &ac->s;
if (sk->extra > 0 && badguy(&sprite[k]) && clipinsidebox(sk->x, sk->y, j, 256L) == 1) if (sk->extra > 0 && badguy(ac) && clipinsidebox(sk->x, sk->y, j, 256L) == 1)
return; return;
} }
it.Reset(STAT_PLAYER); it.Reset(STAT_PLAYER);
while ((k = it.NextIndex()) >= 0) while (auto ac = it.Next())
{ {
auto sk = &sprite[k]; auto sk = &ac->s;
if (sk->owner >= 0 && clipinsidebox(sk->x, sk->y, j, 144L) == 1) if (ac->GetOwner() && clipinsidebox(sk->x, sk->y, j, 144L) == 1)
{ {
t[5] = 8; // Delay t[5] = 8; // Delay
k = (s->yvel >> 3) * t[3]; int k = (s->yvel >> 3) * t[3];
t[2] -= k; t[2] -= k;
t[4] -= k; t[4] -= k;
ms(i); ms(actor);
setsprite(i, s->x, s->y, s->z); setsprite(actor, s->pos);
return; return;
} }
} }
@ -3702,15 +3701,15 @@ void handle_se11(int i)
int k = (s->yvel >> 3) * t[3]; int k = (s->yvel >> 3) * t[3];
t[2] += k; t[2] += k;
t[4] += k; t[4] += k;
ms(i); ms(actor);
setsprite(i, s->x, s->y, s->z); setsprite(actor, s->pos);
if (t[4] <= -511 || t[4] >= 512) if (t[4] <= -511 || t[4] >= 512)
{ {
t[4] = 0; t[4] = 0;
t[2] &= 0xffffff00; t[2] &= 0xffffff00;
ms(i); ms(actor);
setsprite(i, s->x, s->y, s->z); setsprite(actor, s->pos);
} }
} }
} }
@ -3721,10 +3720,10 @@ void handle_se11(int i)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void handle_se12(int i, int planeonly) void handle_se12(DDukeActor *actor, int planeonly)
{ {
spritetype* s = &sprite[i]; auto s = &actor->s;
auto t = &hittype[i].temp_data[0]; 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;
@ -3745,22 +3744,20 @@ void handle_se12(int i, int planeonly)
sc->ceilingshade = t[2]; sc->ceilingshade = t[2];
t[0] = 0; t[0] = 0;
SectIterator it(s->sectnum); DukeSectIterator it(s->sectnum);
int j; while (auto a2 = it.Next())
while ((j = it.NextIndex()) >= 0)
{ {
auto sj = &sprite[j]; if (a2->s.cstat & 16)
if (sj->cstat & 16)
{ {
if (sc->ceilingstat & 1) if (sc->ceilingstat & 1)
sj->shade = sc->ceilingshade; a2->s.shade = sc->ceilingshade;
else sj->shade = sc->floorshade; else a2->s.shade = sc->floorshade;
} }
} }
if (t[3] == 1) if (t[3] == 1)
{ {
deletesprite(i); deletesprite(actor);
return; return;
} }
} }
@ -3786,16 +3783,14 @@ void handle_se12(int i, int planeonly)
} }
else t[0] = 2; else t[0] = 2;
SectIterator it(s->sectnum); DukeSectIterator it(s->sectnum);
int j; while (auto a2 = it.Next())
while ((j = it.NextIndex()) >= 0)
{ {
auto sj = &sprite[j]; if (a2->s.cstat & 16)
if (sj->cstat & 16)
{ {
if (sc->ceilingstat & 1) if (sc->ceilingstat & 1)
sj->shade = sc->ceilingshade; a2->s.shade = sc->ceilingshade;
else sj->shade = sc->floorshade; else a2->s.shade = sc->floorshade;
} }
} }
} }
@ -3807,20 +3802,20 @@ void handle_se12(int i, int planeonly)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void handle_se13(int i) void handle_se13(DDukeActor* actor)
{ {
spritetype* s = &sprite[i]; auto s = &actor->s;
auto t = &hittype[i].temp_data[0]; 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;
if (t[2]) if (t[2])
{ {
int j = (sprite[i].yvel << 5) | 1; int j = (s->yvel << 5) | 1;
if (s->ang == 512) if (s->ang == 512)
{ {
if (s->owner) if (s->owner) // hijacked!
{ {
if (abs(t[0] - sc->ceilingz) >= j) if (abs(t[0] - sc->ceilingz) >= j)
sc->ceilingz += sgn(t[0] - sc->ceilingz) * j; sc->ceilingz += sgn(t[0] - sc->ceilingz) * j;
@ -3860,24 +3855,22 @@ void handle_se13(int i)
if (ps[0].one_parallax_sectnum >= 0) if (ps[0].one_parallax_sectnum >= 0)
{ {
sc->ceilingpicnum = sc->ceilingpicnum = sector[ps[0].one_parallax_sectnum].ceilingpicnum;
sector[ps[0].one_parallax_sectnum].ceilingpicnum; sc->ceilingshade = sector[ps[0].one_parallax_sectnum].ceilingshade;
sc->ceilingshade =
sector[ps[0].one_parallax_sectnum].ceilingshade;
} }
} }
} }
t[2]++; t[2]++;
if (t[2] > 256) if (t[2] > 256)
{ {
deletesprite(i); deletesprite(actor);
return; return;
} }
} }
if (t[2] == 4 && s->ang != 512) if (t[2] == 4 && s->ang != 512)
for (int x = 0; x < 7; x++) RANDOMSCRAP(s, i); for (int x = 0; x < 7; x++) RANDOMSCRAP(actor);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View file

@ -3628,15 +3628,15 @@ void moveeffectors_d(void) //STATNUM 3
break; break;
} }
case SE_11_SWINGING_DOOR: case SE_11_SWINGING_DOOR:
handle_se11(i); handle_se11(&hittype[i]);
break; break;
case SE_12_LIGHT_SWITCH: case SE_12_LIGHT_SWITCH:
handle_se12(i); handle_se12(&hittype[i]);
break; break;
case SE_13_EXPLOSIVE: case SE_13_EXPLOSIVE:
handle_se13(i); handle_se13(&hittype[i]);
break; break;
case SE_15_SLIDING_DOOR: case SE_15_SLIDING_DOOR:

View file

@ -3590,24 +3590,24 @@ void moveeffectors_r(void) //STATNUM 3
handle_se10(&hittype[i], nullptr); handle_se10(&hittype[i], nullptr);
break; break;
case SE_11_SWINGING_DOOR: case SE_11_SWINGING_DOOR:
handle_se11(i); handle_se11(&hittype[i]);
break; break;
case SE_12_LIGHT_SWITCH: case SE_12_LIGHT_SWITCH:
handle_se12(i); handle_se12(&hittype[i]);
break; break;
case SE_47_LIGHT_SWITCH: case SE_47_LIGHT_SWITCH:
if (isRRRA()) handle_se12(i, 1); if (isRRRA()) handle_se12(&hittype[i], 1);
break; break;
case SE_48_LIGHT_SWITCH: case SE_48_LIGHT_SWITCH:
if (isRRRA()) handle_se12(i, 2); if (isRRRA()) handle_se12(&hittype[i], 2);
break; break;
case SE_13_EXPLOSIVE: case SE_13_EXPLOSIVE:
handle_se13(i); handle_se13(&hittype[i]);
break; break;
case SE_15_SLIDING_DOOR: case SE_15_SLIDING_DOOR:

View file

@ -73,9 +73,9 @@ void handle_se04(DDukeActor* i);
void handle_se05(DDukeActor* i, int FIRELASER); void handle_se05(DDukeActor* i, int FIRELASER);
void handle_se08(DDukeActor* i, bool checkhitag1); void handle_se08(DDukeActor* i, bool checkhitag1);
void handle_se10(DDukeActor* i, const int *); void handle_se10(DDukeActor* i, const int *);
void handle_se11(int i); void handle_se11(DDukeActor* i);
void handle_se12(int i, int planeonly = 0); void handle_se12(DDukeActor* i, int planeonly = 0);
void handle_se13(int i); void handle_se13(DDukeActor* i);
void handle_se15(int i); void handle_se15(int i);
void handle_se16(int i, int REACTOR, int REACTOR2); void handle_se16(int i, int REACTOR, int REACTOR2);
void handle_se17(int i); void handle_se17(int i);