FF Diff Viewer

Comparing 2006 Base SDK to Fortress Forever 2.46

cl_dll/clientmode_shared.cpp

3456789
// Purpose: Normal HUD mode // // $Workfile: $ // $Date: $ // $NoKeywords: $ //=============================================================================//
3456789
// Purpose: Normal HUD mode // // $Workfile: $ // $Date: 2005/08/22 19:09:05 $ // $NoKeywords: $ //=============================================================================//
192021222324
#include #include #include #include "engine/ienginesound.h" #include #include
19202122232425
#include #include #include #include #include "engine/ienginesound.h" #include #include
29303132333435
#include "c_vguiscreen.h" #include "c_team.h" #include "c_rumble.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
30313233343536373839
#include "c_vguiscreen.h" #include "c_team.h" #include "c_rumble.h" #include "c_ff_player.h" #include // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
363738394041424344
class CHudWeaponSelection; class CHudChat; static vgui::HContext s_hVGuiContext = DEFAULT_VGUI_CONTEXT; ConVar cl_drawhud( "cl_drawhud","1", FCVAR_CHEAT, "Enable the rendering of the hud" ); extern ConVar v_viewmodel_fov;
40414243444546474849
class CHudWeaponSelection; class CHudChat; static vgui::HContext s_hVGuiContext = vgui::DEFAULT_VGUI_CONTEXT; // Yeah, don't want this to be a cheat ConVar cl_drawhud( "cl_drawhud","1", FCVAR_CLIENTDLL | FCVAR_ARCHIVE, "Enable the rendering of the hud" ); extern ConVar v_viewmodel_fov;
264265266267268269
return true; } //----------------------------------------------------------------------------- // Purpose: Allow weapons to override mouse input (for binoculars) //-----------------------------------------------------------------------------
269270271272273274275276
return true; } void HudContextMenuInput(float *x, float *y); // |-- Mirv: Radial context menu //----------------------------------------------------------------------------- // Purpose: Allow weapons to override mouse input (for binoculars) //-----------------------------------------------------------------------------
274275276277278279
{ pWeapon->OverrideMouseInput( x, y ); } } //-----------------------------------------------------------------------------
281282283284285286287288
{ pWeapon->OverrideMouseInput( x, y ); } HudContextMenuInput(x, y); // |-- Mirv: Feed into our menu } //-----------------------------------------------------------------------------
369370371372373374
gHUD.ProcessInput( bActive ); } //----------------------------------------------------------------------------- // Purpose: We've received a keypress from the engine. Return 1 if the engine is allowed to handle it. //-----------------------------------------------------------------------------
378379380381382383384385
gHUD.ProcessInput( bActive ); } extern int HudContextMenuInput(int down, int keynum, const char *pszCurrentBinding); // |-- Mirv: For context menu //----------------------------------------------------------------------------- // Purpose: We've received a keypress from the engine. Return 1 if the engine is allowed to handle it. //-----------------------------------------------------------------------------
378379380381382383384385386387388389390391392393394395396397398399400401402
return 1; // Should we start typing a message? if ( pszCurrentBinding && ( Q_strcmp( pszCurrentBinding, "messagemode" ) == 0 || Q_strcmp( pszCurrentBinding, "say" ) == 0 ) ) { if ( down ) { StartMessageMode( MM_SAY ); } return 0; } else if ( pszCurrentBinding && ( Q_strcmp( pszCurrentBinding, "messagemode2" ) == 0 || Q_strcmp( pszCurrentBinding, "say_team" ) == 0 ) ) { if ( down ) { StartMessageMode( MM_SAY_TEAM ); } return 0; } C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
return 1; // Should we start typing a message? if ( pszCurrentBinding ) { ////////////////////////////////////////////////////////////////////////// // Say bool bMessageMode = !Q_strncmp( pszCurrentBinding, "messagemode", 11 ); bool bSay = !Q_strcmp( pszCurrentBinding, "say" ); if( bMessageMode || bSay ) { if ( down ) { if(bMessageMode) StartMessageMode( MM_MESSAGEMODE ); else StartMessageMode( MM_SAY ); } // Support starting the message partially filled in if(bMessageMode && m_pChatElement) { const char *pStartStr = pszCurrentBinding+11; while(pStartStr && *pStartStr && *pStartStr == ' ') ++pStartStr; m_pChatElement->StartInputMessage(pStartStr); } return 0; } ////////////////////////////////////////////////////////////////////////// // TeamSay bool bSayTeam = !Q_strcmp( pszCurrentBinding, "say_team" ); if(bSayTeam) { if ( down ) { StartMessageMode( MM_SAY_TEAM ); } return 0; } ////////////////////////////////////////////////////////////////////////// // %i hack bool bParsedOutMacro = false; bool bSayBind = !Q_strncmp( pszCurrentBinding, "say ", 4 ); bool bSayTeamBind = !Q_strncmp( pszCurrentBinding, "say_team ", 9 ); if(bSayBind || bSayTeamBind) { C_FFPlayer *pPlayer = ToFFPlayer(C_BasePlayer::GetLocalPlayer()); if(pPlayer) { std::string strcmd = pszCurrentBinding; while(true) { size_t tok = strcmd.find("%i"); if(tok == strcmd.npos) break; bParsedOutMacro = true; strcmd.erase(tok, 2); // erase the token if(pPlayer && pPlayer->m_hCrosshairInfo.m_szNameLastSeen[0]) { strcmd.insert(tok, pPlayer->m_hCrosshairInfo.m_szNameLastSeen); } } if(bParsedOutMacro) { // don't let the engine handle this one, because we're sending a new one with the macros replaced engine->ClientCmd(strcmd.c_str()); return 0; } } } } C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
427428429430431432
} } if ( m_pWeaponSelection ) { if ( !m_pWeaponSelection->KeyInput( down, keynum, pszCurrentBinding ) )
494495496497498499500501502503504
} } // --> Mirv: Check keypresses for the context menu if (!HudContextMenuInput(down, keynum, pszCurrentBinding)) return 0; // <-- Mirv if ( m_pWeaponSelection ) { if ( !m_pWeaponSelection->KeyInput( down, keynum, pszCurrentBinding ) )
495496497498499500501
} // Create a vgui context for all of the in-game vgui panels... if ( s_hVGuiContext == DEFAULT_VGUI_CONTEXT ) { s_hVGuiContext = vgui::ivgui()->CreateContext(); }
567568569570571572573
} // Create a vgui context for all of the in-game vgui panels... if ( s_hVGuiContext == vgui::DEFAULT_VGUI_CONTEXT ) { s_hVGuiContext = vgui::ivgui()->CreateContext(); }
514515516517518519520521522523
{ m_pChatElement->LevelShutdown(); } if ( s_hVGuiContext != DEFAULT_VGUI_CONTEXT ) { vgui::ivgui()->DestroyContext( s_hVGuiContext ); s_hVGuiContext = DEFAULT_VGUI_CONTEXT; } // Reset any player explosion/shock effects
586587588589590591592593594595
{ m_pChatElement->LevelShutdown(); } if ( s_hVGuiContext != vgui::DEFAULT_VGUI_CONTEXT ) { vgui::ivgui()->DestroyContext( s_hVGuiContext ); s_hVGuiContext = vgui::DEFAULT_VGUI_CONTEXT; } // Reset any player explosion/shock effects
626627628629630631632633634635636637
if ( bDisconnected ) return; int team = event->GetInt( "team" ); C_Team *pTeam = GetGlobalTeam( team ); if ( pTeam ) { hudChat->Printf( "Player %s joined team %s\n", pPlayer->GetPlayerName(), pTeam->Get_Name() ); } else {
698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
if ( bDisconnected ) return; // Bug #0000822: When someone leaves the game, it says "played joined team Unassigned" if( event->GetInt( "disconnect" ) ) return; int team = event->GetInt( "team" ); C_Team *pTeam = GetGlobalTeam( team ); if ( pTeam ) { // --> Mirv: Team localisation fix. This might be more a fundamental issue with the limitations of Printf that needs sorting though wchar_t *szName = vgui::localize()->Find( pTeam->Get_Name() ); char szbuf[256]; char *pszName; if( szName ) { vgui::localize( )->ConvertUnicodeToANSI( szName, szbuf, sizeof( szbuf ) ); pszName = szbuf; } else pszName = pTeam->Get_Name(); hudChat->Printf( "Player %s joined team %s\n", pPlayer->GetPlayerName(), pszName ); // <-- Mirv: Team localisation fix. This might be more a fundamental issue with the limitations of Printf that needs sorting though } else {
680681682683684685
void ClientModeShared::DeactivateInGameVGuiContext() { vgui::ivgui()->ActivateContext( DEFAULT_VGUI_CONTEXT ); }
770771772773774775
void ClientModeShared::DeactivateInGameVGuiContext() { vgui::ivgui()->ActivateContext( vgui::DEFAULT_VGUI_CONTEXT ); }