Browse Source

Merge branch 'master' into residual_point

residual_point
Night Owl 7 years ago
parent
commit
c37728214c
  1. 42
      CMakeLists.txt
  2. 6
      README.md
  3. 28
      appveyor.yml
  4. 2
      cl_dll/Android.mk
  5. 7
      cl_dll/CMakeLists.txt
  6. 41
      cl_dll/ev_hldm.cpp
  7. 1
      cl_dll/health.cpp
  8. 25
      cl_dll/hl/hl_objects.cpp
  9. 2
      cl_dll/hl/hl_weapons.cpp
  10. 3
      cl_dll/hud.cpp
  11. 2
      cl_dll/hud.h
  12. 16
      cl_dll/hud_msg.cpp
  13. 2
      cl_dll/input_goldsource.cpp
  14. 2
      cl_dll/scoreboard.cpp
  15. 8
      cl_dll/text_message.cpp
  16. 29
      cmake/VSForceXPToolchain.cmake
  17. 7
      dlls/CMakeLists.txt
  18. 2
      dlls/cbase.h
  19. 4
      dlls/client.cpp
  20. 3
      dlls/monsters.cpp
  21. 20
      dlls/player.cpp

42
CMakeLists.txt

@ -21,17 +21,25 @@
# #
cmake_minimum_required(VERSION 2.6.0) cmake_minimum_required(VERSION 2.6.0)
# Install custom module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
include(VSForceXPToolchain) # Force XP toolchain for Visual Studio
project (HLSDK-XASH3D) project (HLSDK-XASH3D)
#-------------- #--------------
# USER DEFINES \ # USER DEFINES \
################\ ################\
option(64BIT "Allow 64 Bit builds" OFF)
option(USE_VGUI "Enable VGUI1. UNDONE" OFF) option(USE_VGUI "Enable VGUI1. UNDONE" OFF)
option(USE_VGUI2 "Enable VGUI2. UNDONE" OFF) option(USE_VGUI2 "Enable VGUI2. UNDONE" OFF)
option(USE_VOICEMGR "Enable VOICE MANAGER." OFF) option(USE_VOICEMGR "Enable VOICE MANAGER." OFF)
option(BUILD_CLIENT "Build client dll" ON) option(BUILD_CLIENT "Build client dll" ON)
option(BUILD_SERVER "Build server dll" ON) option(BUILD_SERVER "Build server dll" ON)
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF) option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF)
option(64BIT "Disable auto -m32 appending to compiler flags" OFF)
set(GAMEDIR "valve" CACHE STRING "Gamedir path") set(GAMEDIR "valve" CACHE STRING "Gamedir path")
set(SERVER_INSTALL_DIR "dlls" CACHE STRING "Where put server dll") set(SERVER_INSTALL_DIR "dlls" CACHE STRING "Where put server dll")
set(CLIENT_INSTALL_DIR "cl_dlls" CACHE STRING "Where put client dll") set(CLIENT_INSTALL_DIR "cl_dlls" CACHE STRING "Where put client dll")
@ -43,25 +51,35 @@ set(SERVER_LIBRARY_NAME "hl" CACHE STRING "Library name for Linux/MacOS/Windows"
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
# Build 32-bit Xash on 64-bit, because Xash3D not support this if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT 64BIT)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
if(MSVC) if(MSVC)
error("UNDONE: set 32 build flags") error("UNDONE: set 32 build flags")
else() else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
endif() endif()
set(CMAKE_SIZEOF_VOID_P 4)
endif()
if(64BIT AND CMAKE_SIZEOF_VOID_P EQUAL 4)
message(FATAL_ERROR "You enabled XASH_64BIT, but compiler can't create 64 bit code!")
endif()
if(64BIT)
message(STATUS "Building for 64 Bit")
else()
message(STATUS "Building for 32 Bit")
endif() endif()
# add_compile_options for older cmake versions # add_compile_options for older cmake versions
if(${CMAKE_VERSION} VERSION_LESS "3.0.2") if(${CMAKE_VERSION} VERSION_LESS "3.0.2")
macro(add_compile_options) macro(add_compile_options)
set(list_var "${ARGV}") set(list_var "${ARGV}")
foreach(arg IN LISTS list_var) foreach(arg IN LISTS list_var)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${arg}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${arg}")
endforeach() endforeach()
endmacro() endmacro()
endif() endif()
if(BUILD_CLIENT) if(BUILD_CLIENT)

6
README.md

@ -1,4 +1,4 @@
# Half-Life SDK for Xash3D [![Build Status](https://travis-ci.org/FWGS/hlsdk-xash3d.svg)](https://travis-ci.org/FWGS/hlsdk-xash3d) # Half-Life SDK for Xash3D [![Build Status](https://travis-ci.org/FWGS/hlsdk-xash3d.svg)](https://travis-ci.org/FWGS/hlsdk-xash3d) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-xash3d?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-xash3d)
Half-Life SDK for Xash3D & GoldSource with some fixes. Half-Life SDK for Xash3D & GoldSource with some fixes.
@ -31,7 +31,7 @@ These scripts also can be ran via wine:
The libraries built this way are always GoldSource compatible. The libraries built this way are always GoldSource compatible.
There're dsp projects for MVS 6 in `cl_dll` and `dlls` directories, but we don't keep them up-to-date. You're free to adapt them for yourself and try to import into the newer MVS versions. There're dsp projects for Visual Studio 6 in `cl_dll` and `dlls` directories, but we don't keep them up-to-date. You're free to adapt them for yourself and try to import into the newer Visual Studio versions.
#### Using mingw #### Using mingw
@ -44,7 +44,7 @@ TODO
### OS X ### OS X
TODO Nothing here.
### FreeBSD ### FreeBSD

28
appveyor.yml

@ -0,0 +1,28 @@
version: 1.0.{build}
branches:
only:
- master
environment:
matrix:
- os: Visual Studio 2013
GENERATOR_NAME: "Visual Studio 12 2013"
- os: Visual Studio 2015
GENERATOR_NAME: "Visual Studio 14 2015"
# TODO: Uncomment when AppVeyor will provide XP toolchain for VS2017
# - os: Visual Studio 2017
# GENERATOR_NAME: "Visual Studio 15 2017"
clone_folder: c:\projects\xash\hlsdk-xash3d
build:
project: INSTALL.vcxproj
verbosity: normal
configuration:
- Debug
before_build:
- git submodule update --init --recursive
- cmake -G "%GENERATOR_NAME%"

2
cl_dll/Android.mk

@ -93,7 +93,7 @@ SRCS+=./scoreboard.cpp
SRCS+=./MOTD.cpp SRCS+=./MOTD.cpp
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls -I../utils/false_vgui/include INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls -I../utils/false_vgui/include
DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -DCROWBAR_IDLE_ANIM -w DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -DCROWBAR_IDLE_ANIM -w -D_snprintf=snprintf
LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \ LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
$(LOCAL_PATH)/../common \ $(LOCAL_PATH)/../common \

7
cl_dll/CMakeLists.txt

@ -124,8 +124,13 @@ set_target_properties (${CLDLL_LIBRARY} PROPERTIES
POSITION_INDEPENDENT_CODE 1) POSITION_INDEPENDENT_CODE 1)
if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(CLDLL_NAME "client")
if(64BIT)
set(CLDLL_NAME "client64")
endif()
set_target_properties(${CLDLL_LIBRARY} PROPERTIES set_target_properties(${CLDLL_LIBRARY} PROPERTIES
OUTPUT_NAME "client" OUTPUT_NAME ${CLDLL_NAME}
PREFIX "") PREFIX "")
endif() endif()

