Skip to content

Commit ccce5e7

Browse files
committed
Enable xrWeatherEditor on Release
1 parent ac1fce0 commit ccce5e7

File tree

68 files changed

+129
-502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+129
-502
lines changed

src/xrCore/ModuleLookup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void* Module::open(pcstr moduleName)
2626
handle = ::LoadLibrary(moduleName);
2727

2828
if (handle == nullptr)
29-
Msg("Failed to load DLL: %d", GetLastError());
29+
Msg("! Failed to load DLL: %d", GetLastError());
3030

3131
return handle;
3232
}

src/xrEngine/Device_Initialize.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
#include "stdafx.h"
22
#include "resource.h"
3-
#ifdef INGAME_EDITOR
43
#include "Include/editor/ide.hpp"
54
#include "engine_impl.hpp"
6-
#endif
75
#include "GameFont.h"
86
#include "PerformanceAlert.hpp"
97
#include "xrCore/ModuleLookup.hpp"
108

119
extern LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
1210

13-
#ifdef INGAME_EDITOR
1411
void CRenderDevice::initialize_editor()
1512
{
1613
m_editor_module = std::make_unique<XRay::Module>("xrWeatherEditor");
1714
if (!m_editor_module->exist())
18-
{
19-
Msg("! cannot load library \"xrWeatherEditor\"");
2015
return;
21-
}
2216

2317
m_editor_initialize = (initialize_function_ptr)m_editor_module->getProcAddress("initialize");
2418
VERIFY(m_editor_initialize);
@@ -33,17 +27,16 @@ void CRenderDevice::initialize_editor()
3327
m_hWnd = m_editor->view_handle();
3428
VERIFY(m_hWnd != INVALID_HANDLE_VALUE);
3529
}
36-
#endif // #ifdef INGAME_EDITOR
3730

