shithub: choc

Download patch

ref: b42d644f8233626a60a9ae1f9fd8294d30bf3f58
parent: 3e63451df5b5d3f9f4019f19977e6b0b1ec10053
author: Turo Lamminen <turol@iki.fi>
date: Sat Nov 12 12:10:50 EST 2022

hexen: Fix integer overflows in FaceMovementDirection

--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -1034,28 +1034,28 @@
     switch (actor->movedir)
     {
         case DI_EAST:
-            actor->angle = 0 << 24;
+            actor->angle = 0u << 24;
             break;
         case DI_NORTHEAST:
-            actor->angle = 32 << 24;
+            actor->angle = 32u << 24;
             break;
         case DI_NORTH:
-            actor->angle = 64 << 24;
+            actor->angle = 64u << 24;
             break;
         case DI_NORTHWEST:
-            actor->angle = 96 << 24;
+            actor->angle = 96u << 24;
             break;
         case DI_WEST:
-            actor->angle = 128 << 24;
+            actor->angle = 128u << 24;
             break;
         case DI_SOUTHWEST:
-            actor->angle = 160 << 24;
+            actor->angle = 160u << 24;
             break;
         case DI_SOUTH:
-            actor->angle = 192 << 24;
+            actor->angle = 192u << 24;
             break;
         case DI_SOUTHEAST:
-            actor->angle = 224 << 24;
+            actor->angle = 224u << 24;
             break;
     }
 }