41
cl_dll/ev_hldm.cpp

@ -1414,6 +1414,17 @@ enum EGON_FIREMODE
BEAM *pBeam; BEAM *pBeam;
BEAM *pBeam2; BEAM *pBeam2;
TEMPENTITY *pFlare; // Vit_amiN: egon's beam flare
void EV_EgonFlareCallback( struct tempent_s *ent, float frametime, float currenttime )
{
float delta = currenttime - ent->tentOffset.z; // time past since the last scale
if( delta >= ent->tentOffset.y )
{
ent->entity.curstate.scale += ent->tentOffset.x * delta;
ent->tentOffset.z = currenttime;
}
}
void EV_EgonFire( event_args_t *args ) void EV_EgonFire( event_args_t *args )
{ {
@ -1451,7 +1462,7 @@ void EV_EgonFire( event_args_t *args )
if( EV_IsLocal( idx ) ) if( EV_IsLocal( idx ) )
gEngfuncs.pEventAPI->EV_WeaponAnimation( g_fireAnims1[gEngfuncs.pfnRandomLong( 0, 3 )], 1 ); gEngfuncs.pEventAPI->EV_WeaponAnimation( g_fireAnims1[gEngfuncs.pfnRandomLong( 0, 3 )], 1 );
if( iStartup == 1 && EV_IsLocal( idx ) && !pBeam && !pBeam2 && cl_lw->value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction. if( iStartup == 1 && EV_IsLocal( idx ) && !( pBeam || pBeam2 || pFlare ) && cl_lw->value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction.
{ {
vec3_t vecSrc, vecEnd, angles, forward, right, up; vec3_t vecSrc, vecEnd, angles, forward, right, up;
pmtrace_t tr; pmtrace_t tr;
@ -1499,8 +1510,16 @@ void EV_EgonFire( event_args_t *args )
pBeam->flags |= ( FBEAM_SINENOISE ); pBeam->flags |= ( FBEAM_SINENOISE );
pBeam2 = gEngfuncs.pEfxAPI->R_BeamEntPoint( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 5.0, 0.08, 0.7, 25, 0, 0, r, g, b ); pBeam2 = gEngfuncs.pEfxAPI->R_BeamEntPoint( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 5.0, 0.08, 0.7, 25, 0, 0, r, g, b );
// Vit_amiN: egon beam flare
pFlare = gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 1.0, gEngfuncs.pEventAPI->EV_FindModelIndex( EGON_FLARE_SPRITE ), kRenderGlow, kRenderFxNoDissipation, 1.0, 99999, FTENT_SPRCYCLE | FTENT_PERSIST );
} }
} }
if( pFlare ) // Vit_amiN: store the last mode for EV_EgonStop()
{
pFlare->tentOffset.x = ( iFireMode == FIRE_WIDE ) ? 1.0f : 0.0f;
}
} }
void EV_EgonStop( event_args_t *args ) void EV_EgonStop( event_args_t *args )
@ -1529,6 +1548,26 @@ void EV_EgonStop( event_args_t *args )
pBeam2->die = 0.0; pBeam2->die = 0.0;
pBeam2 = NULL; pBeam2 = NULL;
} }
if( pFlare ) // Vit_amiN: egon beam flare
{
pFlare->die = gEngfuncs.GetClientTime();
if( gEngfuncs.GetMaxClients() == 1 || !(pFlare->flags & FTENT_NOMODEL) )
{
if( pFlare->tentOffset.x != 0.0f ) // true for iFireMode == FIRE_WIDE
{
pFlare->callback = &EV_EgonFlareCallback;
pFlare->fadeSpeed = 2.0; // fade out will take 0.5 sec
pFlare->tentOffset.x = 10.0; // scaling speed per second
pFlare->tentOffset.y = 0.1; // min time between two scales
pFlare->tentOffset.z = pFlare->die; // the last callback run time
pFlare->flags = FTENT_FADEOUT | FTENT_CLIENTCUSTOM;
}
}
pFlare = NULL;
}
} }
} }
//====================== //======================

