diff --git a/mp/src/game/client/client_ff.vpc b/mp/src/game/client/client_ff.vpc index 89dada1e..18879d58 100644 --- a/mp/src/game/client/client_ff.vpc +++ b/mp/src/game/client/client_ff.vpc @@ -34,6 +34,15 @@ $Project "Client (FF)" { $File "ff\ff_cl_dll_interface.cpp" $File "ff\ff_cl_dll_interface.h" + $File "ff\ff_cl_clientmode.cpp" + $File "ff\ff_cl_clientmode.h" + } + $Folder "UI" + { + $File "ff\ui\ff_cl_hudviewport.cpp" + $File "ff\ui\ff_cl_hudviewport.h" + $File "ff\ui\ff_cl_vgui_rootpanel.cpp" + $File "ff\ui\ff_cl_vgui_rootpanel.h" } $Folder "Lua" { @@ -67,6 +76,9 @@ $Project "Client (FF)" { -$File "$SRCDIR\game\shared\hl2\hl_gamemovement.cpp" -$File "$SRCDIR\game\shared\hl2\hl_gamemovement.h" + + -$File "hl2\hl2_clientmode.cpp" + -$File "hl2\vgui_rootpanel_hl2.cpp" } $Folder "HL2MP" @@ -76,6 +88,9 @@ $Project "Client (FF)" -$File "hl2mp\c_hl2mp_player.h" -$File "$SRCDIR\game\shared\hl2mp\hl2mp_player_shared.cpp" -$File "$SRCDIR\game\shared\hl2mp\hl2mp_player_shared.h" + + -$File "hl2mp\clientmode_hl2mpnormal.cpp" + -$File "hl2mp\clientmode_hl2mpnormal.h" } $Folder "Shader Editor" [$WIN32] diff --git a/mp/src/game/client/ff/ff_cl_clientmode.cpp b/mp/src/game/client/ff/ff_cl_clientmode.cpp new file mode 100644 index 00000000..749b69ef --- /dev/null +++ b/mp/src/game/client/ff/ff_cl_clientmode.cpp @@ -0,0 +1,130 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//===========================================================================// +#include "cbase.h" +#include "hud.h" +#include "ff_cl_clientmode.h" +#include "cdll_client_int.h" +#include "iinput.h" +#include "vgui/ISurface.h" +#include "vgui/IPanel.h" +#include +#include "ivmodemanager.h" +#include "buymenu.h" +#include "filesystem.h" +#include "vgui/IVGui.h" +#include "hud_chat.h" +#include "view_shared.h" +#include "view.h" +#include "ivrenderview.h" +#include "model_types.h" +#include "iefx.h" +#include "dlight.h" +#include +#include "c_playerresource.h" +#include +#include "text_message.h" +#include "panelmetaclassmgr.h" + + +ConVar default_fov( "default_fov", "90", FCVAR_CHEAT ); + +IClientMode *g_pClientMode = NULL; + + +// --------------------------------------------------------------------------------- // +// CFF_CL_ClientModeManager. +// --------------------------------------------------------------------------------- // + +class CFF_CL_ClientModeManager : public IVModeManager +{ +public: + virtual void Init(); + virtual void SwitchMode( bool commander, bool force ) {} + virtual void LevelInit( const char *newmap ); + virtual void LevelShutdown( void ); + virtual void ActivateMouse( bool isactive ) {} +}; + +static CFF_CL_ClientModeManager g_ModeManager; +IVModeManager *modemanager = ( IVModeManager * )&g_ModeManager; + +// --------------------------------------------------------------------------------- // +// CFF_CL_ClientModeManager implementation. +// --------------------------------------------------------------------------------- // + +#define SCREEN_FILE "scripts/vgui_screens.txt" + +void CFF_CL_ClientModeManager::Init() +{ + g_pClientMode = GetClientModeNormal(); + + PanelMetaClassMgr()->LoadMetaClassDefinitionFile( SCREEN_FILE ); +} + +void CFF_CL_ClientModeManager::LevelInit( const char *newmap ) +{ + g_pClientMode->LevelInit( newmap ); +} + +void CFF_CL_ClientModeManager::LevelShutdown( void ) +{ + g_pClientMode->LevelShutdown(); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +CFF_CL_ClientModeNormal::CFF_CL_ClientModeNormal() +{ +} + +//----------------------------------------------------------------------------- +// Purpose: If you don't know what a destructor is by now, you are probably going to get fired +//----------------------------------------------------------------------------- +CFF_CL_ClientModeNormal::~CFF_CL_ClientModeNormal() +{ +} + + +void CFF_CL_ClientModeNormal::InitViewport() +{ + m_pViewport = new CFF_CL_HudViewport(); + m_pViewport->Start( gameuifuncs, gameeventmanager ); +} + +CFF_CL_ClientModeNormal g_ClientModeNormal; + +IClientMode *GetClientModeNormal() +{ + return &g_ClientModeNormal; +} + +CFF_CL_ClientModeNormal* GetClientModeFFNormal() +{ + Assert( dynamic_cast< CFF_CL_ClientModeNormal* >( GetClientModeNormal() ) ); + + return static_cast< CFF_CL_ClientModeNormal* >( GetClientModeNormal() ); +} + +float CFF_CL_ClientModeNormal::GetViewModelFOV( void ) +{ + return BaseClass::GetViewModelFOV(); +} + +int CFF_CL_ClientModeNormal::GetDeathMessageStartHeight( void ) +{ + return m_pViewport->GetDeathMessageStartHeight(); +} + +void CFF_CL_ClientModeNormal::PostRenderVGui() +{ +} + + + + diff --git a/mp/src/game/client/ff/ff_cl_clientmode.h b/mp/src/game/client/ff/ff_cl_clientmode.h new file mode 100644 index 00000000..210e0bc0 --- /dev/null +++ b/mp/src/game/client/ff/ff_cl_clientmode.h @@ -0,0 +1,40 @@ +#pragma once +#ifndef FF_CL_CLIENTMODE_H +#define FF_CL_CLIENTMODE_H + +#include "clientmode_shared.h" +#include "ui/ff_cl_hudviewport.h" + +class CFF_CL_ClientModeNormal : public ClientModeShared +{ +DECLARE_CLASS( CFF_CL_ClientModeNormal, ClientModeShared ); + +private: + +// IClientMode overrides. +public: + + CFF_CL_ClientModeNormal(); + virtual ~CFF_CL_ClientModeNormal(); + + virtual void InitViewport(); + + virtual float GetViewModelFOV( void ); + + int GetDeathMessageStartHeight( void ); + + virtual void PostRenderVGui(); + + +private: + + // void UpdateSpectatorMode( void ); + +}; + + +extern IClientMode *GetClientModeNormal(); +extern CFF_CL_ClientModeNormal* GetClientModeFFNormal(); + + +#endif // FF_CL_CLIENTMODE_H diff --git a/mp/src/game/client/ff/ui/ff_cl_hudviewport.cpp b/mp/src/game/client/ff/ui/ff_cl_hudviewport.cpp new file mode 100644 index 00000000..2f208a16 --- /dev/null +++ b/mp/src/game/client/ff/ui/ff_cl_hudviewport.cpp @@ -0,0 +1,85 @@ +//========= 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 +#include +#include +#include +#include +#include +#include +#include + +// client dll/engine defines +#include "hud.h" +#include + +// viewport definitions +#include +#include "ff_cl_hudviewport.h" + +#include "vguicenterprint.h" +#include "text_message.h" + + +void CFF_CL_HudViewport::ApplySchemeSettings( vgui::IScheme *pScheme ) +{ + BaseClass::ApplySchemeSettings( pScheme ); + + gHUD.InitColors( pScheme ); + + SetPaintBackgroundEnabled( false ); +} + + +IViewPortPanel* CFF_CL_HudViewport::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; +} + +void CFF_CL_HudViewport::CreateDefaultPanels( void ) +{ + BaseClass::CreateDefaultPanels(); +} + +int CFF_CL_HudViewport::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; +} + diff --git a/mp/src/game/client/ff/ui/ff_cl_hudviewport.h b/mp/src/game/client/ff/ui/ff_cl_hudviewport.h new file mode 100644 index 00000000..c9af57f9 --- /dev/null +++ b/mp/src/game/client/ff/ui/ff_cl_hudviewport.h @@ -0,0 +1,31 @@ +#pragma once +#ifndef FF_CL_HUDVIEWPORT_H +#define FF_CL_HUDVIEWPORT_H + +#include "baseviewport.h" + +using namespace vgui; + +namespace vgui +{ + class Panel; +} + +class CFF_CL_HudViewport : public CBaseViewport +{ + +private: + DECLARE_CLASS_SIMPLE( CFF_CL_HudViewport, CBaseViewport ); + +public: + + IViewPortPanel* CreatePanelByName(const char *szPanelName); + void CreateDefaultPanels( void ); + + virtual void ApplySchemeSettings( vgui::IScheme *pScheme ); + + int GetDeathMessageStartHeight( void ); +}; + + +#endif // FF_CL_HUDVIEWPORT_H diff --git a/mp/src/game/client/ff/ui/ff_cl_vgui_rootpanel.cpp b/mp/src/game/client/ff/ui/ff_cl_vgui_rootpanel.cpp new file mode 100644 index 00000000..5ab07f85 --- /dev/null +++ b/mp/src/game/client/ff/ui/ff_cl_vgui_rootpanel.cpp @@ -0,0 +1,106 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" +#include "vgui_int.h" +#include "ienginevgui.h" +#include "ff_cl_vgui_rootpanel.h" +#include "vgui/IVGui.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +CFF_CL_VGUI_RootPanel *g_pRootPanel = NULL; + + +//----------------------------------------------------------------------------- +// Global functions. +//----------------------------------------------------------------------------- +void VGUI_CreateClientDLLRootPanel( void ) +{ + g_pRootPanel = new CFF_CL_VGUI_RootPanel( enginevgui->GetPanel( PANEL_CLIENTDLL ) ); +} + +void VGUI_DestroyClientDLLRootPanel( void ) +{ + delete g_pRootPanel; + g_pRootPanel = NULL; +} + +vgui::VPANEL VGui_GetClientDLLRootPanel( void ) +{ + return g_pRootPanel->GetVPanel(); +} + + +//----------------------------------------------------------------------------- +// CFF_CL_VGUI_RootPanel implementation. +//----------------------------------------------------------------------------- +CFF_CL_VGUI_RootPanel::CFF_CL_VGUI_RootPanel( vgui::VPANEL parent ) + : BaseClass( NULL, "FF 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: +//----------------------------------------------------------------------------- +CFF_CL_VGUI_RootPanel::~CFF_CL_VGUI_RootPanel( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CFF_CL_VGUI_RootPanel::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 CFF_CL_VGUI_RootPanel::RenderPanelEffects( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CFF_CL_VGUI_RootPanel::OnTick( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: Reset effects on level load/shutdown +//----------------------------------------------------------------------------- +void CFF_CL_VGUI_RootPanel::LevelInit( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CFF_CL_VGUI_RootPanel::LevelShutdown( void ) +{ +} + diff --git a/mp/src/game/client/ff/ui/ff_cl_vgui_rootpanel.h b/mp/src/game/client/ff/ui/ff_cl_vgui_rootpanel.h new file mode 100644 index 00000000..c5cf02eb --- /dev/null +++ b/mp/src/game/client/ff/ui/ff_cl_vgui_rootpanel.h @@ -0,0 +1,47 @@ +#pragma once +#ifndef FF_CL_VGUI_ROOTPANEL_H +#define FF_CL_VGUI_ROOTPANEL_H + +#include +#include +#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 CFF_CL_VGUI_RootPanel : public vgui::Panel +{ + typedef vgui::Panel BaseClass; +public: + CFF_CL_VGUI_RootPanel( vgui::VPANEL parent ); + virtual ~CFF_CL_VGUI_RootPanel( 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 // FF_CL_VGUI_ROOTPANEL_H diff --git a/mp/src/game/client/hl2/c_info_teleporter_countdown.cpp b/mp/src/game/client/hl2/c_info_teleporter_countdown.cpp index 1cb9ae6f..fa8e6713 100644 --- a/mp/src/game/client/hl2/c_info_teleporter_countdown.cpp +++ b/mp/src/game/client/hl2/c_info_teleporter_countdown.cpp @@ -10,7 +10,7 @@ #include #include #include -#include "clientmode_hlnormal.h" +//#include "clientmode_hlnormal.h" #include "tier1/utllinkedlist.h" // memdbgon must be the last include file in a .cpp file!!! @@ -105,7 +105,7 @@ DECLARE_VGUI_SCREEN_FACTORY( CTeleportCountdownScreen, "teleport_countdown_scree // Constructor: //----------------------------------------------------------------------------- CTeleportCountdownScreen::CTeleportCountdownScreen( vgui::Panel *parent, const char *panelName ) - : BaseClass( parent, panelName, g_hVGuiCombineScheme ) + : BaseClass( parent, panelName/*, g_hVGuiCombineScheme*/ ) // FF: This scheme no longer exists { } diff --git a/mp/src/game/client/hl2mp/hud_deathnotice.cpp b/mp/src/game/client/hl2mp/hud_deathnotice.cpp index a4808a81..bfa0fa97 100644 --- a/mp/src/game/client/hl2mp/hud_deathnotice.cpp +++ b/mp/src/game/client/hl2mp/hud_deathnotice.cpp @@ -8,7 +8,8 @@ #include "hudelement.h" #include "hud_macros.h" #include "c_playerresource.h" -#include "clientmode_hl2mpnormal.h" +//#include "clientmode_hl2mpnormal.h" +#include "ff_cl_clientmode.h" #include #include #include @@ -147,7 +148,7 @@ void CHudDeathNotice::Paint() if ( !m_iconD_skull ) return; - int yStart = GetClientModeHL2MPNormal()->GetDeathMessageStartHeight(); + int yStart = GetClientModeFFNormal()->GetDeathMessageStartHeight(); surface()->DrawSetTextFont( m_hTextFont ); surface()->DrawSetTextColor( GameResources()->GetTeamColor( 0 ) );