FF Diff Viewer

Comparing 2006 Base SDK to Fortress Forever 2.46

cl_dll/hud_basechat.cpp

78910111213
#include "cbase.h" #include "hud_basechat.h" #include #include #include "iclientmode.h"
78910111213
#include "cbase.h" #include "hud_basechat.h" #include #include #include #include "iclientmode.h"
19202122232425
#include "vgui/keycode.h" #include #include "ienginevgui.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
19202122232425262728
#include "vgui/keycode.h" #include #include "ienginevgui.h" #include "cl_dll/iviewport.h" #include "c_ff_player.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
26272829303132
#define CHAT_WIDTH_PERCENTAGE 0.6f #ifndef _XBOX ConVar hud_saytext_time( "hud_saytext_time", "12", 0 ); //----------------------------------------------------------------------------- // Purpose:
29303132333435
#define CHAT_WIDTH_PERCENTAGE 0.6f #ifndef _XBOX ConVar hud_saytext_time( "hud_saytext_time", "12", FCVAR_ARCHIVE ); //----------------------------------------------------------------------------- // Purpose:
244245246247248249
InvalidateLayout(); } void CBaseHudChatInputLine::ClearEntry( void ) { Assert( m_pInput );
247248249250251252253254255256257
InvalidateLayout(); } void CBaseHudChatInputLine::GetPrompt( wchar_t *buffer, int buffersizebytes ) { m_pPrompt->GetText( buffer, buffersizebytes); } void CBaseHudChatInputLine::ClearEntry( void ) { Assert( m_pInput );
313314315316317318319320321322323
if ( IsPC() ) { vgui::ivgui()->AddTickSignal( GetVPanel() ); } // (We don't actually want input until they bring up the chat line). MakePopup(); SetZPos( -30 ); SetHiddenBits( HIDEHUD_CHAT );
321322323324325326327328329330331332333
if ( IsPC() ) { vgui::ivgui()->AddTickSignal( GetVPanel(), 100 ); } // (We don't actually want input until they bring up the chat line). // Mirv: The whole chat box is no longer a popup, only the input line. // This way we don't lose all the text behind the scores. //MakePopup(); SetZPos( -30 ); SetHiddenBits( HIDEHUD_CHAT );
366367368369370371372
{ int w, h; GetSize( w, h ); m_pChatInput->SetBounds( 1, h - m_iFontHeight - 1, w-2, m_iFontHeight ); } #ifdef HL1_CLIENT_DLL
376377378379380381382383384385386387388
{ int w, h; GetSize( w, h ); // Mirv: Now that m_pChatInput is a popup it doesn't inherit its parent's // position, therefore add that on manually. int x, y; GetPos(x, y); m_pChatInput->SetBounds( x + 1, y + h - m_iFontHeight - 1, w-2, m_iFontHeight ); } #ifdef HL1_CLIENT_DLL
498499500501502503504
// Put input area at bottom int w, h; GetSize( w, h ); m_pChatInput->SetBounds( 1, h - m_iFontHeight - 1, w-2, m_iFontHeight ); } }
514515516517518519520521522523524525526
// Put input area at bottom int w, h; GetSize( w, h ); // Mirv: Now that m_pChatInput is a popup it doesn't inherit its parent's // position, therefore add that on manually. int x, y; GetPos(x, y); m_pChatInput->SetBounds( x + 1, y + h - m_iFontHeight - 1, w-2, m_iFontHeight ); } }
541542543544545546547
m_nVisibleHeight = 0; } vgui::surface()->MovePopupToBack( GetVPanel() ); #endif }
563564565566567568569570
m_nVisibleHeight = 0; } // Mirv: Now that we're a popup this is no longer needed //vgui::surface()->MovePopupToBack( GetVPanel() ); #endif }
656657658659660661662
msgcopy[ offset ] = 0; // Print first part #if defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo Printf( "%s", msgcopy ); // Print remainder
679680681682683684685
msgcopy[ offset ] = 0; // Print first part #if 1 // defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo // |-- Mirv: Fix %n exploit Printf( "%s", msgcopy ); // Print remainder
692693694695696697698
msgcopy[ offset ] = 0; // Print first part #if defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo Printf( "%s", msgcopy ); #else Printf( msgcopy );
715716717718719720721
msgcopy[ offset ] = 0; // Print first part #if 1 // defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo // |-- Mirv: Fix %n exploit Printf( "%s", msgcopy ); #else Printf( msgcopy );
704705706707708709710
msgcopy[ offset ] = savechar; // Print remainder #if defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo Printf( "%s", &msgcopy[ offset ] ); #else Printf( &msgcopy[ offset ] );
727728729730731732733
msgcopy[ offset ] = savechar; // Print remainder #if 1 // defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo // |-- Mirv: Fix %n exploit Printf( "%s", &msgcopy[ offset ] ); #else Printf( &msgcopy[ offset ] );
712713714715716717718
} else { #if defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo Printf( "%s", &msgcopy[ offset ] + 1 ); #else Printf( &msgcopy[ offset ] + 1 );
735736737738739740741
} else { #if 1 // defined( CSTRIKE_DLL ) || defined( DOD_DLL ) // reltodo // |-- Mirv: Fix %n exploit Printf( "%s", &msgcopy[ offset ] + 1 ); #else Printf( &msgcopy[ offset ] + 1 );
734735736737738739740
} line->SetText( "" ); line->InsertColorChange( line->GetTextColor() ); line->SetExpireTime(); line->InsertString( pmsg ); line->SetVisible( true );
757758759760761762763764765766767768
} line->SetText( "" ); // --> Mirv: Text alpha fix Color col = line->GetTextColor(); line->InsertColorChange( Color( 255, 178, 0, 255 ) ); // <-- Mirv: Text alpha fix line->SetExpireTime(); line->InsertString( pmsg ); line->SetVisible( true );
761762763764765766767768769770771772773774775776
{ m_pChatInput->SetPrompt( L"Say :" ); } else { m_pChatInput->SetPrompt( L"Say (TEAM) :" ); } vgui::SETUP_PANEL( this ); SetKeyBoardInputEnabled( true ); m_pChatInput->SetVisible( true ); vgui::surface()->CalculateMouseVisible(); m_pChatInput->RequestFocus(); #endif }
789790791792793794795796797798799800801802803804805806807808809810811
{ m_pChatInput->SetPrompt( L"Say :" ); } else if ( m_nMessageMode == MM_SAY_TEAM ) { m_pChatInput->SetPrompt( L"Say (TEAM) :" ); } else m_pChatInput->SetPrompt( L"" ); // Mirv: All these now only act on the chat input line vgui::SETUP_PANEL( m_pChatInput ); m_pChatInput->SetKeyBoardInputEnabled( true ); m_pChatInput->SetVisible( true ); vgui::surface()->CalculateMouseVisible(); m_pChatInput->RequestFocus(); vgui::surface()->MovePopupToBack(m_pChatInput->GetVPanel()); // Mirv: Remove the scoreboard if it is showing gViewPortInterface->ShowPanel(PANEL_SCOREBOARD, false); #endif }
853854855856857858859860861862863864
void CBaseHudChat::Send( void ) { #ifndef _XBOX wchar_t szTextbuf[128]; m_pChatInput->GetMessageText( szTextbuf, sizeof( szTextbuf ) ); char ansi[128]; vgui::localize()->ConvertUnicodeToANSI( szTextbuf, ansi, sizeof( ansi ) ); int len = Q_strlen(ansi);
888889890891892893894895896897898899900901902903
void CBaseHudChat::Send( void ) { #ifndef _XBOX wchar_t szPrompt[128]; wchar_t szTextbuf[128]; m_pChatInput->GetMessageText( szTextbuf, sizeof( szTextbuf ) ); m_pChatInput->GetPrompt( szPrompt, sizeof( szPrompt ) ); char ansi[128]; char ansiprompt[128]; vgui::localize()->ConvertUnicodeToANSI( szTextbuf, ansi, sizeof( ansi ) ); vgui::localize()->ConvertUnicodeToANSI( szPrompt, ansiprompt, sizeof( ansiprompt ) ); int len = Q_strlen(ansi);
872873874875876877878879880881882883884
{ ansi[ len - 1 ] = '\0'; } if( len > 0 ) { char szbuf[144]; // more than 128 Q_snprintf( szbuf, sizeof(szbuf), "%s \"%s\"", m_nMessageMode == MM_SAY ? "say" : "say_team", ansi ); engine->ClientCmd(szbuf); } m_pChatInput->ClearEntry();
911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947
{ ansi[ len - 1 ] = '\0'; } if( len > 0 ) { std::string strcmd = m_nMessageMode == MM_SAY ? "say " : "say_team "; strcmd += "\""; strcmd += ansi; strcmd += "\""; if(m_nMessageMode == MM_MESSAGEMODE) { strcmd = ansiprompt; strcmd += ansi; } C_FFPlayer *pPlayer = ToFFPlayer(C_BasePlayer::GetLocalPlayer()); ////////////////////////////////////////////////////////////////////////// // %i support while(true) { size_t tok = strcmd.find("%i"); if(tok == strcmd.npos) break; strcmd.erase(tok, 2); // erase the token if(pPlayer && pPlayer->m_hCrosshairInfo.m_szNameLastSeen[0]) { strcmd.insert(tok, pPlayer->m_hCrosshairInfo.m_szNameLastSeen); } } ////////////////////////////////////////////////////////////////////////// engine->ClientCmd(strcmd.c_str()); } m_pChatInput->ClearEntry();
963964965966
ChatPrintf( player->entindex(), "(SourceTV) %s", event->GetString( "text" ) ); } #endif }
1026102710281029103010311032103310341035103610371038103910401041104210431044
ChatPrintf( player->entindex(), "(SourceTV) %s", event->GetString( "text" ) ); } #endif } void CBaseHudChat::StartInputMessage(const char *_msg) { if(m_pChatInput) { if(_msg) { wchar_t wBuffer[1024]; vgui::localize()->ConvertANSIToUnicode(_msg, wBuffer, 1024); //m_pChatInput->SetEntry(wBuffer); m_pChatInput->SetPrompt(wBuffer); m_pChatInput->GetChatEntryInput()->GotoEndOfLine(); } } }