shithub: rott

Download patch

ref: 5d5045dca03452ee0f0231591f064d79ea1f40e7
parent: 1a9dce76c92b63ece4fc2b9ad6f8cb6d06dd0fa8
parent: 3c380e243cc62bc0adfbbbaba95976a0c7ab5da2
author: levesqu8 <levesqu8@msu.edu>
date: Mon Jan 22 11:01:32 EST 2018

Merge branch 'newResolutions'

--- a/rott/_z_zone.h
+++ b/rott/_z_zone.h
@@ -24,7 +24,7 @@
 
 #define MINFRAGMENT     64
 #define DPMI_INT  0x31
-#define MAXMEMORYSIZE   9000000
+#define MAXMEMORYSIZE   900000000
 
 #define LEVELZONESIZE   250000
 
--- a/rott/engine.c
+++ b/rott/engine.c
@@ -39,7 +39,7 @@
 =============================================================================
 */
 //wallcast_t posts[642];//bna++
-wallcast_t posts[800+2];//bna++
+wallcast_t posts[1920+4];//bna++
 //wallcast_t posts[321];
 int lasttilex;
 int lasttiley;
--- a/rott/engine.h
+++ b/rott/engine.h
@@ -38,7 +38,7 @@
     int      posttype;
     int      alttile;
 } wallcast_t;
-extern wallcast_t posts[800+2];//bna++ JUST MAKE IT MAX RES
+extern wallcast_t posts[1920+4];//bna++ JUST MAKE IT MAX RES
 //extern wallcast_t posts[642];//bna++
 //extern wallcast_t posts[321];
 
--- a/rott/modexlib.c
+++ b/rott/modexlib.c
@@ -53,7 +53,7 @@
 
 int    linewidth;
 //int    ylookup[MAXSCREENHEIGHT];
-int    ylookup[600];//just set to max res
+int    ylookup[1080];//just set to max res
 byte  *page1start;
 byte  *page2start;
 byte  *page3start;
@@ -434,9 +434,9 @@
 #if defined(PLATFORM_WIN32) || defined(PLATFORM_MACOSX)
     // FIXME: remove this.  --ryan.
     flags = SDL_FULLSCREEN;
-    SDL_WM_GrabInput(SDL_GRAB_ON);
+    
 #endif
-
+    SDL_WM_GrabInput(SDL_GRAB_ON);
     SDL_WM_SetCaption ("Rise of the Triad", "ROTT");
     SDL_ShowCursor (0);
 //    sdl_surface = SDL_SetVideoMode (320, 200, 8, flags);
--- a/rott/modexlib.h
+++ b/rott/modexlib.h
@@ -108,10 +108,10 @@
 #define PEL_DATA                0x3c9
 #endif
 
-extern  boolean StretchScreen;//bn�++
+extern  boolean StretchScreen;//bn�++
 
 //extern  int      ylookup[MAXSCREENHEIGHT];      // Table of row offsets
-extern  int      ylookup[600];      // just set to max res
+extern  int      ylookup[1080];      // just set to max res
 extern  int      linewidth;
 extern  byte    *page1start;
 extern  byte    *page2start;
--- a/rott/queue.c
+++ b/rott/queue.c
@@ -1,9 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
--- a/rott/rt_cfg.c
+++ b/rott/rt_cfg.c
@@ -583,6 +583,9 @@
             } else if (iGLOBAL_SCREENWIDTH == 800) {
                 G_weaponscale=376;
             }
+            else if (iGLOBAL_SCREENWIDTH == 1024) {
+                G_weaponscale=512;
+            }
         }
 
         // Read in MouseAdjustment
@@ -1880,6 +1883,10 @@
             G_weaponscale=299;
         } else if (iGLOBAL_SCREENWIDTH == 800) {
             G_weaponscale=376;
+        }
+        else if (iGLOBAL_SCREENWIDTH == 1024)
+        {
+            G_weaponscale=512;
         }
     }
     WriteParameter(file,"Weaponscale         ",G_weaponscale);
--- a/rott/rt_draw.c
+++ b/rott/rt_draw.c
@@ -3041,8 +3041,7 @@
     dy=(-y)/time;
     ds=-((s-0x1000000)/time);
 
-    destscreen=SafeMalloc(64000*8);//bna fixme
-
+    destscreen=SafeMalloc(iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT);
     SetupScreen(false);
     ThreeDRefresh();
 
@@ -3094,8 +3093,8 @@
 
 //   int Xres = 320;//org
 //   int Yres = 200;//org
