Skip to content

Commit

Permalink
Use definitions from build.h everywhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
nekonomicon committed Oct 31, 2023
1 parent 3cf40cc commit 984986f
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 58 deletions.
2 changes: 1 addition & 1 deletion cl_dll/cdll_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "vgui_TeamFortressViewport.h"
#endif

#if GOLDSOURCE_SUPPORT && (_WIN32 || __linux__ || __APPLE__) && (__i386 || _M_IX86)
#if GOLDSOURCE_SUPPORT && (XASH_WIN32 || XASH_LINUX || XASH_APPLE) && XASH_X86
#define USE_FAKE_VGUI !USE_VGUI
#if USE_FAKE_VGUI
#include "VGUI_Panel.h"
Expand Down
5 changes: 1 addition & 4 deletions cl_dll/cl_dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ typedef float vec_t;
#include "../engine/cdll_int.h"
#include "../dlls/cdll_dll.h"

#if !_WIN32
#if !XASH_WIN32
#define _cdecl
#endif
#include "exportdef.h"
Expand All @@ -49,9 +49,6 @@ typedef float vec_t;
#else
#include <math.h>
#endif
#if __LP64__ || __LLP64__ || _WIN64 || (__x86_64__ && !__ILP32__) || _M_X64 || __ia64 || _M_IA64 || __aarch64__ || __powerpc64__
#define XASH_64BIT 1
#endif

extern cl_enginefunc_t gEngfuncs;
#include "../engine/mobility_int.h"
Expand Down
2 changes: 1 addition & 1 deletion cl_dll/in_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "camera.h"
#include "in_defs.h"

#if _WIN32
#if XASH_WIN32
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define WIN32_EXTRA_LEAN
#define HSPRITE WINDOWS_HSPRITE
Expand Down
72 changes: 36 additions & 36 deletions cl_dll/input_goldsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "keydefs.h"
#include "view.h"

#if !_WIN32
#if !XASH_WIN32
#define USE_SDL2 1
#endif

Expand Down Expand Up @@ -114,7 +114,7 @@ static SDLFunction sdlFunctions[] = {
};
#endif

#if _WIN32
#if XASH_WIN32
#include <process.h>
#else
typedef unsigned int DWORD;
Expand Down Expand Up @@ -149,15 +149,15 @@ extern cvar_t *cl_forwardspeed;
extern cvar_t *cl_pitchspeed;
extern cvar_t *cl_movespeedkey;

#if _WIN32
#if XASH_WIN32
static cvar_t* m_rawinput = NULL;
static double s_flRawInputUpdateTime = 0.0f;
static bool m_bRawInput = false;
static bool m_bMouseThread = false;
bool isMouseRelative = false;
#endif

#if _WIN32
#if XASH_WIN32
#include "progdefs.h"
#endif

Expand All @@ -184,7 +184,7 @@ static cvar_t *m_customaccel_max;
//Mouse move is raised to this power before being scaled by scale factor
static cvar_t *m_customaccel_exponent;

#if _WIN32
#if XASH_WIN32
// if threaded mouse is enabled then the time to sleep between polls
static cvar_t *m_mousethread_sleep;
#endif
Expand Down Expand Up @@ -218,7 +218,7 @@ enum _ControlList
AxisTurn
};

#if !USE_SDL2 && _WIN32
#if !USE_SDL2 && XASH_WIN32
DWORD dwAxisFlags[JOY_MAX_AXES] =
{
JOY_RETURNX,
Expand All @@ -234,7 +234,7 @@ DWORD dwAxisMap[ JOY_MAX_AXES ];
DWORD dwControlMap[ JOY_MAX_AXES ];
#if USE_SDL2
int pdwRawValue[ JOY_MAX_AXES ];
#elif _WIN32
#elif XASH_WIN32
PDWORD pdwRawValue[ JOY_MAX_AXES ];
#endif
DWORD joy_oldbuttonstate, joy_oldpovstate;
Expand All @@ -244,7 +244,7 @@ DWORD joy_numbuttons;

#if USE_SDL2
SDL_GameController *s_pJoystick = NULL;
#elif _WIN32
#elif XASH_WIN32
DWORD joy_flags;
static JOYINFOEX ji;
#endif
Expand Down Expand Up @@ -276,7 +276,7 @@ cvar_t *joy_wwhack2;

int joy_avail, joy_advancedinit, joy_haspov;

#if _WIN32
#if XASH_WIN32
unsigned int s_hMouseThreadId = 0;
HANDLE s_hMouseThread = 0;
HANDLE s_hMouseQuitEvent = 0;
Expand All @@ -300,7 +300,7 @@ void Force_CenterView_f (void)
}
}

