diff --git a/.gitignore b/.gitignore index a0bc5604..adcc4f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ cmake_install.cmake *.vsxproj *.vsproj *.sln +.waf-* +.lock* +*.pyc diff --git a/CMakeLists.txt b/CMakeLists.txt index 64c48928..80c2c5d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,6 @@ project (HLSDK-XASH3D) #-------------- # USER DEFINES \ ################\ -option(64BIT "Allow 64 Bit builds" OFF) option(USE_VGUI "Enable VGUI1. UNDONE" OFF) option(USE_VGUI2 "Enable VGUI2. UNDONE" OFF) option(USE_VOICEMGR "Enable VOICE MANAGER." OFF) @@ -55,8 +54,8 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT 64BIT) if(MSVC) error("UNDONE: set 32 build flags") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32") endif() set(CMAKE_SIZEOF_VOID_P 4) diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..60f4aad3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,39 @@ +Half Life 1 SDK LICENSE +====================== + +Half Life 1 SDK Copyright(c) Valve Corp. + +THIS DOCUMENT DESCRIBES A CONTRACT BETWEEN YOU AND VALVE CORPORATION ("Valve"). +PLEASE READ IT BEFORE DOWNLOADING OR USING THE HALF LIFE 1 SDK ("SDK"). BY +DOWNLOADING AND/OR USING THE HALF LIFE 1 SDK YOU ACCEPT THIS LICENSE. IF YOU DO +NOT AGREE TO THE TERMS OF THIS LICENSE PLEASE DON'T DOWNLOAD OR USE THE SDK. + +You may, free of charge, download and use the SDK to develop a modified Valve +game running on the Half-Life 1 engine. You may distribute your modified Valve +game in source and object code form, but only for free. Terms of use for Valve +games are found in the Steam Subscriber Agreement located here: +http://store.steampowered.com/subscriber_agreement/ + +You may copy, modify, and distribute the SDK and any modifications you make to +the SDK in source and object code form, but only for free. Any distribution of +this SDK must include this LICENSE file. + +Any distribution of the SDK or a substantial portion of the SDK must include +the above copyright notice and the following: + + DISCLAIMER OF WARRANTIES. THE HALF LIFE 1 SDK AND ANY OTHER MATERIAL + DOWNLOADED BY LICENSEE IS PROVIDED "AS IS". VALVE AND ITS SUPPLIERS + DISCLAIM ALL WARRANTIES WITH RESPECT TO THE SDK, EITHER EXPRESS OR IMPLIED, + INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, + NON-INFRINGEMENT, TITLE AND FITNESS FOR A PARTICULAR PURPOSE. + + LIMITATION OF LIABILITY. IN NO EVENT SHALL VALVE OR ITS SUPPLIERS BE LIABLE + FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER + (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, + BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY + LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE ENGINE AND/OR THE + SDK, EVEN IF VALVE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + +If you would like to use the SDK for a commercial purpose, please contact Valve +at sourceengine@valvesoftware.com. diff --git a/cl_dll/MOTD.cpp b/cl_dll/MOTD.cpp index 179ae4a8..439fb9c4 100644 --- a/cl_dll/MOTD.cpp +++ b/cl_dll/MOTD.cpp @@ -56,7 +56,7 @@ void CHudMOTD::Reset( void ) m_bShow = 0; } -#define LINE_HEIGHT 13 +#define LINE_HEIGHT (gHUD.m_scrinfo.iCharHeight) #define ROW_GAP 13 #define ROW_RANGE_MIN 30 #define ROW_RANGE_MAX ( ScreenHeight - 100 ) diff --git a/cl_dll/cdll_int.cpp b/cl_dll/cdll_int.cpp index dc9199ba..45bbcd67 100644 --- a/cl_dll/cdll_int.cpp +++ b/cl_dll/cdll_int.cpp @@ -212,7 +212,9 @@ void TeamFortressViewport::paintBackground() // int wide, tall; // getParent()->getSize( wide, tall ); // setSize( wide, tall ); - gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect()); + int extents[4]; + getParent()->getAbsExtents(extents[0],extents[1],extents[2],extents[3]); + gEngfuncs.VGui_ViewportPaintBackground(extents); } void *TeamFortressViewport::operator new( size_t stAllocateBlock ) diff --git a/cl_dll/cl_dll.h b/cl_dll/cl_dll.h index 6e1c4e69..6ba3db67 100644 --- a/cl_dll/cl_dll.h +++ b/cl_dll/cl_dll.h @@ -38,7 +38,7 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf ); #include "../engine/cdll_int.h" #include "../dlls/cdll_dll.h" -#ifndef __MSC_VER +#if !defined(_WIN32) #define _cdecl #endif #include "exportdef.h" diff --git a/cl_dll/com_weapons.cpp b/cl_dll/com_weapons.cpp index 5621149b..198c533a 100644 --- a/cl_dll/com_weapons.cpp +++ b/cl_dll/com_weapons.cpp @@ -116,7 +116,7 @@ void HUD_PlaySound( const char *sound, float volume ) if( !g_runfuncs || !g_finalstate ) return; - gEngfuncs.pfnPlaySoundByNameAtLocation( sound, volume, (float *)&g_finalstate->playerstate.origin ); + gEngfuncs.pfnPlaySoundByNameAtLocation( sound, volume, g_finalstate->playerstate.origin ); } /* @@ -127,7 +127,7 @@ Directly queue up an event on the client ===================== */ void HUD_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, - float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ) + const float *origin, const float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ) { vec3_t org; vec3_t ang; @@ -138,7 +138,7 @@ void HUD_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short event // Weapon prediction events are assumed to occur at the player's origin org = g_finalstate->playerstate.origin; ang = v_angles; - gEngfuncs.pfnPlaybackEvent( flags, pInvoker, eventindex, delay, (float *)&org, (float *)&ang, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 ); + gEngfuncs.pfnPlaybackEvent( flags, pInvoker, eventindex, delay, org, ang, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 ); } /* diff --git a/cl_dll/com_weapons.h b/cl_dll/com_weapons.h index efe06ad6..89fb3cfe 100644 --- a/cl_dll/com_weapons.h +++ b/cl_dll/com_weapons.h @@ -27,7 +27,7 @@ int UTIL_SharedRandomLong( unsigned int seed, int low, int high ); int HUD_GetWeaponAnim( void ); void HUD_SendWeaponAnim( int iAnim, int body, int force ); void HUD_PlaySound( const char *sound, float volume ); -void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); +void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, const float *origin, const float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); void HUD_SetMaxSpeed( const struct edict_s *ed, float speed ); int stub_PrecacheModel( const char* s ); int stub_PrecacheSound( const char* s ); diff --git a/cl_dll/compile.bat b/cl_dll/compile.bat index 9270d4bc..18b45459 100644 --- a/cl_dll/compile.bat +++ b/cl_dll/compile.bat @@ -8,68 +8,68 @@ echo -- Compiler is MSVC6 set XASH3DSRC=..\..\Xash3D_original set INCLUDES=-I../common -I../engine -I../pm_shared -I../game_shared -I../public -I../external -I../dlls -I../utils/false_vgui/include -set SOURCES=../dlls/crossbow.cpp^ - ../dlls/crowbar.cpp^ - ../dlls/egon.cpp^ - ../dlls/gauss.cpp^ - ../dlls/handgrenade.cpp^ - ../dlls/hornetgun.cpp^ - ../dlls/mp5.cpp^ - ../dlls/python.cpp^ - ../dlls/rpg.cpp^ - ../dlls/satchel.cpp^ - ../dlls/shotgun.cpp^ - ../dlls/squeakgrenade.cpp^ - ../dlls/tripmine.cpp^ - ../dlls/glock.cpp^ - ev_hldm.cpp^ - hl/hl_baseentity.cpp^ - hl/hl_events.cpp^ - hl/hl_objects.cpp^ - hl/hl_weapons.cpp^ - ammo.cpp^ - ammo_secondary.cpp^ - ammohistory.cpp^ - battery.cpp^ - cdll_int.cpp^ - com_weapons.cpp^ - death.cpp^ - demo.cpp^ - entity.cpp^ - ev_common.cpp^ - events.cpp^ - flashlight.cpp^ - GameStudioModelRenderer.cpp^ - geiger.cpp^ - health.cpp^ - hud.cpp^ - hud_msg.cpp^ - hud_redraw.cpp^ - hud_spectator.cpp^ - hud_update.cpp^ - in_camera.cpp^ - input.cpp^ - input_goldsource.cpp^ - input_mouse.cpp^ - input_xash3d.cpp^ - menu.cpp^ - message.cpp^ - overview.cpp^ - parsemsg.cpp^ - ../pm_shared/pm_debug.c^ - ../pm_shared/pm_math.c^ - ../pm_shared/pm_shared.c^ - saytext.cpp^ - status_icons.cpp^ - statusbar.cpp^ - studio_util.cpp^ - StudioModelRenderer.cpp^ - text_message.cpp^ - train.cpp^ - tri.cpp^ - util.cpp^ - view.cpp^ - scoreboard.cpp^ +set SOURCES=../dlls/crossbow.cpp ^ + ../dlls/crowbar.cpp ^ + ../dlls/egon.cpp ^ + ../dlls/gauss.cpp ^ + ../dlls/handgrenade.cpp ^ + ../dlls/hornetgun.cpp ^ + ../dlls/mp5.cpp ^ + ../dlls/python.cpp ^ + ../dlls/rpg.cpp ^ + ../dlls/satchel.cpp ^ + ../dlls/shotgun.cpp ^ + ../dlls/squeakgrenade.cpp ^ + ../dlls/tripmine.cpp ^ + ../dlls/glock.cpp ^ + ev_hldm.cpp ^ + hl/hl_baseentity.cpp ^ + hl/hl_events.cpp ^ + hl/hl_objects.cpp ^ + hl/hl_weapons.cpp ^ + ammo.cpp ^ + ammo_secondary.cpp ^ + ammohistory.cpp ^ + battery.cpp ^ + cdll_int.cpp ^ + com_weapons.cpp ^ + death.cpp ^ + demo.cpp ^ + entity.cpp ^ + ev_common.cpp ^ + events.cpp ^ + flashlight.cpp ^ + GameStudioModelRenderer.cpp ^ + geiger.cpp ^ + health.cpp ^ + hud.cpp ^ + hud_msg.cpp ^ + hud_redraw.cpp ^ + hud_spectator.cpp ^ + hud_update.cpp ^ + in_camera.cpp ^ + input.cpp ^ + input_goldsource.cpp ^ + input_mouse.cpp ^ + input_xash3d.cpp ^ + menu.cpp ^ + message.cpp ^ + overview.cpp ^ + parsemsg.cpp ^ + ../pm_shared/pm_debug.c ^ + ../pm_shared/pm_math.c ^ + ../pm_shared/pm_shared.c ^ + saytext.cpp ^ + status_icons.cpp ^ + statusbar.cpp ^ + studio_util.cpp ^ + StudioModelRenderer.cpp ^ + text_message.cpp ^ + train.cpp ^ + tri.cpp ^ + util.cpp ^ + view.cpp ^ + scoreboard.cpp ^ MOTD.cpp set DEFINES=/DCLIENT_DLL /DCLIENT_WEAPONS /Dsnprintf=_snprintf /DNO_VOICEGAMEMGR /DGOLDSOURCE_SUPPORT set LIBS=user32.lib Winmm.lib diff --git a/cl_dll/input_goldsource.cpp b/cl_dll/input_goldsource.cpp index c45841cb..be85ee3a 100644 --- a/cl_dll/input_goldsource.cpp +++ b/cl_dll/input_goldsource.cpp @@ -44,62 +44,62 @@ const char* (*pfnSDL_GameControllerName)(SDL_GameController*); int safe_pfnSDL_SetRelativeMouseMode(SDL_bool mode) { - if (pfnSDL_SetRelativeMouseMode) - return pfnSDL_SetRelativeMouseMode(mode); - return -1; + if (pfnSDL_SetRelativeMouseMode) + return pfnSDL_SetRelativeMouseMode(mode); + return -1; } Uint32 safe_pfnSDL_GetRelativeMouseState(int* x, int* y) { - if (pfnSDL_GetRelativeMouseState) - return pfnSDL_GetRelativeMouseState(x, y); - return 0; + if (pfnSDL_GetRelativeMouseState) + return pfnSDL_GetRelativeMouseState(x, y); + return 0; } int safe_pfnSDL_NumJoysticks() { - if (pfnSDL_NumJoysticks) - return pfnSDL_NumJoysticks(); - return -1; + if (pfnSDL_NumJoysticks) + return pfnSDL_NumJoysticks(); + return -1; } SDL_bool safe_pfnSDL_IsGameController(int joystick_index) { - if (pfnSDL_IsGameController) - return pfnSDL_IsGameController(joystick_index); - return SDL_FALSE; + if (pfnSDL_IsGameController) + return pfnSDL_IsGameController(joystick_index); + return SDL_FALSE; } SDL_GameController* safe_pfnSDL_GameControllerOpen(int joystick_index) { - if (pfnSDL_GameControllerOpen) - return pfnSDL_GameControllerOpen(joystick_index); - return NULL; + if (pfnSDL_GameControllerOpen) + return pfnSDL_GameControllerOpen(joystick_index); + return NULL; } Sint16 safe_pfnSDL_GameControllerGetAxis(SDL_GameController* gamecontroller, SDL_GameControllerAxis axis) { - if (pfnSDL_GameControllerGetAxis) - return pfnSDL_GameControllerGetAxis(gamecontroller, axis); - return 0; + if (pfnSDL_GameControllerGetAxis) + return pfnSDL_GameControllerGetAxis(gamecontroller, axis); + return 0; } Uint8 safe_pfnSDL_GameControllerGetButton(SDL_GameController* gamecontroller, SDL_GameControllerButton button) { - if (pfnSDL_GameControllerGetButton) - return pfnSDL_GameControllerGetButton(gamecontroller, button); - return 0; + if (pfnSDL_GameControllerGetButton) + return pfnSDL_GameControllerGetButton(gamecontroller, button); + return 0; } void safe_pfnSDL_JoystickUpdate() { - if (pfnSDL_JoystickUpdate) - pfnSDL_JoystickUpdate(); + if (pfnSDL_JoystickUpdate) + pfnSDL_JoystickUpdate(); } const char* safe_pfnSDL_GameControllerName(SDL_GameController* gamecontroller) { - if (pfnSDL_GameControllerName) - return pfnSDL_GameControllerName(gamecontroller); - return NULL; + if (pfnSDL_GameControllerName) + return pfnSDL_GameControllerName(gamecontroller); + return NULL; } struct SDLFunction { - void** ppfnFunc; - const char* name; + void** ppfnFunc; + const char* name; }; static SDLFunction sdlFunctions[] = { {(void**)&pfnSDL_SetRelativeMouseMode, "SDL_SetRelativeMouseMode"}, @@ -129,15 +129,15 @@ extern cl_enginefunc_t gEngfuncs; extern int iMouseInUse; -extern kbutton_t in_strafe; -extern kbutton_t in_mlook; -extern kbutton_t in_speed; -extern kbutton_t in_jlook; +extern kbutton_t in_strafe; +extern kbutton_t in_mlook; +extern kbutton_t in_speed; +extern kbutton_t in_jlook; -extern cvar_t *m_pitch; -extern cvar_t *m_yaw; -extern cvar_t *m_forward; -extern cvar_t *m_side; +extern cvar_t *m_pitch; +extern cvar_t *m_yaw; +extern cvar_t *m_forward; +extern cvar_t *m_side; extern cvar_t *lookstrafe; extern cvar_t *lookspring; @@ -161,6 +161,7 @@ bool isMouseRelative = false; extern globalvars_t *gpGlobals; #endif +int CL_IsDead( void ); extern Vector dead_viewangles; void V_StopPitchDrift( void ) @@ -169,8 +170,8 @@ void V_StopPitchDrift( void ) } // mouse variables -cvar_t *m_filter; -extern cvar_t *sensitivity; +cvar_t *m_filter; +extern cvar_t *sensitivity; // Custom mouse acceleration (0 disable, 1 to enable, 2 enable with separate yaw/pitch rescale) static cvar_t *m_customaccel; @@ -188,44 +189,44 @@ static cvar_t *m_customaccel_exponent; static cvar_t *m_mousethread_sleep; #endif -float mouse_x, mouse_y; +float mouse_x, mouse_y; -static int restore_spi; -static int originalmouseparms[3], newmouseparms[3] = {0, 0, 1}; -static int mouseactive = 0; -static int mouseparmsvalid; -static int mouseshowtoggle = 1; +static int restore_spi; +static int originalmouseparms[3], newmouseparms[3] = {0, 0, 1}; +static int mouseactive = 0; +static int mouseparmsvalid; +static int mouseshowtoggle = 1; // joystick defines and variables // where should defines be moved? -#define JOY_ABSOLUTE_AXIS 0x00000000 // control like a joystick -#define JOY_RELATIVE_AXIS 0x00000010 // control like a mouse, spinner, trackball -#define JOY_MAX_AXES 6 // X, Y, Z, R, U, V -#define JOY_AXIS_X 0 -#define JOY_AXIS_Y 1 -#define JOY_AXIS_Z 2 -#define JOY_AXIS_R 3 -#define JOY_AXIS_U 4 -#define JOY_AXIS_V 5 +#define JOY_ABSOLUTE_AXIS 0x00000000 // control like a joystick +#define JOY_RELATIVE_AXIS 0x00000010 // control like a mouse, spinner, trackball +#define JOY_MAX_AXES 6 // X, Y, Z, R, U, V +#define JOY_AXIS_X 0 +#define JOY_AXIS_Y 1 +#define JOY_AXIS_Z 2 +#define JOY_AXIS_R 3 +#define JOY_AXIS_U 4 +#define JOY_AXIS_V 5 enum _ControlList { - AxisNada = 0, - AxisForward, - AxisLook, - AxisSide, - AxisTurn + AxisNada = 0, + AxisForward, + AxisLook, + AxisSide, + AxisTurn }; #if !defined(USE_SDL2) && defined(_WIN32) DWORD dwAxisFlags[JOY_MAX_AXES] = { - JOY_RETURNX, - JOY_RETURNY, - JOY_RETURNZ, - JOY_RETURNR, - JOY_RETURNU, - JOY_RETURNV + JOY_RETURNX, + JOY_RETURNY, + JOY_RETURNZ, + JOY_RETURNR, + JOY_RETURNU, + JOY_RETURNV }; #endif @@ -236,10 +237,10 @@ int pdwRawValue[ JOY_MAX_AXES ]; #elif defined(_WIN32) PDWORD pdwRawValue[ JOY_MAX_AXES ]; #endif -DWORD joy_oldbuttonstate, joy_oldpovstate; +DWORD joy_oldbuttonstate, joy_oldpovstate; -int joy_id; -DWORD joy_numbuttons; +int joy_id; +DWORD joy_numbuttons; #ifdef USE_SDL2 SDL_GameController *s_pJoystick = NULL; @@ -273,13 +274,13 @@ cvar_t *joy_yawsensitivity; cvar_t *joy_wwhack1; cvar_t *joy_wwhack2; -int joy_avail, joy_advancedinit, joy_haspov; +int joy_avail, joy_advancedinit, joy_haspov; #ifdef _WIN32 unsigned int s_hMouseThreadId = 0; -HANDLE s_hMouseThread = 0; -HANDLE s_hMouseQuitEvent = 0; -HANDLE s_hMouseThreadActiveLock = 0; +HANDLE s_hMouseThread = 0; +HANDLE s_hMouseQuitEvent = 0; +HANDLE s_hMouseThreadActiveLock = 0; #endif /* @@ -289,14 +290,14 @@ Force_CenterView_f */ void Force_CenterView_f (void) { - vec3_t viewangles; - - if (!iMouseInUse) - { - gEngfuncs.GetViewAngles( (float *)viewangles ); - viewangles[PITCH] = 0; - gEngfuncs.SetViewAngles( (float *)viewangles ); - } + vec3_t viewangles; + + if (!iMouseInUse) + { + gEngfuncs.GetViewAngles( (float *)viewangles ); + viewangles[PITCH] = 0; + gEngfuncs.SetViewAngles( (float *)viewangles ); + } } #ifdef _WIN32 @@ -310,129 +311,129 @@ LONG mouseThreadSleep = 0; bool MouseThread_ActiveLock_Enter( void ) { - if(!m_bMouseThread) - return true; + if(!m_bMouseThread) + return true; - return WAIT_OBJECT_0 == WaitForSingleObject( s_hMouseThreadActiveLock, INFINITE); + return WAIT_OBJECT_0 == WaitForSingleObject( s_hMouseThreadActiveLock, INFINITE); } void MouseThread_ActiveLock_Exit( void ) { - if(!m_bMouseThread) - return; + if(!m_bMouseThread) + return; - SetEvent( s_hMouseThreadActiveLock ); + SetEvent( s_hMouseThreadActiveLock ); } unsigned __stdcall MouseThread_Function( void * pArg ) { - while ( true ) - { - DWORD sleepVal = (DWORD)InterlockedExchangeAdd(&mouseThreadSleep, 0); - if(0 > sleepVal) sleepVal = 0; - else if(1000 < sleepVal) sleepVal = 1000; - if(WAIT_OBJECT_0 == WaitForSingleObject( s_hMouseQuitEvent, sleepVal)) - { - break; - } - - if( MouseThread_ActiveLock_Enter() ) - { - if ( InterlockedExchangeAdd(&mouseThreadActive, 0) ) - { - POINT mouse_pos; - POINT center_pos; - - center_pos.x = InterlockedExchangeAdd(&mouseThreadCenterX, 0); - center_pos.y = InterlockedExchangeAdd(&mouseThreadCenterY, 0); - GetCursorPos(&mouse_pos); - - mouse_pos.x -= center_pos.x; - mouse_pos.y -= center_pos.y; - - if(mouse_pos.x || mouse_pos.y) SetCursorPos( center_pos.x, center_pos.y ); - - InterlockedExchangeAdd(&mouseThreadDeltaX, mouse_pos.x); - InterlockedExchangeAdd(&mouseThreadDeltaY, mouse_pos.y); - } - - MouseThread_ActiveLock_Exit(); - } - } - - return 0; + while ( true ) + { + DWORD sleepVal = (DWORD)InterlockedExchangeAdd(&mouseThreadSleep, 0); + if(0 > sleepVal) sleepVal = 0; + else if(1000 < sleepVal) sleepVal = 1000; + if(WAIT_OBJECT_0 == WaitForSingleObject( s_hMouseQuitEvent, sleepVal)) + { + break; + } + + if( MouseThread_ActiveLock_Enter() ) + { + if ( InterlockedExchangeAdd(&mouseThreadActive, 0) ) + { + POINT mouse_pos; + POINT center_pos; + + center_pos.x = InterlockedExchangeAdd(&mouseThreadCenterX, 0); + center_pos.y = InterlockedExchangeAdd(&mouseThreadCenterY, 0); + GetCursorPos(&mouse_pos); + + mouse_pos.x -= center_pos.x; + mouse_pos.y -= center_pos.y; + + if(mouse_pos.x || mouse_pos.y) SetCursorPos( center_pos.x, center_pos.y ); + + InterlockedExchangeAdd(&mouseThreadDeltaX, mouse_pos.x); + InterlockedExchangeAdd(&mouseThreadDeltaY, mouse_pos.y); + } + + MouseThread_ActiveLock_Exit(); + } + } + + return 0; } /// Updates mouseThreadActive using the global variables mouseactive, iVisibleMouse and m_bRawInput. Should be called after any of these is changed. /// Has to be interlocked manually by programmer! Use MouseThread_ActiveLock_Enter and MouseThread_ActiveLock_Exit. void UpdateMouseThreadActive(void) { - InterlockedExchange(&mouseThreadActive, mouseactive && !iVisibleMouse && !m_bRawInput); + InterlockedExchange(&mouseThreadActive, mouseactive && !iVisibleMouse && !m_bRawInput); } #endif void IN_SetMouseMode(bool enable) { - static bool currentMouseMode = false; + static bool currentMouseMode = false; - if(enable == currentMouseMode) - return; + if(enable == currentMouseMode) + return; - if(enable) - { + if(enable) + { #ifdef _WIN32 - if (mouseparmsvalid) - restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0); + if (mouseparmsvalid) + restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0); - m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; - if(m_bRawInput) - { + m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; + if(m_bRawInput) + { #ifdef USE_SDL2 - safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); + safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); #endif - isMouseRelative = true; - } + isMouseRelative = true; + } #else - safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); + safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); #endif - currentMouseMode = true; - } - else - { + currentMouseMode = true; + } + else + { #ifdef _WIN32 - if(isMouseRelative) - { + if(isMouseRelative) + { #ifdef USE_SDL2 - safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); + safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); #endif - isMouseRelative = false; - } + isMouseRelative = false; + } - if (restore_spi) - SystemParametersInfo (SPI_SETMOUSE, 0, originalmouseparms, 0); + if (restore_spi) + SystemParametersInfo (SPI_SETMOUSE, 0, originalmouseparms, 0); #else - safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); + safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); #endif - currentMouseMode = false; - } + currentMouseMode = false; + } } void IN_SetVisibleMouse(bool visible) { #ifdef _WIN32 - bool lockEntered = MouseThread_ActiveLock_Enter(); + bool lockEntered = MouseThread_ActiveLock_Enter(); #endif - iVisibleMouse = visible; + iVisibleMouse = visible; - IN_SetMouseMode(!visible); + IN_SetMouseMode(!visible); #ifdef _WIN32 - UpdateMouseThreadActive(); - if(lockEntered) MouseThread_ActiveLock_Exit(); + UpdateMouseThreadActive(); + if(lockEntered) MouseThread_ActiveLock_Exit(); #endif } @@ -445,24 +446,24 @@ IN_ActivateMouse */ void GoldSourceInput::IN_ActivateMouse (void) { - if (mouseinitialized) - { + if (mouseinitialized) + { #ifdef _WIN32 - bool lockEntered = MouseThread_ActiveLock_Enter(); + bool lockEntered = MouseThread_ActiveLock_Enter(); #endif - IN_SetMouseMode(true); + IN_SetMouseMode(true); - mouseactive = 1; + mouseactive = 1; #ifdef _WIN32 - UpdateMouseThreadActive(); - if(lockEntered) MouseThread_ActiveLock_Exit(); + UpdateMouseThreadActive(); + if(lockEntered) MouseThread_ActiveLock_Exit(); #endif - // now is a good time to reset mouse positon: - IN_ResetMouse(); - } + // now is a good time to reset mouse positon: + IN_ResetMouse(); + } } @@ -473,21 +474,21 @@ IN_DeactivateMouse */ void GoldSourceInput::IN_DeactivateMouse (void) { - if (mouseinitialized) - { + if (mouseinitialized) + { #ifdef _WIN32 - bool lockEntered = MouseThread_ActiveLock_Enter(); + bool lockEntered = MouseThread_ActiveLock_Enter(); #endif - IN_SetMouseMode(false); + IN_SetMouseMode(false); - mouseactive = 0; + mouseactive = 0; #ifdef _WIN32 - UpdateMouseThreadActive(); - if(lockEntered) MouseThread_ActiveLock_Exit(); + UpdateMouseThreadActive(); + if(lockEntered) MouseThread_ActiveLock_Exit(); #endif - } + } } /* @@ -497,34 +498,34 @@ IN_StartupMouse */ void GoldSourceInput::IN_StartupMouse (void) { - if ( gEngfuncs.CheckParm ("-nomouse", NULL ) ) - return; + if ( gEngfuncs.CheckParm ("-nomouse", NULL ) ) + return; - mouseinitialized = 1; + mouseinitialized = 1; #ifdef _WIN32 - mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0); - - if (mouseparmsvalid) - { - if ( gEngfuncs.CheckParm ("-noforcemspd", NULL ) ) - newmouseparms[2] = originalmouseparms[2]; - - if ( gEngfuncs.CheckParm ("-noforcemaccel", NULL ) ) - { - newmouseparms[0] = originalmouseparms[0]; - newmouseparms[1] = originalmouseparms[1]; - } - - if ( gEngfuncs.CheckParm ("-noforcemparms", NULL ) ) - { - newmouseparms[0] = originalmouseparms[0]; - newmouseparms[1] = originalmouseparms[1]; - newmouseparms[2] = originalmouseparms[2]; - } - } + mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0); + + if (mouseparmsvalid) + { + if ( gEngfuncs.CheckParm ("-noforcemspd", NULL ) ) + newmouseparms[2] = originalmouseparms[2]; + + if ( gEngfuncs.CheckParm ("-noforcemaccel", NULL ) ) + { + newmouseparms[0] = originalmouseparms[0]; + newmouseparms[1] = originalmouseparms[1]; + } + + if ( gEngfuncs.CheckParm ("-noforcemparms", NULL ) ) + { + newmouseparms[0] = originalmouseparms[0]; + newmouseparms[1] = originalmouseparms[1]; + newmouseparms[2] = originalmouseparms[2]; + } + } #endif - mouse_buttons = MOUSE_BUTTON_COUNT; + mouse_buttons = MOUSE_BUTTON_COUNT; } /* @@ -534,43 +535,43 @@ IN_Shutdown */ void GoldSourceInput::IN_Shutdown (void) { - IN_DeactivateMouse (); + IN_DeactivateMouse (); #ifdef _WIN32 - if ( s_hMouseQuitEvent ) - { - SetEvent( s_hMouseQuitEvent ); - } - - if ( s_hMouseThread ) - { - if(WAIT_OBJECT_0 != WaitForSingleObject( s_hMouseThread, 5000 )) - { - TerminateThread( s_hMouseThread, 0 ); - } - CloseHandle( s_hMouseThread ); - s_hMouseThread = (HANDLE)0; - } - - if ( s_hMouseQuitEvent ) - { - CloseHandle( s_hMouseQuitEvent ); - s_hMouseQuitEvent = (HANDLE)0; - } - - if( s_hMouseThreadActiveLock ) - { - CloseHandle( s_hMouseThreadActiveLock ); - s_hMouseThreadActiveLock = (HANDLE)0; - } + if ( s_hMouseQuitEvent ) + { + SetEvent( s_hMouseQuitEvent ); + } + + if ( s_hMouseThread ) + { + if(WAIT_OBJECT_0 != WaitForSingleObject( s_hMouseThread, 5000 )) + { + TerminateThread( s_hMouseThread, 0 ); + } + CloseHandle( s_hMouseThread ); + s_hMouseThread = (HANDLE)0; + } + + if ( s_hMouseQuitEvent ) + { + CloseHandle( s_hMouseQuitEvent ); + s_hMouseQuitEvent = (HANDLE)0; + } + + if( s_hMouseThreadActiveLock ) + { + CloseHandle( s_hMouseThreadActiveLock ); + s_hMouseThreadActiveLock = (HANDLE)0; + } #endif #ifdef USE_SDL2 - for (int j=0; jvalue; - - // Using special accleration values - if ( m_customaccel->value != 0 ) - { - float raw_mouse_movement_distance = sqrt( mx * mx + my * my ); - float acceleration_scale = m_customaccel_scale->value; - float accelerated_sensitivity_max = m_customaccel_max->value; - float accelerated_sensitivity_exponent = m_customaccel_exponent->value; - float accelerated_sensitivity = ( (float)pow( raw_mouse_movement_distance, accelerated_sensitivity_exponent ) * acceleration_scale + mouse_senstivity ); - - if ( accelerated_sensitivity_max > 0.0001f && - accelerated_sensitivity > accelerated_sensitivity_max ) - { - accelerated_sensitivity = accelerated_sensitivity_max; - } - - *x *= accelerated_sensitivity; - *y *= accelerated_sensitivity; - - // Further re-scale by yaw and pitch magnitude if user requests alternate mode 2 - // This means that they will need to up their value for m_customaccel_scale greatly (>40x) since m_pitch/yaw default - // to 0.022 - if ( m_customaccel->value == 2 ) - { - *x *= m_yaw->value; - *y *= m_pitch->value; - } - } - else - { - // Just apply the default - *x *= mouse_senstivity; - *y *= mouse_senstivity; - } + float mx = *x; + float my = *y; + + // This is the default sensitivity + float mouse_senstivity = ( gHUD.GetSensitivity() != 0 ) ? gHUD.GetSensitivity() : sensitivity->value; + + // Using special accleration values + if ( m_customaccel->value != 0 ) + { + float raw_mouse_movement_distance = sqrt( mx * mx + my * my ); + float acceleration_scale = m_customaccel_scale->value; + float accelerated_sensitivity_max = m_customaccel_max->value; + float accelerated_sensitivity_exponent = m_customaccel_exponent->value; + float accelerated_sensitivity = ( (float)pow( raw_mouse_movement_distance, accelerated_sensitivity_exponent ) * acceleration_scale + mouse_senstivity ); + + if ( accelerated_sensitivity_max > 0.0001f && + accelerated_sensitivity > accelerated_sensitivity_max ) + { + accelerated_sensitivity = accelerated_sensitivity_max; + } + + *x *= accelerated_sensitivity; + *y *= accelerated_sensitivity; + + // Further re-scale by yaw and pitch magnitude if user requests alternate mode 2 + // This means that they will need to up their value for m_customaccel_scale greatly (>40x) since m_pitch/yaw default + // to 0.022 + if ( m_customaccel->value == 2 ) + { + *x *= m_yaw->value; + *y *= m_pitch->value; + } + } + else + { + // Just apply the default + *x *= mouse_senstivity; + *y *= mouse_senstivity; + } } void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY) { - bool active = mouseactive && !iVisibleMouse; - int mx, my; + bool active = mouseactive && !iVisibleMouse; + int mx, my; - if(active) - { - int deltaX, deltaY; + if(active) + { + int deltaX, deltaY; #ifdef _WIN32 - if ( !m_bRawInput ) - { - if ( m_bMouseThread ) - { - // update mouseThreadSleep: - InterlockedExchange(&mouseThreadSleep, (LONG)m_mousethread_sleep->value); - - bool lockEntered = MouseThread_ActiveLock_Enter(); - - current_pos.x = InterlockedExchange( &mouseThreadDeltaX, 0 ); - current_pos.y = InterlockedExchange( &mouseThreadDeltaY, 0 ); - - if(lockEntered) MouseThread_ActiveLock_Exit(); - } - else - { - GetCursorPos (¤t_pos); - } - } - else + if ( !m_bRawInput ) + { + if ( m_bMouseThread ) + { + // update mouseThreadSleep: + InterlockedExchange(&mouseThreadSleep, (LONG)m_mousethread_sleep->value); + + bool lockEntered = MouseThread_ActiveLock_Enter(); + + current_pos.x = InterlockedExchange( &mouseThreadDeltaX, 0 ); + current_pos.y = InterlockedExchange( &mouseThreadDeltaY, 0 ); + + if(lockEntered) MouseThread_ActiveLock_Exit(); + } + else + { + GetCursorPos (¤t_pos); + } + } + else #endif - { + { #ifdef USE_SDL2 - safe_pfnSDL_GetRelativeMouseState( &deltaX, &deltaY ); - current_pos.x = deltaX; - current_pos.y = deltaY; + safe_pfnSDL_GetRelativeMouseState( &deltaX, &deltaY ); + current_pos.x = deltaX; + current_pos.y = deltaY; #else - GetCursorPos (¤t_pos); - deltaX = current_pos.x - gEngfuncs.GetWindowCenterX(); - deltaY = current_pos.y - gEngfuncs.GetWindowCenterY(); + GetCursorPos (¤t_pos); + deltaX = current_pos.x - gEngfuncs.GetWindowCenterX(); + deltaY = current_pos.y - gEngfuncs.GetWindowCenterY(); #endif - } + } #ifdef _WIN32 - if ( !m_bRawInput ) - { - if ( m_bMouseThread ) - { - mx = current_pos.x; - my = current_pos.y; - } - else - { - mx = current_pos.x - gEngfuncs.GetWindowCenterX() + mx_accum; - my = current_pos.y - gEngfuncs.GetWindowCenterY() + my_accum; - } - } - else + if ( !m_bRawInput ) + { + if ( m_bMouseThread ) + { + mx = current_pos.x; + my = current_pos.y; + } + else + { + mx = current_pos.x - gEngfuncs.GetWindowCenterX() + mx_accum; + my = current_pos.y - gEngfuncs.GetWindowCenterY() + my_accum; + } + } + else #endif - { - mx = deltaX + mx_accum; - my = deltaY + my_accum; - } + { + mx = deltaX + mx_accum; + my = deltaY + my_accum; + } - mx_accum = 0; - my_accum = 0; + mx_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: #ifdef _WIN32 - // do not reset if mousethread would do it: - if ( m_bRawInput || !m_bMouseThread ) + // do not reset if mousethread would do it: + if ( m_bRawInput || !m_bMouseThread ) #else - if(true) + if(true) #endif - IN_ResetMouse(); + IN_ResetMouse(); #ifdef _WIN32 - // update m_bRawInput occasionally: - if ( gpGlobals && gpGlobals->time - s_flRawInputUpdateTime > 1.0f ) - { - s_flRawInputUpdateTime = gpGlobals->time; + // update m_bRawInput occasionally: + if ( gpGlobals && gpGlobals->time - s_flRawInputUpdateTime > 1.0f ) + { + s_flRawInputUpdateTime = gpGlobals->time; - bool lockEntered = MouseThread_ActiveLock_Enter(); + bool lockEntered = MouseThread_ActiveLock_Enter(); - m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; + m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; - if(m_bRawInput && !isMouseRelative) - { + if(m_bRawInput && !isMouseRelative) + { #ifdef USE_SDL2 - safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); + safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); #endif - isMouseRelative = true; - } - else if(!m_bRawInput && isMouseRelative) - { + isMouseRelative = true; + } + else if(!m_bRawInput && isMouseRelative) + { #ifdef USE_SDL2 - safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); + safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); #endif - isMouseRelative = false; - } + isMouseRelative = false; + } - UpdateMouseThreadActive(); - if(lockEntered) MouseThread_ActiveLock_Exit(); - } + UpdateMouseThreadActive(); + if(lockEntered) MouseThread_ActiveLock_Exit(); + } #endif - } - else - { - mx = my = 0; - } - - if(pOutX) *pOutX = mx; - if(pOutY) *pOutY = my; + } + else + { + mx = my = 0; + } + + if(pOutX) *pOutX = mx; + if(pOutY) *pOutY = my; } /* @@ -820,77 +825,93 @@ IN_MouseMove */ void GoldSourceInput::IN_MouseMove ( float frametime, usercmd_t *cmd) { - int mx, my; - vec3_t viewangles; - - gEngfuncs.GetViewAngles( (float *)viewangles ); - - if ( in_mlook.state & 1) - { - V_StopPitchDrift (); - } - - //jjb - this disbles normal mouse control if the user is trying to - // move the camera, or if the mouse cursor is visible or if we're in intermission - if ( !iMouseInUse && !gHUD.m_iIntermission && !iVisibleMouse ) - { - IN_GetMouseDelta( &mx, &my ); - - if (m_filter && m_filter->value) - { - mouse_x = (mx + old_mouse_x) * 0.5; - mouse_y = (my + old_mouse_y) * 0.5; - } - else - { - mouse_x = mx; - mouse_y = my; - } - - old_mouse_x = mx; - old_mouse_y = my; - - // Apply custom mouse scaling/acceleration - IN_ScaleMouse( &mouse_x, &mouse_y ); - - // add mouse X/Y movement to cmd - if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) )) - cmd->sidemove += m_side->value * mouse_x; - else - viewangles[YAW] -= m_yaw->value * mouse_x; - - if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) - { - viewangles[PITCH] += m_pitch->value * mouse_y; - if (viewangles[PITCH] > cl_pitchdown->value) - viewangles[PITCH] = cl_pitchdown->value; - if (viewangles[PITCH] < -cl_pitchup->value) - viewangles[PITCH] = -cl_pitchup->value; - } - else - { - if ((in_strafe.state & 1) && gEngfuncs.IsNoClipping() ) - { - cmd->upmove -= m_forward->value * mouse_y; - } - else - { - cmd->forwardmove -= m_forward->value * mouse_y; - } - } - } - - gEngfuncs.SetViewAngles( (float *)viewangles ); + int mx, my; + vec3_t viewangles; + + if( gHUD.m_iIntermission ) + return; // we can't move during intermission + + if( CL_IsDead() ) + { + viewangles = dead_viewangles; // HACKHACK: see below + } + else + { + gEngfuncs.GetViewAngles( viewangles ); + } + + if ( in_mlook.state & 1) + { + V_StopPitchDrift (); + } + + //jjb - this disbles normal mouse control if the user is trying to + // move the camera, or if the mouse cursor is visible or if we're in intermission + if ( !iMouseInUse && !gHUD.m_iIntermission && !iVisibleMouse ) + { + IN_GetMouseDelta( &mx, &my ); + + if (m_filter && m_filter->value) + { + mouse_x = (mx + old_mouse_x) * 0.5; + mouse_y = (my + old_mouse_y) * 0.5; + } + else + { + mouse_x = mx; + mouse_y = my; + } + + old_mouse_x = mx; + old_mouse_y = my; + + // Apply custom mouse scaling/acceleration + IN_ScaleMouse( &mouse_x, &mouse_y ); + + // add mouse X/Y movement to cmd + if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) )) + cmd->sidemove += m_side->value * mouse_x; + else + viewangles[YAW] -= m_yaw->value * mouse_x; + + if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) + { + viewangles[PITCH] += m_pitch->value * mouse_y; + if (viewangles[PITCH] > cl_pitchdown->value) + viewangles[PITCH] = cl_pitchdown->value; + if (viewangles[PITCH] < -cl_pitchup->value) + viewangles[PITCH] = -cl_pitchup->value; + } + else + { + if ((in_strafe.state & 1) && gEngfuncs.IsNoClipping() ) + { + cmd->upmove -= m_forward->value * mouse_y; + } + else + { + cmd->forwardmove -= m_forward->value * mouse_y; + } + } + } + + // HACKHACK: change viewangles directly in viewcode, + // so viewangles when player is dead will not be changed on server + if( !CL_IsDead() ) + { + gEngfuncs.SetViewAngles( viewangles ); + } + dead_viewangles = viewangles; // keep them actual /* //#define TRACE_TEST #if defined( TRACE_TEST ) - { - int mx, my; - void V_Move( int mx, int my ); - IN_GetMousePos( &mx, &my ); - V_Move( mx, my ); - } + { + int mx, my; + void V_Move( int mx, int my ); + IN_GetMousePos( &mx, &my ); + V_Move( mx, my ); + } #endif */ } @@ -902,49 +923,49 @@ IN_Accumulate */ void GoldSourceInput::IN_Accumulate (void) { - //only accumulate mouse if we are not moving the camera with the mouse - if ( !iMouseInUse && !iVisibleMouse) - { - if (mouseactive) - { + //only accumulate mouse if we are not moving the camera with the mouse + if ( !iMouseInUse && !iVisibleMouse) + { + if (mouseactive) + { #ifdef _WIN32 - if ( !m_bRawInput ) - { - if ( !m_bMouseThread ) - { - GetCursorPos (¤t_pos); - - mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX(); - my_accum += current_pos.y - gEngfuncs.GetWindowCenterY(); - } - } - else + if ( !m_bRawInput ) + { + if ( !m_bMouseThread ) + { + GetCursorPos (¤t_pos); + + mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX(); + my_accum += current_pos.y - gEngfuncs.GetWindowCenterY(); + } + } + else #endif - { + { #ifdef USE_SDL2 - int deltaX, deltaY; - safe_pfnSDL_GetRelativeMouseState( &deltaX, &deltaY ); - mx_accum += deltaX; - my_accum += deltaY; + int deltaX, deltaY; + safe_pfnSDL_GetRelativeMouseState( &deltaX, &deltaY ); + mx_accum += deltaX; + my_accum += deltaY; #else - GetCursorPos (¤t_pos); + GetCursorPos (¤t_pos); - mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX(); - my_accum += current_pos.y - gEngfuncs.GetWindowCenterY(); + mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX(); + my_accum += current_pos.y - gEngfuncs.GetWindowCenterY(); #endif - } + } - // force the mouse to the center, so there's room to move + // force the mouse to the center, so there's room to move #ifdef _WIN32 - // do not reset if mousethread would do it: - if ( m_bRawInput || !m_bMouseThread ) + // do not reset if mousethread would do it: + if ( m_bRawInput || !m_bMouseThread ) #else - if(true) + if(true) #endif - IN_ResetMouse(); + IN_ResetMouse(); - } - } + } + } } @@ -955,12 +976,12 @@ IN_ClearStates */ void GoldSourceInput::IN_ClearStates (void) { - if ( !mouseactive ) - return; + if ( !mouseactive ) + return; - mx_accum = 0; - my_accum = 0; - mouse_oldbuttonstate = 0; + mx_accum = 0; + my_accum = 0; + mouse_oldbuttonstate = 0; } /* @@ -970,136 +991,136 @@ IN_StartupJoystick */ void IN_StartupJoystick (void) { - // abort startup if user requests no joystick - if ( gEngfuncs.CheckParm ("-nojoy", NULL ) ) - return; + // abort startup if user requests no joystick + if ( gEngfuncs.CheckParm ("-nojoy", NULL ) ) + return; - // assume no joystick - joy_avail = 0; + // assume no joystick + joy_avail = 0; #ifdef USE_SDL2 - int nJoysticks = safe_pfnSDL_NumJoysticks(); - if ( nJoysticks > 0 ) - { - for ( int i = 0; i < nJoysticks; i++ ) - { - if ( safe_pfnSDL_IsGameController( i ) ) - { - s_pJoystick = safe_pfnSDL_GameControllerOpen( i ); - if ( s_pJoystick ) - { - //save the joystick's number of buttons and POV status - joy_numbuttons = SDL_CONTROLLER_BUTTON_MAX; - joy_haspov = 0; - - // old button and POV states default to no buttons pressed - joy_oldbuttonstate = joy_oldpovstate = 0; - - // mark the joystick as available and advanced initialization not completed - // this is needed as cvars are not available during initialization - gEngfuncs.Con_Printf ("joystick found\n\n", safe_pfnSDL_GameControllerName(s_pJoystick)); - joy_avail = 1; - joy_advancedinit = 0; - break; - } - } - } - } - else - { - gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n"); - } + int nJoysticks = safe_pfnSDL_NumJoysticks(); + if ( nJoysticks > 0 ) + { + for ( int i = 0; i < nJoysticks; i++ ) + { + if ( safe_pfnSDL_IsGameController( i ) ) + { + s_pJoystick = safe_pfnSDL_GameControllerOpen( i ); + if ( s_pJoystick ) + { + //save the joystick's number of buttons and POV status + joy_numbuttons = SDL_CONTROLLER_BUTTON_MAX; + joy_haspov = 0; + + // old button and POV states default to no buttons pressed + joy_oldbuttonstate = joy_oldpovstate = 0; + + // mark the joystick as available and advanced initialization not completed + // this is needed as cvars are not available during initialization + gEngfuncs.Con_Printf ("joystick found\n\n", safe_pfnSDL_GameControllerName(s_pJoystick)); + joy_avail = 1; + joy_advancedinit = 0; + break; + } + } + } + } + else + { + gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n"); + } #elif defined(_WIN32) - int numdevs; - JOYCAPS jc; - MMRESULT mmr; - // verify joystick driver is present - if ((numdevs = joyGetNumDevs ()) == 0) - { - gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n"); - return; - } - - // cycle through the joystick ids for the first valid one - for (joy_id=0 ; joy_idvalue == 0.0) - { - // default joystick initialization - // 2 axes only with joystick control - dwAxisMap[JOY_AXIS_X] = AxisTurn; - // dwControlMap[JOY_AXIS_X] = JOY_ABSOLUTE_AXIS; - dwAxisMap[JOY_AXIS_Y] = AxisForward; - // dwControlMap[JOY_AXIS_Y] = JOY_ABSOLUTE_AXIS; - } - else - { - if ( strcmp ( joy_name->string, "joystick") != 0 ) - { - // notify user of advanced controller - gEngfuncs.Con_Printf ("\n%s configured\n\n", joy_name->string); - } - - // advanced initialization here - // data supplied by user via joy_axisn cvars - dwTemp = (DWORD) joy_advaxisx->value; - dwAxisMap[JOY_AXIS_X] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_X] = dwTemp & JOY_RELATIVE_AXIS; - dwTemp = (DWORD) joy_advaxisy->value; - dwAxisMap[JOY_AXIS_Y] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_Y] = dwTemp & JOY_RELATIVE_AXIS; - dwTemp = (DWORD) joy_advaxisz->value; - dwAxisMap[JOY_AXIS_Z] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_Z] = dwTemp & JOY_RELATIVE_AXIS; - dwTemp = (DWORD) joy_advaxisr->value; - dwAxisMap[JOY_AXIS_R] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_R] = dwTemp & JOY_RELATIVE_AXIS; - dwTemp = (DWORD) joy_advaxisu->value; - dwAxisMap[JOY_AXIS_U] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_U] = dwTemp & JOY_RELATIVE_AXIS; - dwTemp = (DWORD) joy_advaxisv->value; - dwAxisMap[JOY_AXIS_V] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS; - } + // called once by IN_ReadJoystick and by user whenever an update is needed + // cvars are now available + int i; + DWORD dwTemp; + + // initialize all the maps + for (i = 0; i < JOY_MAX_AXES; i++) + { + dwAxisMap[i] = AxisNada; + dwControlMap[i] = JOY_ABSOLUTE_AXIS; + pdwRawValue[i] = RawValuePointer(i); + } + + if( joy_advanced->value == 0.0) + { + // default joystick initialization + // 2 axes only with joystick control + dwAxisMap[JOY_AXIS_X] = AxisTurn; + // dwControlMap[JOY_AXIS_X] = JOY_ABSOLUTE_AXIS; + dwAxisMap[JOY_AXIS_Y] = AxisForward; + // dwControlMap[JOY_AXIS_Y] = JOY_ABSOLUTE_AXIS; + } + else + { + if ( strcmp ( joy_name->string, "joystick") != 0 ) + { + // notify user of advanced controller + gEngfuncs.Con_Printf ("\n%s configured\n\n", joy_name->string); + } + + // advanced initialization here + // data supplied by user via joy_axisn cvars + dwTemp = (DWORD) joy_advaxisx->value; + dwAxisMap[JOY_AXIS_X] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_X] = dwTemp & JOY_RELATIVE_AXIS; + dwTemp = (DWORD) joy_advaxisy->value; + dwAxisMap[JOY_AXIS_Y] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_Y] = dwTemp & JOY_RELATIVE_AXIS; + dwTemp = (DWORD) joy_advaxisz->value; + dwAxisMap[JOY_AXIS_Z] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_Z] = dwTemp & JOY_RELATIVE_AXIS; + dwTemp = (DWORD) joy_advaxisr->value; + dwAxisMap[JOY_AXIS_R] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_R] = dwTemp & JOY_RELATIVE_AXIS; + dwTemp = (DWORD) joy_advaxisu->value; + dwAxisMap[JOY_AXIS_U] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_U] = dwTemp & JOY_RELATIVE_AXIS; + dwTemp = (DWORD) joy_advaxisv->value; + dwAxisMap[JOY_AXIS_V] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS; + } #if !defined(USE_SDL2) && defined(_WIN32) - // compute the axes to collect from DirectInput - joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV; - for (i = 0; i < JOY_MAX_AXES; i++) - { - if (dwAxisMap[i] != AxisNada) - { - joy_flags |= dwAxisFlags[i]; - } - } + // compute the axes to collect from DirectInput + joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV; + for (i = 0; i < JOY_MAX_AXES; i++) + { + if (dwAxisMap[i] != AxisNada) + { + joy_flags |= dwAxisFlags[i]; + } + } #endif } @@ -1184,85 +1205,85 @@ IN_Commands */ void GoldSourceInput::IN_Commands (void) { - int i, key_index; + int i, key_index; - if (!joy_avail) - { - return; - } + if (!joy_avail) + { + return; + } - DWORD buttonstate, povstate; + DWORD buttonstate, povstate; - // loop through the joystick buttons - // key a joystick event or auxillary event for higher number buttons for each state change + // loop through the joystick buttons + // key a joystick event or auxillary event for higher number buttons for each state change #ifdef USE_SDL2 - buttonstate = 0; - for ( i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++ ) - { - if ( safe_pfnSDL_GameControllerGetButton( s_pJoystick, (SDL_GameControllerButton)i ) ) - { - buttonstate |= 1<value != 0.0) - { - ji.dwUpos += 100; - } - return 1; - } - else - { - // read error occurred - // turning off the joystick seems too harsh for 1 read error,\ - // but what should be done? - // Con_Printf ("IN_ReadJoystick: no response\n"); - // joy_avail = 0; - return 0; - } + memset (&ji, 0, sizeof(ji)); + ji.dwSize = sizeof(ji); + ji.dwFlags = joy_flags; + + if (joyGetPosEx (joy_id, &ji) == JOYERR_NOERROR) + { + // this is a hack -- there is a bug in the Logitech WingMan Warrior DirectInput Driver + // rather than having 32768 be the zero point, they have the zero point at 32668 + // go figure -- anyway, now we get the full resolution out of the device + if (joy_wwhack1->value != 0.0) + { + ji.dwUpos += 100; + } + return 1; + } + else + { + // read error occurred + // turning off the joystick seems too harsh for 1 read error,\ + // but what should be done? + // Con_Printf ("IN_ReadJoystick: no response\n"); + // joy_avail = 0; + return 0; + } #else - return 0; + return 0; #endif } @@ -1314,189 +1335,189 @@ IN_JoyMove */ void IN_JoyMove ( float frametime, usercmd_t *cmd ) { - float speed, aspeed; - float fAxisValue, fTemp; - int i; - vec3_t viewangles; - - gEngfuncs.GetViewAngles( (float *)viewangles ); - - - // complete initialization if first time in - // this is needed as cvars are not available at initialization time - if( joy_advancedinit != 1 ) - { - Joy_AdvancedUpdate_f(); - joy_advancedinit = 1; - } - - // verify joystick is available and that the user wants to use it - if (!joy_avail || !in_joystick->value) - { - return; - } - - // collect the joystick data, if possible - if (IN_ReadJoystick () != 1) - { - return; - } - - if (in_speed.state & 1) - speed = cl_movespeedkey->value; - else - speed = 1; - - aspeed = speed * frametime; - - // loop through the axes - for (i = 0; i < JOY_MAX_AXES; i++) - { - // get the floating point zero-centered, potentially-inverted data for the current axis + float speed, aspeed; + float fAxisValue, fTemp; + int i; + vec3_t viewangles; + + gEngfuncs.GetViewAngles( (float *)viewangles ); + + + // complete initialization if first time in + // this is needed as cvars are not available at initialization time + if( joy_advancedinit != 1 ) + { + Joy_AdvancedUpdate_f(); + joy_advancedinit = 1; + } + + // verify joystick is available and that the user wants to use it + if (!joy_avail || !in_joystick->value) + { + return; + } + + // collect the joystick data, if possible + if (IN_ReadJoystick () != 1) + { + return; + } + + if (in_speed.state & 1) + speed = cl_movespeedkey->value; + else + speed = 1; + + aspeed = speed * frametime; + + // loop through the axes + for (i = 0; i < JOY_MAX_AXES; i++) + { + // get the floating point zero-centered, potentially-inverted data for the current axis #ifdef USE_SDL2 - fAxisValue = (float)pdwRawValue[i]; + fAxisValue = (float)pdwRawValue[i]; #elif defined(_WIN32) - fAxisValue = (float) *pdwRawValue[i]; - fAxisValue -= 32768.0; + fAxisValue = (float) *pdwRawValue[i]; + fAxisValue -= 32768.0; #endif - if (joy_wwhack2->value != 0.0) - { - if (dwAxisMap[i] == AxisTurn) - { - // this is a special formula for the Logitech WingMan Warrior - // y=ax^b; where a = 300 and b = 1.3 - // also x values are in increments of 800 (so this is factored out) - // then bounds check result to level out excessively high spin rates - fTemp = 300.0 * pow(fabs(fAxisValue) / 800.0, 1.3); - if (fTemp > 14000.0) - fTemp = 14000.0; - // restore direction information - fAxisValue = (fAxisValue > 0.0) ? fTemp : -fTemp; - } - } - - // convert range from -32768..32767 to -1..1 - fAxisValue /= 32768.0; - - switch (dwAxisMap[i]) - { - case AxisForward: - if ((joy_advanced->value == 0.0) && (in_jlook.state & 1)) - { - // user wants forward control to become look control - if (fabs(fAxisValue) > joy_pitchthreshold->value) - { - // if mouse invert is on, invert the joystick pitch value - // only absolute control support here (joy_advanced is 0) - if (m_pitch->value < 0.0) - { - viewangles[PITCH] -= (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; - } - else - { - viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; - } - V_StopPitchDrift(); - } - else - { - // no pitch movement - // disable pitch return-to-center unless requested by user - // *** this code can be removed when the lookspring bug is fixed - // *** the bug always has the lookspring feature on - if(lookspring->value == 0.0) - { - V_StopPitchDrift(); - } - } - } - else - { - // user wants forward control to be forward control - if (fabs(fAxisValue) > joy_forwardthreshold->value) - { - cmd->forwardmove += (fAxisValue * joy_forwardsensitivity->value) * speed * cl_forwardspeed->value; - } - } - break; - - case AxisSide: - if (fabs(fAxisValue) > joy_sidethreshold->value) - { - cmd->sidemove += (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; - } - break; - - case AxisTurn: - if ((in_strafe.state & 1) || (lookstrafe->value && (in_jlook.state & 1))) - { - // user wants turn control to become side control - if (fabs(fAxisValue) > joy_sidethreshold->value) - { - cmd->sidemove -= (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; - } - } - else - { - // user wants turn control to be turn control - if (fabs(fAxisValue) > joy_yawthreshold->value) - { - if(dwControlMap[i] == JOY_ABSOLUTE_AXIS) - { - viewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * aspeed * cl_yawspeed->value; - } - else - { - viewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * speed * 180.0; - } - - } - } - break; - - case AxisLook: - if (in_jlook.state & 1) - { - if (fabs(fAxisValue) > joy_pitchthreshold->value) - { - // pitch movement detected and pitch movement desired by user - if(dwControlMap[i] == JOY_ABSOLUTE_AXIS) - { - viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; - } - else - { - viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * speed * 180.0; - } - V_StopPitchDrift(); - } - else - { - // no pitch movement - // disable pitch return-to-center unless requested by user - // *** this code can be removed when the lookspring bug is fixed - // *** the bug always has the lookspring feature on - if( lookspring->value == 0.0 ) - { - V_StopPitchDrift(); - } - } - } - break; - - default: - break; - } - } - - // bounds check pitch - if (viewangles[PITCH] > cl_pitchdown->value) - viewangles[PITCH] = cl_pitchdown->value; - if (viewangles[PITCH] < -cl_pitchup->value) - viewangles[PITCH] = -cl_pitchup->value; - - gEngfuncs.SetViewAngles( (float *)viewangles ); + if (joy_wwhack2->value != 0.0) + { + if (dwAxisMap[i] == AxisTurn) + { + // this is a special formula for the Logitech WingMan Warrior + // y=ax^b; where a = 300 and b = 1.3 + // also x values are in increments of 800 (so this is factored out) + // then bounds check result to level out excessively high spin rates + fTemp = 300.0 * pow(fabs(fAxisValue) / 800.0, 1.3); + if (fTemp > 14000.0) + fTemp = 14000.0; + // restore direction information + fAxisValue = (fAxisValue > 0.0) ? fTemp : -fTemp; + } + } + + // convert range from -32768..32767 to -1..1 + fAxisValue /= 32768.0; + + switch (dwAxisMap[i]) + { + case AxisForward: + if ((joy_advanced->value == 0.0) && (in_jlook.state & 1)) + { + // user wants forward control to become look control + if (fabs(fAxisValue) > joy_pitchthreshold->value) + { + // if mouse invert is on, invert the joystick pitch value + // only absolute control support here (joy_advanced is 0) + if (m_pitch->value < 0.0) + { + viewangles[PITCH] -= (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; + } + else + { + viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; + } + V_StopPitchDrift(); + } + else + { + // no pitch movement + // disable pitch return-to-center unless requested by user + // *** this code can be removed when the lookspring bug is fixed + // *** the bug always has the lookspring feature on + if(lookspring->value == 0.0) + { + V_StopPitchDrift(); + } + } + } + else + { + // user wants forward control to be forward control + if (fabs(fAxisValue) > joy_forwardthreshold->value) + { + cmd->forwardmove += (fAxisValue * joy_forwardsensitivity->value) * speed * cl_forwardspeed->value; + } + } + break; + + case AxisSide: + if (fabs(fAxisValue) > joy_sidethreshold->value) + { + cmd->sidemove += (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; + } + break; + + case AxisTurn: + if ((in_strafe.state & 1) || (lookstrafe->value && (in_jlook.state & 1))) + { + // user wants turn control to become side control + if (fabs(fAxisValue) > joy_sidethreshold->value) + { + cmd->sidemove -= (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; + } + } + else + { + // user wants turn control to be turn control + if (fabs(fAxisValue) > joy_yawthreshold->value) + { + if(dwControlMap[i] == JOY_ABSOLUTE_AXIS) + { + viewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * aspeed * cl_yawspeed->value; + } + else + { + viewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * speed * 180.0; + } + + } + } + break; + + case AxisLook: + if (in_jlook.state & 1) + { + if (fabs(fAxisValue) > joy_pitchthreshold->value) + { + // pitch movement detected and pitch movement desired by user + if(dwControlMap[i] == JOY_ABSOLUTE_AXIS) + { + viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; + } + else + { + viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * speed * 180.0; + } + V_StopPitchDrift(); + } + else + { + // no pitch movement + // disable pitch return-to-center unless requested by user + // *** this code can be removed when the lookspring bug is fixed + // *** the bug always has the lookspring feature on + if( lookspring->value == 0.0 ) + { + V_StopPitchDrift(); + } + } + } + break; + + default: + break; + } + } + + // bounds check pitch + if (viewangles[PITCH] > cl_pitchdown->value) + viewangles[PITCH] = cl_pitchdown->value; + if (viewangles[PITCH] < -cl_pitchup->value) + viewangles[PITCH] = -cl_pitchup->value; + + gEngfuncs.SetViewAngles( (float *)viewangles ); } /* @@ -1506,12 +1527,12 @@ IN_Move */ void GoldSourceInput::IN_Move ( float frametime, usercmd_t *cmd) { - if ( !iMouseInUse && mouseactive ) - { - IN_MouseMove ( frametime, cmd); - } + if ( !iMouseInUse && mouseactive ) + { + IN_MouseMove ( frametime, cmd); + } - IN_JoyMove ( frametime, cmd); + IN_JoyMove ( frametime, cmd); } /* @@ -1521,62 +1542,62 @@ IN_Init */ void GoldSourceInput::IN_Init (void) { - m_filter = gEngfuncs.pfnRegisterVariable ( "m_filter","0", FCVAR_ARCHIVE ); - sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity","3", FCVAR_ARCHIVE ); // user mouse sensitivity setting. - - in_joystick = gEngfuncs.pfnRegisterVariable ( "joystick","0", FCVAR_ARCHIVE ); - joy_name = gEngfuncs.pfnRegisterVariable ( "joyname", "joystick", 0 ); - joy_advanced = gEngfuncs.pfnRegisterVariable ( "joyadvanced", "0", 0 ); - joy_advaxisx = gEngfuncs.pfnRegisterVariable ( "joyadvaxisx", "0", 0 ); - joy_advaxisy = gEngfuncs.pfnRegisterVariable ( "joyadvaxisy", "0", 0 ); - joy_advaxisz = gEngfuncs.pfnRegisterVariable ( "joyadvaxisz", "0", 0 ); - joy_advaxisr = gEngfuncs.pfnRegisterVariable ( "joyadvaxisr", "0", 0 ); - joy_advaxisu = gEngfuncs.pfnRegisterVariable ( "joyadvaxisu", "0", 0 ); - joy_advaxisv = gEngfuncs.pfnRegisterVariable ( "joyadvaxisv", "0", 0 ); - joy_forwardthreshold = gEngfuncs.pfnRegisterVariable ( "joyforwardthreshold", "0.15", 0 ); - joy_sidethreshold = gEngfuncs.pfnRegisterVariable ( "joysidethreshold", "0.15", 0 ); - joy_pitchthreshold = gEngfuncs.pfnRegisterVariable ( "joypitchthreshold", "0.15", 0 ); - joy_yawthreshold = gEngfuncs.pfnRegisterVariable ( "joyyawthreshold", "0.15", 0 ); - joy_forwardsensitivity = gEngfuncs.pfnRegisterVariable ( "joyforwardsensitivity", "-1.0", 0 ); - joy_sidesensitivity = gEngfuncs.pfnRegisterVariable ( "joysidesensitivity", "-1.0", 0 ); - joy_pitchsensitivity = gEngfuncs.pfnRegisterVariable ( "joypitchsensitivity", "1.0", 0 ); - joy_yawsensitivity = gEngfuncs.pfnRegisterVariable ( "joyyawsensitivity", "-1.0", 0 ); - joy_wwhack1 = gEngfuncs.pfnRegisterVariable ( "joywwhack1", "0.0", 0 ); - joy_wwhack2 = gEngfuncs.pfnRegisterVariable ( "joywwhack2", "0.0", 0 ); - - m_customaccel = gEngfuncs.pfnRegisterVariable ( "m_customaccel", "0", FCVAR_ARCHIVE ); - m_customaccel_scale = gEngfuncs.pfnRegisterVariable ( "m_customaccel_scale", "0.04", 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_filter = gEngfuncs.pfnRegisterVariable ( "m_filter","0", FCVAR_ARCHIVE ); + sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity","3", FCVAR_ARCHIVE ); // user mouse sensitivity setting. + + in_joystick = gEngfuncs.pfnRegisterVariable ( "joystick","0", FCVAR_ARCHIVE ); + joy_name = gEngfuncs.pfnRegisterVariable ( "joyname", "joystick", 0 ); + joy_advanced = gEngfuncs.pfnRegisterVariable ( "joyadvanced", "0", 0 ); + joy_advaxisx = gEngfuncs.pfnRegisterVariable ( "joyadvaxisx", "0", 0 ); + joy_advaxisy = gEngfuncs.pfnRegisterVariable ( "joyadvaxisy", "0", 0 ); + joy_advaxisz = gEngfuncs.pfnRegisterVariable ( "joyadvaxisz", "0", 0 ); + joy_advaxisr = gEngfuncs.pfnRegisterVariable ( "joyadvaxisr", "0", 0 ); + joy_advaxisu = gEngfuncs.pfnRegisterVariable ( "joyadvaxisu", "0", 0 ); + joy_advaxisv = gEngfuncs.pfnRegisterVariable ( "joyadvaxisv", "0", 0 ); + joy_forwardthreshold = gEngfuncs.pfnRegisterVariable ( "joyforwardthreshold", "0.15", 0 ); + joy_sidethreshold = gEngfuncs.pfnRegisterVariable ( "joysidethreshold", "0.15", 0 ); + joy_pitchthreshold = gEngfuncs.pfnRegisterVariable ( "joypitchthreshold", "0.15", 0 ); + joy_yawthreshold = gEngfuncs.pfnRegisterVariable ( "joyyawthreshold", "0.15", 0 ); + joy_forwardsensitivity = gEngfuncs.pfnRegisterVariable ( "joyforwardsensitivity", "-1.0", 0 ); + joy_sidesensitivity = gEngfuncs.pfnRegisterVariable ( "joysidesensitivity", "-1.0", 0 ); + joy_pitchsensitivity = gEngfuncs.pfnRegisterVariable ( "joypitchsensitivity", "1.0", 0 ); + joy_yawsensitivity = gEngfuncs.pfnRegisterVariable ( "joyyawsensitivity", "-1.0", 0 ); + joy_wwhack1 = gEngfuncs.pfnRegisterVariable ( "joywwhack1", "0.0", 0 ); + joy_wwhack2 = gEngfuncs.pfnRegisterVariable ( "joywwhack2", "0.0", 0 ); + + m_customaccel = gEngfuncs.pfnRegisterVariable ( "m_customaccel", "0", FCVAR_ARCHIVE ); + m_customaccel_scale = gEngfuncs.pfnRegisterVariable ( "m_customaccel_scale", "0.04", FCVAR_ARCHIVE ); + m_customaccel_max = gEngfuncs.pfnRegisterVariable ( "m_customaccel_max", "0", FCVAR_ARCHIVE ); + m_customaccel_exponent = gEngfuncs.pfnRegisterVariable ( "m_customaccel_exponent", "1", FCVAR_ARCHIVE ); #ifdef _WIN32 - m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; - m_bMouseThread = gEngfuncs.CheckParm ("-mousethread", NULL ) != NULL; - m_mousethread_sleep = gEngfuncs.pfnRegisterVariable ( "m_mousethread_sleep", "1", FCVAR_ARCHIVE ); // default to less than 1000 Hz + m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; + m_bMouseThread = gEngfuncs.CheckParm ("-mousethread", NULL ) != NULL; + m_mousethread_sleep = gEngfuncs.pfnRegisterVariable ( "m_mousethread_sleep", "1", FCVAR_ARCHIVE ); // default to less than 1000 Hz - m_bMouseThread = m_bMouseThread && NULL != m_mousethread_sleep; + m_bMouseThread = m_bMouseThread && NULL != m_mousethread_sleep; - if (m_bMouseThread) - { - // init mouseThreadSleep: + if (m_bMouseThread) + { + // init mouseThreadSleep: #if 0 // _beginthreadex is not defined on VS 6? - InterlockedExchange(&mouseThreadSleep, (LONG)m_mousethread_sleep->value); + InterlockedExchange(&mouseThreadSleep, (LONG)m_mousethread_sleep->value); - s_hMouseQuitEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); - s_hMouseThreadActiveLock = CreateEvent( NULL, FALSE, TRUE, NULL ); - if ( s_hMouseQuitEvent && s_hMouseThreadActiveLock) - { - s_hMouseThread = (HANDLE)_beginthreadex( NULL, 0, MouseThread_Function, NULL, 0, &s_hMouseThreadId ); - } + s_hMouseQuitEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); + s_hMouseThreadActiveLock = CreateEvent( NULL, FALSE, TRUE, NULL ); + if ( s_hMouseQuitEvent && s_hMouseThreadActiveLock) + { + s_hMouseThread = (HANDLE)_beginthreadex( NULL, 0, MouseThread_Function, NULL, 0, &s_hMouseThreadId ); + } - m_bMouseThread = NULL != s_hMouseThread; + m_bMouseThread = NULL != s_hMouseThread; #else - m_bMouseThread = 0; + m_bMouseThread = 0; #endif - // at this early stage this won't print anything: - // gEngfuncs.Con_DPrintf ("Mouse thread %s.\n", m_bMouseThread ? "initalized" : "failed to initalize"); - } + // at this early stage this won't print anything: + // gEngfuncs.Con_DPrintf ("Mouse thread %s.\n", m_bMouseThread ? "initalized" : "failed to initalize"); + } #endif #ifdef USE_SDL2 @@ -1597,11 +1618,11 @@ void GoldSourceInput::IN_Init (void) gEngfuncs.Con_Printf("Could not load SDL2: %s\n", dlerror()); } #endif - gEngfuncs.pfnAddCommand ("force_centerview", Force_CenterView_f); - gEngfuncs.pfnAddCommand ("joyadvancedupdate", Joy_AdvancedUpdate_f); + gEngfuncs.pfnAddCommand ("force_centerview", Force_CenterView_f); + gEngfuncs.pfnAddCommand ("joyadvancedupdate", Joy_AdvancedUpdate_f); - IN_StartupMouse (); - IN_StartupJoystick (); + IN_StartupMouse (); + IN_StartupJoystick (); } #endif diff --git a/cl_dll/message.cpp b/cl_dll/message.cpp index ff8d97bf..bbd59d9a 100644 --- a/cl_dll/message.cpp +++ b/cl_dll/message.cpp @@ -240,7 +240,7 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time ) { int i, j, length, width; const char *pText; - unsigned char line[80]; + const char *pLineStart; pText = pMessage->pMessage; // Count lines @@ -278,22 +278,21 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time ) { m_parms.lineLength = 0; m_parms.width = 0; + pLineStart = pText; while( *pText && *pText != '\n' ) { unsigned char c = *pText; - line[m_parms.lineLength] = c; m_parms.width += gHUD.m_scrinfo.charWidths[c]; m_parms.lineLength++; pText++; } pText++; // Skip LF - line[m_parms.lineLength] = 0; m_parms.x = XPosition( pMessage->x, m_parms.width, m_parms.totalWidth ); for( j = 0; j < m_parms.lineLength; j++ ) { - m_parms.text = line[j]; + m_parms.text = pLineStart[j]; int next = m_parms.x + gHUD.m_scrinfo.charWidths[m_parms.text]; MessageScanNextChar(); diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp index 5d52787c..d4bdecb8 100644 --- a/cl_dll/scoreboard.cpp +++ b/cl_dll/scoreboard.cpp @@ -108,7 +108,7 @@ We have a minimum width of 1-320 - we could have the field widths scale with it? int SCOREBOARD_WIDTH = 320; // Y positions -#define ROW_GAP 13 +#define ROW_GAP (gHUD.m_scrinfo.iCharHeight) #define ROW_RANGE_MIN 15 #define ROW_RANGE_MAX ( ScreenHeight - 50 ) diff --git a/cl_dll/wscript b/cl_dll/wscript new file mode 100644 index 00000000..d0bd0951 --- /dev/null +++ b/cl_dll/wscript @@ -0,0 +1,66 @@ +#! /usr/bin/env python +# encoding: utf-8 +# a1batross, mittorn, 2018 + +from waflib import Utils +import os + +def options(opt): + # stub + return + +def configure(conf): + if conf.env.GOLDSRC: + if conf.env.DEST_OS != 'win32': + conf.check_cc(lib='dl') + +def build(bld): + source = bld.path.parent.ant_glob([ + 'pm_shared/*.c', + 'dlls/crossbow.cpp', 'dlls/crowbar.cpp', 'dlls/egon.cpp', 'dlls/gauss.cpp', 'dlls/handgrenade.cpp', + 'dlls/hornetgun.cpp', 'dlls/mp5.cpp', 'dlls/python.cpp', 'dlls/rpg.cpp', 'dlls/satchel.cpp', + 'dlls/shotgun.cpp', 'dlls/squeakgrenade.cpp', 'dlls/tripmine.cpp', 'dlls/glock.cpp' + ]) + + source += bld.path.ant_glob(['hl/*.cpp']) + source += [ + 'ev_hldm.cpp', 'ammo.cpp', 'ammo_secondary.cpp', 'ammohistory.cpp', + 'battery.cpp', 'cdll_int.cpp', 'com_weapons.cpp', 'death.cpp', + 'demo.cpp', 'entity.cpp', 'ev_common.cpp', 'events.cpp', + 'flashlight.cpp', 'GameStudioModelRenderer.cpp', 'geiger.cpp', + 'health.cpp', 'hud.cpp', 'hud_msg.cpp', 'hud_redraw.cpp', + 'hud_spectator.cpp', 'hud_update.cpp', 'in_camera.cpp', + 'input.cpp', 'input_goldsource.cpp', 'input_mouse.cpp', + 'input_xash3d.cpp', 'menu.cpp', 'message.cpp', + 'overview.cpp', 'parsemsg.cpp', 'saytext.cpp', + 'status_icons.cpp', 'statusbar.cpp', 'studio_util.cpp', + 'StudioModelRenderer.cpp', 'text_message.cpp', 'train.cpp', + 'tri.cpp', 'util.cpp', 'view.cpp', 'scoreboard.cpp', 'MOTD.cpp' + ] + + includes = Utils.to_list('. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/false_vgui/include') + + defines = ['CLIENT_DLL'] + if bld.env.GOLDSRC: + defines += ['GOLDSOURCE_SUPPORT'] + + libs = [] + if bld.env.GOLDSRC: + libs += ['DL'] + + if bld.env.DEST_OS2 not in ['android']: + install_path = os.path.join(bld.env.GAMEDIR, bld.env.CLIENT_DIR) + else: + install_path = bld.env.PREFIX + + bld.shlib( + source = source, + target = 'client', + features = 'c cxx', + includes = includes, + defines = defines, + use = libs, + install_path = install_path, + subsystem = bld.env.MSVC_SUBSYSTEM, + idx = 1 + ) diff --git a/dlls/bullsquid.cpp b/dlls/bullsquid.cpp index af3ab88a..8db94c25 100644 --- a/dlls/bullsquid.cpp +++ b/dlls/bullsquid.cpp @@ -398,7 +398,7 @@ BOOL CBullsquid::FValidateHintType( short sHint ) } } - ALERT( at_aiconsole, "Couldn't validate hint type" ); + ALERT( at_aiconsole, "Couldn't validate hint type\n" ); return FALSE; } diff --git a/dlls/client.cpp b/dlls/client.cpp index 1e7dab72..f96302d0 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -51,6 +51,7 @@ extern int gmsgSayText; extern int gmsgBhopcap; extern cvar_t allow_spectators; +extern cvar_t multibyte_only; extern int g_teamplay; @@ -287,6 +288,10 @@ decodeFinishedMaybeCESU8: bool Q_UnicodeValidate( const char *pUTF8 ) { bool bError = false; + + if( !multibyte_only.value ) + return true; + while( *pUTF8 ) { unsigned int uVal; @@ -1097,8 +1102,8 @@ void SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char **pv } } - *pvs = ENGINE_SET_PVS( (float *)&org ); - *pas = ENGINE_SET_PAS( (float *)&org ); + *pvs = ENGINE_SET_PVS( org ); + *pas = ENGINE_SET_PAS( org ); } #include "entity_state.h" diff --git a/dlls/compile.bat b/dlls/compile.bat index 53c4511b..f97806a5 100644 --- a/dlls/compile.bat +++ b/dlls/compile.bat @@ -8,105 +8,105 @@ echo -- Compiler is MSVC6 set XASH3DSRC=..\..\Xash3D_original set INCLUDES=-I../common -I../engine -I../pm_shared -I../game_shared -I../public -set SOURCES=agrunt.cpp^ - airtank.cpp^ - aflock.cpp^ - animating.cpp^ - animation.cpp^ - apache.cpp^ - barnacle.cpp^ - barney.cpp^ - bigmomma.cpp^ - bloater.cpp^ - bmodels.cpp^ - bullsquid.cpp^ - buttons.cpp^ - cbase.cpp^ - client.cpp^ - combat.cpp^ - controller.cpp^ - crossbow.cpp^ - crowbar.cpp^ - defaultai.cpp^ - doors.cpp^ - effects.cpp^ - egon.cpp^ - explode.cpp^ - flyingmonster.cpp^ - func_break.cpp^ - func_tank.cpp^ - game.cpp^ - gamerules.cpp^ - gargantua.cpp^ - gauss.cpp^ - genericmonster.cpp^ - ggrenade.cpp^ - globals.cpp^ - glock.cpp^ - gman.cpp^ - h_ai.cpp^ - h_battery.cpp^ - h_cine.cpp^ - h_cycler.cpp^ - h_export.cpp^ - handgrenade.cpp^ - hassassin.cpp^ - headcrab.cpp^ - healthkit.cpp^ - hgrunt.cpp^ - hornet.cpp^ - hornetgun.cpp^ - houndeye.cpp^ - ichthyosaur.cpp^ - islave.cpp^ - items.cpp^ - leech.cpp^ - lights.cpp^ - maprules.cpp^ - monstermaker.cpp^ - monsters.cpp^ - monsterstate.cpp^ - mortar.cpp^ - mp5.cpp^ - multiplay_gamerules.cpp^ - nihilanth.cpp^ - nodes.cpp^ - observer.cpp^ - osprey.cpp^ - pathcorner.cpp^ - plane.cpp^ - plats.cpp^ - player.cpp^ - playermonster.cpp^ - python.cpp^ - rat.cpp^ - roach.cpp^ - rpg.cpp^ - satchel.cpp^ - schedule.cpp^ - scientist.cpp^ - scripted.cpp^ - shotgun.cpp^ - singleplay_gamerules.cpp^ - skill.cpp^ - sound.cpp^ - soundent.cpp^ - spectator.cpp^ - squadmonster.cpp^ - squeakgrenade.cpp^ - subs.cpp^ - talkmonster.cpp^ - teamplay_gamerules.cpp^ - tempmonster.cpp^ - tentacle.cpp^ - triggers.cpp^ - tripmine.cpp^ - turret.cpp^ - util.cpp^ - weapons.cpp^ - world.cpp^ - xen.cpp^ - zombie.cpp^ +set SOURCES=agrunt.cpp ^ + airtank.cpp ^ + aflock.cpp ^ + animating.cpp ^ + animation.cpp ^ + apache.cpp ^ + barnacle.cpp ^ + barney.cpp ^ + bigmomma.cpp ^ + bloater.cpp ^ + bmodels.cpp ^ + bullsquid.cpp ^ + buttons.cpp ^ + cbase.cpp ^ + client.cpp ^ + combat.cpp ^ + controller.cpp ^ + crossbow.cpp ^ + crowbar.cpp ^ + defaultai.cpp ^ + doors.cpp ^ + effects.cpp ^ + egon.cpp ^ + explode.cpp ^ + flyingmonster.cpp ^ + func_break.cpp ^ + func_tank.cpp ^ + game.cpp ^ + gamerules.cpp ^ + gargantua.cpp ^ + gauss.cpp ^ + genericmonster.cpp ^ + ggrenade.cpp ^ + globals.cpp ^ + glock.cpp ^ + gman.cpp ^ + h_ai.cpp ^ + h_battery.cpp ^ + h_cine.cpp ^ + h_cycler.cpp ^ + h_export.cpp ^ + handgrenade.cpp ^ + hassassin.cpp ^ + headcrab.cpp ^ + healthkit.cpp ^ + hgrunt.cpp ^ + hornet.cpp ^ + hornetgun.cpp ^ + houndeye.cpp ^ + ichthyosaur.cpp ^ + islave.cpp ^ + items.cpp ^ + leech.cpp ^ + lights.cpp ^ + maprules.cpp ^ + monstermaker.cpp ^ + monsters.cpp ^ + monsterstate.cpp ^ + mortar.cpp ^ + mp5.cpp ^ + multiplay_gamerules.cpp ^ + nihilanth.cpp ^ + nodes.cpp ^ + observer.cpp ^ + osprey.cpp ^ + pathcorner.cpp ^ + plane.cpp ^ + plats.cpp ^ + player.cpp ^ + playermonster.cpp ^ + python.cpp ^ + rat.cpp ^ + roach.cpp ^ + rpg.cpp ^ + satchel.cpp ^ + schedule.cpp ^ + scientist.cpp ^ + scripted.cpp ^ + shotgun.cpp ^ + singleplay_gamerules.cpp ^ + skill.cpp ^ + sound.cpp ^ + soundent.cpp ^ + spectator.cpp ^ + squadmonster.cpp ^ + squeakgrenade.cpp ^ + subs.cpp ^ + talkmonster.cpp ^ + teamplay_gamerules.cpp ^ + tempmonster.cpp ^ + tentacle.cpp ^ + triggers.cpp ^ + tripmine.cpp ^ + turret.cpp ^ + util.cpp ^ + weapons.cpp ^ + world.cpp ^ + xen.cpp ^ + zombie.cpp ^ ../pm_shared/pm_debug.c ../pm_shared/pm_math.c ../pm_shared/pm_shared.c set DEFINES=/DCLIENT_WEAPONS /Dsnprintf=_snprintf /DNO_VOICEGAMEMGR set LIBS=user32.lib diff --git a/dlls/doors.cpp b/dlls/doors.cpp index c12cc3a0..085ee441 100644 --- a/dlls/doors.cpp +++ b/dlls/doors.cpp @@ -926,6 +926,7 @@ public: void Spawn( void ); void Precache( void ); void EXPORT MomentaryMoveDone( void ); + void EXPORT StopMoveSound( void ); void KeyValue( KeyValueData *pkvd ); void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); @@ -1117,7 +1118,15 @@ void CMomentaryDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP } void CMomentaryDoor::MomentaryMoveDone( void ) +{ + SetThink(&CMomentaryDoor::StopMoveSound); + pev->nextthink = pev->ltime + 0.1; +} + +void CMomentaryDoor::StopMoveSound() { STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) ); EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1, ATTN_NORM ); + pev->nextthink = -1; + ResetThink(); } diff --git a/dlls/extdll.h b/dlls/extdll.h index d6ea4888..4610db5e 100644 --- a/dlls/extdll.h +++ b/dlls/extdll.h @@ -62,6 +62,7 @@ typedef int BOOL; // Misc C-runtime library headers #include "stdio.h" #include "stdlib.h" +#include "stddef.h" #include "math.h" #if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) diff --git a/dlls/game.cpp b/dlls/game.cpp index b94e24b7..c9bb4b02 100644 --- a/dlls/game.cpp +++ b/dlls/game.cpp @@ -31,6 +31,7 @@ cvar_t friendlyfire = { "mp_friendlyfire","0", FCVAR_SERVER }; cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER }; cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER }; cvar_t selfgauss = { "mp_selfgauss", "1", FCVAR_SERVER }; +cvar_t chargerfix = { "mp_chargerfix", "0", FCVAR_SERVER }; cvar_t satchelfix = { "mp_satchelfix", "0", FCVAR_SERVER }; cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER }; cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER }; @@ -43,6 +44,7 @@ cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER }; cvar_t bhopcap = { "mp_bhopcap", "1", FCVAR_SERVER }; cvar_t allow_spectators = { "allow_spectators", "0", FCVAR_SERVER }; // 0 prevents players from being spectators +cvar_t multibyte_only = { "mp_multibyte_only", "0", FCVAR_SERVER }; cvar_t mp_chattime = { "mp_chattime","10", FCVAR_SERVER }; @@ -530,6 +532,7 @@ void GameDLLInit( void ) CVAR_REGISTER( &falldamage ); CVAR_REGISTER( &weaponstay ); CVAR_REGISTER( &selfgauss ); + CVAR_REGISTER( &chargerfix ); CVAR_REGISTER( &satchelfix ); CVAR_REGISTER( &forcerespawn ); CVAR_REGISTER( &flashlight ); @@ -540,6 +543,7 @@ void GameDLLInit( void ) CVAR_REGISTER( &defaultteam ); CVAR_REGISTER( &allowmonsters ); CVAR_REGISTER( &bhopcap ); + CVAR_REGISTER( &multibyte_only ); CVAR_REGISTER( &mp_chattime ); diff --git a/dlls/game.h b/dlls/game.h index 0dc5ba87..7eb665c6 100644 --- a/dlls/game.h +++ b/dlls/game.h @@ -28,6 +28,7 @@ extern cvar_t friendlyfire; extern cvar_t falldamage; extern cvar_t weaponstay; extern cvar_t selfgauss; +extern cvar_t chargerfix; extern cvar_t satchelfix; extern cvar_t forcerespawn; extern cvar_t flashlight; diff --git a/dlls/gauss.cpp b/dlls/gauss.cpp index e2954133..9b6620e2 100644 --- a/dlls/gauss.cpp +++ b/dlls/gauss.cpp @@ -226,7 +226,7 @@ void CGauss::SecondaryAttack() m_pPlayer->m_flStartCharge = gpGlobals->time; m_pPlayer->m_flAmmoStartCharge = UTIL_WeaponTimeBase() + GetFullChargeTime(); - PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usGaussSpin, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 110, 0, 0, 0 ); + PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usGaussSpin, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, 110, 0, 0, 0 ); m_iSoundState = SND_CHANGE_PITCH; } @@ -290,7 +290,7 @@ void CGauss::SecondaryAttack() if( m_iSoundState == 0 ) ALERT( at_console, "sound state %d\n", m_iSoundState ); - PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usGaussSpin, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, pitch, 0, ( m_iSoundState == SND_CHANGE_PITCH ) ? 1 : 0, 0 ); + PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usGaussSpin, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, pitch, 0, ( m_iSoundState == SND_CHANGE_PITCH ) ? 1 : 0, 0 ); m_iSoundState = SND_CHANGE_PITCH; // hack for going through level transitions @@ -398,13 +398,13 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage ) g_irunninggausspred = true; #endif // The main firing event is sent unreliably so it won't be delayed. - PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usGaussFire, 0.0, (float *)&m_pPlayer->pev->origin, (float *)&m_pPlayer->pev->angles, flDamage, 0.0, 0, 0, m_fPrimaryFire ? 1 : 0, 0 ); + PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usGaussFire, 0.0, m_pPlayer->pev->origin, m_pPlayer->pev->angles, flDamage, 0.0, 0, 0, m_fPrimaryFire ? 1 : 0, 0 ); // This reliable event is used to stop the spinning sound // It's delayed by a fraction of second to make sure it is delayed by 1 frame on the client // It's sent reliably anyway, which could lead to other delays - PLAYBACK_EVENT_FULL( FEV_RELIABLE, m_pPlayer->edict(), m_usGaussFire, 0.01, (float *)&m_pPlayer->pev->origin, (float *)&m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1 ); + PLAYBACK_EVENT_FULL( FEV_RELIABLE, m_pPlayer->edict(), m_usGaussFire, 0.01, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1 ); /*ALERT( at_console, "%f %f %f\n%f %f %f\n", vecSrc.x, vecSrc.y, vecSrc.z, diff --git a/dlls/glock.cpp b/dlls/glock.cpp index b079c49e..a9e034f2 100644 --- a/dlls/glock.cpp +++ b/dlls/glock.cpp @@ -179,7 +179,7 @@ void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim ) Vector vecDir; vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_9MM, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireGlock1 : m_usFireGlock2, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 ); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireGlock1 : m_usFireGlock2, 0.0, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 ); m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + flCycleTime; diff --git a/dlls/h_battery.cpp b/dlls/h_battery.cpp index 61ee1e1a..6660a4fb 100644 --- a/dlls/h_battery.cpp +++ b/dlls/h_battery.cpp @@ -26,6 +26,8 @@ #include "saverestore.h" #include "skill.h" #include "gamerules.h" +#include "weapons.h" +#include "game.h" class CRecharge : public CBaseToggle { @@ -123,7 +125,7 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use } // if the player doesn't have the suit, or there is no juice left, make the deny noise - if( ( m_iJuice <= 0 ) || ( !( m_hActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) || !UTIL_HasSuit( m_hActivator ) ) ) + if( ( m_iJuice <= 0 ) || ( !( m_hActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) || !UTIL_HasSuit( m_hActivator ) ) || ( ( chargerfix.value ) && ( m_hActivator->pev->armorvalue == MAX_NORMAL_BATTERY ) ) ) { if( m_flSoundTime <= gpGlobals->time ) { diff --git a/dlls/healthkit.cpp b/dlls/healthkit.cpp index a5690cd4..b4d10e60 100644 --- a/dlls/healthkit.cpp +++ b/dlls/healthkit.cpp @@ -22,6 +22,7 @@ #include "player.h" #include "items.h" #include "gamerules.h" +#include "game.h" extern int gmsgItemPickup; @@ -198,7 +199,7 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u } // if the player doesn't have the suit, or there is no juice left, make the deny noise - if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) ) + if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) || ( ( chargerfix.value ) && ( pActivator->pev->health >= pActivator->pev->max_health ) ) ) { if( m_flSoundTime <= gpGlobals->time ) { diff --git a/dlls/houndeye.cpp b/dlls/houndeye.cpp index cedee258..940b68ea 100644 --- a/dlls/houndeye.cpp +++ b/dlls/houndeye.cpp @@ -155,7 +155,7 @@ BOOL CHoundeye::FValidateHintType( short sHint ) } } - ALERT( at_aiconsole, "Couldn't validate hint type" ); + ALERT( at_aiconsole, "Couldn't validate hint type\n" ); return FALSE; } diff --git a/dlls/monsters.cpp b/dlls/monsters.cpp index 953d1a69..3ff235ee 100644 --- a/dlls/monsters.cpp +++ b/dlls/monsters.cpp @@ -1208,13 +1208,19 @@ void CBaseMonster::SetActivity( Activity NewActivity ) iSequence = LookupActivity( NewActivity ); + Activity OldActivity = m_Activity; + m_Activity = NewActivity; // Go ahead and set this so it doesn't keep trying when the anim is not present + + // In case someone calls this with something other than the ideal activity + m_IdealActivity = m_Activity; + // Set to the desired anim, or default anim if the desired is not present if( iSequence > ACTIVITY_NOT_AVAILABLE ) { if( pev->sequence != iSequence || !m_fSequenceLoops ) { // don't reset frame between walk and run - if( !( m_Activity == ACT_WALK || m_Activity == ACT_RUN ) || !( NewActivity == ACT_WALK || NewActivity == ACT_RUN ) ) + if( !( OldActivity == ACT_WALK || OldActivity == ACT_RUN ) || !( NewActivity == ACT_WALK || NewActivity == ACT_RUN ) ) pev->frame = 0; } @@ -1228,11 +1234,6 @@ void CBaseMonster::SetActivity( Activity NewActivity ) ALERT( at_aiconsole, "%s has no sequence for act:%d\n", STRING( pev->classname ), NewActivity ); pev->sequence = 0; // Set to the reset anim (if it's there) } - - m_Activity = NewActivity; // Go ahead and set this so it doesn't keep trying when the anim is not present - - // In case someone calls this with something other than the ideal activity - m_IdealActivity = m_Activity; } //========================================================= diff --git a/dlls/mp5.cpp b/dlls/mp5.cpp index 47b16694..29ba35a0 100644 --- a/dlls/mp5.cpp +++ b/dlls/mp5.cpp @@ -183,7 +183,7 @@ void CMP5::PrimaryAttack() #else flags = 0; #endif - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usMP5, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usMP5, 0.0, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) // HEV suit - indicate out of ammo condition diff --git a/dlls/nodes.cpp b/dlls/nodes.cpp index 04705638..6babe01d 100644 --- a/dlls/nodes.cpp +++ b/dlls/nodes.cpp @@ -21,6 +21,7 @@ #include "cbase.h" #include "monsters.h" #include "nodes.h" +#include "nodes_compat.h" #include "animation.h" #include "doors.h" @@ -44,9 +45,7 @@ LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt ) #if !defined _WIN32 #include #include -#define CreateDirectory(p, n) mkdir(p, 0777) -#else -#define CreateDirectory(p, n) CreateDirectoryA(p, n) +#define CreateDirectoryA(p, n) mkdir(p, 0777) #endif //========================================================= @@ -1701,9 +1700,9 @@ void CTestHull::BuildNodeGraph( void ) // make sure directories have been made GET_GAME_DIR( szNrpFilename ); strcat( szNrpFilename, "/maps" ); - CreateDirectory( szNrpFilename, NULL ); + CreateDirectoryA( szNrpFilename, NULL ); strcat( szNrpFilename, "/graphs" ); - CreateDirectory( szNrpFilename, NULL ); + CreateDirectoryA( szNrpFilename, NULL ); strcat( szNrpFilename, "/" ); strcat( szNrpFilename, STRING( gpGlobals->mapname ) ); @@ -2375,9 +2374,9 @@ int CGraph::FLoadGraph( const char *szMapName ) char szDirName[MAX_PATH]; GET_GAME_DIR( szDirName ); strcat( szDirName, "/maps" ); - CreateDirectory( szDirName, NULL ); + CreateDirectoryA( szDirName, NULL ); strcat( szDirName, "/graphs" ); - CreateDirectory( szDirName, NULL ); + CreateDirectoryA( szDirName, NULL ); strcpy( szFilename, "maps/graphs/" ); strcat( szFilename, szMapName ); @@ -2386,42 +2385,47 @@ int CGraph::FLoadGraph( const char *szMapName ) pMemFile = aMemFile = LOAD_FILE_FOR_ME( szFilename, &length ); if( !aMemFile ) - { return FALSE; - } - else - { - // Read the graph version number - // - length -= sizeof(int); - if( length < 0 ) - goto ShortFile; - memcpy( &iVersion, pMemFile, sizeof(int) ); - pMemFile += sizeof(int); - if( iVersion != GRAPH_VERSION ) - { - // This file was written by a different build of the dll! - // - ALERT( at_aiconsole, "**ERROR** Graph version is %d, expected %d\n", iVersion, GRAPH_VERSION ); - goto ShortFile; - } + // Read the graph version number + // + length -= sizeof(int); + if( length < 0 ) + goto ShortFile; + iVersion = *(int *) pMemFile; + pMemFile += sizeof(int); + if( iVersion == GRAPH_VERSION || iVersion == GRAPH_VERSION_RETAIL ) + { // Read the graph class // - length -= sizeof(CGraph); - if( length < 0 ) - goto ShortFile; - memcpy( this, pMemFile, sizeof(CGraph) ); - pMemFile += sizeof(CGraph); + if ( iVersion == GRAPH_VERSION ) + { + length -= sizeof(CGraph); + if( length < 0 ) + goto ShortFile; + memcpy( this, pMemFile, sizeof(CGraph) ); + pMemFile += sizeof(CGraph); - // Set the pointers to zero, just in case we run out of memory. - // - m_pNodes = NULL; - m_pLinkPool = NULL; - m_di = NULL; - m_pRouteInfo = NULL; - m_pHashLinks = NULL; + // Set the pointers to zero, just in case we run out of memory. + // + m_pNodes = NULL; + m_pLinkPool = NULL; + m_di = NULL; + m_pRouteInfo = NULL; + m_pHashLinks = NULL; + } +#if _GRAPH_VERSION != _GRAPH_VERSION_RETAIL + else + { + ALERT( at_aiconsole, "Loading CGraph in GRAPH_VERSION 16 compatibility mode\n" ); + length -= sizeof(CGraph_Retail); + if( length < 0 ) + goto ShortFile; + reinterpret_cast(pMemFile) -> copyOverTo(this); + pMemFile += sizeof(CGraph_Retail); + } +#endif // Malloc for the nodes // @@ -2453,11 +2457,25 @@ int CGraph::FLoadGraph( const char *szMapName ) // Read in all the links // - length -= sizeof(CLink) * m_cLinks; - if( length < 0 ) - goto ShortFile; - memcpy( m_pLinkPool, pMemFile, sizeof(CLink) * m_cLinks ); - pMemFile += sizeof(CLink) * m_cLinks; + if( iVersion == GRAPH_VERSION ) + { + length -= sizeof(CLink) * m_cLinks; + if( length < 0 ) + goto ShortFile; + memcpy( m_pLinkPool, pMemFile, sizeof(CLink) * m_cLinks ); + pMemFile += sizeof(CLink) * m_cLinks; + } +#if _GRAPH_VERSION != _GRAPH_VERSION_RETAIL + else + { + ALERT( at_aiconsole, "Loading CLink array in GRAPH_VERSION 16 compatibility mode\n" ); + length -= sizeof(CLink_Retail) * m_cLinks; + if( length < 0 ) + goto ShortFile; + reinterpret_cast(pMemFile) -> copyOverTo(m_pLinkPool); + pMemFile += sizeof(CLink_Retail) * m_cLinks; + } +#endif // Malloc for the sorting info. // @@ -2482,7 +2500,7 @@ int CGraph::FLoadGraph( const char *szMapName ) m_pRouteInfo = (signed char *)calloc( sizeof(signed char), m_nRouteInfo ); if( !m_pRouteInfo ) { - ALERT( at_aiconsole, "***ERROR**\nCounldn't malloc %d route bytes!\n", m_nRouteInfo ); + ALERT( at_aiconsole, "***ERROR**\nCouldn't malloc %d route bytes!\n", m_nRouteInfo ); goto NoMemory; } m_CheckedCounter = 0; @@ -2505,7 +2523,7 @@ int CGraph::FLoadGraph( const char *szMapName ) m_pHashLinks = (short *)calloc( sizeof(short), m_nHashLinks ); if( !m_pHashLinks ) { - ALERT( at_aiconsole, "***ERROR**\nCounldn't malloc %d hash link bytes!\n", m_nHashLinks ); + ALERT( at_aiconsole, "***ERROR**\nCouldn't malloc %d hash link bytes!\n", m_nHashLinks ); goto NoMemory; } @@ -2531,6 +2549,13 @@ int CGraph::FLoadGraph( const char *szMapName ) return TRUE; } + else + { + // This file was written by a different build of the dll! + // + ALERT( at_aiconsole, "**ERROR** Graph version is %d, expected %d\n", iVersion, GRAPH_VERSION ); + goto ShortFile; + } ShortFile: NoMemory: @@ -2558,9 +2583,9 @@ int CGraph::FSaveGraph( const char *szMapName ) // make sure directories have been made GET_GAME_DIR( szFilename ); strcat( szFilename, "/maps" ); - CreateDirectory( szFilename, NULL ); + CreateDirectoryA( szFilename, NULL ); strcat( szFilename, "/graphs" ); - CreateDirectory( szFilename, NULL ); + CreateDirectoryA( szFilename, NULL ); strcat( szFilename, "/" ); strcat( szFilename, szMapName ); diff --git a/dlls/nodes.h b/dlls/nodes.h index 52b715e5..4bc1ec1b 100644 --- a/dlls/nodes.h +++ b/dlls/nodes.h @@ -105,11 +105,14 @@ typedef struct //========================================================= // CGraph //========================================================= +#define _GRAPH_VERSION_RETAIL 16 // Retail Half-Life graph version. Don't increment this #ifdef XASH_64BIT -#define GRAPH_VERSION (int)16 * 10 +#define _GRAPH_VERSION (16 * 10) #else -#define GRAPH_VERSION (int)16// !!!increment this whever graph/node/link classes change, to obsolesce older disk files. +#define _GRAPH_VERSION (16) // !!!increment this whenever graph/node/link classes change, to obsolesce older disk files. #endif +#define GRAPH_VERSION (int)_GRAPH_VERSION +#define GRAPH_VERSION_RETAIL (int)_GRAPH_VERSION_RETAIL class CGraph { diff --git a/dlls/nodes_compat.h b/dlls/nodes_compat.h new file mode 100644 index 00000000..d73567e9 --- /dev/null +++ b/dlls/nodes_compat.h @@ -0,0 +1,143 @@ + +#pragma once +#ifndef NODES_32BIT_COMPAT +#define NODES_32BIT_COMPAT + +//#include "nodes.h" + +#if _GRAPH_VERSION != _GRAPH_VERSION_RETAIL + +#include "stdint.h" + +typedef int32_t PTR32; + +class CGraph_Retail +{ +public: + + BOOL m_fGraphPresent; + BOOL m_fGraphPointersSet; + BOOL m_fRoutingComplete; + + PTR32 m_pNodes; // CNode* + PTR32 m_pLinkPool; // CLink* + PTR32 m_pRouteInfo; // signed char* + + int m_cNodes; + int m_cLinks; + int m_nRouteInfo; + + PTR32 m_di; // DIST_INFO* + int m_RangeStart[3][NUM_RANGES]; + int m_RangeEnd[3][NUM_RANGES]; + float m_flShortest; + int m_iNearest; + int m_minX, m_minY, m_minZ, m_maxX, m_maxY, m_maxZ; + int m_minBoxX, m_minBoxY, m_minBoxZ, m_maxBoxX, m_maxBoxY, m_maxBoxZ; + int m_CheckedCounter; + float m_RegionMin[3], m_RegionMax[3]; + CACHE_ENTRY m_Cache[CACHE_SIZE]; + + + int m_HashPrimes[16]; + PTR32 m_pHashLinks; // short* + int m_nHashLinks; + + int m_iLastActiveIdleSearch; + + int m_iLastCoverSearch; + + + void copyOverTo(CGraph *other) { + other->m_fGraphPresent = m_fGraphPresent; + other->m_fGraphPointersSet = m_fGraphPointersSet; + other->m_fRoutingComplete = m_fRoutingComplete; + + other->m_pNodes = NULL; + other->m_pLinkPool = NULL; + other->m_pRouteInfo = NULL; + + other->m_cNodes = m_cNodes; + other->m_cLinks = m_cLinks; + other->m_nRouteInfo = m_nRouteInfo; + + other->m_di = NULL; + + memcpy( (void *) &other->m_RangeStart, (void *) m_RangeStart, + offsetof(class CGraph, m_pHashLinks) - offsetof(class CGraph, m_RangeStart) ); + +#if 0 // replacement routine in case a change in CGraph breaks the above memcpy + for (int i = 0; i < 3; ++i) + for (int j = 0; j < NUM_RANGES; ++j) + other->m_RangeStart[i][j] = m_RangeStart[i][j]; +// m_RangeStart[3][NUM_RANGES] + for (int i = 0; i < 3; ++i) + for (int j = 0; j < NUM_RANGES; ++j) + other->m_RangeEnd[i][j] = m_RangeEnd[i][j]; +// m_RangeEnd[3][NUM_RANGES] + other->m_flShortest = m_flShortest; + other->m_iNearest = m_iNearest; + other->m_minX = m_minX; + other->m_minY = m_minY; + other->m_minZ = m_minZ; + other->m_maxX = m_maxX; + other->m_maxY = m_maxY; + other->m_maxZ = m_maxZ; + other->m_minBoxX = m_minBoxX; + other->m_minBoxY = m_minBoxY; + other->m_minBoxZ = m_minBoxZ; + other->m_maxBoxX = m_maxBoxX; + other->m_maxBoxY = m_maxBoxY; + other->m_maxBoxZ = m_maxBoxZ; + other->m_CheckedCounter = m_CheckedCounter; + for (int i = 0; i < 3; ++i) + other->m_RegionMin[i] = m_RegionMin[i]; +// m_RegionMin[3] + for (int i = 0; i < 3; ++i) + other->m_RegionMax[i] = m_RegionMax[i]; +// m_RegionMax[3] + for (int i = 0; i < CACHE_SIZE; ++i) + other->m_Cache[i] = m_Cache[i]; +// m_Cache[CACHE_SIZE] + for (int i = 0; i < 16; ++i) + other->m_HashPrimes[i] = m_HashPrimes[i]; +// m_HashPrimes[16] +#endif + + other->m_pHashLinks = NULL; + other->m_nHashLinks = m_nHashLinks; + + other->m_iLastActiveIdleSearch = m_iLastActiveIdleSearch; + + other->m_iLastCoverSearch = m_iLastCoverSearch; + + } + +}; + + +class CLink_Retail +{ + +public: + int m_iSrcNode; + int m_iDestNode; + PTR32 m_pLinkEnt; // entvars_t* + char m_szLinkEntModelname[ 4 ]; + int m_afLinkInfo; + float m_flWeight; + + void copyOverTo(CLink* other) { + other->m_iSrcNode = m_iSrcNode; + other->m_iDestNode = m_iDestNode ; + other->m_pLinkEnt = NULL; + for (int i = 0; i < 4; ++i) + other->m_szLinkEntModelname[i] = m_szLinkEntModelname[i]; +// m_szLinkEntModelname[ 4 ] + other->m_afLinkInfo = m_afLinkInfo; + other->m_flWeight = m_flWeight; + } +}; + +#endif +#endif diff --git a/dlls/plats.cpp b/dlls/plats.cpp index fad34ac5..5c5b0fd8 100644 --- a/dlls/plats.cpp +++ b/dlls/plats.cpp @@ -1059,7 +1059,7 @@ void CFuncTrackTrain::StopSound( void ) us_encode = us_sound; PLAYBACK_EVENT_FULL( FEV_RELIABLE | FEV_UPDATE, edict(), m_usAdjustPitch, 0.0, - (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, us_encode, 0, 1, 0 );*/ + g_vecZero, g_vecZero, 0.0, 0.0, us_encode, 0, 1, 0 );*/ STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noise ) ); @@ -1116,7 +1116,7 @@ void CFuncTrackTrain::UpdateSound( void ) us_encode = us_sound | us_pitch | us_volume; PLAYBACK_EVENT_FULL( FEV_RELIABLE | FEV_UPDATE, edict(), m_usAdjustPitch, 0.0, - (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, us_encode, 0, 0, 0 );*/ + g_vecZero, g_vecZero, 0.0, 0.0, us_encode, 0, 0, 0 );*/ } } diff --git a/dlls/python.cpp b/dlls/python.cpp index de4b88f5..1ad48875 100644 --- a/dlls/python.cpp +++ b/dlls/python.cpp @@ -206,7 +206,7 @@ void CPython::PrimaryAttack() #else flags = 0; #endif - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usFirePython, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usFirePython, 0.0, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) // HEV suit - indicate out of ammo condition diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index 887581e1..56be2a5a 100644 --- a/dlls/scientist.cpp +++ b/dlls/scientist.cpp @@ -718,12 +718,6 @@ void CScientist::TalkInit() { CTalkMonster::TalkInit(); - // scientist will try to talk to friends in this order: - - m_szFriends[0] = "monster_scientist"; - m_szFriends[1] = "monster_sitting_scientist"; - m_szFriends[2] = "monster_barney"; - // scientists speach group names (group names are in sentences.txt) if( FClassnameIs( pev, "monster_worker" ) ) diff --git a/dlls/shotgun.cpp b/dlls/shotgun.cpp index 28a2379b..4973927e 100644 --- a/dlls/shotgun.cpp +++ b/dlls/shotgun.cpp @@ -177,7 +177,7 @@ void CShotgun::PrimaryAttack() vecDir = m_pPlayer->FireBulletsPlayer( 6, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); } - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSingleFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSingleFire, 0.0, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) // HEV suit - indicate out of ammo condition @@ -254,7 +254,7 @@ void CShotgun::SecondaryAttack( void ) vecDir = m_pPlayer->FireBulletsPlayer( 12, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); } - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usDoubleFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usDoubleFire, 0.0, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) // HEV suit - indicate out of ammo condition diff --git a/dlls/sound.cpp b/dlls/sound.cpp index 31037b8e..3d20f49b 100644 --- a/dlls/sound.cpp +++ b/dlls/sound.cpp @@ -1038,9 +1038,8 @@ void USENTENCEG_InitLRU( unsigned char *plru, int count ) int USENTENCEG_PickSequential( int isentenceg, char *szfound, int ipick, int freset ) { - char *szgroupname; + const char *szgroupname; unsigned char count; - char sznum[8]; if( !fSentencesInit ) return -1; @@ -1057,10 +1056,7 @@ int USENTENCEG_PickSequential( int isentenceg, char *szfound, int ipick, int fre if( ipick >= count ) ipick = count - 1; - strcpy( szfound, "!" ); - strcat( szfound, szgroupname ); - sprintf( sznum, "%d", ipick ); - strcat( szfound, sznum ); + sprintf( szfound, "!%s%d", szgroupname, ipick ); if( ipick >= count ) { @@ -1084,11 +1080,10 @@ int USENTENCEG_PickSequential( int isentenceg, char *szfound, int ipick, int fre int USENTENCEG_Pick( int isentenceg, char *szfound ) { - char *szgroupname; + const char *szgroupname; unsigned char *plru; unsigned char i; unsigned char count; - char sznum[8]; unsigned char ipick; int ffound = FALSE; @@ -1117,10 +1112,8 @@ int USENTENCEG_Pick( int isentenceg, char *szfound ) USENTENCEG_InitLRU( plru, count ); else { - strcpy( szfound, "!" ); - strcat( szfound, szgroupname ); - sprintf( sznum, "%d", ipick ); - strcat( szfound, sznum ); + sprintf( szfound, "!%s%d", szgroupname, ipick ); + return ipick; } } @@ -1228,7 +1221,6 @@ int SENTENCEG_PlaySequentialSz( edict_t *entity, const char *szgroupname, float void SENTENCEG_Stop( edict_t *entity, int isentenceg, int ipick ) { char buffer[64]; - char sznum[8]; if( !fSentencesInit ) return; @@ -1236,10 +1228,7 @@ void SENTENCEG_Stop( edict_t *entity, int isentenceg, int ipick ) if( isentenceg < 0 || ipick < 0 ) return; - strcpy( buffer, "!" ); - strcat( buffer, rgsentenceg[isentenceg].szgroupname ); - sprintf( sznum, "%d", ipick ); - strcat( buffer, sznum ); + sprintf( buffer, "!%s%d", rgsentenceg[isentenceg].szgroupname, ipick ); STOP_SOUND( entity, CHAN_VOICE, buffer ); } @@ -1370,9 +1359,8 @@ void SENTENCEG_Init() int SENTENCEG_Lookup( const char *sample, char *sentencenum ) { - char sznum[8]; - int i; + // this is a sentence name; lookup sentence number // and give to engine as string. for( i = 0; i < gcallsentences; i++ ) @@ -1380,9 +1368,7 @@ int SENTENCEG_Lookup( const char *sample, char *sentencenum ) { if( sentencenum ) { - strcpy( sentencenum, "!" ); - sprintf( sznum, "%d", i ); - strcat( sentencenum, sznum ); + sprintf(sentencenum, "!%d", i); } return i; } diff --git a/dlls/subs.cpp b/dlls/subs.cpp index 2a299ce4..e24a5c08 100644 --- a/dlls/subs.cpp +++ b/dlls/subs.cpp @@ -407,6 +407,13 @@ void CBaseToggle::LinearMove( Vector vecDest, float flSpeed ) // divide vector length by speed to get time to reach dest float flTravelTime = vecDestDelta.Length() / flSpeed; + if( flTravelTime < 0.05 ) + { + UTIL_SetOrigin( pev, m_vecFinalDest ); + LinearMoveDone(); + return; + } + // set nextthink to trigger a call to LinearMoveDone when dest is reached pev->nextthink = pev->ltime + flTravelTime; SetThink( &CBaseToggle::LinearMoveDone ); diff --git a/dlls/util.cpp b/dlls/util.cpp index df4a611b..f24833ed 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -1936,8 +1936,8 @@ void CSaveRestoreBuffer::BufferRewind( int size ) extern "C" { unsigned _rotr( unsigned val, int shift ) { - register unsigned lobit; /* non-zero means lo bit set */ - register unsigned num = val; /* number to rotate */ + unsigned lobit; /* non-zero means lo bit set */ + unsigned num = val; /* number to rotate */ shift &= 0x1f; /* modulo 32 -- this will also make negative shifts work */ diff --git a/dlls/util.h b/dlls/util.h index 1b1ce43a..8d30f387 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -553,8 +553,8 @@ void EMIT_GROUPNAME_SUIT(edict_t *entity, const char *groupname); #define RANDOM_SOUND_ARRAY( array ) (array) [ RANDOM_LONG(0,ARRAYSIZE( (array) )-1) ] -#define PLAYBACK_EVENT( flags, who, index ) PLAYBACK_EVENT_FULL( flags, who, index, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0 ); -#define PLAYBACK_EVENT_DELAY( flags, who, index, delay ) PLAYBACK_EVENT_FULL( flags, who, index, delay, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0 ); +#define PLAYBACK_EVENT( flags, who, index ) PLAYBACK_EVENT_FULL( flags, who, index, 0, g_vecZero, g_vecZero, 0.0, 0.0, 0, 0, 0, 0 ); +#define PLAYBACK_EVENT_DELAY( flags, who, index, delay ) PLAYBACK_EVENT_FULL( flags, who, index, delay, g_vecZero, g_vecZero, 0.0, 0.0, 0, 0, 0, 0 ); #define GROUP_OP_AND 0 #define GROUP_OP_NAND 1 diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 0ab75479..31ed9241 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -1649,7 +1649,7 @@ IMPLEMENT_SAVERESTORE( CEgon, CBasePlayerWeapon ) TYPEDESCRIPTION CHgun::m_SaveData[] = { - DEFINE_FIELD( CHgun, m_flRechargeTime, FIELD_FLOAT ), + DEFINE_FIELD( CHgun, m_flRechargeTime, FIELD_TIME ), }; IMPLEMENT_SAVERESTORE( CHgun, CBasePlayerWeapon ) diff --git a/dlls/wscript b/dlls/wscript new file mode 100644 index 00000000..05a7d002 --- /dev/null +++ b/dlls/wscript @@ -0,0 +1,72 @@ +#! /usr/bin/env python +# encoding: utf-8 +# a1batross, mittorn, 2018 + +from waflib import Utils +import os + +def options(opt): + # stub + return + +def configure(conf): + # stub + return + +def build(bld): + defines = [] + source = bld.path.parent.ant_glob([ + 'pm_shared/*.c', + ]) + + source += [ + 'agrunt.cpp', 'airtank.cpp', 'aflock.cpp', 'animating.cpp', 'animation.cpp', 'apache.cpp', + 'barnacle.cpp', 'barney.cpp', 'bigmomma.cpp', 'bloater.cpp', 'bmodels.cpp', 'bullsquid.cpp', 'buttons.cpp', + 'cbase.cpp', 'client.cpp', 'combat.cpp', 'controller.cpp', 'crossbow.cpp', 'crowbar.cpp', + 'defaultai.cpp', 'doors.cpp', + 'effects.cpp', 'egon.cpp', 'explode.cpp', + 'flyingmonster.cpp', 'func_break.cpp', 'func_tank.cpp', + 'game.cpp', 'gamerules.cpp', 'gargantua.cpp', 'gauss.cpp', 'genericmonster.cpp', 'ggrenade.cpp', 'globals.cpp', 'glock.cpp', 'gman.cpp', + 'h_ai.cpp', 'h_battery.cpp', 'h_cine.cpp', 'h_cycler.cpp', 'h_export.cpp', 'handgrenade.cpp', 'hassassin.cpp', 'headcrab.cpp', + 'healthkit.cpp', 'hgrunt.cpp', 'hornet.cpp', 'hornetgun.cpp', 'houndeye.cpp', + 'ichthyosaur.cpp', 'islave.cpp', 'items.cpp', + 'leech.cpp', 'lights.cpp', + 'maprules.cpp', 'monstermaker.cpp', 'monsters.cpp', 'monsterstate.cpp', 'mortar.cpp', 'mp5.cpp', 'multiplay_gamerules.cpp', + 'nihilanth.cpp', 'nodes.cpp', + 'observer.cpp', 'osprey.cpp', + 'pathcorner.cpp', 'plane.cpp', 'plats.cpp', 'player.cpp', 'playermonster.cpp', 'python.cpp', + 'rat.cpp', 'roach.cpp', 'rpg.cpp', + 'satchel.cpp', 'schedule.cpp', 'scientist.cpp', 'scripted.cpp', 'shotgun.cpp', 'singleplay_gamerules.cpp', 'skill.cpp', + 'sound.cpp', 'soundent.cpp', 'spectator.cpp', 'squadmonster.cpp', 'squeakgrenade.cpp', 'subs.cpp', + 'talkmonster.cpp', 'teamplay_gamerules.cpp', 'tempmonster.cpp', 'tentacle.cpp', + 'triggers.cpp', 'tripmine.cpp', 'turret.cpp', + 'util.cpp', + 'weapons.cpp', 'world.cpp', 'xen.cpp', 'zombie.cpp'] + + if bld.env.VOICEMGR: + source += bld.path.parent.ant_glob([ + 'game_shared/voice_gamemgr.cpp', + ]) + else: + defines += ['NO_VOICEGAMEMGR'] + + includes = Utils.to_list('. wpn_shared ../common ../engine ../pm_shared ../game_shared ../public') + + libs = [] + + if bld.env.DEST_OS2 not in ['android']: + install_path = os.path.join(bld.env.GAMEDIR, bld.env.SERVER_DIR) + else: + install_path = bld.env.PREFIX + + bld.shlib( + source = source, + target = 'server', + features = 'c cxx', + includes = includes, + defines = defines, + use = libs, + install_path = install_path, + subsystem = bld.env.MSVC_SUBSYSTEM, + idx = 2 + ) diff --git a/engine/cdll_int.h b/engine/cdll_int.h index abfc43bd..8ab903b0 100644 --- a/engine/cdll_int.h +++ b/engine/cdll_int.h @@ -169,7 +169,7 @@ typedef struct cl_enginefuncs_s int (*GetWindowCenterX)( void ); int (*GetWindowCenterY)( void ); void (*GetViewAngles)( float * ); - void (*SetViewAngles)( float * ); + void (*SetViewAngles)( const float * ); int (*GetMaxClients)( void ); void (*Cvar_SetValue)( const char *cvar, float value ); @@ -195,20 +195,20 @@ typedef struct cl_enginefuncs_s float (*GetClientTime)( void ); void (*V_CalcShake)( void ); - void (*V_ApplyShake)( float *origin, float *angles, float factor ); + void (*V_ApplyShake)( const float *origin, const float *angles, float factor ); - int (*PM_PointContents)( float *point, int *truecontents ); - int (*PM_WaterEntity)( float *p ); - struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe ); + int (*PM_PointContents)( const float *point, int *truecontents ); + int (*PM_WaterEntity)( const float *p ); + struct pmtrace_s *(*PM_TraceLine)( const float *start, const float *end, int flags, int usehull, int ignore_pe ); struct model_s *(*CL_LoadModel)( const char *modelname, int *index ); int (*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent ); const struct model_s* (*GetSpritePointer)( HSPRITE hSprite ); - void (*pfnPlaySoundByNameAtLocation)( const char *szSound, float volume, float *origin ); + void (*pfnPlaySoundByNameAtLocation)( const char *szSound, float volume, const float *origin ); unsigned short (*pfnPrecacheEvent)( int type, const char* psz ); - void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); + void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, const float *origin, const float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); void (*pfnWeaponAnim)( int iAnim, int body ); float (*pfnRandomFloat)( float flLow, float flHigh ); int (*pfnRandomLong)( int lLow, int lHigh ); diff --git a/engine/eiface.h b/engine/eiface.h index f6cf2f51..6a5f86fc 100644 --- a/engine/eiface.h +++ b/engine/eiface.h @@ -124,7 +124,7 @@ typedef struct enginefuncs_s int (*pfnWalkMove)( edict_t *ent, float yaw, float dist, int iMode ); void (*pfnSetOrigin)( edict_t *e, const float *rgflOrigin ); void (*pfnEmitSound)( edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch ); - void (*pfnEmitAmbientSound)( edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch ); + void (*pfnEmitAmbientSound)( edict_t *entity, const float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch ); void (*pfnTraceLine)( const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr ); void (*pfnTraceToss)( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr ); int (*pfnTraceMonsterHull)( edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr ); @@ -219,10 +219,10 @@ typedef struct enginefuncs_s void (*pfnSetPhysicsKeyValue)( const edict_t *pClient, const char *key, const char *value ); const char *(*pfnGetPhysicsInfoString)( const edict_t *pClient ); unsigned short (*pfnPrecacheEvent)( int type, const char*psz ); - void (*pfnPlaybackEvent)( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); - - unsigned char *(*pfnSetFatPVS)( float *org ); - unsigned char *(*pfnSetFatPAS)( float *org ); + void (*pfnPlaybackEvent)( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, const float *origin, const float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); + + unsigned char *(*pfnSetFatPVS)( const float *org ); + unsigned char *(*pfnSetFatPAS)( const float *org ); int (*pfnCheckVisibility )( const edict_t *entity, unsigned char *pset ); @@ -241,7 +241,7 @@ typedef struct enginefuncs_s // Forces the client and server to be running with the same version of the specified file // ( e.g., a player model ). // Calling this has no effect in single player - void (*pfnForceUnmodified)( FORCE_TYPE type, float *mins, float *maxs, const char *filename ); + void (*pfnForceUnmodified)( FORCE_TYPE type, const float *mins, const float *maxs, const char *filename ); void (*pfnGetPlayerStats)( const edict_t *pClient, int *ping, int *packet_loss ); @@ -355,7 +355,7 @@ typedef enum _fieldtypes FIELD_TYPECOUNT // MUST BE LAST } FIELDTYPE; -#if !defined(offsetof) && !defined(GNUC) +#if !defined(offsetof) && !defined(__GNUC__) #define offsetof(s,m) (size_t)&(((s *)0)->m) #endif diff --git a/gnu.txt b/gnu.txt deleted file mode 100644 index e587591e..00000000 --- a/gnu.txt +++ /dev/null @@ -1,621 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/scripts/waifulib/xcompile.py b/scripts/waifulib/xcompile.py new file mode 100644 index 00000000..3244a95a --- /dev/null +++ b/scripts/waifulib/xcompile.py @@ -0,0 +1,302 @@ +# encoding: utf-8 +# xcompile.py -- crosscompiling utils +# Copyright (C) 2018 a1batross +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +try: from fwgslib import get_flags_by_compiler +except: from waflib.extras.fwgslib import get_flags_by_compiler +from waflib import Logs +import os +import sys + +# Output: +# CROSSCOMPILING -- set to true, if crosscompiling is enabled +# DEST_OS2 -- as some operating systems is built on top of another, it's better to not change DEST_OS, +# instead of this DEST_OS2 is defined with target value +# For example: android is built on top of linux and have many things in common, +# but it can't be considered as default GNU/Linux. +# Possible values: +# DEST_OS2 DEST_OS +# 'android' 'linux' + +# This class does support ONLY r10e and r19c NDK +class Android: + ctx = None # waf context + arch = None + toolchain = None + api = None + toolchain_path = None + ndk_home = None + ndk_rev = 0 + is_hardfloat = False + clang = False + + def __init__(self, ctx, arch, toolchain, api): + self.ctx = ctx + for i in ['ANDROID_NDK_HOME', 'ANDROID_NDK']: + self.ndk_home = os.getenv(i) + if self.ndk_home != None: + break + + if not self.ndk_home: + conf.fatal('Set ANDROID_NDK_HOME environment variable pointing to the root of Android NDK!') + + # TODO: this were added at some point of NDK development + # but I don't know at which version + # r10e don't have it + source_prop = os.path.join(self.ndk_home, 'source.properties') + if os.path.exists(source_prop): + with open(source_prop) as ndk_props_file: + for line in ndk_props_file.readlines(): + tokens = line.split('=') + trimed_tokens = [token.strip() for token in tokens] + + if 'Pkg.Revision' in trimed_tokens: + self.ndk_rev = int(trimed_tokens[1].split('.')[0]) + else: + self.ndk_rev = 10 + + if self.ndk_rev not in [10, 19]: + ctx.fatal('Unknown NDK revision: {}'.format(self.ndk_rev)) + + self.arch = arch + if self.arch == 'armeabi-v7a-hard': + if self.ndk_rev <= 10: + self.arch = 'armeabi-v7a' # Only armeabi-v7a have hard float ABI + self.is_hardfloat = True + else: + raise Exception('NDK does not support hardfloat ABI') + + self.toolchain = toolchain + + if self.ndk_rev >= 19 or 'clang' in self.toolchain: + self.clang = True + + if self.is_arm64() or self.is_amd64() and self.api < 21: + Logs.warn('API level for 64-bit target automatically was set to 21') + self.api = 21 + elif self.ndk_rev >= 19 and self.api < 16: + Logs.warn('API level automatically was set to 16 due to NDK support') + self.api = 16 + else: self.api = api + self.toolchain_path = self.gen_toolchain_path() + + # TODO: Crystax support? + # TODO: Support for everything else than linux-x86_64? + # TODO: Determine if I actually need to implement listed above + + def is_arm(self): + ''' + Checks if selected architecture is **32-bit** ARM + ''' + return self.arch.startswith('armeabi') + + def is_x86(self): + ''' + Checks if selected architecture is **32-bit** or **64-bit** x86 + ''' + return self.arch == 'x86' + + def is_amd64(self): + ''' + Checks if selected architecture is **64-bit** x86 + ''' + return self.arch == 'x86_64' + + def is_arm64(self): + ''' + Checks if selected architecture is AArch64 + ''' + return self.arch == 'aarch64' + + def is_clang(self): + ''' + Checks if selected toolchain is Clang (TODO) + ''' + return self.clang + + def is_hardfp(self): + return self.is_hardfloat + + def gen_toolchain_path(self): + path = 'toolchains' + + if sys.platform.startswith('linux'): + toolchain_host = 'linux' + elif sys.platform.startswith('darwin'): + toolchain_host = 'darwin' + elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): + toolchain_host = 'windows' + else: raise Exception('Unsupported by NDK host platform') + + toolchain_host += '-' + + # Assuming we are building on x86 + if sys.maxsize > 2**32: + toolchain_host += 'x86_64' + else: toolchain_host += 'x86' + + if self.is_clang(): + if self.ndk_rev < 19: + raise Exception('Clang is not supported for this NDK') + + toolchain_folder = 'llvm' + + if self.is_x86(): + triplet = 'i686-linux-android{}-'.format(self.api) + elif self.is_arm(): + triplet = 'armv7a-linux-androideabi{}-'.format(self.api) + else: + triplet = self.arch + '-linux-android{}-'.format(self.api) + else: + if self.is_x86() or self.is_amd64(): + toolchain_folder = self.arch + '-' + self.toolchain + elif self.is_arm(): + toolchain_folder = 'arm-linux-androideabi-' + self.toolchain + else: + toolchain_folder = self.arch + '-linux-android-' + self.toolchain + + if self.is_x86(): + triplet = 'i686-linux-android-' + elif self.is_arm(): + triplet = 'arm-linux-androideabi-' + else: + triplet = self.arch + '-linux-android-' + + return os.path.join(path, toolchain_folder, 'prebuilt', toolchain_host, 'bin', triplet) + + def cc(self): + return os.path.abspath(os.path.join(self.ndk_home, self.toolchain_path + ('clang' if self.is_clang() else 'gcc'))) + + def cxx(self): + return os.path.abspath(os.path.join(self.ndk_home, self.toolchain_path + ('clang++' if self.is_clang() else 'g++'))) + + def system_stl(self): + # TODO: proper STL support + return os.path.abspath(os.path.join(self.ndk_home, 'sources', 'cxx-stl', 'system', 'include')) + + def sysroot(self): + if self.ndk_rev >= 19: + return os.path.abspath(os.path.join(self.ndk_home, 'sysroot')) + else: + arch = self.arch + if self.is_arm(): + arch = 'arm' + elif self.is_arm64(): + arch = 'arm64' + path = 'platforms/android-{}/arch-{}'.format(self.api, arch) + + return os.path.abspath(os.path.join(self.ndk_home, path)) + + def cflags(self): + cflags = ['--sysroot={0}'.format(self.sysroot()), '-DANDROID', '-D__ANDROID__'] + cflags += ['-I{0}'.format(self.system_stl())] + if self.is_arm(): + if self.arch == 'armeabi-v7a': + # ARMv7 support + cflags += ['-mthumb', '-mfpu=neon', '-mcpu=cortex-a9', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS', '-DVECTORIZE_SINCOS'] + if not self.is_clang(): + cflags += [ '-mvectorize-with-neon-quad' ] + if self.is_hardfloat: + cflags += ['-D_NDK_MATH_NO_SOFTFP=1', '-mhard-float', '-mfloat-abi=hard', '-DLOAD_HARDFP', '-DSOFTFP_LINK'] + else: + cflags += ['-mfloat-abi=softfp'] + else: + # ARMv5 support + cflags += ['-march=armv5te', '-mtune=xscale', '-msoft-float'] + elif self.is_x86(): + cflags += ['-mtune=atom', '-march=atom', '-mssse3', '-mfpmath=sse', '-DVECTORIZE_SINCOS', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS'] + return cflags + + # they go before object list + def linkflags(self): + linkflags = ['--sysroot={0}'.format(self.sysroot())] + return linkflags + + def ldflags(self): + ldflags = ['-lgcc', '-no-canonical-prefixes'] + if self.is_arm(): + if self.arch == 'armeabi-v7a': + ldflags += ['-march=armv7-a', '-Wl,--fix-cortex-a8', '-mthumb'] + if self.is_hardfloat: + ldflags += ['-Wl,--no-warn-mismatch', '-lm_hard'] + else: + ldflags += ['-march=armv5te'] + return ldflags + +def options(opt): + android = opt.add_option_group('Android options') + android.add_option('--android', action='store', dest='ANDROID_OPTS', default=None, + help='enable building for android, format: --android=,,, example: --android=armeabi-v7a-hard,4.9,9') + +def configure(conf): + if conf.options.ANDROID_OPTS: + values = conf.options.ANDROID_OPTS.split(',') + if len(values) != 3: + conf.fatal('Invalid --android paramater value!') + + valid_archs = ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'aarch64', 'mipsel', 'mips64el'] + + if values[0] not in valid_archs: + conf.fatal('Unknown arch: {}. Supported: {}'.format(values[0], ', '.join(valid_archs))) + + android = Android(conf, values[0], values[1], int(values[2])) + setattr(conf, 'android', android) + conf.environ['CC'] = android.cc() + conf.environ['CXX'] = android.cxx() + conf.env.CFLAGS += android.cflags() + conf.env.CXXFLAGS += android.cflags() + conf.env.LINKFLAGS += android.linkflags() + conf.env.LDFLAGS += android.ldflags() + + conf.env.HAVE_M = True + if android.is_hardfp(): + conf.env.LIB_M = ['m_hard'] + else: conf.env.LIB_M = ['m'] + + conf.env.PREFIX = '/lib/{}'.format(android.arch) + + conf.msg('Selected Android NDK', '{}, version: {}'.format(android.ndk_home, android.ndk_rev)) + # no need to print C/C++ compiler, as it would be printed by compiler_c/cxx + conf.msg('... C/C++ flags', ' '.join(android.cflags()).replace(android.ndk_home, '$NDK')) + conf.msg('... link flags', ' '.join(android.linkflags()).replace(android.ndk_home, '$NDK')) + conf.msg('... ld flags', ' '.join(android.ldflags()).replace(android.ndk_home, '$NDK')) + + # conf.env.ANDROID_OPTS = android + conf.env.DEST_OS2 = 'android' +# else: +# conf.load('compiler_c compiler_cxx') # Use host compiler :) + +def post_compiler_cxx_configure(conf): + if conf.options.ANDROID_OPTS: + if conf.android.ndk_rev >= 19: + conf.env.CXXFLAGS_cxxshlib += ['-static-libstdc++'] + conf.env.LDFLAGS_cxxshlib += ['-static-libstdc++'] + return + +def post_compiler_c_configure(conf): + return + +from waflib.Tools import compiler_cxx, compiler_c + +compiler_cxx_configure = getattr(compiler_cxx, 'configure') +compiler_c_configure = getattr(compiler_c, 'configure') + +def patch_compiler_cxx_configure(conf): + compiler_cxx_configure(conf) + post_compiler_cxx_configure(conf) + +def patch_compiler_c_configure(conf): + compiler_c_configure(conf) + post_compiler_c_configure(conf) + +setattr(compiler_cxx, 'configure', patch_compiler_cxx_configure) +setattr(compiler_c, 'configure', patch_compiler_c_configure) diff --git a/waf b/waf new file mode 100755 index 00000000..b35987aa --- /dev/null +++ b/waf @@ -0,0 +1,169 @@ +#!/usr/bin/env python +# encoding: latin-1 +# Thomas Nagy, 2005-2018 +# +""" +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +""" + +import os, sys, inspect + +VERSION="2.0.17" +REVISION="da8474e646911ac5657990d535080c54" +GIT="31da55afb92d9865019eb5193e874d1ffb86c522" +INSTALL='' +C1='#9' +C2='#3' +C3='#*' +cwd = os.getcwd() +join = os.path.join + + +WAF='waf' +def b(x): + return x +if sys.hexversion>0x300000f: + WAF='waf3' + def b(x): + return x.encode() + +def err(m): + print(('\033[91mError: %s\033[0m' % m)) + sys.exit(1) + +def unpack_wafdir(dir, src): + f = open(src,'rb') + c = 'corrupt archive (%d)' + while 1: + line = f.readline() + if not line: err('run waf-light from a folder containing waflib') + if line == b('#==>\n'): + txt = f.readline() + if not txt: err(c % 1) + if f.readline() != b('#<==\n'): err(c % 2) + break + if not txt: err(c % 3) + txt = txt[1:-1].replace(b(C1), b('\n')).replace(b(C2), b('\r')).replace(b(C3), b('\x00')) + + import shutil, tarfile + try: shutil.rmtree(dir) + except OSError: pass + try: + for x in ('Tools', 'extras'): + os.makedirs(join(dir, 'waflib', x)) + except OSError: + err("Cannot unpack waf lib into %s\nMove waf in a writable directory" % dir) + + os.chdir(dir) + tmp = 't.bz2' + t = open(tmp,'wb') + try: t.write(txt) + finally: t.close() + + try: + t = tarfile.open(tmp) + except: + try: + os.system('bunzip2 t.bz2') + t = tarfile.open('t') + tmp = 't' + except: + os.chdir(cwd) + try: shutil.rmtree(dir) + except OSError: pass + err("Waf cannot be unpacked, check that bzip2 support is present") + + try: + for x in t: t.extract(x) + finally: + t.close() + + for x in ('Tools', 'extras'): + os.chmod(join('waflib',x), 493) + + if sys.hexversion<0x300000f: + sys.path = [join(dir, 'waflib')] + sys.path + import fixpy2 + fixpy2.fixdir(dir) + + os.remove(tmp) + os.chdir(cwd) + + try: dir = unicode(dir, 'mbcs') + except: pass + try: + from ctypes import windll + windll.kernel32.SetFileAttributesW(dir, 2) + except: + pass + +def test(dir): + try: + os.stat(join(dir, 'waflib')) + return os.path.abspath(dir) + except OSError: + pass + +def find_lib(): + src = os.path.abspath(inspect.getfile(inspect.getmodule(err))) + base, name = os.path.split(src) + + #devs use $WAFDIR + w=test(os.environ.get('WAFDIR', '')) + if w: return w + + #waf-light + if name.endswith('waf-light'): + w = test(base) + if w: return w + err('waf-light requires waflib -> export WAFDIR=/folder') + + dirname = '%s-%s-%s' % (WAF, VERSION, REVISION) + for i in (INSTALL,'/usr','/usr/local','/opt'): + w = test(i + '/lib/' + dirname) + if w: return w + + #waf-local + dir = join(base, (sys.platform != 'win32' and '.' or '') + dirname) + w = test(dir) + if w: return w + + #unpack + unpack_wafdir(dir, src) + return dir + +wafdir = find_lib() +sys.path.insert(0, wafdir) + +if __name__ == '__main__': + sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scripts', 'waifulib')) + from waflib import Scripting + Scripting.waf_entry_point(cwd, VERSION, wafdir) + +#==> +#BZh91AY&SYL79u  8X0EbQ\{*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#3oKmCamvueJwt]Sf:lݶq:}S۹NNݺ7}ۡ{;RR]#9טͬ@aحٽy_>gv|axoyzw#*Ogmoޏl{3w|#*#*#*#*6>=#*N{r#*ݻaݭw+Z57:٦Im݅8F#9CMw#*DT#*"DPTzRJnT׽z>wsK+w*ۮ"jO[ppwcT>Jzz$cg׾ٻ)nmfl&vNkuuE۞R {7ZۮVm=zǽXztn9EQk^E@^G(c:uJKk/y˙zv>-5΃'#* {Ghν{{'$})#994Aq0vf[5vNͶ뾷zd.o}]ә}uCَ=)ƎN8r #*7zu_w}FzKsH(%;5IBklvv6ɗKݹY{ݞzoy(W7Uv#*#*&#*h{{^w}}EOp[;nøşj=ù ٯZP}Po5zSkiTsڽWivo#*V{ wl)NwGk^غ ؅#Y˛X.+7e}zmMWJ[p^tSt^{;{={v^&U!ܓ2#3ntX{8zkN{:>$ۭ;a}c:4#3=#*{tto;s(X;g:w4qoygl#9|ꁧ#*$=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ߔBЀ\O`YT6So]#*#,#*#0>7u?ǧJ3hE/ J>ƘՃLAW;x?/>??~Wv|ǿb?G_;Wg/?^|?@GT0##12ȞlC!ͫyH yp`J_s1P ABJaa0xùI I>T+h#*k;/EPC8;c"QY5xql(\8nLM͐7ے/gȿeGn⷇:j d|wjf#*s2k.\ĥ[#*(@A%7eCEP1 d:-**!$ = {6/ݳ>$ј:y|4}^v ,F*0 A:^"V;j0IԤLm Dж#94V$H35]uW@==Z<#*/Ti)lRe'C(#3ʔ:GوiWFrIP9f?D25ǻK*ABhQ?=$heiNe6Hdӆm迅#3|(4gF9vjoA)*0LceCOMdq."|-9g-]2%1 D6Ga!ZW9\ŭ҅t44lsV=ZX)5[}챯Am5lm+Um(oSF&Š^r{|:Ϊv m唰qp71Fgd7NOnNN"#'@xǹme#Rx.1&%ǕIGP _#9^4@$fR珗;NhGc \T=*|#*`( @"ڎ[n\٪-,fK{ok[_DH w٩?hb0=3Q2ˠm-8@d4VOk:,'ؑG7k dIV{ )"/(z.5La?l'M QhTPw>?gԿ_1v]igtt)͇{n8A=e<Ð1/s[)@G;WaNIC٩7aS p<3 R+R?wY"ScعBĎ{Dx|@{RA((Et'DS8&5\.2`þGv;hVV?7n<#DZAxm6x_H8ExRå .BPN1`#KCE.PZQ9h+i o5L{y*s< V1$AxmrTPSڗO Ou_ȬF/Y ?"(H&#* +#<== diff --git a/waf.bat b/waf.bat new file mode 100644 index 00000000..dac6143c --- /dev/null +++ b/waf.bat @@ -0,0 +1,101 @@ +@echo off + +rem try fix py2 build +chcp 1252 +set PYTHONIOENCODING=UTF-8 +rem from issue #964 + +Setlocal EnableDelayedExpansion + +rem Check Windows Version +set TOKEN=tokens=3* +ver | findstr /i "5\.0\." > nul +if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=3* +ver | findstr /i "5\.1\." > nul +if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=3* +ver | findstr /i "5\.2\." > nul +if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=3* +ver | findstr /i "6\.0\." > nul +if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=2* +ver | findstr /i "6\.1\." > nul +if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=2* + +rem Start calculating PYTHON and PYTHON_DIR +set PYTHON= +set PYTHON_DIR= + +Setlocal EnableDelayedExpansion + +set PYTHON_DIR_OK=FALSE +set REGPATH= + +for %%i in (3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5) do ( +for %%j in (HKCU HKLM) do ( +for %%k in (SOFTWARE\Wow6432Node SOFTWARE) do ( +for %%l in (Python\PythonCore IronPython) do ( +set REG_PYTHON_EXE=python.exe +if "%%l"=="IronPython" ( +set REG_PYTHON_EXE=ipy.exe +) + +@echo on + +set REGPATH=%%j\%%k\%%l\%%i\InstallPath +rem @echo Regpath !REGPATH! +REG QUERY "!REGPATH!" /ve 1>nul 2>nul +if !ERRORLEVEL! equ 0 ( + for /F "%TOKEN% delims= " %%A IN ('REG QUERY "!REGPATH!" /ve') do @set REG_PYTHON_DIR=%%B + if exist !REG_PYTHON_DIR! ( + IF NOT "!REG_PYTHON_DIR:~-1!"=="\" SET REG_PYTHON_DIR=!REG_PYTHON_DIR!\ + set REG_PYTHON=!REG_PYTHON_DIR!!REG_PYTHON_EXE! + rem set PYTHON_DIR_OK=TRUE + if "!PYTHON_DIR_OK!"=="FALSE" ( + set PYTHON_DIR=!REG_PYTHON_DIR! + set PYTHON=!REG_PYTHON! + set PYTHON_DIR_OK=TRUE + ) + + rem set PYTHON_DIR_OK=FALSE + rem @echo Find !REG_PYTHON! + rem goto finished + ) +) + +echo off + +) +rem for l +) +rem for k +) +rem for j +) +rem for i + + + +:finished + +Endlocal & SET PYTHON_DIR=%PYTHON_DIR% & SET PYTHON=%PYTHON% + +if "%PYTHON_DIR%" == "" ( +rem @echo No Python dir +set PYTHON=python +goto running +) + +rem @echo %PYTHON_DIR% + +if "%PYTHON%" == "" ( +rem @echo No Python +set PYTHON=python +goto running +) + +:running + +@echo Using %PYTHON% + +"%PYTHON%" -x "%~dp0waf" %* +Endlocal +exit /b %ERRORLEVEL% diff --git a/wscript b/wscript new file mode 100644 index 00000000..ede9efa4 --- /dev/null +++ b/wscript @@ -0,0 +1,160 @@ +#! /usr/bin/env python +# encoding: utf-8 +# a1batross, mittorn, 2018 + +from __future__ import print_function +from waflib import Logs +import sys +import os +sys.path.append(os.path.realpath('scripts/waflib')) + +VERSION = '2.4' +APPNAME = 'hlsdk-xash3d' +top = '.' + +def options(opt): + grp = opt.add_option_group('Common options') + + grp.add_option('-T', '--build-type', action='store', dest='BUILD_TYPE', default = None, + help = 'build type: debug, release or none(custom flags)') + + grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False, + help = 'allow targetting 64-bit game dlls') + + grp.add_option('--enable-voicemgr', action = 'store_true', dest = 'VOICEMGR', default = False, + help = 'enable voice manager') + + grp.add_option('--enable-goldsrc-support', action = 'store_true', dest = 'GOLDSRC', default = False, + help = 'enable GoldSource engine support') + + opt.recurse('cl_dll dlls') + + opt.load('xcompile compiler_cxx compiler_c') + if sys.platform == 'win32': + opt.load('msvc msdev') + opt.load('reconfigure') + + +def configure(conf): + # Configuration + conf.env.GAMEDIR = 'valve' + conf.env.CLIENT_DIR = 'cl_dlls' + conf.env.SERVER_DIR = 'dlls' + conf.env.SERVER_NAME = 'hl' + conf.env.PREFIX = '' + + conf.load('reconfigure') + + conf.start_msg('Build type') + if conf.options.BUILD_TYPE == None: + conf.end_msg('not set', color='RED') + conf.fatal('Please set a build type, for example "-T release"') + elif not conf.options.BUILD_TYPE in ['fast', 'release', 'debug', 'nooptimize', 'sanitize', 'none']: + conf.end_msg(conf.options.BUILD_TYPE, color='RED') + conf.fatal('Invalid build type. Valid are "debug", "release" or "none"') + conf.end_msg(conf.options.BUILD_TYPE) + + # -march=native should not be used + if conf.options.BUILD_TYPE == 'fast': + Logs.warn('WARNING: \'fast\' build type should not be used in release builds') + + conf.env.VOICEMGR = conf.options.VOICEMGR + conf.env.GOLDSRC = conf.options.GOLDSRC + + # Force XP compability, all build targets should add + # subsystem=bld.env.MSVC_SUBSYSTEM + # TODO: wrapper around bld.stlib, bld.shlib and so on? + conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01' + conf.env.MSVC_TARGETS = ['x86'] # explicitly request x86 target for MSVC + if sys.platform == 'win32': + conf.load('msvc msdev') + conf.load('xcompile compiler_c compiler_cxx') + + if conf.env.DEST_OS2 == 'android': + conf.options.ALLOW64 = True + conf.options.GOLDSRC = False + conf.env.SERVER_NAME = 'server' # can't be any other name, until specified + + # print(conf.options.ALLOW64) + + conf.env.BIT32_MANDATORY = not conf.options.ALLOW64 + conf.env.BIT32_ALLOW64 = conf.options.ALLOW64 + conf.load('force_32bit') + + if conf.env.DEST_SIZEOF_VOID_P == 4: + Logs.info('NOTE: will build game dlls for 32-bit target') + else: + Logs.warn('WARNING: 64-bit game dlls may be unstable') + + linker_flags = { + 'common': { + 'msvc': ['/DEBUG'], # always create PDB, doesn't affect result binaries + 'gcc': ['-Wl,--no-undefined'] + }, + 'sanitize': { + 'gcc': ['-fsanitize=undefined', '-fsanitize=address'], + } + } + + compiler_c_cxx_flags = { + 'common': { + 'msvc': ['/D_USING_V110_SDK71_', '/Zi', '/FS'], + 'clang': ['-g', '-gdwarf-2'], + 'gcc': ['-g', '-Werror=implicit-function-declaration', '-fdiagnostics-color=always'] + }, + 'fast': { + 'msvc': ['/O2', '/Oy'], #todo: check /GL /LTCG + 'gcc': ['-Ofast', '-march=native', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer'], + 'default': ['-O3'] + }, + 'release': { + 'msvc': ['/O2'], + 'default': ['-O3'] + }, + 'debug': { + 'msvc': ['/O1'], + 'gcc': ['-Og'], + 'default': ['-O1'] + }, + 'sanitize': { + 'msvc': ['/Od', '/RTC1'], + 'gcc': ['-Og', '-fsanitize=undefined', '-fsanitize=address'], + 'default': ['-O1'] + }, + 'nooptimize': { + 'msvc': ['/Od'], + 'default': ['-O0'] + } + } + + conf.env.append_unique('CFLAGS', conf.get_flags_by_type( + compiler_c_cxx_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC)) + conf.env.append_unique('CXXFLAGS', conf.get_flags_by_type( + compiler_c_cxx_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC)) + conf.env.append_unique('LINKFLAGS', conf.get_flags_by_type( + linker_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC)) + + if conf.env.COMPILER_CC == 'msvc': + conf.env.append_unique('DEFINES', ['_CRT_SECURE_NO_WARNINGS','_CRT_NONSTDC_NO_DEPRECATE']) + else: + conf.env.append_unique('DEFINES', ['stricmp=strcasecmp','strnicmp=strncasecmp','_LINUX','LINUX','_snprintf=snprintf','_vsnprintf=vsnprintf']) + cflags = ['-fvisibility=hidden','-Wno-write-strings'] + conf.env.append_unique('CFLAGS', cflags) + conf.env.append_unique('CXXFLAGS', cflags + ['-Wno-invalid-offsetof', '-fno-rtti', '-fno-exceptions']) + + # strip lib from pattern + if conf.env.DEST_OS in ['linux', 'darwin'] and conf.env.DEST_OS2 not in ['android']: + if conf.env.cshlib_PATTERN.startswith('lib'): + conf.env.cshlib_PATTERN = conf.env.cshlib_PATTERN[3:] + if conf.env.cxxshlib_PATTERN.startswith('lib'): + conf.env.cxxshlib_PATTERN = conf.env.cxxshlib_PATTERN[3:] + + conf.env.append_unique('DEFINES', 'CLIENT_WEAPONS') + + conf.recurse('cl_dll dlls') + +def build(bld): + bld.recurse('cl_dll dlls') + + +