From f493f3a17f581b75603dceacb3be753d6f14a176 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 1 Aug 2010 21:11:16 +0000 Subject: [PATCH] gl_mesh.c (BuildTris): worked around a type-punned pointer. adapted from quakeforge. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@249 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/gl_mesh.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Quake/gl_mesh.c b/Quake/gl_mesh.c index 1719fc1b..19bc668c 100644 --- a/Quake/gl_mesh.c +++ b/Quake/gl_mesh.c @@ -215,7 +215,7 @@ void BuildTris (void) numorder = 0; numcommands = 0; memset (used, 0, sizeof(used)); - for (i=0 ; inumtris ; i++) + for (i = 0; i < pheader->numtris; i++) { // pick an unused triangle and start the trifan if (used[i]) @@ -226,7 +226,7 @@ void BuildTris (void) for (type = 0 ; type < 2 ; type++) // type = 1; { - for (startv =0 ; startv < 3 ; startv++) + for (startv = 0; startv < 3; startv++) { if (type == 1) len = StripLength (i, startv); @@ -236,16 +236,16 @@ void BuildTris (void) { besttype = type; bestlen = len; - for (j=0 ; jskinwidth; t = (t + 0.5) / pheader->skinheight; - *(float *)&commands[numcommands++] = s; - *(float *)&commands[numcommands++] = t; + // *(float *)&commands[numcommands++] = s; + // *(float *)&commands[numcommands++] = t; + // NOTE: 4 == sizeof(int) + // == sizeof(float) + memcpy (&tmp, &s, 4); + commands[numcommands++] = tmp; + memcpy (&tmp, &t, 4); + commands[numcommands++] = tmp; } }