Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- made mirrorsector a pointer array
  • Loading branch information
coelckers committed Nov 21, 2021
1 parent d80d4cc commit 5f1c789
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion source/games/duke/src/_polymost.cpp
Expand Up @@ -182,7 +182,7 @@ void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz cho
int j = g_visibility;
g_visibility = (j >> 1) + (j >> 2);

renderDrawRoomsQ16(tposx, tposy, cposz, tang, choriz.asq16(), mirrorsector[i], true);
renderDrawRoomsQ16(tposx, tposy, cposz, tang, choriz.asq16(), sectnum(mirrorsector[i]), true);

display_mirror = 1;
fi.animatesprites(pm_tsprite, pm_spritesortcnt, tposx, tposy, tang, smoothratio);
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/global.cpp
Expand Up @@ -115,7 +115,7 @@ int cloudclock;
int numcyclers; // sector lighting effects
Cycler cyclers[MAXCYCLERS];
int mirrorcnt;
int mirrorsector[64]; // mirrors
sectortype* mirrorsector[64]; // mirrors
walltype* mirrorwall[64];
int numplayersprites; // player management for some SEs.
player_orig po[MAXPLAYERS];
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/global.h
Expand Up @@ -97,7 +97,7 @@ extern int cloudclock;

extern DDukeActor *spriteq[1024];
extern Cycler cyclers[MAXCYCLERS];
extern int mirrorsector[64];
extern sectortype* mirrorsector[64];
extern walltype* mirrorwall[64];

extern int wupass;
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/premap_d.cpp
Expand Up @@ -390,7 +390,7 @@ void prelevel_d(int g)
sectp->ceilingpicnum = MIRROR;
sectp->floorpicnum = MIRROR;
mirrorwall[mirrorcnt] = &wal;
mirrorsector[mirrorcnt] = sectnum(sectp);
mirrorsector[mirrorcnt] = sectp;
mirrorcnt++;
continue;
}
Expand Down
18 changes: 8 additions & 10 deletions source/games/duke/src/premap_r.cpp
Expand Up @@ -724,16 +724,16 @@ void prelevel_r(int g)

if (wal->overpicnum == MIRROR && (wal->cstat & 32) != 0)
{
j = wal->nextsector;
auto sect = wal->nextSector();

if (mirrorcnt > 63)
I_Error("Too many mirrors (64 max.)");
if ((j >= 0) && sector[j].ceilingpicnum != MIRROR)
if ((j >= 0) && sect->ceilingpicnum != MIRROR)
{
sector[j].ceilingpicnum = MIRROR;
sector[j].floorpicnum = MIRROR;
sect->ceilingpicnum = MIRROR;
sect->floorpicnum = MIRROR;
mirrorwall[mirrorcnt] = wal;
mirrorsector[mirrorcnt] = j;
mirrorsector[mirrorcnt] = sect;
mirrorcnt++;
continue;
}
Expand Down Expand Up @@ -777,12 +777,10 @@ void prelevel_r(int g)
//Invalidate textures in sector behind mirror
for (i = 0; i < mirrorcnt; i++)
{
startwall = sector[mirrorsector[i]].wallptr;
endwall = startwall + sector[mirrorsector[i]].wallnum;
for (j = startwall; j < endwall; j++)
for (auto& mwal : wallsofsector(mirrorsector[i]))
{
wall[j].picnum = MIRROR;
wall[j].overpicnum = MIRROR;
mwal.picnum = MIRROR;
mwal.overpicnum = MIRROR;
}
}
thunder_brightness = 0;
Expand Down

0 comments on commit 5f1c789

Please sign in to comment.