Skip to content

Commit

Permalink
xrEngine: now build on linux. WARNING!!! TextConsole excluded from li…
Browse files Browse the repository at this point in the history
…nux build, dedicated server unusable!!!
  • Loading branch information
eagleivg committed Jul 24, 2018
1 parent 663f9c5 commit 054f7e5
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ os:
- linux
before_script:
- g++ --version
- sudo apt-get install libegl1-mesa-dev libgles2-mesa-dev libpugixml-dev libopenal-dev libtbb-dev libcrypto++-dev liblockfile-dev
- sudo apt-get install libegl1-mesa-dev libgles2-mesa-dev libpugixml-dev libopenal-dev libtbb-dev libcrypto++-dev liblockfile-dev libfreeimage-dev
- sudo apt-get install cmake lua5.1-dev libssl-dev libogg-dev libtheora-dev libvorbis-dev libsdl2-dev liblzo2-dev libjpeg-dev libncurses5-dev
- mkdir bin
- cd bin
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ add_subdirectory(Layers)
add_subdirectory(xrAICore)
add_subdirectory(xrCDB)
add_subdirectory(xrCore)
#add_subdirectory(xrEngine)
add_subdirectory(xrEngine)
#add_subdirectory(xrGame)
#add_subdirectory(xrNetServer)
add_subdirectory(xrParticles)
Expand Down
18 changes: 11 additions & 7 deletions src/Common/PlatformLinux.inl
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,31 @@ inline int GetExceptionCode()

#define xr_unlink unlink

typedef bool BOOL;
#include <inttypes.h>
typedef int32_t BOOL;
typedef uint8_t BYTE;
typedef uint16_t WORD;
typedef uint32_t DWORD;
typedef int32_t LONG;
#ifndef _LIBRAW_TYPES_H
typedef int64_t INT64;
typedef uint64_t UINT64;
#endif

typedef char* LPSTR;
typedef char* PSTR;
typedef char* LPTSTR;
typedef const char* LPCSTR;
typedef const char* LPCTSTR;
typedef unsigned char BYTE;
typedef unsigned char* LPBYTE;
typedef unsigned int UINT;
typedef int INT;
typedef long LONG;
typedef unsigned long ULONG;
typedef unsigned long& ULONG_PTR;
typedef long long int LARGE_INTEGER;
typedef unsigned long long int ULARGE_INTEGER;

typedef unsigned short WORD;
typedef unsigned short* LPWORD;
typedef unsigned long DWORD;
typedef unsigned long* LPDWORD;
typedef const void* LPCVOID;
typedef long long int* PLARGE_INTEGER;
Expand Down Expand Up @@ -193,8 +199,6 @@ typedef long _W64;
//typedef void* HWND;
typedef SDL_Window* HWND;
typedef void* HDC;
//typedef void* HGLRC;
typedef SDL_GLContext HGLRC;
typedef float FLOAT;
typedef unsigned char UINT8;

Expand Down
6 changes: 4 additions & 2 deletions src/xrEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ add_dir("${DIRS}")
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/OpenAutomate/inc
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/FreeImage/Dist/x64
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/luabind
/usr/include/SDL2
)

list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./tntQAVI.cpp")
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./editor_environment_manager_properties.cpp")
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./Text_Console.cpp")
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./Text_Console_WndProc.cpp")

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

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

set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME} xrCore luabind xrAPI xrSound xrScriptEngine luajit theora ${OGG_LIBRARIES} xrNetServer xrCDB xrPhysics openal lockfile)
target_link_libraries(${PROJECT_NAME} xrCore luabind xrAPI xrSound xrScriptEngine luajit theora ${OGG_LIBRARIES} xrCDB xrPhysics openal lockfile)
6 changes: 5 additions & 1 deletion src/xrEngine/Device_Initialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ void CRenderDevice::Initialize()
if (!m_sdlWnd)
{
const Uint32 flags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_HIDDEN |
SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_OPENGL;
SDL_WINDOW_RESIZABLE
#if SDL_VERSION_ATLEAST(2,0,5)
| SDL_WINDOW_ALWAYS_ON_TOP
#endif
| SDL_WINDOW_OPENGL;

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

Expand Down
2 changes: 2 additions & 0 deletions src/xrEngine/Device_create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void CRenderDevice::UpdateWindowRects()
m_rcWindowBounds.w += m_rcWindowBounds.x;
m_rcWindowBounds.h += m_rcWindowBounds.y;

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

void CRenderDevice::SelectResolution(const bool windowed)
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/Feel_Touch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using namespace Feel;
Touch::Touch() : pure_relcase(&Touch::feel_touch_relcase) {}
Touch::~Touch() {}
bool Touch::feel_touch_contact(IGameObject* O) { return true; }
void Touch::feel_touch_deny(IGameObject* O, /*DWORD*/ unsigned long T)
void Touch::feel_touch_deny(IGameObject* O, DWORD T)
{
DenyTouch D;
D.O = O;
Expand Down
4 changes: 2 additions & 2 deletions src/xrEngine/XR_IOConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ void CConsole::Show()
}
bVisible = true;

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

ec().clear_states();
scroll_delta = 0;
Expand All @@ -626,7 +626,7 @@ void CConsole::Hide()

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

bVisible = false;
Expand Down
4 changes: 4 additions & 0 deletions src/xrEngine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@

#include "LightAnimLibrary.h"
#include "xrCDB/ISpatial.h"
#if defined(WINDOWS)
#include "Text_Console.h"
#elif defined(LINUX)
#define CTextConsole CConsole
#endif
#include "xrSASH.h"
#include "xr_ioc_cmd.h"

Expand Down

0 comments on commit 054f7e5

Please sign in to comment.