shithub: rott

Download patch

ref: da91b3295abdb26f947958f605aee4c17418ac61
parent: bdc20c79f9404fdf257def8cb9134e4ee0712100
author: levesqu8 <levesqu8@msu.edu>
date: Thu Jan 11 15:26:48 EST 2018

Fix for end cinematics crashing and more refactoring rotate screen code

--- a/rott/rt_draw.c
+++ b/rott/rt_draw.c
@@ -3106,6 +3106,13 @@
 
     //   RotatedImage=SafeMalloc(131072);org
     //RotatedImage=SafeMalloc(131072*8);
+    
+    
+    int amountToAlloc = ((iGLOBAL_SCREENWIDTH * iGLOBAL_SCREENHEIGHT)*2) + 3072; //this replaces 131072
+    
+    RotatedImage = SafeMalloc(amountToAlloc);
+    
+/*
     if (iGLOBAL_SCREENWIDTH == 320) {
         RotatedImage=SafeMalloc(131072);
     } else if (iGLOBAL_SCREENWIDTH == 640) {
@@ -3123,15 +3130,20 @@
     }
     else if (iGLOBAL_SCREENWIDTH == 1400)
     {
-        RotatedImage=SafeMalloc(131072*30);
+        RotatedImage=SafeMalloc(131072*20);
     }
     else if (iGLOBAL_SCREENWIDTH == 1920)
     {
         RotatedImage=SafeMalloc(131072*50);
     }
+*/
 //SetupScreen(false);//used these 2 to test screen size
 //VW_UpdateScreen ();
-    if (masked==0) {
+    if (masked==0) 
+        memset(RotatedImage, 0, amountToAlloc);
+    else
+        memset(RotatedImage, 0xff, amountToAlloc);
+/*
         if (iGLOBAL_SCREENWIDTH == 320) {
             memset(RotatedImage,0,131072);
         } else if (iGLOBAL_SCREENWIDTH == 640) {
@@ -3148,7 +3160,7 @@
         }
         else if (iGLOBAL_SCREENWIDTH == 1400)
         {
-            memset(RotatedImage, 0, 131072*30);
+            memset(RotatedImage, 0, 131072*20);
         }
         else if (iGLOBAL_SCREENWIDTH == 1920)
         {
@@ -3171,13 +3183,14 @@
         }
         else if (iGLOBAL_SCREENWIDTH == 1400)
         {
-            memset(RotatedImage, 0xff, 131072*30);
+            memset(RotatedImage, 0xff, 131072*20);
         }
         else if (iGLOBAL_SCREENWIDTH == 1920)
         {
             memset(RotatedImage, 0xff, 131072*50);
         }
-    }
+*/
+    
     //memset(RotatedImage,0xff,131072);//org
     //memset(RotatedImage,0xff,131072*8);
 
@@ -3309,7 +3322,6 @@
 // RotateBuffer
 //
 //******************************************************************************
-
 void RotateBuffer (int startangle, int endangle, int startscale, int endscale, int time)
 {
     int savetics;
--- a/rott/rt_game.c
+++ b/rott/rt_game.c
@@ -455,7 +455,7 @@
             shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
                 
             //this causes a seg fault when MUSIC_StopSong calls Mix_HaltMusic for some odd reason when player pauses the game...
-            //DrawTiledRegion( 0, iGLOBAL_SCREENHEIGHT, iGLOBAL_SCREENWIDTH, 16, 10,10, shape );
+            //DrawTiledRegion( 0, iGLOBAL_SCREENHEIGHT - 16, iGLOBAL_SCREENWIDTH, 16, 34,32, shape );
                 
             //...yet if we do this...no seg fault
             DrawTiledRegion( 0, iGLOBAL_SCREENHEIGHT - 16, iGLOBAL_SCREENWIDTH, 13, 10,10, shape );
@@ -2932,27 +2932,29 @@
         case 0:
             displayofs += 1;
             MoveScreenUpLeft();//SetTextMode (  );
-            DrawPlayScreen(true);//repaint ammo and life stat
+            //DrawPlayScreen(true);//repaint ammo and life stat
             break;
 
         case 1:
             displayofs -= 1;
             MoveScreenUpRight();
-            DrawPlayScreen(true);//repaint ammo and life stat
+            //DrawPlayScreen(true);//repaint ammo and life stat
             break;
 
         case 2:
             displayofs += 3*iGLOBAL_SCREENBWIDE;
             MoveScreenDownLeft();
-            DrawPlayScreen(true);//repaint ammo and life stat
+            //DrawPlayScreen(true);//repaint ammo and life stat
             break;
 
         case 3:
             displayofs -= 3*iGLOBAL_SCREENBWIDE;
             MoveScreenDownRight();
-            DrawPlayScreen(true);//repaint ammo and life stat
+            //DrawPlayScreen(true);//repaint ammo and life stat
             break;
         }
+        if (playstate != ex_gameover)
+            DrawPlayScreen(true);//repaint ammo and life stat
 
     }
 }