1
cl_dll/health.cpp

@ -231,7 +231,6 @@ int CHudHealth::Draw( float flTime )
int iHeight = gHUD.m_iFontHeight; int iHeight = gHUD.m_iFontHeight;
int iWidth = HealthWidth / 10; int iWidth = HealthWidth / 10;
UnpackRGB( r, g, b, RGB_YELLOWISH ); UnpackRGB( r, g, b, RGB_YELLOWISH );
FillRGBA( x, y, iWidth, iHeight, r, g, b, a ); FillRGBA( x, y, iWidth, iHeight, r, g, b, a );
} }

25
cl_dll/hl/hl_objects.cpp

@ -29,6 +29,7 @@
extern BEAM *pBeam; extern BEAM *pBeam;
extern BEAM *pBeam2; extern BEAM *pBeam2;
extern TEMPENTITY *pFlare; // Vit_amiN: egon's energy flare
void HUD_GetLastOrg( float *org ); void HUD_GetLastOrg( float *org );
void UpdateBeams( void ) void UpdateBeams( void )
@ -75,6 +76,28 @@ void UpdateBeams( void )
pBeam2->target = tr.endpos; pBeam2->target = tr.endpos;
pBeam2->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case. pBeam2->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
} }
if( pFlare ) // Vit_amiN: beam flare
{
pFlare->entity.origin = tr.endpos;
pFlare->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
if( gEngfuncs.GetMaxClients() != 1 ) // Singleplayer always draws the egon's energy beam flare
{
pFlare->flags |= FTENT_NOMODEL;
if( !( tr.allsolid || tr.ent <= 0 || tr.fraction == 1.0 ) ) // Beam hit some non-world entity
{
physent_t *pEntity = gEngfuncs.pEventAPI->EV_GetPhysent( tr.ent );
// Not the world, let's assume that we hit something organic ( dog, cat, uncle joe, etc )
if( pEntity && !( pEntity->solid == SOLID_BSP || pEntity->movetype == MOVETYPE_PUSHSTEP ) )
{
pFlare->flags &= ~FTENT_NOMODEL;
}
}
}
}
} }
/* /*
@ -86,6 +109,6 @@ Add game specific, client-side objects here
*/ */
void Game_AddObjects( void ) void Game_AddObjects( void )
{ {
if( pBeam && pBeam2 ) if( pBeam || pBeam2 || pFlare ) // Vit_amiN: egon flare added
UpdateBeams(); UpdateBeams();
} }

