shithub: rott

Download patch

ref: 902ec1a8c46d93883dce62915142e6e990d1f8ea
parent: 8ea6beedb619eda993c77d7cb5d5c3bd53b4db50
parent: eed80d7ae6c768be4420b4f5976708c4d35fad41
author: levesqu8 <levesqu8@msu.edu>
date: Thu Jan 25 11:07:56 EST 2018

Merge branch 'newResolutions'

--- a/rott/WinRott.h
+++ b/rott/WinRott.h
@@ -27,7 +27,7 @@
 
 void EnableScreenStretch(void);
 void DisableScreenStretch(void);
-
+void WriteNewResolution(void);
 /*
 double dYZANGLELIMIT;
 
--- a/rott/rt_cfg.c
+++ b/rott/rt_cfg.c
@@ -121,7 +121,12 @@
 boolean enableExtraPistolDrops = 0;
 boolean allowMovementWithMouseYAxis = 1;
 int FocalWidthOffset = 0;
+int ScreenHeightToWriteToCfg = 0;
 
+int ScreenWidthToWriteToCfg = 0;
+boolean writeNewResIntoCfg = false;
+
+
 boolean joystickenabled  = 0;
 boolean joypadenabled    = 0;
 int     joystickport     = 0;
@@ -1711,6 +1716,10 @@
 //
 //******************************************************************************
 
+extern boolean writeNewResIntoCfg;
+extern int ScreenWidthToWriteToCfg;
+extern int ScreenHeightToWriteToCfg;
+
 void WriteConfig (void)
 {
     int file;
@@ -1859,8 +1868,21 @@
     SafeWriteString(file,"\n;\n");
     SafeWriteString(file,"; Screen Resolution, supported resolutions: \n");
     SafeWriteString(file,"; 320x200, 640x480 and 800x600\n");
-    WriteParameter(file,"ScreenWidth      ",iGLOBAL_SCREENWIDTH);
-    WriteParameter(file,"ScreenHeight     ",iGLOBAL_SCREENHEIGHT);
+    
+    //WriteParameter(file,"ScreenWidth      ",iGLOBAL_SCREENWIDTH);
+    //WriteParameter(file,"ScreenHeight     ",iGLOBAL_SCREENHEIGHT);
+    
+    if (writeNewResIntoCfg)
+    {
+        WriteParameter(file,"ScreenWidth      ",ScreenWidthToWriteToCfg);
+        WriteParameter(file,"ScreenHeight     ",ScreenHeightToWriteToCfg);
+    }
+    else
+    {
+        WriteParameter(file,"ScreenWidth      ",iGLOBAL_SCREENWIDTH);
+        WriteParameter(file,"ScreenHeight     ",iGLOBAL_SCREENHEIGHT);    
+    }
+    
 
     // Write out ViewSize
 
--- a/rott/rt_menu.c
+++ b/rott/rt_menu.c
@@ -772,17 +772,69 @@
 
 CP_MenuNames VisualOptionsNames[] = 
 {
+    "SCREEN RESOLUTION",
     "ADJUST FOCAL WIDTH"
 };
 
-CP_iteminfo VisualOptionsItems = { 20, MENU_Y, 1, 0, 43, VisualOptionsNames, mn_largefont };
+CP_MenuNames ScreenResolutions[] = 
+{
+    "320x200",
+    "640x400",
+    "640x480",
+    "800x600",
+    "1024x768",
+    "1152x864",
+    "1280x720",
+    "1280x768",
+    "1280x800",
+    "1280x960",
+    "1280x1024",
+    //"1366x768",
+    "1400x1050",
+    "1440x900",
+    "1600x900",
+    "1680x1050",
+    "1920x1080",
+    "2560x1080",
+    "2560x1440",
+    "3840x2160"
+};
+CP_itemtype ScreenResolutionMenu[] = {
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    //{1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+    {1, "", ' ',NULL},
+};
 
+CP_iteminfo VisualOptionsItems = { 20, MENU_Y, 2, 0, 43, VisualOptionsNames, mn_largefont };
+
+CP_iteminfo ScreenResolutionItems = {NORMALKEY_X, 17, 19, 0, 16, ScreenResolutions, mn_tinyfont};
+
 CP_iteminfo ExtOptionsItems = { 20, MENU_Y, 8, 0, 43, ExtOptionsNames, mn_largefont };
 
 CP_iteminfo ExtGameOptionsItems = { 20, MENU_Y, 4, 0, 43, ExtGameOptionsNames, mn_largefont }; //LT added
 
+void CP_ScreenResolution(void);
+
 CP_itemtype VisualsOptionsMenu[] = 
 {
+    {1, "", 'S', (menuptr)CP_ScreenResolution},
     {1, "", 'F', (menuptr)DoAdjustFocalWidth}
 };
 
@@ -4615,15 +4667,6 @@
                 "Adjust Threshold", "Small", "Large" );
 }
 
-extern int FocalWidthOffset;
-
-void DoAdjustFocalWidth (void)
-{
-    SliderMenu (&FocalWidthOffset, 200, 0, 44, 81, 194, 1, "block2", NULL,
-                "Adjust Focal Width", "Default", "You Crazy" );
-    DrawVisualsMenu ();
-}
-
 //******************************************************************************
 //
 // DRAW CONTROL MENU SCREEN
@@ -5359,6 +5402,7 @@
 
 
 
+
 //****************************************************************************
 //
 // DrawOptionsMenu ()
@@ -5380,6 +5424,22 @@
     FlipMenuBuf();
 }
 
+void DrawVisualsMenu (void)
+{
+    MenuNum = 1;
+    SetAlternateMenuBuf();
+    ClearMenuBuf();
+    SetMenuTitle ("Visuals Menu");
+    
+    MN_GetCursorLocation( &VisualOptionsItems, &VisualsOptionsMenu[ 0 ] );
+    DrawMenu (&VisualOptionsItems, &VisualsOptionsMenu[0]);
+    DrawMenuBufItem (VisualOptionsItems.x, ((VisualOptionsItems.curpos*14)+(VisualOptionsItems.y-2)),
+                     W_GetNumForName( LargeCursor ) + CursorFrame[ CursorNum ] );
+    DisplayInfo (0);
+    FlipMenuBuf();
+    
+}
+
 void CP_VisualsMenu(void)
 {
     int which;
@@ -5393,20 +5453,173 @@
     DrawControlMenu();
 }
 
-void DrawVisualsMenu (void)
+
+extern int FocalWidthOffset;
+
+void DoAdjustFocalWidth (void)
 {
+    SliderMenu (&FocalWidthOffset, 200, 0, 44, 81, 194, 1, "block2", NULL,
+                "Adjust Focal Width", "Default", "You Crazy" );
+    DrawVisualsMenu ();
+}
+
+void DrawScreenResolutionMenu(void)
+{
     MenuNum = 1;
     SetAlternateMenuBuf();
     ClearMenuBuf();
-    SetMenuTitle ("Visuals Menu");
+    SetMenuTitle ("Screen Resolution");
     
-    MN_GetCursorLocation( &VisualOptionsItems, &VisualsOptionsMenu[ 0 ] );
-    DrawMenu (&VisualOptionsItems, &VisualsOptionsMenu[0]);
-    DrawMenuBufItem (VisualOptionsItems.x, ((VisualOptionsItems.curpos*14)+(VisualOptionsItems.y-2)),
-                     W_GetNumForName( LargeCursor ) + CursorFrame[ CursorNum ] );
+    MN_GetCursorLocation( &ScreenResolutionItems, &ScreenResolutionMenu[ 0 ] );
+    DrawMenu (&ScreenResolutionItems, &ScreenResolutionMenu[0]);
+
     DisplayInfo (0);
     FlipMenuBuf();
+
+}
+
+void CP_RestartProgramMessage
+(
+    void
+)
+
+{
+    CP_ErrorMsg( "Note:",
+                 "Changes will not be applied until the application is restarted. "
+                 "Hit any key to continue.",
+                 mn_smallfont );
+}
+
+extern int ScreenWidthToWriteToCfg;
+extern int ScreenHeightToWriteToCfg;
+extern boolean writeNewResIntoCfg;
+
+void CP_ScreenResolution(void)
+{
+    int which;
     
+    //CP_RestartProgramMessage();
+    
+    DrawScreenResolutionMenu();
+
+    do
+    {
+        which = HandleMenu (&ScreenResolutionItems, &ScreenResolutionMenu[0], NULL);
+        switch(which)
+        {
+            case 0:
+                ScreenWidthToWriteToCfg = 320;
+                ScreenHeightToWriteToCfg = 200;
+                writeNewResIntoCfg = true;
+                break;
+            case 1:
+                ScreenWidthToWriteToCfg = 640;
+                ScreenHeightToWriteToCfg = 400;
+                writeNewResIntoCfg = true;
+                break;
+            case 2:
+                ScreenWidthToWriteToCfg = 640;
+                ScreenHeightToWriteToCfg = 480;
+                writeNewResIntoCfg = true;
+                break;
+            case 3:
+                ScreenWidthToWriteToCfg = 800;
+                ScreenHeightToWriteToCfg = 600;
+                writeNewResIntoCfg = true;
+                break;
+            case 4:
+                ScreenWidthToWriteToCfg = 1024;
+                ScreenHeightToWriteToCfg = 768;
+                writeNewResIntoCfg = true;
+                break;
+            case 5:
+                ScreenWidthToWriteToCfg = 1152;
+                ScreenHeightToWriteToCfg = 864;
+                writeNewResIntoCfg = true;
+                break;
+            case 6:
+                ScreenWidthToWriteToCfg = 1280;
+                ScreenHeightToWriteToCfg = 720;
+                writeNewResIntoCfg = true;
+                break;
+            case 7:
+                ScreenWidthToWriteToCfg = 1280;
+                ScreenHeightToWriteToCfg = 768;
+                writeNewResIntoCfg = true;
+                break;
+            case 8:
+                ScreenWidthToWriteToCfg = 1280;
+                ScreenHeightToWriteToCfg = 800;
+                writeNewResIntoCfg = true;
+                break;
+            case 9:
+                ScreenWidthToWriteToCfg = 1280;
+                ScreenHeightToWriteToCfg = 960;
+                writeNewResIntoCfg = true;
+                break;
+            case 10:
+                ScreenWidthToWriteToCfg = 1280;
+                ScreenHeightToWriteToCfg = 1024;
+                writeNewResIntoCfg = true;
+                break;
+/*          buggy af mode
+            case 11:
+                ScreenWidthToWriteToCfg = 1366;
+                ScreenHeightToWriteToCfg = 768;
+                writeNewResIntoCfg = true;
+                break;
+*/
+            case 11:
+                ScreenWidthToWriteToCfg = 1400;
+                ScreenHeightToWriteToCfg = 1050;
+                writeNewResIntoCfg = true;
+                break;
+            case 12:
+                ScreenWidthToWriteToCfg = 1440;
+                ScreenHeightToWriteToCfg = 900;
+                writeNewResIntoCfg = true;
+                break;
+            case 13:
+                ScreenWidthToWriteToCfg = 1600;
+                ScreenHeightToWriteToCfg = 900;
+                writeNewResIntoCfg = true;
+                break;
+            case 14:
+                ScreenWidthToWriteToCfg = 1680;
+                ScreenHeightToWriteToCfg = 1050;
+                writeNewResIntoCfg = true;
+                break;
+            case 15:
+                ScreenWidthToWriteToCfg = 1920;
+                ScreenHeightToWriteToCfg = 1080;
+                writeNewResIntoCfg = true;
+                break;
+            case 16:
+                ScreenWidthToWriteToCfg = 2560;
+                ScreenHeightToWriteToCfg = 1080;
+                writeNewResIntoCfg = true;
+                break;
+            case 17:
+                ScreenWidthToWriteToCfg = 2560;
+                ScreenHeightToWriteToCfg = 1440;
+                writeNewResIntoCfg = true;
+                break;
+            case 18:
+                ScreenWidthToWriteToCfg = 3840;
+                ScreenHeightToWriteToCfg = 2160;
+                writeNewResIntoCfg = true;
+                break;
+            default:
+                break;
+        }
+        
+        
+    } while (which >= 0);
+    
+    if (writeNewResIntoCfg)
+        CP_RestartProgramMessage();
+
+    DrawVisualsMenu();
 }
 
 
--- a/rott/winrott.c
+++ b/rott/winrott.c
@@ -205,6 +205,4 @@
     for (Ycnt=b+((viewheight-startY-1)*iGLOBAL_SCREENWIDTH); Ycnt>b; Ycnt-=iGLOBAL_SCREENWIDTH) {
         memcpy(Ycnt+startoffset,Ycnt,viewwidth-startX);
     }
-}
-
-
+}
\ No newline at end of file