-    int   Xres =   iGLOBAL_SCREENWIDTH;//bna val 800
-    int   Yres = iGLOBAL_SCREENHEIGHT;//bna val 600
+    int   Xres =   iGLOBAL_SCREENWIDTH;
+    int   Yres = iGLOBAL_SCREENHEIGHT;
 
 
     iG_masked = masked;
@@ -3107,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) {
@@ -3114,9 +3120,30 @@
     } else if (iGLOBAL_SCREENWIDTH == 800) {
         RotatedImage=SafeMalloc(131072*8);
     }
+    else if (iGLOBAL_SCREENWIDTH == 1024)
+    {
+        RotatedImage=SafeMalloc(131072*14);
+    }
+    else if (iGLOBAL_SCREENWIDTH == 1280)
+    {
+        RotatedImage=SafeMalloc(131072*20);
+    }
+    else if (iGLOBAL_SCREENWIDTH == 1400)
+    {
+        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) {
@@ -3124,7 +3151,21 @@
         } else if (iGLOBAL_SCREENWIDTH == 800) {
             //memset(RotatedImage,0,131072);//org
             memset(RotatedImage,0,131072*8);
+        }else if (iGLOBAL_SCREENWIDTH == 1024) { 
+            memset(RotatedImage,0,131072*14);
         }
+        else if (iGLOBAL_SCREENWIDTH == 1280)
+        {
+            memset(RotatedImage, 0, 131072*20);
+        }
+        else if (iGLOBAL_SCREENWIDTH == 1400)
+        {
+            memset(RotatedImage, 0, 131072*20);
+        }
+        else if (iGLOBAL_SCREENWIDTH == 1920)
+        {
+            memset(RotatedImage, 0, 131072*50);
+        }
     } else {
         if (iGLOBAL_SCREENWIDTH == 320) {
             memset(RotatedImage,0xff,131072);
@@ -3133,11 +3174,27 @@
         } else if (iGLOBAL_SCREENWIDTH == 800) {
             memset(RotatedImage,0xff,131072*8);
         }
-    }
+        else if (iGLOBAL_SCREENWIDTH == 1024) { 
+            memset(RotatedImage,0xff,131072*14);
+        }
+        else if (iGLOBAL_SCREENWIDTH == 1280)
+        {
+            memset(RotatedImage, 0xff, 131072*20);
+        }
+        else if (iGLOBAL_SCREENWIDTH == 1400)
+        {
+            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);
 
