From 79eac572d2efd9d7b8460e5ac0a223174b9c591e Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Fri, 19 Jun 2020 15:24:18 +0000 Subject: [PATCH] Host_Main improvements. Workaround to avoid crash with +map no longer needed. * FreeType2 now tries to load by default, regardless of game. This fixes font issues if this cvar is turned off after the subsystem is already initialized. This has no side effects in Quake as far as I can tell. * Host_StartVideo has been moved to CL_Init where it honestly should be. This makes it easier to initialize the engine without a client compiled in. The FT2 fix allows initialization to happen early without screwing with the fonts. * VID_Start will now parse +vid_width and +vid_height just the same as -width and -height, as well as +vid_fullscreen 1 and 0 for -fullscreen and -window respectively. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12699 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_main.c | 2 ++ cmd.c | 4 ---- ft2.c | 2 +- host.c | 6 ------ vid_shared.c | 11 ++++++----- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/cl_main.c b/cl_main.c index 45eeac77..4f875743 100644 --- a/cl_main.c +++ b/cl_main.c @@ -2776,5 +2776,7 @@ void CL_Init (void) CL_MeshEntities_Init(); CL_Video_Init(); + Host_StartVideo(); + } } diff --git a/cmd.c b/cmd.c index 010568de..f3d0a1cb 100644 --- a/cmd.c +++ b/cmd.c @@ -411,10 +411,6 @@ static void Cmd_StuffCmds_f (cmd_state_t *cmd) // this is for all commandline options combined (and is bounds checked) char build[MAX_INPUTLINE]; - // come back later so we don't crash - if(host.state == host_init) - return; - if (Cmd_Argc (cmd) != 1) { Con_Print("stuffcmds : execute command line parameters\n"); diff --git a/ft2.c b/ft2.c index 9eff4a2b..906ad70c 100644 --- a/ft2.c +++ b/ft2.c @@ -33,7 +33,7 @@ CVars introduced with the freetype extension ================================================================================ */ -cvar_t r_font_disable_freetype = {CVAR_CLIENT | CVAR_SAVE, "r_font_disable_freetype", "1", "disable freetype support for fonts entirely"}; +cvar_t r_font_disable_freetype = {CVAR_CLIENT | CVAR_SAVE, "r_font_disable_freetype", "0", "disable freetype support for fonts entirely"}; cvar_t r_font_use_alpha_textures = {CVAR_CLIENT | CVAR_SAVE, "r_font_use_alpha_textures", "0", "use alpha-textures for font rendering, this should safe memory"}; cvar_t r_font_size_snapping = {CVAR_CLIENT | CVAR_SAVE, "r_font_size_snapping", "1", "stick to good looking font sizes whenever possible - bad when the mod doesn't support it!"}; cvar_t r_font_kerning = {CVAR_CLIENT | CVAR_SAVE, "r_font_kerning", "1", "Use kerning if available"}; diff --git a/host.c b/host.c index 0d33ce2d..7959dd57 100644 --- a/host.c +++ b/host.c @@ -1286,8 +1286,6 @@ static void Host_Init (void) Host_AddConfigText(cmd); - Host_StartVideo(); - // if quake.rc is missing, use default if (!FS_FileExists("quake.rc")) { @@ -1297,10 +1295,6 @@ static void Host_Init (void) host.state = host_active; - // run stuffcmds now, deferred previously because it can crash if a server starts that early - Cbuf_AddText(cmd,"stuffcmds\n"); - Cbuf_Execute(cmd); - Log_Start(); // put up the loading image so the user doesn't stare at a black screen... diff --git a/vid_shared.c b/vid_shared.c index 580d9b33..c35dbffd 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -1507,24 +1507,25 @@ const char *vidfallbacks[][2] = // this is only called once by Host_StartVideo and again on each FS_GameDir_f void VID_Start(void) { - int i, width, height, success; + int i = 0; + int width, height, success; if (vid_commandlinecheck) { // interpret command-line parameters vid_commandlinecheck = false; // COMMANDLINEOPTION: Video: -window performs +vid_fullscreen 0 - if (COM_CheckParm("-window") || COM_CheckParm("-safe")) + if (COM_CheckParm("-window") || COM_CheckParm("-safe") || (i = COM_CheckParm("+vid_fullscreen") != 0 && atoi(sys.argv[i+1]) == 0)) Cvar_SetValueQuick(&vid_fullscreen, false); // COMMANDLINEOPTION: Video: -fullscreen performs +vid_fullscreen 1 - if (COM_CheckParm("-fullscreen")) + if (COM_CheckParm("-fullscreen") || (i = COM_CheckParm("+vid_fullscreen") != 0 && atoi(sys.argv[i+1]) == 1)) Cvar_SetValueQuick(&vid_fullscreen, true); width = 0; height = 0; // COMMANDLINEOPTION: Video: -width performs +vid_width and also +vid_height if only -width is specified (example: -width 1024 sets 1024x768 mode) - if ((i = COM_CheckParm("-width")) != 0) + if ((i = COM_CheckParm("-width")) != 0 || (i = COM_CheckParm("+vid_width") != 0)) width = atoi(sys.argv[i+1]); // COMMANDLINEOPTION: Video: -height performs +vid_height and also +vid_width if only -height is specified (example: -height 768 sets 1024x768 mode) - if ((i = COM_CheckParm("-height")) != 0) + if ((i = COM_CheckParm("-height")) != 0 || (i = COM_CheckParm("+vid_height") != 0)) height = atoi(sys.argv[i+1]); if (width == 0) width = height * 4 / 3; -- 2.39.2