From 53122355fef56b30133e7967cbb401c20d02a04a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 18 Nov 2021 00:47:46 +0100 Subject: [PATCH] - more sectors in spawn.cpp --- source/games/duke/src/spawn.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 7bfe6c344..e9fcb6fca 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -382,7 +382,7 @@ int spawnbloodpoolpart1(DDukeActor *actj, DDukeActor* acti) void initfootprint(DDukeActor* actj, DDukeActor* acti) { auto sp = acti->s; - int sect = sp->sectnum; + auto sect = sp->sector(); if (actj) { auto s1 = sp->sector(); @@ -412,8 +412,8 @@ void initfootprint(DDukeActor* actj, DDukeActor* acti) sp->ang = actj->s->ang; } - sp->z = sector[sect].floorz; - if (sector[sect].lotag != 1 && sector[sect].lotag != 2) + sp->z = sect->floorz; + if (sect->lotag != 1 && sect->lotag != 2) sp->xrepeat = sp->yrepeat = 32; insertspriteq(acti); @@ -482,12 +482,12 @@ void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell) void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE) { auto sp = acti->s; - int sect = sp->sectnum; + auto sect = sp->sector(); auto t = acti->temp_data; sp->cstat |= 64 | 257; sp->picnum += 2; - sp->z = sector[sect].ceilingz + (48 << 8); + sp->z = sect->ceilingz + (48 << 8); t[4] = cranes.Reserve(1); auto& apt = cranes[t[4]]; @@ -1092,11 +1092,9 @@ void spawneffector(DDukeActor* actor) void lotsofglass(DDukeActor *actor, walltype* wal, int n) { int j, z, a; - int sect; + sectortype* sect = nullptr; auto sp = actor->s; - sect = -1; - if (wal == nullptr) { for (j = n - 1; j >= 0; j--) @@ -1121,9 +1119,9 @@ void lotsofglass(DDukeActor *actor, walltype* wal, int n) y1 += delta.y; updatesector(x1, y1, §); - if (sect >= 0) + if (sect) { - z = sector[sect].floorz - (krand() & (abs(sector[sect].ceilingz - sector[sect].floorz))); + z = sect->floorz - (krand() & (abs(sect->ceilingz - sect->floorz))); if (z < -(32 << 8) || z >(32 << 8)) z = sp->z - (32 << 8) + (krand() & ((64 << 8) - 1)); a = sp->ang - 1024; @@ -1189,7 +1187,7 @@ void ceilingglass(DDukeActor* actor, int sectnum, int n) void lotsofcolourglass(DDukeActor* actor, walltype* wal, int n) { int j, z; - int sect = -1; + sectortype* sect = nullptr; int a;; auto sp = actor->s; @@ -1215,7 +1213,7 @@ void lotsofcolourglass(DDukeActor* actor, walltype* wal, int n) y1 += delta.y; updatesector(x1, y1, §); - z = sector[sect].floorz - (krand() & (abs(sector[sect].ceilingz - sector[sect].floorz))); + z = sect->floorz - (krand() & (abs(sect->ceilingz - sect->floorz))); if (z < -(32 << 8) || z >(32 << 8)) z = sp->z - (32 << 8) + (krand() & ((64 << 8) - 1)); a = sp->ang - 1024;