Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/OpenXRay/xray-16 into opengl
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/xrEngine/x_ray.cpp
  • Loading branch information
CrossVR committed Dec 12, 2015
2 parents a4b56cd + 7efe143 commit e4c249b
Show file tree
Hide file tree
Showing 27 changed files with 1,049 additions and 4,033 deletions.
34 changes: 5 additions & 29 deletions src/Common/object_type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#define object_type_traits_h_included
#pragma once

#include <type_traits>

//#define USE_BOOST

#ifdef USE_BOOST
Expand All @@ -28,32 +30,12 @@

template <bool expression, typename T1, typename T2>
struct _if {
template <bool>
struct selector {
typedef T2 result;
};

template <>
struct selector<true> {
typedef T1 result;
};

typedef typename selector<expression>::result result;
using result = typename std::conditional<expression, T1, T2>::type;
};

template <typename T1, typename T2>
struct is_type {
template <typename T>
struct selector {
enum { value = false, };
};

template <>
struct selector<T1> {
enum { value = true, };
};

enum { value = selector<T2>::value, };
enum { value = std::is_same<T1,T2>::value, };
};

template <typename T>
Expand Down Expand Up @@ -102,13 +84,7 @@

template <typename T>
struct is_void {
template <typename P>
struct select {enum { value = false}; };

template <>
struct select<void> {enum { value = true}; };

enum { value = select<T>::value};
enum { value = std::is_same<void,T>::value };
};

template <typename T> struct is_const{
Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/Animation/Envelope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void CEnvelope::LoadA(IReader& F)
}
// behavior <pre> <post>
F.r_string(buf, sizeof(buf));
int cnt = sscanf(buf, "Behaviors %d %d", behavior[0], behavior[1]);
int cnt = sscanf(buf, "Behaviors %d %d", &behavior[0], &behavior[1]);
R_ASSERT(cnt == 2);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/xrCore/Crypto/xr_dsa_signer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "xr_dsa_signer.h"
#include <ctime>

xr_dsa_signer::xr_dsa_signer(u8 const p_number[crypto::xr_dsa::public_key_length],
u8 const q_number[crypto::xr_dsa::private_key_length],
Expand Down
11 changes: 10 additions & 1 deletion src/xrCore/FTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,17 @@ void CStatTimer::FrameEnd()
else result = 0.99f*result + 0.01f*_time;
}

XRCORE_API pauseMngr g_pauseMngr;
XRCORE_API pauseMngr *g_pauseMngr()
{
static pauseMngr *manager = nullptr;

if (!manager)
{
manager = new pauseMngr();
}

return manager;
}

pauseMngr::pauseMngr() :m_paused(FALSE)
{
Expand Down
6 changes: 3 additions & 3 deletions src/xrCore/FTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class XRCORE_API pauseMngr
void UnRegister(CTimer_paused* t);
};

extern XRCORE_API pauseMngr g_pauseMngr;
extern XRCORE_API pauseMngr *g_pauseMngr();

class XRCORE_API CTimerBase
{
Expand Down Expand Up @@ -161,8 +161,8 @@ class XRCORE_API CTimer_paused_ex : public CTimer
class XRCORE_API CTimer_paused : public CTimer_paused_ex
{
public:
CTimer_paused() { g_pauseMngr.Register(this); }
virtual ~CTimer_paused() { g_pauseMngr.UnRegister(this); }
CTimer_paused() { g_pauseMngr()->Register(this); }
virtual ~CTimer_paused() { g_pauseMngr()->UnRegister(this); }
};

extern XRCORE_API BOOL g_bEnableStatGather;
Expand Down
26 changes: 26 additions & 0 deletions src/xrCore/ModuleLookup.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "stdafx.h"

#include "ModuleLookup.hpp"

#define WIN32_LEAN_AND_MEAN
#include <windows.h>

namespace XRay {
HMODULE LoadLibrary(const char *libraryFileName, bool log)
{
if (log)
Log("Loading DLL:", libraryFileName);
return ::LoadLibraryA(libraryFileName);
}

void UnloadLibrary(HMODULE libraryHandle)
{
FreeLibrary(libraryHandle);
}

void *GetProcAddress(HMODULE libraryHandle, const char *procName)
{
return ::GetProcAddress(libraryHandle, procName);
}

}
9 changes: 9 additions & 0 deletions src/xrCore/ModuleLookup.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include "xrCore.h"

namespace XRay {
XRCORE_API HMODULE LoadLibrary(const char *libraryFileName, bool log = true);
XRCORE_API void UnloadLibrary(HMODULE libraryHandle);
XRCORE_API void *GetProcAddress(HMODULE libraryHandle, const char *procName);
}
2 changes: 1 addition & 1 deletion src/xrCore/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void __cdecl Msg(const char* format, ...)
va_list mark;
string2048 buf;
va_start(mark, format);
int sz = _vsnprintf(buf, sizeof(buf) - 1, format, mark);
int sz = std::vsnprintf(buf, sizeof(buf) - 1, format, mark);
buf[sizeof(buf) - 1] = 0;
va_end(mark);
if (sz) Log(buf);
Expand Down
104 changes: 0 additions & 104 deletions src/xrCore/lzo1x_d3.cpp

This file was deleted.

Loading

0 comments on commit e4c249b

Please sign in to comment.