Browse Source

Merge branch 'master' into bshift

bshift
Andrey Akhmichin 1 year ago
parent
commit
e05162e3d7
  1. 14
      cl_dll/MOTD.cpp
  2. 2
      cl_dll/cdll_int.cpp
  3. 6
      cl_dll/cl_dll.h
  4. 2
      cl_dll/in_camera.cpp
  5. 72
      cl_dll/input_goldsource.cpp
  6. 5
      cl_dll/input_mouse.h
  7. 4
      cl_dll/vgui_TeamFortressViewport.cpp
  8. 4
      dlls/cbase.cpp
  9. 2
      dlls/crossbow.cpp
  10. 2
      dlls/exportdef.h
  11. 8
      dlls/extdll.h
  12. 2
      dlls/h_export.cpp
  13. 2
      dlls/talkmonster.cpp
  14. 23
      dlls/util.cpp
  15. 2
      utils/fake_vgui/include/VGUI.h
  16. 4
      utils/fake_vgui/include/VGUI_Dar.h

14
cl_dll/MOTD.cpp

@ -73,7 +73,7 @@ int CHudMOTD::Draw( float fTime )
//bool bScroll; //bool bScroll;
// find the top of where the MOTD should be drawn, so the whole thing is centered in the screen // find the top of where the MOTD should be drawn, so the whole thing is centered in the screen
int ypos = ( ScreenHeight - LINE_HEIGHT * m_iLines ) / 2; // shift it up slightly int ypos = ( ScreenHeight - LINE_HEIGHT * m_iLines ) / 2; // shift it up slightly
char *ch = m_szMOTD; unsigned char *ch = (unsigned char*)m_szMOTD;
int xpos = ( ScreenWidth - gHUD.m_scrinfo.charWidths['M'] * m_iMaxLength ) / 2; int xpos = ( ScreenWidth - gHUD.m_scrinfo.charWidths['M'] * m_iMaxLength ) / 2;
if( xpos < 30 ) if( xpos < 30 )
xpos = 30; xpos = 30;
@ -95,11 +95,13 @@ int CHudMOTD::Draw( float fTime )
gHUD.DrawDarkRectangle( xpos - 5, ypos_r - 5, xmax - xpos + 10, height + 10 ); gHUD.DrawDarkRectangle( xpos - 5, ypos_r - 5, xmax - xpos + 10, height + 10 );
while( *ch ) while( *ch )
{ {
char *next_line; unsigned char *next_line;
int line_length = 0; // count the length of the current line
for( next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ ) for( next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ )
line_length += gHUD.m_scrinfo.charWidths[*next_line]; ;
char *top = next_line; // int line_length = 0; // count the length of the current line
// for( next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ )
// line_length += gHUD.m_scrinfo.charWidths[*next_line];
unsigned char *top = next_line;
if( *top == '\n' ) if( *top == '\n' )
*top = 0; *top = 0;
else else
@ -107,7 +109,7 @@ int CHudMOTD::Draw( float fTime )
// find where to start drawing the line // find where to start drawing the line
if( ( ypos > ROW_RANGE_MIN ) && ( ypos + LINE_HEIGHT <= ypos_r + height ) ) if( ( ypos > ROW_RANGE_MIN ) && ( ypos + LINE_HEIGHT <= ypos_r + height ) )
DrawUtfString( xpos, ypos, xmax, ch, 255, 180, 0 ); DrawUtfString( xpos, ypos, xmax, (const char*)ch, 255, 180, 0 );
ypos += LINE_HEIGHT; ypos += LINE_HEIGHT;

2
cl_dll/cdll_int.cpp

@ -28,7 +28,7 @@
#include "vgui_TeamFortressViewport.h" #include "vgui_TeamFortressViewport.h"
#endif #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 #define USE_FAKE_VGUI !USE_VGUI
#if USE_FAKE_VGUI #if USE_FAKE_VGUI
#include "VGUI_Panel.h" #include "VGUI_Panel.h"

6
cl_dll/cl_dll.h

@ -28,6 +28,7 @@
#pragma once #pragma once
#if !defined(CL_DLL_H) #if !defined(CL_DLL_H)
#define CL_DLL_H #define CL_DLL_H
#include "build.h"
typedef unsigned char byte; typedef unsigned char byte;
typedef unsigned short word; typedef unsigned short word;
typedef float vec_t; typedef float vec_t;
@ -39,7 +40,7 @@ typedef float vec_t;
#include "../engine/cdll_int.h" #include "../engine/cdll_int.h"
#include "../dlls/cdll_dll.h" #include "../dlls/cdll_dll.h"
#if !_WIN32 #if !XASH_WIN32
#define _cdecl #define _cdecl
#endif #endif
#include "exportdef.h" #include "exportdef.h"
@ -49,9 +50,6 @@ typedef float vec_t;
#else #else
#include <math.h> #include <math.h>
#endif #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; extern cl_enginefunc_t gEngfuncs;
#include "../engine/mobility_int.h" #include "../engine/mobility_int.h"

2
cl_dll/in_camera.cpp

@ -15,7 +15,7 @@
#include "camera.h" #include "camera.h"
#include "in_defs.h" #include "in_defs.h"
#if _WIN32 #if XASH_WIN32
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define WIN32_EXTRA_LEAN #define WIN32_EXTRA_LEAN
#define HSPRITE WINDOWS_HSPRITE #define HSPRITE WINDOWS_HSPRITE

72
cl_dll/input_goldsource.cpp

@ -23,7 +23,7 @@
#include "keydefs.h" #include "keydefs.h"
#include "view.h" #include "view.h"
#if !_WIN32 #if !XASH_WIN32
#define USE_SDL2 1 #define USE_SDL2 1
#endif #endif
@ -114,7 +114,7 @@ static SDLFunction sdlFunctions[] = {
}; };
#endif #endif
#if _WIN32 #if XASH_WIN32
#include <process.h> #include <process.h>
#else #else
typedef unsigned int DWORD; typedef unsigned int DWORD;
@ -149,7 +149,7 @@ extern cvar_t *cl_forwardspeed;
extern cvar_t *cl_pitchspeed; extern cvar_t *cl_pitchspeed;
extern cvar_t *cl_movespeedkey; extern cvar_t *cl_movespeedkey;
#if _WIN32 #if XASH_WIN32
static cvar_t* m_rawinput = NULL; static cvar_t* m_rawinput = NULL;
static double s_flRawInputUpdateTime = 0.0f; static double s_flRawInputUpdateTime = 0.0f;
static bool m_bRawInput = false; static bool m_bRawInput = false;
@ -157,7 +157,7 @@ static bool m_bMouseThread = false;
bool isMouseRelative = false; bool isMouseRelative = false;
#endif #endif
#if _WIN32 #if XASH_WIN32
#include "progdefs.h" #include "progdefs.h"
#endif #endif
@ -184,7 +184,7 @@ static cvar_t *m_customaccel_max;
//Mouse move is raised to this power before being scaled by scale factor //Mouse move is raised to this power before being scaled by scale factor
static cvar_t *m_customaccel_exponent; static cvar_t *m_customaccel_exponent;
#if _WIN32 #if XASH_WIN32
// if threaded mouse is enabled then the time to sleep between polls // if threaded mouse is enabled then the time to sleep between polls
static cvar_t *m_mousethread_sleep; static cvar_t *m_mousethread_sleep;
#endif #endif
@ -218,7 +218,7 @@ enum _ControlList
AxisTurn AxisTurn
}; };
#if !USE_SDL2 && _WIN32 #if !USE_SDL2 && XASH_WIN32
DWORD dwAxisFlags[JOY_MAX_AXES] = DWORD dwAxisFlags[JOY_MAX_AXES] =
{ {
JOY_RETURNX, JOY_RETURNX,
@ -234,7 +234,7 @@ DWORD dwAxisMap[ JOY_MAX_AXES ];
DWORD dwControlMap[ JOY_MAX_AXES ]; DWORD dwControlMap[ JOY_MAX_AXES ];
#if USE_SDL2 #if USE_SDL2
int pdwRawValue[ JOY_MAX_AXES ]; int pdwRawValue[ JOY_MAX_AXES ];
#elif _WIN32 #elif XASH_WIN32
PDWORD pdwRawValue[ JOY_MAX_AXES ]; PDWORD pdwRawValue[ JOY_MAX_AXES ];
#endif #endif
DWORD joy_oldbuttonstate, joy_oldpovstate; DWORD joy_oldbuttonstate, joy_oldpovstate;
@ -244,7 +244,7 @@ DWORD joy_numbuttons;
#if USE_SDL2 #if USE_SDL2
SDL_GameController *s_pJoystick = NULL; SDL_GameController *s_pJoystick = NULL;
#elif _WIN32 #elif XASH_WIN32
DWORD joy_flags; DWORD joy_flags;
static JOYINFOEX ji; static JOYINFOEX ji;
#endif #endif
@ -276,7 +276,7 @@ cvar_t *joy_wwhack2;
int joy_avail, joy_advancedinit, joy_haspov; int joy_avail, joy_advancedinit, joy_haspov;
#if _WIN32 #if XASH_WIN32
unsigned int s_hMouseThreadId = 0; unsigned int s_hMouseThreadId = 0;
HANDLE s_hMouseThread = 0; HANDLE s_hMouseThread = 0;
HANDLE s_hMouseQuitEvent = 0; HANDLE s_hMouseQuitEvent = 0;
@ -300,7 +300,7 @@ void Force_CenterView_f (void)
} }
} }
#if _WIN32 #if XASH_WIN32
LONG mouseThreadActive = 0; LONG mouseThreadActive = 0;
LONG mouseThreadCenterX = 0; LONG mouseThreadCenterX = 0;
@ -382,7 +382,7 @@ void IN_SetMouseMode(bool enable)
if(enable) if(enable)
{ {
#if _WIN32 #if XASH_WIN32
if (mouseparmsvalid) if (mouseparmsvalid)
restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0); restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);
@ -402,7 +402,7 @@ void IN_SetMouseMode(bool enable)
} }
else else
{ {
#if _WIN32 #if XASH_WIN32
if(isMouseRelative) if(isMouseRelative)
{ {
#if USE_SDL2 #if USE_SDL2
@ -423,7 +423,7 @@ void IN_SetMouseMode(bool enable)
void IN_SetVisibleMouse(bool visible) void IN_SetVisibleMouse(bool visible)
{ {
#if _WIN32 #if XASH_WIN32
bool lockEntered = MouseThread_ActiveLock_Enter(); bool lockEntered = MouseThread_ActiveLock_Enter();
#endif #endif
@ -431,7 +431,7 @@ void IN_SetVisibleMouse(bool visible)
IN_SetMouseMode(!visible); IN_SetMouseMode(!visible);
#if _WIN32 #if XASH_WIN32
UpdateMouseThreadActive(); UpdateMouseThreadActive();
if(lockEntered) MouseThread_ActiveLock_Exit(); if(lockEntered) MouseThread_ActiveLock_Exit();
#endif #endif
@ -448,7 +448,7 @@ void GoldSourceInput::IN_ActivateMouse (void)
{ {
if (mouseinitialized) if (mouseinitialized)
{ {
#if _WIN32 #if XASH_WIN32
bool lockEntered = MouseThread_ActiveLock_Enter(); bool lockEntered = MouseThread_ActiveLock_Enter();
#endif #endif
@ -456,7 +456,7 @@ void GoldSourceInput::IN_ActivateMouse (void)
mouseactive = 1; mouseactive = 1;
#if _WIN32 #if XASH_WIN32
UpdateMouseThreadActive(); UpdateMouseThreadActive();
if(lockEntered) MouseThread_ActiveLock_Exit(); if(lockEntered) MouseThread_ActiveLock_Exit();
#endif #endif
@ -476,7 +476,7 @@ void GoldSourceInput::IN_DeactivateMouse (void)
{ {
if (mouseinitialized) if (mouseinitialized)
{ {
#if _WIN32 #if XASH_WIN32
bool lockEntered = MouseThread_ActiveLock_Enter(); bool lockEntered = MouseThread_ActiveLock_Enter();
#endif #endif
@ -484,7 +484,7 @@ void GoldSourceInput::IN_DeactivateMouse (void)
mouseactive = 0; mouseactive = 0;
#if _WIN32 #if XASH_WIN32
UpdateMouseThreadActive(); UpdateMouseThreadActive();
if(lockEntered) MouseThread_ActiveLock_Exit(); if(lockEntered) MouseThread_ActiveLock_Exit();
#endif #endif
@ -502,7 +502,7 @@ void GoldSourceInput::IN_StartupMouse (void)
return; return;
mouseinitialized = 1; mouseinitialized = 1;
#if _WIN32 #if XASH_WIN32
mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0); mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0);
if (mouseparmsvalid) if (mouseparmsvalid)
@ -537,7 +537,7 @@ void GoldSourceInput::IN_Shutdown (void)
{ {
IN_DeactivateMouse (); IN_DeactivateMouse ();
#if _WIN32 #if XASH_WIN32
if ( s_hMouseQuitEvent ) if ( s_hMouseQuitEvent )
{ {
SetEvent( s_hMouseQuitEvent ); SetEvent( s_hMouseQuitEvent );
@ -597,7 +597,7 @@ FIXME: Call through to engine?
void IN_ResetMouse( void ) void IN_ResetMouse( void )
{ {
// no work to do in SDL // no work to do in SDL
#if _WIN32 #if XASH_WIN32
// reset only if mouse is active and not in visible mode: // reset only if mouse is active and not in visible mode:
if(mouseactive && !iVisibleMouse && gEngfuncs.GetWindowCenterX && gEngfuncs.GetWindowCenterY) if(mouseactive && !iVisibleMouse && gEngfuncs.GetWindowCenterX && gEngfuncs.GetWindowCenterY)
{ {
@ -712,7 +712,7 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY)
if(active) if(active)
{ {
int deltaX, deltaY; int deltaX, deltaY;
#if _WIN32 #if XASH_WIN32
if ( !m_bRawInput ) if ( !m_bRawInput )
{ {
if ( m_bMouseThread ) if ( m_bMouseThread )
@ -746,7 +746,7 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY)
#endif #endif
} }
#if _WIN32 #if XASH_WIN32
if ( !m_bRawInput ) if ( !m_bRawInput )
{ {
if ( m_bMouseThread ) if ( m_bMouseThread )
@ -771,7 +771,7 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY)
my_accum = 0; my_accum = 0;
// reset mouse position if required, so there is room to move: // reset mouse position if required, so there is room to move:
#if _WIN32 #if XASH_WIN32
// do not reset if mousethread would do it: // do not reset if mousethread would do it:
if ( m_bRawInput || !m_bMouseThread ) if ( m_bRawInput || !m_bMouseThread )
#else #else
@ -779,7 +779,7 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY)
#endif #endif
IN_ResetMouse(); IN_ResetMouse();
#if _WIN32 #if XASH_WIN32
// update m_bRawInput occasionally: // update m_bRawInput occasionally:
const float currentTime = gEngfuncs.GetClientTime(); const float currentTime = gEngfuncs.GetClientTime();
if ( currentTime - s_flRawInputUpdateTime > 1.0f || s_flRawInputUpdateTime == 0.0f ) if ( currentTime - s_flRawInputUpdateTime > 1.0f || s_flRawInputUpdateTime == 0.0f )
@ -929,7 +929,7 @@ void GoldSourceInput::IN_Accumulate (void)
{ {
if (mouseactive) if (mouseactive)
{ {
#if _WIN32 #if XASH_WIN32
if ( !m_bRawInput ) if ( !m_bRawInput )
{ {
if ( !m_bMouseThread ) if ( !m_bMouseThread )
@ -957,7 +957,7 @@ void GoldSourceInput::IN_Accumulate (void)
} }
// force the mouse to the center, so there's room to move // 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: // do not reset if mousethread would do it:
if ( m_bRawInput || !m_bMouseThread ) if ( m_bRawInput || !m_bMouseThread )
#else #else
@ -1030,7 +1030,7 @@ void IN_StartupJoystick (void)
{ {
gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n"); gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n");
} }
#elif _WIN32 #elif XASH_WIN32
int numdevs; int numdevs;
JOYCAPS jc; JOYCAPS jc;
MMRESULT mmr; MMRESULT mmr;
@ -1102,7 +1102,7 @@ int RawValuePointer (int axis)
} }
} }
#elif _WIN32 #elif XASH_WIN32
PDWORD RawValuePointer (int axis) PDWORD RawValuePointer (int axis)
{ {
switch (axis) switch (axis)
@ -1185,7 +1185,7 @@ void Joy_AdvancedUpdate_f (void)
dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS; dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS;
} }
#if !USE_SDL2 && _WIN32 #if !USE_SDL2 && XASH_WIN32
// compute the axes to collect from DirectInput // compute the axes to collect from DirectInput
joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV; joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV;
for (i = 0; i < JOY_MAX_AXES; i++) for (i = 0; i < JOY_MAX_AXES; i++)
@ -1231,7 +1231,7 @@ void GoldSourceInput::IN_Commands (void)
{ {
pdwRawValue[i] = RawValuePointer(i); pdwRawValue[i] = RawValuePointer(i);
} }
#elif _WIN32 #elif XASH_WIN32
buttonstate = ji.dwButtons; buttonstate = ji.dwButtons;
#endif #endif
@ -1257,7 +1257,7 @@ void GoldSourceInput::IN_Commands (void)
// this avoids any potential problems related to moving from one // this avoids any potential problems related to moving from one
// direction to another without going through the center position // direction to another without going through the center position
povstate = 0; povstate = 0;
#if !USE_SDL2 && _WIN32 #if !USE_SDL2 && XASH_WIN32
if(ji.dwPOV != JOY_POVCENTERED) if(ji.dwPOV != JOY_POVCENTERED)
{ {
if (ji.dwPOV == JOY_POVFORWARD) if (ji.dwPOV == JOY_POVFORWARD)
@ -1298,7 +1298,7 @@ int IN_ReadJoystick (void)
#if USE_SDL2 #if USE_SDL2
safe_pfnSDL_JoystickUpdate(); safe_pfnSDL_JoystickUpdate();
return 1; return 1;
#elif _WIN32 #elif XASH_WIN32
memset (&ji, 0, sizeof(ji)); memset (&ji, 0, sizeof(ji));
ji.dwSize = sizeof(ji); ji.dwSize = sizeof(ji);
ji.dwFlags = joy_flags; ji.dwFlags = joy_flags;
@ -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 // get the floating point zero-centered, potentially-inverted data for the current axis
#if USE_SDL2 #if USE_SDL2
fAxisValue = (float)pdwRawValue[i]; fAxisValue = (float)pdwRawValue[i];
#elif _WIN32 #elif XASH_WIN32
fAxisValue = (float) *pdwRawValue[i]; fAxisValue = (float) *pdwRawValue[i];
fAxisValue -= 32768.0; fAxisValue -= 32768.0;
#endif #endif
@ -1571,7 +1571,7 @@ void GoldSourceInput::IN_Init (void)
m_customaccel_max = gEngfuncs.pfnRegisterVariable ( "m_customaccel_max", "0", FCVAR_ARCHIVE ); m_customaccel_max = gEngfuncs.pfnRegisterVariable ( "m_customaccel_max", "0", FCVAR_ARCHIVE );
m_customaccel_exponent = gEngfuncs.pfnRegisterVariable ( "m_customaccel_exponent", "1", 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_rawinput = gEngfuncs.pfnGetCvarPointer("m_rawinput");
m_bRawInput = m_rawinput && m_rawinput->value != 0; m_bRawInput = m_rawinput && m_rawinput->value != 0;
m_bMouseThread = gEngfuncs.CheckParm ("-mousethread", NULL ) != NULL; m_bMouseThread = gEngfuncs.CheckParm ("-mousethread", NULL ) != NULL;
@ -1603,7 +1603,7 @@ void GoldSourceInput::IN_Init (void)
#endif #endif
#if USE_SDL2 #if USE_SDL2
#if __APPLE__ #if XASH_APPLE
#define SDL2_FULL_LIBNAME "libsdl2-2.0.0.dylib" #define SDL2_FULL_LIBNAME "libsdl2-2.0.0.dylib"
#else #else
#define SDL2_FULL_LIBNAME "libSDL2-2.0.so.0" #define SDL2_FULL_LIBNAME "libSDL2-2.0.so.0"

5
cl_dll/input_mouse.h

@ -1,7 +1,4 @@
#pragma once #pragma once
#include "build.h"
#if !defined(INPUT_MOUSE_H) #if !defined(INPUT_MOUSE_H)
#define INPUT_MOUSE_H #define INPUT_MOUSE_H
#include "cl_dll.h" #include "cl_dll.h"
@ -51,7 +48,7 @@ protected:
#if GOLDSOURCE_SUPPORT && ( XASH_WIN32 || ( XASH_LINUX && !XASH_ANDROID ) || XASH_APPLE ) && XASH_X86 #if GOLDSOURCE_SUPPORT && ( XASH_WIN32 || ( XASH_LINUX && !XASH_ANDROID ) || XASH_APPLE ) && XASH_X86
#define SUPPORT_GOLDSOURCE_INPUT 1 #define SUPPORT_GOLDSOURCE_INPUT 1
#if _WIN32 #if XASH_WIN32
#define HSPRITE WINDOWS_HSPRITE #define HSPRITE WINDOWS_HSPRITE
#include <windows.h> #include <windows.h>
#undef HSPRITE #undef HSPRITE

4
cl_dll/vgui_TeamFortressViewport.cpp

@ -673,7 +673,7 @@ int TeamFortressViewport::CreateCommandMenu( const char *menuFile, int direction
return newIndex; return newIndex;
} }
#ifdef _WIN32 #if XASH_WIN32
try try
{ {
#endif #endif
@ -873,7 +873,7 @@ int TeamFortressViewport::CreateCommandMenu( const char *menuFile, int direction
pfile = gEngfuncs.COM_ParseFile( pfile, token ); pfile = gEngfuncs.COM_ParseFile( pfile, token );
} }
#ifdef _WIN32 #if XASH_WIN32
} }
catch( CException *e ) catch( CException *e )
{ {

4
dlls/cbase.cpp

@ -98,7 +98,7 @@ static DLL_FUNCTIONS gFunctionTable =
static void SetObjectCollisionBox( entvars_t *pev ); static void SetObjectCollisionBox( entvars_t *pev );
#if !_WIN32 #if !XASH_WIN32
extern "C" { extern "C" {
#endif #endif
int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ) int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion )
@ -125,7 +125,7 @@ int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion )
return TRUE; return TRUE;
} }
#if !_WIN32 #if !XASH_WIN32
} }
#endif #endif

2
dlls/crossbow.cpp

@ -324,7 +324,7 @@ void CCrossbow::Holster( int skiplocal /* = 0 */ )
{ {
m_fInReload = FALSE;// cancel any reload in progress. m_fInReload = FALSE;// cancel any reload in progress.
if( m_fInZoom ) if( m_pPlayer->pev->fov != 0 )
{ {
SecondaryAttack(); SecondaryAttack();
} }

2
dlls/exportdef.h

@ -1,7 +1,7 @@
#pragma once #pragma once
#if !defined(EXPORTDEF_H) #if !defined(EXPORTDEF_H)
#define EXPORTDEF_H #define EXPORTDEF_H
#if _WIN32 || __CYGWIN__ #if XASH_WIN32 || __CYGWIN__
#if __GNUC__ #if __GNUC__
#define EXPORT __attribute__ ((dllexport)) #define EXPORT __attribute__ ((dllexport))
#else #else

8
dlls/extdll.h

@ -15,7 +15,7 @@
#pragma once #pragma once
#if !defined(EXTDLL_H) #if !defined(EXTDLL_H)
#define EXTDLL_H #define EXTDLL_H
#include "build.h"
// //
// Global header file for extension DLLs // Global header file for extension DLLs
// //
@ -35,7 +35,7 @@
#endif #endif
// Prevent tons of unused windows definitions // Prevent tons of unused windows definitions
#if _WIN32 #if XASH_WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define NOWINRES #define NOWINRES
#define NOSERVICE #define NOSERVICE
@ -76,10 +76,6 @@ typedef int BOOL;
#define M_PI_F (float)M_PI #define M_PI_F (float)M_PI
#endif #endif
#if __LP64__ || __LLP64__ || _WIN64 || (__x86_64__ && !__ILP32__) || _M_X64 || __ia64 || _M_IA64 || __aarch64__ || __powerpc64__
#define XASH_64BIT 1
#endif
// Header file containing definition of globalvars_t and entvars_t // Header file containing definition of globalvars_t and entvars_t
typedef unsigned int func_t; typedef unsigned int func_t;
typedef int string_t; // from engine's pr_comp.h; typedef int string_t; // from engine's pr_comp.h;

2
dlls/h_export.cpp

@ -29,7 +29,7 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
#if _WIN32 #if XASH_WIN32
// Required DLL entry point // Required DLL entry point
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )

2
dlls/talkmonster.cpp

@ -791,7 +791,7 @@ CBaseEntity *CTalkMonster::FindNearestFriend( BOOL fPlayer )
// for each friend in this bsp... // for each friend in this bsp...
while( ( pFriend = UTIL_FindEntityByClassname( pFriend, pszFriend ) ) ) while( ( pFriend = UTIL_FindEntityByClassname( pFriend, pszFriend ) ) )
{ {
if( pFriend == this || !pFriend->IsAlive() ) if( pFriend == this || !pFriend->IsAlive() || pFriend->pev->deadflag != DEAD_NO )
// don't talk to self or dead people // don't talk to self or dead people
continue; continue;

23
dlls/util.cpp

@ -1729,26 +1729,11 @@ void CSaveRestoreBuffer::BufferRewind( int size )
m_pdata->size -= size; m_pdata->size -= size;
} }
#if !_WIN32 && !__WATCOMC__ #if !XASH_WIN32 && !__WATCOMC__
extern "C" { static unsigned _rotr( unsigned val, int shift )
unsigned _rotr( unsigned val, int shift )
{ {
unsigned lobit; /* non-zero means lo bit set */ // Any modern compiler will generate one single ror instruction for x86, arm and mips here.
unsigned num = val; /* number to rotate */ return ( val >> shift ) | ( val << ( 32 - shift ));
shift &= 0x1f; /* modulo 32 -- this will also make
negative shifts work */
while( shift-- )
{
lobit = num & 1; /* get high bit */
num >>= 1; /* shift right one bit */
if( lobit )
num |= 0x80000000; /* set hi bit if lo bit was set */
}
return num;
}
} }
#endif #endif

2
utils/fake_vgui/include/VGUI.h

@ -77,7 +77,7 @@
// then App can come along later and fire all the signals // then App can come along later and fire all the signals
//TODO: Change all method naming to starting with a capital letter. //TODO: Change all method naming to starting with a capital letter.
#ifdef _WIN32 #if XASH_WIN32
# define VGUIAPI __declspec( dllexport ) # define VGUIAPI __declspec( dllexport )
#else #else
# define VGUIAPI __attribute__ ((visibility("default"))) # define VGUIAPI __attribute__ ((visibility("default")))

4
utils/fake_vgui/include/VGUI_Dar.h

@ -166,7 +166,7 @@ protected:
ELEMTYPE* _data; ELEMTYPE* _data;
}; };
#ifdef _WIN32 #if XASH_WIN32
//forward referencing all the template types used so they get exported //forward referencing all the template types used so they get exported
template class VGUIAPI Dar<char>; template class VGUIAPI Dar<char>;
template class VGUIAPI Dar<char*>; template class VGUIAPI Dar<char*>;
@ -191,4 +191,4 @@ template class VGUIAPI Dar<class RepaintSignal*>;
} }
#endif #endif

Loading…
Cancel
Save