ref: 841970e1ef524cb249a79f8bcce2545d714d8e5b
parent: 3cdb969ceda035309253a017f5448f3ae0eb463b
author: Tanguy Fautre <tanguy@fautre.com>
date: Sun May 3 11:51:26 EDT 2020
Fix FullScreen not persisting correctly across sessions.
--- a/Engine/src/display.c
+++ b/Engine/src/display.c
@@ -68,7 +68,6 @@
static SDL_Surface* surface = NULL;
static SDL_Surface* surface_rgba = NULL;
-static uint32_t sdl_flags = 0;
static int32_t mouse_relative_x = 0;
static int32_t mouse_relative_y = 0;
static short mouse_buttons = 0;
@@ -196,7 +195,7 @@
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
w, h,
- sdl_flags | SDL_WINDOW_ALLOW_HIGHDPI);
+ (FullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0) | SDL_WINDOW_ALLOW_HIGHDPI);
SDL_CHECK_NOT_NULL(window, "create window");
@@ -370,7 +369,7 @@
x = surface->w;
y = surface->h;
- BFullScreen =!BFullScreen;
+ FullScreen =!FullScreen;
_platform_init(0, NULL, "Duke Nukem 3D", "Duke3D");
_setgamemode(x,y);
//vscrn();
@@ -669,7 +668,6 @@
title = "BUILD";
titleName = string_dupe(title);
- sdl_flags = BFullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0;
set_sdl_scancodes(scancodes, sizeof(scancodes) / sizeof(scancodes[0]));
output_sdl_versions();
--- a/Engine/src/display.h
+++ b/Engine/src/display.h
@@ -42,7 +42,7 @@
extern uint8_t permanentlock;
// defined in the game project:
-extern int32_t BFullScreen; // defined in Game\src\config.c
+extern int32_t FullScreen; // defined in Game\src\config.c
/* these need to be implemented by YOUR driver. */
void _platform_init(int argc, char **argv, const char *title, const char *iconName);
--- a/Game/src/config.c
+++ b/Game/src/config.c
@@ -67,7 +67,7 @@
int32 ControllerType;
int32 MouseAiming = 0;
-int32 BFullScreen = 0;
+int32 FullScreen = 0;
//
// Screen variables
@@ -653,7 +653,7 @@
SCRIPT_GetNumber( scripthandle, "Screen Setup", "Messages",&ud.fta_on);
SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenWidth",&ScreenWidth);
SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenHeight",&ScreenHeight);
- // SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenMode",&ScreenMode);
+ SCRIPT_GetNumber( scripthandle, "Screen Setup", "FullScreen",&FullScreen);
SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenGamma",&ud.brightness);
SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenSize",&ud.screen_size);
SCRIPT_GetNumber( scripthandle, "Screen Setup", "ExtScreenSize",&ud.extended_screen_size);
@@ -786,7 +786,7 @@
SCRIPT_PutNumber( scripthandle, "Screen Setup", "ShowFPS",ud.tickrate&1,false,false);
SCRIPT_PutNumber( scripthandle, "Screen Setup", "ScreenWidth",xdim,false,false);
SCRIPT_PutNumber( scripthandle, "Screen Setup", "ScreenHeight",ydim,false,false);
- SCRIPT_PutNumber( scripthandle, "Screen Setup", "Fullscreen",BFullScreen,false,false);
+ SCRIPT_PutNumber( scripthandle, "Screen Setup", "FullScreen",FullScreen,false,false);
SCRIPT_PutNumber( scripthandle, "Sound Setup", "FXVolume",FXVolume,false,false);
SCRIPT_PutNumber( scripthandle, "Sound Setup", "MusicVolume",MusicVolume,false,false);
SCRIPT_PutNumber( scripthandle, "Sound Setup", "FXDevice",FXDevice,false,false);
--- a/Game/src/config.h
+++ b/Game/src/config.h
@@ -34,7 +34,7 @@
extern int32 MouseAiming;
extern int32 ScreenWidth;
extern int32 ScreenHeight;
-extern int32 BFullScreen;
+extern int32 FullScreen;
void CONFIG_ReadSetup( void );
void CONFIG_GetSetupFilename( void );
--- a/Game/src/menues.c
+++ b/Game/src/menues.c
@@ -3131,7 +3131,7 @@
break;
case 1:
- BFullScreen = !BFullScreen;
+ FullScreen = !FullScreen;
_platform_init(0, NULL, "Duke Nukem 3D", "Duke3D");
_setgamemode(validmodexdim[current_resolution],validmodeydim[current_resolution]);
break;
@@ -3154,7 +3154,7 @@
menutext(c+150,43,0,1,text);
menutext(c,43+16*1,SHX(-3),PHX(-3),"FULLSCREEN");
- menutext(c+160+40,43+16*1,0,0,BFullScreen?"ON":"OFF");
+ menutext(c+160+40,43+16*1,0,0,FullScreen?"ON":"OFF");
menutext(c,43+16*2,SHX(-2),PHX(-2),"DETAIL");
menutext(c+160+40,43+16*2,0,0,ud.detail?"HIGH":"LOW");