-    if ((masked == false)&&(iGLOBAL_SCREENWIDTH == 800)) {
+    if ((masked == false)&&(iGLOBAL_SCREENWIDTH >= 800)) {
         DisableScreenStretch();
         // SetTextMode (  );
 
@@ -3266,8 +3323,10 @@
 //
 //******************************************************************************
 
+extern boolean skipRotate;
+
 void RotateBuffer (int startangle, int endangle, int startscale, int endscale, int time)
-{
+{   
     int savetics;
 
     //save off fastcounter
@@ -3323,12 +3382,16 @@
         xst = (((-cx)*s)+((328)<<16))-(cy*c);
         xct = (((-cx)*c)+((397)<<16)+(1<<18)-(1<<16))+(cy*s);
     }//328 397
+    else if ((iGLOBAL_SCREENWIDTH >= 1024 )&&(masked == false)) {
+	xst = (((-cx)*s)+((410)<<16))-(cy*c);// 1024/768=1.3333
+	xct = (((-cx)*c)+((500)<<16)+(1<<18)-(1<<16))+(cy*s);
+   }//388 397
 
     mr_xstep=s;
     mr_ystep=c;
 
 
-    if ((iGLOBAL_SCREENWIDTH == 800)&&(masked==0)) {
+    if ((iGLOBAL_SCREENWIDTH >= 800)&&(masked==0)) {
         screen=destscreen+iGLOBAL_SCREENWIDTH;//bna aaaa fix
     } else {
         screen=destscreen;
@@ -5942,9 +6005,6 @@
             ecx += mr_ystep;
         }
     } else if (iGLOBAL_SCREENWIDTH == 800) {
-
-
-
         srctmp = src;
         desttmp = dest;
 
@@ -5984,6 +6044,57 @@
             ecx += mr_ystep;
         }
 
+    }
+    else if (iGLOBAL_SCREENWIDTH >= 1024) {
+        srctmp = src;
+        desttmp = dest;
+
+        desttmp -= (iGLOBAL_SCREENWIDTH*1);
+
+/*
+        ecx = mr_yfrac;
+        edx = mr_xfrac;
+*/
+	while (count--) {
+            eax = edx >> 16;
+            if (eax < (256*3.1) && (ecx >> 16) < (512*2.0)) {
+                eax = (eax << 10) | ((ecx << 6) >> (32-10));
+            } else {
+		eax = 0;
+            }
+			
+            *desttmp++ = srctmp[eax];
+			
+            edx += mr_xstep;
+            ecx += mr_ystep;
+        }
+    }
+    else
+    {
+        srctmp = src;
+        desttmp = dest;
+
+        desttmp -= (iGLOBAL_SCREENWIDTH*1);
+
+/*
+        ecx = mr_yfrac;
+        edx = mr_xfrac;
+*/
+	while (count--) {
+            eax = edx >> 16;
+            if (eax < (256*(iGLOBAL_SCREENWIDTH/320)) && (ecx >> 16) < (512*((iGLOBAL_SCREENWIDTH/320 + iGLOBAL_SCREENHEIGHT/200)<<1))) {
+                eax = (eax << 10) | ((ecx << 6) >> (32-10));
+            } else {
+		eax = 0;
+            }
+			
+            *desttmp++ = srctmp[eax];
+			
+            edx += mr_xstep;
+            ecx += mr_ystep;
+        }
+    
+    
     }
 }
 
--- a/rott/rt_floor.c
+++ b/rott/rt_floor.c
@@ -76,7 +76,7 @@
 static byte     *floor;
 static byte     *ceiling;
 //static int xstarts[MAXVIEWHEIGHT];
-static int xstarts[600];//set to max hight res
+static int xstarts[1080];//set to max hight res
 static byte * skysegs[MAXSKYSEGS];
 static byte * skydata[MAXSKYDATA];
 static int      horizonheight;
@@ -274,7 +274,7 @@
     byte * ptr;
     int c;
 
-    temp=SafeMalloc(256*800);
+    temp=SafeMalloc(256*1024);
 
     ptr=temp;
 
--- a/rott/rt_game.c
+++ b/rott/rt_game.c
@@ -418,6 +418,7 @@
 void DrawPlayScreen (boolean bufferofsonly)
 {
     pic_t *shape;
+    
     int    shapenum;
     int ShowKillsYoffset = 0;//bna++
 
@@ -426,30 +427,14 @@
     
     if ( SHOW_TOP_STATUS_BAR() )
     {
-        if (iGLOBAL_SCREENWIDTH == 640) 
+        if (iGLOBAL_SCREENWIDTH > 320 || iGLOBAL_SCREENHEIGHT > 200)
         {
             shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
             
             DrawTiledRegion( 0, 0, iGLOBAL_SCREENWIDTH, 16, 0,16, shape );
-            
-            shape = ( pic_t * )W_CacheLumpName( "stat_bar", PU_CACHE, Cvt_pic_t, 1 );
-            GameMemToScreen( shape, topBarCenterOffsetX, 0, bufferofsonly );
-        } 
-        else if (iGLOBAL_SCREENWIDTH == 800) 
-        {  
-            shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
-            
-            DrawTiledRegion( 0, 0, iGLOBAL_SCREENWIDTH, 16, 0,16, shape );
-            
-            shape = ( pic_t * )W_CacheLumpName( "stat_bar", PU_CACHE, Cvt_pic_t, 1 );
-            GameMemToScreen( shape, topBarCenterOffsetX, 0, bufferofsonly );
-            
-        } 
-        else if (iGLOBAL_SCREENWIDTH == 320) 
-        {
-            shape = ( pic_t * )W_CacheLumpName( "stat_bar", PU_CACHE, Cvt_pic_t, 1 );
-            GameMemToScreen( shape, 0, 0, bufferofsonly );
         }
+        shape = ( pic_t * )W_CacheLumpName( "stat_bar", PU_CACHE, Cvt_pic_t, 1 );
+        GameMemToScreen( shape, topBarCenterOffsetX, 0, bufferofsonly );
     }
 
     if ( BATTLEMODE )
@@ -465,36 +450,28 @@
         {
             ShowKillsYoffset = KILLS_HEIGHT;
         }
-            if (iGLOBAL_SCREENWIDTH == 640) {
-                //bna fix - not to good? but no one has 286 any more
-                //statusbar dosent cover hole screen, because its a lump picture width max 320
-                //first write dummy shape and next over it
-                GameMemToScreen( shape, 320, (224*2)+16-ShowKillsYoffset, bufferofsonly );
-                //copy next shape to mem
-                GameMemToScreen( shape, 0, (224*2)+16-ShowKillsYoffset, bufferofsonly );
-                // delete bullet in middle of shape picture
-                DrawPPic( 310, (224*2)+17-ShowKillsYoffset, 8 >> 2, 16,
-                          ( byte * )&erase->data, 2, true, bufferofsonly );
-                // delete hart in middle of shape picture
-                DrawPPic( 324, (224*2)+17-ShowKillsYoffset, 8 >> 2, 16,
-                          ( byte * )&erase->data, 2, true, bufferofsonly );
-
-            } else if (iGLOBAL_SCREENWIDTH == 800) {
-                GameMemToScreen( shape, 800-320, 584-ShowKillsYoffset, bufferofsonly );
-                //copy next shape to mem
-                GameMemToScreen( shape, 300, 584-ShowKillsYoffset, bufferofsonly );
-                //copy next shape to mem
-                GameMemToScreen( shape, 0, 584-ShowKillsYoffset, bufferofsonly );
-                // delete 2 bullets in middle of shape picture
-                DrawPPic( 305, 584+1-ShowKillsYoffset, 8 >> 2, 16,
-                          ( byte * )&erase->data, 2, true, bufferofsonly );
-                // delete hart in middle of shape picture
-                DrawPPic( 610, 584+1-ShowKillsYoffset, 8 >> 2, 16,
-                          ( byte * )&erase->data, 2, true, bufferofsonly );
-
-            } else {
-                GameMemToScreen( shape, 0, 184, bufferofsonly );
-            }
+        if (iGLOBAL_SCREENWIDTH > 320 || iGLOBAL_SCREENHEIGHT > 200)
+        {
+            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 - 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 );
+            DrawTiledRegion( 0, iGLOBAL_SCREENHEIGHT - 29, iGLOBAL_SCREENWIDTH, 3, 10,10, shape ); //fill in remaining spots
+            
+            
+            shape = ( pic_t * ) W_CacheLumpName( "bottbar", PU_CACHE, Cvt_pic_t, 1 );
+                  
+            //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
+
         //}
 
         DrawBarAmmo( bufferofsonly );
@@ -2955,27 +2932,30 @@
         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;
         }
+        //fix for play screen accidentally being drawn during transmitter explosion cinematic
+        if (playstate != ex_gameover) 
+            DrawPlayScreen(true);//repaint ammo and life stat
 
     }
 }
