shithub: rott

Download patch

ref: 703c099c93c279f05c49934ddf56df0140fe3499
parent: 60c69e088e00e271da6857f056c67cc5d1b8df3a
author: levesqu8 <levesqu8@msu.edu>
date: Mon Nov 13 12:28:29 EST 2017

Added menu option to adjust focal width

--- a/rott/rt_menu.c
+++ b/rott/rt_menu.c
@@ -714,6 +714,7 @@
 
 CP_MenuNames ControlMMenuNames[] =
 {
+    "VISUAL OPTIONS",
     "CONTROLS",
     "USER OPTIONS",
     "EXT USER OPTIONS",//bna added
@@ -722,11 +723,12 @@
     "SOUND FX VOLUME"
 
 };
-CP_iteminfo ControlMItems = {32, 48-8, 6, 0, 32, ControlMMenuNames, mn_largefont };//bna added
+CP_iteminfo ControlMItems = {32, 48-8, 7, 0, 32, ControlMMenuNames, mn_largefont };//bna added
 //CP_iteminfo ControlMItems = {32, 48, 4, 0, 32, ControlMMenuNames, mn_largefont };
-
+void CP_VisualsMenu(void);
 CP_itemtype ControlMMenu[] =
 {
+    {1, "adjfwid\0", 'W', (menuptr)CP_VisualsMenu},
     {2, "cntl\0",     'C', (menuptr)CP_Control},
     {1, "uopt\0",     'U', (menuptr)CP_OptionsMenu},
     {1, "euopt\0", 'E', (menuptr)CP_ExtOptionsMenu},//bna added
@@ -733,7 +735,6 @@
     {1, "eaopt\0", 'A', (menuptr)CP_ExtGameOptionsMenu},
     {1, "muvolumn\0", 'M', (menuptr)MusicVolume},
     {1, "fxvolumn\0", 'S', (menuptr)FXVolume}
-
 };
 
 CP_MenuNames OptionsNames[] =
@@ -768,10 +769,22 @@
     "ENABLE ZOMROTT"
 }; //LT added
 
+CP_MenuNames VisualOptionsNames[] = 
+{
+    "ADJUST FOCAL WIDTH"
+};
+
+CP_iteminfo VisualOptionsItems = { 20, MENU_Y, 1, 0, 43, VisualOptionsNames, mn_largefont };
+
 CP_iteminfo ExtOptionsItems = { 20, MENU_Y, 7, 0, 43, ExtOptionsNames, mn_largefont };
 
 CP_iteminfo ExtGameOptionsItems = { 20, MENU_Y, 4, 0, 43, ExtGameOptionsNames, mn_largefont }; //LT added
 
+CP_itemtype VisualsOptionsMenu[] = 
+{
+    {1, "", 'F', (menuptr)DoAdjustFocalWidth}
+};
+
 CP_itemtype ExtOptionsMenu[] =
 {
     {1, "", 'M', NULL},
@@ -780,7 +793,7 @@
     {1, "", 'J', NULL},
     {1, "", 'F', NULL},
     {1, "", 'A', NULL},
-    {1, "", 'U', NULL}
+    {1, "", 'U', NULL},
 };
 
 CP_itemtype ExtGameMenu[] =
@@ -1697,6 +1710,10 @@
     FreeSavedScreenPtr ();
 
     WriteConfig ();
+    
+    //change the focal width if modified
+    
+    RecalculateFocalWidth();
 
     INL_GetJoyDelta (joystickport, &joyx, &joyy);
 
@@ -4596,6 +4613,15 @@
                 "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
@@ -4903,8 +4929,6 @@
 
             mouseactive = 1;
         }
-#else
-    #error please define your platform.
 #endif
 
         buttons = IN_GetMouseButtons();
@@ -5353,6 +5377,37 @@
     DisplayInfo (0);
     FlipMenuBuf();
 }
+
+void CP_VisualsMenu(void)
+{
+    int which;
+    DrawVisualsMenu();
+
+    do
+    {
+        which = HandleMenu (&VisualOptionsItems, &VisualsOptionsMenu[0], NULL);
+    } while (which >= 0);
+
+    DrawControlMenu();
+}
+
+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();
+    
+}
+
+
 //****************************************************************************
 //
 // DrawExtOptionsMenu ()  () bna added
