Fix Goldsource build (#176)

This commit is contained in:
Roman Chistokhodov 2021-06-08 00:05:47 +03:00 committed by GitHub
parent 0557b2dfe3
commit 3f6ab0b2fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 27 deletions

View File

@ -7,21 +7,39 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
compiler: [gcc, clang]
include:
- compiler: gcc
cpp-compiler: g++
- compiler: clang
cpp-compiler: clang++
- os: ubuntu-latest
cc: gcc
cxx: g++
- os: ubuntu-latest
cc: clang
cxx: clang++
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.cpp-compiler }}
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get SDL2 headers
uses: actions/checkout@v2
with:
repository: libsdl-org/SDL
ref: release-2.0.9
path: SDL2
- name: Link SDL2 headers into system path
run: |
sudo ln -s "$GITHUB_WORKSPACE/SDL2/include" /usr/local/include/SDL2
- name: Install dependencies
run: sudo apt-get -y install gcc-multilib g++-multilib libgl1-mesa-dev
- name: Build client and server on ${{ matrix.os }} with ${{ matrix.compiler }}
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get -y install gcc-multilib g++-multilib
- name: Build with xash3d-fwgs input
run: |
cmake -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" && cmake --build build --target all
- name: Build with goldsource input
run: |
cmake -B build-gs -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DGOLDSOURCE_SUPPORT=ON && cmake --build build-gs --target all

View File

@ -183,7 +183,7 @@ int *HUD_GetRect( void )
return extent;
}
#if USE_VGUI_FOR_GOLDSOURCE_SUPPORT
#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
class TeamFortressViewport : public vgui::Panel
{
public:
@ -238,7 +238,7 @@ so the HUD can reinitialize itself.
int DLLEXPORT HUD_VidInit( void )
{
gHUD.VidInit();
#if USE_VGUI_FOR_GOLDSOURCE_SUPPORT
#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
vgui::Panel* root=(vgui::Panel*)gEngfuncs.VGui_GetPanel();
if (root) {
gEngfuncs.Con_Printf( "Root VGUI panel exists\n" );
@ -337,7 +337,7 @@ Called by engine every frame that client .dll is loaded
void DLLEXPORT HUD_Frame( double time )
{
#if USE_VGUI_FOR_GOLDSOURCE_SUPPORT
#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
if (!gViewPort)
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
#else

View File

@ -10,7 +10,7 @@
#include "input_mouse.h"
#if SUPPORT_GOLDSOURCE_INPUT
#ifdef SUPPORT_GOLDSOURCE_INPUT
#include "hud.h"
#include "cl_util.h"
@ -27,7 +27,7 @@
#define USE_SDL2
#endif
#if USE_SDL2
#ifdef USE_SDL2
#define ARRAYSIZE(p) ( sizeof(p) /sizeof(p[0]) )
#include <dlfcn.h>
#include <SDL2/SDL_mouse.h>
@ -242,7 +242,7 @@ DWORD joy_oldbuttonstate, joy_oldpovstate;
int joy_id;
DWORD joy_numbuttons;
#if USE_SDL2
#ifdef USE_SDL2
SDL_GameController *s_pJoystick = NULL;
#elif defined(_WIN32)
DWORD joy_flags;
@ -566,7 +566,7 @@ void GoldSourceInput::IN_Shutdown (void)
}
#endif
#if USE_SDL2
#ifdef USE_SDL2
for (int j=0; j<ARRAYSIZE(sdlFunctions); ++j) {
*(sdlFunctions[j].ppfnFunc) = NULL;
}
@ -735,7 +735,7 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY)
else
#endif
{
#if USE_SDL2
#ifdef USE_SDL2
safe_pfnSDL_GetRelativeMouseState( &deltaX, &deltaY );
current_pos.x = deltaX;
current_pos.y = deltaY;
@ -942,7 +942,7 @@ void GoldSourceInput::IN_Accumulate (void)
else
#endif
{
#if USE_SDL2
#ifdef USE_SDL2
int deltaX, deltaY;
safe_pfnSDL_GetRelativeMouseState( &deltaX, &deltaY );
mx_accum += deltaX;
@ -997,7 +997,7 @@ void IN_StartupJoystick (void)
// assume no joystick
joy_avail = 0;
#if USE_SDL2
#ifdef USE_SDL2
int nJoysticks = safe_pfnSDL_NumJoysticks();
if ( nJoysticks > 0 )
{
@ -1084,7 +1084,7 @@ void IN_StartupJoystick (void)
#endif
}
#if USE_SDL2
#ifdef USE_SDL2
int RawValuePointer (int axis)
{
switch (axis)
@ -1216,7 +1216,7 @@ void GoldSourceInput::IN_Commands (void)
// loop through the joystick buttons
// key a joystick event or auxillary event for higher number buttons for each state change
#if USE_SDL2
#ifdef USE_SDL2
buttonstate = 0;
for ( i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++ )
{
@ -1294,7 +1294,7 @@ IN_ReadJoystick
*/
int IN_ReadJoystick (void)
{
#if USE_SDL2
#ifdef USE_SDL2
safe_pfnSDL_JoystickUpdate();
return 1;
#elif defined(_WIN32)
@ -1374,7 +1374,7 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
for (i = 0; i < JOY_MAX_AXES; i++)
{
// get the floating point zero-centered, potentially-inverted data for the current axis
#if USE_SDL2
#ifdef USE_SDL2
fAxisValue = (float)pdwRawValue[i];
#elif defined(_WIN32)
fAxisValue = (float) *pdwRawValue[i];
@ -1600,7 +1600,7 @@ void GoldSourceInput::IN_Init (void)
}
#endif
#if USE_SDL2
#ifdef USE_SDL2
#if __APPLE__
#define SDL2_FULL_LIBNAME "libsdl2-2.0.0.dylib"
#else

View File

@ -10,7 +10,7 @@ cvar_t *in_joystick;
FWGSInput fwgsInput;
#if SUPPORT_GOLDSOURCE_INPUT
#ifdef SUPPORT_GOLDSOURCE_INPUT
GoldSourceInput goldSourceInput;
AbstractInput* currentInput = &goldSourceInput;
#else
@ -68,7 +68,7 @@ void IN_Shutdown( void )
void IN_Init( void )
{
#if SUPPORT_GOLDSOURCE_INPUT
#ifdef SUPPORT_GOLDSOURCE_INPUT
if (IsXashFWGS()) {
gEngfuncs.Con_Printf( "FWGS Xash3D input is in use\n" );
currentInput = &fwgsInput;