From b65ae1b741c11dadf7b4efdea2ee6c33984bf765 Mon Sep 17 00:00:00 2001
From: helixhorned <helixhorned@1a8010ca-5511-0410-912e-c29ae57300e0>
Date: Sat, 22 Nov 2014 18:37:23 +0000
Subject: [PATCH] a-c.c: Compile vlineasm4nlogy() only if
 CLASSIC_NONPOW2_YSIZE_WALLS is #defined.

Also make three file-scope variables static.

git-svn-id: https://svn.eduke32.com/eduke32@4758 1a8010ca-5511-0410-912e-c29ae57300e0
---
 polymer/eduke32/build/include/a.h  |  5 +++++
 polymer/eduke32/build/src/a-c.c    | 30 +++++++++++++++++++-----------
 polymer/eduke32/build/src/engine.c | 12 +++---------
 3 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/polymer/eduke32/build/include/a.h b/polymer/eduke32/build/include/a.h
index d04421447..b78cae5b9 100644
--- a/polymer/eduke32/build/include/a.h
+++ b/polymer/eduke32/build/include/a.h
@@ -11,6 +11,11 @@
 #define CLASSIC_SLICE_BY_4
 #define A_C_RESTRICT __restrict
 
+#define CLASSIC_NONPOW2_YSIZE_SPRITES
+#ifdef LUNATIC
+# define CLASSIC_NONPOW2_YSIZE_WALLS
+#endif
+
 /** Definitions of high-precision integer types. **/
 // Should be used for values that represent coordinates with which calculations
 // like dot product are carried out. Substituting 32-bit ints for these will
diff --git a/polymer/eduke32/build/src/a-c.c b/polymer/eduke32/build/src/a-c.c
index 8c3666b36..728c219ce 100644
--- a/polymer/eduke32/build/src/a-c.c
+++ b/polymer/eduke32/build/src/a-c.c
@@ -37,9 +37,10 @@ char *a64_gtrans;
 #endif
 
 static int32_t bpl, transmode = 0;
-int32_t glogx, glogy, gpinc;
+static char *gbuf;
+static int32_t glogx, glogy;
+int32_t gpinc;
 static int32_t gbxinc, gbyinc;
-char *gbuf;
 static char *gpal, *ghlinepal, *gtrans;
 static char *gpal2;
 
@@ -219,13 +220,14 @@ typedef uint32_t uint32_vec4 __attribute__ ((vector_size (16)));
 # define saturate_vplc_trans(vplc, vinc)
 #endif
 
+#ifdef CLASSIC_NONPOW2_YSIZE_WALLS
 // cnt >= 1
-void vlineasm4nlogy(int32_t cnt, char *p, char *const A_C_RESTRICT * pal, char *const A_C_RESTRICT * buf,
-#ifdef USE_VECTOR_EXT
+static void vlineasm4nlogy(int32_t cnt, char *p, char *const A_C_RESTRICT * pal, char *const A_C_RESTRICT * buf,
+# ifdef USE_VECTOR_EXT
     uint32_vec4 vplc, const uint32_vec4 vinc)
-#else
+# else
     uint32_t * vplc, const int32_t *vinc)
-#endif
+# endif
 {
     const int32_t ourbpl = bpl;
 
@@ -236,19 +238,20 @@ void vlineasm4nlogy(int32_t cnt, char *p, char *const A_C_RESTRICT * pal, char *
         p[2] = pal[2][buf[2][ourmulscale32(vplc[2], globaltilesizy)]];
         p[3] = pal[3][buf[3][ourmulscale32(vplc[3], globaltilesizy)]];
 
-#if defined USE_VECTOR_EXT
+# if defined USE_VECTOR_EXT
         vplc += vinc;
-#else
+# else
         vplc[0] += vinc[0];
         vplc[1] += vinc[1];
         vplc[2] += vinc[2];
         vplc[3] += vinc[3];
-#endif
+# endif
         p += ourbpl;
     } while (--cnt);
 
     Bmemcpy(&vplce[0], &vplc[0], sizeof(uint32_t) * 4);
 }
+#endif
 
 // cnt >= 1
 void vlineasm4(int32_t cnt, char *p)
@@ -264,12 +267,17 @@ void vlineasm4(int32_t cnt, char *p)
 #endif
     const int32_t logy = glogy, ourbpl = bpl;
 
-    if (EDUKE32_PREDICT_FALSE(!logy)) // I had an assert on logy for quite a while that NEVER triggered...
+#ifdef CLASSIC_NONPOW2_YSIZE_WALLS
+    if (EDUKE32_PREDICT_FALSE(!logy))
     {
+        // This should only happen when 'globalshiftval = 0' has been set in engine.c.
         vlineasm4nlogy(cnt, p, pal, buf, vplc, vinc);
         return;
     }
-    
+#else
+    assert(logy);
+#endif
+
     // just fucking shoot me
 #ifdef CLASSIC_SLICE_BY_4
     for (; cnt>=4;cnt-=4)
diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c
index 916afb70e..5c9ca6382 100644
--- a/polymer/eduke32/build/src/engine.c
+++ b/polymer/eduke32/build/src/engine.c
@@ -53,11 +53,6 @@ L_State g_engState;
 #endif
 
 #define CACHEAGETIME 16
-#define CLASSIC_NONPOW2_YSIZE_SPRITES
-
-#ifdef LUNATIC
-# define CLASSIC_NONPOW2_YSIZE_WALLS
-#endif
 
 #if !defined(__arm__) && !defined(GEKKO)
 #define HIGH_PRECISION_SPRITE
@@ -4208,15 +4203,14 @@ static int32_t gglogx, gglogy, ggpinc;
 static char *ggbuf, *ggpal;
 
 #ifdef ENGINE_USING_A_C
-extern int32_t glogx, glogy, gpinc;
-extern char *gbuf;
+extern int32_t gpinc;
 #endif
 
 static inline void setupslopevlin_alsotrans(int32_t logylogx, intptr_t bufplc, int32_t pinc)
 {
 #ifdef ENGINE_USING_A_C
-    glogx = (logylogx&255); glogy = (logylogx>>8);
-    gbuf = (char *) bufplc; gpinc = pinc;
+    sethlinesizes(logylogx&255, logylogx>>8, bufplc);
+    gpinc = pinc;
 #else
     setupslopevlin(logylogx, bufplc, pinc);
 #endif