--- a/rott/rt_main.c
+++ b/rott/rt_main.c
@@ -255,7 +255,7 @@
 
     // Start up Memory manager with a certain amount of reserved memory
 
-    Z_Init(50000,1000000);
+    Z_Init(50000,10000000);
 
     IN_Startup ();
 
@@ -456,7 +456,7 @@
         }
 #endif
     }
-    SDL_WM_GrabInput( SDL_GRAB_ON );
+    //SDL_WM_GrabInput( SDL_GRAB_ON );
     GameLoop();
 
 
@@ -866,16 +866,16 @@
             if (i < _argc)
             {
                 int width, height;
-                if ( (sscanf(_argv[i], "%dx%d", &width, &height) == 2) &&
-                        ( ( (width == 320) && (height == 200) ) ||
-                          ( (width == 640) && (height == 480) ) ||
-                          ( (width == 800) && (height == 600) ) ) )
+                unsigned int numResParams = sscanf(_argv[i], "%dx%d", &width, &height);
+                if ( numResParams == 2)
                 {
                     iGLOBAL_SCREENWIDTH  = width;
                     iGLOBAL_SCREENHEIGHT = height;
                 }
+/*
                 else
                     printf("Invalid resolution parameter: %s\n", _argv[i]);
+*/
             }
             else
                 printf("Missing resolution parameter\n");
