From e16ea21dc8a710237ade8413207f58d403c616a3 Mon Sep 17 00:00:00 2001 From: Joe Ludwig Date: Wed, 17 Jul 2013 18:26:59 -0700 Subject: * Added support for building shaders in your mod * Added nav mesh support * fixed many warnings and misc bugs * Fixed the create*projects scripts in mp * Added a bunch of stuff to .gitignore --- mp/src/game/client/c_baseanimating.cpp | 6 +++-- mp/src/game/client/c_baseanimating.h | 2 +- mp/src/game/client/c_baseentity.h | 2 ++ mp/src/game/client/c_team_objectiveresource.cpp | 19 ++++++++++++-- mp/src/game/client/c_team_objectiveresource.h | 6 +++++ mp/src/game/client/cdll_client_int.cpp | 3 +++ mp/src/game/client/client_virtualreality.cpp | 28 --------------------- mp/src/game/client/glow_outline_effect.cpp | 33 ++++++------------------- mp/src/game/client/hud_controlpointicons.cpp | 18 +++++++++++++- mp/src/game/client/in_mouse.cpp | 10 +------- mp/src/game/client/input.h | 2 +- 11 files changed, 60 insertions(+), 69 deletions(-) (limited to 'mp/src/game/client') diff --git a/mp/src/game/client/c_baseanimating.cpp b/mp/src/game/client/c_baseanimating.cpp index 137923d4..1086c301 100644 --- a/mp/src/game/client/c_baseanimating.cpp +++ b/mp/src/game/client/c_baseanimating.cpp @@ -1543,6 +1543,8 @@ void C_BaseAnimating::BuildTransformations( CStudioHdr *hdr, Vector *pos, Quater ApplyBoneMatrixTransform( GetBoneForWrite( i ) ); } } + + } //----------------------------------------------------------------------------- @@ -3233,7 +3235,7 @@ int C_BaseAnimating::InternalDrawModel( int flags ) if ( !GetModelPtr() ) return 0; - UpdateBoneAttachments( flags ); + UpdateBoneAttachments( ); if ( IsEffectActive( EF_ITEM_BLINK ) ) { @@ -6255,7 +6257,7 @@ bool C_BaseAnimating::ShouldResetSequenceOnNewModel( void ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void C_BaseAnimating::UpdateBoneAttachments( int flags ) +void C_BaseAnimating::UpdateBoneAttachments( void ) { if ( !m_pAttachedTo ) return; diff --git a/mp/src/game/client/c_baseanimating.h b/mp/src/game/client/c_baseanimating.h index d1c99868..5f30d8f8 100644 --- a/mp/src/game/client/c_baseanimating.h +++ b/mp/src/game/client/c_baseanimating.h @@ -228,7 +228,7 @@ public: int GetNumBoneAttachments(); C_BaseAnimating* GetBoneAttachment( int i ); virtual void NotifyBoneAttached( C_BaseAnimating* attachTarget ); - virtual void UpdateBoneAttachments( int flags ); + virtual void UpdateBoneAttachments( void ); //bool solveIK(float a, float b, const Vector &Foot, const Vector &Knee1, Vector &Knee2); //void DebugIK( mstudioikchain_t *pikchain ); diff --git a/mp/src/game/client/c_baseentity.h b/mp/src/game/client/c_baseentity.h index 955e80c5..3ea4b7fd 100644 --- a/mp/src/game/client/c_baseentity.h +++ b/mp/src/game/client/c_baseentity.h @@ -743,6 +743,7 @@ public: virtual void SetHealth(int iHealth) {} virtual int GetHealth() const { return 0; } virtual int GetMaxHealth() const { return 1; } + virtual bool IsVisibleToTargetID( void ) { return false; } // Returns the health fraction float HealthFraction() const; @@ -1004,6 +1005,7 @@ public: virtual bool IsBaseObject( void ) const { return false; } virtual bool IsBaseCombatWeapon( void ) const { return false; } virtual class C_BaseCombatWeapon *MyCombatWeaponPointer() { return NULL; } + virtual bool IsCombatItem( void ) const { return false; } virtual bool IsBaseTrain( void ) const { return false; } diff --git a/mp/src/game/client/c_team_objectiveresource.cpp b/mp/src/game/client/c_team_objectiveresource.cpp index 7d31036d..e0412d27 100644 --- a/mp/src/game/client/c_team_objectiveresource.cpp +++ b/mp/src/game/client/c_team_objectiveresource.cpp @@ -87,7 +87,10 @@ IMPLEMENT_CLIENTCLASS_DT_NOBASE(C_BaseTeamObjectiveResource, DT_BaseTeamObjectiv RecvPropArray3( RECVINFO_ARRAY(m_iTeamInZone), RecvPropInt( RECVINFO(m_iTeamInZone[0]) ) ), RecvPropArray3( RECVINFO_ARRAY(m_bBlocked), RecvPropInt( RECVINFO(m_bBlocked[0]) ) ), RecvPropArray3( RECVINFO_ARRAY(m_iOwner), RecvPropInt( RECVINFO(m_iOwner[0]), 0, RecvProxy_Owner ) ), + RecvPropArray3( RECVINFO_ARRAY(m_bCPCapRateScalesWithPlayers), RecvPropBool( RECVINFO(m_bCPCapRateScalesWithPlayers[0]) ) ), RecvPropString( RECVINFO(m_pszCapLayoutInHUD), 0, RecvProxy_CapLayout ), + RecvPropFloat( RECVINFO(m_flCustomPositionX) ), + RecvPropFloat( RECVINFO(m_flCustomPositionY) ), END_RECV_TABLE() C_BaseTeamObjectiveResource *g_pObjectiveResource = NULL; @@ -151,6 +154,9 @@ C_BaseTeamObjectiveResource::C_BaseTeamObjectiveResource() m_flNodeHillData[i] = 0; } + m_flCustomPositionX = -1.f; + m_flCustomPositionY = -1.f; + g_pObjectiveResource = this; } @@ -173,6 +179,9 @@ void C_BaseTeamObjectiveResource::OnPreDataChanged( DataUpdateType_t updateType m_iOldUpdateCapHudParity = m_iUpdateCapHudParity; m_bOldControlPointsReset = m_bControlPointsReset; + m_flOldCustomPositionX = m_flCustomPositionX; + m_flOldCustomPositionY = m_flCustomPositionY; + memcpy( m_flOldLazyCapPerc, m_flLazyCapPerc, sizeof(float)*m_iNumControlPoints ); memcpy( m_flOldUnlockTimes, m_flUnlockTimes, sizeof(float)*m_iNumControlPoints ); memcpy( m_flOldCPTimerTimes, m_flCPTimerTimes, sizeof(float)*m_iNumControlPoints ); @@ -229,6 +238,11 @@ void C_BaseTeamObjectiveResource::OnDataChanged( DataUpdateType_t updateType ) } } } + + if ( m_flOldCustomPositionX != m_flCustomPositionX || m_flOldCustomPositionY != m_flCustomPositionY ) + { + UpdateControlPoint( "controlpoint_updatelayout" ); + } } //----------------------------------------------------------------------------- @@ -373,7 +387,7 @@ void C_BaseTeamObjectiveResource::ClientThink() if ( iPlayersCapping > 0 ) { float flReduction = gpGlobals->curtime - m_flCapLastThinkTime[i]; - if ( mp_capstyle.GetInt() == 1 ) + if ( mp_capstyle.GetInt() == 1 && m_bCPCapRateScalesWithPlayers[i] ) { // Diminishing returns for successive players. for ( int iPlayer = 1; iPlayer < iPlayersCapping; iPlayer++ ) @@ -423,7 +437,8 @@ void C_BaseTeamObjectiveResource::ClientThink() if ( TeamplayRoundBasedRules() && TeamplayRoundBasedRules()->TeamMayCapturePoint(m_iCappingTeam[i],i) ) { float flCapLength = m_flTeamCapTime[ TEAM_ARRAY(i,m_iCappingTeam[i]) ]; - float flDecrease = (flCapLength / mp_capdeteriorate_time.GetFloat()) * (gpGlobals->curtime - m_flCapLastThinkTime[i]); + float flDecreaseScale = m_bCPCapRateScalesWithPlayers[i] ? mp_capdeteriorate_time.GetFloat() : flCapLength; + float flDecrease = (flCapLength / flDecreaseScale) * (gpGlobals->curtime - m_flCapLastThinkTime[i]); if ( TeamplayRoundBasedRules() && TeamplayRoundBasedRules()->InOvertime() ) { flDecrease *= 6; diff --git a/mp/src/game/client/c_team_objectiveresource.h b/mp/src/game/client/c_team_objectiveresource.h index ca75d8dc..588971c3 100644 --- a/mp/src/game/client/c_team_objectiveresource.h +++ b/mp/src/game/client/c_team_objectiveresource.h @@ -163,6 +163,7 @@ public: } const char *GetCapLayoutInHUD( void ) { return m_pszCapLayoutInHUD; } + void GetCapLayoutCustomPosition( float& flCustomPositionX, float& flCustomPositionY ) { flCustomPositionX = m_flCustomPositionX; flCustomPositionY = m_flCustomPositionY; } bool PlayingMiniRounds( void ){ return m_bPlayingMiniRounds; } bool IsInMiniRound( int index ) { return m_bInMiniRound[index]; } @@ -313,6 +314,7 @@ protected: int m_iTeamInZone[MAX_CONTROL_POINTS]; bool m_bBlocked[MAX_CONTROL_POINTS]; int m_iOwner[MAX_CONTROL_POINTS]; + bool m_bCPCapRateScalesWithPlayers[MAX_CONTROL_POINTS]; // client calculated state float m_flCapTimeLeft[MAX_CONTROL_POINTS]; @@ -321,6 +323,10 @@ protected: bool m_bWarnedOnFinalCap[MAX_CONTROL_POINTS]; float m_flLastCapWarningTime[MAX_CONTROL_POINTS]; char m_pszCapLayoutInHUD[MAX_CAPLAYOUT_LENGTH]; + float m_flOldCustomPositionX; + float m_flOldCustomPositionY; + float m_flCustomPositionX; + float m_flCustomPositionY; // hill data for multi-escort payload maps int m_nNumNodeHillData[TEAM_TRAIN_MAX_TEAMS]; diff --git a/mp/src/game/client/cdll_client_int.cpp b/mp/src/game/client/cdll_client_int.cpp index 0e96b11c..c8f7f40b 100644 --- a/mp/src/game/client/cdll_client_int.cpp +++ b/mp/src/game/client/cdll_client_int.cpp @@ -104,6 +104,7 @@ #include "replay/vgui/replayperformanceeditor.h" #endif #include "vgui/ILocalize.h" +#include "vgui/IVGui.h" #include "ixboxsystem.h" #include "ipresence.h" #include "engine/imatchmaking.h" @@ -982,6 +983,8 @@ int CHLClient::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physi g_pSourceVR->GetViewportBounds( ISourceVirtualReality::VREye_Left, NULL, NULL, &nViewportWidth, &nViewportHeight ); vgui::surface()->SetFullscreenViewport( 0, 0, nViewportWidth, nViewportHeight ); + + vgui::ivgui()->SetVRMode( true ); } if (!Initializer::InitializeAllObjects()) diff --git a/mp/src/game/client/client_virtualreality.cpp b/mp/src/game/client/client_virtualreality.cpp index 69f6e63a..1eb59a59 100644 --- a/mp/src/game/client/client_virtualreality.cpp +++ b/mp/src/game/client/client_virtualreality.cpp @@ -635,34 +635,6 @@ bool CClientVirtualReality::OverrideStereoView( CViewSetup *pViewMiddle, CViewSe g_pSourceVR->GetEyeProjectionMatrix ( &pViewLeft->m_ViewToProjection, ISourceVirtualReality::VREye_Left, pViewMiddle->zNear, pViewMiddle->zFar, 1.0f/headtrackFovScale ); g_pSourceVR->GetEyeProjectionMatrix ( &pViewRight->m_ViewToProjection, ISourceVirtualReality::VREye_Right, pViewMiddle->zNear, pViewMiddle->zFar, 1.0f/headtrackFovScale ); - static ConVarRef vr_distortion_grow_outside( "vr_distortion_grow_outside" ); - static ConVarRef vr_distortion_grow_inside( "vr_distortion_grow_inside" ); - static ConVarRef vr_distortion_grow_above( "vr_distortion_grow_above" ); - static ConVarRef vr_distortion_grow_below( "vr_distortion_grow_below" ); - - float StereoDistortionGrowOutside = vr_distortion_grow_outside.GetFloat(); - float StereoDistortionGrowInside = vr_distortion_grow_inside.GetFloat(); - float StereoDistortionGrowAbove = vr_distortion_grow_above.GetFloat(); - float StereoDistortionGrowBelow = vr_distortion_grow_below.GetFloat(); - if ( ( StereoDistortionGrowOutside != 0.0f ) || (StereoDistortionGrowInside != 0.0f ) ) - { - float ScaleX = 2.0f / ( StereoDistortionGrowInside + StereoDistortionGrowOutside + 2.0f ); - float OffsetX = 0.5f * ScaleX * ( StereoDistortionGrowInside - StereoDistortionGrowOutside ); - pViewLeft ->m_ViewToProjection.m[0][0] *= ScaleX; - pViewLeft ->m_ViewToProjection.m[0][2] = ( pViewLeft ->m_ViewToProjection.m[0][2] * ScaleX ) + OffsetX; - pViewRight->m_ViewToProjection.m[0][0] *= ScaleX; - pViewRight->m_ViewToProjection.m[0][2] = ( pViewRight->m_ViewToProjection.m[0][2] * ScaleX ) - OffsetX; - } - if ( ( StereoDistortionGrowAbove != 0.0f ) || (StereoDistortionGrowBelow != 0.0f ) ) - { - float ScaleY = 2.0f / ( StereoDistortionGrowBelow + StereoDistortionGrowAbove + 2.0f ); - float OffsetY = -0.5f * ScaleY * ( StereoDistortionGrowBelow - StereoDistortionGrowAbove ); // Why is this -0.5 and not +0.5? I wish I knew. - pViewLeft ->m_ViewToProjection.m[1][1] *= ScaleY; - pViewLeft ->m_ViewToProjection.m[1][2] = ( pViewLeft ->m_ViewToProjection.m[1][2] * ScaleY ) + OffsetY; - pViewRight->m_ViewToProjection.m[1][1] *= ScaleY; - pViewRight->m_ViewToProjection.m[1][2] = ( pViewRight->m_ViewToProjection.m[1][2] * ScaleY ) + OffsetY; - } - // And bodge together some sort of average for our cyclops friends. pViewMiddle->m_bViewToProjectionOverride = true; for ( int i = 0; i < 4; i++ ) diff --git a/mp/src/game/client/glow_outline_effect.cpp b/mp/src/game/client/glow_outline_effect.cpp index 600b15d7..a6d80b7f 100644 --- a/mp/src/game/client/glow_outline_effect.cpp +++ b/mp/src/game/client/glow_outline_effect.cpp @@ -312,37 +312,20 @@ void CGlowObjectManager::ApplyEntityGlowEffects( const CViewSetup *pSetup, int n void CGlowObjectManager::GlowObjectDefinition_t::DrawModel() { - C_BaseEntity *pEntity = m_hEntity.Get(); - if ( !pEntity ) - return; - - if ( pEntity->GetMoveParent() != NULL ) + if ( m_hEntity.Get() ) { - C_BaseAnimating *pBaseAnimating = pEntity->GetBaseAnimating(); - if ( pBaseAnimating ) - { - pBaseAnimating->InvalidateBoneCache(); - } - } + m_hEntity->DrawModel( STUDIO_RENDER ); + C_BaseEntity *pAttachment = m_hEntity->FirstMoveChild(); - pEntity->DrawModel( STUDIO_RENDER ); - - C_BaseEntity *pAttachment = pEntity->FirstMoveChild(); - while ( pAttachment != NULL ) - { - if ( !g_GlowObjectManager.HasGlowEffect( pAttachment ) && pAttachment->ShouldDraw() ) + while ( pAttachment != NULL ) { - C_BaseAnimating *pBaseAnimating = pAttachment->GetBaseAnimating(); - if ( pBaseAnimating ) + if ( !g_GlowObjectManager.HasGlowEffect( pAttachment ) && pAttachment->ShouldDraw() ) { - pBaseAnimating->InvalidateBoneCache(); + pAttachment->DrawModel( STUDIO_RENDER ); } - - pAttachment->DrawModel( STUDIO_RENDER ); + pAttachment = pAttachment->NextMovePeer(); } - - pAttachment = pAttachment->NextMovePeer(); } } -#endif // GLOWS_ENABLE +#endif // GLOWS_ENABLE \ No newline at end of file diff --git a/mp/src/game/client/hud_controlpointicons.cpp b/mp/src/game/client/hud_controlpointicons.cpp index 20d6150b..a8c390ae 100644 --- a/mp/src/game/client/hud_controlpointicons.cpp +++ b/mp/src/game/client/hud_controlpointicons.cpp @@ -1107,7 +1107,23 @@ void CHudControlPointIcons::PerformLayout( void ) } // Setup the main panel - SetBounds( (ScreenWidth() - iWidest) * 0.5, ScreenHeight() - iTall - m_nHeightOffset, iWidest, iTall ); + float flPositionX = (ScreenWidth() - iWidest) * 0.5; + float flPositionY = ScreenHeight() - iTall - m_nHeightOffset; + if ( ObjectiveResource() ) + { + float flCustomPositionX = -1.f; + float flCustomPositionY = -1.f; + ObjectiveResource()->GetCapLayoutCustomPosition( flCustomPositionX, flCustomPositionY ); + if ( flCustomPositionX != -1.f ) + { + flPositionX = flCustomPositionX * ScreenWidth(); + } + if ( flCustomPositionY != -1.f ) + { + flPositionY = flCustomPositionY * ScreenHeight(); + } + } + SetBounds( flPositionX, flPositionY, iWidest, iTall ); // Now that we know how wide we are, and how many icons are in each line, // we can lay the icons out, centered in the lines. diff --git a/mp/src/game/client/in_mouse.cpp b/mp/src/game/client/in_mouse.cpp index 207e7508..16cdd15e 100644 --- a/mp/src/game/client/in_mouse.cpp +++ b/mp/src/game/client/in_mouse.cpp @@ -10,9 +10,6 @@ #define _WIN32_WINNT 0x0502 #include #endif -#ifdef OSX -#include -#endif #include "cbase.h" #include "hud.h" #include "cdll_int.h" @@ -105,12 +102,7 @@ static ConVar m_mousespeed( "m_mousespeed", "1", FCVAR_ARCHIVE, "Windows mouse a static ConVar m_mouseaccel1( "m_mouseaccel1", "0", FCVAR_ARCHIVE, "Windows mouse acceleration initial threshold (2x movement).", true, 0, false, 0.0f ); static ConVar m_mouseaccel2( "m_mouseaccel2", "0", FCVAR_ARCHIVE, "Windows mouse acceleration secondary threshold (4x movement).", true, 0, false, 0.0f ); -#if defined( OSX ) -// On OSX, this needs to stick at 0. -static ConVar m_rawinput( "m_rawinput", "0", FCVAR_ARCHIVE, "Raw Mouse input is unavailable on OSX", true, 0.0, true, 0.0); -#else static ConVar m_rawinput( "m_rawinput", "0", FCVAR_ARCHIVE, "Use Raw Input for mouse input."); -#endif #if DEBUG ConVar cl_mouselook( "cl_mouselook", "1", FCVAR_ARCHIVE, "Set to 1 to use mouse for look, 0 for keyboard look." ); @@ -604,7 +596,7 @@ void CInput::AccumulateMouse( void ) m_flAccumulatedMouseXMovement += current_posx - x; m_flAccumulatedMouseYMovement += current_posy - y; -#elif defined( USE_SDL ) || defined( OSX ) +#elif defined( USE_SDL ) int dx, dy; engine->GetMouseDelta( dx, dy ); m_flAccumulatedMouseXMovement += dx; diff --git a/mp/src/game/client/input.h b/mp/src/game/client/input.h index bd371c80..00bbb02f 100644 --- a/mp/src/game/client/input.h +++ b/mp/src/game/client/input.h @@ -18,7 +18,7 @@ #include "ehandle.h" #include "inputsystem/AnalogCode.h" -typedef unsigned long CRC32_t; +typedef unsigned int CRC32_t; //----------------------------------------------------------------------------- // Purpose: -- cgit v1.2.3