#if _WIN32
#if XASH_WIN32

LONG mouseThreadActive = 0;
LONG mouseThreadCenterX = 0;
Expand Down Expand Up @@ -382,7 +382,7 @@ void IN_SetMouseMode(bool enable)

if(enable)
{
#if _WIN32
#if XASH_WIN32
if (mouseparmsvalid)
restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);

Expand All @@ -402,7 +402,7 @@ void IN_SetMouseMode(bool enable)
}
else
{
#if _WIN32
#if XASH_WIN32
if(isMouseRelative)
{
#if USE_SDL2
Expand All @@ -423,15 +423,15 @@ void IN_SetMouseMode(bool enable)

void IN_SetVisibleMouse(bool visible)
{
#if _WIN32
#if XASH_WIN32
bool lockEntered = MouseThread_ActiveLock_Enter();
#endif

iVisibleMouse = visible;

IN_SetMouseMode(!visible);

#if _WIN32
#if XASH_WIN32
UpdateMouseThreadActive();
if(lockEntered) MouseThread_ActiveLock_Exit();
#endif
Expand All @@ -448,15 +448,15 @@ void GoldSourceInput::IN_ActivateMouse (void)
{
if (mouseinitialized)
{
#if _WIN32
#if XASH_WIN32
bool lockEntered = MouseThread_ActiveLock_Enter();
#endif

IN_SetMouseMode(true);

mouseactive = 1;

#if _WIN32
#if XASH_WIN32
UpdateMouseThreadActive();
if(lockEntered) MouseThread_ActiveLock_Exit();
#endif
Expand All @@ -476,15 +476,15 @@ void GoldSourceInput::IN_DeactivateMouse (void)
{
if (mouseinitialized)
{
#if _WIN32
#if XASH_WIN32
bool lockEntered = MouseThread_ActiveLock_Enter();
#endif

IN_SetMouseMode(false);

mouseactive = 0;

#if _WIN32
#if XASH_WIN32
UpdateMouseThreadActive();
if(lockEntered) MouseThread_ActiveLock_Exit();
#endif
Expand All @@ -502,7 +502,7 @@ void GoldSourceInput::IN_StartupMouse (void)
return;

mouseinitialized = 1;
#if _WIN32
#if XASH_WIN32
mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0);

if (mouseparmsvalid)
Expand Down Expand Up @@ -537,7 +537,7 @@ void GoldSourceInput::IN_Shutdown (void)
{
IN_DeactivateMouse ();

#if _WIN32
#if XASH_WIN32
if ( s_hMouseQuitEvent )
{
SetEvent( s_hMouseQuitEvent );
Expand Down Expand Up @@ -597,7 +597,7 @@ FIXME: Call through to engine?
void IN_ResetMouse( void )
{
// no work to do in SDL
#if _WIN32
#if XASH_WIN32
// reset only if mouse is active and not in visible mode:
if(mouseactive && !iVisibleMouse && gEngfuncs.GetWindowCenterX && gEngfuncs.GetWindowCenterY)
{
Expand Down Expand Up @@ -712,7 +712,7 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY)
if(active)
{
int deltaX, deltaY;
#if _WIN32
#if XASH_WIN32
if ( !m_bRawInput )
{
if ( m_bMouseThread )
Expand Down Expand Up @@ -746,7 +746,7 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY)
#endif
}

#if _WIN32
#if XASH_WIN32
if ( !m_bRawInput )
{
if ( m_bMouseThread )
Expand All @@ -771,15 +771,15 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY)
my_accum = 0;

// reset mouse position if required, so there is room to move:
#if _WIN32
#if XASH_WIN32
// do not reset if mousethread would do it:
if ( m_bRawInput || !m_bMouseThread )
#else
if(true)
#endif
IN_ResetMouse();

#if _WIN32
#if XASH_WIN32
// update m_bRawInput occasionally:
const float currentTime = gEngfuncs.GetClientTime();
if ( currentTime - s_flRawInputUpdateTime > 1.0f || s_flRawInputUpdateTime == 0.0f )
Expand Down Expand Up @@ -929,7 +929,7 @@ void GoldSourceInput::IN_Accumulate (void)
{
if (mouseactive)
{
#if _WIN32
#if XASH_WIN32
if ( !m_bRawInput )
{
if ( !m_bMouseThread )
Expand Down Expand Up @@ -957,7 +957,7 @@ void GoldSourceInput::IN_Accumulate (void)
}

// force the mouse to the center, so there's room to move
#if _WIN32
#if XASH_WIN32
// do not reset if mousethread would do it:
if ( m_bRawInput || !m_bMouseThread )
#else
Expand Down Expand Up @@ -1030,7 +1030,7 @@ void IN_StartupJoystick (void)
{
gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n");
}
#elif _WIN32
#elif XASH_WIN32
int numdevs;
JOYCAPS jc;
MMRESULT mmr;
Expand Down Expand Up @@ -1102,7 +1102,7 @@ int RawValuePointer (int axis)

}
}
#elif _WIN32
#elif XASH_WIN32
PDWORD RawValuePointer (int axis)
{
switch (axis)
Expand Down Expand Up @@ -1185,7 +1185,7 @@ void Joy_AdvancedUpdate_f (void)
dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS;
}

#if !USE_SDL2 && _WIN32
#if !USE_SDL2 && XASH_WIN32
// compute the axes to collect from DirectInput
joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV;
for (i = 0; i < JOY_MAX_AXES; i++)
Expand Down Expand Up @@ -1231,7 +1231,7 @@ void GoldSourceInput::IN_Commands (void)
{
pdwRawValue[i] = RawValuePointer(i);
}
#elif _WIN32
#elif XASH_WIN32
buttonstate = ji.dwButtons;
#endif

Expand All @@ -1257,7 +1257,7 @@ void GoldSourceInput::IN_Commands (void)
// this avoids any potential problems related to moving from one
// direction to another without going through the center position
povstate = 0;
#if !USE_SDL2 && _WIN32
#if !USE_SDL2 && XASH_WIN32
if(ji.dwPOV != JOY_POVCENTERED)
{
if (ji.dwPOV == JOY_POVFORWARD)
Expand Down Expand Up @@ -1298,7 +1298,7 @@ int IN_ReadJoystick (void)
#if USE_SDL2
safe_pfnSDL_JoystickUpdate();
return 1;
#elif _WIN32
#elif XASH_WIN32
memset (&ji, 0, sizeof(ji));
ji.dwSize = sizeof(ji);
ji.dwFlags = joy_flags;
Expand Down Expand Up @@ -1377,7 +1377,7 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
// get the floating point zero-centered, potentially-inverted data for the current axis
#if USE_SDL2
fAxisValue = (float)pdwRawValue[i];
#elif _WIN32
#elif XASH_WIN32
fAxisValue = (float) *pdwRawValue[i];
fAxisValue -= 32768.0;
#endif
Expand Down Expand Up @@ -1571,7 +1571,7 @@ void GoldSourceInput::IN_Init (void)
m_customaccel_max = gEngfuncs.pfnRegisterVariable ( "m_customaccel_max", "0", FCVAR_ARCHIVE );
m_customaccel_exponent = gEngfuncs.pfnRegisterVariable ( "m_customaccel_exponent", "1", FCVAR_ARCHIVE );

#if _WIN32
#if XASH_WIN32
m_rawinput = gEngfuncs.pfnGetCvarPointer("m_rawinput");
m_bRawInput = m_rawinput && m_rawinput->value != 0;
m_bMouseThread = gEngfuncs.CheckParm ("-mousethread", NULL ) != NULL;
Expand Down Expand Up @@ -1603,7 +1603,7 @@ void GoldSourceInput::IN_Init (void)
#endif

#if USE_SDL2
#if __APPLE__
#if XASH_APPLE
#define SDL2_FULL_LIBNAME "libsdl2-2.0.0.dylib"
#else
#define SDL2_FULL_LIBNAME "libSDL2-2.0.so.0"
Expand Down
2 changes: 1 addition & 1 deletion cl_dll/input_mouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class FWGSInput : public AbstractInput
#if GOLDSOURCE_SUPPORT && ( XASH_WIN32 || ( XASH_LINUX && !XASH_ANDROID ) || XASH_APPLE ) && XASH_X86
#define SUPPORT_GOLDSOURCE_INPUT 1

#if _WIN32
#if XASH_WIN32
#define HSPRITE WINDOWS_HSPRITE
#include <windows.h>
#undef HSPRITE
Expand Down
4 changes: 2 additions & 2 deletions cl_dll/vgui_TeamFortressViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ int TeamFortressViewport::CreateCommandMenu( const char *menuFile, int direction
return newIndex;
}

#ifdef _WIN32
#if XASH_WIN32
try
{
#endif
Expand Down Expand Up @@ -873,7 +873,7 @@ int TeamFortressViewport::CreateCommandMenu( const char *menuFile, int direction

pfile = gEngfuncs.COM_ParseFile( pfile, token );
}
#ifdef _WIN32
#if XASH_WIN32
}
catch( CException *e )
{
Expand Down
Loading

0 comments on commit 984986f

Please sign in to comment.