FF Diff Viewer

Comparing 2006 Base SDK to Fortress Forever 2.46

cl_dll/game_controls/vguitextwindow.cpp

232425262728
#include // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
2324252627282930313233
#include #include "IGameUIFuncs.h" #include "ienginevgui.h" #include "ff_button.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
646566676869
} } //----------------------------------------------------------------------------- // Purpose: Constructor //-----------------------------------------------------------------------------
697071727374757677787980818283848586878889909192
} } CON_COMMAND( hud_reloadserverinfo, "hud_reloadserverinfo" ) { IViewPortPanel *pPanel = gViewPortInterface->FindPanelByName( PANEL_INFO ); if( !pPanel ) return; CTextWindow *pServerInfo = dynamic_cast< CTextWindow * >( pPanel ); if( !pServerInfo ) return; vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ClientScheme.res", "HudScheme" ); pServerInfo->SetScheme( scheme ); pServerInfo->SetProportional( true ); pServerInfo->LoadControlSettings( "Resource/UI/TextWindow.res" ); } //----------------------------------------------------------------------------- // Purpose: Constructor //-----------------------------------------------------------------------------
8687888990919293949596
m_pTextMessage = new TextEntry(this, "TextMessage"); m_pHTMLMessage = new HTML(this,"HTMLMessage");; m_pTitleLable = new Label( this, "MessageTitle", "Message Title" ); m_pOK = new Button(this, "ok", "#PropertyDialog_OK"); m_pOK->SetCommand("okay"); m_pTextMessage->SetMultiline( true ); LoadControlSettings("Resource/UI/TextWindow.res"); Reset();
109110111112113114115116117118119120121122123124
m_pTextMessage = new TextEntry(this, "TextMessage"); m_pHTMLMessage = new HTML(this,"HTMLMessage");; m_pTitleLable = new Label( this, "MessageTitle", "Message Title" ); m_pOK = new FFButton(this, "ok", "#PropertyDialog_OK"); m_pOK->SetCommand("okay"); m_pTextMessage->SetMultiline( true ); m_pTextMessage->SetVerticalScrollbar(true); m_pHTMLMessage->SetScrollbarsEnabled(false); // to get server name gameeventmanager->AddListener(this, "server_spawn", false ); LoadControlSettings("Resource/UI/TextWindow.res"); Reset();
107108109110111112113114115116117118119
void CTextWindow::Reset( void ) { Q_strcpy( m_szTitle, "This could be your Title." ); Q_strcpy( m_szMessage, "Just for 10 Euros a week!" ); m_szExitCommand[0] = 0; m_nContentType = TYPE_TEXT; Update(); } void CTextWindow::ShowText( const char *text) { m_pTextMessage->SetVisible( true );
135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
void CTextWindow::Reset( void ) { Q_strcpy( m_szTitle, "Fortress Forever" ); Q_strcpy( m_szMessage, "motd" ); m_szExitCommand[0] = 0; m_nContentType = TYPE_INDEX; Update(); } //----------------------------------------------------------------------------- // Purpose: Get the server name //----------------------------------------------------------------------------- void CTextWindow::FireGameEvent( IGameEvent *event ) { const char * type = event->GetName(); if ( Q_strcmp(type, "server_spawn") == 0 ) { Q_strncpy( m_szTitle, event->GetString("hostname"), 255 ); } if( IsVisible() ) Update(); } //----------------------------------------------------------------------------- // Purpose: Give them some key control too //----------------------------------------------------------------------------- void CTextWindow::OnKeyCodePressed(KeyCode code) { // Show the scoreboard over this if needed if (engine->GetLastPressedEngineKey() == gameuifuncs->GetEngineKeyCodeForBind("showscores")) gViewPortInterface->ShowPanel(PANEL_SCOREBOARD, true); // Support hiding the motd by hitting your serverinfo button again // 0001232: Or if the user presses escape, kill the menu if ((engine->GetLastPressedEngineKey() == gameuifuncs->GetEngineKeyCodeForBind("serverinfo")) || (engine->GetLastPressedEngineKey() == gameuifuncs->GetEngineKeyCodeForBind("cancelselect"))) gViewPortInterface->ShowPanel(this, false); BaseClass::OnKeyCodePressed(code); } void CTextWindow::OnKeyCodeReleased(KeyCode code) { // Bug #0000524: Scoreboard gets stuck with the class menu up when you first join // Hide the scoreboard now if (engine->GetLastPressedEngineKey() == gameuifuncs->GetEngineKeyCodeForBind("showscores")) gViewPortInterface->ShowPanel(PANEL_SCOREBOARD, false); BaseClass::OnKeyCodeReleased(code); } void CTextWindow::ShowText( const char *text) { m_pTextMessage->SetVisible( true );
129130131132133134
void CTextWindow::ShowIndex( const char *entry) { const char *data = NULL; int length = 0; int index = g_pStringTableInfoPanel->FindStringIndex( m_szMessage );
201202203204205206207208209
void CTextWindow::ShowIndex( const char *entry) { if (g_pStringTableInfoPanel == NULL) return; const char *data = NULL; int length = 0; int index = g_pStringTableInfoPanel->FindStringIndex( m_szMessage );
137138139140141142143
data = (const char *)g_pStringTableInfoPanel->GetStringUserData( index, &length ); if ( !data || !data[0] ) return; // nothing to show // is this a web URL ? if ( !Q_strncmp( data, "http://", 7 ) )
212213214215216217218219220221
data = (const char *)g_pStringTableInfoPanel->GetStringUserData( index, &length ); if ( !data || !data[0] ) { ShowURL( "http://www.fortress-forever.com/defaultmotd/" ); return; // show default } // is this a web URL ? if ( !Q_strncmp( data, "http://", 7 ) )
284285286287288289290291292293
{ Activate(); SetMouseInputEnabled( true ); } else { SetVisible( false ); SetMouseInputEnabled( false ); } }
362363364365366367368369370371372373374375376
{ Activate(); SetMouseInputEnabled( true ); SetKeyBoardInputEnabled( true ); SetEnabled(true); MoveToFront(); } else { SetVisible( false ); SetMouseInputEnabled( false ); SetKeyBoardInputEnabled( false ); } }