diff options
| author | Joe Ludwig <[email protected]> | 2014-05-15 13:59:18 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2014-05-15 13:59:18 -0700 |
| commit | 53e78c503e6e9c7d15e2eefc480755fe37dd7077 (patch) | |
| tree | c8cc106eb4c0a2b2b5d79f534f2facb0514f5f55 /mp/src/game | |
| parent | Added many shader source files (diff) | |
| download | source-sdk-2013-53e78c503e6e9c7d15e2eefc480755fe37dd7077.tar.xz source-sdk-2013-53e78c503e6e9c7d15e2eefc480755fe37dd7077.zip | |
General:
* Upgraded Steamworks SDK to v1.29
* Fixed mod compatibility problem with Multiplayer Base that was introduced in September.
* In Hammer, while using the Vertex Tool, pressing CTRL+B will snap selected vertices to the grid.
Virtual Reality:
* Mods that support virtual reality now need to have a line in gameinfo.txt that says “supportsvr 1”. This indicates to gameui and engine that certain UI should be enabled.
* VR-enabled mods will now start up in VR mode when launched from Steam’s VR mode.
Windows:
* Upgraded to Visual Studio 2013. If you need to build projects for VS 2010, add /2010 to your VPC command line.
OSX:
* Upgraded to XCode 5.
Diffstat (limited to 'mp/src/game')
46 files changed, 240 insertions, 120 deletions
diff --git a/mp/src/game/client/beamdraw.cpp b/mp/src/game/client/beamdraw.cpp index 2bba8efe..8fc7d499 100644 --- a/mp/src/game/client/beamdraw.cpp +++ b/mp/src/game/client/beamdraw.cpp @@ -589,7 +589,7 @@ void DrawTeslaSegs( int noise_divisions, float *prgNoise, const model_t* spritem curSeg.m_flWidth = ((fraction*(endWidth-startWidth))+startWidth) * 2; // Reduce the width by the current number of branches we've had - for ( int j = 0; i < iBranches; j++ ) + for ( int j = 0; j < iBranches; j++ ) { curSeg.m_flWidth *= 0.5; } @@ -619,7 +619,7 @@ void DrawTeslaSegs( int noise_divisions, float *prgNoise, const model_t* spritem // Reduce the end width by the current number of branches we've had flEndWidth = endWidth; - for ( int j = 0; i < iBranches; j++ ) + for ( int j = 0; j < iBranches; j++ ) { flEndWidth *= 0.5; } diff --git a/mp/src/game/client/c_baseanimating.cpp b/mp/src/game/client/c_baseanimating.cpp index c7cc08b4..c41ff46b 100644 --- a/mp/src/game/client/c_baseanimating.cpp +++ b/mp/src/game/client/c_baseanimating.cpp @@ -3687,6 +3687,8 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int if ( token ) { const char* mtoken = ModifyEventParticles( token ); + if ( !mtoken || mtoken[0] == '\0' ) + return; Q_strncpy( szParticleEffect, mtoken, sizeof(szParticleEffect) ); } @@ -5298,8 +5300,8 @@ void C_BaseAnimating::ResetSequenceInfo( void ) m_bSequenceFinished = false; m_flLastEventCheck = 0; - m_nNewSequenceParity = ( ++m_nNewSequenceParity ) & EF_PARITY_MASK; - m_nResetEventsParity = ( ++m_nResetEventsParity ) & EF_PARITY_MASK; + m_nNewSequenceParity = ( m_nNewSequenceParity + 1 ) & EF_PARITY_MASK; + m_nResetEventsParity = ( m_nResetEventsParity + 1 ) & EF_PARITY_MASK; // FIXME: why is this called here? Nothing should have changed to make this nessesary SetEventIndexForSequence( pStudioHdr->pSeqdesc( GetSequence() ) ); diff --git a/mp/src/game/client/c_colorcorrection.cpp b/mp/src/game/client/c_colorcorrection.cpp index 56f1a65e..6960031d 100644 --- a/mp/src/game/client/c_colorcorrection.cpp +++ b/mp/src/game/client/c_colorcorrection.cpp @@ -122,7 +122,7 @@ void C_ColorCorrection::ClientThink() return; } - CBaseEntity *pPlayer = UTIL_PlayerByIndex(1); + C_BaseEntity *pPlayer = C_BasePlayer::GetLocalPlayer(); if( !pPlayer ) return; diff --git a/mp/src/game/client/c_func_breakablesurf.cpp b/mp/src/game/client/c_func_breakablesurf.cpp index 03176315..3118cd5e 100644 --- a/mp/src/game/client/c_func_breakablesurf.cpp +++ b/mp/src/game/client/c_func_breakablesurf.cpp @@ -154,7 +154,7 @@ private: Assert( type < NUM_EDGE_STYLES ); Assert( type >= 0 ); // Clear old value - m_nPanelBits[ w ][ h ] &= ( ~0x03 << 2 ); + m_nPanelBits[ w ][ h ] &= 0xF0; // ( ~0x03 << 2 ); Left shifting a negative value has undefined behavior. Use the constant 0xF0 instead. // Insert new value m_nPanelBits[ w ][ h ] |= ( type << 2 ); } diff --git a/mp/src/game/client/c_te_bloodstream.cpp b/mp/src/game/client/c_te_bloodstream.cpp index 2c16e3a1..d543d111 100644 --- a/mp/src/game/client/c_te_bloodstream.cpp +++ b/mp/src/game/client/c_te_bloodstream.cpp @@ -114,7 +114,7 @@ void TE_BloodStream( IRecipientFilter& filter, float delay, float arc = 0.05; int count, count2; float num; - int speedCopy = amount; + float speedCopy = amount; Vector dir; VectorCopy( *direction, dir ); diff --git a/mp/src/game/client/c_te_decal.cpp b/mp/src/game/client/c_te_decal.cpp index 4ea42e5e..f0212ee1 100644 --- a/mp/src/game/client/c_te_decal.cpp +++ b/mp/src/game/client/c_te_decal.cpp @@ -139,7 +139,7 @@ void TE_Decal( IRecipientFilter& filter, float delay, // Only decal the world + brush models // Here we deal with decals on entities. C_BaseEntity* ent; - if ( ( ent = cl_entitylist->GetEnt( entity ) ) == false ) + if ( ( ent = cl_entitylist->GetEnt( entity ) ) == NULL ) return; ent->AddDecal( *start, *pos, *pos, hitbox, diff --git a/mp/src/game/client/cdll_client_int.cpp b/mp/src/game/client/cdll_client_int.cpp index b5a53e72..10cce078 100644 --- a/mp/src/game/client/cdll_client_int.cpp +++ b/mp/src/game/client/cdll_client_int.cpp @@ -1717,7 +1717,11 @@ void CHLClient::LevelShutdown( void ) messagechars->Clear(); +#ifndef TF_CLIENT_DLL + // don't want to do this for TF2 because we have particle systems in our + // character loadout screen that can be viewed when we're not connected to a server g_pParticleSystemMgr->UncacheAllParticleSystems(); +#endif UncacheAllMaterials(); #ifdef _XBOX diff --git a/mp/src/game/client/client_virtualreality.cpp b/mp/src/game/client/client_virtualreality.cpp index d729210e..fb6e4417 100644 --- a/mp/src/game/client/client_virtualreality.cpp +++ b/mp/src/game/client/client_virtualreality.cpp @@ -21,6 +21,7 @@ #include "vgui_controls/Controls.h" #include "tier0/vprof_telemetry.h" #include <time.h> +#include "steam/steam_api.h" const char *COM_GetModDirectory(); // return the mod dir (rather than the complete -game param, which can be a path) @@ -260,6 +261,8 @@ CClientVirtualReality::CClientVirtualReality() m_rtLastMotionSample = 0; m_bMotionUpdated = false; + m_bForceVRMode = false; + #if defined( USE_SDL ) m_nNonVRSDLDisplayIndex = 0; #endif @@ -1363,28 +1366,32 @@ void CClientVirtualReality::Activate() if( !g_pSourceVR ) return; - // see if VR mode is even enabled - if( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 ) + // These checks don't apply if we're in VR mode because Steam said so. + if ( !m_bForceVRMode ) { - Warning( "Enable VR mode in the video options before trying to use it.\n" ); - return; - } + // see if VR mode is even enabled + if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 ) + { + Warning( "Enable VR mode in the video options before trying to use it.\n" ); + return; + } - // See if we have an actual adapter - int32 nVRModeAdapter = g_pSourceVR->GetVRModeAdapter(); - if( nVRModeAdapter == -1 ) - { - Warning( "Unable to get VRMode adapter from OpenVR. VR mode cannot be enabled. Try restarting and then enabling VR again.\n" ); - return; - } + // See if we have an actual adapter + int32 nVRModeAdapter = g_pSourceVR->GetVRModeAdapter(); + if ( nVRModeAdapter == -1 ) + { + Warning( "Unable to get VRMode adapter from OpenVR. VR mode cannot be enabled. Try restarting and then enabling VR again.\n" ); + return; + } - // we can only activate if we've got a VR device - if( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter != nVRModeAdapter ) - { - Warning( "VR Mode expects adapter %d which is different from %d which we are currently using. Try restarting and enabling VR mode again.\n", - nVRModeAdapter, materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter ); - engine->ExecuteClientCmd( "mat_enable_vrmode 0\n" ); - return; + // we can only activate if we've got a VR device + if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter != nVRModeAdapter ) + { + Warning( "VR Mode expects adapter %d which is different from %d which we are currently using. Try restarting and enabling VR mode again.\n", + nVRModeAdapter, materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter ); + engine->ExecuteClientCmd( "mat_enable_vrmode 0\n" ); + return; + } } @@ -1429,18 +1436,22 @@ void CClientVirtualReality::Activate() int nViewportWidth, nViewportHeight; g_pSourceVR->GetViewportBounds( ISourceVirtualReality::VREye_Left, NULL, NULL, &nViewportWidth, &nViewportHeight ); - vgui::surface()->SetFullscreenViewportAndRenderTarget( 0, 0, nViewportWidth, nViewportHeight, g_pSourceVR->GetRenderTarget( ISourceVirtualReality::VREye_Left, ISourceVirtualReality::RT_Color ) ); + g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( 0, 0, nViewportWidth, nViewportHeight, g_pSourceVR->GetRenderTarget( ISourceVirtualReality::VREye_Left, ISourceVirtualReality::RT_Color ) ); vgui::ivgui()->SetVRMode( true ); - VRRect_t rect; - if( g_pSourceVR->GetDisplayBounds( &rect ) ) + // we can skip this extra mode change if we've always been in VR mode + if ( !m_bForceVRMode ) { + VRRect_t rect; + if ( g_pSourceVR->GetDisplayBounds( &rect ) ) + { - // set mode - char szCmd[ 256 ]; - Q_snprintf( szCmd, sizeof( szCmd ), "mat_setvideomode %i %i %i\n", rect.nWidth, rect.nHeight, vr_force_windowed.GetBool()? 1 : 0 ); - engine->ClientCmd_Unrestricted( szCmd ); + // set mode + char szCmd[256]; + Q_snprintf( szCmd, sizeof(szCmd), "mat_setvideomode %i %i %i\n", rect.nWidth, rect.nHeight, vr_force_windowed.GetBool() ? 1 : 0 ); + engine->ClientCmd_Unrestricted( szCmd ); + } } } @@ -1455,7 +1466,7 @@ void CClientVirtualReality::Deactivate() g_pMatSystemSurface->ForceScreenSizeOverride(false, 0, 0 ); g_pMaterialSystem->GetRenderContext()->Viewport( 0, 0, m_nNonVRWidth, m_nNonVRHeight ); - vgui::surface()->SetFullscreenViewportAndRenderTarget( 0, 0, m_nNonVRWidth, m_nNonVRHeight, NULL ); + g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( 0, 0, m_nNonVRWidth, m_nNonVRHeight, NULL ); static ConVarRef cl_software_cursor( "cl_software_cursor" ); vgui::surface()->SetSoftwareCursor( cl_software_cursor.GetBool() ); @@ -1499,7 +1510,10 @@ void CClientVirtualReality::Deactivate() // Called when startup is complete void CClientVirtualReality::StartupComplete() { - if( vr_activate_default.GetBool() ) + if ( g_pSourceVR ) + m_bForceVRMode = g_pSourceVR->ShouldForceVRMode(); + + if ( vr_activate_default.GetBool( ) || m_bForceVRMode ) Activate(); } diff --git a/mp/src/game/client/client_virtualreality.h b/mp/src/game/client/client_virtualreality.h index 9aadfeb3..3a8c9469 100644 --- a/mp/src/game/client/client_virtualreality.h +++ b/mp/src/game/client/client_virtualreality.h @@ -147,6 +147,7 @@ private: int m_iAlignTorsoAndViewToWeaponCountdown; bool m_bMotionUpdated; + bool m_bForceVRMode; RTime32 m_rtLastMotionSample; diff --git a/mp/src/game/client/clientmode_shared.cpp b/mp/src/game/client/clientmode_shared.cpp index b6dee29c..5d10db6c 100644 --- a/mp/src/game/client/clientmode_shared.cpp +++ b/mp/src/game/client/clientmode_shared.cpp @@ -228,9 +228,9 @@ static void __MsgFunc_VGUIMenu( bf_read &msg ) && keys->GetInt( "type", 0 ) == 2 // URL message type ) { const char *pszURL = keys->GetString( "msg", "" ); - if ( Q_strncmp( pszURL, "http://", 7 ) != 0 && Q_strncmp( pszURL, "https://", 8 ) != 0 ) + if ( Q_strncmp( pszURL, "http://", 7 ) != 0 && Q_strncmp( pszURL, "https://", 8 ) != 0 && Q_stricmp( pszURL, "about:blank" ) != 0 ) { - Warning( "Blocking MOTD URL '%s'; must begin with 'http://' or 'https://'\n", pszURL ); + Warning( "Blocking MOTD URL '%s'; must begin with 'http://' or 'https://' or be about:blank\n", pszURL ); keys->deleteThis(); return; } diff --git a/mp/src/game/client/detailobjectsystem.cpp b/mp/src/game/client/detailobjectsystem.cpp index 7aa871ea..3e211bb0 100644 --- a/mp/src/game/client/detailobjectsystem.cpp +++ b/mp/src/game/client/detailobjectsystem.cpp @@ -1477,7 +1477,7 @@ void CDetailObjectSystem::LevelInitPreEntity() PrecacheMaterial( DETAIL_SPRITE_MATERIAL ); IMaterial *pMat = m_DetailSpriteMaterial; // adjust for non-square textures (cropped) - float flRatio = pMat->GetMappingWidth() / pMat->GetMappingHeight(); + float flRatio = (float)( pMat->GetMappingWidth() ) / pMat->GetMappingHeight(); if ( flRatio > 1.0 ) { for( int i = 0; i<m_DetailSpriteDict.Count(); i++ ) diff --git a/mp/src/game/client/flashlighteffect.h b/mp/src/game/client/flashlighteffect.h index 6d5282ba..d291c382 100644 --- a/mp/src/game/client/flashlighteffect.h +++ b/mp/src/game/client/flashlighteffect.h @@ -18,7 +18,7 @@ class CFlashlightEffect public: CFlashlightEffect(int nEntIndex = 0); - ~CFlashlightEffect(); + virtual ~CFlashlightEffect(); virtual void UpdateLight(const Vector &vecPos, const Vector &vecDir, const Vector &vecRight, const Vector &vecUp, int nDistance); void TurnOn(); diff --git a/mp/src/game/client/game_controls/buymenu.cpp b/mp/src/game/client/game_controls/buymenu.cpp index 40cbeab7..4ae693ae 100644 --- a/mp/src/game/client/game_controls/buymenu.cpp +++ b/mp/src/game/client/game_controls/buymenu.cpp @@ -86,7 +86,6 @@ void CBuyMenu::ShowPanel(bool bShow) void CBuyMenu::Update() { //Don't need to do anything, but do need to implement this function as base is pure virtual - NULL; } void CBuyMenu::OnClose() { diff --git a/mp/src/game/client/hl2/hud_weaponselection.cpp b/mp/src/game/client/hl2/hud_weaponselection.cpp index 9d223169..f5600705 100644 --- a/mp/src/game/client/hl2/hud_weaponselection.cpp +++ b/mp/src/game/client/hl2/hud_weaponselection.cpp @@ -598,13 +598,13 @@ void CHudWeaponSelection::Paint() // bucket style int screenCenterX = (int) fCenterX; - int screenCenterY = (int) fCenterY - 15; // Height isn't quite screen height, so adjust for center alignement + int screenCenterY = (int) fCenterY - 15; // Height isn't quite screen height, so adjust for center alignment // Modifiers for the four directions. Used to change the x and y offsets // of each box based on which bucket we're drawing. Bucket directions are // 0 = UP, 1 = RIGHT, 2 = DOWN, 3 = LEFT - int xModifiers[] = { 0, 1, 0, -1 }; - int yModifiers[] = { -1, 0, 1, 0 }; + int xModifiers[] = { 0, 1, 0, -1, -1, 1 }; + int yModifiers[] = { -1, 0, 1, 0, 1, 1 }; // Draw the four buckets for ( int i = 0; i < MAX_WEAPON_SLOTS; ++i ) @@ -1453,7 +1453,7 @@ void CHudWeaponSelection::SelectWeaponSlot( int iSlot ) return; // Don't try and read past our possible number of slots - if ( iSlot > MAX_WEAPON_SLOTS ) + if ( iSlot >= MAX_WEAPON_SLOTS ) return; // Make sure the player's allowed to switch weapons diff --git a/mp/src/game/client/hud.cpp b/mp/src/game/client/hud.cpp index 1baad2e1..af50b187 100644 --- a/mp/src/game/client/hud.cpp +++ b/mp/src/game/client/hud.cpp @@ -512,7 +512,7 @@ void CHud::Shutdown( void ) //----------------------------------------------------------------------------- -// Purpose: LevelInit's called whenever a new level's starting +// Purpose: LevelInit's called whenever a new level is starting //----------------------------------------------------------------------------- void CHud::LevelInit( void ) { @@ -533,11 +533,11 @@ void CHud::LevelInit( void ) } //----------------------------------------------------------------------------- -// Purpose: LevelShutdown's called whenever a level's finishing +// Purpose: LevelShutdown's called whenever a level is finishing //----------------------------------------------------------------------------- void CHud::LevelShutdown( void ) { - // Tell all the registered hud elements to LevelInit + // Tell all the registered hud elements to LevelShutdown for ( int i = 0; i < m_HudList.Size(); i++ ) { m_HudList[i]->LevelShutdown(); diff --git a/mp/src/game/client/hud.h b/mp/src/game/client/hud.h index 7b637c64..b623a3eb 100644 --- a/mp/src/game/client/hud.h +++ b/mp/src/game/client/hud.h @@ -107,9 +107,9 @@ public: void VidInit( void ); // Shutdown's called when the engine's shutting down void Shutdown( void ); - // LevelInit's called whenever a new level's starting + // LevelInit's called whenever a new level is starting void LevelInit( void ); - // LevelShutdown's called whenever a level's finishing + // LevelShutdown's called whenever a level is finishing void LevelShutdown( void ); void ResetHUD( void ); diff --git a/mp/src/game/client/hud_vote.cpp b/mp/src/game/client/hud_vote.cpp index 55b8f389..659669a0 100644 --- a/mp/src/game/client/hud_vote.cpp +++ b/mp/src/game/client/hud_vote.cpp @@ -662,7 +662,8 @@ void CVoteSetupDialog::OnItemSelected( vgui::Panel *panel ) for ( int index = 0; index < m_VoteIssuesPopFiles.Count(); index++ ) { // Don't show the current pop file - if ( TFObjectiveResource()->GetMvMPopFileName() == '\0' ) + const char *pszPopFileName = TFObjectiveResource()->GetMvMPopFileName(); + if ( !pszPopFileName || !pszPopFileName[0] ) { // Use the map name char szShortMapName[ MAX_MAP_NAME ]; diff --git a/mp/src/game/client/hudelement.h b/mp/src/game/client/hudelement.h index e6de48b9..b903de5d 100644 --- a/mp/src/game/client/hudelement.h +++ b/mp/src/game/client/hudelement.h @@ -36,9 +36,9 @@ public: // called whenever the video mode changes, and whenever Init() would be called, so the hud can vid init itself virtual void VidInit( void ) { return; } - // LevelInit's called whenever a new level's starting + // LevelInit's called whenever a new level is starting virtual void LevelInit( void ) { return; }; - // LevelShutdown's called whenever a level's finishing + // LevelShutdown's called whenever a level is finishing virtual void LevelShutdown( void ) { return; }; // called whenever the hud receives "reset" message, which is (usually) every time the client respawns after getting killed diff --git a/mp/src/game/client/in_joystick.cpp b/mp/src/game/client/in_joystick.cpp index 2f0e3dad..71d03a08 100644 --- a/mp/src/game/client/in_joystick.cpp +++ b/mp/src/game/client/in_joystick.cpp @@ -846,6 +846,8 @@ void CInput::JoyStickMove( float frametime, CUserCmd *cmd ) { angle = m_flPreviousJoystickYaw * joy_yawsensitivity.GetFloat() * aspeed * 180.0; } + + angle = JoyStickAdjustYaw( angle ); viewangles[YAW] += angle; cmd->mousedx = angle; diff --git a/mp/src/game/client/input.h b/mp/src/game/client/input.h index 356c7532..e34b82db 100644 --- a/mp/src/game/client/input.h +++ b/mp/src/game/client/input.h @@ -141,6 +141,7 @@ private: void ControllerMove ( float frametime, CUserCmd *cmd ); void JoyStickMove ( float frametime, CUserCmd *cmd ); float ScaleAxisValue( const float axisValue, const float axisThreshold ); + virtual float JoyStickAdjustYaw( float flSpeed ) { return flSpeed; } // Call this to get the cursor position. The call will be logged in the VCR file if there is one. void GetMousePos(int &x, int &y); diff --git a/mp/src/game/client/prediction.cpp b/mp/src/game/client/prediction.cpp index 7e00732c..6646f8f9 100644 --- a/mp/src/game/client/prediction.cpp +++ b/mp/src/game/client/prediction.cpp @@ -931,7 +931,8 @@ void CPrediction::SetIdealPitch ( C_BasePlayer *player, const Vector& origin, co Vector top, bottom; float floor_height[MAX_FORWARD]; int i, j; - int step, dir, steps; + float step, dir; + int steps; trace_t tr; if ( player->GetGroundEntity() == NULL ) diff --git a/mp/src/game/client/replay/replayyoutubeapi.cpp b/mp/src/game/client/replay/replayyoutubeapi.cpp index 399d12ca..faab2e95 100644 --- a/mp/src/game/client/replay/replayyoutubeapi.cpp +++ b/mp/src/game/client/replay/replayyoutubeapi.cpp @@ -24,7 +24,7 @@ #include "confirm_dialog.h" #include "replay/vgui/replaybrowserdetailspanel.h" -#include "base_gcmessages.h" +#include "base_gcmessages.pb.h" #include "youtubeapi.h" #include "steamworks_gamestats.h" diff --git a/mp/src/game/client/sixense/in_sixense_gesture_bindings.cpp b/mp/src/game/client/sixense/in_sixense_gesture_bindings.cpp index 7ede9ba5..0f0f7105 100644 --- a/mp/src/game/client/sixense/in_sixense_gesture_bindings.cpp +++ b/mp/src/game/client/sixense/in_sixense_gesture_bindings.cpp @@ -879,10 +879,6 @@ bool SixenseGestureBindings::ActionTokenToStr( sixenseUtils::IButtonStates::Acti { Q_snprintf( buf, buflen, "tilt_gesture" ); } - else if( action == sixenseUtils::IButtonStates::ACTION_BUTTON_PRESS ) - { - Q_snprintf( buf, buflen, "button_press" ); - } else if( action == sixenseUtils::IButtonStates::ACTION_TRIGGER_PRESS ) { Q_snprintf( buf, buflen, "trigger_press" ); diff --git a/mp/src/game/client/vgui_fpspanel.cpp b/mp/src/game/client/vgui_fpspanel.cpp index a44dde34..aec28add 100644 --- a/mp/src/game/client/vgui_fpspanel.cpp +++ b/mp/src/game/client/vgui_fpspanel.cpp @@ -189,12 +189,12 @@ void GetFPSColor( int nFps, unsigned char ucColor[3] ) if ( IsPC() && g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 95 ) { nFPSThreshold1 = 60; - nFPSThreshold1 = 50; + nFPSThreshold2 = 50; } else if ( IsX360() || g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 90 ) { nFPSThreshold1 = 30; - nFPSThreshold1 = 25; + nFPSThreshold2 = 25; } if ( nFps >= nFPSThreshold1 ) diff --git a/mp/src/game/client/vgui_messagechars.cpp b/mp/src/game/client/vgui_messagechars.cpp index 547164f6..1d1410f1 100644 --- a/mp/src/game/client/vgui_messagechars.cpp +++ b/mp/src/game/client/vgui_messagechars.cpp @@ -235,9 +235,10 @@ int CMessageCharsPanel::AddText( Assert( !msg->text ); - msg->text = new char[ Q_strlen( data ) + 1 ]; + int textLength = Q_strlen( data ) + 1; + msg->text = new char[ textLength ]; Assert( msg->text ); - Q_strncpy( msg->text, data, sizeof( msg->text ) ); + Q_strncpy( msg->text, data, textLength ); if ( flTime ) msg->fTTL = gpGlobals->curtime + flTime; diff --git a/mp/src/game/client/viewpostprocess.cpp b/mp/src/game/client/viewpostprocess.cpp index 3f74acdc..39c2237e 100644 --- a/mp/src/game/client/viewpostprocess.cpp +++ b/mp/src/game/client/viewpostprocess.cpp @@ -1885,7 +1885,8 @@ static void DrawPyroVignette( int nDestX, int nDestY, int nWidth, int nHeight, / if ( pyro_vignette.GetInt() > 1 ) { - Vector2D vMaxSize( ( float )nScreenWidth / ( float )nScreenWidth / NUM_PYRO_SEGMENTS * 2.0f, ( float )nScreenHeight / ( float )nScreenHeight / NUM_PYRO_SEGMENTS * 2.0f ); + float flPyroSegments = 2.0f / NUM_PYRO_SEGMENTS; + Vector2D vMaxSize( flPyroSegments, flPyroSegments ); if ( !bInit ) { diff --git a/mp/src/game/client/viewrender.cpp b/mp/src/game/client/viewrender.cpp index a9ef4eb8..a629071b 100644 --- a/mp/src/game/client/viewrender.cpp +++ b/mp/src/game/client/viewrender.cpp @@ -2248,7 +2248,7 @@ void CViewRender::RenderView( const CViewSetup &view, int nClearFlags, int whatT // let vgui know where to render stuff for the forced-to-framebuffer panels if( UseVR() ) { - vgui::surface()->SetFullscreenViewportAndRenderTarget( viewFramebufferX, viewFramebufferY, viewFramebufferWidth, viewFramebufferHeight, saveRenderTarget ); + g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( viewFramebufferX, viewFramebufferY, viewFramebufferWidth, viewFramebufferHeight, saveRenderTarget ); } // clear the render target if we need to @@ -3885,7 +3885,7 @@ static void DrawOpaqueRenderables_DrawStaticProps( CClientRenderablesList::CEntr for( CClientRenderablesList::CEntry *itEntity = pEntitiesBegin; itEntity < pEntitiesEnd; ++ itEntity ) { if ( itEntity->m_pRenderable ) - NULL; + /**/; else continue; @@ -3935,7 +3935,7 @@ void CRendering3dView::DrawOpaqueRenderables( ERenderDepthMode DepthMode ) RopeManager()->ResetRenderCache(); g_pParticleSystemMgr->ResetRenderCache(); - bool const bDrawopaquestaticpropslast = r_drawopaquestaticpropslast.GetBool(); + //bool const bDrawopaquestaticpropslast = r_drawopaquestaticpropslast.GetBool(); // @@ -4101,16 +4101,20 @@ void CRendering3dView::DrawOpaqueRenderables( ERenderDepthMode DepthMode ) for ( int bucket = 0; bucket < RENDER_GROUP_CFG_NUM_OPAQUE_ENT_BUCKETS; ++ bucket ) { - if ( bDrawopaquestaticpropslast ) + // PVS-Studio pointed out that the two sides of the if/else were identical. Fixing + // this long-broken behavior would change rendering, so I fixed the code but + // commented out the new behavior. Uncomment the if statement and else block + // when needed. + //if ( bDrawopaquestaticpropslast ) { DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode ); DrawOpaqueRenderables_DrawStaticProps( pProps[bucket][0], pProps[bucket][1], DepthMode ); } - else + /*else { - DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode ); DrawOpaqueRenderables_DrawStaticProps( pProps[bucket][0], pProps[bucket][1], DepthMode ); - } + DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode ); + }*/ } diff --git a/mp/src/game/protobuf_include.vpc b/mp/src/game/protobuf_include.vpc index c4fe5022..74c2ada4 100644 --- a/mp/src/game/protobuf_include.vpc +++ b/mp/src/game/protobuf_include.vpc @@ -8,10 +8,10 @@ $MacroRequired "PLATFORM" $Project { - $Folder "Libraries" + $Folder "Link Libraries" { - $Libexternal libprotobuf [!$VS2012 && !$VS2013] + $Libexternal $SRCDIR\lib\public\2010\libprotobuf [$VS2010] $Libexternal 2012\libprotobuf [$VS2012] - $Libexternal 2013\libprotobuf [$VS2013] + $Libexternal libprotobuf [$VS2013 || !$WINDOWS] } } diff --git a/mp/src/game/server/BaseAnimatingOverlay.cpp b/mp/src/game/server/BaseAnimatingOverlay.cpp index 50c94361..36534bc0 100644 --- a/mp/src/game/server/BaseAnimatingOverlay.cpp +++ b/mp/src/game/server/BaseAnimatingOverlay.cpp @@ -104,9 +104,14 @@ void CAnimationLayer::Init( CBaseAnimatingOverlay *pOverlay ) m_nSequence = 0; m_nPriority = 0; m_nOrder.Set( CBaseAnimatingOverlay::MAX_OVERLAYS ); + + m_flBlendIn = 0.0; + m_flBlendOut = 0.0; + m_flKillRate = 100.0; m_flKillDelay = 0.0; m_flPlaybackRate = 1.0; + m_flLastEventCheck = 0.0; m_flLastAccess = gpGlobals->curtime; m_flLayerAnimtime = 0; m_flLayerFadeOuttime = 0; diff --git a/mp/src/game/server/EnvFade.cpp b/mp/src/game/server/EnvFade.cpp index b3ed4b2c..fa0185d5 100644 --- a/mp/src/game/server/EnvFade.cpp +++ b/mp/src/game/server/EnvFade.cpp @@ -95,7 +95,7 @@ void CEnvFade::InputFade( inputdata_t &inputdata ) if ( m_spawnflags & SF_FADE_ONLYONE ) { - if ( inputdata.pActivator->IsNetClient() ) + if ( inputdata.pActivator && inputdata.pActivator->IsNetClient() ) { UTIL_ScreenFade( inputdata.pActivator, m_clrRender, Duration(), HoldTime(), fadeFlags ); } diff --git a/mp/src/game/server/ai_utils.cpp b/mp/src/game/server/ai_utils.cpp index 802a1c10..83847479 100644 --- a/mp/src/game/server/ai_utils.cpp +++ b/mp/src/game/server/ai_utils.cpp @@ -46,7 +46,7 @@ END_DATADESC() CAI_ShotRegulator::CAI_ShotRegulator() : m_nMinBurstShots(1), m_nMaxBurstShots(1) { m_flMinRestInterval = 0.0f; - m_flMinRestInterval = 0.0f; + m_flMaxRestInterval = 0.0f; m_flMinBurstInterval = 0.0f; m_flMaxBurstInterval = 0.0f; m_flNextShotTime = -1; diff --git a/mp/src/game/server/baseentity.cpp b/mp/src/game/server/baseentity.cpp index 52316924..b42f2abe 100644 --- a/mp/src/game/server/baseentity.cpp +++ b/mp/src/game/server/baseentity.cpp @@ -303,7 +303,7 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE( CBaseEntity, DT_BaseEntity ) SendPropBool( SENDINFO( m_bAlternateSorting )), #ifdef TF_DLL - SendPropArray3( SENDINFO_ARRAY3(m_nModelIndexOverrides), SendPropInt( SENDINFO_ARRAY(m_nModelIndexOverrides), SP_MODEL_INDEX_BITS, SPROP_UNSIGNED ) ), + SendPropArray3( SENDINFO_ARRAY3(m_nModelIndexOverrides), SendPropInt( SENDINFO_ARRAY(m_nModelIndexOverrides), SP_MODEL_INDEX_BITS, 0 ) ), #endif END_SEND_TABLE() diff --git a/mp/src/game/server/baseflex.cpp b/mp/src/game/server/baseflex.cpp index 8e17fa75..4e6b4629 100644 --- a/mp/src/game/server/baseflex.cpp +++ b/mp/src/game/server/baseflex.cpp @@ -1318,9 +1318,9 @@ static Activity DetermineExpressionMoveActivity( CChoreoEvent *event, CAI_BaseNP // Custom distance styles are appended to param2 with a space as a separator const char *pszAct = Q_strstr( sParam2, " " ); + char szActName[256]; if ( pszAct ) { - char szActName[256]; Q_strncpy( szActName, sParam2, sizeof(szActName) ); szActName[ (pszAct-sParam2) ] = '\0'; pszAct = szActName; diff --git a/mp/src/game/server/env_tonemap_controller.cpp b/mp/src/game/server/env_tonemap_controller.cpp index 807e39ac..613d4548 100644 --- a/mp/src/game/server/env_tonemap_controller.cpp +++ b/mp/src/game/server/env_tonemap_controller.cpp @@ -169,7 +169,7 @@ void CEnvTonemapController::InputSetBloomScaleRange( inputdata_t &inputdata ) return; } m_flCustomBloomScale=bloom_max; - m_flCustomBloomScale=bloom_min; + m_flCustomBloomScaleMinimum=bloom_min; } //----------------------------------------------------------------------------- diff --git a/mp/src/game/server/gameinterface.cpp b/mp/src/game/server/gameinterface.cpp index c9357138..ff077ea5 100644 --- a/mp/src/game/server/gameinterface.cpp +++ b/mp/src/game/server/gameinterface.cpp @@ -1888,9 +1888,13 @@ void CServerGameDLL::SetServerHibernation( bool bHibernating ) const char *CServerGameDLL::GetServerBrowserMapOverride() { #ifdef TF_DLL - if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && g_pPopulationManager && g_pPopulationManager->GetPopulationFilenameShort() != '\0' ) + if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() ) { - return g_pPopulationManager->GetPopulationFilenameShort(); + const char *pszFilenameShort = g_pPopulationManager ? g_pPopulationManager->GetPopulationFilenameShort() : NULL; + if ( pszFilenameShort && pszFilenameShort[0] ) + { + return pszFilenameShort; + } } #endif return NULL; @@ -2964,17 +2968,20 @@ void CServerGameClients::ClientSetupVisibility( edict_t *pViewEntity, edict_t *p // Flush the remaining areaportal states. engine->SetAreaPortalStates( portalNums, isOpen, iOutPortal ); - // Update the area bits that get sent to the client. - pPlayer->m_Local.UpdateAreaBits( pPlayer, portalBits ); + if ( pPlayer ) + { + // Update the area bits that get sent to the client. + pPlayer->m_Local.UpdateAreaBits( pPlayer, portalBits ); #ifdef PORTAL - // *After* the player's view has updated its area bits, add on any other areas seen by portals - CPortal_Player* pPortalPlayer = dynamic_cast<CPortal_Player*>( pPlayer ); - if ( pPortalPlayer ) - { - pPortalPlayer->UpdatePortalViewAreaBits( pvs, pvssize ); - } + // *After* the player's view has updated its area bits, add on any other areas seen by portals + CPortal_Player* pPortalPlayer = dynamic_cast<CPortal_Player*>( pPlayer ); + if ( pPortalPlayer ) + { + pPortalPlayer->UpdatePortalViewAreaBits( pvs, pvssize ); + } #endif //PORTAL + } } diff --git a/mp/src/game/server/hl2/npc_strider.cpp b/mp/src/game/server/hl2/npc_strider.cpp index b0cb2edf..60d37cdf 100644 --- a/mp/src/game/server/hl2/npc_strider.cpp +++ b/mp/src/game/server/hl2/npc_strider.cpp @@ -1130,7 +1130,7 @@ void CNPC_Strider::GatherConditions() !WeaponLOSCondition( GetAdjustedOrigin(), GetEnemy()->BodyTarget( GetAdjustedOrigin() ), false ) ) ) { #if 0 - if ( !HasCondition( COND_STRIDER_SHOULD_CROUCH ) && !HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) + if ( !HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) SetIdealHeight( MIN( GetMaxHeight(), GetHeight() + 75.0 * 0.1 ) ); // default to rising up #endif GatherHeightConditions( GetAdjustedOrigin(), GetEnemy() ); @@ -1161,7 +1161,7 @@ void CNPC_Strider::GatherConditions() //--------------------------------------------------------- void CNPC_Strider::GatherHeightConditions( const Vector &vTestPos, CBaseEntity *pEntity ) { - if ( HasCondition( COND_STRIDER_SHOULD_CROUCH ) && HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) + if ( HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) return; float maxZ = (GetAbsOrigin().z - (GetMaxHeightModel() - GetMaxHeight())); diff --git a/mp/src/game/server/player.cpp b/mp/src/game/server/player.cpp index 73aab6d6..0538f90a 100644 --- a/mp/src/game/server/player.cpp +++ b/mp/src/game/server/player.cpp @@ -7409,6 +7409,13 @@ void CBasePlayer::RemoveWearable( CEconWearable *pItem ) m_hMyWearables.Remove( i ); break; } + + // Integrety is failing, remove NULLs + if ( !pWearable ) + { + m_hMyWearables.Remove( i ); + break; + } } #ifdef DEBUG diff --git a/mp/src/game/server/props.cpp b/mp/src/game/server/props.cpp index 4d121d71..648191db 100644 --- a/mp/src/game/server/props.cpp +++ b/mp/src/game/server/props.cpp @@ -1517,7 +1517,7 @@ void CBreakableProp::OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t Rea SetPhysicsAttacker( pPhysGunUser, gpGlobals->curtime ); - if( Reason == PUNTED_BY_CANNON ) + if( (int)Reason == (int)PUNTED_BY_CANNON ) { PlayPuntSound(); } diff --git a/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp b/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp index 975eec17..4d1ad4fe 100644 --- a/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp +++ b/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp @@ -358,16 +358,21 @@ void CMultiPlayerAnimState::PlayFlinchGesture( Activity iActivity ) //----------------------------------------------------------------------------- bool CMultiPlayerAnimState::InitGestureSlots( void ) { - // Get the base player. - CBasePlayer *pPlayer = GetBasePlayer(); - if( pPlayer ) + // Setup the number of gesture slots. + m_aGestureSlots.AddMultipleToTail( GESTURE_SLOT_COUNT ); + + // Assign all of the the CAnimationLayer pointers to null early in case we bail. + for ( int iGesture = 0; iGesture < GESTURE_SLOT_COUNT; ++iGesture ) { - // Set the number of animation overlays we will use. - pPlayer->SetNumAnimOverlays( GESTURE_SLOT_COUNT ); + m_aGestureSlots[iGesture].m_pAnimLayer = NULL; } - // Setup the number of gesture slots. - m_aGestureSlots.AddMultipleToTail( GESTURE_SLOT_COUNT ); + // Get the base player. + CBasePlayer *pPlayer = GetBasePlayer(); + + // Set the number of animation overlays we will use. + pPlayer->SetNumAnimOverlays( GESTURE_SLOT_COUNT ); + for ( int iGesture = 0; iGesture < GESTURE_SLOT_COUNT; ++iGesture ) { m_aGestureSlots[iGesture].m_pAnimLayer = pPlayer->GetAnimOverlay( iGesture ); @@ -409,6 +414,9 @@ void CMultiPlayerAnimState::ResetGestureSlot( int iGestureSlot ) // Sanity Check Assert( iGestureSlot >= 0 && iGestureSlot < GESTURE_SLOT_COUNT ); + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + GestureSlot_t *pGestureSlot = &m_aGestureSlots[iGestureSlot]; if ( pGestureSlot ) { @@ -486,6 +494,36 @@ bool CMultiPlayerAnimState::IsGestureSlotActive( int iGestureSlot ) return m_aGestureSlots[iGestureSlot].m_bActive; } + +//----------------------------------------------------------------------------- +// Purpose: Track down a crash +//----------------------------------------------------------------------------- +bool CMultiPlayerAnimState::VerifyAnimLayerInSlot( int iGestureSlot ) +{ + if ( iGestureSlot < 0 || iGestureSlot >= GESTURE_SLOT_COUNT ) + { + return false; + } + + if ( GetBasePlayer()->GetNumAnimOverlays() < iGestureSlot + 1 ) + { + AssertMsg2( false, "Player %d doesn't have gesture slot %d any more.", GetBasePlayer()->entindex(), iGestureSlot ); + Msg( "Player %d doesn't have gesture slot %d any more.\n", GetBasePlayer()->entindex(), iGestureSlot ); + m_aGestureSlots[iGestureSlot].m_pAnimLayer = NULL; + return false; + } + + CAnimationLayer *pExpected = GetBasePlayer()->GetAnimOverlay( iGestureSlot ); + if ( m_aGestureSlots[iGestureSlot].m_pAnimLayer != pExpected ) + { + AssertMsg3( false, "Gesture slot %d pointing to wrong address %p. Updating to new address %p.", iGestureSlot, m_aGestureSlots[iGestureSlot].m_pAnimLayer, pExpected ); + Msg( "Gesture slot %d pointing to wrong address %p. Updating to new address %p.\n", iGestureSlot, m_aGestureSlots[iGestureSlot].m_pAnimLayer, pExpected ); + m_aGestureSlots[iGestureSlot].m_pAnimLayer = pExpected; + } + + return true; +} + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- @@ -509,6 +547,9 @@ void CMultiPlayerAnimState::RestartGesture( int iGestureSlot, Activity iGestureA // Sanity Check Assert( iGestureSlot >= 0 && iGestureSlot < GESTURE_SLOT_COUNT ); + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + if ( !IsGestureSlotPlaying( iGestureSlot, iGestureActivity ) ) { #ifdef CLIENT_DLL @@ -549,6 +590,9 @@ void CMultiPlayerAnimState::AddToGestureSlot( int iGestureSlot, Activity iGestur if ( !m_aGestureSlots[iGestureSlot].m_pAnimLayer ) return; + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + // Get the sequence. int iGestureSequence = pPlayer->SelectWeightedSequence( iGestureActivity ); if ( iGestureSequence <= 0 ) @@ -623,6 +667,9 @@ void CMultiPlayerAnimState::AddVCDSequenceToGestureSlot( int iGestureSlot, int i if ( !m_aGestureSlots[iGestureSlot].m_pAnimLayer ) return; + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + // Set the activity. Activity iGestureActivity = ACT_MP_VCD; @@ -1154,6 +1201,9 @@ void CMultiPlayerAnimState::ComputeGestureSequence( CStudioHdr *pStudioHdr ) if ( !m_aGestureSlots[iGesture].m_bActive ) continue; + if ( !VerifyAnimLayerInSlot( iGesture ) ) + continue; + UpdateGestureLayer( pStudioHdr, &m_aGestureSlots[iGesture] ); } } diff --git a/mp/src/game/shared/Multiplayer/multiplayer_animstate.h b/mp/src/game/shared/Multiplayer/multiplayer_animstate.h index 5407e4bd..007533a1 100644 --- a/mp/src/game/shared/Multiplayer/multiplayer_animstate.h +++ b/mp/src/game/shared/Multiplayer/multiplayer_animstate.h @@ -200,6 +200,7 @@ public: void AddVCDSequenceToGestureSlot( int iGestureSlot, int iGestureSequence, float flCycle = 0.0f, bool bAutoKill = true ); CAnimationLayer* GetGestureSlotLayer( int iGestureSlot ); bool IsGestureSlotActive( int iGestureSlot ); + bool VerifyAnimLayerInSlot( int iGestureSlot ); // Feet. bool m_bForceAimYaw; diff --git a/mp/src/game/shared/base_playeranimstate.cpp b/mp/src/game/shared/base_playeranimstate.cpp index a25d773c..d90655ac 100644 --- a/mp/src/game/shared/base_playeranimstate.cpp +++ b/mp/src/game/shared/base_playeranimstate.cpp @@ -65,7 +65,7 @@ CBasePlayerAnimState::CBasePlayerAnimState() m_flEyePitch = 0.0f; m_bCurrentFeetYawInitialized = false; m_flCurrentTorsoYaw = 0.0f; - m_flCurrentTorsoYaw = TURN_NONE; + m_nTurningInPlace = TURN_NONE; m_flMaxGroundSpeed = 0.0f; m_flStoredCycle = 0.0f; diff --git a/mp/src/game/shared/baseachievement.cpp b/mp/src/game/shared/baseachievement.cpp index 494133c1..ebc5876e 100644 --- a/mp/src/game/shared/baseachievement.cpp +++ b/mp/src/game/shared/baseachievement.cpp @@ -427,13 +427,7 @@ void CBaseAchievement::EnsureComponentBitSetAndEvaluate( int iBitNumber ) // new component, set the bit and increment the count SetComponentBits( m_iComponentBits | iBitMask ); - Assert( m_iCount <= m_iGoal ); - if ( m_iCount == m_iGoal ) - { - // all components found, award the achievement (and save state) - AwardAchievement(); - } - else + if ( m_iCount != m_iGoal ) { // save our state at the next good opportunity m_pAchievementMgr->SetDirty( true ); @@ -453,6 +447,15 @@ void CBaseAchievement::EnsureComponentBitSetAndEvaluate( int iBitNumber ) Msg( "Component %d for achievement %s found, but already had that component\n", iBitNumber, GetName() ); } } + + // Check to see if we've achieved our goal even if the bit is already set + // (this fixes some older achievements that are stuck in the 9/9 state and could never be evaluated) + Assert( m_iCount <= m_iGoal ); + if ( m_iCount == m_iGoal ) + { + // all components found, award the achievement (and save state) + AwardAchievement(); + } } //----------------------------------------------------------------------------- diff --git a/mp/src/game/shared/baseachievement.h b/mp/src/game/shared/baseachievement.h index 893055a3..2074f81d 100644 --- a/mp/src/game/shared/baseachievement.h +++ b/mp/src/game/shared/baseachievement.h @@ -105,6 +105,9 @@ public: virtual void Think( void ) { return; } + const char *GetMapNameFilter( void ){ return m_pMapNameFilter; } + CAchievementMgr *GetAchievementMgr( void ){ return m_pAchievementMgr; } + protected: virtual void FireGameEvent( IGameEvent *event ); virtual void FireGameEvent_Internal( IGameEvent *event ) {}; diff --git a/mp/src/game/shared/multiplay_gamerules.cpp b/mp/src/game/shared/multiplay_gamerules.cpp index 07932e92..abecba9e 100644 --- a/mp/src/game/shared/multiplay_gamerules.cpp +++ b/mp/src/game/shared/multiplay_gamerules.cpp @@ -857,9 +857,9 @@ ConVarRef suitcharger( "sk_suitcharger" ); { killer_weapon_name += 7; } - else if ( strncmp( killer_weapon_name, "NPC_", 8 ) == 0 ) + else if ( strncmp( killer_weapon_name, "NPC_", 4 ) == 0 ) { - killer_weapon_name += 8; + killer_weapon_name += 4; } else if ( strncmp( killer_weapon_name, "func_", 5 ) == 0 ) { diff --git a/mp/src/game/shared/particle_parse.cpp b/mp/src/game/shared/particle_parse.cpp index 9d3b4245..db15685d 100644 --- a/mp/src/game/shared/particle_parse.cpp +++ b/mp/src/game/shared/particle_parse.cpp @@ -309,7 +309,7 @@ void DispatchParticleEffect( const char *pszParticleName, ParticleAttachment_t i if ( ( data.m_fFlags & PARTICLE_DISPATCH_FROM_ENTITY ) != 0 && ( iAttachType == PATTACH_ABSORIGIN_FOLLOW || iAttachType == PATTACH_POINT_FOLLOW || iAttachType == PATTACH_ROOTBONE_FOLLOW ) ) { - CReliableBroadcastRecipientFilter filter; + CBroadcastRecipientFilter filter; DispatchEffect( "ParticleEffect", data, filter ); } else diff --git a/mp/src/game/shared/particle_property.cpp b/mp/src/game/shared/particle_property.cpp index 8ddc9784..c1c44a1a 100644 --- a/mp/src/game/shared/particle_property.cpp +++ b/mp/src/game/shared/particle_property.cpp @@ -200,8 +200,23 @@ void CParticleProperty::AddControlPoint( int iEffectIndex, int iPoint, C_BaseEnt ParticleEffectList_t *pEffect = &m_ParticleEffects[iEffectIndex]; Assert( pEffect->pControlPoints.Count() < MAX_PARTICLE_CONTROL_POINTS ); - int iIndex = pEffect->pControlPoints.AddToTail(); - ParticleControlPoint_t *pNewPoint = &pEffect->pControlPoints[iIndex]; + // If the control point is already used, override it + ParticleControlPoint_t *pNewPoint = NULL; + int iIndex = iPoint; + FOR_EACH_VEC( pEffect->pControlPoints, i ) + { + if ( pEffect->pControlPoints[i].iControlPoint == iPoint ) + { + pNewPoint = &pEffect->pControlPoints[i]; + } + } + + if ( !pNewPoint ) + { + iIndex = pEffect->pControlPoints.AddToTail(); + pNewPoint = &pEffect->pControlPoints[iIndex]; + } + pNewPoint->iControlPoint = iPoint; pNewPoint->hEntity = pEntity; pNewPoint->iAttachType = iAttachType; @@ -553,7 +568,7 @@ void CParticleProperty::UpdateControlPoint( ParticleEffectList_t *pEffect, int i if ( pAnimating ) { int bUseHeadOrigin = 0; - CALL_ATTRIB_HOOK_INT_ON_OTHER( pPoint->hEntity.Get(), bUseHeadOrigin, particle_effect_use_head_origin ); + CALL_ATTRIB_HOOK_INT_ON_OTHER( pAnimating, bUseHeadOrigin, particle_effect_use_head_origin ); if ( bUseHeadOrigin > 0 ) { int iBone = Studio_BoneIndexByName( pAnimating->GetModelPtr(), "bip_head" ); @@ -565,15 +580,17 @@ void CParticleProperty::UpdateControlPoint( ParticleEffectList_t *pEffect, int i iBone = Studio_BoneIndexByName( pAnimating->GetModelPtr(), "prp_hat" ); } } - if ( iBone >= 0 ) + if ( iBone < 0 ) { - bUsingHeadOrigin = true; - const matrix3x4_t headBone = pAnimating->GetBone( iBone ); - MatrixVectors( headBone, &vecForward, &vecRight, &vecUp ); - MatrixPosition( headBone, vecOrigin ); - - CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pPoint->hEntity.Get(), flOffset, particle_effect_vertical_offset ); + iBone = 0; } + + bUsingHeadOrigin = true; + const matrix3x4_t headBone = pAnimating->GetBone( iBone ); + MatrixVectors( headBone, &vecForward, &vecRight, &vecUp ); + MatrixPosition( headBone, vecOrigin ); + + CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pAnimating, flOffset, particle_effect_vertical_offset ); } } } |