From b3e56d3a5cb9098be2292900b75ea3dc61757df5 Mon Sep 17 00:00:00 2001 From: Ilya Orlov Date: Sat, 7 Jul 2018 01:11:48 +0400 Subject: [PATCH] xrEngine: refactor --- src/Layers/xrRender/HW.cpp | 2 +- src/xrEngine/Device_Initialize.cpp | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Layers/xrRender/HW.cpp b/src/Layers/xrRender/HW.cpp index bb20b5f226d..206a5707fd8 100644 --- a/src/Layers/xrRender/HW.cpp +++ b/src/Layers/xrRender/HW.cpp @@ -109,7 +109,7 @@ void CHW::CreateDevice(SDL_Window* m_sdlWnd, bool move_window) fDepth = selectDepthStencil(fTarget); } - if ((D3DFMT_UNKNOWN == fTarget) || (D3DFMT_UNKNOWN == fTarget)) + if (D3DFMT_UNKNOWN == fTarget) { Msg("Failed to initialize graphics hardware.\n" "Please try to restart the game.\n" diff --git a/src/xrEngine/Device_Initialize.cpp b/src/xrEngine/Device_Initialize.cpp index 0337861e066..d18c02bd807 100644 --- a/src/xrEngine/Device_Initialize.cpp +++ b/src/xrEngine/Device_Initialize.cpp @@ -39,6 +39,9 @@ void CRenderDevice::Initialize() if (strstr(Core.Params, "-weather")) initialize_weather_editor(); + //SetEnvironmentVariable("SDL_VIDEODRIVER", "windows"); + SetEnvironmentVariable("SDL_AUDIODRIVER", "directsound"); + if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { Log("Unable to initialize SDL: %s", SDL_GetError()); @@ -55,14 +58,8 @@ void CRenderDevice::Initialize() flags |= SDL_WINDOW_OPENGL; m_sdlWnd = SDL_CreateWindow("S.T.A.L.K.E.R.: Call of Pripyat", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, flags); - - if (!m_sdlWnd) - Log("Unable to create window: %s", SDL_GetError()); - - //m_sdlRndr = SDL_CreateRenderer(m_sdlWnd, -1, SDL_RENDERER_ACCELERATED); - - //SDL_RenderClear(m_sdlRndr); - //SDL_RenderPresent(m_sdlRndr); + + R_ASSERT3(m_sdlWnd, "Unable to create SDL window", SDL_GetError()); } // Save window properties