@@ -130,7 +130,6 @@ namespace RTE {
130
130
m_ResMultiplier = m_NewResMultiplier = 1 ;
131
131
}
132
132
}
133
- if (resX * m_ResMultiplier == m_ScreenResX && resY * m_ResMultiplier == m_ScreenResY) { m_Fullscreen = true ; }
134
133
}
135
134
136
135
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -306,97 +305,6 @@ namespace RTE {
306
305
g_PrimitiveMan.ClearPrimitivesList ();
307
306
}
308
307
309
- // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
310
-
311
- int FrameMan::ToggleFullscreen () {
312
- // Save the palette so we can re-set it after the change
313
- PALETTE pal;
314
- get_palette (pal);
315
-
316
- // Refuse windowed multiplier if the resolution is too high
317
- if (m_ResX > 1024 ) { m_NxWindowed = 1 ; }
318
-
319
- // Need to save these first for recovery attempts to work (screen might be 0)
320
- int resX = m_ResX;
321
- int resY = m_ResY;
322
-
323
- int fullscreenGfxDriver = GFX_AUTODETECT_FULLSCREEN;
324
- int windowedGfxDriver = GFX_AUTODETECT_WINDOWED;
325
-
326
- fullscreenGfxDriver = GFX_DIRECTX_ACCEL;
327
-
328
- if (g_SettingsMan.ForceSoftwareGfxDriver ()) { fullscreenGfxDriver = GFX_DIRECTX_SOFT; }
329
- if (g_SettingsMan.ForceSafeGfxDriver ()) { fullscreenGfxDriver = GFX_DIRECTX_SAFE; }
330
- if (g_SettingsMan.ForceOverlayedWindowGfxDriver ()) { windowedGfxDriver = GFX_DIRECTX_OVL; }
331
- if (g_SettingsMan.ForceNonOverlayedWindowGfxDriver ()) { windowedGfxDriver = GFX_DIRECTX_WIN; }
332
- if (g_SettingsMan.ForceVirtualFullScreenGfxDriver ()) { windowedGfxDriver = GFX_DIRECTX_WIN_BORDERLESS; }
333
-
334
- // Switch to windowed mode
335
- if (m_Fullscreen) {
336
- if (set_gfx_mode (windowedGfxDriver, resX * m_NxWindowed, resY * m_NxWindowed, 0 , 0 ) != 0 ) {
337
- // Oops, failed to set windowed mode, so go back to fullscreen
338
- if (set_gfx_mode (fullscreenGfxDriver, resX * m_NxFullscreen, resY * m_NxFullscreen, 0 , 0 ) != 0 ) {
339
- // Can't go back to fullscreen either! total fail
340
- set_gfx_mode (GFX_TEXT, 0 , 0 , 0 , 0 );
341
- allegro_message (" Unable to set back to fullscreen mode because: %s!" , allegro_error);
342
- return 1 ;
343
- }
344
- // Successfully reverted back to fullscreen
345
- g_ConsoleMan.PrintString (" ERROR: Failed to switch to windowed mode, reverted back to fullscreen!" );
346
- m_Fullscreen = true ;
347
- // Reset the palette.
348
- set_palette (pal);
349
- // Make sure everything gets caught up after the switch
350
- rest (2000 );
351
- return 1 ;
352
- }
353
- // Make sure everything gets caught up after the switch
354
- rest (2000 );
355
- g_ConsoleMan.PrintString (" SYSTEM: Switched to windowed mode" );
356
- m_Fullscreen = false ;
357
- } else {
358
- // Switch to fullscreen
359
- if (set_gfx_mode (fullscreenGfxDriver, resX * m_NxFullscreen, resY * m_NxFullscreen, 0 , 0 ) != 0 ) {
360
- // Oops, failed to set fullscreen mode, try a different fullscreen scaling
361
- m_NewNxFullscreen = m_NxFullscreen = m_NxFullscreen == 1 ? 2 : 1 ;
362
- if (set_gfx_mode (fullscreenGfxDriver, resX * m_NxFullscreen, resY * m_NxFullscreen, 0 , 0 ) != 0 ) {
363
- // That didn't work either, so go back to windowed
364
- allegro_message (" Unable enter fullscreen mode because: %s!\n\n Will try to revert to windowed mode now..." , allegro_error);
365
- if (set_gfx_mode (windowedGfxDriver, resX * m_NxWindowed, resY * m_NxWindowed, 0 , 0 ) != 0 ) {
366
- // Can't go back to windowed either! total fail
367
- set_gfx_mode (GFX_TEXT, 0 , 0 , 0 , 0 );
368
- allegro_message (" Unable to set back to windowed mode because: %s!" , allegro_error);
369
- return 1 ;
370
- }
371
- // Successfully reverted back to windowed
372
- g_ConsoleMan.PrintString (" ERROR: Failed to switch to fullscreen mode, reverted back to windowed!" );
373
- m_Fullscreen = false ;
374
- // Make sure everything gets caught up after the switch
375
- rest (1500 );
376
- // Reset the palette.
377
- set_palette (pal);
378
- return 1 ;
379
- }
380
- }
381
- // Make sure everything gets caught up after the switch
382
- rest (1500 );
383
- g_ConsoleMan.PrintString (" SYSTEM: Switched to fullscreen mode" );
384
- m_Fullscreen = true ;
385
- }
386
- // Reset the palette.
387
- set_palette (pal);
388
-
389
- // Adjust the speed of the mouse according to 2x of screen
390
- float mouseDenominator = IsFullscreen () ? NxFullscreen () : NxWindowed ();
391
- set_mouse_range (0 , 0 , (GetResX () * mouseDenominator) - 3 , (GetResY () * mouseDenominator) - 3 );
392
-
393
- // If NxFullscreen, adjust the mouse speed accordingly
394
- unsigned char mouseSpeedMultiplier = (g_FrameMan.IsFullscreen () && g_FrameMan.NxFullscreen () > 1 ) ? 1 : 2 ;
395
- set_mouse_speed (mouseSpeedMultiplier, mouseSpeedMultiplier);
396
-
397
- return 0 ;
398
- }
399
-
400
308
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
401
309
402
310
bool FrameMan::IsValidResolution (int width, int height) const {
0 commit comments