Skip to content

Commit 527fd7d

Browse files
committed
Merge remote-tracking branch 'upstream/xd_dev' into xd_dev
2 parents f5a0054 + b5b2b75 commit 527fd7d

File tree

13 files changed

+85
-72
lines changed

13 files changed

+85
-72
lines changed

appveyor.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ environment:
2222
tbs_tools: msvc
2323
tbs_config: Release
2424
install:
25-
- SET LUAENV=cinst
25+
- SET LUAENV=lua51
2626
- cmd: .appveyor\install-lua.cmd
2727

2828
build_script:
@@ -54,11 +54,11 @@ build_script:
5454
)
5555
test: off
5656
artifacts:
57-
- path: res/xdOpenXRay.Dx86.7z
58-
name: xdOpenXRay.Dx86.7z
59-
- path: res/xdOpenXRay.Dx64.7z
60-
name: xdOpenXRay.Dx64.7z
61-
- path: res/xdOpenXRay.Rx86.7z
62-
name: xdOpenXRay.Rx86.7z
63-
- path: res/xdOpenXRay.Rx64.7z
64-
name: xdOpenXRay.Rx64.7z
57+
- path: res/OpenXRay.Dx86.7z
58+
name: OpenXRay.Dx86.7z
59+
- path: res/OpenXRay.Dx64.7z
60+
name: OpenXRay.Dx64.7z
61+
- path: res/OpenXRay.Rx86.7z
62+
name: OpenXRay.Rx86.7z
63+
- path: res/OpenXRay.Rx64.7z
64+
name: OpenXRay.Rx64.7z

src/xrEngine/main.cpp

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Entry point is in xr_3da/entry_point.cpp
22
#include "stdafx.h"
33
#include "main.h"
4-
#include "xr_3da/resource.h"
54

65
#include <process.h>
76
#include <locale.h>
@@ -33,6 +32,7 @@ ENGINE_API string_path g_sLaunchWorkingFolder;
3332

3433
namespace
3534
{
35+
bool CheckBenchmark();
3636
void RunBenchmark(pcstr name);
3737
}
3838

@@ -231,26 +231,8 @@ ENGINE_API int RunApplication()
231231
InitConsole();
232232
Engine.External.CreateRendererList();
233233

234-
pcstr benchName = "-batch_benchmark ";
235-
if (strstr(Core.Params, benchName))
236-
{
237-
u32 sz = xr_strlen(benchName);
238-
string64 benchmarkName;
239-
sscanf(strstr(Core.Params, benchName) + sz, "%[^ ] ", benchmarkName);
240-
RunBenchmark(benchmarkName);
241-
return 0;
242-
}
243-
244-
pcstr sashName = "-openautomate ";
245-
if (strstr(Core.Params, sashName))
246-
{
247-
u32 sz = xr_strlen(sashName);
248-
string512 sashArg;
249-
sscanf(strstr(Core.Params, sashName) + sz, "%[^ ] ", sashArg);
250-
g_SASH.Init(sashArg);
251-
g_SASH.MainLoop();
234+
if (CheckBenchmark())
252235
return 0;
253-
}
254236

