This commit is contained in:
FluorescentCIAAfricanAmerican
2020-04-22 12:56:21 -04:00
commit 3bf9df6b27
15370 changed files with 5489726 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "tfcclassmenu.h"
#include <KeyValues.h>
#include <filesystem.h>
#include <vgui_controls/Button.h>
#include <vgui/IVGui.h>
#include "hud.h" // for gEngfuncs
#include "tfc_gamerules.h"
#include "viewport_panel_names.h"
#include "c_tfc_player.h"
using namespace vgui;
// ----------------------------------------------------------------------------- //
// CTFCClassMenu
// ----------------------------------------------------------------------------- //
CTFCClassMenu::CTFCClassMenu(IViewPort *pViewPort) : CClassMenu(pViewPort)
{
}
const char *CTFCClassMenu::GetName( void )
{
return PANEL_CLASS;
}
void CTFCClassMenu::ShowPanel(bool bShow)
{
if ( bShow)
{
engine->CheckPoint( "ClassMenu" );
}
BaseClass::ShowPanel( bShow );
}
void CTFCClassMenu::Update()
{
// Force them to pick a class if they haven't picked one yet.
if ( C_TFCPlayer::GetLocalTFCPlayer()->m_Shared.GetPlayerClass() == PC_UNDEFINED )
{
SetVisibleButton( "CancelButton", false );
}
else
{
SetVisibleButton( "CancelButton", true );
}
}
+42
View File
@@ -0,0 +1,42 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef TFCCLASSMENU_H
#define TFCCLASSMENU_H
#ifdef _WIN32
#pragma once
#endif
#include <classmenu.h>
#include <commandpanel.h>
#include <vgui_controls/EditablePanel.h>
#include <filesystem.h>
#include "tfc_shareddefs.h"
#include "cbase.h"
#include "tfc_gamerules.h"
#include "vgui_controls/ImagePanel.h"
//-----------------------------------------------------------------------------
// Purpose: Draws the Terrorist class menu
//-----------------------------------------------------------------------------
class CTFCClassMenu : public CClassMenu
{
private:
DECLARE_CLASS_SIMPLE( CTFCClassMenu, CClassMenu );
public:
CTFCClassMenu::CTFCClassMenu(IViewPort *pViewPort);
const char *GetName( void );
void ShowPanel(bool bShow);
void Update();
};
#endif // TFCCLASSMENU_H
+118
View File
@@ -0,0 +1,118 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "tfcteammenu.h"
#include <convar.h>
#include "hud.h" // for gEngfuncs
#include "c_tfc_player.h"
#include "tfc_gamerules.h"
using namespace vgui;
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CTFCTeamMenu::CTFCTeamMenu(IViewPort *pViewPort) : CTeamMenu(pViewPort)
{
}
//-----------------------------------------------------------------------------
// Purpose: Destructor
//-----------------------------------------------------------------------------
CTFCTeamMenu::~CTFCTeamMenu()
{
}
void CTFCTeamMenu::ApplySettings(KeyValues *inResourceData)
{
BaseClass::ApplySettings( inResourceData );
}
void CTFCTeamMenu::ShowPanel(bool bShow)
{
if ( bShow )
{
engine->CheckPoint( "TeamMenu" );
}
BaseClass::ShowPanel( bShow );
}
//-----------------------------------------------------------------------------
// Purpose: called to update the menu with new information
//-----------------------------------------------------------------------------
void CTFCTeamMenu::Update( void )
{
BaseClass::Update();
const ConVar *allowspecs = cvar->FindVar( "mp_allowspectators" );
if ( allowspecs && allowspecs->GetBool() )
{
C_TFCPlayer *pPlayer = C_TFCPlayer::GetLocalTFCPlayer();
if ( !pPlayer || !TFCGameRules() )
return;
// if we're not already a CT or T...or the freeze time isn't over yet...or we're dead
if ( pPlayer->GetTeamNumber() == TEAM_UNASSIGNED ||
( pPlayer && pPlayer->IsPlayerDead() ) )
{
SetVisibleButton("specbutton", true);
}
else
{
SetVisibleButton("specbutton", false);
}
}
else
{
SetVisibleButton("specbutton", false );
}
char mapName[MAX_MAP_NAME];
Q_FileBase( engine->GetLevelName(), mapName, sizeof(mapName) );
if( C_TFCPlayer::GetLocalTFCPlayer()->GetTeamNumber() == TEAM_UNASSIGNED ) // we aren't on a team yet
{
SetVisibleButton("CancelButton", false);
}
else
{
SetVisibleButton("CancelButton", true);
}
}
//-----------------------------------------------------------------------------
// Purpose: When a team button is pressed it triggers this function to
// cause the player to join a team
//-----------------------------------------------------------------------------
void CTFCTeamMenu::OnCommand( const char *command )
{
if ( Q_stricmp( command, "vguicancel" ) )
{
engine->ClientCmd( command );
}
BaseClass::OnCommand(command);
gViewPortInterface->ShowBackGround( false );
OnClose();
}
//-----------------------------------------------------------------------------
// Purpose: Sets the visibility of a button by name
//-----------------------------------------------------------------------------
void CTFCTeamMenu::SetVisibleButton(const char *textEntryName, bool state)
{
Button *entry = dynamic_cast<Button *>(FindChildByName(textEntryName));
if (entry)
{
entry->SetVisible(state);
}
}
+42
View File
@@ -0,0 +1,42 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef TFCTEAMMENU_H
#define TFCTEAMMENU_H
#ifdef _WIN32
#pragma once
#endif
#include <teammenu.h>
//-----------------------------------------------------------------------------
// Purpose: Displays the team menu
//-----------------------------------------------------------------------------
class CTFCTeamMenu : public CTeamMenu
{
private:
DECLARE_CLASS_SIMPLE( CTFCTeamMenu, CTeamMenu );
public:
CTFCTeamMenu(IViewPort *pViewPort);
~CTFCTeamMenu();
virtual void ApplySettings( KeyValues *inResourceData );
void Update();
void ShowPanel( bool bShow );
private:
enum { NUM_TEAMS = 3 };
// VGUI2 override
void OnCommand( const char *command);
// helper functions
void SetVisibleButton(const char *textEntryName, bool state);
};
#endif // TFCTEAMMENU_H
+96
View File
@@ -0,0 +1,96 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Client DLL VGUI2 Viewport
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#pragma warning( disable : 4800 ) // disable forcing int to bool performance warning
// VGUI panel includes
#include <vgui_controls/Panel.h>
#include <vgui/ISurface.h>
#include <KeyValues.h>
#include <vgui/Cursor.h>
#include <vgui/IScheme.h>
#include <vgui/IVGui.h>
#include <vgui/ILocalize.h>
#include <vgui/VGUI.h>
// client dll/engine defines
#include "hud.h"
#include <voice_status.h>
// viewport definitions
#include <baseviewport.h>
#include "TFCViewport.h"
#include "tfcteammenu.h"
#include "vguicenterprint.h"
#include "text_message.h"
#include "tfcclassmenu.h"
//
// This is the main function of the viewport. Right here is where we create our class menu,
// team menu, and anything else that we want to turn on and off in the UI.
//
void TFCViewport::CreateDefaultPanels( void )
{
AddNewPanel( new CTFCTeamMenu( this ), "CTFCTeamMenu" );
AddNewPanel( new CTFCClassMenu( this ), "CTFCClassMenu" );
BaseClass::CreateDefaultPanels();
}
void TFCViewport::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
gHUD.InitColors( pScheme );
SetPaintBackgroundEnabled( false );
}
IViewPortPanel* TFCViewport::CreatePanelByName(const char *szPanelName)
{
IViewPortPanel* newpanel = NULL;
// Up here, strcmp against each type of panel we know how to create.
// else if ( Q_strcmp(PANEL_OVERVIEW, szPanelName) == 0 )
// {
// newpanel = new CCSMapOverview( this );
// }
// create a generic base panel, don't add twice
newpanel = BaseClass::CreatePanelByName( szPanelName );
return newpanel;
}
int TFCViewport::GetDeathMessageStartHeight( void )
{
int x = YRES(2);
IViewPortPanel *spectator = gViewPortInterface->FindPanelByName( PANEL_SPECGUI );
//TODO: Link to actual height of spectator bar
if ( spectator && spectator->IsVisible() )
{
x += YRES(52);
}
return x;
}
+40
View File
@@ -0,0 +1,40 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef TFCVIEWPORT_H
#define TFCVIEWPORT_H
#include "tfc_shareddefs.h"
#include "baseviewport.h"
using namespace vgui;
namespace vgui
{
class Panel;
}
class TFCViewport : public CBaseViewport
{
private:
DECLARE_CLASS_SIMPLE( TFCViewport, CBaseViewport );
public:
IViewPortPanel* CreatePanelByName(const char *szPanelName);
void CreateDefaultPanels( void );
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
int GetDeathMessageStartHeight( void );
};
#endif // TFCViewport_H
+106
View File
@@ -0,0 +1,106 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "vgui_int.h"
#include "ienginevgui.h"
#include "vgui_rootpanel_tfc.h"
#include "vgui/IVGui.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
C_TFCRootPanel *g_pRootPanel = NULL;
//-----------------------------------------------------------------------------
// Global functions.
//-----------------------------------------------------------------------------
void VGUI_CreateClientDLLRootPanel( void )
{
g_pRootPanel = new C_TFCRootPanel( enginevgui->GetPanel( PANEL_CLIENTDLL ) );
}
void VGUI_DestroyClientDLLRootPanel( void )
{
delete g_pRootPanel;
g_pRootPanel = NULL;
}
vgui::VPANEL VGui_GetClientDLLRootPanel( void )
{
return g_pRootPanel->GetVPanel();
}
//-----------------------------------------------------------------------------
// C_TFCRootPanel implementation.
//-----------------------------------------------------------------------------
C_TFCRootPanel::C_TFCRootPanel( vgui::VPANEL parent )
: BaseClass( NULL, "TFC Root Panel" )
{
SetParent( parent );
SetPaintEnabled( false );
SetPaintBorderEnabled( false );
SetPaintBackgroundEnabled( false );
// This panel does post child painting
SetPostChildPaintEnabled( true );
// Make it screen sized
SetBounds( 0, 0, ScreenWidth(), ScreenHeight() );
// Ask for OnTick messages
vgui::ivgui()->AddTickSignal( GetVPanel() );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_TFCRootPanel::~C_TFCRootPanel( void )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_TFCRootPanel::PostChildPaint()
{
BaseClass::PostChildPaint();
// Draw all panel effects
RenderPanelEffects();
}
//-----------------------------------------------------------------------------
// Purpose: For each panel effect, check if it wants to draw and draw it on
// this panel/surface if so
//-----------------------------------------------------------------------------
void C_TFCRootPanel::RenderPanelEffects( void )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_TFCRootPanel::OnTick( void )
{
}
//-----------------------------------------------------------------------------
// Purpose: Reset effects on level load/shutdown
//-----------------------------------------------------------------------------
void C_TFCRootPanel::LevelInit( void )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_TFCRootPanel::LevelShutdown( void )
{
}
+56
View File
@@ -0,0 +1,56 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef VGUI_ROOTPANEL_TFC_H
#define VGUI_ROOTPANEL_TFC_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui_controls/Panel.h>
#include <vgui_controls/EditablePanel.h>
#include "utlvector.h"
class CPanelEffect;
// Serial under of effect, for safe lookup
typedef unsigned int EFFECT_HANDLE;
//-----------------------------------------------------------------------------
// Purpose: Sits between engine and client .dll panels
// Responsible for drawing screen overlays
//-----------------------------------------------------------------------------
class C_TFCRootPanel : public vgui::Panel
{
typedef vgui::Panel BaseClass;
public:
C_TFCRootPanel( vgui::VPANEL parent );
virtual ~C_TFCRootPanel( void );
// Draw Panel effects here
virtual void PostChildPaint();
// Clear list of Panel Effects
virtual void LevelInit( void );
virtual void LevelShutdown( void );
// Run effects and let them decide whether to remove themselves
void OnTick( void );
private:
// Render all panel effects
void RenderPanelEffects( void );
// List of current panel effects
CUtlVector< CPanelEffect *> m_Effects;
};
#endif // VGUI_ROOTPANEL_TFC_H