Skip to content

Commit 054f7e5

Browse files
committed
xrEngine: now build on linux. WARNING!!! TextConsole excluded from linux build, dedicated server unusable!!!
1 parent 663f9c5 commit 054f7e5

File tree

9 files changed

+31
-15
lines changed

9 files changed

+31
-15
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ os:
99
- linux
1010
before_script:
1111
- g++ --version
12-
- sudo apt-get install libegl1-mesa-dev libgles2-mesa-dev libpugixml-dev libopenal-dev libtbb-dev libcrypto++-dev liblockfile-dev
12+
- sudo apt-get install libegl1-mesa-dev libgles2-mesa-dev libpugixml-dev libopenal-dev libtbb-dev libcrypto++-dev liblockfile-dev libfreeimage-dev
1313
- sudo apt-get install cmake lua5.1-dev libssl-dev libogg-dev libtheora-dev libvorbis-dev libsdl2-dev liblzo2-dev libjpeg-dev libncurses5-dev
1414
- mkdir bin
1515
- cd bin

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ add_subdirectory(Layers)
55
add_subdirectory(xrAICore)
66
add_subdirectory(xrCDB)
77
add_subdirectory(xrCore)
8-
#add_subdirectory(xrEngine)
8+
add_subdirectory(xrEngine)
99
#add_subdirectory(xrGame)
1010
#add_subdirectory(xrNetServer)
1111
add_subdirectory(xrParticles)

src/Common/PlatformLinux.inl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,25 +110,31 @@ inline int GetExceptionCode()
110110

111111
#define xr_unlink unlink
112112

113-
typedef bool BOOL;
113+
#include <inttypes.h>
114+
typedef int32_t BOOL;
115+
typedef uint8_t BYTE;
116+
typedef uint16_t WORD;
117+
typedef uint32_t DWORD;
118+
typedef int32_t LONG;
119+
#ifndef _LIBRAW_TYPES_H
120+
typedef int64_t INT64;
121+
typedef uint64_t UINT64;
122+
#endif
123+
114124
typedef char* LPSTR;
115125
typedef char* PSTR;
116126
typedef char* LPTSTR;
117127
typedef const char* LPCSTR;
118128
typedef const char* LPCTSTR;
119-
typedef unsigned char BYTE;
120129
typedef unsigned char* LPBYTE;
121130
typedef unsigned int UINT;
122131
typedef int INT;
123-
typedef long LONG;
124132
typedef unsigned long ULONG;
125133
typedef unsigned long& ULONG_PTR;
126134
typedef long long int LARGE_INTEGER;
127135
typedef unsigned long long int ULARGE_INTEGER;
128136

129-
typedef unsigned short WORD;
130137
typedef unsigned short* LPWORD;
131-
typedef unsigned long DWORD;
132138
typedef unsigned long* LPDWORD;
133139
typedef const void* LPCVOID;
134140
typedef long long int* PLARGE_INTEGER;
@@ -193,8 +199,6 @@ typedef long _W64;
193199
//typedef void* HWND;
194200
typedef SDL_Window* HWND;
195201
typedef void* HDC;
196-
//typedef void* HGLRC;
197-
typedef SDL_GLContext HGLRC;
198202
typedef float FLOAT;
199203
typedef unsigned char UINT8;
200204

src/xrEngine/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@ add_dir("${DIRS}")
99
include_directories(
1010
${CMAKE_CURRENT_SOURCE_DIR}/..
1111
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/OpenAutomate/inc
12-
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/FreeImage/Dist/x64
1312
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
1413
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/luabind
1514
/usr/include/SDL2
1615
)
1716

1817
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./tntQAVI.cpp")
1918
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./editor_environment_manager_properties.cpp")
19+
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./Text_Console.cpp")
20+
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./Text_Console_WndProc.cpp")
2021

2122
list(REMOVE_ITEM ${PROJECT_NAME}__INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/./tntQAVI.h")
23+
list(REMOVE_ITEM ${PROJECT_NAME}__INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/./Text_Console.h")
2224

2325
add_definitions(-DENGINE_BUILD)
2426
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__INCLUDES})
2527