@@ -1145,7 +1145,7 @@
 
     while (1)
     {
-        SDL_WarpMouse(iGLOBAL_SCREENWIDTH<<2, iGLOBAL_SCREENHEIGHT<<2);
+        SDL_WarpMouse(iGLOBAL_SCREENWIDTH<<1, iGLOBAL_SCREENHEIGHT<<1);
         if ( playstate == ex_battledone )
         {
             while( damagecount > 0 )
--- a/rott/rt_ted.c
+++ b/rott/rt_ted.c
@@ -1176,7 +1176,23 @@
     MiscPreCache();
 
     SortPreCache();
-
+    
+    double ratioNewToOldWidth = ((double)iGLOBAL_SCREENWIDTH)/320.0;
+                        
+    double ratioNewToOldHeight = ((double)iGLOBAL_SCREENHEIGHT)/200.0;
+    
+    double newPrecacheBarX = ratioNewToOldWidth * 28.0; //PRECACHEBARX = 28
+    
+    double newPrecacheBarY = ratioNewToOldHeight * 178.0; //PRECACHEBARY = 178
+    
+    double newPrecacheBar1LedX = ratioNewToOldWidth * (double)9.0; //PRECACHEBAR1LEDX = 9
+                        
+    double newPrecacheBar1LedY = ratioNewToOldHeight * (double)8.0; //PRECACHEBAR1LEDY = 8
+    
+    double newPrecacheBar2LedX = newPrecacheBar1LedX; //PRECACHEBAR2LEDX = PRECACHEBAR1LEDX
+    
+    double newPrecacheBar2LedY = ratioNewToOldHeight * (double)12.0; //PRECACHEBAR2LEDY = 12
+    
     if (loadedgame==false)
     {
         maxheapsize=Z_HeapSize();
@@ -1193,15 +1209,45 @@
             currentmem=(newheap*MAXLEDS)/maxheapsize;
             while (lastmem<=currentmem)
             {   //SetTextMode (  );
+                //Note: This isn't drawing 4 LED thingys... its just drawing one big one (made up of 4 of the LED thingys)
+                
+                DrawNormalSprite ((int)(newPrecacheBarX + newPrecacheBar1LedX+(Gs*(lastmem<<2))),
+                                  (int)(newPrecacheBarY + newPrecacheBar1LedY),W_GetNumForName ("led1"));//led1 progressbar
+                
+                DrawNormalSprite ((int)(newPrecacheBarX + newPrecacheBar1LedX+(Gs*(lastmem<<2))),
+                                  (int)(newPrecacheBarY + newPrecacheBar1LedY + 3),W_GetNumForName ("led1"));//led1 progressbar
+                
+                DrawNormalSprite ((int)(newPrecacheBarX + newPrecacheBar1LedX+(Gs*(lastmem<<2)) + 3),
+                                  (int)(newPrecacheBarY + newPrecacheBar1LedY),W_GetNumForName ("led1"));//led1 progressbar
+                
+                DrawNormalSprite ((int)(newPrecacheBarX + newPrecacheBar1LedX+(Gs*(lastmem<<2)) + 3),
+                                  (int)(newPrecacheBarY + newPrecacheBar1LedY + 3),W_GetNumForName ("led1"));//led1 progressbar
+                
+/*
                 if ( iGLOBAL_SCREENWIDTH == 320) {
                     DrawNormalSprite (PRECACHEBARX+PRECACHELED1X+(lastmem<<2),
                                       PRECACHEBARY+PRECACHELED1Y,
                                       W_GetNumForName ("led1"));//led1 progressbar
                 } else if ( iGLOBAL_SCREENWIDTH == 640) {
-                    DrawNormalSprite (72+(Gs*(lastmem<<2)),446,W_GetNumForName ("led1"));//led1 progressbar
-                    DrawNormalSprite (72+(Gs*(lastmem<<2)),446+3,W_GetNumForName ("led1"));//led1 progressbar
-                    DrawNormalSprite (72+3+(Gs*(lastmem<<2)),446,W_GetNumForName ("led1"));//led1 progressbar
-                    DrawNormalSprite (72+3+(Gs*(lastmem<<2)),446+3,W_GetNumForName ("led1"));//led1 progressbar
+                    if (iGLOBAL_SCREENHEIGHT == 400)
+                    {
+                        DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar1LedX+(Gs*(lastmem<<2))),
+                                            (int)(newPrecacheBarY + newPrecacheBar1LedY),W_GetNumForName ("led1"));//led1 progressbar
+                        DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar1LedX+(Gs*(lastmem<<2))),
+                                          (int)(newPrecacheBarY + newPrecacheBar1LedY + 3),W_GetNumForName ("led1"));//led1 progressbar
+                        DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar1LedX+(Gs*(lastmem<<2)) + 3),
+                                          (int)(newPrecacheBarY + newPrecacheBar1LedY),W_GetNumForName ("led1"));//led1 progressbar
+                        DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar1LedX+(Gs*(lastmem<<2)) + 3),
+                                          (int)(newPrecacheBarY + newPrecacheBar1LedY + 3),W_GetNumForName ("led1"));//led1 progressbar
+                    }
+                    else
+                    {
+                        DrawNormalSprite (72+(Gs*(lastmem<<2)),446,W_GetNumForName ("led1"));//led1 progressbar
+                        DrawNormalSprite (72+(Gs*(lastmem<<2)),446+3,W_GetNumForName ("led1"));//led1 progressbar
+                        DrawNormalSprite (72+3+(Gs*(lastmem<<2)),446,W_GetNumForName ("led1"));//led1 progressbar
+                        DrawNormalSprite (72+3+(Gs*(lastmem<<2)),446+3,W_GetNumForName ("led1"));//led1 progressbar
+                    }
+                    
                 } else if ( iGLOBAL_SCREENWIDTH == 800) {
                     DrawNormalSprite (91+(Gs*(lastmem<<2)),559,W_GetNumForName ("led1"));//led1 progressbar
                     DrawNormalSprite (91+(Gs*(lastmem<<2)),559+3,W_GetNumForName ("led1"));//led1 progressbar
@@ -1208,6 +1254,7 @@
                     DrawNormalSprite (91+3+(Gs*(lastmem<<2)),559,W_GetNumForName ("led1"));//led1 progressbar
                     DrawNormalSprite (91+3+(Gs*(lastmem<<2)),559+3,W_GetNumForName ("led1"));//led1 progressbar
                 }
+*/
 
                 lastmem++;
                 VW_UpdateScreen (); // was missing, fixed
@@ -1215,16 +1262,39 @@
             currentcache=(i*MAXLEDS)/(cacheindex+1);
             while (lastcache<=currentcache)
             {
-
+                DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar2LedX+(Gs*(lastcache<<2))),
+                                  (int)(newPrecacheBarY + newPrecacheBar2LedY),W_GetNumForName ("led2"));//led2 progressbar
+                DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar2LedX+(Gs*(lastcache<<2))),
+                                  (int)(newPrecacheBarY + newPrecacheBar2LedY + 3),W_GetNumForName ("led2"));//led2 progressbar
+                DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar2LedX+(Gs*(lastcache<<2)) + 3),
+                                  (int)(newPrecacheBarY + newPrecacheBar2LedY),W_GetNumForName ("led2"));//led2 progressbar
+                DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar2LedX+(Gs*(lastcache<<2)) + 3),
+                                  (int)(newPrecacheBarY + newPrecacheBar2LedY + 3),W_GetNumForName ("led2"));//led2 progressbar
+/*
                 if ( iGLOBAL_SCREENWIDTH == 320) {
                     DrawNormalSprite (PRECACHEBARX+PRECACHELED2X+(lastcache<<2),
                                       PRECACHEBARY+PRECACHELED2Y,
                                       W_GetNumForName ("led2"));//led2 progressbar
-                } else if ( iGLOBAL_SCREENWIDTH == 640) {
-                    DrawNormalSprite (72+(Gs*(lastcache<<2)),458,W_GetNumForName ("led2"));//led2 progressbar
-                    DrawNormalSprite (72+(Gs*(lastcache<<2)),458+3,W_GetNumForName ("led2"));//led2 progressbar
-                    DrawNormalSprite (72+3+(Gs*(lastcache<<2)),458,W_GetNumForName ("led2"));//led2 progressbar
-                    DrawNormalSprite (72+3+(Gs*(lastcache<<2)),458+3,W_GetNumForName ("led2"));//led2 progressbar
+                } 
+                else if ( iGLOBAL_SCREENWIDTH == 640) {
+                    if (iGLOBAL_SCREENHEIGHT == 400)
+                    {
+                        DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar2LedX+(Gs*(lastcache<<2))),
+                                            (int)(newPrecacheBarY + newPrecacheBar2LedY),W_GetNumForName ("led2"));//led2 progressbar
+                        DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar2LedX+(Gs*(lastcache<<2))),
+                                          (int)(newPrecacheBarY + newPrecacheBar2LedY + 3),W_GetNumForName ("led2"));//led2 progressbar
+                        DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar2LedX+(Gs*(lastcache<<2)) + 3),
+                                          (int)(newPrecacheBarY + newPrecacheBar2LedY),W_GetNumForName ("led2"));//led2 progressbar
+                        DrawNormalSprite ((int)(newPrecacheBarX+newPrecacheBar2LedX+(Gs*(lastcache<<2)) + 3),
+                                          (int)(newPrecacheBarY + newPrecacheBar2LedY + 3),W_GetNumForName ("led2"));//led2 progressbar
+                    }
+                    else
+                    {
+                        DrawNormalSprite (72+(Gs*(lastcache<<2)),458,W_GetNumForName ("led2"));//led2 progressbar
+                        DrawNormalSprite (72+(Gs*(lastcache<<2)),458+3,W_GetNumForName ("led2"));//led2 progressbar
+                        DrawNormalSprite (72+3+(Gs*(lastcache<<2)),458,W_GetNumForName ("led2"));//led2 progressbar
+                        DrawNormalSprite (72+3+(Gs*(lastcache<<2)),458+3,W_GetNumForName ("led2"));//led2 progressbar
+                    }
 
                 } else if ( iGLOBAL_SCREENWIDTH == 800) {
                     DrawNormalSprite (91+(Gs*(lastcache<<2)),573,W_GetNumForName ("led2"));//led2 progressbar
@@ -1232,6 +1302,7 @@
                     DrawNormalSprite (91+3+(Gs*(lastcache<<2)),573,W_GetNumForName ("led2"));//led2 progressbar
                     DrawNormalSprite (91+3+(Gs*(lastcache<<2)),573+3,W_GetNumForName ("led2"));//led2 progressbar
                 }
+*/
                 DisableScreenStretch();//bna++
                 VW_UpdateScreen ();//bna++
                 lastcache++;
