- handle SE02-SE04.

This commit is contained in:
Christoph Oelckers 2020-10-22 00:10:43 +02:00
parent 3e62550489
commit 2edc7168ca
4 changed files with 40 additions and 37 deletions

View file

@ -3221,10 +3221,10 @@ void handle_se30(DDukeActor *actor, int JIBS6)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void handle_se02(int i) void handle_se02(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;
@ -3246,7 +3246,7 @@ void handle_se02(int i)
{ {
t[0] = -1; //Stop the quake t[0] = -1; //Stop the quake
t[4] = -1; t[4] = -1;
deletesprite(i); deletesprite(actor);
return; return;
} }
else else
@ -3254,7 +3254,7 @@ void handle_se02(int i)
if ((t[0] & 31) == 8) if ((t[0] & 31) == 8)
{ {
earthquaketime = 48; earthquaketime = 48;
S_PlayActorSound(EARTHQUAKE, ps[screenpeek].i); S_PlayActorSound(EARTHQUAKE, ps[screenpeek].GetActor());
} }
if (abs(sc->floorheinum - t[5]) < 8) if (abs(sc->floorheinum - t[5]) < 8)
@ -3276,20 +3276,19 @@ void handle_se02(int i)
ps[p].bobposy += x; ps[p].bobposy += x;
} }
SectIterator it(s->sectnum); DukeSectIterator it(s->sectnum);
int j; while (auto a2 = it.Next())
while ((j = it.NextIndex()) >= 0)
{ {
auto sj = &sprite[j]; auto sj = &a2->s;
if (sj->picnum != SECTOREFFECTOR) if (sj->picnum != SECTOREFFECTOR)
{ {
sj->x += m; sj->x += m;
sj->y += x; sj->y += x;
setsprite(j, sj->x, sj->y, sj->z); setsprite(a2, sj->pos);
} }
} }
ms(i); ms(actor);
setsprite(i, s->x, s->y, s->z); setsprite(actor, s->pos);
} }
} }
@ -3299,24 +3298,26 @@ void handle_se02(int i)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void handle_se03(int i) void handle_se03(DDukeActor *actor)
{ {
auto 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[4] == 0) return; if (t[4] == 0) return;
int x, p = findplayer(s, &x); int x, p = findplayer(&actor->s, &x);
int palvals = s->owner; // this type hijacks the Owner field!!!
// if(t[5] > 0) { t[5]--; break; } // if(t[5] > 0) { t[5]--; break; }
if ((global_random / (sh + 1) & 31) < 4 && !t[2]) if ((global_random / (sh + 1) & 31) < 4 && !t[2])
{ {
// t[5] = 4+(global_random&7); // t[5] = 4+(global_random&7);
sc->ceilingpal = s->owner >> 8; sc->ceilingpal = palvals >> 8;
sc->floorpal = s->owner & 0xff; sc->floorpal = palvals & 0xff;
t[0] = s->shade + (global_random & 15); t[0] = s->shade + (global_random & 15);
} }
else else
@ -3351,21 +3352,23 @@ void handle_se03(int i)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void handle_se04(int i) void handle_se04(DDukeActor *actor)
{ {
auto 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;
int j; int j;
int palvals = s->owner; // this type hijacks the Owner field!!!
if ((global_random / (sh + 1) & 31) < 4) if ((global_random / (sh + 1) & 31) < 4)
{ {
t[1] = s->shade + (global_random & 15);//Got really bright t[1] = s->shade + (global_random & 15);//Got really bright
t[0] = s->shade + (global_random & 15); t[0] = s->shade + (global_random & 15);
sc->ceilingpal = s->owner >> 8; sc->ceilingpal = palvals >> 8;
sc->floorpal = s->owner & 0xff; sc->floorpal = palvals & 0xff;
j = 1; j = 1;
} }
else else
@ -3386,7 +3389,7 @@ void handle_se04(int i)
for (int x = sc->wallnum; x > 0; x--, wal++) for (int x = sc->wallnum; x > 0; x--, wal++)
{ {
if (j) wal->pal = (s->owner & 0xff); if (j) wal->pal = (palvals & 0xff);
else wal->pal = s->pal; else wal->pal = s->pal;
if (wal->hitag != 1) if (wal->hitag != 1)
@ -3397,10 +3400,10 @@ void handle_se04(int i)
} }
} }
SectIterator it(s->sectnum); DukeSectIterator it(s->sectnum);
while ((j = it.NextIndex()) >= 0) while (auto a2 = it.Next())
{ {
auto sj = &sprite[j]; auto sj = &a2->s;
if (sj->cstat & 16) if (sj->cstat & 16)
{ {
if (sc->ceilingstat & 1) if (sc->ceilingstat & 1)
@ -3410,7 +3413,7 @@ void handle_se04(int i)
} }
if (t[4]) if (t[4])
deletesprite(i); deletesprite(actor);
} }

View file

@ -3599,16 +3599,16 @@ void moveeffectors_d(void) //STATNUM 3
case SE_2_EARTHQUAKE: case SE_2_EARTHQUAKE:
handle_se02(i); handle_se02(&hittype[i]);
break; break;
//Flashing sector lights after reactor EXPLOSION2 //Flashing sector lights after reactor EXPLOSION2
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT: case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
handle_se03(i); handle_se03(&hittype[i]);
break; break;
case SE_4_RANDOM_LIGHTS: case SE_4_RANDOM_LIGHTS:
handle_se04(i); handle_se04(&hittype[i]);
break; break;
//BOSS //BOSS

View file

@ -3564,16 +3564,16 @@ void moveeffectors_r(void) //STATNUM 3
case SE_2_EARTHQUAKE: case SE_2_EARTHQUAKE:
handle_se02(i); handle_se02(&hittype[i]);
break; break;
//Flashing sector lights after reactor EXPLOSION2 //Flashing sector lights after reactor EXPLOSION2
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT: case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
handle_se03(i); handle_se03(&hittype[i]);
break; break;
case SE_4_RANDOM_LIGHTS: case SE_4_RANDOM_LIGHTS:
handle_se04(i); handle_se04(&hittype[i]);
break; break;
//BOSS //BOSS

View file

@ -67,9 +67,9 @@ void handle_se00(DDukeActor* i, int LASERLINE);
void handle_se01(DDukeActor* i); void handle_se01(DDukeActor* i);
void handle_se14(DDukeActor* i, bool checkstat, int RPG, int JIBS6); void handle_se14(DDukeActor* i, bool checkstat, int RPG, int JIBS6);
void handle_se30(DDukeActor* i, int JIBS6); void handle_se30(DDukeActor* i, int JIBS6);
void handle_se02(int i); void handle_se02(DDukeActor* i);
void handle_se03(int i); void handle_se03(DDukeActor* i);
void handle_se04(int i); void handle_se04(DDukeActor* i);
void handle_se05(int i, int FIRELASER); void handle_se05(int i, int FIRELASER);
void handle_se08(int i, bool checkhitag1); void handle_se08(int i, bool checkhitag1);
void handle_se10(int i, const int *); void handle_se10(int i, const int *);