From a0c29e7dd67abb15c74c85f07741784877edfdcd Mon Sep 17 00:00:00 2001 From: Joe Ludwig Date: Mon, 2 Sep 2013 11:39:10 -0700 Subject: General: * Fixed a variety of server browser issues with mods based on this SDK * Fixed many warnings on various platforms * Added source code for fgdlib and raytrace * Updated many source files with the latest shared source from TF2. OSX: * Added support for Xcode 4.6 * Switched OSX builds to use Xcode instead of makefiles * Moved libs from src/lib/osx32 to src/lib/public/osx32 or src/lib/common/osx32 to match windows better. Linux: * Moved libs from src/lib/linux32 to src/lib/public/linux32 or src/lib/common/linux32 to match windows better. --- mp/src/game/client/c_baseentity.cpp | 113 +++++++++++++++++++++++++++++++-- mp/src/game/client/c_baseentity.h | 7 +- mp/src/game/client/c_baseplayer.cpp | 2 +- mp/src/game/client/cdll_client_int.cpp | 2 + mp/src/game/client/client_base.vpc | 78 ++++++----------------- mp/src/game/client/client_hl2mp.vpc | 15 ----- mp/src/game/client/death.cpp | 2 +- 7 files changed, 138 insertions(+), 81 deletions(-) (limited to 'mp/src/game/client') diff --git a/mp/src/game/client/c_baseentity.cpp b/mp/src/game/client/c_baseentity.cpp index 8e2e752d..89b503d4 100644 --- a/mp/src/game/client/c_baseentity.cpp +++ b/mp/src/game/client/c_baseentity.cpp @@ -2462,27 +2462,36 @@ void C_BaseEntity::UnlinkFromHierarchy() void C_BaseEntity::ValidateModelIndex( void ) { #ifdef TF_CLIENT_DLL - if ( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_DEFAULT] > 0 ) + if ( m_nModelIndexOverrides[VISION_MODE_NONE] > 0 ) { if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_HALLOWEEN ) ) { - if ( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_HALLOWEEN] > 0 ) + if ( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] > 0 ) { - SetModelByIndex( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_HALLOWEEN] ); + SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] ); return; } } if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_PYRO ) ) { - if ( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_PYRO] > 0 ) + if ( m_nModelIndexOverrides[VISION_MODE_PYRO] > 0 ) { - SetModelByIndex( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_PYRO] ); + SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_PYRO] ); return; } } - SetModelByIndex( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_DEFAULT] ); + if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_ROME ) ) + { + if ( m_nModelIndexOverrides[VISION_MODE_ROME] > 0 ) + { + SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_ROME] ); + return; + } + } + + SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_NONE] ); return; } @@ -3597,6 +3606,48 @@ void C_BaseEntity::AddStudioDecal( const Ray_t& ray, int hitbox, int decalIndex, } } +//----------------------------------------------------------------------------- +void C_BaseEntity::AddColoredStudioDecal( const Ray_t& ray, int hitbox, int decalIndex, + bool doTrace, trace_t& tr, Color cColor, int maxLODToDecal ) +{ + if (doTrace) + { + enginetrace->ClipRayToEntity( ray, MASK_SHOT, this, &tr ); + + // Trace the ray against the entity + if (tr.fraction == 1.0f) + return; + + // Set the trace index appropriately... + tr.m_pEnt = this; + } + + // Exit out after doing the trace so any other effects that want to happen can happen. + if ( !r_drawmodeldecals.GetBool() ) + return; + + // Found the point, now lets apply the decals + CreateModelInstance(); + + // FIXME: Pass in decal up? + Vector up(0, 0, 1); + + if (doTrace && (GetSolid() == SOLID_VPHYSICS) && !tr.startsolid && !tr.allsolid) + { + // Choose a more accurate normal direction + // Also, since we have more accurate info, we can avoid pokethru + Vector temp; + VectorSubtract( tr.endpos, tr.plane.normal, temp ); + Ray_t betterRay; + betterRay.Init( tr.endpos, temp ); + modelrender->AddColoredDecal( m_ModelInstance, betterRay, up, decalIndex, GetStudioBody(), cColor, true, maxLODToDecal ); + } + else + { + modelrender->AddColoredDecal( m_ModelInstance, ray, up, decalIndex, GetStudioBody(), cColor, false, maxLODToDecal ); + } +} + //----------------------------------------------------------------------------- // This method works when we've got a brush model @@ -3647,6 +3698,56 @@ void C_BaseEntity::AddDecal( const Vector& rayStart, const Vector& rayEnd, } } +//----------------------------------------------------------------------------- +void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd, + const Vector& decalCenter, int hitbox, int decalIndex, bool doTrace, trace_t& tr, Color cColor, int maxLODToDecal ) +{ + Ray_t ray; + ray.Init( rayStart, rayEnd ); + + // FIXME: Better bloat? + // Bloat a little bit so we get the intersection + ray.m_Delta *= 1.1f; + + int modelType = modelinfo->GetModelType( model ); + if ( doTrace ) + { + enginetrace->ClipRayToEntity( ray, MASK_SHOT, this, &tr ); + switch ( modelType ) + { + case mod_studio: + tr.m_pEnt = this; + break; + case mod_brush: + if ( tr.fraction == 1.0f ) + return; // Explicitly end + default: + // By default, no collision + tr.fraction = 1.0f; + break; + } + } + + switch ( modelType ) + { + case mod_studio: + AddColoredStudioDecal( ray, hitbox, decalIndex, doTrace, tr, cColor, maxLODToDecal ); + break; + + case mod_brush: + { + color32 cColor32 = { cColor.r(), cColor.g(), cColor.b(), cColor.a() }; + effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 ); + } + break; + + default: + // By default, no collision + tr.fraction = 1.0f; + break; + } +} + //----------------------------------------------------------------------------- // A method to remove all decals from an entity //----------------------------------------------------------------------------- diff --git a/mp/src/game/client/c_baseentity.h b/mp/src/game/client/c_baseentity.h index 3ea4b7fd..e00513df 100644 --- a/mp/src/game/client/c_baseentity.h +++ b/mp/src/game/client/c_baseentity.h @@ -770,6 +770,10 @@ public: // A method to apply a decal to an entity virtual void AddDecal( const Vector& rayStart, const Vector& rayEnd, const Vector& decalCenter, int hitbox, int decalIndex, bool doTrace, trace_t& tr, int maxLODToDecal = ADDDECAL_TO_ALL_LODS ); + + virtual void AddColoredDecal( const Vector& rayStart, const Vector& rayEnd, + const Vector& decalCenter, int hitbox, int decalIndex, bool doTrace, trace_t& tr, Color cColor, int maxLODToDecal = ADDDECAL_TO_ALL_LODS ); + // A method to remove all decals from an entity void RemoveAllDecals( void ); @@ -1317,7 +1321,7 @@ public: short m_nModelIndex; #ifdef TF_CLIENT_DLL - int m_nModelIndexOverrides[MAX_MODEL_INDEX_OVERRIDES]; + int m_nModelIndexOverrides[MAX_VISION_MODES]; #endif char m_takedamage; @@ -1464,6 +1468,7 @@ private: // methods related to decal adding void AddStudioDecal( const Ray_t& ray, int hitbox, int decalIndex, bool doTrace, trace_t& tr, int maxLODToDecal = ADDDECAL_TO_ALL_LODS ); + void AddColoredStudioDecal( const Ray_t& ray, int hitbox, int decalIndex, bool doTrace, trace_t& tr, Color cColor, int maxLODToDecal ); void AddBrushModelDecal( const Ray_t& ray, const Vector& decalCenter, int decalIndex, bool doTrace, trace_t& tr ); void ComputePackedOffsets( void ); diff --git a/mp/src/game/client/c_baseplayer.cpp b/mp/src/game/client/c_baseplayer.cpp index 8e4ff89f..74c12bbc 100644 --- a/mp/src/game/client/c_baseplayer.cpp +++ b/mp/src/game/client/c_baseplayer.cpp @@ -2178,7 +2178,7 @@ void C_BasePlayer::PlayPlayerJingle() if ( !filesystem->FileExists( fullsoundname ) ) { char custname[ 512 ]; - Q_snprintf( custname, sizeof( custname ), "downloads/%s.dat", soundhex ); + Q_snprintf( custname, sizeof( custname ), "download/user_custom/%c%c/%s.dat", soundhex[0], soundhex[1], soundhex ); // it may have been downloaded but not copied under materials folder if ( !filesystem->FileExists( custname ) ) return; // not downloaded yet diff --git a/mp/src/game/client/cdll_client_int.cpp b/mp/src/game/client/cdll_client_int.cpp index c8f7f40b..4e856c95 100644 --- a/mp/src/game/client/cdll_client_int.cpp +++ b/mp/src/game/client/cdll_client_int.cpp @@ -116,6 +116,7 @@ #include "rtime.h" #include "tf_hud_disconnect_prompt.h" #include "../engine/audio/public/sound.h" +#include "tf_shared_content_manager.h" #endif #include "clientsteamcontext.h" #include "renamed_recvtable_compat.h" @@ -1018,6 +1019,7 @@ int CHLClient::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physi #if defined( TF_CLIENT_DLL ) IGameSystem::Add( CustomTextureToolCacheGameSystem() ); + IGameSystem::Add( TFSharedContentManager() ); #endif #if defined( TF_CLIENT_DLL ) diff --git a/mp/src/game/client/client_base.vpc b/mp/src/game/client/client_base.vpc index 8acae4f7..757a4cce 100644 --- a/mp/src/game/client/client_base.vpc +++ b/mp/src/game/client/client_base.vpc @@ -44,14 +44,18 @@ $Configuration "Release" $Configuration { + $General + { + $OutputDirectory ".\$GAMENAME" [$OSXALL] + } + $Compiler { $AdditionalIncludeDirectories ".\;$BASE;$SRCDIR\vgui2\include;$SRCDIR\vgui2\controls;$SRCDIR\game\shared;.\game_controls;$SRCDIR\thirdparty\sixensesdk\include" $PreprocessorDefinitions "$BASE;NO_STRING_T;CLIENT_DLL;VECTOR;VERSION_SAFE_STEAM_API_INTERFACES;PROTECTED_THINGS_ENABLE;strncpy=use_Q_strncpy_instead;_snprintf=use_Q_snprintf_instead" $PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;fopen=dont_use_fopen" [$WIN32] $PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;" [$OSXALL] - $PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;" [$LINUX] - $PreprocessorDefinitions "$BASE;USE_WEBM_FOR_REPLAY" [$LINUX] + $PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;USE_WEBM_FOR_REPLAY;" [$LINUXALL] $PreprocessorDefinitions "$BASE;CURL_STATICLIB" [$WIN32 && $BUILD_REPLAY] $Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)" $Create/UsePCHThroughFile "cbase.h" @@ -1232,55 +1236,7 @@ $Project $File "game_controls\IconPanel.h" } - $Folder "Link Libraries" [$WIN32] - { - $DynamicFile "$SRCDIR\lib\public\bitmap.lib" - $DynamicFile "$SRCDIR\lib\public\choreoobjects.lib" - $DynamicFile "$SRCDIR\lib\public\dmxloader.lib" - $DynamicFile "$SRCDIR\lib\public\mathlib.lib" - $DynamicFile "$SRCDIR\lib\public\matsys_controls.lib" - $DynamicFile "$SRCDIR\lib\public\particles.lib" - $DynamicFile "$SRCDIR\lib\public\tier1.lib" - $DynamicFile "$SRCDIR\lib\public\tier2.lib" - $DynamicFile "$SRCDIR\lib\public\tier3.lib" - $DynamicFile "$SRCDIR\lib\public\vgui_controls.lib" - $DynamicFile "$SRCDIR\lib\public\steam_api.lib" - $DynamicFile "$SRCDIR\lib\public\vtf.lib" - $DynamicFile "$SRCDIR\lib\win32\release\libcurl.lib" [$BUILD_REPLAY] - } - - $Folder "Link Libraries" [$X360] - { - $DynamicFile "$SRCDIR\lib\public\bitmap_360.lib" - $DynamicFile "$SRCDIR\lib\public\choreoobjects_360.lib" - $DynamicFile "$SRCDIR\lib\public\dmxloader_360.lib" - $DynamicFile "$SRCDIR\lib\public\mathlib_360.lib" - $DynamicFile "$SRCDIR\lib\public\matsys_controls_360.lib" - $DynamicFile "$SRCDIR\lib\public\particles_360.lib" - $DynamicFile "$SRCDIR\lib\public\tier1_360.lib" - $DynamicFile "$SRCDIR\lib\public\tier2_360.lib" - $DynamicFile "$SRCDIR\lib\public\tier3_360.lib" - $DynamicFile "$SRCDIR\lib\public\vgui_controls_360.lib" - } - - $Folder "Link Libraries" [$POSIX && !$LINUX] - { - $DynamicFile "$SRCDIR\lib\$PLATFORM\libcurl$_IMPLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\bitmap$_STATICLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\choreoobjects$_STATICLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\dmxloader$_STATICLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\mathlib$_STATICLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\matsys_controls$_STATICLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\particles$_STATICLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\tier1$_STATICLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\tier2$_STATICLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\tier3$_STATICLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\vgui_controls$_STATICLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\$_IMPLIB_PREFIXsteam_api$_IMPLIB_EXT" - $DynamicFile "$SRCDIR\lib\$PLATFORM\vtf$_STATICLIB_EXT" - } - - $Folder "Link Libraries" [$LINUX] + $Folder "Link Libraries" { $Lib bitmap $Lib choreoobjects @@ -1292,12 +1248,20 @@ $Project $Lib tier2 $Lib tier3 $Lib vgui_controls - $Lib vtf - $DynamicFile "$SRCDIR\lib\$PLATFORM\$_IMPLIB_PREFIXsteam_api$_IMPLIB_EXT" - $DynamicFile "$SRCDIR/lib/linux32/libcurl$_STATICLIB_EXT" [$DEDICATED] - $DynamicFile "$SRCDIR/lib/linux32/libcurlssl$_STATICLIB_EXT" [!$DEDICATED] - $DynamicFile "$SRCDIR/lib/linux32/libssl$_STATICLIB_EXT" [!$DEDICATED] - $DynamicFile "$SRCDIR/lib/linux32/release/libcrypto$_STATICLIB_EXT" [!$DEDICATED] + $Lib vtf + $ImpLib steam_api + + $Lib $LIBCOMMON/libcrypto [$POSIX] + + $ImpLib "$LIBCOMMON\curl" [$OSXALL] + + $Lib "$LIBCOMMON\libcurl" [$WIN32] + $Lib "libz" [$WIN32] + + $Libexternal libz [$LINUXALL] + $Libexternal "$LIBCOMMON/libcurl" [$LINUXALL] + $Libexternal "$LIBCOMMON/libcurlssl" [$LINUXALL] + $Libexternal "$LIBCOMMON/libssl" [$LINUXALL] } } diff --git a/mp/src/game/client/client_hl2mp.vpc b/mp/src/game/client/client_hl2mp.vpc index 9e50fefd..597b39d9 100644 --- a/mp/src/game/client/client_hl2mp.vpc +++ b/mp/src/game/client/client_hl2mp.vpc @@ -10,9 +10,6 @@ $Macro GAMENAME "mod_hl2mp" [$SOURCESDK] $Include "$SRCDIR\game\client\client_base.vpc" -$macro VSLIBDIR "." [!$VS2010] -$macro VSLIBDIR "VS2010" [$VS2010] - $Configuration { $Compiler @@ -174,16 +171,4 @@ $Project "Client (HL2MP)" } } } - $Folder "Libraries" - { - $File "$SRCDIR\lib\$PLATFORM\release\$VSLIBDIR\libprotobuf.lib" [$WINDOWS] - { - $Configuration "Debug" { $ExcludedFromBuild "Yes" } - } - $File "$SRCDIR\lib\$PLATFORM\debug\$VSLIBDIR\libprotobuf.lib" [$WINDOWS] - { - $Configuration "Release" { $ExcludedFromBuild "Yes" } - } - $File "$SRCDIR\lib\$PLATFORM\release\libprotobuf.a" [$POSIX] - } } diff --git a/mp/src/game/client/death.cpp b/mp/src/game/client/death.cpp index fa63ede8..50463d57 100644 --- a/mp/src/game/client/death.cpp +++ b/mp/src/game/client/death.cpp @@ -289,7 +289,7 @@ void CHudDeathNotice::FireGameEvent( KeyValues * event) if ( !strcmp( killedwith+2, "gauss" ) ) Q_strncpy( killedwith, "d_tau cannon", sizeof( killedwith ) ); - Msg( killedwith+2 ); // skip over the "d_" part + Msg( "%s", killedwith+2 ); // skip over the "d_" part } Msg( "\n" ); -- cgit v1.2.3