@@ -5370,6 +5425,7 @@
     MN_GetCursorLocation( &ExtOptionsItems, &ExtOptionsMenu[ 0 ] );
     DrawMenu (&ExtOptionsItems, &ExtOptionsMenu[0]);
     DrawExtOptionsButtons ();
+    
     DisplayInfo (0);
 
     FlipMenuBuf();
@@ -5435,6 +5491,7 @@
 
     DrawControlMenu();
 }
+
 void DrawExtOptionsButtons (void)
 {
     int i,
--- a/rott/rt_menu.h
+++ b/rott/rt_menu.h
@@ -213,5 +213,6 @@
 void CP_CaptureTheTriadError( void );
 void CP_TeamPlayErrorMessage( void );
 void CP_ExtGameOptionsMenu( void );
+void DoAdjustFocalWidth (void);
 
 #endif
--- a/rott/winrott.c
+++ b/rott/winrott.c
@@ -30,9 +30,26 @@
 
 extern int  viewheight;
 extern int  viewwidth;
-extern int scaleOffset;
+extern int FocalWidthOffset;
 //----------------------------------------------------------------------
 #define FINEANGLES                        2048
+
+void RecalculateFocalWidth(void)
+{
+    if (iGLOBAL_SCREENWIDTH == 320) {
+        iGLOBAL_FOCALWIDTH = 160 - FocalWidthOffset;
+        dGLOBAL_FPFOCALWIDTH = 160.0 - FocalWidthOffset;
+    }
+    else if (iGLOBAL_SCREENWIDTH == 640) {
+        iGLOBAL_FOCALWIDTH = 180 - FocalWidthOffset;
+        dGLOBAL_FPFOCALWIDTH = 180.0 - FocalWidthOffset ;
+    }
+    else if (iGLOBAL_SCREENWIDTH == 800) {
+        iGLOBAL_FOCALWIDTH = 200 - FocalWidthOffset;
+        dGLOBAL_FPFOCALWIDTH = 200.0 - FocalWidthOffset;
+    }
+}
+
 void SetRottScreenRes (int Width, int Height)
 {
 
@@ -44,8 +61,8 @@
     iG_SCREENWIDTH = iGLOBAL_SCREENWIDTH*(96/320);;// default screen width in bytes
 
     if (iGLOBAL_SCREENWIDTH == 320) {
-        iGLOBAL_FOCALWIDTH = 160 - scaleOffset;
-        dGLOBAL_FPFOCALWIDTH = 160.0 - scaleOffset;
+        iGLOBAL_FOCALWIDTH = 160 - FocalWidthOffset;
+        dGLOBAL_FPFOCALWIDTH = 160.0 - FocalWidthOffset;
         iGLOBAL_HEALTH_X = 20;
         iGLOBAL_HEALTH_Y = 185;
         iGLOBAL_AMMO_X = 300;
@@ -54,8 +71,8 @@
         dTopYZANGLELIMIT = (44*FINEANGLES/360);;
     }
     if (iGLOBAL_SCREENWIDTH == 640) {
-        iGLOBAL_FOCALWIDTH = 180- scaleOffset;
-        dGLOBAL_FPFOCALWIDTH = 180.0- scaleOffset ;
+        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;
@@ -64,8 +81,8 @@
         dTopYZANGLELIMIT = (42*FINEANGLES/360);;
     }
     if (iGLOBAL_SCREENWIDTH == 800) {
-        iGLOBAL_FOCALWIDTH = 200- scaleOffset;
-        dGLOBAL_FPFOCALWIDTH = 200.0 - scaleOffset;
+        iGLOBAL_FOCALWIDTH = 200 - FocalWidthOffset;
+        dGLOBAL_FPFOCALWIDTH = 200.0 - FocalWidthOffset;
         iGLOBAL_HEALTH_X = 40;//20*2;
         iGLOBAL_HEALTH_Y = 585;//(185/200)*600;
         iGLOBAL_AMMO_X = 750;//(300/320)*800;