From 925b27e3cdea9577b184f7a0ed8812027ee27d95 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 25 Feb 2012 15:59:44 +0000 Subject: [PATCH] Try to find another mirror wall if the assigned one breaks. This fixes mirrors consisting of more than one walls not drawing when the first assigned mirror wall breaks. It still does not let you have more than one mirror (i.e. mirror sectors) showing up at the same time in the scene. Affects classic and Polymost only. git-svn-id: https://svn.eduke32.com/eduke32@2387 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 654cb3a44..928b76d60 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -3315,7 +3315,6 @@ void G_AnalyzeSprites(void) void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32_t smoothratio) { - if ((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) #ifdef POLYMER && (getrendermode() != 4) @@ -3324,6 +3323,16 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, i { int32_t j, i = 0, k, dst = 0x7fffffff; + if (g_mirrorCount==0) + { + // XXX: can we have g_mirrorCount==0 but gotpic'd MIRROR? + gotpic[MIRROR>>3] &= ~(1<<(MIRROR&7)); +#ifdef DEBUGGINGAIDS + initprintf("Called G_HandleMirror() with g_mirrorCount==0!\n"); +#endif + return; + } + for (k=g_mirrorCount-1; k>=0; k--) { j = klabs(wall[g_mirrorWall[k]].x - x); @@ -3331,6 +3340,24 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, i if (j < dst) dst = j, i = k; } + if (wall[g_mirrorWall[i]].overpicnum != MIRROR) + { + // try to find a new mirror wall + + int32_t startwall = sector[g_mirrorSector[i]].wallptr; + int32_t endwall = startwall + sector[g_mirrorSector[i]].wallnum; + + for (k=startwall; k= 0 && (wall[j].cstat&32) && wall[j].overpicnum==MIRROR) // cmp. premap.c + { + g_mirrorWall[i] = j; + break; + } + } + } + if (wall[g_mirrorWall[i]].overpicnum == MIRROR) { int32_t tposx,tposy;