255237
if (!GEnv.isDedicatedServer)
256238
{
@@ -295,13 +277,38 @@ ENGINE_API int RunApplication()
295277

296278
namespace
297279
{
280+
bool CheckBenchmark()
281+
{
282+
pcstr benchName = "-batch_benchmark ";
283+
if (strstr(Core.Params, benchName))
284+
{
285+
const u32 sz = xr_strlen(benchName);
286+
string64 benchmarkName;
287+
sscanf(strstr(Core.Params, benchName) + sz, "%[^ ] ", benchmarkName);
288+
RunBenchmark(benchmarkName);
289+
return true;
290+
}
291+
292+
pcstr sashName = "-openautomate ";
293+
if (strstr(Core.Params, sashName))
294+
{
295+
const u32 sz = xr_strlen(sashName);
296+
string512 sashArg;
297+
sscanf(strstr(Core.Params, sashName) + sz, "%[^ ] ", sashArg);
298+
g_SASH.Init(sashArg);
299+
g_SASH.MainLoop();
300+
return true;
301+
}
302+
303+
return false;
304+
}
298305
void RunBenchmark(pcstr name)
299306
{
300307
g_bBenchmark = true;
301308
string_path cfgPath;
302309
FS.update_path(cfgPath, "$app_data_root$", name);
303310
CInifile ini(cfgPath);
304-
u32 benchmarkCount = ini.line_count("benchmark");
311+
const u32 benchmarkCount = ini.line_count("benchmark");
305312
for (u32 i = 0; i < benchmarkCount; i++)
306313
{
307314
LPCSTR benchmarkName, t;

src/xrEngine/pure.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ struct MessageObject
3636
{
3737
IPure* Object;
3838
int Prio;
39-
u32 Flags;
4039
};
4140

4241
template<class T>
@@ -57,12 +56,12 @@ class MessageRegistry
5756

5857
void Clear() { messages.clear(); }
5958

60-
void Add(T* object, const int priority = REG_PRIORITY_NORMAL, const u32 flags = 0)
59+
constexpr void Add(T* object, const int priority = REG_PRIORITY_NORMAL)
6160
{
62-
Add({ object, priority, flags });
61+
Add({ object, priority });
6362
}
6463

65-
void Add(MessageObject newMessage)
64+
void Add(MessageObject&& newMessage)
6665
{
6766
#ifdef DEBUG
6867
VERIFY(newMessage.Object);

src/xrEngine/xrEngine.vcxproj.filters

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,6 @@
555555
<ClInclude Include="profiler_inline.h">
556556
<Filter>General\Profiler</Filter>
557557
</ClInclude>
558-
<ClInclude Include="main.h" />
559558
<ClInclude Include="splash.h">
560559
<Filter>General</Filter>
561560
</ClInclude>
@@ -565,6 +564,9 @@
565564
<ClInclude Include="ShadersExternalData.h">
566565
<Filter>Render\Visibility</Filter>
567566
</ClInclude>
567+
<ClInclude Include="main.h">
568+
<Filter>General</Filter>
569+
</ClInclude>
568570
</ItemGroup>
569571
<ItemGroup>
570572
<ClCompile Include="defines.cpp">

src/xrGame/ik/limb.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,7 @@ int Limb::try_singularities(int solves, float& swivel_angle, float x[])
738738
//
739739
// Assumes that either SetGoal or SetGoalPos has been called first
740740
//
741-
// XXX: Shouldn't the phInfinity declaration be in a header for xrPhysics?
742-
extern XRPHYSICS_API const float phInfinity;
741+
743742
int Limb::Solve(float x[], float* new_swivel, float* new_pos)
744743
{
745744
int success;

src/xrGame/script_sound.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
CScriptSound::CScriptSound(LPCSTR caSoundName, ESoundTypes sound_type)
1818
{
19+
m_bIsNoSound = strstr(Core.Params, "-nosound");
1920
m_caSoundToPlay = caSoundName;
2021
string_path l_caFileName;
2122
VERIFY(GEnv.Sound);
@@ -35,7 +36,7 @@ CScriptSound::~CScriptSound()
3536

3637
Fvector CScriptSound::GetPosition() const
3738
{
38-
VERIFY(m_sound._handle());
39+
VERIFY(m_sound._handle() || m_bIsNoSound);
3940
const CSound_params* l_tpSoundParams = m_sound.get_params();
4041
if (l_tpSoundParams)
4142
return (l_tpSoundParams->position);
@@ -48,15 +49,15 @@ Fvector CScriptSound::GetPosition() const
4849

4950
void CScriptSound::Play(CScriptGameObject* object, float delay, int flags)
5051
{
51-
THROW3(m_sound._handle(), "There is no sound", *m_caSoundToPlay);
52+
THROW3(m_sound._handle() || m_bIsNoSound, "There is no sound", *m_caSoundToPlay);
5253
// Msg ("%6d : CScriptSound::Play (%s), delay %f, flags
5354
//%d",Device.dwTimeGlobal,m_sound._handle()->file_name(),delay,flags);
5455
m_sound.play((object) ? &object->object() : NULL, flags, delay);
5556
}
5657

5758
void CScriptSound::PlayAtPos(CScriptGameObject* object, const Fvector& position, float delay, int flags)
5859
{
59-
THROW3(m_sound._handle(), "There is no sound", *m_caSoundToPlay);
60+
THROW3(m_sound._handle() || m_bIsNoSound, "There is no sound", *m_caSoundToPlay);
6061
// Msg ("%6d : CScriptSound::Play (%s), delay %f, flags
6162
//%d",m_sound._handle()->file_name(),delay,flags);
6263
m_sound.play_at_pos((object) ? &object->object() : NULL, position, flags, delay);
@@ -65,6 +66,6 @@ void CScriptSound::PlayAtPos(CScriptGameObject* object, const Fvector& position,
6566
void CScriptSound::PlayNoFeedback(
6667
CScriptGameObject* object, u32 flags /*!< Looping */, float delay /*!< Delay */, Fvector pos, float vol)
6768
{
68-
THROW3(m_sound._handle(), "There is no sound", *m_caSoundToPlay);
69+
THROW3(m_sound._handle() || m_bIsNoSound, "There is no sound", *m_caSoundToPlay);
6970
m_sound.play_no_feedback((object) ? &object->object() : NULL, flags, delay, &pos, &vol);
7071
}

src/xrGame/script_sound.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class CScriptSound
1616
{
1717
mutable ref_sound m_sound;
1818
shared_str m_caSoundToPlay;
19+
bool m_bIsNoSound = false;
1920

2021
friend class CScriptSoundAction;
2122

src/xrGame/script_sound_inline.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
IC u32 CScriptSound::Length()
1212
{
13-
VERIFY(m_sound._handle());
13+
VERIFY(m_sound._handle() || m_bIsNoSound);
1414
return iFloor(m_sound.get_length_sec() * 1000.0f);
1515
}
1616

@@ -28,37 +28,37 @@ IC void CScriptSound::PlayAtPos(CScriptGameObject* object, const Fvector& positi
2828

2929
IC void CScriptSound::SetMinDistance(const float fMinDistance)
3030
{
31-
VERIFY(m_sound._handle());
31+
VERIFY(m_sound._handle() || m_bIsNoSound);
3232
m_sound.set_range(fMinDistance, GetMaxDistance());
3333
}
3434

3535
IC void CScriptSound::SetMaxDistance(const float fMaxDistance)
3636
{
37-
VERIFY(m_sound._handle());
37+
VERIFY(m_sound._handle() || m_bIsNoSound);
3838
m_sound.set_range(GetMinDistance(), fMaxDistance);
3939
}
4040

4141
IC const float CScriptSound::GetFrequency() const
4242
{
43-
VERIFY(m_sound._handle());
43+
VERIFY(m_sound._handle() || m_bIsNoSound);
4444
return (m_sound.get_params()->freq);
4545
}
4646

4747
IC const float CScriptSound::GetMinDistance() const
4848
{
49-
VERIFY(m_sound._handle());
49+
VERIFY(m_sound._handle() || m_bIsNoSound);
5050
return (m_sound.get_params()->min_distance);
5151
}
5252

5353
IC const float CScriptSound::GetMaxDistance() const
5454
{
55-
VERIFY(m_sound._handle());
55+
VERIFY(m_sound._handle() || m_bIsNoSound);
5656
return (m_sound.get_params()->max_distance);
5757
}
5858

5959
IC const float CScriptSound::GetVolume() const
6060
{
61-
VERIFY(m_sound._handle());
61+
VERIFY(m_sound._handle() || m_bIsNoSound);
6262
return (m_sound.get_params()->volume);
6363
}
6464

@@ -72,42 +72,42 @@ IC bool CScriptSound::IsPlaying() const
7272
IC void CScriptSound::AttachTail(LPCSTR caSoundName) { m_sound.attach_tail(caSoundName); }
7373
IC void CScriptSound::Stop()
7474
{
75-
VERIFY(m_sound._handle());
75+
VERIFY(m_sound._handle() || m_bIsNoSound);
7676
m_sound.stop();
7777
}
7878

7979
IC void CScriptSound::StopDeferred()
8080
{
81-
VERIFY(m_sound._handle());
81+
VERIFY(m_sound._handle() || m_bIsNoSound);
8282
m_sound.stop_deferred();
8383
}
8484

8585
IC void CScriptSound::SetPosition(const Fvector& position)
8686
{
87-
VERIFY(m_sound._handle());
87+
VERIFY(m_sound._handle() || m_bIsNoSound);
8888
m_sound.set_position(position);
8989
}
9090

9191
IC void CScriptSound::SetFrequency(float frequency)
9292
{
93-
VERIFY(m_sound._handle());
93+
VERIFY(m_sound._handle() || m_bIsNoSound);
9494
m_sound.set_frequency(frequency);
9595
}
9696

9797
IC void CScriptSound::SetVolume(float volume)
9898
{
99-
VERIFY(m_sound._handle());
99+
VERIFY(m_sound._handle() || m_bIsNoSound);
100100
m_sound.set_volume(volume);
101101
}
102102

103103
IC const CSound_params* CScriptSound::GetParams()
104104
{
105-
VERIFY(m_sound._handle());
105+
VERIFY(m_sound._handle() || m_bIsNoSound);
106106
return (m_sound.get_params());
107107
}
108108

109109
IC void CScriptSound::SetParams(CSound_params* sound_params)
110110
{
111-
VERIFY(m_sound._handle());
111+
VERIFY(m_sound._handle() || m_bIsNoSound);
112112
m_sound.set_params(sound_params);
113113
}

src/xrGame/ui/UIComboBox.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,23 @@ void CUIComboBox::SetCurrentOptValue()
123123
m_list_box.Clear();
124124
const xr_token* tok = GetOptToken();
125125

126-
while (tok->name)
126+
if (tok)
127127
{
128-
if (m_disabled.end() == std::find(m_disabled.begin(), m_disabled.end(), tok->id))
128+
while (tok->name)
129129
{
130-
AddItem_(tok->name, tok->id);
130+
if (m_disabled.end() == std::find(m_disabled.begin(), m_disabled.end(), tok->id))
131+
{
132+
AddItem_(tok->name, tok->id);
133+
}
134+
tok++;
131135
}
132-
tok++;
133-
}
134136

135-
LPCSTR cur_val = *CStringTable().translate(GetOptTokenValue());
136-
m_text.SetText(cur_val);
137-
m_list_box.SetSelectedText(cur_val);
137+
LPCSTR cur_val = *CStringTable().translate(GetOptTokenValue());
138+
m_text.SetText(cur_val);
139+
m_list_box.SetSelectedText(cur_val);
140+
}
141+
else
142+
m_text.SetText("-");
138143

139144
CUIListBoxItem* itm = m_list_box.GetSelectedItem();
140145
if (itm)

src/xrGame/ui/UIGameTutorialVideoItem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void CUISequenceVideoItem::Load(CUIXml* xml, int idx)
9393
if (snd_name && snd_name[0])
9494
{
9595
m_sound.create(snd_name, st_Effect, sg_Undefined);
96-
VERIFY(m_sound._handle());
96+
VERIFY(m_sound._handle() || strstr(Core.Params, "-nosound"));
9797
}
9898
xml->SetLocalRoot(_stored_root);
9999
}

0 commit comments

Comments
 (0)