From 0d576cf7985131ed4b3a512a78eb3d83a852b72f Mon Sep 17 00:00:00 2001
From: Evan Ramos <hendricks266@gmail.com>
Date: Sun, 29 Mar 2020 08:41:07 +0000
Subject: [PATCH] Fix negative viewtypes to match what World Tour expects

From-SVN: r8787
---
 source/duke3d/src/game.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp
index fcf4b8a1d..adef07d08 100644
--- a/source/duke3d/src/game.cpp
+++ b/source/duke3d/src/game.cpp
@@ -3814,15 +3814,14 @@ PALONLY:
             if ((unsigned)scrofs_action + ACTION_PARAM_COUNT > (unsigned)g_scriptSize)
                 goto skip;
 
-            l = apScript[scrofs_action + ACTION_VIEWTYPE];
+            int32_t viewtype = apScript[scrofs_action + ACTION_VIEWTYPE];
             uint16_t const action_flags = apScript[scrofs_action + ACTION_FLAGS];
 #else
-            l = viewtype;
             uint16_t const action_flags = actor[i].ac.flags;
 #endif
 
-            int const invertp = l < 0;
-            l = klabs(l);
+            int const invertp = viewtype < 0;
+            l = klabs(viewtype);
 
             if (tilehasmodelorvoxel(pSprite->picnum,t->pal) && !(spriteext[i].flags&SPREXT_NOTMD))
             {
@@ -3873,13 +3872,13 @@ PALONLY:
             }
 
 #if !defined LUNATIC
-            t->picnum += frameOffset + apScript[scrofs_action + ACTION_STARTFRAME] + l*curframe;
+            t->picnum += frameOffset + apScript[scrofs_action + ACTION_STARTFRAME] + viewtype*curframe;
 #else
-            t->picnum += frameOffset + startframe + l*curframe;
+            t->picnum += frameOffset + startframe + viewtype*curframe;
 #endif
             // XXX: t->picnum can be out-of-bounds by bad user code.
 
-            if (l > 0)
+            if (viewtype > 0)
                 while (tilesiz[t->picnum].x == 0 && t->picnum > 0)
                     t->picnum -= l;       //Hack, for actors