From 35691be9699a2d6076a2cd578a366ae17e66b008 Mon Sep 17 00:00:00 2001
From: plagman <plagman@1a8010ca-5511-0410-912e-c29ae57300e0>
Date: Sun, 12 Apr 2009 10:46:31 +0000
Subject: [PATCH] Fixes models after modeswitches on Windows and removes
 warnings.

git-svn-id: https://svn.eduke32.com/eduke32@1301 1a8010ca-5511-0410-912e-c29ae57300e0
---
 polymer/eduke32/build/include/polymer.h |  1 -
 polymer/eduke32/build/src/polymer.c     | 21 +++++++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h
index be7fc1901..8b27250b9 100644
--- a/polymer/eduke32/build/include/polymer.h
+++ b/polymer/eduke32/build/include/polymer.h
@@ -291,7 +291,6 @@ static void         polymer_updatewall(int16_t wallnum);
 static void         polymer_drawwall(int16_t sectnum, int16_t wallnum);
 // HSR
 static void         polymer_buffertoplane(GLfloat* buffer, GLushort* indices, int32_t indicecount, GLfloat* plane, GLfloat* t, GLfloat* b, GLfloat* n);
-static GLfloat      polymer_dotproduct(GLfloat* in_a, GLfloat* in_b);
 static void         polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLfloat* out);
 static void         polymer_transformpoint(float* inpos, float* pos, float* matrix);
 static void         polymer_pokesector(int16_t sectnum);
diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c
index c28dbd52e..d7351084b 100644
--- a/polymer/eduke32/build/src/polymer.c
+++ b/polymer/eduke32/build/src/polymer.c
@@ -582,6 +582,19 @@ int32_t             polymer_init(void)
         memcpy(spriteplane.buffer, horizsprite, sizeof(GLfloat) * 4 * 5);
     }
 
+    i = 0;
+    while (i < nextmodelid)
+    {
+        if (models[i])
+        {
+            md3model_t* m;
+
+            m = (md3model_t*)models[i];
+            m->indices = NULL;
+        }
+        i++;
+    }
+
     i = 0;
     while (i < (1 << PR_BIT_COUNT))
     {
@@ -1221,7 +1234,7 @@ static void         polymer_displayrooms(int16_t dacursectnum)
                     // hack to avoid occlusion querying portals that are too close to the viewpoint
                     // this is needed because of the near z-clipping plane;
                     if (sqdist < 100)
-                        queryid[sec->wallptr + i] = -1;
+                        queryid[sec->wallptr + i] = 0xFFFFFFFF;
                     else {
                         bglColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
                         bglDepthMask(GL_FALSE);
@@ -1256,13 +1269,13 @@ static void         polymer_displayrooms(int16_t dacursectnum)
             {
                 // REAP
                 result = 0;
-                if (doquery && (queryid[sec->wallptr + i] != -1))
+                if (doquery && (queryid[sec->wallptr + i] != 0xFFFFFFFF))
                 {
                     bglGetQueryObjectivARB(queryid[sec->wallptr + i],
                                            GL_QUERY_RESULT_ARB,
                                            &result);
                     bglDeleteQueriesARB(1, &queryid[sec->wallptr + i]);
-                } else if (queryid[sec->wallptr + i] == -1)
+                } else if (queryid[sec->wallptr + i] == 0xFFFFFFFF)
                     result = 1;
 
                 queryid[sec->wallptr + i] = 0;
@@ -2461,7 +2474,7 @@ static void         polymer_drawwall(int16_t sectnum, int16_t wallnum)
 // HSR
 static void         polymer_buffertoplane(GLfloat* buffer, GLushort* indices, int32_t indicecount, GLfloat* plane, GLfloat* t, GLfloat* b, GLfloat* n)
 {
-    GLfloat         vec1[5], vec2[5], norm, r, BxN[3], NxT[3], TxB[3];
+    GLfloat         vec1[5], vec2[5], norm, r;// BxN[3], NxT[3], TxB[3];
     int32_t         i;
 
     i = 0;