- wrapped user.oz reads.

This commit is contained in:
Christoph Oelckers 2022-08-20 22:12:05 +02:00
parent 306e751a51
commit a7d62f944b
4 changed files with 17 additions and 16 deletions

View file

@ -930,6 +930,7 @@ struct USER
memset(&WallP, 0, sizeof(USER) - myoffsetof(USER, WallP));
}
int int_oz() const { return oz; }
int int_loz() const { return loz * zworldtoint; }
int int_hiz() const { return hiz * zworldtoint; }

View file

@ -49,18 +49,18 @@ void ReverseSpike(DSWActor* actor)
}
// moving toward to OFF pos
if (actor->user.z_tgt == actor->user.oz)
if (actor->user.z_tgt == actor->user.int_oz())
{
if (actor->int_pos().Z == actor->user.oz)
if (actor->int_pos().Z == actor->user.int_oz())
actor->user.z_tgt = actor->user.pos.Z;
else if (actor->user.pos.Z == actor->user.oz)
else if (actor->user.pos.Z == actor->user.int_oz())
actor->user.z_tgt = actor->int_pos().Z;
}
else if (actor->user.z_tgt == actor->user.pos.Z)
{
if (actor->int_pos().Z == actor->user.oz)
if (actor->int_pos().Z == actor->user.int_oz())
actor->user.z_tgt = actor->int_pos().Z;
else if (actor->user.pos.Z == actor->user.oz)
else if (actor->user.pos.Z == actor->user.int_oz())
actor->user.z_tgt = actor->user.pos.Z;
}
@ -326,7 +326,7 @@ int DoSpike(DSWActor* actor)
}
// setup to go back to the original z
if (*lptr != actor->user.oz)
if (*lptr != actor->user.int_oz())
{
if (actor->user.WaitTics)
actor->user.Tics = actor->user.WaitTics;
@ -335,7 +335,7 @@ int DoSpike(DSWActor* actor)
else // if (*lptr == actor->user.z_tgt)
{
// if heading for the OFF (original) position and should NOT CRUSH
if (TEST_BOOL3(actor) && actor->user.z_tgt == actor->user.oz)
if (TEST_BOOL3(actor) && actor->user.z_tgt == actor->user.int_oz())
{
bool found = false;

View file

@ -2262,7 +2262,7 @@ void SpriteSetup(void)
// set orig z
actor->user.oz = actor->user.zclip;
actor->opos.Z = actor->user.oz * zinttoworld;
actor->opos.Z = actor->user.int_oz() * zinttoworld;
}
else
{
@ -2281,7 +2281,7 @@ void SpriteSetup(void)
// set orig z
actor->user.oz = actor->user.zclip;
actor->opos.Z = actor->user.oz * zinttoworld;
actor->opos.Z = actor->user.int_oz() * zinttoworld;
}
change_actor_stat(actor, STAT_SPIKE);

View file

@ -54,18 +54,18 @@ void ReverseVator(DSWActor* actor)
}
// moving toward to OFF pos
if (actor->user.z_tgt == actor->user.oz)
if (actor->user.z_tgt == actor->user.int_oz())
{
if (actor->int_pos().Z == actor->user.oz)
if (actor->int_pos().Z == actor->user.int_oz())
actor->user.z_tgt = actor->user.pos.Z;
else if (actor->user.pos.Z == actor->user.oz)
else if (actor->user.pos.Z == actor->user.int_oz())
actor->user.z_tgt = actor->int_pos().Z;
}
else if (actor->user.z_tgt == actor->user.pos.Z)
{
if (actor->int_pos().Z == actor->user.oz)
if (actor->int_pos().Z == actor->user.int_oz())
actor->user.z_tgt = actor->int_pos().Z;
else if (actor->user.pos.Z == actor->user.oz)
else if (actor->user.pos.Z == actor->user.int_oz())
actor->user.z_tgt = actor->user.pos.Z;
}
@ -438,7 +438,7 @@ int DoVator(DSWActor* actor)
}
// setup to go back to the original z
if (zval != actor->user.oz)
if (zval != actor->user.int_oz())
{
if (actor->user.WaitTics)
actor->user.Tics = actor->user.WaitTics;
@ -447,7 +447,7 @@ int DoVator(DSWActor* actor)
else // if (*lptr == actor->user.z_tgt)
{
// if heading for the OFF (original) position and should NOT CRUSH
if (TEST_BOOL3(actor) && actor->user.z_tgt == actor->user.oz)
if (TEST_BOOL3(actor) && actor->user.z_tgt == actor->user.int_oz())
{
int i;
bool found = false;