3831
void CRenderDevice::Initialize()
3932
{
4033
Log("Initializing Engine...");
4134
TimerGlobal.Start();
4235
TimerMM.Start();
43-
#ifdef INGAME_EDITOR
36+
4437
if (strstr(Core.Params, "-editor"))
4538
initialize_editor();
46-
#endif
39+
4740
// Unless a substitute hWnd has been specified, create a window to render into
4841
if (!m_hWnd)
4942
{

src/xrEngine/Device_create.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ void CRenderDevice::Create()
3434
#endif
3535
fFOV = 90.f;
3636
fASPECT = 1.f;
37-
#ifdef INGAME_EDITOR
38-
bool noEd = !editor();
39-
#else
40-
bool noEd = true;
41-
#endif
37+
const bool noEd = !editor();
4238
GEnv.Render->Create(m_hWnd, dwWidth, dwHeight, fWidth_2, fHeight_2, noEd);
4339
Memory.mem_compact();
4440
b_is_Ready = TRUE;

src/xrEngine/Device_wndproc.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,30 @@ bool CRenderDevice::on_message(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
44
{
55
switch (uMsg)
66
{
7-
case WM_SYSKEYDOWN: { return true;
8-
}
9-
case WM_ACTIVATE: {
10-
#ifdef INGAME_EDITOR
7+
case WM_SYSKEYDOWN: { return true; }
8+
case WM_ACTIVATE:
9+
{
1110
if (editor())
1211
{
1312
Device.b_is_Active = TRUE;
1413
break;
1514
}
16-
#endif // #ifdef INGAME_EDITOR
15+
1716
OnWM_Activate(wParam, lParam);
1817
return (false);
1918
}
20-
case WM_SETCURSOR: {
21-
#ifdef INGAME_EDITOR
19+
case WM_SETCURSOR:
20+
{
2221
if (editor())
2322
break;
24-
#endif // #ifdef INGAME_EDITOR
2523

2624
result = 1;
2725
return (true);
2826
}
29-
case WM_SYSCOMMAND: {
30-
#ifdef INGAME_EDITOR
27+
case WM_SYSCOMMAND:
28+
{
3129
if (editor())
3230
break;
33-
#endif // #ifdef INGAME_EDITOR
3431

3532
// Prevent moving/sizing and power loss in fullscreen mode
3633
switch (wParam)
@@ -42,11 +39,10 @@ bool CRenderDevice::on_message(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
4239
}
4340
return (false);
4441
}
45-
case WM_CLOSE: {
46-
#ifdef INGAME_EDITOR
42+
case WM_CLOSE:
43+
{
4744
if (editor())
4845
break;
49-
#endif // #ifdef INGAME_EDITOR
5046

5147
result = 0;
5248
return (true);

src/xrEngine/Environment.h

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ class CLensFlareDescriptor;
2828

2929
#define DAY_LENGTH 86400.f
3030

31-
#ifdef INGAME_EDITOR
32-
#define INGAME_EDITOR_VIRTUAL virtual
33-
#else // #ifdef INGAME_EDITOR
34-
#define INGAME_EDITOR_VIRTUAL
35-
#endif // #ifdef INGAME_EDITOR
36-
3731
// t-defs
3832
class ENGINE_API CEnvModifier
3933
{
@@ -69,7 +63,7 @@ class ENGINE_API CEnvAmbient
6963
float wind_blast_strength;
7064
Fvector wind_blast_direction;
7165

72-
INGAME_EDITOR_VIRTUAL ~SEffect() {}
66+
virtual ~SEffect() {}
7367
};
7468
using EffectVec = xr_vector<SEffect*>;
7569

@@ -95,8 +89,8 @@ class ENGINE_API CEnvAmbient
9589
{
9690
return (m_sound_dist.x < m_sound_dist.y) ? Random.randF(m_sound_dist.x, m_sound_dist.y) : 0;
9791
}
98-
INGAME_EDITOR_VIRTUAL ~SSndChannel() {}
99-
INGAME_EDITOR_VIRTUAL sounds_type& sounds() { return m_sounds; }
92+
virtual ~SSndChannel() {}
93+
virtual sounds_type& sounds() { return m_sounds; }
10094
protected:
10195
xr_vector<ref_sound> m_sounds;
10296
};
@@ -114,16 +108,16 @@ class ENGINE_API CEnvAmbient
114108
public:
115109
const shared_str& name() { return m_load_section; }
116110
const shared_str& get_ambients_config_filename() { return m_ambients_config_filename; }
117-
INGAME_EDITOR_VIRTUAL void load(CInifile& ambients_config, CInifile& sound_channels_config,
111+
virtual void load(CInifile& ambients_config, CInifile& sound_channels_config,
118112
CInifile& effects_config, const shared_str& section);
119113
SEffect* get_rnd_effect() { return effects().empty() ? 0 : effects()[Random.randI(effects().size())]; }
120114
u32 get_rnd_effect_time() { return Random.randI(m_effect_period.x, m_effect_period.y); }
121-
INGAME_EDITOR_VIRTUAL SEffect* create_effect(CInifile& config, LPCSTR id);
122-
INGAME_EDITOR_VIRTUAL SSndChannel* create_sound_channel(CInifile& config, LPCSTR id);
123-
INGAME_EDITOR_VIRTUAL ~CEnvAmbient();
115+
virtual SEffect* create_effect(CInifile& config, LPCSTR id);
116+
virtual SSndChannel* create_sound_channel(CInifile& config, LPCSTR id);
117+
virtual ~CEnvAmbient();
124118
void destroy();
125-
INGAME_EDITOR_VIRTUAL EffectVec& effects() { return m_effects; }
126-
INGAME_EDITOR_VIRTUAL SSndChannelVec& get_snd_channels() { return m_sound_channels; }
119+
virtual EffectVec& effects() { return m_effects; }
120+
virtual SSndChannelVec& get_snd_channels() { return m_sound_channels; }
127121
};
128122

129123
class ENGINE_API CEnvDescriptor
@@ -216,7 +210,7 @@ class ENGINE_API CEnvDescriptorMixer : public CEnvDescriptor
216210

217211
public:
218212
CEnvDescriptorMixer(shared_str const& identifier);
219-
INGAME_EDITOR_VIRTUAL void lerp(
213+
virtual void lerp(
220214
CEnvironment* parent, CEnvDescriptor& A, CEnvDescriptor& B, float f, CEnvModifier& M, float m_power);
221215
void clear();
222216
void destroy();
@@ -302,17 +296,17 @@ class ENGINE_API CEnvironment
302296
void SelectEnvs(float gt);
303297

304298
void UpdateAmbient();
305-
INGAME_EDITOR_VIRTUAL CEnvAmbient* AppendEnvAmb(const shared_str& sect);
299+
virtual CEnvAmbient* AppendEnvAmb(const shared_str& sect);
306300

307301
void Invalidate();
308302

309303
public:
310304
CEnvironment();
311305

312-
INGAME_EDITOR_VIRTUAL ~CEnvironment();
306+
virtual ~CEnvironment();
313307

314-
INGAME_EDITOR_VIRTUAL void load();
315-
INGAME_EDITOR_VIRTUAL void unload();
308+
virtual void load();
309+
virtual void unload();
316310

317311
void mods_load();
318312
void mods_unload();
@@ -348,9 +342,7 @@ class ENGINE_API CEnvironment
348342
void ED_Reload();
349343
float GetGameTime() { return fGameTime; }
350344
#else // #ifdef _EDITOR
351-
#ifdef INGAME_EDITOR
352345
float GetGameTime() { return fGameTime; }
353-
#endif // #ifdef INGAME_EDITOR
354346

355347
bool m_paused;
356348
#endif // #ifdef _EDITOR
@@ -363,21 +355,21 @@ class ENGINE_API CEnvironment
363355
CInifile* m_thunderbolts_config;
364356

365357
protected:
366-
INGAME_EDITOR_VIRTUAL CEnvDescriptor* create_descriptor(shared_str const& identifier, CInifile* config);
367-
INGAME_EDITOR_VIRTUAL void load_weathers();
368-
INGAME_EDITOR_VIRTUAL void load_weather_effects();
369-
INGAME_EDITOR_VIRTUAL void create_mixer();
358+
virtual CEnvDescriptor* create_descriptor(shared_str const& identifier, CInifile* config);
359+
virtual void load_weathers();
360+
virtual void load_weather_effects();
361+
virtual void create_mixer();
370362
void destroy_mixer();
371363

372364
void load_level_specific_ambients();
373365

374366
public:
375-
INGAME_EDITOR_VIRTUAL SThunderboltDesc* thunderbolt_description(CInifile& config, shared_str const& section);
376-
INGAME_EDITOR_VIRTUAL SThunderboltCollection* thunderbolt_collection(
367+
virtual SThunderboltDesc* thunderbolt_description(CInifile& config, shared_str const& section);
368+
virtual SThunderboltCollection* thunderbolt_collection(
377369
CInifile* pIni, CInifile* thunderbolts, LPCSTR section);
378-
INGAME_EDITOR_VIRTUAL SThunderboltCollection* thunderbolt_collection(
370+
virtual SThunderboltCollection* thunderbolt_collection(
379371
xr_vector<SThunderboltCollection*>& collection, shared_str const& id);
380-
INGAME_EDITOR_VIRTUAL CLensFlareDescriptor* add_flare(
372+
virtual CLensFlareDescriptor* add_flare(
381373
xr_vector<CLensFlareDescriptor*>& collection, shared_str const& id);
382374

383375
public:
@@ -391,8 +383,6 @@ class ENGINE_API CEnvironment
391383
float p_fog_color;
392384
};
393385

394-
#undef INGAME_EDITOR_VIRTUAL
395-
396386
ENGINE_API extern Flags32 psEnvFlags;
397387
ENGINE_API extern float psVisDistance;
398388

src/xrEngine/IGame_Persistent.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@
1515
#include "CustomHUD.h"
1616
#endif
1717

18-
#ifdef _EDITOR
19-
bool g_dedicated_server = false;
20-
#endif
21-
22-
#ifdef INGAME_EDITOR
2318
#include "editor_environment_manager.hpp"
24-
#endif // INGAME_EDITOR
2519

2620
ENGINE_API IGame_Persistent* g_pGamePersistent = nullptr;
2721

@@ -41,16 +35,10 @@ IGame_Persistent::IGame_Persistent()
4135

4236
m_pMainMenu = nullptr;
4337

44-
#ifndef INGAME_EDITOR
45-
#ifndef _EDITOR
46-
pEnvironment = new CEnvironment();
47-
#endif
48-
#else // #ifdef INGAME_EDITOR
4938
if (RDEVICE.editor())
5039
pEnvironment = new editor::environment::manager();
5140
else
5241
pEnvironment = new CEnvironment();
53-
#endif // #ifdef INGAME_EDITOR
5442
}
5543

5644
IGame_Persistent::~IGame_Persistent()

src/xrEngine/Xr_input.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ float stop_vibration_time = flt_max;
2626
static bool g_exclusive = true;
2727
static void on_error_dialog(bool before)
2828
{
29-
#ifdef INGAME_EDITOR
30-
if (Device.editor())
31-
return;
32-
#endif // #ifdef INGAME_EDITOR
33-
if (!pInput || !g_exclusive)
29+
if (!pInput || !g_exclusive || Device.editor())
3430
return;
3531

3632
if (before)
@@ -134,9 +130,7 @@ HRESULT CInput::CreateInputDevice(
134130

135131
// Set the cooperativity level to let DirectInput know how this device
136132
// should interact with the system and with other DirectInput applications.
137-
#ifdef INGAME_EDITOR
138133
if (!Device.editor())
139-
#endif // #ifdef INGAME_EDITOR
140134
{
141135
HRESULT _hr = (*device)->SetCooperativeLevel(RDEVICE.m_hWnd, dwFlags);
142136
if (FAILED(_hr) && (_hr == E_NOTIMPL))
@@ -670,17 +664,13 @@ void CInput::unacquire()
670664
void CInput::acquire(const bool& exclusive)
671665
{
672666
pKeyboard->SetCooperativeLevel(
673-
#ifdef INGAME_EDITOR
674667
Device.editor() ? Device.editor()->main_handle() :
675-
#endif // #ifdef INGAME_EDITOR
676668
RDEVICE.m_hWnd,
677669
(exclusive ? DISCL_EXCLUSIVE : DISCL_NONEXCLUSIVE) | DISCL_FOREGROUND);
678670
pKeyboard->Acquire();
679671

680672
pMouse->SetCooperativeLevel(
681-
#ifdef INGAME_EDITOR
682673
Device.editor() ? Device.editor()->main_handle() :
683-
#endif // #ifdef INGAME_EDITOR
684674
RDEVICE.m_hWnd,
685675
(exclusive ? DISCL_EXCLUSIVE : DISCL_NONEXCLUSIVE) | DISCL_FOREGROUND | DISCL_NOWINKEY);
686676
pMouse->Acquire();

0 commit comments

Comments
 (0)