From 7a95c1661e0513faa8cdfd00640a0cf2a700f2c4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 4 Nov 2020 19:04:20 +0100 Subject: [PATCH] - wrap actor index storage in sector in the script index API. --- source/games/duke/src/player_r.cpp | 3 ++- source/games/duke/src/spawn.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 4a408dafb..7b025d320 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -4030,7 +4030,8 @@ HORIZONLY: psect = s->sectnum; if (ud.clipping == 0 && sector[psect].lotag == ST_31_TWO_WAY_TRAIN) { - if (sprite[sector[psect].hitag].xvel && hittype[sector[psect].hitag].temp_data[0] == 0) // hijack + auto act = ScriptIndexToActor(sector[psect].hitag); + if (act && act->s.xvel && act->temp_data[0] == 0) { quickkill(p); return; diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 298eea42e..98211bbcf 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -961,7 +961,7 @@ void spawneffector(DDukeActor* actor) if (sp->pal) sp->clipdist = 1; else sp->clipdist = 0; t[3] = sector[sect].floorz; - sector[sect].hitag = actor->GetIndex(); // hijack + sector[sect].hitag = ActorToScriptIndex(actor); } DukeSpriteIterator it; @@ -1014,7 +1014,7 @@ void spawneffector(DDukeActor* actor) sp->extra = 0; else sp->extra = 1; - sector[sect].hitag = actor->GetIndex(); // hijack + sector[sect].hitag = ActorToScriptIndex(actor); int j = 0;