Skip to content

Commit 3dd786b

Browse files
intorrXottab-DUTY
authored andcommitted
Fix build. And modified updateWindowProps for convenience of debugging and similarity to other renderers.
Xottab_DUTY: this commit was squashed with my compilation fix commit.
1 parent 7a9e2c3 commit 3dd786b

File tree

6 files changed

+54
-72
lines changed

6 files changed

+54
-72
lines changed

src/Layers/xrRenderGL/glHW.cpp

Lines changed: 47 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -193,78 +193,54 @@ void CHW::Reset (HWND hwnd)
193193

194194
void CHW::updateWindowProps(HWND m_hWnd)
195195
{
196-
// BOOL bWindowed = strstr(Core.Params,"-dedicated") ? TRUE : !psDeviceFlags.is (rsFullscreen);
197-
BOOL bWindowed = !psDeviceFlags.is(rsFullscreen);
198-
199-
u32 dwWindowStyle = 0;
200-
// Set window properties depending on what mode were in.
201-
if (bWindowed) {
202-
if (strstr(Core.Params, "-no_dialog_header"))
203-
SetWindowLong(m_hWnd, GWL_STYLE, dwWindowStyle = (WS_BORDER | WS_VISIBLE));
204-
else
205-
SetWindowLong(m_hWnd, GWL_STYLE, dwWindowStyle = (WS_BORDER | WS_DLGFRAME | WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX));
206-
207-
// Change to default resolution
208-
ChangeDisplaySettings(nullptr, CDS_FULLSCREEN);
209-
}
210-
else {
211-
SetWindowLong(m_hWnd, GWL_STYLE, dwWindowStyle = (WS_POPUP | WS_VISIBLE));
212-
213-
DEVMODE dmScreenSettings;
214-
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
215-
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
216-
dmScreenSettings.dmPelsWidth = psCurrentVidMode[0];
217-
dmScreenSettings.dmPelsHeight = psCurrentVidMode[1];
218-
dmScreenSettings.dmBitsPerPel = 32;
219-
dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
220-
221-
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
222-
ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
223-
}
196+
bool bWindowed = true;
197+
#ifndef _EDITOR
198+
if (!GEnv.isDedicatedServer)
199+
bWindowed = !psDeviceFlags.is(rsFullscreen);
200+
#endif
224201

225-
if (m_move_window) {
226-
// When moving from fullscreen to windowed mode, it is important to
227-
// adjust the window size after recreating the device rather than
228-
// beforehand to ensure that you get the window size you want. For
229-
// example, when switching from 640x480 fullscreen to windowed with
230-
// a 1000x600 window on a 1024x768 desktop, it is impossible to set
231-
// the window size to 1000x600 until after the display mode has
232-
// changed to 1024x768, because windows cannot be larger than the
233-
// desktop.
234-
235-
RECT m_rcWindowBounds;
236-
BOOL bCenter = FALSE;
237-
if (strstr(Core.Params, "-center_screen")) bCenter = TRUE;
238-
239-
if (bCenter) {
240-
RECT DesktopRect;
241-
242-
GetClientRect(GetDesktopWindow(), &DesktopRect);
243-
244-
SetRect(&m_rcWindowBounds,
245-
(DesktopRect.right - psCurrentVidMode[0]) / 2,
246-
(DesktopRect.bottom - psCurrentVidMode[1]) / 2,
247-
(DesktopRect.right + psCurrentVidMode[0]) / 2,
248-
(DesktopRect.bottom + psCurrentVidMode[1]) / 2);
249-
}
250-
else {
251-
SetRect(&m_rcWindowBounds,
252-
0,
253-
0,
254-
psCurrentVidMode[0],
255-
psCurrentVidMode[1]);
256-
}
257-
258-
AdjustWindowRect(&m_rcWindowBounds, dwWindowStyle, FALSE);
259-
260-
SetWindowPos(m_hWnd,
261-
HWND_TOP,
262-
m_rcWindowBounds.left,
263-
m_rcWindowBounds.top,
264-
(m_rcWindowBounds.right - m_rcWindowBounds.left),
265-
(m_rcWindowBounds.bottom - m_rcWindowBounds.top),
266-
SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_DRAWFRAME);
267-
}
202+
u32 dwWindowStyle = 0;
203+
// Set window properties depending on what mode were in.
204+
if (bWindowed)
205+
{
206+
if (m_move_window)
207+
{
208+
dwWindowStyle = WS_BORDER | WS_VISIBLE;
209+
if (!strstr(Core.Params, "-no_dialog_header"))
210+
dwWindowStyle |= WS_DLGFRAME | WS_SYSMENU | WS_MINIMIZEBOX;
211+
SetWindowLong(m_hWnd, GWL_STYLE, dwWindowStyle);
212+
// When moving from fullscreen to windowed mode, it is important to
213+
// adjust the window size after recreating the device rather than
214+
// beforehand to ensure that you get the window size you want. For
215+
// example, when switching from 640x480 fullscreen to windowed with
216+
// a 1000x600 window on a 1024x768 desktop, it is impossible to set
217+
// the window size to 1000x600 until after the display mode has
218+
// changed to 1024x768, because windows cannot be larger than the
219+
// desktop.
220+
221+
RECT m_rcWindowBounds;
222+
RECT DesktopRect;
223+
224+
GetClientRect(GetDesktopWindow(), &DesktopRect);
225+
226+
SetRect(&m_rcWindowBounds,
227+
(DesktopRect.right - psCurrentVidMode[0]) / 2,
228+
(DesktopRect.bottom - psCurrentVidMode[1]) / 2,
229+
(DesktopRect.right + psCurrentVidMode[0]) / 2,
230+
(DesktopRect.bottom + psCurrentVidMode[1]) / 2);
231+
232+
AdjustWindowRect(&m_rcWindowBounds, dwWindowStyle, FALSE);
233+
234+
SetWindowPos(m_hWnd, HWND_NOTOPMOST, m_rcWindowBounds.left, m_rcWindowBounds.top,
235+
(m_rcWindowBounds.right - m_rcWindowBounds.left),
236+
(m_rcWindowBounds.bottom - m_rcWindowBounds.top),
237+
SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_DRAWFRAME);
238+
}
239+
}
240+
else
241+
{
242+
SetWindowLong(m_hWnd, GWL_STYLE, dwWindowStyle = (WS_POPUP | WS_VISIBLE));
243+
}
268244

269245
ShowCursor(FALSE);
270246
SetForegroundWindow(m_hWnd);

src/Layers/xrRenderPC_GL/gl_loader.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ void CRender::level_Load(IReader* fs)
102102
pApp->LoadEnd ();
103103

104104
// sanity-clear
105-
lstLODs.clear ();
106105
lstLODgroups.clear ();
107106
mapLOD.clear ();
108107

src/utils/xrAI/StdAfx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include "Common/Common.hpp"
88
#include "xrCore/xrCore.h"
99

10+
#include <memory>
11+
1012
#include <d3dx9.h>
1113
#include "Common/_d3d_extensions.h"
1214

src/utils/xrAI/game_graph_builder.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "stdafx.h"
1010
#include "game_graph_builder.h"
1111
#include "xrServerEntities/xrServer_Objects_ALife.h"
12+
#include "xrServerEntities/xrMessages.h"
1213
#include "factory_api.h"
1314
#include "guid_generator.h"
1415

src/utils/xrAI/level_spawn_constructor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "level_spawn_constructor.h"
1111
#include "xrServerEntities/restriction_space.h"
1212
#include "xrServerEntities/clsid_game.h"
13+
#include "xrServerEntities/xrMessages.h"
1314
#include "factory_api.h"
1415

1516
#define IGNORE_ZERO_SPAWN_POSITIONS

src/xrCore/xrstring.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#pragma once
22

3+
#include <cstdio>
4+
35
#include "_types.h"
46
#include "xrCommon/inlining_macros.h"
7+
#include "xrMemory.h"
58

69
#define BREAK_AT_STRCMP
710
#ifndef DEBUG

0 commit comments

Comments
 (0)