From a0b928583be110f0af128c81da2809479cbd2ac5 Mon Sep 17 00:00:00 2001
From: helixhorned <helixhorned@1a8010ca-5511-0410-912e-c29ae57300e0>
Date: Sun, 2 Oct 2011 22:38:09 +0000
Subject: [PATCH] Show fake TROR texture when show-invisibility [I] is on in
 Mapster32/Polymer. Also move a 'int16_t editstatus' declaration from
 polymost.c to engine_priv.h.

git-svn-id: https://svn.eduke32.com/eduke32@2066 1a8010ca-5511-0410-912e-c29ae57300e0
---
 polymer/eduke32/build/src/engine.c      | 42 +++++++++++++++++++++++--
 polymer/eduke32/build/src/engine_priv.h |  2 ++
 polymer/eduke32/build/src/polymost.c    |  2 --
 3 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c
index c62ab592e..2a63e944b 100644
--- a/polymer/eduke32/build/src/engine.c
+++ b/polymer/eduke32/build/src/engine.c
@@ -664,20 +664,38 @@ static void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore)
     for (SECTORS_OF_BUNCH(bunchnum, cf, i))
     {
         dastat = (SECTORFLD(i,stat, cf)&(128+256));
-        if (dastat==0)
+
+        if (dastat==0 || (restore==1 && opicnum[cf][i]&0x8000))
         {
             if (!restore)
             {
                 opicnum[cf][i] = SECTORFLD(i,picnum, cf);
                 if (editstatus && showinvisibility)
                     SECTORFLD(i,picnum, cf) = MAXTILES-1;
-                else if ((dastat&(128+256))==0)
+                else //if ((dastat&(128+256))==0)
                     SECTORFLD(i,picnum, cf) = 13; //FOF;
             }
             else
             {
                 SECTORFLD(i,picnum, cf) = opicnum[cf][i];
             }
+#ifdef POLYMER
+            // will be called only in editor
+            if (rendmode==4)
+            {
+                if (!restore)
+                {
+                    SECTORFLD(i,stat, cf) |= 128;
+                    opicnum[cf][i] |= 0x8000;
+                }
+                else
+                {
+                    SECTORFLD(i,stat, cf) &= ~128;
+                    SECTORFLD(i,picnum, cf) &= 0x7fff;
+                    opicnum[cf][i] = 0;
+                }
+            }
+#endif
         }
     }
 }
@@ -7964,6 +7982,16 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
 # ifdef POLYMER
     if (rendmode == 4)
     {
+        // BEGIN TWEAK ceiling/floor fake 'TROR' pics
+        if (editstatus && showinvisibility)
+        {
+            for (i=0; i<numyaxbunches; i++)
+            {
+                yax_tweakpicnums(i, YAX_CEILING, 0);
+                yax_tweakpicnums(i, YAX_FLOOR, 0);
+            }
+        }
+
         polymer_glinit();
         polymer_drawrooms(daposx, daposy, daposz, daang, dahoriz, dacursectnum);
         bglDisable(GL_CULL_FACE);
@@ -8439,6 +8467,16 @@ killsprite:
 #ifdef POLYMER
     if (rendmode == 4) {
         polymer_drawmasks();
+
+        // END TWEAK ceiling/floor fake 'TROR' pics
+        if (editstatus && showinvisibility)
+        {
+            for (i=0; i<numyaxbunches; i++)
+            {
+                yax_tweakpicnums(i, YAX_CEILING, 1);
+                yax_tweakpicnums(i, YAX_FLOOR, 1);
+            }
+        }
     }
 #endif
 
diff --git a/polymer/eduke32/build/src/engine_priv.h b/polymer/eduke32/build/src/engine_priv.h
index 6a0f0ab29..669a66e65 100644
--- a/polymer/eduke32/build/src/engine_priv.h
+++ b/polymer/eduke32/build/src/engine_priv.h
@@ -42,6 +42,8 @@ extern int16_t globalpicnum;
 extern int32_t globalx1, globaly2;
 extern int32_t globalorientation;
 
+extern int16_t editstatus;
+
 extern int16_t searchit;
 extern int32_t searchx, searchy;
 extern int16_t searchsector, searchwall, searchstat;
diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c
index 82b9fadfa..979e2da87 100644
--- a/polymer/eduke32/build/src/polymost.c
+++ b/polymer/eduke32/build/src/polymost.c
@@ -210,8 +210,6 @@ static char ptempbuf[MAXWALLSB<<1];
 int32_t r_parallaxskyclamping = 1;
 int32_t r_parallaxskypanning = 0;
 
-extern int16_t editstatus;
-
 #define MIN_CACHETIME_PRINT 10