From 6729859e39123f98a45dd126425ba65a28402c8e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 4 Nov 2020 21:25:59 +0100 Subject: [PATCH] - fixed the crane. Cannot take the special value out of the owner field. :( --- source/games/duke/src/actors.cpp | 15 +++++++-------- source/games/duke/src/types.h | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 2eadd1d34..210071c1f 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -715,7 +715,7 @@ void movecrane(DDukeActor *actor, int crane) ps[p].on_crane = nullptr; } t[0]++; - actor->SetOwner(nullptr); + actor->SetActiveCrane(false); } } } @@ -789,7 +789,7 @@ void movecrane(DDukeActor *actor, int crane) setsprite(ScriptIndexToActor(msy[t[4] + 2]), spri->x, spri->y, spri->z - (34 << 8)); auto Owner = actor->GetOwner(); - if (Owner != nullptr) + if (Owner != nullptr || actor->IsActiveCrane()) { int p = findplayer(actor, &x); @@ -804,14 +804,13 @@ void movecrane(DDukeActor *actor, int crane) return; } - auto a_owner = actor->GetOwner(); - if (a_owner != nullptr) + if (Owner != nullptr) { - setsprite(a_owner, spri->pos); + setsprite(Owner, spri->pos); - a_owner->bposx = spri->x; - a_owner->bposy = spri->y; - a_owner->bposz = spri->z; + Owner->bposx = spri->x; + Owner->bposy = spri->y; + Owner->bposz = spri->z; spri->zvel = 0; } diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 35be0880f..524cc35e2 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -77,12 +77,12 @@ struct weaponhit // This used the Owner field - better move this to something more safe. inline bool IsActiveCrane() { - return palvals == -2; + return s.owner == -2; } inline void SetActiveCrane(bool yes) { - palvals = yes ? -2 : -1; + s.owner = yes ? -2 : -1; } int PlayerIndex() const