shithub: rott

Download patch

ref: da547d6299123ed8b0ec665d27108cf52b70b9df
parent: 29c7e4ee1ffc7368f415f4fc9c68597c5cfbe861
author: LTCHIPS <ltchips994@gmail.com>
date: Fri Jun 1 11:20:15 EDT 2018

some code cleanup

--- a/rott/modexlib.c
+++ b/rott/modexlib.c
@@ -646,7 +646,7 @@
     output.x = (iGLOBAL_SCREENWIDTH - output.w)>>1;
         
     output.y = (iGLOBAL_SCREENHEIGHT - output.h)>>1;
-        
+    
     SDL_RenderCopyEx(renderer, tex, NULL, &output, angle, NULL, SDL_FLIP_NONE);
         
     SDL_RenderPresent(renderer);
--- a/rott/rt_game.c
+++ b/rott/rt_game.c
@@ -373,6 +373,14 @@
                         source->height, x, y );
     }
 }
+
+void QueueItemToDraw(pic_t * source, int x, int y)
+{
+
+
+}
+
+
 int topBarCenterOffsetX;
 extern int hudRescaleFactor;
 
@@ -432,11 +440,16 @@
             
             shape = ( pic_t * ) W_CacheLumpName( "bottbar", PU_CACHE, Cvt_pic_t, 1 );
             
+            
+            
+            
             //enqueue(sdl_draw_obj_queue, shape);
             
             //GameMemToScreen( shape, topBarCenterOffsetX, iGLOBAL_SCREENHEIGHT - 16, bufferofsonly ); //using topBarCenterOffsetX since bottbar dims == statbar dims 
         }
         
+        
+        
         GameMemToScreen( shape, topBarCenterOffsetX, iGLOBAL_SCREENHEIGHT - 16, bufferofsonly ); //using topBarCenterOffsetX since bottbar dims == statbar dims
 
         //}
@@ -447,16 +460,9 @@
         if ( demoplayback )
         {
             shape = ( pic_t * )W_CacheLumpName( "demo", PU_CACHE, Cvt_pic_t, 1 );
-            if (iGLOBAL_SCREENWIDTH == 640) {
-                DrawPPic( 148*2, 465, shape->width, shape->height,
-                          ( byte * )&shape->data, 1, true, bufferofsonly );
-            } else if (iGLOBAL_SCREENWIDTH == 800) {
-                DrawPPic( 380, 585, shape->width, shape->height,
-                          ( byte * )&shape->data, 1, true, bufferofsonly );
-            } else {
-                DrawPPic( 148, 185, shape->width, shape->height,
-                          ( byte * )&shape->data, 1, true, bufferofsonly );
-            }
+            
+            DrawPPic( (iGLOBAL_SCREENWIDTH-(shape->width<<2)), (iGLOBAL_SCREENHEIGHT-shape->height)>>1, 
+                    shape->width, shape->height, ( byte * )&shape->data, 1, true, bufferofsonly );
         }
     }
 
@@ -483,21 +489,11 @@
 
         // Draw player's name
         
-        if (iGLOBAL_SCREENWIDTH == 800)
-        {
-            DrawGameString ( MEN_X + 3 + topBarCenterOffsetX, MEN_Y + 2, Names[ character ], bufferofsonly );
-            VW_MeasurePropString( LastNames[ character ], &width, &height );
-            DrawGameString ( MEN_X + 44 - width + topBarCenterOffsetX, MEN_Y + 8,
-                         LastNames[ character ], bufferofsonly );
-        }
-        else
-        {  
-            DrawGameString ( MEN_X + 3 + topBarCenterOffsetX, MEN_Y + 2, Names[ character ], bufferofsonly );
-            VW_MeasurePropString( LastNames[ character ], &width, &height );
-            DrawGameString ( MEN_X + 44 - width + topBarCenterOffsetX, MEN_Y + 8,
-                         LastNames[ character ], bufferofsonly );
+        DrawGameString ( MEN_X + 3 + topBarCenterOffsetX, MEN_Y + 2, Names[ character ], bufferofsonly );
+        VW_MeasurePropString( LastNames[ character ], &width, &height );
+        DrawGameString ( MEN_X + 44 - width + topBarCenterOffsetX, MEN_Y + 8,
+                     LastNames[ character ], bufferofsonly );
         
-        }
         UpdateLives( locplayerstate->lives );
         UpdateScore( gamestate.score );
         DrawTriads( bufferofsonly );
--- a/rott/rt_view.c
+++ b/rott/rt_view.c
@@ -181,13 +181,8 @@
 // calculate scale value for vertical height calculations
 // and sprite x calculations
 //