2628
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
27-
target_link_libraries(${PROJECT_NAME} xrCore luabind xrAPI xrSound xrScriptEngine luajit theora ${OGG_LIBRARIES} xrNetServer xrCDB xrPhysics openal lockfile)
29+
target_link_libraries(${PROJECT_NAME} xrCore luabind xrAPI xrSound xrScriptEngine luajit theora ${OGG_LIBRARIES} xrCDB xrPhysics openal lockfile)

src/xrEngine/Device_Initialize.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ void CRenderDevice::Initialize()
4646
if (!m_sdlWnd)
4747
{
4848
const Uint32 flags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_HIDDEN |
49-
SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_OPENGL;
49+
SDL_WINDOW_RESIZABLE
50+
#if SDL_VERSION_ATLEAST(2,0,5)
51+
| SDL_WINDOW_ALWAYS_ON_TOP
52+
#endif
53+
| SDL_WINDOW_OPENGL;
5054

5155
m_sdlWnd = SDL_CreateWindow("S.T.A.L.K.E.R.: Call of Pripyat", 0, 0, 256, 192, flags);
5256

src/xrEngine/Device_create.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ void CRenderDevice::UpdateWindowRects()
126126
m_rcWindowBounds.w += m_rcWindowBounds.x;
127127
m_rcWindowBounds.h += m_rcWindowBounds.y;
128128

129+
#if SDL_VERSION_ATLEAST(2,0,5)
129130
// Do we need code below?
130131
int top, left, bottom, right;
131132
SDL_GetWindowBordersSize(m_sdlWnd, &top, &left, &bottom, &right);
@@ -135,6 +136,7 @@ void CRenderDevice::UpdateWindowRects()
135136
m_rcWindowBounds.h += bottom;
136137
// XXX: check if we need this code when SDL_GetWindowBordersSize
137138
// will be available for Windows
139+
#endif
138140
}
139141

140142
void CRenderDevice::SelectResolution(const bool windowed)

src/xrEngine/Feel_Touch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using namespace Feel;
77
Touch::Touch() : pure_relcase(&Touch::feel_touch_relcase) {}
88
Touch::~Touch() {}
99
bool Touch::feel_touch_contact(IGameObject* O) { return true; }
10-
void Touch::feel_touch_deny(IGameObject* O, /*DWORD*/ unsigned long T)
10+
void Touch::feel_touch_deny(IGameObject* O, DWORD T)
1111
{
1212
DenyTouch D;
1313
D.O = O;

src/xrEngine/XR_IOConsole.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ void CConsole::Show()
601601
}
602602
bVisible = true;
603603

604-
GetCursorPos(&m_mouse_pos);
604+
SDL_GetGlobalMouseState((int *) &m_mouse_pos.x, (int *) &m_mouse_pos.y); // Replace with SDL_GetMouseState in case retrieve window-relative coordinates
605605

606606
ec().clear_states();
607607
scroll_delta = 0;
@@ -626,7 +626,7 @@ void CConsole::Hide()
626626

627627
if (pInput->get_exclusive_mode())
628628
{
629-
SetCursorPos(m_mouse_pos.x, m_mouse_pos.y);
629+
SDL_WarpMouseGlobal(m_mouse_pos.x, m_mouse_pos.y); // Replace with SDL_WarpMouseInWindow in case set window-relative coordinates
630630
}
631631

632632
bVisible = false;

src/xrEngine/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818

1919
#include "LightAnimLibrary.h"
2020
#include "xrCDB/ISpatial.h"
21+
#if defined(WINDOWS)
2122
#include "Text_Console.h"
23+
#elif defined(LINUX)
24+
#define CTextConsole CConsole
25+
#endif
2226
#include "xrSASH.h"
2327
#include "xr_ioc_cmd.h"
2428

0 commit comments

Comments
 (0)