--- a/rott/rt_util.c
+++ b/rott/rt_util.c
@@ -357,7 +357,7 @@
     px = ERRORVERSIONCOL;
     py = ERRORVERSIONROW;
 #if (BETA == 1)
-    UL_printf ("�");
+    UL_printf ("�");
 #else
     UL_printf (itoa(ROTTMAJORVERSION,&buf[0],10));
 #endif
@@ -1574,7 +1574,7 @@
     px = ERRORVERSIONCOL;
     py = ERRORVERSIONROW;
 #if (BETA == 1)
-    UL_printf ("�");
+    UL_printf ("�");
 #else
     UL_printf (itoa(ROTTMAJORVERSION,&buf[0],10));
 #endif
--- a/rott/rt_view.c
+++ b/rott/rt_view.c
@@ -87,7 +87,7 @@
 byte * greenmap;
 byte * playermaps[MAXPLAYERCOLORS];
 //short  pixelangle[MAXVIEWWIDTH];
-short  pixelangle[800];
+short  pixelangle[1920];
 byte   gammatable[GAMMAENTRIES];
 int    gammaindex;
 int    focalwidth=160;
@@ -212,7 +212,7 @@
         scale = (centerx*focalwidth)/(160);
     } else if ( iGLOBAL_SCREENWIDTH == 640) {
         scale = (centerx*focalwidth)/(160);
-    } else if ( iGLOBAL_SCREENWIDTH == 800) {
+    } else if ( iGLOBAL_SCREENWIDTH >= 800) {
         scale = (centerx*focalwidth)/(160);
     }
 //
