Commit 7c9331a2 authored by Evan Ramos's avatar Evan Ramos
Browse files

SW: Add FOV slider

parent 3e9cbdd6
......@@ -2462,6 +2462,8 @@ drawscreen(PLAYERp pp)
videoSetCorrectedAspect();
}
renderSetAspect(Blrintf(float(viewingrange) * tanf(gs.FOV * (fPI/360.f))), yxaspect);
if (FAF_DebugView)
videoClearViewableArea(255L);
......
......@@ -237,6 +237,7 @@ const GAME_SET gs_defaults =
"Track??", // waveform track name
FALSE,
TRUE,
90, // FOV
};
GAME_SET gs;
......
......@@ -216,6 +216,9 @@ enum
screenmode_redblue,
};
#define MinFOV 60
#define MaxFOV 145
#define IncFOV 5
#ifdef __cplusplus
};
......
......@@ -227,12 +227,15 @@ MenuItem screen_i[] =
{DefSlider(sldr_brightness, KEYSC_B, "Brightness"), OPT_XS, OPT_LINE(2), 1, m_defshade, 0, NULL, NULL, NULL},
{DefInert(0, NULL), OPT_XSIDE, OPT_LINE(2), 0, m_defshade, 0, NULL, NULL, NULL},
{DefButton(btn_videofs, 0, "Fullscreen"), OPT_XS, OPT_LINE(4), 1, m_defshade, 0, NULL, NULL, NULL},
{DefSlider(sldr_videobpp, 0, "Colour"), OPT_XS, OPT_LINE(5), 1, m_defshade, 0, NULL, NULL, NULL},
{DefInert(0, NULL), OPT_XSIDE, OPT_LINE(5), 0, m_defshade, 0, NULL, NULL, NULL},
{DefSlider(sldr_videores, 0, "Resolution"), OPT_XS, OPT_LINE(6), 1, m_defshade, 0, NULL, NULL, NULL},
{DefSlider(sldr_fov, 0, "FOV"), OPT_XS, OPT_LINE(3), 1, m_defshade, 0, NULL, NULL, NULL},
{DefInert(0, NULL), OPT_XSIDE, OPT_LINE(3), 0, m_defshade, 0, NULL, NULL, NULL},
{DefButton(btn_videofs, 0, "Fullscreen"), OPT_XS, OPT_LINE(5), 1, m_defshade, 0, NULL, NULL, NULL},
{DefSlider(sldr_videobpp, 0, "Colour"), OPT_XS, OPT_LINE(6), 1, m_defshade, 0, NULL, NULL, NULL},
{DefInert(0, NULL), OPT_XSIDE, OPT_LINE(6), 0, m_defshade, 0, NULL, NULL, NULL},
{DefOption(0, "Apply Settings"), OPT_XSIDE, OPT_LINE(8), 1, m_defshade, 0, ApplyModeSettings, NULL, NULL},
{DefSlider(sldr_videores, 0, "Resolution"), OPT_XS, OPT_LINE(7), 1, m_defshade, 0, NULL, NULL, NULL},
{DefInert(0, NULL), OPT_XSIDE, OPT_LINE(7), 0, m_defshade, 0, NULL, NULL, NULL},
{DefOption(0, "Apply Settings"), OPT_XSIDE, OPT_LINE(9), 1, m_defshade, 0, ApplyModeSettings, NULL, NULL},
{DefNone}
};
......@@ -2201,6 +2204,7 @@ MNU_InitMenus(void)
slidersettings[sldr_scrsize] = gs.BorderNum;
slidersettings[sldr_brightness] = gs.Brightness;
slidersettings[sldr_bordertile] = gs.BorderTile;
slidersettings[sldr_fov] = (gs.FOV - MinFOV) / IncFOV;
{
int i,newx=xdim,newy=ydim;
......@@ -3900,6 +3904,25 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
MNU_DrawString(OPT_XSIDE+tilesiz[pic_slidelend].x+tilesiz[pic_sliderend].x+(barwidth+1)*tilesiz[pic_slidebar].x, item->y, tmp_text, 1, 16);
} break;
case sldr_fov:
{
constexpr int numvalid = (MaxFOV - MinFOV) / IncFOV + 1;
offset = clamp(slidersettings[sldr_fov] + dir, 0, numvalid-1);
barwidth = numvalid;
if (TEST(item->flags, mf_disabled))
break;
if (dir)
{
slidersettings[sldr_fov] = offset;
gs.FOV = offset * IncFOV + MinFOV;
}
sprintf(tmp_text, "%d", gs.FOV);
MNU_DrawString(OPT_XSIDE+tilesiz[pic_slidelend].x+tilesiz[pic_sliderend].x+(barwidth+1)*tilesiz[pic_slidebar].x, item->y, tmp_text, 1, 16);
} break;
case sldr_mousescalex:
case sldr_mousescaley:
barwidth = 8+1+8;
......
......@@ -170,6 +170,7 @@ typedef enum
sldr_mouse, sldr_sndfxvolume, sldr_musicvolume, sldr_scrsize, sldr_brightness,
sldr_bordertile, sldr_gametype, sldr_netlevel, sldr_monsters, sldr_killlimit,
sldr_timelimit, sldr_playercolor, sldr_videores, sldr_videobpp,
sldr_fov,
sldr_mousescalex, sldr_mousescaley,
sldr_joyaxisscale, sldr_joyaxisanalog, sldr_joyaxisdead, sldr_joyaxissatur,
sldr_max
......
......@@ -72,6 +72,7 @@ typedef struct
char WaveformTrackName[MAXWAVEFORMTRACKLENGTH];
SWBOOL Darts;
SWBOOL WeaponAutoSwitch;
int FOV;
} GAME_SET, *GAME_SETp;
extern const GAME_SET gs_defaults;
......
......@@ -236,6 +236,10 @@ void ReadGameSetup(int32_t scripthandle)
SCRIPT_GetNumber(scripthandle, "Options", "WeaponAutoSwitch",&dummy);
if (dummy != -1) gs.WeaponAutoSwitch = dummy;
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "FOV",&dummy);
if (dummy != -1) gs.FOV = clamp(dummy, MinFOV, MaxFOV);
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "MouseAimingOn",&dummy);
if (dummy != -1) gs.MouseAimingOn = dummy;
......@@ -348,6 +352,8 @@ void WriteGameSetup(int32_t scripthandle)
SCRIPT_PutNumber(scripthandle, "Options", "Darts",dummy,FALSE,FALSE);
dummy = gs.WeaponAutoSwitch;
SCRIPT_PutNumber(scripthandle, "Options", "WeaponAutoSwitch",dummy,FALSE,FALSE);
dummy = gs.FOV;
SCRIPT_PutNumber(scripthandle, "Options", "FOV",dummy,FALSE,FALSE);
EncodePassword(gs.Password);
SCRIPT_PutString(scripthandle, "Options","Rooster",gs.Password);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment