- fixed the crane.

Cannot take the special value out of the owner field. :(
This commit is contained in:
Christoph Oelckers 2020-11-04 21:25:59 +01:00
parent 721efae0d3
commit 6729859e39
2 changed files with 9 additions and 10 deletions

View file

@ -715,7 +715,7 @@ void movecrane(DDukeActor *actor, int crane)
ps[p].on_crane = nullptr; ps[p].on_crane = nullptr;
} }
t[0]++; 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)); setsprite(ScriptIndexToActor(msy[t[4] + 2]), spri->x, spri->y, spri->z - (34 << 8));
auto Owner = actor->GetOwner(); auto Owner = actor->GetOwner();
if (Owner != nullptr) if (Owner != nullptr || actor->IsActiveCrane())
{ {
int p = findplayer(actor, &x); int p = findplayer(actor, &x);
@ -804,14 +804,13 @@ void movecrane(DDukeActor *actor, int crane)
return; return;
} }
auto a_owner = actor->GetOwner(); if (Owner != nullptr)
if (a_owner != nullptr)
{ {
setsprite(a_owner, spri->pos); setsprite(Owner, spri->pos);
a_owner->bposx = spri->x; Owner->bposx = spri->x;
a_owner->bposy = spri->y; Owner->bposy = spri->y;
a_owner->bposz = spri->z; Owner->bposz = spri->z;
spri->zvel = 0; spri->zvel = 0;
} }

View file

@ -77,12 +77,12 @@ struct weaponhit
// This used the Owner field - better move this to something more safe. // This used the Owner field - better move this to something more safe.
inline bool IsActiveCrane() inline bool IsActiveCrane()
{ {
return palvals == -2; return s.owner == -2;
} }
inline void SetActiveCrane(bool yes) inline void SetActiveCrane(bool yes)
{ {
palvals = yes ? -2 : -1; s.owner = yes ? -2 : -1;
} }
int PlayerIndex() const int PlayerIndex() const