From 8a8ef22e531c307eb36b31850072ad4d1e201344 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 6 Oct 2022 17:30:01 +0200 Subject: [PATCH] - mostly '>' comparisons with scale values. --- source/games/blood/src/aiunicult.cpp | 6 +++--- source/games/duke/src/actors.cpp | 6 +++--- source/games/duke/src/actors_d.cpp | 16 ++++++++-------- source/games/duke/src/actors_r.cpp | 12 ++++++------ source/games/duke/src/animatesprites_d.cpp | 2 +- source/games/duke/src/animatesprites_r.cpp | 2 +- source/games/duke/src/gameexec.cpp | 8 ++++---- source/games/duke/src/player.cpp | 2 +- source/games/duke/src/player_d.cpp | 4 ++-- source/games/duke/src/player_r.cpp | 4 ++-- source/games/duke/src/prediction.cpp | 4 ++-- source/games/sw/src/coolg.cpp | 2 +- source/games/sw/src/weapon.cpp | 8 ++++---- 13 files changed, 38 insertions(+), 38 deletions(-) diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index d883b3e2a..576a35621 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -350,9 +350,9 @@ static void ThrowThing(DBloodActor* actor, bool impact) if (Chance(0x5000)) spawned->spr.cstat |= CSTAT_SPRITE_XFLIP; if (Chance(0x5000)) spawned->spr.cstat |= CSTAT_SPRITE_YFLIP; - if (spawned->spr.xrepeat > 60) spawned->xspr.data1 = 43; - else if (spawned->spr.xrepeat > 40) spawned->xspr.data1 = 33; - else if (spawned->spr.xrepeat > 30) spawned->xspr.data1 = 23; + if (spawned->spr.ScaleX() > 0.9375 ) spawned->xspr.data1 = 43; + else if (spawned->spr.ScaleX() > 0.625) spawned->xspr.data1 = 33; + else if (spawned->spr.ScaleX() > 0.46875) spawned->xspr.data1 = 23; else spawned->xspr.data1 = 12; return; case kThingTNTBarrel: diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 03f22c77c..6efde051c 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -421,7 +421,7 @@ void moveplayers(void) auto psp = ps[otherp].GetActor(); if (psp->spr.extra > 0) { - if (act->spr.yrepeat > 32 && psp->spr.ScaleY() < 0.5) + if (act->spr.ScaleY() > 0.5 && psp->spr.ScaleY() < 0.5) { if (other < 1400/16. && p->knee_incs == 0) { @@ -1195,7 +1195,7 @@ void moveooz(DDukeActor* actor, int seenine, int seeninedead, int ooz, int explo } else { - if (actor->spr.xrepeat > 0) + if (actor->spr.ScaleX() > 0) { actor->temp_data[2]++; if (actor->temp_data[2] == 3) @@ -2305,7 +2305,7 @@ bool bloodpool(DDukeActor* actor, bool puke) } } - if (xx < 844 / 16. && actor->spr.xrepeat > 6 && actor->spr.yrepeat > 6) + if (xx < 844 / 16. && actor->spr.ScaleX() > 0.09375 && actor->spr.yrepeat > 6) { if (actor->spr.pal == 0 && (krand() & 255) < 16 && !puke) { diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 9c494228b..57a92b6d5 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -454,7 +454,7 @@ int movesprite_ex_d(DDukeActor* actor, const DVector3& change, unsigned int clip if (bg) { - if (actor->spr.xrepeat > 60) + if (actor->spr.ScaleX() > 0.9375 ) clipmove(ppos, &dasectp, change * 0.5, 64., 4., 4., cliptype, result); else { @@ -1481,9 +1481,9 @@ static bool weaponhitsector(DDukeActor* proj, const DVector3& oldpos, bool fireb bounce(proj); ssp(proj, CLIPMASK1); proj->spr.extra >>= 1; - if (proj->spr.xrepeat > 8) + if (proj->spr.ScaleX() > 0.125 ) proj->spr.xrepeat -= 2; - if (proj->spr.yrepeat > 8) + if (proj->spr.ScaleY() > 0.125 ) proj->spr.yrepeat -= 2; proj->spr.yint--; return true; @@ -2276,8 +2276,8 @@ static void greenslime(DDukeActor *actor) actor->spr.cstat &= ~CSTAT_SPRITE_YFLIP; actor->spr.picnum = GREENSLIME + 4; - if (actor->spr.xrepeat > 32) actor->spr.xrepeat -= krand() & 7; - if (actor->spr.yrepeat > 16) actor->spr.yrepeat -= krand() & 7; + if (actor->spr.ScaleX() > 0.5 ) actor->spr.xrepeat -= krand() & 7; + if (actor->spr.ScaleY() > 0.25 ) actor->spr.yrepeat -= krand() & 7; else { actor->spr.SetScale(0.625, 0.25); @@ -2395,7 +2395,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->spr.ScaleX() > 0.125 ) actor->spr.xrepeat -= 4; if (actor->vel.Z > -12) actor->vel.Z -= 348 / 256.; actor->spr.pos.Z += actor->vel.Z; @@ -2421,7 +2421,7 @@ static void greenslime(DDukeActor *actor) else { if (actor->spr.yrepeat < (40 - 4)) actor->spr.yrepeat += 8; - if (actor->spr.xrepeat > 8) actor->spr.xrepeat -= 4; + if (actor->spr.ScaleX() > 0.125 ) actor->spr.xrepeat -= 4; } if (actor->spr.pos.Z > actor->floorz - 8) @@ -3618,7 +3618,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel) if (a && actor->spr.picnum != ROTATEGUN) { - if (xvel < 960 && actor->spr.xrepeat > 16) + if (xvel < 960 && actor->spr.ScaleX() > 0.25 ) { daxvel = -(1024 - xvel) * maptoworld; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index b18a92add..1ccd8bb59 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -382,7 +382,7 @@ int movesprite_ex_r(DDukeActor* actor, const DVector3& change, unsigned int clip if (bg) { - if (actor->spr.xrepeat > 60) + if (actor->spr.ScaleX() > 0.9375 ) clipmove(ppos, &dasectp, change * 0.5, 64., 4., 4., cliptype, result); else { @@ -1054,9 +1054,9 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3& oldpo if (wal->overpicnum != MIRROR && wal->picnum != MIRROR) { proj->spr.extra >>= 1; - if (proj->spr.xrepeat > 8) + if (proj->spr.ScaleX() > 0.125 ) proj->spr.xrepeat -= 2; - if (proj->spr.yrepeat > 8) + if (proj->spr.ScaleY() > 0.125 ) proj->spr.yrepeat -= 2; proj->spr.yint--; } @@ -1138,9 +1138,9 @@ bool weaponhitsector(DDukeActor *proj, const DVector3& oldpos) bounce(proj); ssp(proj, CLIPMASK1); proj->spr.extra >>= 1; - if (proj->spr.xrepeat > 8) + if (proj->spr.ScaleX() > 0.125 ) proj->spr.xrepeat -= 2; - if (proj->spr.yrepeat > 8) + if (proj->spr.ScaleY() > 0.125 ) proj->spr.yrepeat -= 2; proj->spr.yint--; return true; @@ -3619,7 +3619,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel) if (a) { - if (xvel < 960 && actor->spr.xrepeat > 16) + if (xvel < 960 && actor->spr.ScaleX() > 0.25 ) { daxvel = -(1024 - xvel) * maptoworld; diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 99410938e..5e07eefec 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -390,7 +390,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi if (ps[p].on_crane == nullptr && (h->sector()->lotag & 0x7ff) != 1) { double v = h->spr.pos.Z - ps[p].GetActor()->floorz + 3; - if (v > 4 && h->spr.yrepeat > 32 && h->spr.extra > 0) + if (v > 4 && h->spr.ScaleY() > 0.5 && h->spr.extra > 0) h->spr.yoffset = (int8_t)(v / h->spr.ScaleY()); else h->spr.yoffset = 0; } diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 625c0eb22..79ee618ae 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -431,7 +431,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi if (ps[p].on_crane == nullptr && (h->sector()->lotag & 0x7ff) != 1) { double v = h->spr.pos.Z - ps[p].GetActor()->floorz + 3; - if (v > 4 && h->spr.yrepeat > 32 && h->spr.extra > 0) + if (v > 4 && h->spr.ScaleY() > 0.5 && h->spr.extra > 0) h->spr.yoffset = (int8_t)(v / h->spr.ScaleY()); else h->spr.yoffset = 0; } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index f7a727e54..87d0012b7 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1386,7 +1386,7 @@ static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x) double sclip; DAngle angdif; - if (badguy(actor) && actor->spr.xrepeat > 56) + if (badguy(actor) && actor->spr.ScaleX() > 0.875) { sclip = 3084 / 16.; angdif = DAngle22_5 * 3 / 8; @@ -2419,7 +2419,7 @@ int ParseState::parse(void) j = 1; else if( (l& ponground) && ps[g_p].on_ground) j = 1; - else if( (l& palive) && ps[g_p].GetActor()->spr.xrepeat > (isRR() ? 8 : 32) && ps[g_p].GetActor()->spr.extra > 0 && ps[g_p].timebeforeexit == 0 ) + else if( (l& palive) && ps[g_p].GetActor()->spr.ScaleX() > (isRR() ? 0.125 : 0.5) && ps[g_p].GetActor()->spr.extra > 0 && ps[g_p].timebeforeexit == 0) j = 1; else if( (l& pdead) && ps[g_p].GetActor()->spr.extra <= 0) j = 1; @@ -3680,7 +3680,7 @@ void LoadActor(DDukeActor *actor, int p, int x) { if (badguy(actor)) { - if (actor->spr.xrepeat > 60) return; + if (actor->spr.ScaleX() > 0.9375 ) return; if (ud.respawn_monsters == 1 && actor->spr.extra <= 0) return; } else if (ud.respawn_items == 1 && (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) return; @@ -3763,7 +3763,7 @@ void execute(DDukeActor *actor,int p,double xx) { if (badguy(actor)) { - if (actor->spr.xrepeat > 60) goto quit; + if (actor->spr.ScaleX() > 0.9375 ) goto quit; if (ud.respawn_monsters == 1 && actor->spr.extra <= 0) goto quit; } else if (ud.respawn_items == 1 && (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) goto quit; diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index edd39f242..80725d636 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -311,7 +311,7 @@ DDukeActor* aim(DDukeActor* actor, int abase) DukeStatIterator it(aimstats[k]); while (auto act = it.Next()) { - if (act->spr.xrepeat > 0 && act->spr.extra >= 0 && (act->spr.cstat & (CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_INVISIBLE)) == CSTAT_SPRITE_BLOCK_ALL) + if (act->spr.ScaleX() > 0 && act->spr.extra >= 0 && (act->spr.cstat & (CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_INVISIBLE)) == CSTAT_SPRITE_BLOCK_ALL) if (badguy(act) || k < 2) { if (badguy(act) || act->isPlayer()) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 01d25d18c..15d44aa4b 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1213,7 +1213,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum { int i, j, k; auto p = &ps[snum]; - if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->spr.xrepeat > 32 && p->access_incs == 0 && p->knee_incs == 0) + if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->spr.ScaleX() > 0.5 && p->access_incs == 0 && p->knee_incs == 0) { if ((p->weapon_pos == 0 || (p->holster_weapon && p->weapon_pos == -9))) { @@ -2806,7 +2806,7 @@ void processinput_d(int snum) p->footprintcount = 0; p->spritebridge = 1; } - else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < 84) + else if (badguy(clz.actor()) && clz.actor()->spr.ScaleX() > 0.375 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < 84) { auto ang = (clz.actor()->spr.pos - p->pos).Angle(); p->vel.XY() -= ang.ToVector(); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 9f9397db5..648020b30 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -977,7 +977,7 @@ void selectweapon_r(int snum, int weap) { int i, j, k; auto p = &ps[snum]; - if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->spr.xrepeat > 8 && p->access_incs == 0 && p->knee_incs == 0) + if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->spr.ScaleX() > 0.125 && p->access_incs == 0 && p->knee_incs == 0) { if ((p->weapon_pos == 0 || (p->holster_weapon && p->weapon_pos == -9))) { @@ -3464,7 +3464,7 @@ void processinput_r(int snum) { doVehicleHit(); } - else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < 84) + else if (badguy(clz.actor()) && clz.actor()->spr.ScaleX() > 0.375 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < 84) { auto ang = (clz.actor()->spr.pos - p->pos).Angle(); p->vel.XY() -= ang.ToVector(); diff --git a/source/games/duke/src/prediction.cpp b/source/games/duke/src/prediction.cpp index c3fe7496f..34d1edafc 100644 --- a/source/games/duke/src/prediction.cpp +++ b/source/games/duke/src/prediction.cpp @@ -121,7 +121,7 @@ void fakedomovethings(void) psectlotag = psect->lotag; spritebridge = 0; - shrunk = (p->GetActor()->s.yrepeat < (isRR()? 8 : 32)); + shrunk = (p->GetActor()->s.y_repeat < (isRR()? 8 : 32)); if( ud.clipping == 0 && ( psect->floorpicnum == MIRROR || psect == nullptr) ) { @@ -178,7 +178,7 @@ void fakedomovethings(void) psectlotag = 0; spritebridge = 1; } - if(badguy(chz.actor) && chz.actor()->s.xrepeat > 24 && abs(p->GetActor()->s.z- chz.actor()->s.z) < (84<<8) ) + if(badguy(chz.actor) && chz.actor()->s.ScaleX() > 0.375 && abs(p->GetActor()->s.z- chz.actor()->s.z) < (84<<8) ) { j = g etangle(chz.actor()->s.x-myx, chz.actor()->s.y-myy); myxvel -= b cos(j, 4); diff --git a/source/games/sw/src/coolg.cpp b/source/games/sw/src/coolg.cpp index e47cb1972..d4bbecb5b 100644 --- a/source/games/sw/src/coolg.cpp +++ b/source/games/sw/src/coolg.cpp @@ -885,7 +885,7 @@ int DoCoolgMove(DSWActor* actor) actor->spr.hitag = 0; actor->spr.xrepeat++; actor->spr.shade--; - if (actor->spr.xrepeat > 42) actor->spr.xrepeat = 42; + if (actor->spr.ScaleX() > 0.65625) actor->spr.xrepeat = 42; if (actor->spr.shade < -10) actor->spr.shade = -10; } else if (actor->user.FlagOwner == 0) diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 4573a2baa..c91ff970b 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -11319,7 +11319,7 @@ int DoSerpMeteor(DSWActor* actor) auto oldv = actor->spr.pos; actor->spr.xrepeat += MISSILEMOVETICS * 2; - if (actor->spr.xrepeat > 80) + if (actor->spr.ScaleX() > 1.25) actor->spr.xrepeat = 80; actor->user.coll = move_missile(actor, actor->user.change, actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -11364,7 +11364,7 @@ int DoSerpMeteor(DSWActor* actor) int DoMirvMissile(DSWActor* actor) { actor->spr.xrepeat += MISSILEMOVETICS * 2; - if (actor->spr.xrepeat > 80) + if (actor->spr.ScaleX() > 1.25) actor->spr.xrepeat = 80; actor->user.coll = move_missile(actor, actor->user.change, actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -18325,7 +18325,7 @@ int DoFloorBlood(DSWActor* actor) } // See if any players stepped in blood - if (actor->spr.xrepeat != 4 && actor->spr.yrepeat > 4) + if (actor->spr.xrepeat != 4 && actor->spr.ScaleY() > 0.0625) { TRAVERSE_CONNECT(pnum) { @@ -18342,7 +18342,7 @@ int DoFloorBlood(DSWActor* actor) } // If blood has already grown to max size, we can shrink it - if (actor->spr.xrepeat == 40 && actor->spr.yrepeat > 10) + if (actor->spr.xrepeat == 40 && actor->spr.ScaleY() > 0.15625) { actor->spr.yrepeat -= 10; if (actor->spr.yrepeat <= 10) // Shrink it down and don't use it anymore