aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/client/game_controls
diff options
context:
space:
mode:
Diffstat (limited to 'mp/src/game/client/game_controls')
-rw-r--r--mp/src/game/client/game_controls/MapOverview.cpp4
-rw-r--r--mp/src/game/client/game_controls/SpectatorGUI.cpp3
-rw-r--r--mp/src/game/client/game_controls/basemodel_panel.cpp205
-rw-r--r--mp/src/game/client/game_controls/basemodel_panel.h23
-rw-r--r--mp/src/game/client/game_controls/baseviewport.cpp21
-rw-r--r--mp/src/game/client/game_controls/vguitextwindow.cpp6
6 files changed, 242 insertions, 20 deletions
diff --git a/mp/src/game/client/game_controls/MapOverview.cpp b/mp/src/game/client/game_controls/MapOverview.cpp
index b4262fbb..73d259ff 100644
--- a/mp/src/game/client/game_controls/MapOverview.cpp
+++ b/mp/src/game/client/game_controls/MapOverview.cpp
@@ -181,7 +181,7 @@ void CMapOverview::Init( void )
// register for events as client listener
ListenForGameEvent( "game_newmap" );
ListenForGameEvent( "round_start" );
- ListenForGameEvent( "player_connect" );
+ ListenForGameEvent( "player_connect_client" );
ListenForGameEvent( "player_info" );
ListenForGameEvent( "player_team" );
ListenForGameEvent( "player_spawn" );
@@ -933,7 +933,7 @@ void CMapOverview::FireGameEvent( IGameEvent *event )
ResetRound();
}
- else if ( Q_strcmp(type,"player_connect") == 0 )
+ else if ( Q_strcmp(type,"player_connect_client") == 0 )
{
int index = event->GetInt("index"); // = entity index - 1
diff --git a/mp/src/game/client/game_controls/SpectatorGUI.cpp b/mp/src/game/client/game_controls/SpectatorGUI.cpp
index 1c95068a..3ce30008 100644
--- a/mp/src/game/client/game_controls/SpectatorGUI.cpp
+++ b/mp/src/game/client/game_controls/SpectatorGUI.cpp
@@ -67,6 +67,7 @@ static const char *s_SpectatorModes[] =
"#Spec_Mode2", // OBS_MODE_FIXED,
"#Spec_Mode3", // OBS_MODE_IN_EYE,
"#Spec_Mode4", // OBS_MODE_CHASE,
+ "#Spec_Mode_POI", // OBS_MODE_POI, PASSTIME
"#Spec_Mode5", // OBS_MODE_ROAMING,
};
@@ -806,6 +807,8 @@ CON_COMMAND_F( spec_mode, "Set spectator mode", FCVAR_CLIENTCMD_CAN_EXECUTE )
if ( mode > LAST_PLAYER_OBSERVERMODE )
mode = OBS_MODE_IN_EYE;
+ else if ( mode == OBS_MODE_POI ) // PASSTIME skip POI mode since hltv doesn't have the entity data required to make it work
+ mode = OBS_MODE_ROAMING;
}
// handle the command clientside
diff --git a/mp/src/game/client/game_controls/basemodel_panel.cpp b/mp/src/game/client/game_controls/basemodel_panel.cpp
index e4115ea4..5f834412 100644
--- a/mp/src/game/client/game_controls/basemodel_panel.cpp
+++ b/mp/src/game/client/game_controls/basemodel_panel.cpp
@@ -22,6 +22,7 @@ CBaseModelPanel::CBaseModelPanel( vgui::Panel *pParent, const char *pName ): Bas
m_bForcePos = false;
m_bMousePressed = false;
m_bAllowRotation = false;
+ m_bAllowPitch = false;
m_bAllowFullManipulation = false;
m_bApplyManipulators = false;
m_bForcedCameraPosition = false;
@@ -43,6 +44,7 @@ void CBaseModelPanel::ApplySettings( KeyValues *inResourceData )
// Set whether we render to texture
m_bRenderToTexture = inResourceData->GetBool( "render_texture", true );
+ m_bUseParticle = inResourceData->GetBool( "use_particle", false );
// Grab and set the camera FOV.
float flFOV = GetCameraFOV();
@@ -51,6 +53,7 @@ void CBaseModelPanel::ApplySettings( KeyValues *inResourceData )
// Do we allow rotation on these panels.
m_bAllowRotation = inResourceData->GetBool( "allow_rot", false );
+ m_bAllowPitch = inResourceData->GetBool( "allow_pitch", false );
// Do we allow full manipulation on these panels.
m_bAllowFullManipulation = inResourceData->GetBool( "allow_manip", false );
@@ -64,7 +67,7 @@ void CBaseModelPanel::ApplySettings( KeyValues *inResourceData )
}
}
- SetMouseInputEnabled( m_bAllowFullManipulation || m_bAllowRotation );
+ SetMouseInputEnabled( m_bAllowFullManipulation || m_bAllowRotation || m_bAllowPitch );
}
//-----------------------------------------------------------------------------
@@ -412,13 +415,16 @@ void CBaseModelPanel::OnMousePressed ( vgui::MouseCode code )
return;
}
- if ( !m_bAllowRotation )
+ if ( !m_bAllowRotation && !m_bAllowPitch )
return;
RequestFocus();
EnableMouseCapture( true, code );
+ // Save where they clicked
+ input()->GetCursorPosition( m_nClickStartX, m_nClickStartY );
+
// Warp the mouse to the center of the screen
int width, height;
GetSize( width, height );
@@ -446,11 +452,14 @@ void CBaseModelPanel::OnMouseReleased( vgui::MouseCode code )
return;
}
- if ( !m_bAllowRotation )
+ if ( !m_bAllowRotation && !m_bAllowPitch )
return;
EnableMouseCapture( false );
m_bMousePressed = false;
+
+ // Restore the cursor to where the clicked
+ input()->SetCursorPos( m_nClickStartX, m_nClickStartY );
}
//-----------------------------------------------------------------------------
@@ -467,7 +476,7 @@ void CBaseModelPanel::OnCursorMoved( int x, int y )
return;
}
- if ( !m_bAllowRotation )
+ if ( !m_bAllowRotation && !m_bAllowPitch )
return;
if ( m_bMousePressed )
@@ -476,11 +485,25 @@ void CBaseModelPanel::OnCursorMoved( int x, int y )
int xpos, ypos;
input()->GetCursorPos( xpos, ypos );
- // Only want the x delta.
- float flDelta = xpos - m_nManipStartX;
+ if ( m_bAllowRotation )
+ {
+ // Only want the x delta.
+ float flDelta = xpos - m_nManipStartX;
+
- // Apply the delta and rotate the player.
- RotateYaw( flDelta );
+ // Apply the delta and rotate the player.
+ RotateYaw( flDelta );
+ }
+
+ if ( m_bAllowPitch )
+ {
+ // Only want the y delta.
+ float flDelta = ypos - m_nManipStartY;
+
+
+ // Apply the delta and rotate the player.
+ RotatePitch( flDelta );
+ }
}
}
@@ -503,6 +526,23 @@ void CBaseModelPanel::RotateYaw( float flDelta )
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+void CBaseModelPanel::RotatePitch( float flDelta )
+{
+ m_angPlayer.x += flDelta;
+ if ( m_angPlayer.x > m_flMaxPitch )
+ {
+ m_angPlayer.x = m_flMaxPitch;
+ }
+ else if ( m_angPlayer.x < -m_flMaxPitch )
+ {
+ m_angPlayer.x = -m_flMaxPitch;
+ }
+
+ SetModelAnglesAndPosition( m_angPlayer, m_vecPlayerPos );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
Vector CBaseModelPanel::GetPlayerPos() const
{
return m_vecPlayerPos;
@@ -643,7 +683,7 @@ void CBaseModelPanel::LookAtBounds( const Vector &vecBoundsMin, const Vector &ve
// Clear the camera pivot and set position matrix.
ResetCameraPivot();
- if (m_bAllowRotation )
+ if (m_bAllowRotation || m_bAllowPitch )
{
vecCameraOffset.x = 0.0f;
}
@@ -651,3 +691,150 @@ void CBaseModelPanel::LookAtBounds( const Vector &vecBoundsMin, const Vector &ve
UpdateCameraTransform();
}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+CBaseModelPanel::particle_data_t::~particle_data_t()
+{
+ if ( m_pParticleSystem )
+ {
+ delete m_pParticleSystem;
+ m_pParticleSystem = NULL;
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Allocate particle data
+//-----------------------------------------------------------------------------
+void CBaseModelPanel::particle_data_t::UpdateControlPoints( CStudioHdr *pStudioHdr, matrix3x4_t *pWorldMatrix, const CUtlVector< int >& vecAttachments, int iDefaultBone /*= 0*/, const Vector& vecParticleOffset /*= vec3_origin*/ )
+{
+ if ( m_pParticleSystem )
+ {
+ // Update control points which is updating the position of the particles
+ matrix3x4_t matAttachToWorld;
+ Vector vecPosition, vecForward, vecRight, vecUp;
+ if ( vecAttachments.Count() )
+ {
+ for ( int i = 0; i < vecAttachments.Count(); ++i )
+ {
+ const mstudioattachment_t& attach = pStudioHdr->pAttachment( vecAttachments[i] );
+ MatrixMultiply( pWorldMatrix[ attach.localbone ], attach.local, matAttachToWorld );
+
+ MatrixVectors( matAttachToWorld, &vecForward, &vecRight, &vecUp );
+ MatrixPosition( matAttachToWorld, vecPosition );
+
+ m_pParticleSystem->SetControlPointOrientation( i, vecForward, vecRight, vecUp );
+ m_pParticleSystem->SetControlPoint( i, vecPosition + vecParticleOffset );
+ }
+ }
+ else
+ {
+ matAttachToWorld = pWorldMatrix[iDefaultBone];
+ MatrixVectors( matAttachToWorld, &vecForward, &vecRight, &vecUp );
+ MatrixPosition( matAttachToWorld, vecPosition );
+
+ m_pParticleSystem->SetControlPointOrientation( 0, vecForward, vecRight, vecUp );
+ m_pParticleSystem->SetControlPoint( 0, vecPosition + vecParticleOffset );
+ }
+ }
+
+ m_bIsUpdateToDate = true;
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Allocate particle data
+//-----------------------------------------------------------------------------
+CBaseModelPanel::particle_data_t *CBaseModelPanel::CreateParticleData( const char *pszParticleName )
+{
+ Assert( m_bUseParticle );
+ if ( !m_bUseParticle )
+ return NULL;
+
+ CParticleCollection *pParticle = g_pParticleSystemMgr->CreateParticleCollection( pszParticleName );
+ if ( !pParticle )
+ return NULL;
+
+ particle_data_t *pData = new particle_data_t;
+ pData->m_bIsUpdateToDate = false;
+ pData->m_pParticleSystem = pParticle;
+
+ m_particleList.AddToTail( pData );
+
+ return pData;
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose: remove and delete particle data
+//-----------------------------------------------------------------------------
+bool CBaseModelPanel::SafeDeleteParticleData( particle_data_t **pData )
+{
+ if ( !m_bUseParticle )
+ return false;
+
+ if ( *pData )
+ {
+ FOR_EACH_VEC( m_particleList, i )
+ {
+ if ( *pData == m_particleList[i] )
+ {
+ delete *pData;
+ *pData = NULL;
+ m_particleList.FastRemove( i );
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CBaseModelPanel::PrePaint3D( IMatRenderContext *pRenderContext )
+{
+ if ( !m_bUseParticle )
+ return;
+
+ // mark all effects need to be updated
+ FOR_EACH_VEC( m_particleList, i )
+ {
+ m_particleList[i]->m_bIsUpdateToDate = false;
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CBaseModelPanel::PostPaint3D( IMatRenderContext *pRenderContext )
+{
+ if ( !m_bUseParticle )
+ return;
+
+ // This needs calling to reset various counters.
+ g_pParticleSystemMgr->SetLastSimulationTime( gpGlobals->curtime );
+
+ // Render Particles
+ pRenderContext->MatrixMode( MATERIAL_MODEL );
+ pRenderContext->PushMatrix();
+ pRenderContext->LoadIdentity( );
+
+ FOR_EACH_VEC( m_particleList, i )
+ {
+ if ( m_particleList[i]->m_bIsUpdateToDate )
+ {
+ m_particleList[i]->m_pParticleSystem->Simulate( gpGlobals->frametime, false );
+ m_particleList[i]->m_pParticleSystem->Render( pRenderContext );
+ m_particleList[i]->m_bIsUpdateToDate = false;
+ }
+ }
+
+ pRenderContext->MatrixMode( MATERIAL_MODEL );
+ pRenderContext->PopMatrix();
+}
+
diff --git a/mp/src/game/client/game_controls/basemodel_panel.h b/mp/src/game/client/game_controls/basemodel_panel.h
index b9fa0d68..a71bb7a4 100644
--- a/mp/src/game/client/game_controls/basemodel_panel.h
+++ b/mp/src/game/client/game_controls/basemodel_panel.h
@@ -182,7 +182,8 @@ public:
studiohdr_t* GetStudioHdr( void ) { return m_RootMDL.m_MDL.GetStudioHdr(); }
void SetBody( unsigned int nBody ) { m_RootMDL.m_MDL.m_nBody = nBody; }
- void RotateYaw( float flDelta );
+ void RotateYaw( float flDelta );
+ void RotatePitch( float flDelta );
Vector GetPlayerPos() const;
QAngle GetPlayerAngles() const;
@@ -213,6 +214,7 @@ protected:
bool m_bForcePos;
bool m_bMousePressed;
bool m_bAllowRotation;
+ bool m_bAllowPitch;
bool m_bAllowFullManipulation;
bool m_bApplyManipulators;
bool m_bForcedCameraPosition;
@@ -220,6 +222,25 @@ protected:
// VGUI script accessible variables.
CPanelAnimationVar( bool, m_bStartFramed, "start_framed", "0" );
CPanelAnimationVar( bool, m_bDisableManipulation, "disable_manipulation", "0" );
+ CPanelAnimationVar( bool, m_bUseParticle, "use_particle", "0" );
+ CPanelAnimationVar( float, m_flMaxPitch, "max_pitch", "90" );
+
+ struct particle_data_t
+ {
+ ~particle_data_t();
+
+ void UpdateControlPoints( CStudioHdr *pStudioHdr, matrix3x4_t *pWorldMatrix, const CUtlVector< int >& vecAttachments, int iDefaultBone = 0, const Vector& vecParticleOffset = vec3_origin );
+
+ bool m_bIsUpdateToDate;
+ CParticleCollection *m_pParticleSystem;
+ };
+ CUtlVector< particle_data_t* > m_particleList;
+
+ particle_data_t *CreateParticleData( const char *pszParticleName );
+ bool SafeDeleteParticleData( particle_data_t **pData );
+
+ virtual void PrePaint3D( IMatRenderContext *pRenderContext ) OVERRIDE;
+ virtual void PostPaint3D( IMatRenderContext *pRenderContext ) OVERRIDE;
};
#endif // BASEMODEL_PANEL_H \ No newline at end of file
diff --git a/mp/src/game/client/game_controls/baseviewport.cpp b/mp/src/game/client/game_controls/baseviewport.cpp
index f239cde8..31d8dca2 100644
--- a/mp/src/game/client/game_controls/baseviewport.cpp
+++ b/mp/src/game/client/game_controls/baseviewport.cpp
@@ -65,7 +65,17 @@ vgui::Panel *g_lastPanel = NULL; // used for mouseover buttons, keeps track of t
vgui::Button *g_lastButton = NULL; // used for mouseover buttons, keeps track of the last active button
using namespace vgui;
-ConVar hud_autoreloadscript("hud_autoreloadscript", "0", FCVAR_NONE, "Automatically reloads the animation script each time one is ran");
+void hud_autoreloadscript_callback( IConVar *var, const char *pOldValue, float flOldValue );
+
+ConVar hud_autoreloadscript("hud_autoreloadscript", "0", FCVAR_NONE, "Automatically reloads the animation script each time one is ran", hud_autoreloadscript_callback);
+
+void hud_autoreloadscript_callback( IConVar *var, const char *pOldValue, float flOldValue )
+{
+ if ( g_pClientMode && g_pClientMode->GetViewportAnimationController() )
+ {
+ g_pClientMode->GetViewportAnimationController()->SetAutoReloadScript( hud_autoreloadscript.GetBool() );
+ }
+}
static ConVar cl_leveloverviewmarker( "cl_leveloverviewmarker", "0", FCVAR_CHEAT );
@@ -573,11 +583,12 @@ void CBaseViewport::OnThink()
else
m_pActivePanel = NULL;
}
-
- m_pAnimController->UpdateAnimations( gpGlobals->curtime );
- // check the auto-reload cvar
- m_pAnimController->SetAutoReloadScript(hud_autoreloadscript.GetBool());
+ // TF does this in OnTick in TFViewport. This remains to preserve old
+ // behavior in other games
+#if !defined( TF_CLIENT_DLL )
+ m_pAnimController->UpdateAnimations( gpGlobals->curtime );
+#endif
int count = m_Panels.Count();
diff --git a/mp/src/game/client/game_controls/vguitextwindow.cpp b/mp/src/game/client/game_controls/vguitextwindow.cpp
index 3c641859..3c25eb80 100644
--- a/mp/src/game/client/game_controls/vguitextwindow.cpp
+++ b/mp/src/game/client/game_controls/vguitextwindow.cpp
@@ -138,9 +138,9 @@ void CTextWindow::Reset( void )
// HPE_BEGIN:
// [Forrest] Replace strange hard-coded default message with hard-coded error message.
//=============================================================================
- Q_strcpy( m_szTitle, "Error loading info message." );
- Q_strcpy( m_szMessage, "" );
- Q_strcpy( m_szMessageFallback, "" );
+ V_strcpy_safe( m_szTitle, "Error loading info message." );
+ V_strcpy_safe( m_szMessage, "" );
+ V_strcpy_safe( m_szMessageFallback, "" );
//=============================================================================
// HPE_END
//=============================================================================