From 25c93e65fcd4141cf96a90103566067fb111b8d4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 4 Nov 2020 19:15:44 +0100 Subject: [PATCH] - more script ID wrappers for sectors. --- source/games/duke/src/sectors.cpp | 6 ++++-- source/games/duke/src/spawn.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 6d7aa3c57..2bf2f8903 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -971,7 +971,8 @@ void operatesectors(int sn, DDukeActor *actor) case ST_30_ROTATE_RISE_BRIDGE: { - auto act = &hittype[sector[sn].hitag]; + auto act = ScriptIndexToActor(sector[sn].hitag); + if (!act) break; if (act->tempang == 0 || act->tempang == 256) callsound(sn, actor); if (act->s.extra == 1) act->s.extra = 3; else act->s.extra = 1; @@ -980,7 +981,8 @@ void operatesectors(int sn, DDukeActor *actor) case ST_31_TWO_WAY_TRAIN: { - auto act = &hittype[sector[sn].hitag]; + auto act = ScriptIndexToActor(sector[sn].hitag); + if (!act) break; if (act->temp_data[4] == 0) act->temp_data[4] = 1; diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 98211bbcf..c68f061e8 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -179,7 +179,7 @@ int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_listactorstayput = -1; t[0] = t[1] = t[2] = t[3] = t[4] = t[5] = 0; - hittype[i].temp_actor = nullptr; + act->temp_actor = nullptr; if (sp->cstat & 48) if (!isIn(sp->picnum, excludes) && (sp->cstat & 48))