shithub: choc

Download patch

ref: e7abef98528ee0746b72f8089e0ad9e7a01e7755
parent: ea5f633fe42c7693e30106a306b376ec169a4809
author: Fabian Greffrath <fabian@greffrath.com>
date: Thu Dec 18 05:59:47 EST 2014

fix some more endianess issues with the width fields in patch_t structs

as pointed out necessary by Ronald Lasmanowicz for his Wii ports

--- a/src/heretic/f_finale.c
+++ b/src/heretic/f_finale.c
@@ -213,10 +213,10 @@
         }
 
         w = W_CacheLumpNum(FontABaseLump + c - 33, PU_CACHE);
-        if (cx + w->width > SCREENWIDTH)
+        if (cx + SHORT(w->width) > SCREENWIDTH)
             break;
         V_DrawPatch(cx, cy, w);
-        cx += w->width;
+        cx += SHORT(w->width);
     }
 
 }
--- a/src/hexen/f_finale.c
+++ b/src/hexen/f_finale.c
@@ -24,6 +24,7 @@
 #include "s_sound.h"
 #include <ctype.h>
 #include "v_video.h"
+#include "i_swap.h"
 
 // MACROS ------------------------------------------------------------------
 
@@ -224,12 +225,12 @@
             continue;
         }
         w = W_CacheLumpNum(FontABaseLump + c - 33, PU_CACHE);
-        if (cx + w->width > SCREENWIDTH)
+        if (cx + SHORT(w->width) > SCREENWIDTH)
         {
             break;
         }
         V_DrawPatch(cx, cy, w);
-        cx += w->width;
+        cx += SHORT(w->width);
     }
 }
 
--- a/src/hexen/in_lude.c
+++ b/src/hexen/in_lude.c
@@ -23,6 +23,7 @@
 #include "m_misc.h"
 #include "p_local.h"
 #include "v_video.h"
+#include "i_swap.h"
 
 // MACROS ------------------------------------------------------------------
 
@@ -600,11 +601,11 @@
             continue;
         }
         w = W_CacheLumpNum(FontABaseLump + c - 33, PU_CACHE);
-        if (cx + w->width > SCREENWIDTH)
+        if (cx + SHORT(w->width) > SCREENWIDTH)
         {
             break;
         }
         V_DrawPatch(cx, cy, w);
-        cx += w->width;
+        cx += SHORT(w->width);
     }
 }
--- a/src/hexen/mn_menu.c
+++ b/src/hexen/mn_menu.c
@@ -378,7 +378,7 @@
         {
             p = W_CacheLumpNum(FontAYellowBaseLump + c - 33, PU_CACHE);
             V_DrawPatch(x, y, p);
-            x += p->width - 1;
+            x += SHORT(p->width) - 1;
         }
     }
 }
--- a/src/hexen/sb_bar.c
+++ b/src/hexen/sb_bar.c
@@ -26,6 +26,7 @@
 #include "p_local.h"
 #include "s_sound.h"
 #include "v_video.h"
+#include "i_swap.h"
 
 // TYPES -------------------------------------------------------------------
 
@@ -496,7 +497,7 @@
     if (val > 99)
     {
         patch = W_CacheLumpNum(FontBNumBase + val / 100, PU_CACHE);
-        V_DrawShadowedPatch(xpos + 6 - patch->width / 2, y, patch);
+        V_DrawShadowedPatch(xpos + 6 - SHORT(patch->width) / 2, y, patch);
     }
     val = val % 100;
     xpos += 12;
@@ -503,12 +504,12 @@
     if (val > 9 || oldval > 99)
     {
         patch = W_CacheLumpNum(FontBNumBase + val / 10, PU_CACHE);
-        V_DrawShadowedPatch(xpos + 6 - patch->width / 2, y, patch);
+        V_DrawShadowedPatch(xpos + 6 - SHORT(patch->width) / 2, y, patch);
     }
     val = val % 10;
     xpos += 12;
     patch = W_CacheLumpNum(FontBNumBase + val, PU_CACHE);
-    V_DrawShadowedPatch(xpos + 6 - patch->width / 2, y, patch);
+    V_DrawShadowedPatch(xpos + 6 - SHORT(patch->width) / 2, y, patch);
 }
 
 //==========================================================================