mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
better support for -1,-2,-3 command line parameters (#1644)
This commit is contained in:
parent
3704eeff92
commit
9d23fcf221
@ -59,7 +59,9 @@
|
||||
|
||||
#include "icon.c"
|
||||
|
||||
int current_video_height;
|
||||
int current_video_height, default_current_video_height;
|
||||
static int GetCurrentVideoHeight(void);
|
||||
|
||||
boolean dynamic_resolution;
|
||||
|
||||
boolean use_vsync; // killough 2/8/98: controls whether vsync is called
|
||||
@ -79,7 +81,8 @@ boolean toggle_fullscreen;
|
||||
boolean toggle_exclusive_fullscreen;
|
||||
|
||||
int video_display = 0; // display index
|
||||
int window_width, window_height;
|
||||
static int window_width, window_height;
|
||||
int default_window_width, default_window_height;
|
||||
int window_position_x, window_position_y;
|
||||
|
||||
// [AM] Fractional part of the current tic, in the half-open
|
||||
@ -1388,6 +1391,10 @@ static void I_InitVideoParms(void)
|
||||
// SDL may report native refresh rate as zero.
|
||||
native_refresh_rate = mode.refresh_rate;
|
||||
|
||||
current_video_height = default_current_video_height;
|
||||
window_width = default_window_width;
|
||||
window_height = default_window_height;
|
||||
|
||||
widescreen = default_widescreen;
|
||||
uncapped = default_uncapped;
|
||||
grabmouse = default_grabmouse;
|
||||
@ -1468,6 +1475,9 @@ static void I_InitVideoParms(void)
|
||||
if (p && strcasecmp("-skipsec", myargv[p - 1]))
|
||||
{
|
||||
scalefactor = tmp_scalefactor;
|
||||
GetCurrentVideoHeight();
|
||||
MN_UpdateDynamicResolutionItem();
|
||||
MN_DisableResolutionScaleItem();
|
||||
}
|
||||
|
||||
//!
|
||||
@ -1492,7 +1502,7 @@ static void I_InitVideoParms(void)
|
||||
fullscreen = true;
|
||||
}
|
||||
|
||||
MN_SetupResetMenuVideo();
|
||||
MN_UpdateFpsLimitItem();
|
||||
}
|
||||
|
||||
static void I_InitGraphicsMode(void)
|
||||
@ -1597,8 +1607,13 @@ void I_GetResolutionScaling(resolution_scaling_t *rs)
|
||||
rs->step = 50;
|
||||
}
|
||||
|
||||
static int CurrentResolutionHeight(void)
|
||||
static int GetCurrentVideoHeight(void)
|
||||
{
|
||||
if (scalefactor > 0)
|
||||
{
|
||||
current_video_height = scalefactor * SCREENHEIGHT;
|
||||
}
|
||||
|
||||
current_video_height =
|
||||
BETWEEN(SCREENHEIGHT, native_height_adjusted, current_video_height);
|
||||
|
||||
@ -1656,8 +1671,9 @@ static void CreateSurfaces(int w, int h)
|
||||
|
||||
I_InitDiskFlash();
|
||||
|
||||
SDL_SetWindowMinimumSize(screen, video.unscaledw * 2,
|
||||
use_aspect ? ACTUALHEIGHT * 2 : SCREENHEIGHT * 2);
|
||||
int n = (scalefactor == 1 ? 1 : 2);
|
||||
SDL_SetWindowMinimumSize(screen, video.unscaledw * n,
|
||||
use_aspect ? ACTUALHEIGHT * n : SCREENHEIGHT * n);
|
||||
|
||||
if (!fullscreen)
|
||||
{
|
||||
@ -1686,7 +1702,7 @@ static void I_ReinitGraphicsMode(void)
|
||||
window_position_y = 0;
|
||||
|
||||
I_InitGraphicsMode();
|
||||
ResetResolution(CurrentResolutionHeight(), true);
|
||||
ResetResolution(GetCurrentVideoHeight(), true);
|
||||
CreateSurfaces(video.pitch, video.height);
|
||||
ResetLogicalSize();
|
||||
}
|
||||
@ -1697,12 +1713,9 @@ void I_ResetScreen(void)
|
||||
|
||||
widescreen = default_widescreen;
|
||||
|
||||
ResetResolution(CurrentResolutionHeight(), true);
|
||||
ResetResolution(GetCurrentVideoHeight(), true);
|
||||
CreateSurfaces(video.pitch, video.height);
|
||||
ResetLogicalSize();
|
||||
|
||||
SDL_SetWindowMinimumSize(screen, video.unscaledw * 2,
|
||||
use_aspect ? ACTUALHEIGHT * 2 : SCREENHEIGHT * 2);
|
||||
}
|
||||
|
||||
void I_ShutdownGraphics(void)
|
||||
@ -1712,6 +1725,13 @@ void I_ShutdownGraphics(void)
|
||||
SDL_GetWindowPosition(screen, &window_position_x, &window_position_y);
|
||||
}
|
||||
|
||||
if (scalefactor == 0)
|
||||
{
|
||||
default_window_width = window_width;
|
||||
default_window_height = window_height;
|
||||
default_current_video_height = current_video_height;
|
||||
}
|
||||
|
||||
UpdateGrab();
|
||||
}
|
||||
|
||||
@ -1726,7 +1746,7 @@ void I_InitGraphics(void)
|
||||
|
||||
I_InitVideoParms();
|
||||
I_InitGraphicsMode(); // killough 10/98
|
||||
ResetResolution(CurrentResolutionHeight(), true);
|
||||
ResetResolution(GetCurrentVideoHeight(), true);
|
||||
CreateSurfaces(video.pitch, video.height);
|
||||
ResetLogicalSize();
|
||||
|
||||
|
@ -70,7 +70,8 @@ extern boolean drs_skip_frame;
|
||||
|
||||
extern boolean use_vsync; // killough 2/8/98: controls whether vsync is called
|
||||
extern boolean disk_icon; // killough 10/98
|
||||
extern int current_video_height;
|
||||
|
||||
extern int current_video_height, default_current_video_height;
|
||||
|
||||
# define DRS_MIN_HEIGHT 400
|
||||
extern boolean dynamic_resolution;
|
||||
|
@ -75,7 +75,7 @@ extern int showMessages;
|
||||
extern int show_toggle_messages;
|
||||
extern int show_pickup_messages;
|
||||
|
||||
extern int window_width, window_height;
|
||||
extern int default_window_width, default_window_height;
|
||||
extern int window_position_x, window_position_y;
|
||||
extern boolean flipcorpses; // [crispy] randomly flip corpse, blood and death
|
||||
// animation sprites
|
||||
@ -132,7 +132,7 @@ default_t defaults[] = {
|
||||
|
||||
{
|
||||
"current_video_height",
|
||||
(config_t *) ¤t_video_height, NULL,
|
||||
(config_t *) &default_current_video_height, NULL,
|
||||
{600}, {SCREENHEIGHT, UL}, number, ss_none, wad_no,
|
||||
"vertical resolution (600p by default)"
|
||||
},
|
||||
@ -237,7 +237,7 @@ default_t defaults[] = {
|
||||
// window width
|
||||
{
|
||||
"window_width",
|
||||
(config_t *) &window_width, NULL,
|
||||
(config_t *) &default_window_width, NULL,
|
||||
{1065}, {0, UL}, number, ss_none, wad_no,
|
||||
"window width"
|
||||
},
|
||||
@ -245,7 +245,7 @@ default_t defaults[] = {
|
||||
// window height
|
||||
{
|
||||
"window_height",
|
||||
(config_t *) &window_height, NULL,
|
||||
(config_t *) &default_window_height, NULL,
|
||||
{600}, {0, UL}, number, ss_none, wad_no,
|
||||
"window height"
|
||||
},
|
||||
|
@ -59,11 +59,13 @@ void MN_ForcedLoadGame(const char *msg); // killough 5/15/98: forced loadgames
|
||||
void MN_Trans(void); // killough 11/98: reset translucency
|
||||
void MN_ResetMenu(void); // killough 11/98: reset main menu ordering
|
||||
void MN_SetupResetMenu(void);
|
||||
void MN_SetupResetMenuVideo(void);
|
||||
void MN_ResetTimeScale(void);
|
||||
void MN_DrawCredits(void); // killough 11/98
|
||||
void MN_SetHUFontKerning(void);
|
||||
void MN_DisableVoxelsRenderingItem(void);
|
||||
void MN_UpdateDynamicResolutionItem(void);
|
||||
void MN_DisableResolutionScaleItem(void);
|
||||
void MN_UpdateFpsLimitItem(void);
|
||||
|
||||
extern int traditional_menu; // display the menu traditional way
|
||||
|
||||
|
@ -1839,12 +1839,16 @@ int resolution_scale;
|
||||
static const char **GetResolutionScaleStrings(void)
|
||||
{
|
||||
const char **strings = NULL;
|
||||
|
||||
resolution_scaling_t rs;
|
||||
I_GetResolutionScaling(&rs);
|
||||
|
||||
array_push(strings, "100%");
|
||||
|
||||
if (current_video_height == SCREENHEIGHT)
|
||||
{
|
||||
resolution_scale = 0;
|
||||
}
|
||||
|
||||
int val = SCREENHEIGHT * 2;
|
||||
char buf[8];
|
||||
int i;
|
||||
@ -1870,8 +1874,6 @@ static const char **GetResolutionScaleStrings(void)
|
||||
return strings;
|
||||
}
|
||||
|
||||
static void UpdateDynamicResolutionItem(void);
|
||||
|
||||
static void ResetVideoHeight(void)
|
||||
{
|
||||
const char **strings = GetStrings(str_resolution_scale);
|
||||
@ -1915,7 +1917,7 @@ static void ResetVideoHeight(void)
|
||||
VX_ResetMaxDist();
|
||||
}
|
||||
|
||||
UpdateDynamicResolutionItem();
|
||||
MN_UpdateDynamicResolutionItem();
|
||||
|
||||
resetneeded = true;
|
||||
}
|
||||
@ -1933,8 +1935,6 @@ static void UpdateFOV(void)
|
||||
setsizeneeded = true; // run R_ExecuteSetViewSize;
|
||||
}
|
||||
|
||||
static void ToggleUncapped(void);
|
||||
|
||||
static void ToggleFullScreen(void)
|
||||
{
|
||||
toggle_fullscreen = true;
|
||||
@ -1995,7 +1995,7 @@ static setup_menu_t gen_settings1[] = {
|
||||
MI_GAP,
|
||||
|
||||
{"Uncapped Framerate", S_ONOFF, M_X, M_SPC, {"uncapped"}, m_null, input_null,
|
||||
str_empty, ToggleUncapped},
|
||||
str_empty, MN_UpdateFpsLimitItem},
|
||||
|
||||
{"Framerate Limit", S_NUM, M_X, M_SPC, {"fpslimit"}, m_null, input_null,
|
||||
str_empty, CoerceFPSLimit},
|
||||
@ -2016,6 +2016,11 @@ static setup_menu_t gen_settings1[] = {
|
||||
MI_END
|
||||
};
|
||||
|
||||
void MN_DisableResolutionScaleItem(void)
|
||||
{
|
||||
DisableItem(true, gen_settings1, "resolution_scale");
|
||||
}
|
||||
|
||||
static void UpdateSfxVolume(void)
|
||||
{
|
||||
S_SetSfxVolume(snd_SfxVolume);
|
||||
@ -2345,7 +2350,7 @@ static setup_menu_t *gen_settings[] = {
|
||||
gen_settings5, gen_settings6, NULL
|
||||
};
|
||||
|
||||
static void UpdateDynamicResolutionItem(void)
|
||||
void MN_UpdateDynamicResolutionItem(void)
|
||||
{
|
||||
DisableItem(current_video_height <= DRS_MIN_HEIGHT, gen_settings1,
|
||||
"dynamic_resolution");
|
||||
@ -2356,7 +2361,7 @@ static void UpdateAdvancedSoundItems(void)
|
||||
DisableItem(snd_module != SND_MODULE_3D, gen_settings2, "snd_hrtf");
|
||||
}
|
||||
|
||||
static void ToggleUncapped(void)
|
||||
void MN_UpdateFpsLimitItem(void)
|
||||
{
|
||||
DisableItem(!default_uncapped, gen_settings1, "fpslimit");
|
||||
setrefreshneeded = true;
|
||||
@ -3809,16 +3814,11 @@ void MN_SetupResetMenu(void)
|
||||
DisableItem(deh_set_blood_color, enem_settings1, "colored_blood");
|
||||
DisableItem(!brightmaps_found || force_brightmaps, gen_settings5,
|
||||
"brightmaps");
|
||||
|
||||
DisableItem(default_current_video_height <= DRS_MIN_HEIGHT, gen_settings1,
|
||||
"dynamic_resolution");
|
||||
UpdateInterceptsEmuItem();
|
||||
UpdateDynamicResolutionItem();
|
||||
CoerceFPSLimit();
|
||||
UpdateCrosshairItems();
|
||||
UpdateCenteredWeaponItem();
|
||||
UpdateAdvancedSoundItems();
|
||||
}
|
||||
|
||||
void MN_SetupResetMenuVideo(void)
|
||||
{
|
||||
ToggleUncapped();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user