From 1763fbc7ff47de6afc4a4a82d319635ec075b623 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 25 Nov 2021 16:55:46 +0100 Subject: [PATCH] - OperateSector --- source/games/sw/src/rotator.cpp | 4 ++-- source/games/sw/src/sector.cpp | 24 ++++++++++++------------ source/games/sw/src/slidor.cpp | 4 ++-- source/games/sw/src/vator.cpp | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/source/games/sw/src/rotator.cpp b/source/games/sw/src/rotator.cpp index 07f001ae0..4a7734b0b 100644 --- a/source/games/sw/src/rotator.cpp +++ b/source/games/sw/src/rotator.cpp @@ -130,9 +130,9 @@ void SetRotatorInactive(DSWActor* actor) } // called for operation from the space bar -void DoRotatorOperate(PLAYERp pp, short sectnum) +void DoRotatorOperate(PLAYERp pp, sectortype* sect) { - short match = sector[sectnum].hitag; + short match = sect->hitag; if (match > 0) { diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 8fe8b0151..f7669d9e6 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -68,11 +68,11 @@ bool TestSpikeMatchActive(short match); bool TestRotatorMatchActive(short match); bool TestSlidorMatchActive(short match); int PlayerCheckDeath(PLAYERp, DSWActor*); -void DoVatorOperate(PLAYERp, short); +void DoVatorOperate(PLAYERp, sectortype*); void DoVatorMatch(PLAYERp pp, short match); -void DoRotatorOperate(PLAYERp, short); +void DoRotatorOperate(PLAYERp, sectortype*); void DoRotatorMatch(PLAYERp pp, short match, bool); -void DoSlidorOperate(PLAYERp, short); +void DoSlidorOperate(PLAYERp, sectortype*); void DoSlidorMatch(PLAYERp pp, short match, bool); void KillMatchingCrackSprites(short match); @@ -708,17 +708,17 @@ short DoSpawnActorTrigger(short match) int OperateSector(short sectnum, short player_is_operating) { PLAYERp pp = GlobPlayerP; + auto sect = §or[sectnum]; // Don't let actors operate locked or secret doors if (!player_is_operating) { SPRITEp fsp; - auto sect = §or[sectnum]; if (sect->hasU() && sect->stag == SECT_LOCK_DOOR) return false; - SWSectIterator it(sectnum); + SWSectIterator it(sect); while (auto actor = it.Next()) { fsp = &actor->s(); @@ -737,19 +737,19 @@ int OperateSector(short sectnum, short player_is_operating) } } - switch (sector[sectnum].lotag) + switch (sect->lotag) { case TAG_VATOR: - DoVatorOperate(pp, sectnum); + DoVatorOperate(pp, sect); return true; case TAG_ROTATOR: - DoRotatorOperate(pp, sectnum); + DoRotatorOperate(pp, sect); return true; case TAG_SLIDOR: - DoSlidorOperate(pp, sectnum); + DoSlidorOperate(pp, sect); return true; } @@ -2388,10 +2388,10 @@ void PlayerOperateEnv(PLAYERp pp) switch (pp->cursector()->lotag) { case TAG_VATOR: - DoVatorOperate(pp, pp->cursectnum); + DoVatorOperate(pp, pp->cursector()); DoSpikeOperate(pp->cursectnum); - DoRotatorOperate(pp, pp->cursectnum); - DoSlidorOperate(pp, pp->cursectnum); + DoRotatorOperate(pp, pp->cursector()); + DoSlidorOperate(pp, pp->cursector()); break; case TAG_SPRING_BOARD: DoSpringBoard(pp/*, pp->cursectnum*/); diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index 5a61086fc..8770725bb 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -125,11 +125,11 @@ void SetSlidorInactive(DSWActor* actor) } // called for operation from the space bar -void DoSlidorOperate(PLAYERp pp, short sectnum) +void DoSlidorOperate(PLAYERp pp, sectortype* sect) { short match; - match = sector[sectnum].hitag; + match = sect->hitag; if (match > 0) diff --git a/source/games/sw/src/vator.cpp b/source/games/sw/src/vator.cpp index 8c4b2985d..36d1cbf20 100644 --- a/source/games/sw/src/vator.cpp +++ b/source/games/sw/src/vator.cpp @@ -144,12 +144,12 @@ void SetVatorInactive(DSWActor* actor) } // called for operation from the space bar -void DoVatorOperate(PLAYERp pp, short sectnum) +void DoVatorOperate(PLAYERp pp, sectortype* sect) { SPRITEp fsp; short match; - SWSectIterator it(sectnum); + SWSectIterator it(sect); while (auto actor = it.Next()) { fsp = &actor->s();