- removed floorzptr and ceilingzptr.

These were obstacles for further changes.
This commit is contained in:
Christoph Oelckers 2022-02-03 00:50:36 +01:00
parent c84d75b8bf
commit 8325e7369f
3 changed files with 30 additions and 32 deletions

View file

@ -253,8 +253,6 @@ struct sectortype
void set_int_floorz(int cc, bool temp = false);
void add_int_ceilingz(int cc, bool temp = false);
void add_int_floorz(int cc, bool temp = false);
int32_t* ceilingzptr(bool temp = false);
int32_t* floorzptr(bool temp = false);
#endif
@ -695,16 +693,6 @@ inline void sectortype::add_int_floorz(int cc, bool temp)
__int_floorz += cc;
if (!temp) MarkVerticesForSector(sector.IndexOf(this));
}
inline int32_t* sectortype::ceilingzptr(bool temp)
{
if (!temp) MarkVerticesForSector(sector.IndexOf(this));
return &__int_ceilingz;
}
inline int32_t* sectortype::floorzptr(bool temp)
{
if (!temp) MarkVerticesForSector(sector.IndexOf(this));
return &__int_floorz;
}
#endif

View file

@ -4211,30 +4211,36 @@ void handle_se20(DDukeActor* actor)
void handle_se21(DDukeActor* actor)
{
auto sc = actor->sector();
int* lp;
int lp;
if (actor->temp_data[0] == 0) return;
if (actor->spr.ang == 1536)
lp = sc->ceilingzptr();
lp = sc->int_ceilingz();
else
lp = sc->floorzptr();
lp = sc->int_floorz();
if (actor->temp_data[0] == 1) //Decide if the sector should go up or down
{
actor->spr.zvel = Sgn(actor->int_pos().Z - *lp) * (actor->spr.yvel << 4);
actor->spr.zvel = Sgn(actor->int_pos().Z - lp) * (actor->spr.yvel << 4);
actor->temp_data[0]++;
}
if (sc->extra == 0)
{
*lp += actor->spr.zvel;
lp += actor->spr.zvel;
if (abs(*lp - actor->int_pos().Z) < 1024)
if (abs(lp - actor->int_pos().Z) < 1024)
{
*lp = actor->int_pos().Z;
lp = actor->int_pos().Z;
deletesprite(actor);
}
if (actor->spr.ang == 1536)
sc->set_int_ceilingz(lp);
else
sc->set_int_floorz(lp);
}
else sc->extra--;
}

View file

@ -364,7 +364,7 @@ int DoVatorMove(DSWActor* actor, int *lptr)
int DoVator(DSWActor* actor)
{
sectortype* sectp = actor->sector();
int *lptr;
int zval;
int amt;
// actor->user.sz - where the sector z started
@ -375,19 +375,21 @@ int DoVator(DSWActor* actor)
if (actor->spr.cstat & (CSTAT_SPRITE_YFLIP))
{
lptr = sectp->ceilingzptr();
amt = DoVatorMove(actor, lptr);
zval = sectp->int_ceilingz();
amt = DoVatorMove(actor, &zval);
sectp->set_int_ceilingz(zval);
MoveSpritesWithSector(actor->sector(), amt, true); // ceiling
}
else
{
lptr = sectp->floorzptr();
amt = DoVatorMove(actor, lptr);
zval = sectp->int_floorz();
amt = DoVatorMove(actor, &zval);
sectp->set_int_floorz(zval);
MoveSpritesWithSector(actor->sector(), amt, false); // floor
}
// EQUAL this entry has finished
if (*lptr == actor->user.z_tgt)
if (zval == actor->user.z_tgt)
{
// in the ON position
if (actor->user.z_tgt == actor->int_pos().Z)
@ -436,7 +438,7 @@ int DoVator(DSWActor* actor)
}
// setup to go back to the original z
if (*lptr != actor->user.oz)
if (zval != actor->user.oz)
{
if (actor->user.WaitTics)
actor->user.Tics = actor->user.WaitTics;
@ -521,24 +523,26 @@ int DoVator(DSWActor* actor)
int DoVatorAuto(DSWActor* actor)
{
sectortype* sectp = actor->sector();
int *lptr;
int zval;
int amt;
if (actor->spr.cstat & (CSTAT_SPRITE_YFLIP))
{
lptr = sectp->ceilingzptr();
amt = DoVatorMove(actor, lptr);
zval = sectp->int_ceilingz();
amt = DoVatorMove(actor, &zval);
sectp->set_int_ceilingz(zval);
MoveSpritesWithSector(actor->sector(), amt, true); // ceiling
}
else
{
lptr = sectp->floorzptr();
amt = DoVatorMove(actor, lptr);
zval = sectp->int_floorz();
amt = DoVatorMove(actor, &zval);
sectp->set_int_floorz(zval);
MoveSpritesWithSector(actor->sector(), amt, false); // floor
}
// EQUAL this entry has finished
if (*lptr == actor->user.z_tgt)
if (zval == actor->user.z_tgt)
{
// in the UP position
if (actor->user.z_tgt == actor->int_pos().Z)