From 56e538815059d0dff4002c93c28672401effddac Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 1 Sep 2022 01:08:54 +0200 Subject: [PATCH] - handle 'zvel >' comparisons with constants. --- source/games/duke/src/actors.cpp | 12 ++++++------ source/games/duke/src/actors_d.cpp | 8 ++++---- source/games/duke/src/actors_r.cpp | 4 ++-- source/games/exhumed/src/grenade.cpp | 2 +- source/games/exhumed/src/move.cpp | 2 +- source/games/exhumed/src/player.cpp | 2 +- source/games/exhumed/src/queen.cpp | 2 +- source/games/exhumed/src/set.cpp | 2 +- source/games/sw/src/weapon.cpp | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index fb388e1d5..88349d5fd 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -2418,7 +2418,7 @@ void glasspieces(DDukeActor* actor) makeitfall(actor); - if (actor->int_zvel() > 4096) actor->set_int_zvel(4096); + if (actor->float_zvel() > 16) actor->set_int_zvel(4096); if (!actor->insector()) { deletesprite(actor); @@ -4847,7 +4847,7 @@ void makeitfall(DDukeActor* actor) if( actor->spr.pos.Z < actor->floorz - FOURSLEIGHT_F) { - if( actor->sector()->lotag == 2 && actor->int_zvel() > 3122 ) + if( actor->sector()->lotag == 2 && actor->float_zvel() > 3122/256.) actor->set_int_zvel(3144); if(actor->float_zvel() < 24) actor->add_int_zvel( c); @@ -4985,7 +4985,7 @@ void alterang(int ang, DDukeActor* actor, int playernum) aang = actor->int_ang(); actor->spr.xvel += (*moveptr - actor->spr.xvel) / 5; - if (actor->int_zvel() < 648) actor->add_int_zvel( ((*(moveptr + 1) << 4) - actor->int_zvel()) / 5); + if (actor->float_zvel() < (648/256.)) actor->add_int_zvel( ((*(moveptr + 1) << 4) - actor->int_zvel()) / 5); if (isRRRA() && (ang & windang)) actor->set_int_ang(WindDir); @@ -5082,7 +5082,7 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO actor->add_int_zvel( c); actor->spr.pos.Z += actor->float_zvel(); - if (actor->int_zvel() > 6144) actor->set_int_zvel(6144); + if (actor->float_zvel() > 24) actor->set_int_zvel(6144); } else { @@ -5091,7 +5091,7 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO if (badguy(actor) || (actor->isPlayer() && actor->GetOwner())) { - if (actor->int_zvel() > 3084 && actor->spr.extra <= 1) + if (actor->float_zvel() > (3084/256.) && actor->spr.extra <= 1) { if (actor->spr.pal != 1 && actor->spr.picnum != DRONE) { @@ -5116,7 +5116,7 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO actor->hitextra = 1; actor->clear_zvel(); } - else if (actor->int_zvel() > 2048 && actor->sector()->lotag != 1) + else if (actor->float_zvel() > 8 && actor->sector()->lotag != 1) { auto sect = actor->sector(); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index a66e379c3..e42831977 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -773,7 +773,7 @@ void movefallers_d(void) if (act->spr.pos.Z < sectp->floorz - 1) { act->add_int_zvel( x); - if (act->int_zvel() > 6144) + if (act->float_zvel() > 24) act->set_int_zvel(6144); act->add_int_z(act->int_zvel()); } @@ -1339,7 +1339,7 @@ static bool movefireball(DDukeActor* actor) } actor->temp_data[0]++; } - if (actor->int_zvel() < 15000) + if (actor->float_zvel() < 15000./256.) actor->add_int_zvel( 200); return false; } @@ -1593,7 +1593,7 @@ static void weaponcommon_d(DDukeActor* proj) } } } - else if (proj->spr.picnum == SPIT) if (proj->int_zvel() < 6144) + else if (proj->spr.picnum == SPIT) if (proj->float_zvel() < 24) proj->add_int_zvel( gs.gravity - 112); if (coll.type != 0) @@ -2399,7 +2399,7 @@ static void greenslime(DDukeActor *actor) actor->spr.picnum = GREENSLIME; if (actor->spr.yrepeat < 40) actor->spr.yrepeat += 8; if (actor->spr.xrepeat > 8) actor->spr.xrepeat -= 4; - if (actor->int_zvel() > -(2048 + 1024)) + if (actor->float_zvel() > -12) actor->add_int_zvel(- 348); actor->spr.pos.Z += actor->float_zvel(); if (actor->spr.pos.Z < actor->ceilingz + 16) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index a535298c4..a174b99d5 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -691,7 +691,7 @@ void movefallers_r(void) if (act->spr.pos.Z < sectp->floorz - 1) { act->add_int_zvel( x); - if (act->int_zvel() > 6144) + if (act->float_zvel() > 24) act->set_int_zvel(6144); act->add_int_z(act->int_zvel()); } @@ -1274,7 +1274,7 @@ static void weaponcommon_r(DDukeActor *proj) } } } - else if (proj->spr.picnum == SPIT) if (proj->int_zvel() < 6144) + else if (proj->spr.picnum == SPIT) if (proj->float_zvel() < 24) proj->add_int_zvel( gs.gravity - 112); if (coll.type != 0) diff --git a/source/games/exhumed/src/grenade.cpp b/source/games/exhumed/src/grenade.cpp index 829fcb043..c71161ebf 100644 --- a/source/games/exhumed/src/grenade.cpp +++ b/source/games/exhumed/src/grenade.cpp @@ -301,7 +301,7 @@ void AIGrenade::Tick(RunListEvent* ev) pActor->set_int_zvel(-(zVel >> 1)); - if (pActor->int_zvel() > -1280) + if (pActor->float_zvel() > -5) { D3PlayFX(StaticSound[kSound5], pActor); pActor->nCount = 0; diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 7319c0c05..13defaca8 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -604,7 +604,7 @@ void Gravity(DExhumedActor* pActor) else { pActor->add_int_zvel( 512); - if (pActor->int_zvel() > 16384) { + if (pActor->float_zvel() > 64) { pActor->set_int_zvel(16384); } } diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 80644e945..bfd5fc3bd 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -850,7 +850,7 @@ void AIPlayer::Tick(RunListEvent* ev) int y = (sPlayerInput[nPlayer].yVel * 4) >> 2; int z = (pPlayerActor->int_zvel() * 4) >> 2; - if (pPlayerActor->int_zvel() > 8192) + if (pPlayerActor->float_zvel() > 32) pPlayerActor->set_int_zvel(8192); if (PlayerList[nPlayer].bIsMummified) diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index 98852a2d3..d635bee40 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -799,7 +799,7 @@ void AIQueenHead::Tick(RunListEvent* ev) { pActor->set_int_zvel(-(pActor->int_zvel() >> 1)); - if (pActor->int_zvel() > -256) + if (pActor->float_zvel() > -1) { nVelShift = 100; pActor->clear_zvel(); diff --git a/source/games/exhumed/src/set.cpp b/source/games/exhumed/src/set.cpp index 68a2d8a94..35dc4a1b6 100644 --- a/source/games/exhumed/src/set.cpp +++ b/source/games/exhumed/src/set.cpp @@ -267,7 +267,7 @@ void AISet::Tick(RunListEvent* ev) pushmove(pActor, §, pActor->spr.clipdist << 2, 5120, -5120, CLIPMASK0); pActor->setsector(sect); - if (pActor->int_zvel() > 4000) + if (pActor->float_zvel() > 4000/256.) { if (nMov.exbits & kHitAux2) { diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 50b96a1ca..c96422ec9 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -16721,7 +16721,7 @@ int DoBubble(DSWActor* actor) actor->spr.pos.Z -= actor->float_zvel(); actor->add_int_zvel( 32); - if (actor->int_zvel() > 768) + if (actor->float_zvel() > 3) actor->set_int_zvel(768); // notreallypos