-    if ( iGLOBAL_SCREENWIDTH == 320) {
-        scale = (centerx*focalwidth)/(160);
-    } else if ( iGLOBAL_SCREENWIDTH == 640) {
-        scale = (centerx*focalwidth)/(160);
-    } else if ( iGLOBAL_SCREENWIDTH >= 800) {
-        scale = (centerx*focalwidth)/(160);
-    }
+
+    scale = (centerx*focalwidth)/(160);
 //
 // divide heightnumerator by a posts distance to get the posts height for
 // the heightbuffer.  The pixel height is height>>HEIGHTFRACTION
@@ -283,295 +278,11 @@
     }
     */
 
-    if ( iGLOBAL_SCREENWIDTH == 640) {
-        if (iGLOBAL_SCREENHEIGHT == 400)
-        {
-            height = 0;//we use height as dummy cnt
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 400 - 32;
-            
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 400 - 32;
-            
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 400 - 32;
-            
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 400 - 32;
-            
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 400 - 32;
-            
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 400 - 32;
-            
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 400 - 32;
-            
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 400 - 32;
-            
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 400 - 16;
-            
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 400;
-            
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 400;
-        
-        }
-        else{
-            height = 0;//we use height as dummy cnt
-            viewsizes[height++]= 380;
-            viewsizes[height++]= 336;
-            viewsizes[height++]= 428;
-            viewsizes[height++]= 352;
-            viewsizes[height++]= 460;
-            viewsizes[height++]= 368;
-            viewsizes[height++]= 492;
-            viewsizes[height++]= 384;
-            viewsizes[height++]= 524;
-            viewsizes[height++]= 400;
-            viewsizes[height++]= 556;
-            viewsizes[height++]= 416;
-            viewsizes[height++]= 588;
-            viewsizes[height++]= 432;
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 448;
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 464;
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 480;
-            viewsizes[height++]= 640;
-            viewsizes[height++]= 480;
-        }
-
-    } else if ( iGLOBAL_SCREENWIDTH == 800) {
-        height = 0;
-        viewsizes[height++]= 556;
-        viewsizes[height++]= 488;
-        
-        viewsizes[height++]= 588;
-        viewsizes[height++]= 504;
-        
-        viewsizes[height++]= 620;
-        viewsizes[height++]= 520;
-        
-        viewsizes[height++]= 652;
-        viewsizes[height++]= 536;
-        
-        viewsizes[height++]= 684;
-        viewsizes[height++]= 552;
-        
-        viewsizes[height++]= 716;
-        viewsizes[height++]= 568;
-        
-        viewsizes[height++]= 748;
-        viewsizes[height++]= 584;
-        
-        viewsizes[height++]= 800;
-        viewsizes[height++]= 600;
-        
-        viewsizes[height++]= 800;
-        viewsizes[height++]= 600;
-        
-        viewsizes[height++]= 800;
-        viewsizes[height++]= 600;
-        
-        viewsizes[height++]= 800;
-        viewsizes[height++]= 600;
-        
-    }
-    else if ( iGLOBAL_SCREENWIDTH == 1024) {
-	height = 0;
-	viewsizes[height++]= 556; 
-        viewsizes[height++]= 488;
-        
-        viewsizes[height++]= 588; 
-        viewsizes[height++]= 504;
-        
-        viewsizes[height++]= 620; 
-        viewsizes[height++]= 520;
-        
-        viewsizes[height++]= 816; 
-        viewsizes[height++]= 704;
-        
-        viewsizes[height++]= 868; 
-        viewsizes[height++]= 720;
-        
-        viewsizes[height++]= 920; 
-        viewsizes[height++]= 736;
-        
-        viewsizes[height++]= 972; 
-        viewsizes[height++]= 752;
-        
-        viewsizes[height++]= 1024; 
-        viewsizes[height++]= 768;
-        
-        viewsizes[height++]= 1024; 
-        viewsizes[height++]= 768;
-        
-        viewsizes[height++]= 1024; 
-        viewsizes[height++]= 768;
-        
-        viewsizes[height++]= 1024; 
-        viewsizes[height++]= 768;
-	}
-    else if ( iGLOBAL_SCREENWIDTH == 1280)
+    height = 0;
+    for (height = 0; height < 21;)
     {
-        height = 0;
-        viewsizes[height++]= 1280; 
-        viewsizes[height++]= 1024;
-        
-        viewsizes[height++]= 1280; 
-        viewsizes[height++]= 1024;
-        
-        viewsizes[height++]= 1280; 
-        viewsizes[height++]= 1024;
-        
-        viewsizes[height++]= 1280; 
-        viewsizes[height++]= 1024;
-        
-        viewsizes[height++]= 1280; 
-        viewsizes[height++]= 1024;
-        
-        viewsizes[height++]= 1280; 
-        viewsizes[height++]= 1024;
-        
-        viewsizes[height++]= 1280; 
-        viewsizes[height++]= 1024;
-        
-        viewsizes[height++]= 1280; 
-        viewsizes[height++]= 1024;
-        
-        viewsizes[height++]= 1280; 
-        viewsizes[height++]= 1024;
-        
-        viewsizes[height++]= 1280; 
-        viewsizes[height++]= 1024;
-        
-        viewsizes[height++]= 1280; 
-        viewsizes[height++]= 1024;
-    }
-    else if ( iGLOBAL_SCREENWIDTH == 1400)
-    {
-        height = 0;
-        viewsizes[height++]= 1400; 
-        viewsizes[height++]= 1050;
-        
-        viewsizes[height++]= 1400; 
-        viewsizes[height++]= 1050;
-        
-        viewsizes[height++]= 1400; 
-        viewsizes[height++]= 1050;
-        
-        viewsizes[height++]= 1400; 
-        viewsizes[height++]= 1050;
-        
-        viewsizes[height++]= 1400; 
-        viewsizes[height++]= 1050;
-        
-        viewsizes[height++]= 1400; 
-        viewsizes[height++]= 1050;
-        
-        viewsizes[height++]= 1400; 
-        viewsizes[height++]= 1050;
-        
-        viewsizes[height++]= 1400; 
-        viewsizes[height++]= 1050;
-        
-        viewsizes[height++]= 1400; 
-        viewsizes[height++]= 1050;
-        
-        viewsizes[height++]= 1400; 
-        viewsizes[height++]= 1050;
-        
-        viewsizes[height++]= 1400; 
-        viewsizes[height++]= 1050;
-    }
-    else if ( iGLOBAL_SCREENWIDTH == 1920)
-    {
-        height = 0;
-        viewsizes[height++]= 1920;
-        viewsizes[height++]= 1080;
-        
-        viewsizes[height++]= 1920;
-        viewsizes[height++]= 1080;
-        
-        viewsizes[height++]= 1920;
-        viewsizes[height++]= 1080;
-        
-        viewsizes[height++]= 1920;
-        viewsizes[height++]= 1080;
-        
-        viewsizes[height++]= 1920;
-        viewsizes[height++]= 1080;
-        
-        viewsizes[height++]= 1920;
-        viewsizes[height++]= 1080;
-        
-        viewsizes[height++]= 1920;
-        viewsizes[height++]= 1080;
-        
-        viewsizes[height++]= 1920;
-        viewsizes[height++]= 1080;
-        
-        viewsizes[height++]= 1920;
-        viewsizes[height++]= 1080;
-        
-        viewsizes[height++]= 1920;
-        viewsizes[height++]= 1080;
-        
-        viewsizes[height++]= 1920;
-        viewsizes[height++]= 1080;
-    }
-    else if ( iGLOBAL_SCREENWIDTH == 3840)
-    {
-        height = 0;
-        viewsizes[height++]= 3840;
-        viewsizes[height++]= 2160;
-        
-        viewsizes[height++]= 3840;
-        viewsizes[height++]= 2160;
-        
-        viewsizes[height++]= 3840;
-        viewsizes[height++]= 2160;
-        
-        viewsizes[height++]= 3840;
-        viewsizes[height++]= 2160;
-        
-        viewsizes[height++]= 3840;
-        viewsizes[height++]= 2160;
-        
-        viewsizes[height++]= 3840;
-        viewsizes[height++]= 2160;
-        
-        viewsizes[height++]= 3840;
-        viewsizes[height++]= 2160;
-        
-        viewsizes[height++]= 3840;
-        viewsizes[height++]= 2160;
-        
-        viewsizes[height++]= 3840;
-        viewsizes[height++]= 2160;
-        
-        viewsizes[height++]= 3840;
-        viewsizes[height++]= 2160;
-        
-        viewsizes[height++]= 3840;
-        viewsizes[height++]= 2160;
-    }
-    else
-    {
-        height = 0;
-        for (height = 0; height < 21;)
-        {
-            viewsizes[height++] = iGLOBAL_SCREENWIDTH;
-            viewsizes[height++] = iGLOBAL_SCREENHEIGHT;
-        }
-    
-    
+        viewsizes[height++] = iGLOBAL_SCREENWIDTH;
+        viewsizes[height++] = iGLOBAL_SCREENHEIGHT;
     }
 
 
--- a/rott/winrott.c
+++ b/rott/winrott.c
@@ -37,7 +37,7 @@
 void RecalculateFocalWidth(void)
 {
     iGLOBAL_FOCALWIDTH = 160 - FocalWidthOffset;
-    dGLOBAL_FPFOCALWIDTH = 160 - FocalWidthOffset;
+    dGLOBAL_FPFOCALWIDTH = (double) FocalWidthOffset;
 }
 
 void SetRottScreenRes (int Width, int Height)