From 425f4055b4465c2ae7e83cfd78d25e87102fb167 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 20 Aug 2022 22:42:05 +0200 Subject: [PATCH] - floatified user.z_tgt. --- source/games/sw/src/game.h | 4 ++-- source/games/sw/src/spike.cpp | 16 ++++++++-------- source/games/sw/src/sprite.cpp | 16 ++++++++-------- source/games/sw/src/vator.cpp | 16 ++++++++-------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index df7258aea..c3b7f7aa0 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -966,6 +966,8 @@ struct USER TObjPtr WpnGoalActor; double oz; // serialized copy of sprite.oz + double z_tgt; + int Flags; int Flags2; int Tics; @@ -1007,8 +1009,6 @@ struct USER // precalculated vectors vec3_t change; - int z_tgt; - // velocity int vel_tgt; int16_t vel_rate; diff --git a/source/games/sw/src/spike.cpp b/source/games/sw/src/spike.cpp index a01453e9b..5adc5b8cb 100644 --- a/source/games/sw/src/spike.cpp +++ b/source/games/sw/src/spike.cpp @@ -52,16 +52,16 @@ void ReverseSpike(DSWActor* actor) if (actor->user.int_z_tgt() == actor->user.int_oz()) { if (actor->spr.pos.Z == actor->user.oz) - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; else if (actor->user.pos.Z == actor->user.int_oz()) - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; } else if (actor->user.int_z_tgt() == actor->user.pos.Z) { if (actor->spr.pos.Z == actor->user.oz) - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; else if (actor->user.pos.Z == actor->user.int_oz()) - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; } actor->user.vel_rate = -actor->user.vel_rate; @@ -285,7 +285,7 @@ int DoSpike(DSWActor* actor) if (actor->user.int_z_tgt() == actor->int_pos().Z) { // change target - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; actor->user.vel_rate = -actor->user.vel_rate; SetSpikeInactive(actor); @@ -302,7 +302,7 @@ int DoSpike(DSWActor* actor) // change target actor->user.jump_speed = actor->user.vel_tgt; actor->user.vel_rate = (short)abs(actor->user.vel_rate); - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; SetSpikeInactive(actor); @@ -390,7 +390,7 @@ int DoSpikeAuto(DSWActor* actor) if (actor->user.int_z_tgt() == actor->int_pos().Z) { // change target - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; actor->user.vel_rate = -actor->user.vel_rate; actor->user.Tics = actor->user.WaitTics; @@ -404,7 +404,7 @@ int DoSpikeAuto(DSWActor* actor) // change target actor->user.jump_speed = actor->user.vel_tgt; actor->user.vel_rate = (short)abs(actor->user.vel_rate); - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; actor->user.Tics = actor->user.WaitTics; if (SP_TAG6(actor) && TEST_BOOL5(actor)) diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 82aae87eb..55ec01c39 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -2043,7 +2043,7 @@ void SpriteSetup(void) { // start off actor->user.pos.Z = sectp->int_floorz(); - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; if (start_on) { int amt; @@ -2051,7 +2051,7 @@ void SpriteSetup(void) // start in the on position sectp->add_int_floorz(amt); - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; MoveSpritesWithSector(actor->sector(), amt, false); // floor } @@ -2064,7 +2064,7 @@ void SpriteSetup(void) { // start off actor->user.pos.Z = sectp->int_ceilingz(); - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; if (start_on) { int amt; @@ -2072,7 +2072,7 @@ void SpriteSetup(void) // starting in the on position sectp->add_int_ceilingz(amt); - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; MoveSpritesWithSector(actor->sector(), amt, true); // ceiling } @@ -2251,12 +2251,12 @@ void SpriteSetup(void) // start off actor->user.pos.Z = actor->user.zclip; - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; if (start_on) { // start in the on position actor->user.zclip = actor->int_pos().Z; - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; SpikeAlign(actor); } @@ -2270,12 +2270,12 @@ void SpriteSetup(void) // start off actor->user.pos.Z = actor->user.zclip; - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; if (start_on) { // starting in the on position actor->user.zclip = actor->int_pos().Z; - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; SpikeAlign(actor); } diff --git a/source/games/sw/src/vator.cpp b/source/games/sw/src/vator.cpp index 2398e19e8..157d863e8 100644 --- a/source/games/sw/src/vator.cpp +++ b/source/games/sw/src/vator.cpp @@ -57,16 +57,16 @@ void ReverseVator(DSWActor* actor) if (actor->user.int_z_tgt() == actor->user.int_oz()) { if (actor->spr.pos.Z == actor->user.oz) - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; else if (actor->user.pos.Z == actor->user.int_oz()) - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; } else if (actor->user.int_z_tgt() == actor->user.pos.Z) { if (actor->spr.pos.Z == actor->user.oz) - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; else if (actor->user.pos.Z == actor->user.int_oz()) - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; } actor->user.vel_rate = -actor->user.vel_rate; @@ -395,7 +395,7 @@ int DoVator(DSWActor* actor) if (actor->user.int_z_tgt() == actor->int_pos().Z) { // change target - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; actor->user.vel_rate = -actor->user.vel_rate; SetVatorInactive(actor); @@ -413,7 +413,7 @@ int DoVator(DSWActor* actor) // change target actor->user.jump_speed = actor->user.vel_tgt; actor->user.vel_rate = short(abs(actor->user.vel_rate)); - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; RESET_BOOL8(actor); SetVatorInactive(actor); @@ -548,7 +548,7 @@ int DoVatorAuto(DSWActor* actor) if (actor->user.int_z_tgt() == actor->int_pos().Z) { // change target - actor->user.z_tgt = actor->user.pos.Z; + actor->user.z_tgt = actor->user.pos.Z * zinttoworld; actor->user.vel_rate = -actor->user.vel_rate; actor->user.Tics = actor->user.WaitTics; @@ -562,7 +562,7 @@ int DoVatorAuto(DSWActor* actor) // change target actor->user.jump_speed = actor->user.vel_tgt; actor->user.vel_rate = short(abs(actor->user.vel_rate)); - actor->user.z_tgt = actor->int_pos().Z; + actor->user.z_tgt = actor->spr.pos.Z; actor->user.Tics = actor->user.WaitTics; if (SP_TAG6(actor) && TEST_BOOL5(actor))