From b55d39e58d3cebc3d063b1aab585291cd98d52f5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 30 Apr 2023 10:05:21 +0200 Subject: [PATCH] - fixed invocation of RunState. --- source/games/duke/src/actors.cpp | 8 ++------ source/games/duke/src/types.h | 4 ---- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index a6537de9d..02d26f838 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -135,15 +135,13 @@ void TickActor(DDukeActor* self) bool conres = execute(self, p, pdist); if (!conres && (self->flags4 & SFLAG4_CONOVERRIDE)) { - self->state_player = &ps[p]; - self->state_dist = pdist; self->flags4 |= SFLAG4_INRUNSTATE; IFVIRTUALPTR(self, DDukeActor, RunState) { - VMValue val[] = { self }; + VMValue val[] = { self, &ps[p], pdist}; try { - VMCall(func, val, 1, nullptr, 0); + VMCall(func, val, 3, nullptr, 0); } catch(const CDukeKillEvent& ev) { @@ -155,8 +153,6 @@ void TickActor(DDukeActor* self) } } self->flags4 &= ~SFLAG4_INRUNSTATE; - self->state_player = nullptr; - self->state_dist = -1; conres = true; } // moveactor gets only called for actors with a scripted runner. diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 6d1333429..f9da0fa6a 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -110,10 +110,6 @@ public: TObjPtr temp_actor, seek_actor; TArray uservars; - // these two variables are only valid while RunState is executed. They are explicitly nulled right afterward and only accessible throgh the CON emulation interface. - struct player_struct* state_player; - double state_dist; - DDukeActor() = default; size_t PropagateMark() override; const ActorInfo* conInfo() const;