@@ -309,53 +309,247 @@
     */
 
     if ( iGLOBAL_SCREENWIDTH == 640) {
-        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;
+        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;
+        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;
     }
 
 
--- a/rott/rt_view.h
+++ b/rott/rt_view.h
@@ -76,7 +76,7 @@
 
 extern byte * playermaps[MAXPLAYERCOLORS];
 //extern short  pixelangle[MAXVIEWWIDTH];
-extern short  pixelangle[800];
+extern short  pixelangle[1920];
 extern byte   gammatable[GAMMAENTRIES];
 extern int    gammaindex;
 extern byte   uniformcolors[MAXPLAYERCOLORS];
--- a/rott/stdout.txt
+++ /dev/null
@@ -1,14 +1,0 @@
-Rise of the Triad Startup  Version 1.4
- Commercial Version 
-Z_INIT: 8950000 bytes
-IN_Startup: Mouse Present
-    Adding DARKWAR.WAD.
-    Adding REMOTE1.RTS.
-W_Wad: Wad Manager Started NUMLUMPS=3904
-RT_DRAW: Tables Initialized
-MU_Startup: 
-SD_SetupFXCard: Fx ok.
-SD_Startup: Fx ok.
-RT_MAIN: Fonts Initialized
-RT_MSG: Message System Started
-RT_VIEW: Colormaps Initialized
--- a/rott/watcom.c
+++ b/rott/watcom.c
@@ -33,6 +33,7 @@
 
 fixed FixedScale(fixed orig, fixed factor, fixed divisor)
 {
+/*
     __int64 x = orig;
     __int64 y = factor;
     __int64 z = divisor;
@@ -40,4 +41,7 @@
     __int64 w = (x * y) / z;
 
     return (w) & 0xffffffff;
+*/
+    //changed to this because arithmetic errors occurred with resolutions > 800x600
+    return (float)orig * factor / divisor;
 }
