From 8f4c418a1b7e7daeed49f03c0282af91b7485fa9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 17 Aug 2022 00:18:47 +0200 Subject: [PATCH] - pos simplifications --- source/games/exhumed/src/move.cpp | 6 ++---- source/games/sw/src/weapon.cpp | 28 ++++++++-------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index b58eef292..229fb591e 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -622,9 +622,7 @@ Collision MoveCreature(DExhumedActor* pActor) Collision MoveCreatureWithCaution(DExhumedActor* pActor) { - int x = pActor->int_pos().X; - int y = pActor->int_pos().Y; - int z = pActor->int_pos().Z; + auto oldv = pActor->spr.pos; auto pSectorPre = pActor->sector(); auto ecx = MoveCreature(pActor); @@ -640,7 +638,7 @@ Collision MoveCreatureWithCaution(DExhumedActor* pActor) if (zDiff > 15360 || (pSector->Flag & kSectUnderwater) || (pSector->pBelow != nullptr && pSector->pBelow->Flag) || pSector->Damage) { - pActor->set_int_pos({ x, y, z }); + pActor->spr.pos = oldv; ChangeActorSect(pActor, pSectorPre); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 2583f8ddb..b8b063471 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -7974,12 +7974,8 @@ int DoPlasmaFountain(DSWActor* actor) int DoPlasma(DSWActor* actor) { int32_t dax, day, daz; - int ox,oy,oz; - - ox = actor->int_pos().X; - oy = actor->int_pos().Y; - oz = actor->int_pos().Z; - + + auto oldv = actor->spr.pos; DoBlurExtend(actor, 0, 4); dax = MOVEx(actor->spr.xvel, actor->int_ang()); @@ -8001,7 +7997,7 @@ int DoPlasma(DSWActor* actor) if (hitActor->hasU() && hitActor != actor->user.WpnGoalActor) { - actor->set_int_pos({ ox, oy, oz }); + actor->spr.pos = oldv; hitActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); actor->user.coll = move_missile(actor, dax, day, daz, Z(16), Z(16), CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -10729,9 +10725,7 @@ int DoFindGroundPoint(DSWActor* actor) int DoNapalm(DSWActor* actor) { - int ox, oy, oz; - - DoBlurExtend(actor, 1, 7); + DoBlurExtend(actor, 1, 7); if (actor->user.Flags & (SPR_UNDERWATER)) { @@ -10744,9 +10738,7 @@ int DoNapalm(DSWActor* actor) } } - ox = actor->int_pos().X; - oy = actor->int_pos().Y; - oz = actor->int_pos().Z; + auto oldv = actor->spr.pos; actor->user.coll = move_missile(actor, actor->user.change.X, actor->user.change.Y, actor->user.change.Z, actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -10766,7 +10758,7 @@ int DoNapalm(DSWActor* actor) { auto hcstat = hitActor->spr.cstat; - actor->set_int_pos({ ox, oy, oz }); + actor->spr.pos = oldv; hitActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); actor->user.coll = move_missile(actor, actor->user.change.X, actor->user.change.Y, actor->user.change.Z, actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -10905,11 +10897,7 @@ int DoMeteor(DSWActor* actor) int DoSerpMeteor(DSWActor* actor) { - int ox, oy, oz; - - ox = actor->int_pos().X; - oy = actor->int_pos().Y; - oz = actor->int_pos().Z; + auto oldv = actor->spr.pos; actor->spr.xrepeat += MISSILEMOVETICS * 2; if (actor->spr.xrepeat > 80) @@ -10929,7 +10917,7 @@ int DoSerpMeteor(DSWActor* actor) { auto hcstat = hitActor->spr.cstat; - actor->set_int_pos({ ox, oy, oz }); + actor->spr.pos = oldv; hitActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); actor->user.coll = move_missile(actor, actor->user.change.X, actor->user.change.Y, actor->user.change.Z, actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS);