From 1af39eb29def5e6edd83bc4e77842866bdc997b8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 22 Oct 2020 19:46:42 +0200 Subject: [PATCH] - move*bolt. --- source/games/duke/src/actors_d.cpp | 29 ++++++++++++----------------- source/games/duke/src/actors_r.cpp | 12 ++++++------ 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 318a527f2..155e7bf78 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1319,14 +1319,14 @@ static void moveviewscreen(DDukeActor* actor) // //--------------------------------------------------------------------------- -static void movesidebolt(int i) +static void movesidebolt(DDukeActor* actor) { - auto s = &sprite[i]; - auto t = &hittype[i].temp_data[0]; + auto s = &actor->s; + int* t = &actor->temp_data[0]; int x; int sect = s->sectnum; - auto p = findplayer(s, &x); + auto p = findplayer(&actor->s, &x); if (x > 20480) return; CLEAR_THE_BOLT2: @@ -1350,13 +1350,8 @@ CLEAR_THE_BOLT2: } s->picnum++; -#if 0 - // content of l was undefined. - if (l & 1) s->cstat ^= 2; -#endif - if ((krand() & 1) && sector[sect].floorpicnum == HURTRAIL) - S_PlayActorSound(SHORT_CIRCUIT, i); + S_PlayActorSound(SHORT_CIRCUIT, actor); if (s->picnum == SIDEBOLT1 + 4) s->picnum = SIDEBOLT1; } @@ -1367,14 +1362,14 @@ CLEAR_THE_BOLT2: // //--------------------------------------------------------------------------- -static void movebolt(int i) +static void movebolt(DDukeActor *actor) { - auto s = &sprite[i]; - auto t = &hittype[i].temp_data[0]; + auto s = &actor->s; + int* t = &actor->temp_data[0]; int x; int sect = s->sectnum; - auto p = findplayer(s, &x); + auto p = findplayer(&actor->s, &x); if (x > 20480) return; if (t[3] == 0) @@ -1409,7 +1404,7 @@ CLEAR_THE_BOLT: if (l & 1) s->cstat ^= 2; if (s->picnum == (BOLT1+1) && (krand()&7) == 0 && sector[sect].floorpicnum == HURTRAIL) - S_PlayActorSound(SHORT_CIRCUIT,i); + S_PlayActorSound(SHORT_CIRCUIT,actor); if (s->picnum==BOLT1+4) s->picnum=BOLT1; @@ -1503,12 +1498,12 @@ void movestandables_d(void) else if (picnum >= SIDEBOLT1 && picnum <= SIDEBOLT1 + 3) { - movesidebolt(i); + movesidebolt(&hittype[i]); } else if (picnum >= BOLT1 && picnum <= BOLT1 + 3) { - movebolt(i); + movebolt(&hittype[i]); } else if (picnum == WATERDRIP) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 891870599..61914ad31 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -933,14 +933,14 @@ static void movecrack(DDukeActor* actor) // //--------------------------------------------------------------------------- -static void movebolt(int i) +static void movebolt(DDukeActor* actor) { - auto s = &sprite[i]; - auto t = &hittype[i].temp_data[0]; + auto s = &actor->s; + int* t = &actor->temp_data[0]; int x; int sect = s->sectnum; - auto p = findplayer(s, &x); + auto p = findplayer(&actor->s, &x); if (x > 20480) return; if (t[3] == 0) @@ -975,7 +975,7 @@ CLEAR_THE_BOLT: if (l & 1) s->cstat ^= 2; if (s->picnum == (BOLT1 + 1) && (krand() & 1) && sector[sect].floorpicnum == HURTRAIL) - S_PlayActorSound(SHORT_CIRCUIT, i); + S_PlayActorSound(SHORT_CIRCUIT, actor); if (s->picnum == BOLT1 + 4) s->picnum = BOLT1; @@ -1055,7 +1055,7 @@ void movestandables_r(void) else if (picnum >= BOLT1 && picnum <= BOLT1 + 3) { - movebolt(i); + movebolt(&hittype[i]); } else if (picnum == WATERDRIP)