Browse Source

Demo mode: Force resolution to that of the demo

pull/5656/head
Gleb Mazovetskiy 3 years ago
parent
commit
5bf9dfd7ee
  1. 1
      Source/engine/demomode.cpp
  2. 6
      Source/utils/display.cpp
  3. 2
      Source/utils/display.h
  4. 2
      test/timedemo_test.cpp

1
Source/engine/demomode.cpp

@ -390,6 +390,7 @@ void OverrideOptions()
#endif
sgOptions.Graphics.limitFPS.SetValue(false);
}
forceResolution = Size(DemoGraphicsWidth, DemoGraphicsHeight);
}
bool IsRunning()

6
Source/utils/display.cpp

@ -46,6 +46,8 @@ namespace devilution {
extern SDLSurfaceUniquePtr RendererTextureSurface; /** defined in dx.cpp */
SDL_Window *ghMainWnd;
Size forceResolution;
Uint16 gnScreenWidth;
Uint16 gnScreenHeight;
Uint16 gnViewportHeight;
@ -155,7 +157,7 @@ void CalculateUIRectangle()
Size GetPreferredWindowSize()
{
Size windowSize = *sgOptions.Graphics.resolution;
Size windowSize = forceResolution.width != 0 ? forceResolution : *sgOptions.Graphics.resolution;
#ifndef USE_SDL1
if (*sgOptions.Graphics.upscale && *sgOptions.Graphics.fitToScreen) {
@ -243,7 +245,7 @@ bool SpawnWindow(const char *lpWindowName)
#endif
#ifdef NXDK
{
Size windowSize = *sgOptions.Graphics.resolution;
Size windowSize = forceResolution.width != 0 ? forceResolution : *sgOptions.Graphics.resolution;
VIDEO_MODE xmode;
void *p = nullptr;
while (XVideoListModes(&xmode, 0, 0, &p)) {

2
Source/utils/display.h

@ -10,6 +10,7 @@
#include "utils/sdl2_backports.h"
#endif
#include "utils/attributes.h"
#include "utils/sdl_ptrs.h"
#include "utils/ui_fwd.h"
@ -26,6 +27,7 @@ extern SDLTextureUniquePtr texture;
extern SDLPaletteUniquePtr Palette;
extern SDL_Surface *PalSurface;
extern unsigned int pal_surface_palette_version;
extern DVL_API_FOR_TEST Size forceResolution;
#ifdef USE_SDL1
void SetVideoMode(int width, int height, int bpp, uint32_t flags);

2
test/timedemo_test.cpp

@ -53,7 +53,7 @@ void RunTimedemo(std::string timedemoFolderName)
demo::OverrideOptions();
AdjustToScreenGeometry(*sgOptions.Graphics.resolution);
AdjustToScreenGeometry(forceResolution);
StartGame(false, true);

Loading…
Cancel
Save