- handle_se18+19

This commit is contained in:
Christoph Oelckers 2020-10-22 00:30:22 +02:00
parent 5b096ea35e
commit 5d837176de
4 changed files with 65 additions and 83 deletions

View file

@ -4082,25 +4082,24 @@ void handle_se17(DDukeActor* actor)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void handle_se18(int i, bool morecheck) void handle_se18(DDukeActor *actor, bool morecheck)
{ {
spritetype* s = &sprite[i]; int* t = &actor->temp_data[0];
auto t = &hittype[i].temp_data[0]; auto sc = &sector[actor->s.sectnum];
auto sc = &sector[s->sectnum]; int st = actor->s.lotag;
int st = s->lotag; int sh = actor->s.hitag;
int sh = s->hitag;
if (t[0]) if (t[0])
{ {
if (s->pal) if (actor->s.pal)
{ {
if (s->ang == 512) if (actor->s.ang == 512)
{ {
sc->ceilingz -= sc->extra; sc->ceilingz -= sc->extra;
if (sc->ceilingz <= t[1]) if (sc->ceilingz <= t[1])
{ {
sc->ceilingz = t[1]; sc->ceilingz = t[1];
deletesprite(i); deletesprite(actor);
return; return;
} }
} }
@ -4109,38 +4108,35 @@ void handle_se18(int i, bool morecheck)
sc->floorz += sc->extra; sc->floorz += sc->extra;
if (morecheck) if (morecheck)
{ {
SectIterator it(s->sectnum); DukeSectIterator it(actor->s.sectnum);
int j; while (auto a2 = it.Next())
while ((j = it.NextIndex()) >= 0)
{ {
auto sj = &sprite[j]; if (a2->s.picnum == TILE_APLAYER && a2->GetOwner())
if (sj->picnum == TILE_APLAYER && sj->owner >= 0) if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz += sc->extra;
if (ps[sj->yvel].on_ground == 1) if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && a2->s.statnum != STAT_PROJECTILE)
ps[sj->yvel].posz += sc->extra;
if (sj->zvel == 0 && sj->statnum != STAT_EFFECTOR && sj->statnum != STAT_PROJECTILE)
{ {
hittype[j].bposz = sj->z += sc->extra; a2->bposz = a2->s.z += sc->extra;
hittype[j].floorz = sc->floorz; a2->floorz = sc->floorz;
} }
} }
} }
if (sc->floorz >= t[1]) if (sc->floorz >= t[1])
{ {
sc->floorz = t[1]; sc->floorz = t[1];
deletesprite(i); deletesprite(actor);
return; return;
} }
} }
} }
else else
{ {
if (s->ang == 512) if (actor->s.ang == 512)
{ {
sc->ceilingz += sc->extra; sc->ceilingz += sc->extra;
if (sc->ceilingz >= s->z) if (sc->ceilingz >= actor->s.z)
{ {
sc->ceilingz = s->z; sc->ceilingz = actor->s.z;
deletesprite(i); deletesprite(actor);
return; return;
} }
} }
@ -4149,32 +4145,29 @@ void handle_se18(int i, bool morecheck)
sc->floorz -= sc->extra; sc->floorz -= sc->extra;
if (morecheck) if (morecheck)
{ {
SectIterator it(s->sectnum); DukeSectIterator it(actor->s.sectnum);
int j; while (auto a2 = it.Next())
while ((j = it.NextIndex()) >= 0)
{ {
auto sj = &sprite[j]; if (a2->s.picnum == TILE_APLAYER && a2->GetOwner())
if (sj->picnum == TILE_APLAYER && sj->owner >= 0) if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz -= sc->extra;
if (ps[sj->yvel].on_ground == 1) if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && a2->s.statnum != STAT_PROJECTILE)
ps[sj->yvel].posz -= sc->extra;
if (sj->zvel == 0 && sj->statnum != STAT_EFFECTOR && sj->statnum != STAT_PROJECTILE)
{ {
hittype[j].bposz = sj->z -= sc->extra; a2->bposz = a2->s.z -= sc->extra;
hittype[j].floorz = sc->floorz; a2->floorz = sc->floorz;
} }
} }
} }
if (sc->floorz <= s->z) if (sc->floorz <= actor->s.z)
{ {
sc->floorz = s->z; sc->floorz = actor->s.z;
deletesprite(i); deletesprite(actor);
return; return;
} }
} }
} }
t[2]++; t[2]++;
if (t[2] >= s->hitag) if (t[2] >= actor->s.hitag)
{ {
t[2] = 0; t[2] = 0;
t[0] = 0; t[0] = 0;
@ -4188,13 +4181,12 @@ void handle_se18(int i, bool morecheck)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void handle_se19(int i, int BIGFORCE) void handle_se19(DDukeActor *actor, int BIGFORCE)
{ {
spritetype* s = &sprite[i]; int* t = &actor->temp_data[0];
auto t = &hittype[i].temp_data[0]; auto sc = &sector[actor->s.sectnum];
auto sc = &sector[s->sectnum]; int st = actor->s.lotag;
int st = s->lotag; int sh = actor->s.hitag;
int sh = s->hitag;
int j, x, q; int j, x, q;
if (t[0]) if (t[0])
@ -4218,56 +4210,46 @@ void handle_se19(int i, int BIGFORCE)
} }
if (sc->ceilingz < sc->floorz) if (sc->ceilingz < sc->floorz)
sc->ceilingz += sprite[i].yvel; sc->ceilingz += actor->s.yvel;
else else
{ {
sc->ceilingz = sc->floorz; sc->ceilingz = sc->floorz;
StatIterator it(STAT_EFFECTOR); DukeStatIterator it(STAT_EFFECTOR);
int j; while (auto a2 = it.Next())
while ((j = it.NextIndex()) >= 0)
{ {
auto sj = &sprite[j]; auto a2Owner = a2->GetOwner();
if (sj->lotag == 0 && sj->hitag == sh) if (a2->s.lotag == 0 && a2->s.hitag == sh && a2Owner)
{ {
q = sprite[sj->owner].sectnum; q = a2Owner->s.sectnum;
sector[sj->sectnum].floorpal = sector[sj->sectnum].ceilingpal = sector[a2->s.sectnum].floorpal = sector[a2->s.sectnum].ceilingpal = sector[q].floorpal;
sector[q].floorpal; sector[a2->s.sectnum].floorshade = sector[a2->s.sectnum].ceilingshade = sector[q].floorshade;
sector[sj->sectnum].floorshade = sector[sj->sectnum].ceilingshade = a2Owner->temp_data[0] = 2;
sector[q].floorshade;
hittype[sj->owner].temp_data[0] = 2;
} }
} }
deletesprite(i); deletesprite(actor);
return; return;
} }
} }
else //Not hit yet else //Not hit yet
{ {
j = fi.ifhitsectors(s->sectnum); auto hitter = fi.ifhitsectors(actor->s.sectnum);
if (j >= 0) if (hitter)
{ {
FTA(8, &ps[myconnectindex]); FTA(8, &ps[myconnectindex]);
StatIterator it(STAT_EFFECTOR); DukeStatIterator it(STAT_EFFECTOR);
int l; while (auto ac = it.Next())
while ((l = it.NextIndex()) >= 0)
{ {
auto sl = &sprite[l]; x = ac->s.lotag & 0x7fff;
x = sl->lotag & 0x7fff;
switch (x) switch (x)
{ {
case 0: case 0:
if (sl->hitag == sh) if (ac->s.hitag == sh && ac->GetOwner())
{ {
q = sl->sectnum; q = ac->s.sectnum;
sector[q].floorshade = sector[q].floorshade = sector[q].ceilingshade = ac->GetOwner()->s.shade;
sector[q].ceilingshade = sector[q].floorpal = sector[q].ceilingpal = ac->GetOwner()->s.pal;
sprite[sl->owner].shade;
sector[q].floorpal =
sector[q].ceilingpal =
sprite[sl->owner].pal;
} }
break; break;
@ -4276,11 +4258,11 @@ void handle_se19(int i, int BIGFORCE)
//case 18: //case 18:
case 19: case 19:
if (sh == sl->hitag) if (sh == ac->s.hitag)
if (hittype[l].temp_data[0] == 0) if (ac->temp_data[0] == 0)
{ {
hittype[l].temp_data[0] = 1; //Shut them all on ac->temp_data[0] = 1; //Shut them all on
sl->owner = i; ac->SetOwner(actor);
} }
break; break;

View file

@ -3652,11 +3652,11 @@ void moveeffectors_d(void) //STATNUM 3
break; break;
case SE_18_INCREMENTAL_SECTOR_RISE_FALL: case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
handle_se18(i, true); handle_se18(&hittype[i], true);
break; break;
case SE_19_EXPLOSION_LOWERS_CEILING: case SE_19_EXPLOSION_LOWERS_CEILING:
handle_se19(i, BIGFORCE); handle_se19(&hittype[i], BIGFORCE);
break; break;
case SE_20_STRETCH_BRIDGE: case SE_20_STRETCH_BRIDGE:

View file

@ -3623,11 +3623,11 @@ void moveeffectors_r(void) //STATNUM 3
break; break;
case SE_18_INCREMENTAL_SECTOR_RISE_FALL: case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
handle_se18(i, true); handle_se18(&hittype[i], true);
break; break;
case SE_19_EXPLOSION_LOWERS_CEILING: case SE_19_EXPLOSION_LOWERS_CEILING:
handle_se19(i, BIGFORCE); handle_se19(&hittype[i], BIGFORCE);
break; break;
case SE_20_STRETCH_BRIDGE: case SE_20_STRETCH_BRIDGE:

View file

@ -79,8 +79,8 @@ void handle_se13(DDukeActor* i);
void handle_se15(DDukeActor* i); void handle_se15(DDukeActor* i);
void handle_se16(DDukeActor* i, int REACTOR, int REACTOR2); void handle_se16(DDukeActor* i, int REACTOR, int REACTOR2);
void handle_se17(DDukeActor* i); void handle_se17(DDukeActor* i);
void handle_se18(int i, bool morecheck); void handle_se18(DDukeActor* i, bool morecheck);
void handle_se19(int i, int BIGFORCE); void handle_se19(DDukeActor* i, int BIGFORCE);
void handle_se20(int i); void handle_se20(int i);
void handle_se21(int i); void handle_se21(int i);
void handle_se22(int i); void handle_se22(int i);