shithub: rott

Download patch

ref: cef9a7f8da0dbdce4e95b17151e75ac3bd4b7ebd
parent: 3fa26c1c743399394546c57430f628431f96b53c
author: levesqu8 <levesqu8@msu.edu>
date: Wed Jan 24 12:13:20 EST 2018

started work on menu to select scr res

--- 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
@@ -1711,6 +1711,10 @@
 //
 //******************************************************************************
 
+extern boolean writeNewResIntoCfg;
+extern int ScreenWidthToWriteToCfg;
+extern int ScreenHeightToWriteToCfg;
+
 void WriteConfig (void)
 {
     int file;
@@ -1859,8 +1863,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, "", ' ', WriteNewResolution},
+    {1, "", ' ', WriteNewResolution},
+    {1, "", ' ', WriteNewResolution},
+    {1, "", ' ', WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution},
+    {1, "", ' ',  WriteNewResolution}
+};
 
+CP_iteminfo VisualOptionsItems = { 20, MENU_Y, 2, 0, 43, VisualOptionsNames, mn_largefont };
+
+CP_iteminfo ScreenResolutionItems = {NORMALKEY_X, 17, 21, 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}
 };
 
@@ -5379,6 +5431,42 @@
     DisplayInfo (0);
     FlipMenuBuf();
 }
+
+void DrawScreenResolutionMenu(void)
+{
+    MenuNum = 1;
+    SetAlternateMenuBuf();
+    ClearMenuBuf();
+    SetMenuTitle ("Screen Resolution");
+    
+    MN_GetCursorLocation( &ScreenResolutionItems, &ScreenResolutionMenu[ 0 ] );
+    DrawMenu (&ScreenResolutionItems, &ScreenResolutionMenu[0]);
+    
+    
+    DrawMenuBufItem (ScreenResolutionItems.x, ((ScreenResolutionItems.curpos*14)+(ScreenResolutionItems.y-2)),
+                     W_GetNumForName( SmallCursor ) + CursorFrame[ CursorNum ] );
+    DisplayInfo (0);
+    FlipMenuBuf();
+
+}
+
+int whichResolution = 0;
+
+void CP_ScreenResolution(void)
+{
+    int which;
+    DrawScreenResolutionMenu();
+
+    do
+    {
+        which = HandleMenu (&ScreenResolutionItems, &ScreenResolutionMenu[0], NULL);
+        whichResolution = which;
+    } while (which >= 0);
+
+    DrawVisualsMenu();
+}
+
+
 
 void CP_VisualsMenu(void)
 {
--- a/rott/winrott.c
+++ b/rott/winrott.c
@@ -11,6 +11,11 @@
 int iGLOBAL_SCREENBWIDE ;
 int iG_SCREENWIDTH;// default screen width in bytes
 
+int ScreenWidthToWriteToCfg = 0;
+int ScreenHeightToWriteToCfg = 0;
+
+int WriteNewResolutionToCfg = 0;
+
 int iGLOBAL_HEALTH_X;
 int iGLOBAL_HEALTH_Y;
 int iGLOBAL_AMMO_X;
@@ -208,3 +213,11 @@
 }
 
 
+extern int whichResolution;
+boolean writeNewResIntoCfg = false;
+
+void WriteNewResolution(void)
+{   
+    
+    
+}
\ No newline at end of file