From 7c6ea9cff79ba6f044713cb6a11ee543e1e5a7c9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 2 Nov 2020 19:28:59 +0100 Subject: [PATCH] - activatebysector. --- source/games/duke/src/actors.cpp | 2 +- source/games/duke/src/dispatch.cpp | 4 ++-- source/games/duke/src/duke3d.h | 2 +- source/games/duke/src/player_d.cpp | 4 ++-- source/games/duke/src/player_r.cpp | 4 ++-- source/games/duke/src/render.cpp | 1 - source/games/duke/src/sectors_d.cpp | 14 +++++++------- source/games/duke/src/sectors_r.cpp | 14 ++++++-------- 8 files changed, 21 insertions(+), 24 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 364558374..5eb297dd0 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -3636,7 +3636,7 @@ void handle_se10(DDukeActor* actor, const int* specialtags) return; } } - fi.activatebysector(s->sectnum, actor->GetIndex()); + fi.activatebysector(s->sectnum, actor); t[0] = 0; } else t[0]++; diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 6eabf9e59..0ca6f26ab 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -45,8 +45,8 @@ void operateforcefields_r(int s, int low); void operateforcefields_d(int s, int low); bool checkhitswitch_d(int snum, int w, DDukeActor *act); bool checkhitswitch_r(int snum, int w, DDukeActor* act); -void activatebysector_d(int sect, int j); -void activatebysector_r(int sect, int j); +void activatebysector_d(int sect, DDukeActor* j); +void activatebysector_r(int sect, DDukeActor* j); void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith); void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith); bool checkhitceiling_d(int sn); diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 7f26ec7c3..df0fb5e12 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -77,7 +77,7 @@ struct Dispatcher void (*operaterespawns)(int low); void (*operateforcefields)(int s, int low); bool (*checkhitswitch)(int snum, int w, DDukeActor* act); - void (*activatebysector)(int sect, int j); + void (*activatebysector)(int sect, DDukeActor* j); void (*checkhitwall)(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith); bool (*checkhitceiling)(int sn); void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn); diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 396142a19..897c9d11d 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -3093,7 +3093,7 @@ HORIZONLY: { if (!(sector[s->sectnum].lotag & 0x8000) && (isanunderoperator(sector[s->sectnum].lotag) || isanearoperator(sector[s->sectnum].lotag))) - fi.activatebysector(s->sectnum, pi); + fi.activatebysector(s->sectnum, pact); if (j) { quickkill(p); @@ -3101,7 +3101,7 @@ HORIZONLY: } } else if (abs(fz - cz) < (32 << 8) && isanunderoperator(sector[psect].lotag)) - fi.activatebysector(psect, pi); + fi.activatebysector(psect, pact); } // center_view diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 842563548..b565aa2b7 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -4063,7 +4063,7 @@ HORIZONLY: { if (!(sector[s->sectnum].lotag & 0x8000) && (isanunderoperator(sector[s->sectnum].lotag) || isanearoperator(sector[s->sectnum].lotag))) - fi.activatebysector(s->sectnum, pact->GetIndex()); + fi.activatebysector(s->sectnum, pact); if (j) { quickkill(p); @@ -4071,7 +4071,7 @@ HORIZONLY: } } else if (abs(fz - cz) < (32 << 8) && isanunderoperator(sector[psect].lotag)) - fi.activatebysector(psect, pact->GetIndex()); + fi.activatebysector(psect, pact); } if (ud.clipping == 0 && sector[p->cursectnum].ceilingz > (sector[p->cursectnum].floorz - (12 << 8))) diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 4d99657f9..a3e2c8fe4 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -404,7 +404,6 @@ void setdrugmode(player_struct *p, int oyrepeat) static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixedhoriz choriz, int sect, int smoothratio) { short gs, tgsect, geosect, geoid = 0; - int spr; renderDrawRoomsQ16(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), sect); fi.animatesprites(cposx, cposy, cang.asbuild(), smoothratio); renderDrawMasks(); diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 2bcc7ca44..34ef41705 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -613,25 +613,25 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act) // //--------------------------------------------------------------------------- -void activatebysector_d(int sect, int j) +void activatebysector_d(int sect, DDukeActor* activator) { - short i, didit; + short didit; didit = 0; - SectIterator it(sect); - while ((i = it.NextIndex()) >= 0) + DukeSectIterator it(sect); + while (auto act = it.Next()) { - if (sprite[i].picnum == ACTIVATOR) + if (act->s.picnum == ACTIVATOR) { - operateactivators(sprite[i].lotag, -1); + operateactivators(act->s.lotag, -1); didit = 1; // return; } } if (didit == 0) - operatesectors(sect, &hittype[j]); + operatesectors(sect, activator); } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index a98abea6b..390162dd8 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -895,22 +895,20 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) // //--------------------------------------------------------------------------- -void activatebysector_r(int sect, int j) +void activatebysector_r(int sect, DDukeActor* activator) { - short i; - - SectIterator it(sect); - while ((i = it.NextIndex()) >= 0) + DukeSectIterator it(sect); + while (auto act = it.Next()) { - if (sprite[i].picnum == ACTIVATOR) + if (act->s.picnum == ACTIVATOR) { - operateactivators(sprite[i].lotag, -1); + operateactivators(act->s.lotag, -1); // return; } } if (sector[sect].lotag != 22) - operatesectors(sect, &hittype[j]); + operatesectors(sect, activator); }