From 8932b2fc1da691620d481f90ec0e929b411a9767 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 30 Dec 2021 22:54:08 +1100 Subject: [PATCH] - Duke: Replace `DDukeActor` `lastvx` with `ovel.X` calls. --- source/games/duke/src/actors.cpp | 8 ++++---- source/games/duke/src/actors_d.cpp | 4 ++-- source/games/duke/src/gameexec.cpp | 10 +++++----- source/games/duke/src/savegame.cpp | 2 +- source/games/duke/src/spawn.cpp | 6 +++--- source/games/duke/src/types.h | 3 ++- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 4f2f37b14..3a7e4ded7 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -2808,8 +2808,8 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) { if (statstate) { - if (!S_CheckSoundPlaying(actor->lastvx)) - S_PlayActorSound(actor->lastvx, actor); + if (!S_CheckSoundPlaying(actor->ovel.X)) + S_PlayActorSound(actor->ovel.X, actor); } if ((!checkstat || !statstate) && (ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat & CSTAT_SECTOR_SKY) && rnd(8))) { @@ -2825,7 +2825,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) } if (actor->spr.xvel <= 64 && statstate) - S_StopSound(actor->lastvx, actor); + S_StopSound(actor->ovel.X, actor); if ((sc->floorz - sc->ceilingz) < (108 << 8)) { @@ -5038,7 +5038,7 @@ void alterang(int ang, DDukeActor* actor, int playernum) auto Owner = actor->GetOwner(); if (Owner->spr.picnum == TILE_APLAYER) - goalang = getangle(actor->lastvx - actor->spr.pos.X, actor->lastvy - actor->spr.pos.Y); + goalang = getangle(actor->ovel.X - actor->spr.pos.X, actor->lastvy - actor->spr.pos.Y); else goalang = getangle(Owner->spr.pos.X - actor->spr.pos.X, Owner->spr.pos.Y - actor->spr.pos.Y); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 1f8b2d6ef..54189a090 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1014,7 +1014,7 @@ static void movetripbomb(DDukeActor *actor) DDukeActor* hit; x = hitasprite(actor, &hit); - actor->lastvx = x; + actor->ovel.X = x; actor->spr.ang = l; @@ -1081,7 +1081,7 @@ static void movetripbomb(DDukeActor *actor) actor->spr.pos.Z += (3 << 8); SetActor(actor, actor->spr.pos); - if (actor->lastvx != x && lTripBombControl & TRIPBOMB_TRIPWIRE) + if (actor->ovel.X != x && lTripBombControl & TRIPBOMB_TRIPWIRE) { actor->temp_data[2] = 13; S_PlayActorSound(LASERTRIP_ARMING, actor); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 3351e8fa7..7962f6e1c 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1321,8 +1321,8 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, else SetGameVarID(lVar2, act->ceilingz, sActor, sPlayer); break; case ACTOR_HTLASTVX: - if (bSet) act->lastvx = lValue; - else SetGameVarID(lVar2, act->lastvx, sActor, sPlayer); + if (bSet) act->ovel.X = lValue; + else SetGameVarID(lVar2, act->ovel.X, sActor, sPlayer); break; case ACTOR_HTLASTVY: if (bSet) act->lastvy = lValue; @@ -1496,13 +1496,13 @@ static bool ifcansee(DDukeActor* actor, int pnum) { // search around for target player // also modifies 'target' x&y if found. - j = furthestcanseepoint(actor, tosee, &actor->lastvx, &actor->lastvy); + j = furthestcanseepoint(actor, tosee, &actor->ovel.X, &actor->lastvy); } else { // else, they did see it. // save where we were looking.. - actor->lastvx = tosee->spr.pos.X; + actor->ovel.X = tosee->spr.pos.X; actor->lastvy = tosee->spr.pos.Y; } @@ -3151,7 +3151,7 @@ int ParseState::parse(void) i = *(insptr++); // ID of def // g_ac->lastvx and lastvy are last known location of target. - ang = getangle(g_ac->lastvx - g_ac->spr.pos.X, g_ac->lastvy - g_ac->spr.pos.Y); + ang = getangle(g_ac->ovel.X - g_ac->spr.pos.X, g_ac->lastvy - g_ac->spr.pos.Y); SetGameVarID(i, ang, g_ac, g_p); break; } diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index 10575403b..6a35cb8d2 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -311,7 +311,7 @@ void DDukeActor::Serialize(FSerializer& arc) ("timetosleep", timetosleep) ("floorz", floorz) ("ceilingz", ceilingz) - ("lastvx", lastvx) + ("lastvx", ovel.X) ("lastvy", lastvy) ("aflags", aflags) ("saved_ammo", saved_ammo) diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 54cc5080e..3608ae4b7 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -80,7 +80,7 @@ DDukeActor* EGS(sectortype* whatsectp, int s_x, int s_y, int s_z, int s_pn, int8 act->spr.lotag = 0; act->spr.backuploc(); - act->lastvx = 0; + act->ovel.X = 0; act->lastvy = 0; act->timetosleep = 0; @@ -152,7 +152,7 @@ bool initspriteforspawn(DDukeActor* act, const std::initializer_list &exclu act->floorz = act->spr.sector()->floorz; act->ceilingz = act->spr.sector()->ceilingz; - act->lastvx = 0; + act->ovel.X = 0; act->lastvy = 0; act->actorstayput = nullptr; @@ -1031,7 +1031,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) else if (actor->spr.sector()->floorpal == 7) j = 456; else j = 75; } - actor->lastvx = j; + actor->ovel.X = j; } [[fallthrough]]; case SE_30_TWO_WAY_TRAIN: diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 6b377c414..298de91e1 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -37,7 +37,8 @@ public: short attackertype, ang, extra, movflag; short tempang, dispicnum; short timetosleep; - int floorz, ceilingz, lastvx, lastvy, aflags; + vec2_t ovel; + int floorz, ceilingz, ovel.X, lastvy, aflags; union { int saved_ammo;