--- a/rott/winrott.c
+++ b/rott/winrott.c
@@ -48,6 +48,11 @@
         iGLOBAL_FOCALWIDTH = 200 - FocalWidthOffset;
         dGLOBAL_FPFOCALWIDTH = 200.0 - FocalWidthOffset;
     }
+    else if (iGLOBAL_SCREENWIDTH == 1024)
+    {
+        iGLOBAL_FOCALWIDTH = 200 - FocalWidthOffset;
+        dGLOBAL_FPFOCALWIDTH = 200.0 - FocalWidthOffset;
+    }
 }
 
 void SetRottScreenRes (int Width, int Height)
@@ -55,11 +60,26 @@
 
     iGLOBAL_SCREENWIDTH = Width;
     iGLOBAL_SCREENHEIGHT = Height;
+    
+    iGLOBAL_FOCALWIDTH = 160 - FocalWidthOffset;
+    dGLOBAL_FPFOCALWIDTH = (double) iGLOBAL_FOCALWIDTH;
 
+    int middleWidth = Width / 2;
+    
+    iGLOBAL_AMMO_X = middleWidth + 160 - 20;
+    
+    iGLOBAL_AMMO_Y = iGLOBAL_SCREENHEIGHT - 16;
+    
+    iGLOBAL_HEALTH_X = middleWidth - 160 + 20;
+    
+    iGLOBAL_HEALTH_Y = iGLOBAL_AMMO_Y;
 
     iGLOBAL_SCREENBWIDE = iGLOBAL_SCREENWIDTH*(96/320);
     iG_SCREENWIDTH = iGLOBAL_SCREENWIDTH*(96/320);;// default screen width in bytes
+    
+    dTopYZANGLELIMIT = (44*FINEANGLES/360);;
 
+/*
     if (iGLOBAL_SCREENWIDTH == 320) {
         iGLOBAL_FOCALWIDTH = 160 - FocalWidthOffset;
         dGLOBAL_FPFOCALWIDTH = 160.0 - FocalWidthOffset;
@@ -71,14 +91,31 @@
         dTopYZANGLELIMIT = (44*FINEANGLES/360);;
     }
     if (iGLOBAL_SCREENWIDTH == 640) {
-        iGLOBAL_FOCALWIDTH = 180 - FocalWidthOffset;
-        dGLOBAL_FPFOCALWIDTH = 180.0 - FocalWidthOffset ;
-        iGLOBAL_HEALTH_X = 40;//20*2;
-        iGLOBAL_HEALTH_Y = 466;//(185*2)+16;
-        iGLOBAL_AMMO_X = 600;//300*2;
-        iGLOBAL_AMMO_Y = 464;//480-16;
+        if (iGLOBAL_SCREENHEIGHT == 400)
+        {
+            iGLOBAL_FOCALWIDTH = 180 - FocalWidthOffset;
+            dGLOBAL_FPFOCALWIDTH = 180.0 - FocalWidthOffset ;
+            iGLOBAL_HEALTH_X = 180;
+            iGLOBAL_HEALTH_Y = 400 - 16;
+            iGLOBAL_AMMO_X = 460;
+            iGLOBAL_AMMO_Y = 400 - 16;
 
-        dTopYZANGLELIMIT = (42*FINEANGLES/360);;
+            dTopYZANGLELIMIT = (42*FINEANGLES/360);;
+        
+        }
+        else
+        {
+            iGLOBAL_FOCALWIDTH = 180 - FocalWidthOffset;
+            dGLOBAL_FPFOCALWIDTH = 180.0 - FocalWidthOffset ;
+            iGLOBAL_HEALTH_X = 40;//20*2;
+            iGLOBAL_HEALTH_Y = 466;//(185*2)+16;
+            iGLOBAL_AMMO_X = 600;//300*2;
+            iGLOBAL_AMMO_Y = 464;//480-16;
+
+            dTopYZANGLELIMIT = (42*FINEANGLES/360);;
+        
+        }
+        
     }
     if (iGLOBAL_SCREENWIDTH == 800) {
         iGLOBAL_FOCALWIDTH = 200 - FocalWidthOffset;
@@ -90,6 +127,7 @@
 
         dTopYZANGLELIMIT = (90*FINEANGLES/360);;
     }
+*/
 
     //dYZANGLELIMIT = (12*FINEANGLES/360);
     //#define YZANGLELIMIT  (12*FINEANGLES/360)//bna--(30*FINEANGLES/360)