2
cl_dll/hl/hl_weapons.cpp

@ -34,6 +34,7 @@
extern globalvars_t *gpGlobals; extern globalvars_t *gpGlobals;
extern int g_iUser1; extern int g_iUser1;
extern bool g_hasPredictedFOV; // Vit_amiN: from HUD
// Pool of client side entities/entvars_t // Pool of client side entities/entvars_t
static entvars_t ev[32]; static entvars_t ev[32];
@ -881,6 +882,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
to->client.fuser2 = player.m_flNextAmmoBurn; to->client.fuser2 = player.m_flNextAmmoBurn;
to->client.fuser3 = player.m_flAmmoStartCharge; to->client.fuser3 = player.m_flAmmoStartCharge;
to->client.maxspeed = player.pev->maxspeed; to->client.maxspeed = player.pev->maxspeed;
g_hasPredictedFOV = true; // Vit_amiN: ready
//HL Weapons //HL Weapons
to->client.vuser1[0] = player.ammo_9mm; to->client.vuser1[0] = player.ammo_9mm;

3
cl_dll/hud.cpp

@ -413,6 +413,7 @@ int CHud::MsgFunc_Logo( const char *pszName, int iSize, void *pbuf )
} }
float g_lastFOV = 0.0; float g_lastFOV = 0.0;
bool g_hasPredictedFOV = false; // Vit_amiN: it'll became true after the first prediction
/* /*
============ ============
@ -514,7 +515,7 @@ int CHud::MsgFunc_SetFOV( const char *pszName, int iSize, void *pbuf )
int def_fov = CVAR_GET_FLOAT( "default_fov" ); int def_fov = CVAR_GET_FLOAT( "default_fov" );
//Weapon prediction already takes care of changing the fog. ( g_lastFOV ). //Weapon prediction already takes care of changing the fog. ( g_lastFOV ).
if( cl_lw && cl_lw->value ) if( g_hasPredictedFOV )
return 1; return 1;
g_lastFOV = newfov; g_lastFOV = newfov;

2
cl_dll/hud.h

@ -231,7 +231,7 @@ public:
void InitHUDData( void ); void InitHUDData( void );
int VidInit( void ); int VidInit( void );
int Draw( float flTime ); int Draw( float flTime );
int DrawPlayers( int xoffset, float listslot, int nameoffset = 0, char *team = NULL ); // returns the ypos where it finishes drawing int DrawPlayers( int xoffset, float listslot, int nameoffset = 0, const char *team = NULL ); // returns the ypos where it finishes drawing
void UserCmd_ShowScores( void ); void UserCmd_ShowScores( void );
void UserCmd_HideScores( void ); void UserCmd_HideScores( void );
int MsgFunc_ScoreInfo( const char *pszName, int iSize, void *pbuf ); int MsgFunc_ScoreInfo( const char *pszName, int iSize, void *pbuf );

16
cl_dll/hud_msg.cpp

@ -25,6 +25,10 @@
extern BEAM *pBeam; extern BEAM *pBeam;
extern BEAM *pBeam2; extern BEAM *pBeam2;
extern TEMPENTITY *pFlare; // Vit_amiN
extern float g_lastFOV; // Vit_amiN
extern bool g_hasPredictedFOV; // Vit_amiN
/// USER-DEFINED SERVER MESSAGE HANDLERS /// USER-DEFINED SERVER MESSAGE HANDLERS
@ -48,6 +52,11 @@ int CHud::MsgFunc_ResetHUD( const char *pszName, int iSize, void *pbuf )
// reset concussion effect // reset concussion effect
m_iConcussionEffect = 0; m_iConcussionEffect = 0;
// Vit_amiN: reset the FOV
m_iFOV = 0; // default_fov
g_lastFOV = 0.0f;
g_hasPredictedFOV = false;
return 1; return 1;
} }
@ -72,6 +81,7 @@ void CHud::MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
//Probably not a good place to put this. //Probably not a good place to put this.
pBeam = pBeam2 = NULL; pBeam = pBeam2 = NULL;
pFlare = NULL; // Vit_amiN: clear egon's beam flare
} }
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf ) int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
@ -107,10 +117,14 @@ int CHud::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
int CHud::MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf ) int CHud::MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
{ {
int r, g, b;
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
m_iConcussionEffect = READ_BYTE(); m_iConcussionEffect = READ_BYTE();
if( m_iConcussionEffect ) if( m_iConcussionEffect )
this->m_StatusIcons.EnableIcon( "dmg_concuss", 255, 160, 0 ); {
UnpackRGB( r, g, b, RGB_YELLOWISH ); // Vit_amiN: fixed
this->m_StatusIcons.EnableIcon( "dmg_concuss", r, g, b );
}
else else
this->m_StatusIcons.DisableIcon( "dmg_concuss" ); this->m_StatusIcons.DisableIcon( "dmg_concuss" );
return 1; return 1;

2
cl_dll/input_goldsource.cpp

@ -1368,7 +1368,7 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
// y=ax^b; where a = 300 and b = 1.3 // y=ax^b; where a = 300 and b = 1.3
// also x values are in increments of 800 (so this is factored out) // also x values are in increments of 800 (so this is factored out)
// then bounds check result to level out excessively high spin rates // then bounds check result to level out excessively high spin rates
fTemp = 300.0 * pow(abs(fAxisValue) / 800.0, 1.3); fTemp = 300.0 * pow(fabs(fAxisValue) / 800.0, 1.3);
if (fTemp > 14000.0) if (fTemp > 14000.0)
fTemp = 14000.0; fTemp = 14000.0;
// restore direction information // restore direction information

2
cl_dll/scoreboard.cpp

@ -337,7 +337,7 @@ int CHudScoreboard::Draw( float fTime )
extern float *GetClientColor( int client ); extern float *GetClientColor( int client );
// returns the ypos where it finishes drawing // returns the ypos where it finishes drawing
int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, char *team ) int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, const char *team )
{ {
int can_show_packetloss = 0; int can_show_packetloss = 0;
int FAR_RIGHT; int FAR_RIGHT;

8
cl_dll/text_message.cpp

@ -181,20 +181,20 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf
switch( msg_dest ) switch( msg_dest )
{ {
case HUD_PRINTCENTER: case HUD_PRINTCENTER:
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] ); _snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
CenterPrint( ConvertCRtoNL( psz ) ); CenterPrint( ConvertCRtoNL( psz ) );
break; break;
case HUD_PRINTNOTIFY: case HUD_PRINTNOTIFY:
psz[0] = 1; // mark this message to go into the notify buffer psz[0] = 1; // mark this message to go into the notify buffer
snprintf( psz + 1, MSG_BUF_SIZE - 1, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] ); _snprintf( psz + 1, MSG_BUF_SIZE - 1, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
ConsolePrint( ConvertCRtoNL( psz ) ); ConsolePrint( ConvertCRtoNL( psz ) );
break; break;
case HUD_PRINTTALK: case HUD_PRINTTALK:
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] ); _snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), MSG_BUF_SIZE ); gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), MSG_BUF_SIZE );
break; break;
case HUD_PRINTCONSOLE: case HUD_PRINTCONSOLE:
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] ); _snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
ConsolePrint( ConvertCRtoNL( psz ) ); ConsolePrint( ConvertCRtoNL( psz ) );
break; break;
} }

29
cmake/VSForceXPToolchain.cmake

@ -0,0 +1,29 @@
if(WIN32)
# Windows XP compatible platform toolset. Must be set before project(),
# otherwise change of CMAKE_*_TOOLSET will take no effect.
# We get VS version from the generator name because neither MSVC* nor other
# variables that describe the compiler aren't available before project().
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)")
if(${CMAKE_MATCH_1} LESS 11)
# Nothing. Older VS does support XP by default.
elseif(${CMAKE_MATCH_1} EQUAL 11)
# Visual Studio 11 2012
set(CMAKE_GENERATOR_TOOLSET "v110_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
set(CMAK_VS_PLATFORM_TOOLSET "v110_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
elseif (${CMAKE_MATCH_1} EQUAL 12)
# Visual Studio 12 2013
set(CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
set(CMAKE_VS_PLATFORM_TOOLSET "v120_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
elseif (${CMAKE_MATCH_1} EQUAL 14)
# Visual Studio 14 2015
set(CMAKE_GENERATOR_TOOLSET "v140_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
set(CMAKE_VS_PLATFORM_TOOLSET "v140_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
elseif (${CMAKE_MATCH_1} EQUAL 15)
# Visual Studio 15 2017
set(CMAKE_GENERATOR_TOOLSET "v141_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
set(CMAKE_VS_PLATFORM_TOOLSET "v141_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
else()
message(WARNING "WARNING: You maybe building without Windows XP compability. See which toolchain version Visual Studio provides, and say cmake to use it: cmake -G \"Visual Studio XX\" -T \"vXXX_xp\"")
endif()
endif()
endif()

7
dlls/CMakeLists.txt

@ -166,8 +166,13 @@ set_target_properties (${SVDLL_LIBRARY} PROPERTIES
POSITION_INDEPENDENT_CODE 1) POSITION_INDEPENDENT_CODE 1)
if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(SVDLL_NAME "${SERVER_LIBRARY_NAME}")
if(64BIT)
set(SVDLL_NAME "${SERVER_LIBRARY_NAME}64")
endif()
set_target_properties(${SVDLL_LIBRARY} PROPERTIES set_target_properties(${SVDLL_LIBRARY} PROPERTIES
OUTPUT_NAME ${SERVER_LIBRARY_NAME} OUTPUT_NAME ${SVDLL_NAME}
PREFIX "") PREFIX "")
endif() endif()

2
dlls/cbase.h

@ -284,7 +284,7 @@ public:
#ifdef _DEBUG #ifdef _DEBUG
void FunctionCheck( void *pFunction, char *name ) void FunctionCheck( void *pFunction, char *name )
{ {
if( pFunction && !NAME_FOR_FUNCTION( (size_t)( pFunction ) ) ) if( pFunction && !NAME_FOR_FUNCTION( pFunction ) )
ALERT( at_error, "No EXPORT: %s:%s (%08lx)\n", STRING( pev->classname ), name, (size_t)pFunction ); ALERT( at_error, "No EXPORT: %s:%s (%08lx)\n", STRING( pev->classname ), name, (size_t)pFunction );
} }

4
dlls/client.cpp

@ -108,7 +108,7 @@ void ClientDisconnect( edict_t *pEntity )
char text[256] = ""; char text[256] = "";
if( pEntity->v.netname ) if( pEntity->v.netname )
snprintf( text, sizeof(text), "- %s has left the game\n", STRING( pEntity->v.netname ) ); _snprintf( text, sizeof(text), "- %s has left the game\n", STRING( pEntity->v.netname ) );
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL ); MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
WRITE_BYTE( ENTINDEX( pEntity ) ); WRITE_BYTE( ENTINDEX( pEntity ) );
WRITE_STRING( text ); WRITE_STRING( text );
@ -660,7 +660,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
if( gpGlobals->maxClients > 1 ) if( gpGlobals->maxClients > 1 )
{ {
char text[256]; char text[256];
snprintf( text, 256, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) ); _snprintf( text, 256, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL ); MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
WRITE_BYTE( ENTINDEX( pEntity ) ); WRITE_BYTE( ENTINDEX( pEntity ) );
WRITE_STRING( text ); WRITE_STRING( text );

3
dlls/monsters.cpp

@ -2118,7 +2118,8 @@ void CBaseMonster::StartMonster( void )
SetThink( &CBaseMonster::CallMonsterThink ); SetThink( &CBaseMonster::CallMonsterThink );
pev->nextthink += RANDOM_FLOAT( 0.1, 0.4 ); // spread think times. pev->nextthink += RANDOM_FLOAT( 0.1, 0.4 ); // spread think times.
if( !FStringNull( pev->targetname ) )// wait until triggered // Vit_amiN: fixed -- now it doesn't touch any scripted_sequence target
if( !FStringNull( pev->targetname ) && !m_pCine )// wait until triggered
{ {
SetState( MONSTERSTATE_IDLE ); SetState( MONSTERSTATE_IDLE );
// UNDONE: Some scripted sequence monsters don't have an idle? // UNDONE: Some scripted sequence monsters don't have an idle?

20
dlls/player.cpp

@ -1860,6 +1860,7 @@ void CBasePlayer::PreThink( void )
{ {
CBaseEntity *pTrain = CBaseEntity::Instance( pev->groundentity ); CBaseEntity *pTrain = CBaseEntity::Instance( pev->groundentity );
float vel; float vel;
int iGearId; // Vit_amiN: keeps the train control HUD in sync
if( !pTrain ) if( !pTrain )
{ {
@ -1900,10 +1901,12 @@ void CBasePlayer::PreThink( void )
pTrain->Use( this, this, USE_SET, (float)vel ); pTrain->Use( this, this, USE_SET, (float)vel );
} }
if( vel ) iGearId = TrainSpeed( pTrain->pev->speed, pTrain->pev->impulse );
if( iGearId != ( m_iTrain & 0x0F ) ) // Vit_amiN: speed changed
{ {
m_iTrain = TrainSpeed( (int)pTrain->pev->speed, pTrain->pev->impulse ); m_iTrain = iGearId;
m_iTrain |= TRAIN_ACTIVE|TRAIN_NEW; m_iTrain |= TRAIN_ACTIVE | TRAIN_NEW;
} }
} }
else if( m_iTrain & TRAIN_ACTIVE ) else if( m_iTrain & TRAIN_ACTIVE )
@ -2919,6 +2922,8 @@ void CBasePlayer::Precache( void )
if( gInitHUD ) if( gInitHUD )
m_fInitHUD = TRUE; m_fInitHUD = TRUE;
pev->fov = m_iFOV; // Vit_amiN: restore the FOV on level change or map/saved game load
} }
int CBasePlayer::Save( CSave &save ) int CBasePlayer::Save( CSave &save )
@ -3326,6 +3331,8 @@ void CBasePlayer::ForceClientDllUpdate( void )
{ {
m_iClientHealth = -1; m_iClientHealth = -1;
m_iClientBattery = -1; m_iClientBattery = -1;
m_iClientHideHUD = -1; // Vit_amiN: forcing to update
m_iClientFOV = -1; // Vit_amiN: force client weapons to be sent
m_iTrain |= TRAIN_NEW; // Force new train message. m_iTrain |= TRAIN_NEW; // Force new train message.
m_fWeapon = FALSE; // Force weapon send m_fWeapon = FALSE; // Force weapon send
m_fKnownItem = FALSE; // Force weaponinit messages. m_fKnownItem = FALSE; // Force weaponinit messages.
@ -3890,6 +3897,11 @@ void CBasePlayer::UpdateClientData( void )
WRITE_BYTE( m_iFlashBattery ); WRITE_BYTE( m_iFlashBattery );
MESSAGE_END(); MESSAGE_END();
// Vit_amiN: the geiger state could run out of sync, too
MESSAGE_BEGIN( MSG_ONE, gmsgGeigerRange, NULL, pev );
WRITE_BYTE( 0 );
MESSAGE_END();
InitStatusBar(); InitStatusBar();
} }
@ -3935,7 +3947,7 @@ void CBasePlayer::UpdateClientData( void )
m_iClientHealth = (int)pev->health; m_iClientHealth = (int)pev->health;
} }
if( pev->armorvalue != m_iClientBattery ) if( (int)pev->armorvalue != m_iClientBattery )
{ {
m_iClientBattery = (int)pev->armorvalue; m_iClientBattery = (int)pev->armorvalue;

Loading…
Cancel
Save