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 +- mp/src/game/server/ai_activity.cpp | 6 +++ mp/src/game/server/ai_networkmanager.cpp | 6 +-- mp/src/game/server/basecombatcharacter.cpp | 4 ++ mp/src/game/server/baseentity.h | 1 + mp/src/game/server/cbase.cpp | 46 ++++++++++++++++++---- mp/src/game/server/doors.cpp | 15 +++++++ mp/src/game/server/functorutils.h | 12 ++++++ mp/src/game/server/gameinterface.cpp | 19 +++++---- mp/src/game/server/hl2/combine_mine.cpp | 2 +- mp/src/game/server/nav_area.h | 7 ++++ mp/src/game/server/nav_colors.cpp | 8 ++-- mp/src/game/server/nav_edit.cpp | 5 +-- mp/src/game/server/nav_entities.cpp | 20 +++++++++- mp/src/game/server/nav_mesh.cpp | 39 +++++++++++++++++- mp/src/game/server/nav_mesh.h | 4 +- mp/src/game/server/nav_mesh.vpc | 43 ++++++++++++++++++++ mp/src/game/server/server_hl2mp.vpc | 1 + mp/src/game/server/team_control_point_master.cpp | 34 +++++++++++++--- mp/src/game/server/team_control_point_master.h | 6 ++- mp/src/game/server/team_control_point_round.cpp | 32 ++++++--------- mp/src/game/server/team_objectiveresource.cpp | 18 +++++++++ mp/src/game/server/team_objectiveresource.h | 7 ++++ mp/src/game/server/team_train_watcher.cpp | 6 +-- mp/src/game/server/trigger_area_capture.cpp | 35 ++++++++++------ mp/src/game/server/trigger_area_capture.h | 27 ++++++++++--- mp/src/game/server/vote_controller.cpp | 23 ++++++----- mp/src/game/shared/activitylist.cpp | 5 +++ mp/src/game/shared/ai_activity.h | 7 ++++ mp/src/game/shared/baseentity_shared.cpp | 16 ++++++++ mp/src/game/shared/multiplay_gamerules.cpp | 2 +- mp/src/game/shared/particle_property.cpp | 6 +++ mp/src/game/shared/playernet_vars.h | 4 +- mp/src/game/shared/teamplay_round_timer.h | 1 + .../game/shared/teamplayroundbased_gamerules.cpp | 2 +- mp/src/game/shared/voice_status.cpp | 6 +-- 46 files changed, 441 insertions(+), 163 deletions(-) create mode 100644 mp/src/game/server/nav_mesh.vpc (limited to 'mp/src/game') 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: diff --git a/mp/src/game/server/ai_activity.cpp b/mp/src/game/server/ai_activity.cpp index ba9c8432..25e5c441 100644 --- a/mp/src/game/server/ai_activity.cpp +++ b/mp/src/game/server/ai_activity.cpp @@ -2147,4 +2147,10 @@ void CAI_BaseNPC::InitDefaultActivitySR(void) ADD_ACTIVITY_TO_SR( ACT_MP_RELOAD_CROUCH_PRIMARY3_END ); ADD_ACTIVITY_TO_SR( ACT_MP_RELOAD_AIRWALK_PRIMARY3_END ); ADD_ACTIVITY_TO_SR( ACT_MP_RELOAD_SWIM_PRIMARY3 ); + + ADD_ACTIVITY_TO_SR( ACT_MP_THROW ); + ADD_ACTIVITY_TO_SR( ACT_THROWABLE_VM_DRAW ); + ADD_ACTIVITY_TO_SR( ACT_THROWABLE_VM_IDLE ); + ADD_ACTIVITY_TO_SR( ACT_THROWABLE_VM_FIRE ); + } diff --git a/mp/src/game/server/ai_networkmanager.cpp b/mp/src/game/server/ai_networkmanager.cpp index 953e2884..00826e02 100644 --- a/mp/src/game/server/ai_networkmanager.cpp +++ b/mp/src/game/server/ai_networkmanager.cpp @@ -2633,7 +2633,7 @@ void CAI_NetworkBuilder::InitVisibility(CAI_Network *pNetwork, CAI_Node *pNode) if ( DebuggingConnect( pNode->m_iID, testnode ) ) { - DevMsg( "" ); // break here.. + DevMsg( " " ); // break here.. } // We know we can view ourself @@ -2814,7 +2814,7 @@ void CAI_NetworkBuilder::InitNeighbors(CAI_Network *pNetwork, CAI_Node *pNode) { if ( DebuggingConnect( pNode->m_iID, checknode ) ) { - DevMsg( "" ); // break here.. + DevMsg( " " ); // break here.. } // I'm not a neighbor of myself @@ -3204,7 +3204,7 @@ void CAI_NetworkBuilder::InitLinks(CAI_Network *pNetwork, CAI_Node *pNode) if ( DebuggingConnect( pNode->m_iID, i ) ) { - DevMsg( "" ); // break here.. + DevMsg( " " ); // break here.. } if ( !(pNode->m_eNodeInfo & bits_NODE_FALLEN) && !(pDestNode->m_eNodeInfo & bits_NODE_FALLEN) ) diff --git a/mp/src/game/server/basecombatcharacter.cpp b/mp/src/game/server/basecombatcharacter.cpp index 58767184..7fb5cce1 100644 --- a/mp/src/game/server/basecombatcharacter.cpp +++ b/mp/src/game/server/basecombatcharacter.cpp @@ -3522,6 +3522,10 @@ void CBaseCombatCharacter::ChangeTeam( int iTeamNum ) // old team member no longer in the nav mesh ClearLastKnownArea(); +#ifdef GLOWS_ENABLE + RemoveGlowEffect(); +#endif // GLOWS_ENABLE + BaseClass::ChangeTeam( iTeamNum ); } diff --git a/mp/src/game/server/baseentity.h b/mp/src/game/server/baseentity.h index 26d81804..016915ca 100644 --- a/mp/src/game/server/baseentity.h +++ b/mp/src/game/server/baseentity.h @@ -948,6 +948,7 @@ public: bool IsBSPModel() const; bool IsCombatCharacter() { return MyCombatCharacterPointer() == NULL ? false : true; } bool IsInWorld( void ) const; + virtual bool IsCombatItem( void ) const { return false; } virtual bool IsBaseCombatWeapon( void ) const { return false; } virtual bool IsWearable( void ) const { return false; } diff --git a/mp/src/game/server/cbase.cpp b/mp/src/game/server/cbase.cpp index f1f9b0d6..944e6841 100644 --- a/mp/src/game/server/cbase.cpp +++ b/mp/src/game/server/cbase.cpp @@ -278,14 +278,32 @@ void CBaseEntityOutput::FireOutput(variant_t Value, CBaseEntity *pActivator, CBa if ( ev->m_flDelay ) { char szBuffer[256]; - Q_snprintf( szBuffer, sizeof(szBuffer), "(%0.2f) output: (%s,%s) -> (%s,%s,%.1f)(%s)\n", gpGlobals->curtime, pCaller ? STRING(pCaller->m_iClassname) : "NULL", pCaller ? STRING(pCaller->GetEntityName()) : "NULL", STRING(ev->m_iTarget), STRING(ev->m_iTargetInput), ev->m_flDelay, STRING(ev->m_iParameter) ); + Q_snprintf( szBuffer, + sizeof(szBuffer), + "(%0.2f) output: (%s,%s) -> (%s,%s,%.1f)(%s)\n", + engine->GetServerTime(), + pCaller ? STRING(pCaller->m_iClassname) : "NULL", + pCaller ? STRING(pCaller->GetEntityName()) : "NULL", + STRING(ev->m_iTarget), + STRING(ev->m_iTargetInput), + ev->m_flDelay, + STRING(ev->m_iParameter) ); + DevMsg( 2, "%s", szBuffer ); ADD_DEBUG_HISTORY( HISTORY_ENTITY_IO, szBuffer ); } else { char szBuffer[256]; - Q_snprintf( szBuffer, sizeof(szBuffer), "(%0.2f) output: (%s,%s) -> (%s,%s)(%s)\n", gpGlobals->curtime, pCaller ? STRING(pCaller->m_iClassname) : "NULL", pCaller ? STRING(pCaller->GetEntityName()) : "NULL", STRING(ev->m_iTarget), STRING(ev->m_iTargetInput), STRING(ev->m_iParameter) ); + Q_snprintf( szBuffer, + sizeof(szBuffer), + "(%0.2f) output: (%s,%s) -> (%s,%s)(%s)\n", + engine->GetServerTime(), + pCaller ? STRING(pCaller->m_iClassname) : "NULL", + pCaller ? STRING(pCaller->GetEntityName()) : "NULL", STRING(ev->m_iTarget), + STRING(ev->m_iTargetInput), + STRING(ev->m_iParameter) ); + DevMsg( 2, "%s", szBuffer ); ADD_DEBUG_HISTORY( HISTORY_ENTITY_IO, szBuffer ); } @@ -749,7 +767,7 @@ void CEventQueue::Dump( void ) { EventQueuePrioritizedEvent_t *pe = m_Events.m_pNext; - Msg("Dumping event queue. Current time is: %.2f\n", gpGlobals->curtime ); + Msg( "Dumping event queue. Current time is: %.2f\n", engine->GetServerTime() ); while ( pe != NULL ) { @@ -777,7 +795,7 @@ void CEventQueue::AddEvent( const char *target, const char *targetInput, variant { // build the new event EventQueuePrioritizedEvent_t *newEvent = new EventQueuePrioritizedEvent_t; - newEvent->m_flFireTime = gpGlobals->curtime + fireDelay; // priority key in the priority queue + newEvent->m_flFireTime = engine->GetServerTime() + fireDelay; // priority key in the priority queue newEvent->m_iTarget = MAKE_STRING( target ); newEvent->m_pEntTarget = NULL; newEvent->m_iTargetInput = MAKE_STRING( targetInput ); @@ -796,7 +814,7 @@ void CEventQueue::AddEvent( CBaseEntity *target, const char *targetInput, varian { // build the new event EventQueuePrioritizedEvent_t *newEvent = new EventQueuePrioritizedEvent_t; - newEvent->m_flFireTime = gpGlobals->curtime + fireDelay; // primary priority key in the priority queue + newEvent->m_flFireTime = engine->GetServerTime() + fireDelay; // primary priority key in the priority queue newEvent->m_iTarget = NULL_STRING; newEvent->m_pEntTarget = target; newEvent->m_iTargetInput = MAKE_STRING( targetInput ); @@ -867,7 +885,7 @@ void CEventQueue::ServiceEvents( void ) EventQueuePrioritizedEvent_t *pe = m_Events.m_pNext; - while ( pe != NULL && pe->m_flFireTime <= gpGlobals->curtime ) + while ( pe != NULL && pe->m_flFireTime <= engine->GetServerTime() ) { MDLCACHE_CRITICAL_SECTION(); @@ -1150,11 +1168,23 @@ int CEventQueue::Restore( IRestore &restore ) // add the restored event into the list if ( tmpEvent.m_pEntTarget ) { - AddEvent( tmpEvent.m_pEntTarget, STRING(tmpEvent.m_iTargetInput), tmpEvent.m_VariantValue, tmpEvent.m_flFireTime - gpGlobals->curtime, tmpEvent.m_pActivator, tmpEvent.m_pCaller, tmpEvent.m_iOutputID ); + AddEvent( tmpEvent.m_pEntTarget, + STRING(tmpEvent.m_iTargetInput), + tmpEvent.m_VariantValue, + tmpEvent.m_flFireTime - engine->GetServerTime(), + tmpEvent.m_pActivator, + tmpEvent.m_pCaller, + tmpEvent.m_iOutputID ); } else { - AddEvent( STRING(tmpEvent.m_iTarget), STRING(tmpEvent.m_iTargetInput), tmpEvent.m_VariantValue, tmpEvent.m_flFireTime - gpGlobals->curtime, tmpEvent.m_pActivator, tmpEvent.m_pCaller, tmpEvent.m_iOutputID ); + AddEvent( STRING(tmpEvent.m_iTarget), + STRING(tmpEvent.m_iTargetInput), + tmpEvent.m_VariantValue, + tmpEvent.m_flFireTime - engine->GetServerTime(), + tmpEvent.m_pActivator, + tmpEvent.m_pCaller, + tmpEvent.m_iOutputID ); } } diff --git a/mp/src/game/server/doors.cpp b/mp/src/game/server/doors.cpp index d44d6632..53abb829 100644 --- a/mp/src/game/server/doors.cpp +++ b/mp/src/game/server/doors.cpp @@ -21,6 +21,10 @@ #include "KeyValues.h" #endif +#ifdef TF_DLL +#include "tf_gamerules.h" +#endif // TF_DLL + // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -332,6 +336,17 @@ void CBaseDoor::Spawn() } CreateVPhysics(); + +#ifdef TF_DLL + if ( TFGameRules() && TFGameRules()->IsMultiplayer() ) + { + if ( !m_flBlockDamage ) + { + // Never block doors in TF2 - to prevent various exploits. + m_flBlockDamage = 10.f; + } + } +#endif // TF_DLL } void CBaseDoor::MovingSoundThink( void ) diff --git a/mp/src/game/server/functorutils.h b/mp/src/game/server/functorutils.h index 8b4657b2..d07f0597 100644 --- a/mp/src/game/server/functorutils.h +++ b/mp/src/game/server/functorutils.h @@ -5,8 +5,10 @@ #ifndef _FUNCTOR_UTILS_H_ #define _FUNCTOR_UTILS_H_ +#ifdef NEXT_BOT #include "NextBotInterface.h" #include "NextBotManager.h" +#endif // NEXT_BOT //-------------------------------------------------------------------------------------------------------- /** @@ -321,12 +323,14 @@ inline bool ForEachActor( Functor &func ) if ( !player->IsConnected() ) continue; +#ifdef NEXT_BOT // skip bots - ForEachCombatCharacter will catch them INextBot *bot = player->MyNextBotPointer(); if ( bot ) { continue; } +#endif // NEXT_BOT if ( func( player ) == false ) { @@ -334,8 +338,12 @@ inline bool ForEachActor( Functor &func ) } } +#ifdef NEXT_BOT // iterate all NextBots return TheNextBots().ForEachCombatCharacter( func ); +#else + return true; +#endif // NEXT_BOT } @@ -385,12 +393,14 @@ inline bool ForEachActor( IActorFunctor &func ) if ( !player->IsConnected() ) continue; +#ifdef NEXT_BOT // skip bots - ForEachCombatCharacter will catch them INextBot *bot = dynamic_cast< INextBot * >( player ); if ( bot ) { continue; } +#endif // NEXT_BOT if ( func( player ) == false ) { @@ -399,11 +409,13 @@ inline bool ForEachActor( IActorFunctor &func ) } } +#ifdef NEXT_BOT if ( !isComplete ) { // iterate all NextBots isComplete = TheNextBots().ForEachCombatCharacter( func ); } +#endif // NEXT_BOT func.OnEndIteration( isComplete ); diff --git a/mp/src/game/server/gameinterface.cpp b/mp/src/game/server/gameinterface.cpp index 9f707419..b4d09bae 100644 --- a/mp/src/game/server/gameinterface.cpp +++ b/mp/src/game/server/gameinterface.cpp @@ -98,14 +98,17 @@ #include "tf/tf_gc_server.h" #include "tf_gamerules.h" #include "tf_lobby.h" -#include "player_vs_environment/tf_populator.h" +#include "player_vs_environment/tf_population_manager.h" extern ConVar tf_mm_trusted; extern ConVar tf_mm_servermode; #endif -#ifdef NEXT_BOT +#ifdef USE_NAV_MESH #include "nav_mesh.h" +#endif + +#ifdef NEXT_BOT #include "NextBotManager.h" #endif @@ -730,7 +733,7 @@ bool CServerGameDLL::DLLInit( CreateInterfaceFn appSystemFactory, debugoverlay = (IVDebugOverlay *)appSystemFactory( VDEBUG_OVERLAY_INTERFACE_VERSION, NULL ); #ifndef _XBOX -#ifdef NEXT_BOT +#ifdef USE_NAV_MESH // create the Navigation Mesh interface TheNavMesh = NavMeshFactory(); #endif @@ -776,7 +779,7 @@ void CServerGameDLL::DLLShutdown( void ) #endif #ifndef _XBOX -#ifdef NEXT_BOT +#ifdef USE_NAV_MESH // destroy the Navigation Mesh interface if ( TheNavMesh ) { @@ -1125,7 +1128,7 @@ void CServerGameDLL::ServerActivate( edict_t *pEdictList, int edictCount, int cl } #ifndef _XBOX -#ifdef NEXT_BOT +#ifdef USE_NAV_MESH // load the Navigation Mesh for this map TheNavMesh->Load(); TheNavMesh->OnServerActivate(); @@ -1220,9 +1223,11 @@ void CServerGameDLL::GameFrame( bool simulating ) GameStartFrame(); #ifndef _XBOX -#ifdef NEXT_BOT +#ifdef USE_NAV_MESH TheNavMesh->Update(); +#endif +#ifdef NEXT_BOT TheNextBots().Update(); #endif @@ -1388,7 +1393,7 @@ void CServerGameDLL::LevelShutdown( void ) g_nCurrentChapterIndex = -1; #ifndef _XBOX -#ifdef NEXT_BOT +#ifdef USE_NAV_MESH // reset the Navigation Mesh if ( TheNavMesh ) { diff --git a/mp/src/game/server/hl2/combine_mine.cpp b/mp/src/game/server/hl2/combine_mine.cpp index 6d49f94e..d3e40b56 100644 --- a/mp/src/game/server/hl2/combine_mine.cpp +++ b/mp/src/game/server/hl2/combine_mine.cpp @@ -244,7 +244,7 @@ int CBounceBomb::DrawDebugTextOverlays(void) if (m_debugOverlays & OVERLAY_TEXT_BIT) { char tempstr[512]; - Q_snprintf(tempstr,sizeof(tempstr), pszMineStateNames[m_iMineState] ); + Q_snprintf(tempstr,sizeof(tempstr), "%s", pszMineStateNames[m_iMineState] ); EntityText(text_offset,tempstr,0); text_offset++; } diff --git a/mp/src/game/server/nav_area.h b/mp/src/game/server/nav_area.h index cbabe493..6eba5966 100644 --- a/mp/src/game/server/nav_area.h +++ b/mp/src/game/server/nav_area.h @@ -313,10 +313,12 @@ public: bool HasAvoidanceObstacle( float maxObstructionHeight = StepHeight ) const; // is there a large, immobile object obstructing this area float GetAvoidanceObstacleHeight( void ) const; // returns the maximum height of the obstruction above the ground +#ifdef NEXT_BOT bool HasPrerequisite( CBaseCombatCharacter *actor = NULL ) const; // return true if this area has a prerequisite that applies to the given actor const CUtlVector< CHandle< CFuncNavPrerequisite > > &GetPrerequisiteVector( void ) const; // return vector of prerequisites that must be met before this area can be traversed void RemoveAllPrerequisites( void ); void AddPrerequisite( CFuncNavPrerequisite *prereq ); +#endif void ClearAllNavCostEntities( void ); // clear set of func_nav_cost entities that affect this area void AddFuncNavCostEntity( CFuncNavCost *cost ); // add the given func_nav_cost entity to the cost of this area @@ -722,7 +724,9 @@ private: void CalcDebugID(); +#ifdef NEXT_BOT CUtlVector< CHandle< CFuncNavPrerequisite > > m_prerequisiteVector; // list of prerequisites that must be met before this area can be traversed +#endif CNavArea *m_prevHash, *m_nextHash; // for hash table in CNavMesh @@ -764,6 +768,8 @@ extern NavAreaVector TheNavAreas; // Inlines // +#ifdef NEXT_BOT + //-------------------------------------------------------------------------------------------------------------- inline bool CNavArea::HasPrerequisite( CBaseCombatCharacter *actor ) const { @@ -790,6 +796,7 @@ inline void CNavArea::AddPrerequisite( CFuncNavPrerequisite *prereq ) m_prerequisiteVector.AddToTail( prereq ); } } +#endif //-------------------------------------------------------------------------------------------------------------- inline float CNavArea::GetDangerDecayRate( void ) const diff --git a/mp/src/game/server/nav_colors.cpp b/mp/src/game/server/nav_colors.cpp index 8f2035be..50ba6cac 100644 --- a/mp/src/game/server/nav_colors.cpp +++ b/mp/src/game/server/nav_colors.cpp @@ -79,8 +79,8 @@ void NavDrawLine( const Vector& from, const Vector& to, NavEditColor navColor ) const Vector offset( 0, 0, 1 ); Color color = NavColors[navColor]; - NDebugOverlay::Line( from + offset, to + offset, color[0]/2, color[1]/2, color[2]/2, true, 0.1f ); - NDebugOverlay::Line( from + offset, to + offset, color[0], color[1], color[2], false, 0.15f ); + NDebugOverlay::Line( from + offset, to + offset, color[0], color[1], color[2], false, NDEBUG_PERSIST_TILL_NEXT_SERVER ); + NDebugOverlay::Line( from + offset, to + offset, color[0]/2, color[1]/2, color[2]/2, true, NDEBUG_PERSIST_TILL_NEXT_SERVER ); } @@ -113,8 +113,8 @@ void NavDrawHorizontalArrow( const Vector& from, const Vector& to, float width, const Vector offset( 0, 0, 1 ); Color color = NavColors[navColor]; - NDebugOverlay::HorzArrow( from + offset, to + offset, width, color[0]/2, color[1]/2, color[2]/2, 255, true, NDEBUG_PERSIST_TILL_NEXT_SERVER ); NDebugOverlay::HorzArrow( from + offset, to + offset, width, color[0], color[1], color[2], 255, false, NDEBUG_PERSIST_TILL_NEXT_SERVER ); + NDebugOverlay::HorzArrow( from + offset, to + offset, width, color[0]/2, color[1]/2, color[2]/2, 255, true, NDEBUG_PERSIST_TILL_NEXT_SERVER ); } @@ -142,8 +142,8 @@ void NavDrawDashedLine( const Vector& from, const Vector& to, NavEditColor navCo distance += solidLen + gapLen; - NDebugOverlay::Line( start + offset, end + offset, color[0]/2, color[1]/2, color[2]/2, true, NDEBUG_PERSIST_TILL_NEXT_SERVER ); NDebugOverlay::Line( start + offset, end + offset, color[0], color[1], color[2], false, NDEBUG_PERSIST_TILL_NEXT_SERVER ); + NDebugOverlay::Line( start + offset, end + offset, color[0]/2, color[1]/2, color[2]/2, true, NDEBUG_PERSIST_TILL_NEXT_SERVER ); } } diff --git a/mp/src/game/server/nav_edit.cpp b/mp/src/game/server/nav_edit.cpp index cea4e41d..512d5dda 100644 --- a/mp/src/game/server/nav_edit.cpp +++ b/mp/src/game/server/nav_edit.cpp @@ -732,9 +732,6 @@ void CNavMesh::DrawEditMode( void ) static ConVarRef host_thread_mode( "host_thread_mode" ); host_thread_mode.SetValue( 0 ); - static ConVarRef sb_perf_collect( "sb_perf_collect" ); - sb_perf_collect.SetValue( 0 ); - const float maxRange = 1000.0f; // 500 #if DEBUG_NAV_NODES @@ -908,7 +905,7 @@ void CNavMesh::DrawEditMode( void ) { V_snprintf( buffer, sizeof( buffer ), "Ladder #%d\n", m_selectedLadder->GetID() ); } - NDebugOverlay::ScreenText( 0.5, 0.53, buffer, 255, 255, 0, 128, nav_show_area_info.GetBool() ? 0.1 : 0.5 ); + NDebugOverlay::ScreenText( 0.5, 0.53, buffer, 255, 255, 0, 128, NDEBUG_PERSIST_TILL_NEXT_SERVER ); } // draw the ladder we are pointing at and all connected areas diff --git a/mp/src/game/server/nav_entities.cpp b/mp/src/game/server/nav_entities.cpp index c7abe838..ef9366cc 100644 --- a/mp/src/game/server/nav_entities.cpp +++ b/mp/src/game/server/nav_entities.cpp @@ -96,7 +96,7 @@ void CFuncNavCost::Spawn( void ) for( char *token = strtok( buffer, " " ); token; token = strtok( NULL, " " ) ) { - m_tags.AddToTail( token ); + m_tags.AddToTail( CFmtStr( "%s", token ) ); } delete [] buffer; @@ -189,6 +189,19 @@ bool CFuncNavCost::IsApplicableTo( CBaseCombatCharacter *who ) const return true; } + // check custom bomb_carrier tags for this bot + for( int i=0; iHasTag( pszTag ) ) + { + return true; + } + } + } + // the bomb carrier only pays attention to bomb_carrier costs return false; } @@ -217,6 +230,11 @@ bool CFuncNavCost::IsApplicableTo( CBaseCombatCharacter *who ) const } } + if ( bot->HasMission( CTFBot::MISSION_REPROGRAMMED ) ) + { + return false; + } + if ( !bot->IsOnAnyMission() ) { if ( HasTag( "common" ) ) diff --git a/mp/src/game/server/nav_mesh.cpp b/mp/src/game/server/nav_mesh.cpp index 095fabb0..05cf7ff7 100644 --- a/mp/src/game/server/nav_mesh.cpp +++ b/mp/src/game/server/nav_mesh.cpp @@ -21,13 +21,15 @@ #endif #include "functorutils.h" +#ifdef NEXT_BOT #include "NextBot/NavMeshEntities/func_nav_prerequisite.h" +#endif // NOTE: This has to be the last file included! #include "tier0/memdbgon.h" -#define DrawLine( from, to, duration, red, green, blue ) NDebugOverlay::Line( from, to, red, green, blue, true, 0.1f ) +#define DrawLine( from, to, duration, red, green, blue ) NDebugOverlay::Line( from, to, red, green, blue, true, NDEBUG_PERSIST_TILL_NEXT_SERVER ) /** @@ -42,6 +44,7 @@ ConVar nav_show_danger( "nav_show_danger", "0", FCVAR_GAMEDLL | FCVAR_CHEAT, "Sh ConVar nav_show_player_counts( "nav_show_player_counts", "0", FCVAR_GAMEDLL | FCVAR_CHEAT, "Show current player counts in each area." ); ConVar nav_show_func_nav_avoid( "nav_show_func_nav_avoid", "0", FCVAR_GAMEDLL | FCVAR_CHEAT, "Show areas of designer-placed bot avoidance due to func_nav_avoid entities" ); ConVar nav_show_func_nav_prefer( "nav_show_func_nav_prefer", "0", FCVAR_GAMEDLL | FCVAR_CHEAT, "Show areas of designer-placed bot preference due to func_nav_prefer entities" ); +ConVar nav_show_func_nav_prerequisite( "nav_show_func_nav_prerequisite", "0", FCVAR_GAMEDLL | FCVAR_CHEAT, "Show areas of designer-placed bot preference due to func_nav_prerequisite entities" ); ConVar nav_max_vis_delta_list_length( "nav_max_vis_delta_list_length", "64", FCVAR_CHEAT ); extern ConVar nav_show_potentially_visible; @@ -302,6 +305,13 @@ void CNavMesh::Update( void ) DrawFuncNavPrefer(); } +#ifdef NEXT_BOT + if ( nav_show_func_nav_prerequisite.GetBool() ) + { + DrawFuncNavPrerequisite(); + } +#endif + if ( nav_show_potentially_visible.GetBool() ) { CBasePlayer *player = UTIL_GetListenServerHost(); @@ -569,6 +579,7 @@ void CNavMesh::OnServerActivate( void ) } } +#ifdef NEXT_BOT //-------------------------------------------------------------------------------------------------------------- class CRegisterPrerequisite @@ -588,6 +599,8 @@ public: CFuncNavPrerequisite *m_prereq; }; +#endif + //-------------------------------------------------------------------------------------------------------------- /** * Test all areas for blocked status @@ -609,6 +622,7 @@ void CNavMesh::OnRoundRestart( void ) { m_updateBlockedAreasTimer.Start( 1.0f ); +#ifdef NEXT_BOT FOR_EACH_VEC( TheNavAreas, pit ) { CNavArea *area = TheNavAreas[ pit ]; @@ -626,6 +640,7 @@ void CNavMesh::OnRoundRestart( void ) ForAllAreasOverlappingExtent( apply, prereqExtent ); } +#endif } @@ -1420,7 +1435,7 @@ void CNavMesh::DrawPlayerCounts( void ) const if (area->GetPlayerCount() > 0) { - NDebugOverlay::Text( area->GetCenter(), msg.sprintf( "%d (%d/%d)", area->GetPlayerCount(), area->GetPlayerCount(1), area->GetPlayerCount(2) ), false, 0.1f ); + NDebugOverlay::Text( area->GetCenter(), msg.sprintf( "%d (%d/%d)", area->GetPlayerCount(), area->GetPlayerCount(1), area->GetPlayerCount(2) ), false, NDEBUG_PERSIST_TILL_NEXT_SERVER ); } } } @@ -1462,6 +1477,26 @@ void CNavMesh::DrawFuncNavPrefer( void ) const } +#ifdef NEXT_BOT +//-------------------------------------------------------------------------------------------------------------- +/** + * Draw bot preference areas from func_nav_prerequisite entities + */ +void CNavMesh::DrawFuncNavPrerequisite( void ) const +{ + FOR_EACH_VEC( TheNavAreas, it ) + { + CNavArea *area = TheNavAreas[ it ]; + + if ( area->HasPrerequisite() ) + { + area->DrawFilled( 0, 0, 255, 255 ); + } + } +} +#endif + + //-------------------------------------------------------------------------------------------------------------- /** * Increase the danger of nav areas containing and near the given position diff --git a/mp/src/game/server/nav_mesh.h b/mp/src/game/server/nav_mesh.h index dd608792..21dc200b 100644 --- a/mp/src/game/server/nav_mesh.h +++ b/mp/src/game/server/nav_mesh.h @@ -340,7 +340,9 @@ public: void DrawPlayerCounts( void ) const; // draw the current player counts for each area void DrawFuncNavAvoid( void ) const; // draw bot avoidance areas from func_nav_avoid entities void DrawFuncNavPrefer( void ) const; // draw bot preference areas from func_nav_prefer entities - +#ifdef NEXT_BOT + void DrawFuncNavPrerequisite( void ) const; // draw bot prerequisite areas from func_nav_prerequisite entities +#endif //------------------------------------------------------------------------------------- // Auto-generation // diff --git a/mp/src/game/server/nav_mesh.vpc b/mp/src/game/server/nav_mesh.vpc new file mode 100644 index 00000000..a9af8574 --- /dev/null +++ b/mp/src/game/server/nav_mesh.vpc @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------- +// NAV_MESH.VPC +// +// Project script for navigation mesh files (no NextBot files) +//----------------------------------------------------------------------------- + +$Configuration +{ + $Compiler + { + $PreprocessorDefinitions "$BASE;USE_NAV_MESH" + } +} + +$Project +{ + $Folder "Source Files" + { + $Folder "Navigation Mesh" + { + $File "nav.h" + $File "nav_area.cpp" + $File "nav_area.h" + $File "nav_colors.cpp" + $File "nav_colors.h" + $File "nav_edit.cpp" + $File "nav_entities.cpp" + $File "nav_entities.h" + $File "nav_file.cpp" + $File "nav_generate.cpp" + $File "nav_ladder.cpp" + $File "nav_ladder.h" + $File "nav_merge.cpp" + $File "nav_mesh.cpp" + $File "nav_mesh.h" + $File "nav_mesh_factory.cpp" + $File "nav_node.cpp" + $File "nav_node.h" + $File "nav_pathfind.h" + $File "nav_simplify.cpp" + } + } +} \ No newline at end of file diff --git a/mp/src/game/server/server_hl2mp.vpc b/mp/src/game/server/server_hl2mp.vpc index 1dfbdbc2..e4002760 100644 --- a/mp/src/game/server/server_hl2mp.vpc +++ b/mp/src/game/server/server_hl2mp.vpc @@ -9,6 +9,7 @@ $Macro GAMENAME "hl2mp" [!$SOURCESDK] $Macro GAMENAME "mod_hl2mp" [$SOURCESDK] $Include "$SRCDIR\game\server\server_base.vpc" +$Include "$SRCDIR\game\server\nav_mesh.vpc" [$SOURCESDK] $Configuration { diff --git a/mp/src/game/server/team_control_point_master.cpp b/mp/src/game/server/team_control_point_master.cpp index 6a579e01..662d8200 100644 --- a/mp/src/game/server/team_control_point_master.cpp +++ b/mp/src/game/server/team_control_point_master.cpp @@ -24,6 +24,9 @@ BEGIN_DATADESC( CTeamControlPointMaster ) DEFINE_KEYFIELD( m_flPartialCapturePointsRate, FIELD_FLOAT, "partial_cap_points_rate" ), + DEFINE_KEYFIELD( m_flCustomPositionX, FIELD_FLOAT, "custom_position_x" ), + DEFINE_KEYFIELD( m_flCustomPositionY, FIELD_FLOAT, "custom_position_y" ), + // DEFINE_FIELD( m_ControlPoints, CUtlMap < int , CTeamControlPoint * > ), // DEFINE_FIELD( m_bFoundPoints, FIELD_BOOLEAN ), // DEFINE_FIELD( m_ControlPointRounds, CUtlVector < CTeamControlPointRound * > ), @@ -40,6 +43,8 @@ BEGIN_DATADESC( CTeamControlPointMaster ) DEFINE_INPUTFUNC( FIELD_VOID, "RoundSpawn", InputRoundSpawn ), DEFINE_INPUTFUNC( FIELD_VOID, "RoundActivate", InputRoundActivate ), DEFINE_INPUTFUNC( FIELD_STRING, "SetCapLayout", InputSetCapLayout ), + DEFINE_INPUTFUNC( FIELD_FLOAT, "SetCapLayoutCustomPositionX", InputSetCapLayoutCustomPositionX ), + DEFINE_INPUTFUNC( FIELD_FLOAT, "SetCapLayoutCustomPositionY", InputSetCapLayoutCustomPositionY ), DEFINE_FUNCTION( CPMThink ), @@ -70,6 +75,8 @@ int ControlPointRoundSort( CTeamControlPointRound* const *p1, CTeamControlPointR CTeamControlPointMaster::CTeamControlPointMaster() { m_flPartialCapturePointsRate = 0.0f; + m_flCustomPositionX = -1.f; + m_flCustomPositionY = -1.f; } //----------------------------------------------------------------------------- @@ -329,6 +336,7 @@ bool CTeamControlPointMaster::FindControlPointRounds( void ) { g_pObjectiveResource->SetPlayingMiniRounds( bFoundRounds ); g_pObjectiveResource->SetCapLayoutInHUD( STRING(m_iszCapLayoutInHUD) ); + g_pObjectiveResource->SetCapLayoutCustomPosition( m_flCustomPositionX, m_flCustomPositionY ); } return bFoundRounds; @@ -837,15 +845,11 @@ void CTeamControlPointMaster::InputRoundSpawn( inputdata_t &input ) // init the ClientAreas int index = 0; - CBaseEntity *pEnt = gEntList.FindEntityByClassname( NULL, GetTriggerAreaCaptureName() ); - while( pEnt ) + for ( int i=0; i( ITriggerAreaCaptureAutoList::AutoList()[i] ); pArea->SetAreaIndex( index ); index++; - - pEnt = gEntList.FindEntityByClassname( pEnt, GetTriggerAreaCaptureName() ); } ObjectiveResource()->ResetControlPoints(); @@ -889,6 +893,24 @@ void CTeamControlPointMaster::InputSetCapLayout( inputdata_t &inputdata ) g_pObjectiveResource->SetCapLayoutInHUD( STRING(m_iszCapLayoutInHUD) ); } +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CTeamControlPointMaster::InputSetCapLayoutCustomPositionX( inputdata_t &inputdata ) +{ + m_flCustomPositionX = inputdata.value.Float(); + g_pObjectiveResource->SetCapLayoutCustomPosition( m_flCustomPositionX, m_flCustomPositionY ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CTeamControlPointMaster::InputSetCapLayoutCustomPositionY( inputdata_t &inputdata ) +{ + m_flCustomPositionY = inputdata.value.Float(); + g_pObjectiveResource->SetCapLayoutCustomPosition( m_flCustomPositionX, m_flCustomPositionY ); +} + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- diff --git a/mp/src/game/server/team_control_point_master.h b/mp/src/game/server/team_control_point_master.h index 48265ba6..64b1e9b5 100644 --- a/mp/src/game/server/team_control_point_master.h +++ b/mp/src/game/server/team_control_point_master.h @@ -36,7 +36,6 @@ public: CTeamControlPointMaster(); // Used to find game specific entities - virtual const char *GetTriggerAreaCaptureName( void ) { return "trigger_capture_area"; } virtual const char *GetControlPointName( void ) { return "team_control_point"; } virtual const char *GetControlPointRoundName( void ) { return "team_control_point_round"; } @@ -182,6 +181,8 @@ private: void InputSetWinner( inputdata_t &inputdata ); void InputSetWinnerAndForceCaps( inputdata_t &inputdata ); void InputSetCapLayout( inputdata_t &inputdata ); + void InputSetCapLayoutCustomPositionX( inputdata_t &inputdata ); + void InputSetCapLayoutCustomPositionY( inputdata_t &inputdata ); void InternalSetWinner( int iTeam ); @@ -191,6 +192,9 @@ private: int m_iTeamBaseIcons[MAX_TEAMS]; string_t m_iszCapLayoutInHUD; + float m_flCustomPositionX; + float m_flCustomPositionY; + int m_iInvalidCapWinner; bool m_bSwitchTeamsOnWin; bool m_bScorePerCapture; diff --git a/mp/src/game/server/team_control_point_round.cpp b/mp/src/game/server/team_control_point_round.cpp index cc3d0cc7..c9e36bd7 100644 --- a/mp/src/game/server/team_control_point_round.cpp +++ b/mp/src/game/server/team_control_point_round.cpp @@ -365,33 +365,27 @@ bool CTeamControlPointRound::MakePlayable( void ) if ( !IsPlayable() ) { // we need to try switching the owners of the teams to make this round playable - for ( int i = FIRST_GAME_TEAM ; i < GetNumberOfTeams() ; i++ ) + for ( int iTeam = FIRST_GAME_TEAM ; iTeam < GetNumberOfTeams() ; iTeam++ ) { - for ( int j = 0 ; j < m_ControlPoints.Count() ; j++ ) + for ( int iControlPoint = 0 ; iControlPoint < m_ControlPoints.Count() ; iControlPoint++ ) { - if ( ( !pMaster->IsBaseControlPoint( m_ControlPoints[j]->GetPointIndex() ) ) && // this is NOT the base point for one of the teams (we don't want to assign the base to the wrong team) - ( !WouldNewCPOwnerWinGame( m_ControlPoints[j], i ) ) ) // making this change would make this round playable + if ( ( !pMaster->IsBaseControlPoint( m_ControlPoints[iControlPoint]->GetPointIndex() ) ) && // this is NOT the base point for one of the teams (we don't want to assign the base to the wrong team) + ( !WouldNewCPOwnerWinGame( m_ControlPoints[iControlPoint], iTeam ) ) ) // making this change would make this round playable { // need to find the trigger area associated with this point - CBaseEntity *pEnt = gEntList.FindEntityByClassname( NULL, pMaster->GetTriggerAreaCaptureName() ); - while( pEnt ) + for ( int iObj=0; iObj( pEnt ); - if ( pArea ) - { - if ( pArea->TeamCanCap( i ) ) + CTriggerAreaCapture *pArea = static_cast< CTriggerAreaCapture * >( ITriggerAreaCaptureAutoList::AutoList()[iObj] ); + if ( pArea->TeamCanCap( iTeam ) ) + { + CHandle hPoint = pArea->GetControlPoint(); + if ( hPoint == m_ControlPoints[iControlPoint] ) { - CHandle hPoint = pArea->GetControlPoint(); - if ( hPoint == m_ControlPoints[j] ) - { - // found! - pArea->ForceOwner( i ); // this updates the trigger_area *and* the control_point - return true; - } + // found! + pArea->ForceOwner( iTeam ); // this updates the trigger_area *and* the control_point + return true; } } - - pEnt = gEntList.FindEntityByClassname( pEnt, pMaster->GetTriggerAreaCaptureName() ); } } } diff --git a/mp/src/game/server/team_objectiveresource.cpp b/mp/src/game/server/team_objectiveresource.cpp index 9f8d0e7f..f7dd502e 100644 --- a/mp/src/game/server/team_objectiveresource.cpp +++ b/mp/src/game/server/team_objectiveresource.cpp @@ -61,7 +61,10 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE(CBaseTeamObjectiveResource, DT_BaseTeamObjective SendPropArray3( SENDINFO_ARRAY3(m_iTeamInZone), SendPropInt( SENDINFO_ARRAY(m_iTeamInZone), 4, SPROP_UNSIGNED ) ), SendPropArray3( SENDINFO_ARRAY3(m_bBlocked), SendPropInt( SENDINFO_ARRAY(m_bBlocked), 1, SPROP_UNSIGNED ) ), SendPropArray3( SENDINFO_ARRAY3(m_iOwner), SendPropInt( SENDINFO_ARRAY(m_iOwner), 4, SPROP_UNSIGNED ) ), + SendPropArray3( SENDINFO_ARRAY3(m_bCPCapRateScalesWithPlayers), SendPropBool( SENDINFO_ARRAY(m_bCPCapRateScalesWithPlayers) ) ), SendPropString( SENDINFO(m_pszCapLayoutInHUD) ), + SendPropFloat( SENDINFO( m_flCustomPositionX ) ), + SendPropFloat( SENDINFO( m_flCustomPositionY ) ), END_SEND_TABLE() @@ -72,6 +75,8 @@ BEGIN_DATADESC( CBaseTeamObjectiveResource ) DEFINE_FIELD( m_bPlayingMiniRounds, FIELD_BOOLEAN ), DEFINE_FIELD( m_bControlPointsReset, FIELD_BOOLEAN ), DEFINE_FIELD( m_iUpdateCapHudParity, FIELD_INTEGER ), + DEFINE_FIELD( m_flCustomPositionX, FIELD_FLOAT ), + DEFINE_FIELD( m_flCustomPositionY, FIELD_FLOAT ), DEFINE_ARRAY( m_vCPPositions, FIELD_VECTOR, MAX_CONTROL_POINTS ), DEFINE_ARRAY( m_bCPIsVisible, FIELD_INTEGER, MAX_CONTROL_POINTS ), DEFINE_ARRAY( m_flLazyCapPerc, FIELD_FLOAT, MAX_CONTROL_POINTS ), @@ -91,6 +96,7 @@ BEGIN_DATADESC( CBaseTeamObjectiveResource ) DEFINE_ARRAY( m_iTeamInZone, FIELD_INTEGER, MAX_CONTROL_POINTS ), DEFINE_ARRAY( m_bBlocked, FIELD_BOOLEAN, MAX_CONTROL_POINTS ), DEFINE_ARRAY( m_iOwner, FIELD_INTEGER, MAX_CONTROL_POINTS ), + DEFINE_ARRAY( m_bCPCapRateScalesWithPlayers, FIELD_BOOLEAN, MAX_CONTROL_POINTS ), DEFINE_ARRAY( m_pszCapLayoutInHUD, FIELD_CHARACTER, MAX_CAPLAYOUT_LENGTH ), DEFINE_ARRAY( m_flCapPercentages, FIELD_FLOAT, MAX_CONTROL_POINTS ), DEFINE_ARRAY( m_iCPGroup, FIELD_INTEGER, MAX_CONTROL_POINTS ), @@ -114,6 +120,8 @@ CBaseTeamObjectiveResource::CBaseTeamObjectiveResource() m_bPlayingMiniRounds = false; m_iUpdateCapHudParity = 0; m_bControlPointsReset = false; + m_flCustomPositionX = -1.f; + m_flCustomPositionY = -1.f; } //----------------------------------------------------------------------------- @@ -153,6 +161,7 @@ void CBaseTeamObjectiveResource::Spawn( void ) m_bCPLocked.Set( i, false ); m_flUnlockTimes.Set( i, 0.0 ); m_flCPTimerTimes.Set( i, -1.0 ); + m_bCPCapRateScalesWithPlayers.Set( i, true ); for ( int team = 0; team < MAX_CONTROL_POINT_TEAMS; team++ ) { @@ -381,6 +390,15 @@ void CBaseTeamObjectiveResource::SetCPTimerTime( int index, float flTime ) m_flCPTimerTimes.Set( index, flTime ); } +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CBaseTeamObjectiveResource::SetCPCapTimeScalesWithPlayers( int index, bool bScales ) +{ + AssertValidIndex(index); + m_bCPCapRateScalesWithPlayers.Set( index, bScales ); +} + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- diff --git a/mp/src/game/server/team_objectiveresource.h b/mp/src/game/server/team_objectiveresource.h index 40d1920c..5cc42009 100644 --- a/mp/src/game/server/team_objectiveresource.h +++ b/mp/src/game/server/team_objectiveresource.h @@ -58,6 +58,7 @@ public: int GetPreviousPointForPoint( int index, int team, int iPrevIndex ); bool TeamCanCapPoint( int index, int team ); void SetCapLayoutInHUD( const char *pszLayout ) { Q_strncpy(m_pszCapLayoutInHUD.GetForModify(), pszLayout, MAX_CAPLAYOUT_LENGTH ); } + void SetCapLayoutCustomPosition( float flPositionX, float flPositionY ) { m_flCustomPositionX = flPositionX; m_flCustomPositionY = flPositionY; } void SetWarnOnCap( int index, int iWarnLevel ); void SetWarnSound( int index, string_t iszSound ); void SetCPGroup( int index, int iCPGroup ); @@ -65,6 +66,7 @@ public: void SetTrackAlarm( int index, bool bAlarm ); void SetCPUnlockTime( int index, float flTime ); void SetCPTimerTime( int index, float flTime ); + void SetCPCapTimeScalesWithPlayers( int index, bool bScales ); // State functions, called many times void SetNumPlayers( int index, int team, int iNumPlayers ); @@ -205,10 +207,15 @@ private: // changes when a point is successfully captured CNetworkArray( int, m_iOwner, MAX_CONTROL_POINTS ); + CNetworkArray( bool, m_bCPCapRateScalesWithPlayers, MAX_CONTROL_POINTS ); // describes how to lay out the cap points in the hud CNetworkString( m_pszCapLayoutInHUD, MAX_CAPLAYOUT_LENGTH ); + // custom screen position for the cap points in the hud + CNetworkVar( float, m_flCustomPositionX ); + CNetworkVar( float, m_flCustomPositionY ); + // the groups the points belong to CNetworkArray( int, m_iCPGroup, MAX_CONTROL_POINTS ); diff --git a/mp/src/game/server/team_train_watcher.cpp b/mp/src/game/server/team_train_watcher.cpp index 27d7a15c..cf6631fb 100644 --- a/mp/src/game/server/team_train_watcher.cpp +++ b/mp/src/game/server/team_train_watcher.cpp @@ -819,17 +819,15 @@ void CTeamTrainWatcher::WatcherActivate( void ) { if ( m_hTrain ) { - CTriggerAreaCapture *pArea = dynamic_cast( gEntList.FindEntityByClassname( NULL, "trigger_capture_area" ) ); - while( pArea ) + for ( int i=0; i( ITriggerAreaCaptureAutoList::AutoList()[i] ); if ( pArea->GetParent() == m_hTrain.Get() ) { // this is the capture area we care about, so let it know that we want updates on the capture numbers pArea->SetTrainWatcher( this ); break; } - - pArea = dynamic_cast( gEntList.FindEntityByClassname( pArea, "trigger_capture_area" ) ); } } diff --git a/mp/src/game/server/trigger_area_capture.cpp b/mp/src/game/server/trigger_area_capture.cpp index fcf3a868..665bd005 100644 --- a/mp/src/game/server/trigger_area_capture.cpp +++ b/mp/src/game/server/trigger_area_capture.cpp @@ -18,10 +18,12 @@ extern ConVar mp_capstyle; extern ConVar mp_blockstyle; extern ConVar mp_capdeteriorate_time; +IMPLEMENT_AUTO_LIST( ITriggerAreaCaptureAutoList ); + BEGIN_DATADESC(CTriggerAreaCapture) // Touch functions - DEFINE_FUNCTION( AreaTouch ), + DEFINE_FUNCTION( CTriggerAreaCaptureShim::Touch ), // Think functions DEFINE_THINKFUNC( CaptureThink ), @@ -96,7 +98,7 @@ void CTriggerAreaCapture::Spawn( void ) m_iAreaIndex = -1; - SetTouch ( &CTriggerAreaCapture::AreaTouch ); + SetTouch ( &CTriggerAreaCaptureShim::Touch ); SetThink( &CTriggerAreaCapture::CaptureThink ); SetNextThink( gpGlobals->curtime + AREA_THINK_TIME ); @@ -250,6 +252,14 @@ void CTriggerAreaCapture::EndTouch(CBaseEntity *pOther) BaseClass::EndTouch( pOther ); } +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool CTriggerAreaCapture::CaptureModeScalesWithPlayers() const +{ + return mp_capstyle.GetBool(); +} + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- @@ -469,7 +479,7 @@ void CTriggerAreaCapture::CaptureThink( void ) float flTimeDelta = gpGlobals->curtime - m_flLastReductionTime; float flReduction = flTimeDelta; - if ( mp_capstyle.GetInt() == 1 ) + if ( CaptureModeScalesWithPlayers() ) { // Diminishing returns for successive players. for ( int i = 1; i < m_TeamData[m_nTeamInZone].iNumTouching; i++ ) @@ -490,7 +500,7 @@ void CTriggerAreaCapture::CaptureThink( void ) // See if anyone gets credit for the block float flPercentToGo = m_fTimeRemaining / m_flCapTime; - if ( mp_capstyle.GetInt() == 1 ) + if ( CaptureModeScalesWithPlayers() ) { flPercentToGo = m_fTimeRemaining / ((m_flCapTime * 2) * m_TeamData[m_nCapturingTeam].iNumRequiredToCap); } @@ -561,7 +571,7 @@ void CTriggerAreaCapture::CaptureThink( void ) } float flTotalTimeToCap = m_flCapTime; - if ( mp_capstyle.GetInt() == 1 ) + if ( CaptureModeScalesWithPlayers() ) { flTotalTimeToCap = ((m_flCapTime * 2) * m_TeamData[m_nCapturingTeam].iNumRequiredToCap); } @@ -580,7 +590,8 @@ void CTriggerAreaCapture::CaptureThink( void ) // Caps deteriorate over time if ( TeamplayRoundBasedRules() && m_hPoint && TeamplayRoundBasedRules()->TeamMayCapturePoint(m_nCapturingTeam,m_hPoint->GetPointIndex()) ) { - float flDecrease = (flTotalTimeToCap / mp_capdeteriorate_time.GetFloat()) * flTimeDelta; + float flDecreaseScale = CaptureModeScalesWithPlayers() ? mp_capdeteriorate_time.GetFloat() : flTotalTimeToCap; + float flDecrease = (flTotalTimeToCap / flDecreaseScale) * flTimeDelta; if ( TeamplayRoundBasedRules() && TeamplayRoundBasedRules()->InOvertime() ) { flDecrease *= 6; @@ -649,7 +660,7 @@ void CTriggerAreaCapture::CaptureThink( void ) if ( m_TeamData[i].iNumTouching < m_TeamData[i].iNumRequiredToStartCap ) continue; - if ( mp_capstyle.GetInt() == 0 && m_TeamData[i].iNumTouching < m_TeamData[i].iNumRequiredToCap ) + if ( !CaptureModeScalesWithPlayers() && m_TeamData[i].iNumTouching < m_TeamData[i].iNumRequiredToCap ) continue; StartCapture( i, CAPTURE_NORMAL ); @@ -670,7 +681,7 @@ void CTriggerAreaCapture::SetCapTimeRemaining( float flTime ) if ( m_nCapturingTeam ) { flCapPercentage = m_fTimeRemaining / m_flCapTime; - if ( mp_capstyle.GetInt() == 1 ) + if ( CaptureModeScalesWithPlayers() ) { flCapPercentage = m_fTimeRemaining / ((m_flCapTime * 2) * m_TeamData[m_nCapturingTeam].iNumRequiredToCap); } @@ -762,7 +773,7 @@ void CTriggerAreaCapture::StartCapture( int team, int capmode ) UpdateNumPlayers(); - if ( mp_capstyle.GetInt() == 1 ) + if ( CaptureModeScalesWithPlayers() ) { SetCapTimeRemaining( ((m_flCapTime * 2) * m_TeamData[team].iNumRequiredToCap) ); } @@ -1017,7 +1028,7 @@ void CTriggerAreaCapture::InputRoundSpawn( inputdata_t &inputdata ) ObjectiveResource()->SetCPRequiredCappers( m_hPoint->GetPointIndex(), i, m_TeamData[i].iNumRequiredToCap ); ObjectiveResource()->SetTeamCanCap( m_hPoint->GetPointIndex(), i, m_TeamData[i].bCanCap ); - if ( mp_capstyle.GetInt() == 1 ) + if ( CaptureModeScalesWithPlayers() ) { ObjectiveResource()->SetCPCapTime( m_hPoint->GetPointIndex(), i, (m_flCapTime * 2) * m_TeamData[i].iNumRequiredToCap ); } @@ -1025,6 +1036,8 @@ void CTriggerAreaCapture::InputRoundSpawn( inputdata_t &inputdata ) { ObjectiveResource()->SetCPCapTime( m_hPoint->GetPointIndex(), i, m_flCapTime ); } + + ObjectiveResource()->SetCPCapTimeScalesWithPlayers( m_hPoint->GetPointIndex(), CaptureModeScalesWithPlayers() ); } } } @@ -1125,7 +1138,7 @@ bool CTriggerAreaCapture::CheckIfDeathCausesBlock( CBaseMultiplayerPlayer *pVict // break early incase we kill multiple people in the same frame bool bBreakCap = false; - if ( mp_capstyle.GetInt() == 1 ) + if ( CaptureModeScalesWithPlayers() ) { bBreakCap = ( m_TeamData[m_nCapturingTeam].iBlockedTouching - 1 ) <= 0; } diff --git a/mp/src/game/server/trigger_area_capture.h b/mp/src/game/server/trigger_area_capture.h index e2e494c9..383f3fad 100644 --- a/mp/src/game/server/trigger_area_capture.h +++ b/mp/src/game/server/trigger_area_capture.h @@ -32,9 +32,19 @@ class CTeamTrainWatcher; // Can either be capped by both teams at once, or just by one // Time to capture and number of people required to capture are both passed by the mapper //----------------------------------------------------------------------------- -class CTriggerAreaCapture : public CBaseTrigger +// This class is to get around the fact that DEFINE_FUNCTION doesn't like multiple inheritance +class CTriggerAreaCaptureShim : public CBaseTrigger { - DECLARE_CLASS( CTriggerAreaCapture, CBaseTrigger ); + virtual void AreaTouch( CBaseEntity *pOther ) = 0; +public: + void Touch( CBaseEntity *pOther ) { return AreaTouch( pOther ) ; } +}; + +DECLARE_AUTO_LIST( ITriggerAreaCaptureAutoList ); + +class CTriggerAreaCapture : public CTriggerAreaCaptureShim, public ITriggerAreaCaptureAutoList +{ + DECLARE_CLASS( CTriggerAreaCapture, CTriggerAreaCaptureShim ); public: CTriggerAreaCapture(); @@ -73,10 +83,17 @@ public: void SetTrainWatcher( CTeamTrainWatcher *pTrainWatcher ){ m_hTrainWatcher = pTrainWatcher; } // used for train watchers that control train movement CTeamTrainWatcher *GetTrainWatcher( void ) const { return m_hTrainWatcher; } + virtual void StartTouch(CBaseEntity *pOther) OVERRIDE; + virtual void EndTouch(CBaseEntity *pOther) OVERRIDE; + + float GetCapTime() const { return m_flCapTime; } + +protected: + + virtual bool CaptureModeScalesWithPlayers() const; + private: - void StartTouch(CBaseEntity *pOther); - void EXPORT AreaTouch( CBaseEntity *pOther ); - void EndTouch(CBaseEntity *pOther); + virtual void AreaTouch( CBaseEntity *pOther ) OVERRIDE; void CaptureThink( void ); void StartCapture( int team, int capmode ); diff --git a/mp/src/game/server/vote_controller.cpp b/mp/src/game/server/vote_controller.cpp index f2c8e2f4..a2fcfd99 100644 --- a/mp/src/game/server/vote_controller.cpp +++ b/mp/src/game/server/vote_controller.cpp @@ -346,6 +346,19 @@ bool CVoteController::CreateVote( int iEntIndex, const char *pszTypeString, cons Assert( nNumVoteOptions >= 2 ); } + // Have the issue start working on it + pCurrentIssue->OnVoteStarted(); + + // Now the vote handling and UI + m_nPotentialVotes = pCurrentIssue->CountPotentialVoters(); + m_acceptingVotesTimer.Start( sv_vote_timer_duration.GetFloat() ); + + // Force the vote holder to agree with a Yes/No vote + if ( m_bIsYesNoVote && !bDedicatedServer ) + { + TryCastVote( iEntIndex, "Option1" ); + } + // Get the data out to the client CBroadcastRecipientFilter filter; filter.MakeReliable(); @@ -357,16 +370,6 @@ bool CVoteController::CreateVote( int iEntIndex, const char *pszTypeString, cons WRITE_BOOL( m_bIsYesNoVote ); MessageEnd(); - // Force the vote holder to agree with a Yes/No vote - if ( m_bIsYesNoVote && !bDedicatedServer ) - { - TryCastVote( iEntIndex, "Option1" ); - } - - m_nPotentialVotes = pCurrentIssue->CountPotentialVoters(); - m_acceptingVotesTimer.Start( sv_vote_timer_duration.GetFloat() ); - pCurrentIssue->OnVoteStarted(); - if ( !bDedicatedServer ) { TrackVoteCaller( pVoteCaller ); diff --git a/mp/src/game/shared/activitylist.cpp b/mp/src/game/shared/activitylist.cpp index 1b61fb64..a69933c9 100644 --- a/mp/src/game/shared/activitylist.cpp +++ b/mp/src/game/shared/activitylist.cpp @@ -2265,6 +2265,11 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY( ACT_MP_RELOAD_AIRWALK_PRIMARY3_END ); REGISTER_SHARED_ACTIVITY( ACT_MP_RELOAD_SWIM_PRIMARY3 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_THROW ); + REGISTER_SHARED_ACTIVITY( ACT_THROWABLE_VM_DRAW ); + REGISTER_SHARED_ACTIVITY( ACT_THROWABLE_VM_IDLE ); + REGISTER_SHARED_ACTIVITY( ACT_THROWABLE_VM_FIRE ); + AssertMsg( g_HighestActivity == LAST_SHARED_ACTIVITY - 1, "Not all activities from ai_activity.h registered in activitylist.cpp" ); } diff --git a/mp/src/game/shared/ai_activity.h b/mp/src/game/shared/ai_activity.h index 854da726..4e94fca8 100644 --- a/mp/src/game/shared/ai_activity.h +++ b/mp/src/game/shared/ai_activity.h @@ -2095,6 +2095,13 @@ typedef enum ACT_MP_RELOAD_AIRWALK_PRIMARY3_END, ACT_MP_RELOAD_SWIM_PRIMARY3, + // Throwable Animations + ACT_MP_THROW, + + ACT_THROWABLE_VM_DRAW, + ACT_THROWABLE_VM_IDLE, + ACT_THROWABLE_VM_FIRE, + // this is the end of the global activities, private per-monster activities start here. LAST_SHARED_ACTIVITY, } Activity; diff --git a/mp/src/game/shared/baseentity_shared.cpp b/mp/src/game/shared/baseentity_shared.cpp index 470b2d2e..949143b1 100644 --- a/mp/src/game/shared/baseentity_shared.cpp +++ b/mp/src/game/shared/baseentity_shared.cpp @@ -48,6 +48,11 @@ ConVar hl2_episodic( "hl2_episodic", "0", FCVAR_REPLICATED ); #include "prop_portal_shared.h" #endif +#ifdef TF_DLL +#include "tf_gamerules.h" +#include "tf_weaponbase.h" +#endif // TF_DLL + #include "rumble_shared.h" // memdbgon must be the last include file in a .cpp file!!! @@ -1746,6 +1751,17 @@ void CBaseEntity::FireBullets( const FireBulletsInfo_t &info ) { pShootThroughPortal = NULL; } +#elif TF_DLL + CTraceFilterIgnoreFriendlyCombatItems traceFilterCombatItem( this, COLLISION_GROUP_NONE, GetTeamNumber() ); + if ( TFGameRules() && TFGameRules()->GameModeUsesUpgrades() ) + { + CTraceFilterChain traceFilterChain( &traceFilter, &traceFilterCombatItem ); + AI_TraceLine(info.m_vecSrc, vecEnd, MASK_SHOT, &traceFilterChain, &tr); + } + else + { + AI_TraceLine(info.m_vecSrc, vecEnd, MASK_SHOT, &traceFilter, &tr); + } #else AI_TraceLine(info.m_vecSrc, vecEnd, MASK_SHOT, &traceFilter, &tr); #endif //#ifdef PORTAL diff --git a/mp/src/game/shared/multiplay_gamerules.cpp b/mp/src/game/shared/multiplay_gamerules.cpp index f933634c..2cbb6f61 100644 --- a/mp/src/game/shared/multiplay_gamerules.cpp +++ b/mp/src/game/shared/multiplay_gamerules.cpp @@ -1223,7 +1223,7 @@ ConVarRef suitcharger( "sk_suitcharger" ); { if ( bForceSpew || V_stricmp( szLastResult, pszResult) ) { - Msg( "Using map cycle file %s.\n", pszResult ); + Msg( "Using map cycle file '%s'.\n", pszResult ); V_strcpy_safe( szLastResult, pszResult ); } return; diff --git a/mp/src/game/shared/particle_property.cpp b/mp/src/game/shared/particle_property.cpp index b1ae32a7..18d278ad 100644 --- a/mp/src/game/shared/particle_property.cpp +++ b/mp/src/game/shared/particle_property.cpp @@ -26,6 +26,12 @@ // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" +#ifdef STAGING_ONLY +#ifdef TF_CLIENT_DLL +extern ConVar tf_unusual_effect_offset; +#endif +#endif + //----------------------------------------------------------------------------- // Save/load //----------------------------------------------------------------------------- diff --git a/mp/src/game/shared/playernet_vars.h b/mp/src/game/shared/playernet_vars.h index abb49765..9fdeec0f 100644 --- a/mp/src/game/shared/playernet_vars.h +++ b/mp/src/game/shared/playernet_vars.h @@ -77,10 +77,10 @@ struct fogplayerparams_t { m_hCtrl.Set( NULL ); m_flTransitionTime = -1.0f; - m_OldColor.r = m_OldColor.g = m_OldColor.b = m_OldColor.a = 0; + m_OldColor.r = m_OldColor.g = m_OldColor.g = m_OldColor.a = 0.0f; m_flOldStart = 0.0f; m_flOldEnd = 0.0f; - m_NewColor.r = m_NewColor.g = m_NewColor.b = m_NewColor.a = 0; + m_NewColor.r = m_NewColor.g = m_NewColor.g = m_NewColor.a = 0.0f; m_flNewStart = 0.0f; m_flNewEnd = 0.0f; } diff --git a/mp/src/game/shared/teamplay_round_timer.h b/mp/src/game/shared/teamplay_round_timer.h index 7826cf5b..470a5f16 100644 --- a/mp/src/game/shared/teamplay_round_timer.h +++ b/mp/src/game/shared/teamplay_round_timer.h @@ -79,6 +79,7 @@ public: void SetStopWatch( bool bState ) { m_bStopWatchTimer = bState; } bool IsStopWatchTimer( void ) { return m_bStopWatchTimer; } float GetStopWatchTotalTime( void ) { return m_flTotalTime; } + bool IsRoundMaxTimerSet( void ) { return m_nTimerMaxLength > 0; } private: diff --git a/mp/src/game/shared/teamplayroundbased_gamerules.cpp b/mp/src/game/shared/teamplayroundbased_gamerules.cpp index f737aecf..a843d134 100644 --- a/mp/src/game/shared/teamplayroundbased_gamerules.cpp +++ b/mp/src/game/shared/teamplayroundbased_gamerules.cpp @@ -38,7 +38,7 @@ #if defined(TF_CLIENT_DLL) || defined(TF_DLL) #include "tf_lobby.h" #ifdef GAME_DLL - #include "player_vs_environment/tf_populator.h" + #include "player_vs_environment/tf_population_manager.h" #include "../server/tf/tf_gc_server.h" #include "../server/tf/tf_objective_resource.h" #else diff --git a/mp/src/game/shared/voice_status.cpp b/mp/src/game/shared/voice_status.cpp index 4d295713..ed6c0f2f 100644 --- a/mp/src/game/shared/voice_status.cpp +++ b/mp/src/game/shared/voice_status.cpp @@ -425,7 +425,7 @@ void CVoiceStatus::UpdateServerState(bool bForce) void CVoiceStatus::HandleVoiceMaskMsg(bf_read &msg) { - unsigned long dw; + unsigned int dw; for(dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++) { m_AudiblePlayers.SetDWord(dw, (unsigned long)msg.ReadLong()); @@ -434,8 +434,8 @@ void CVoiceStatus::HandleVoiceMaskMsg(bf_read &msg) if( voice_clientdebug.GetInt()) { Msg("CVoiceStatus::HandleVoiceMaskMsg\n"); - Msg(" - m_AudiblePlayers[%d] = %lu\n", dw, m_AudiblePlayers.GetDWord(dw)); - Msg(" - m_ServerBannedPlayers[%d] = %lu\n", dw, m_ServerBannedPlayers.GetDWord(dw)); + Msg(" - m_AudiblePlayers[%d] = %u\n", dw, m_AudiblePlayers.GetDWord(dw)); + Msg(" - m_ServerBannedPlayers[%d] = %u\n", dw, m_ServerBannedPlayers.GetDWord(dw)); } } -- cgit v1.2.3