diff --git a/polymer/eduke32/build/src/baselayer.c b/polymer/eduke32/build/src/baselayer.c index 7220d91df..b20700de4 100644 --- a/polymer/eduke32/build/src/baselayer.c +++ b/polymer/eduke32/build/src/baselayer.c @@ -421,6 +421,7 @@ int32_t baselayer_init(void) #ifdef YAX_ENABLE { "r_tror_nomaskpass", "enable/disable additional pass in TROR software rendering", (void *)&r_tror_nomaskpass, CVAR_BOOL, 0, 1 }, #endif + { "r_windowpositioning", "enable/disable window position memory", (void *) &windowpos, CVAR_BOOL, 0, 1 }, { "vid_gamma","adjusts gamma component of gamma ramp",(void *) &vid_gamma, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 }, { "vid_contrast","adjusts contrast component of gamma ramp",(void *) &vid_contrast, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 }, { "vid_brightness","adjusts brightness component of gamma ramp",(void *) &vid_brightness, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 }, diff --git a/polymer/eduke32/build/src/config.c b/polymer/eduke32/build/src/config.c index 2a33fb938..421ef0444 100644 --- a/polymer/eduke32/build/src/config.c +++ b/polymer/eduke32/build/src/config.c @@ -247,13 +247,11 @@ int32_t loadsetup(const char *fn) if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16); #endif -#ifdef RENDERTYPEWIN if (readconfig(fp, "windowpositioning", val, VL) > 0) windowpos = atoi_safe(val); windowx = -1; if (readconfig(fp, "windowposx", val, VL) > 0) windowx = atoi_safe(val); windowy = -1; if (readconfig(fp, "windowposy", val, VL) > 0) windowy = atoi_safe(val); -#endif if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); } @@ -427,12 +425,12 @@ int32_t writesetup(const char *fn) "; Maximum OpenGL mode refresh rate (Windows only, in Hertz)\n" "maxrefreshfreq = %d\n" "\n" +#endif "; Window positioning, 0 = center, 1 = memory\n" "windowpositioning = %d\n" "windowposx = %d\n" "windowposy = %d\n" "\n" -#endif "; 3D mode brightness setting\n" "vid_gamma = %g\n" "vid_brightness = %g\n" @@ -610,8 +608,9 @@ int32_t writesetup(const char *fn) #ifndef RENDERTYPEWIN r_screenxy, #else - maxrefreshfreq, windowpos, windowx, windowy, + maxrefreshfreq, #endif + windowpos, windowx, windowy, vid_gamma_3d>=0?vid_gamma_3d:vid_gamma, vid_brightness_3d>=0?vid_brightness_3d:vid_brightness, vid_contrast_3d>=0?vid_contrast_3d:vid_contrast, diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 499dd9497..fe16148d2 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -1434,7 +1434,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) return -1; } # else - sdl_window = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED, + sdl_window = SDL_CreateWindow("", windowpos ? windowx : SDL_WINDOWPOS_CENTERED ,windowpos ? windowy : SDL_WINDOWPOS_CENTERED, x,y, ((fs&1)?SDL_WINDOW_FULLSCREEN:0) | SDL_WINDOW_OPENGL); if (!sdl_window) { @@ -2236,6 +2236,13 @@ int32_t handleevents(void) SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS); # endif break; + case SDL_WINDOWEVENT_MOVED: + if (windowpos) + { + windowx = ev.window.data1; + windowy = ev.window.data2; + } + break; } break; // #warning Using SDL 1.3 or 2.X diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index e1af9ab0a..9731af4db 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -488,21 +488,6 @@ static int32_t set_maxrefreshfreq(const osdfuncparm_t *parm) return OSDCMD_OK; } -static int32_t set_windowpos(const osdfuncparm_t *parm) -{ - if (parm->numparms == 0) - { - OSD_Printf("\"r_windowpositioning\" is \"%d\"\n",windowpos); - return OSDCMD_OK; - } - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - - windowpos = Batol(parm->parms[0])>0; - OSD_Printf("r_windowpositioning %d\n",windowpos); - - return OSDCMD_OK; -} - // // initsystem() -- init systems // @@ -585,7 +570,6 @@ int32_t initsystem(void) initprintf("DirectDraw initialization failed. Fullscreen modes will be unavailable.\n"); OSD_RegisterFunction("maxrefreshfreq", "maxrefreshfreq: maximum display frequency to set for OpenGL Polymost modes (0=no maximum)", set_maxrefreshfreq); - OSD_RegisterFunction("r_windowpositioning", "r_windowpositioning: enable/disable window position memory", set_windowpos); // See if we're on an ATI card... determine_ATI(); diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 01c6a87a7..bc7b7f651 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -639,13 +639,13 @@ int32_t CONFIG_ReadSetup(void) SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",&ud.config.ScreenMode); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",&ud.config.ScreenWidth); -#ifdef RENDERTYPEWIN SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos); windowx = -1; SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32_t *)&windowx); windowy = -1; SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy); +#ifdef RENDERTYPEWIN SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq); #endif @@ -814,10 +814,10 @@ void CONFIG_WriteSetup(uint32_t flags) return; } -#ifdef RENDERTYPEWIN SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE); +#ifdef RENDERTYPEWIN SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", maxrefreshfreq, FALSE, FALSE); #endif