From ac998da374632a4658cde88feca19667a6623871 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 4 Sep 2022 00:08:01 +0200 Subject: [PATCH] - floatified SO bobbing --- source/games/sw/src/game.h | 14 ++++++-------- source/games/sw/src/track.cpp | 14 +++++++------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 977629695..99517f237 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1464,19 +1464,17 @@ struct SECTOR_OBJECT vel_tgt, // target velocity update; // Distance from player at which you continue updating - // start of must floatify double zorig_floor[MAX_SO_SECTOR], // original z values for all sectors z_tgt; // target z delta - int z_rate, // rate at which z aproaches target + int z_rate; // rate at which z aproaches target // only works for single player. - bob_diff; // bobbing difference for the frame - double floor_loz, // floor low z - floor_hiz; // floor hi z - int bob_amt, // bob amount max in z coord - // end of must floatify + double bob_diff, // bobbing difference for the frame + floor_loz, // floor low z + floor_hiz, // floor hi z + bob_amt; // bob amount max in z coord // variables set by mappers for drivables - drive_angspeed, + int drive_angspeed, drive_angslide, drive_speed, drive_slide, diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 4d9a3c8a4..bab0b079c 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -1212,7 +1212,7 @@ void SetupSectorObject(sectortype* sectp, short tag) KillActor(actor); break; case SO_BOB_START: - sop->bob_amt = Z(actor->spr.lotag); + sop->bob_amt = actor->spr.lotag; sop->bob_sine_ndx = 0; sop->bob_speed = 4; KillActor(actor); @@ -1255,7 +1255,7 @@ void SetupSectorObject(sectortype* sectp, short tag) #if 0 case SO_SPEED_BOAT: sop->vel = 0; - sop->bob_amt = Z(2); + sop->bob_amt = 2; sop->bob_speed = 4; sop->flags |= (SOBJ_OPERATIONAL); break; @@ -1964,7 +1964,7 @@ void MoveZ(SECTOR_OBJECT* sop) if (sop->bob_amt) { sop->bob_sine_ndx = (PlayClock << sop->bob_speed) & 2047; - sop->bob_diff = MulScale(sop->bob_amt, bsin(sop->bob_sine_ndx), 14); + sop->bob_diff = sop->bob_amt * BobVal(sop->bob_sine_ndx); // for all sectors for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) @@ -1972,7 +1972,7 @@ void MoveZ(SECTOR_OBJECT* sop) if (sop->sectp[i]->hasU() && (sop->sectp[i]->flags & SECTFU_SO_DONT_BOB)) continue; - (*sectp)->floorz = sop->zorig_floor[i] + sop->bob_diff * zinttoworld; + (*sectp)->setfloorz(sop->zorig_floor[i] + sop->bob_diff); } } @@ -2220,7 +2220,7 @@ DVector2 DoTrack(SECTOR_OBJECT* sop, short locktics) case TRACK_BOB_START: sop->flags |= (SOBJ_ZMID_FLOOR); - sop->bob_amt = Z(tpoint->tag_high); + sop->bob_amt = tpoint->tag_high; sop->bob_sine_ndx = 0; sop->bob_speed = 4; break; @@ -2515,7 +2515,7 @@ void OperateSectorObjectForTics(SECTOR_OBJECT* sop, DAngle newang, const DVector if (sop->bob_amt) { sop->bob_sine_ndx = (PlayClock << sop->bob_speed) & 2047; - sop->bob_diff = MulScale(sop->bob_amt, bsin(sop->bob_sine_ndx), 14); + sop->bob_diff = sop->bob_amt * BobVal(sop->bob_sine_ndx); // for all sectors for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) @@ -2523,7 +2523,7 @@ void OperateSectorObjectForTics(SECTOR_OBJECT* sop, DAngle newang, const DVector if (sop->sectp[i]->hasU() && (sop->sectp[i]->flags & SECTFU_SO_DONT_BOB)) continue; - (*sectp)->floorz = sop->zorig_floor[i] + sop->bob_diff * zinttoworld; + (*sectp)->setfloorz(sop->zorig_floor[i] + sop->bob_diff); } }