From b32c4444c4cb0cac7bc9d64d8d2c64f527c9f0eb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 20 Aug 2022 17:59:15 +0200 Subject: [PATCH] - replaced all add_int_z calls with constants. --- source/games/blood/src/actor.cpp | 2 +- source/games/blood/src/nnexts.cpp | 6 +++--- source/games/duke/src/actors.cpp | 10 +++++----- source/games/duke/src/actors_d.cpp | 6 +++--- source/games/duke/src/actors_r.cpp | 2 +- source/games/duke/src/animatesprites_d.cpp | 4 ++-- source/games/duke/src/animatesprites_r.cpp | 4 ++-- source/games/duke/src/player.cpp | 2 +- source/games/duke/src/player_r.cpp | 4 ++-- source/games/duke/src/player_w.cpp | 2 +- source/games/duke/src/sectors_d.cpp | 2 +- source/games/duke/src/sectors_r.cpp | 2 +- source/games/duke/src/spawn.cpp | 6 +++--- source/games/duke/src/spawn_d.cpp | 6 +++--- source/games/duke/src/spawn_r.cpp | 4 ++-- source/games/sw/src/jweapon.cpp | 6 +++--- source/games/sw/src/player.cpp | 2 +- source/games/sw/src/sprite.cpp | 4 ++-- source/games/sw/src/weapon.cpp | 15 +++++++-------- 19 files changed, 44 insertions(+), 45 deletions(-) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 1eaf791c8..0ef1602d7 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -4584,7 +4584,7 @@ static Collision MoveThing(DBloodActor* actor) if ((actor->spr.flags & 2) && bottom < floorZ) { - actor->add_int_z(455); + actor->spr.pos.Z += 1.777; actor->vel.Z += 58254; if (actor->spr.type == kThingZombieHead) { diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index a2d8e46c5..a3db864a3 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -746,8 +746,8 @@ void nnExtInitModernStuff(TArray& actors) // very quick fix for floor sprites with Touch trigger flag if their Z is equals sector florz / ceilgz if (actor->insector() && actor->xspr.Touch && (actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) { - if (actor->int_pos().Z == actor->sector()->int_floorz()) actor->add_int_z(-1); - else if (actor->int_pos().Z == actor->sector()->int_ceilingz()) actor->add_int_z(1); + if (actor->int_pos().Z == actor->sector()->int_floorz()) actor->spr.pos.Z -= zmaptoworld; + else if (actor->int_pos().Z == actor->sector()->int_ceilingz()) actor->spr.pos.Z += zmaptoworld; } // make Proximity flag work not just for dudes and things... @@ -1747,7 +1747,7 @@ void debrisMove(int listIndex) } else if ((actor->xspr.physAttr & kPhysGravity) && bottom < floorZ) { - actor->add_int_z(455); + actor->spr.pos.Z += 1.777; actor->vel.Z += 58254; } diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 1da053f0a..981af46f6 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -491,7 +491,7 @@ void moveplayers(void) if (act->sector()->lotag != ST_2_UNDERWATER) makeitfall(act); if (act->spr.zvel == 0 && act->sector()->lotag == ST_1_ABOVE_WATER) - act->add_int_z((32 << 8)); + act->spr.pos.Z += 32; } if (act->spr.extra < 8) @@ -663,7 +663,7 @@ void movecrane(DDukeActor *actor, int crane) } else if (actor->temp_data[0] == 2 || actor->temp_data[0] == 7) { - actor->add_int_z((1024 + 512)); + actor->spr.pos.Z += 6; if (actor->temp_data[0] == 2) { @@ -923,7 +923,7 @@ void detonate(DDukeActor *actor, int explosion) } } - actor->add_int_z(-(32 << 8)); + actor->spr.pos.Z -= 32; if ((actor->temp_data[3] == 1 && actor->spr.xrepeat) || actor->spr.lotag == -99) { @@ -1371,7 +1371,7 @@ void rpgexplode(DDukeActor *actor, int hit, const vec3_t &pos, int EXPLOSION2, i else { explosion->spr.cstat |= CSTAT_SPRITE_YFLIP; - explosion->add_int_z((48 << 8)); + explosion->spr.pos.Z += 48; } } if (newextra > 0) actor->spr.extra = newextra; @@ -1634,7 +1634,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p if (actor->temp_data[0] == -1) { - actor->add_int_z(1024); + actor->spr.pos.Z += 4; actor->temp_data[2]++; if ((actor->temp_data[2] & 3) == 0) spawn(actor, explosion); getglobalz(actor); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index c23e1f901..ec60c6f1b 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -740,7 +740,7 @@ void movefallers_d(void) } } act->set_int_ang(act->temp_data[1]); - act->add_int_z(+(16 << 8)); + act->spr.pos.Z += 16; } else if (act->temp_data[0] == 1) { @@ -1645,7 +1645,7 @@ static void weaponcommon_d(DDukeActor* proj) if (proj->spr.zvel < 0) { spawned->spr.cstat |= CSTAT_SPRITE_YFLIP; - spawned->add_int_z(72 << 8); + spawned->spr.pos.Z += 72; } } } @@ -2610,7 +2610,7 @@ static void heavyhbomb(DDukeActor *actor) if (actor->sector()->lotag == 1 && actor->spr.zvel == 0) { - actor->add_int_z(32 << 8); + actor->spr.pos.Z += 32; if (actor->temp_data[5] == 0) { actor->temp_data[5] = 1; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index a9e74feba..f65addd26 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1309,7 +1309,7 @@ static void weaponcommon_r(DDukeActor *proj) if (proj->spr.zvel < 0) { spawned->spr.cstat |= CSTAT_SPRITE_YFLIP; - spawned->add_int_z(72 << 8); + spawned->spr.pos.Z += 72; } } } diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index d159117eb..145a4dabb 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -183,7 +183,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat switch (h->spr.picnum) { case DUKELYINGDEAD: - t->add_int_z(24 << 8); + t->pos.Z += 24; break; case BLOODPOOL: case FOOTPRINTS: @@ -299,7 +299,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat p = h->spr.yvel; - if (t->pal == 1) t->add_int_z(-(18 << 8)); + if (t->pal == 1) t->pos.Z -= 18; if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr) { diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index c28b72f24..e82094ce6 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -181,7 +181,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat h->spr.xrepeat = 24; h->spr.yrepeat = 17; if (h->spr.extra > 0) - t->add_int_z(6 << 8); + t->pos.Z += 6; break; case BLOODPOOL: case FOOTPRINTS: @@ -341,7 +341,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat p = h->spr.yvel; - if (t->pal == 1) t->add_int_z(-(18 << 8)); + if (t->pal == 1) t->pos.Z -= 18; if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr) { diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 24e55cb6b..d65b1d8e2 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -617,7 +617,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz) } else { - actor->add_int_z(-512); + actor->spr.pos.Z -= 2; actor->spr.zvel = -348; } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 02f35e8dd..d7b869273 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -894,7 +894,7 @@ void shoot_r(DDukeActor* actor, int atwith) { j->spr.xvel = 32; j->spr.angle = actor->spr.angle; - j->add_int_z(-(5 << 8)); + j->spr.pos.Z -= 5; } break; } @@ -905,7 +905,7 @@ void shoot_r(DDukeActor* actor, int atwith) { j->spr.xvel = 250; j->spr.angle = actor->spr.angle; - j->add_int_z(-(15 << 8)); + j->spr.pos.Z -= 15; } break; } diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index 482d3d8dc..a3db55dea 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -127,7 +127,7 @@ void DoSpawn(player_struct *p, int snum) // like chaingun shells j->set_int_ang((j->int_ang() + 1024) & 2047); j->spr.xvel += 32; - j->add_int_z(3<<8); + j->spr.pos.Z += 3; ssp(j,CLIPMASK0); } diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 34063c12c..172fb0cf3 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -199,7 +199,7 @@ void operaterespawns_d(int low) auto star = spawn(act, TRANSPORTERSTAR); if (star) { - star->add_int_z(-(32 << 8)); + star->spr.pos.Z -= 32; act->spr.extra = 66 - 12; // Just a way to killit } diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 8d9df068d..4ff235182 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -313,7 +313,7 @@ void operaterespawns_r(int low) if (badguypic(act->spr.hitag) && ud.monsters_off) break; auto star = spawn(act, TRANSPORTERSTAR); - if (star) star->add_int_z(-(32 << 8)); + if (star) star->spr.pos.Z -= 32; act->spr.extra = 66 - 12; // Just a way to killit break; diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 6e161f63f..e250fadde 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -318,7 +318,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* act, bool beam) act->spr.xrepeat = 48; act->spr.yrepeat = 64; if (actj->spr.statnum == 10 || badguy(actj)) - act->add_int_z(-(32 << 8)); + act->spr.pos.Z -= 32; } } @@ -527,9 +527,9 @@ void initwaterdrip(DDukeActor* actj, DDukeActor* actor) if (actj->spr.pal != 1) { actor->spr.pal = 2; - actor->add_int_z(-(18 << 8)); + actor->spr.pos.Z -= 18; } - else actor->add_int_z(-(13 << 8)); + else actor->spr.pos.Z -= 13; actor->set_int_ang(getangle(ps[connecthead].player_int_pos().X - actor->int_pos().X, ps[connecthead].player_int_pos().Y - actor->int_pos().Y)); actor->spr.xvel = 48 - (krand() & 31); ssp(actor, CLIPMASK0); diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 6060a7524..026dabdb8 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -262,7 +262,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* case BLOOD: act->spr.xrepeat = act->spr.yrepeat = 16; - act->add_int_z(-(26 << 8)); + act->spr.pos.Z -= 26; if (actj && actj->spr.pal == 6) act->spr.pal = 6; ChangeActorStat(act, STAT_MISC); @@ -297,7 +297,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* int fz = getflorzofslopeptr(act->sector(), act->int_pos().X, act->int_pos().Y); if (fz != act->int_pos().Z) act->set_int_z(fz); - act->add_int_z(-200); + act->spr.pos.Z -= 0.78125; } [[fallthrough]]; @@ -1000,7 +1000,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* if (actj) { act->spr.lotag = 0; - act->add_int_z(-(32 << 8)); + act->spr.pos.Z -= 32; act->spr.zvel = -1024; ssp(act, CLIPMASK0); if (krand() & 4) act->spr.cstat |= CSTAT_SPRITE_XFLIP; diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index f1383a087..7516e0096 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -324,7 +324,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case BLOOD: act->spr.xrepeat = act->spr.yrepeat = 4; - act->add_int_z(-(26 << 8)); + act->spr.pos.Z -= 26; ChangeActorStat(act, STAT_MISC); break; case BLOODPOOL: @@ -1155,7 +1155,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* act->spr.lotag = 0; if (act->spr.picnum != BOWLINGBALLSPRITE) { - act->add_int_z(-(32 << 8)); + act->spr.pos.Z -= 32; act->spr.zvel = -(4 << 8); } else diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index ad1320767..4f9eb1b30 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -1838,7 +1838,7 @@ int InitBloodSpray(DSWActor* actor, bool dogib, short velocity) int BloodSprayFall(DSWActor* actor) { - actor->add_int_z(1500); + actor->spr.pos.Z += 5.86; return 0; } @@ -2191,7 +2191,7 @@ int SpawnShell(DSWActor* actor, int ShellNum) switch (actorNew->user.ID) { case UZI_SHELL: - actorNew->add_int_z(-Z(13)); + actorNew->spr.pos.Z -= 13; if (ShellNum == -3) { @@ -2217,7 +2217,7 @@ int SpawnShell(DSWActor* actor, int ShellNum) actorNew->spr.yrepeat = actorNew->spr.xrepeat = 13; break; case SHOT_SHELL: - actorNew->add_int_z(-Z(13)); + actorNew->spr.pos.Z -= 13; actorNew->spr.angle = actor->spr.angle; HelpMissileLateral(actorNew,2500); actorNew->set_int_ang(NORM_ANGLE(actorNew->spr.int_ang() + 512)); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index e2a9a2055..986b564a4 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -5962,7 +5962,7 @@ void DoPlayerDeathDrown(PLAYER* pp) { pp->pos.Z += 2; if (MoveSkip2 == 0) - actor->add_int_z(Z(4)); + actor->spr.pos.Z += 4; // Stick like glue when you hit the ground if (pp->int_ppos().Z > pp->loz - PLAYER_DEATH_HEIGHT) diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 2dd11b6fd..725a84bc1 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -6556,12 +6556,12 @@ Collision move_ground_missile(DSWActor* actor, int xchange, int ychange, int cei { if (actor->user.z_tgt > actor->int_pos().Z) { - actor->add_int_z(Z(30)); + actor->spr.pos.Z += 30; return retval; } else { - actor->add_int_z(-Z(30)); + actor->spr.pos.Z -= 30; return retval; } } diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index bdf4a65be..4b3154d8d 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -3724,7 +3724,7 @@ AutoShrap: break; case Vomit1: shrap_bounce = false; - actor->add_int_z(-Z(4)); + actor->spr.pos.Z -= 4; shrap_xsize = actor->user.pos.X = 12 + (RANDOM_P2(32<<8)>>8); shrap_ysize = actor->user.pos.Y = 12 + (RANDOM_P2(32<<8)>>8); actor->user.Counter = (RANDOM_P2(2048<<5)>>5); @@ -3739,7 +3739,7 @@ AutoShrap: break; case EMP: shrap_bounce = false; - actor->add_int_z(-Z(4)); + actor->spr.pos.Z -= 4; shrap_xsize = actor->user.pos.X = 5 + (RANDOM_P2(4<<8)>>8); shrap_ysize = actor->user.pos.Y = 5 + (RANDOM_P2(4<<8)>>8); break; @@ -4459,13 +4459,13 @@ bool WeaponMoveHit(DSWActor* actor) int DoUziSmoke(DSWActor* actor) { - actor->add_int_z(-200); // !JIM! Make them float up + actor->spr.pos.Z -= 0.78125; // !JIM! Make them float up return 0; } int DoShotgunSmoke(DSWActor* actor) { - actor->add_int_z(-200); // !JIM! Make them float up + actor->spr.pos.Z -= 0.78125; // !JIM! Make them float up return 0; } @@ -7393,7 +7393,7 @@ int DoStar(DSWActor* actor) SpawnBubble(actor); } - actor->add_int_z(128 * MISSILEMOVETICS); + actor->spr.pos.Z += 0.5 * MISSILEMOVETICS; DoActorZrange(actor); MissileWaterAdjust(actor); @@ -17453,8 +17453,7 @@ int QueueFloorBlood(DSWActor* actor) spawnedActor->spr.extra = 0; spawnedActor->spr.clipdist = 0; spawnedActor->spr.xoffset = spawnedActor->spr.yoffset = 0; - spawnedActor->spr.pos = actor->spr.pos; - spawnedActor->add_int_z(Z(1)); + spawnedActor->spr.pos = actor->spr.pos.plusZ(1); spawnedActor->set_int_ang(RANDOM_P2(2048)); // Just make it any old angle spawnedActor->spr.shade -= 5; // Brighten it up just a bit @@ -17785,7 +17784,7 @@ int DoWallBlood(DSWActor* actor) if (actor->spr.yrepeat < 80) { actor->spr.yrepeat++; - actor->add_int_z(128); + actor->spr.pos.Z += 0.5; } return 0;