mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 20:16:10 +08:00
Sync with upstream (Issue #30).
Recompiled tier1 and mathlib for all platforms will come in next commit.
This commit is contained in:
@ -85,6 +85,12 @@ extern ConVar v_viewmodel_fov;
|
||||
extern ConVar voice_modenable;
|
||||
|
||||
extern bool IsInCommentaryMode( void );
|
||||
extern const char* GetWearLocalizationString( float flWear );
|
||||
|
||||
CON_COMMAND( cl_reload_localization_files, "Reloads all localization files" )
|
||||
{
|
||||
g_pVGuiLocalize->ReloadLocalizationFiles();
|
||||
}
|
||||
|
||||
#ifdef VOICE_VOX_ENABLE
|
||||
void VoxCallback( IConVar *var, const char *oldString, float oldFloat )
|
||||
@ -141,7 +147,7 @@ CON_COMMAND( hud_reloadscheme, "Reloads hud layout and animation scripts." )
|
||||
if ( !mode )
|
||||
return;
|
||||
|
||||
mode->ReloadScheme();
|
||||
mode->ReloadScheme(true);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
@ -292,8 +298,14 @@ ClientModeShared::~ClientModeShared()
|
||||
delete m_pViewport;
|
||||
}
|
||||
|
||||
void ClientModeShared::ReloadScheme( void )
|
||||
void ClientModeShared::ReloadScheme( bool flushLowLevel )
|
||||
{
|
||||
// Invalidate the global cache first.
|
||||
if (flushLowLevel)
|
||||
{
|
||||
KeyValuesSystem()->InvalidateCache();
|
||||
}
|
||||
|
||||
m_pViewport->ReloadScheme( "resource/ClientScheme.res" );
|
||||
ClearKeyValuesCache();
|
||||
}
|
||||
@ -335,7 +347,7 @@ void ClientModeShared::Init()
|
||||
Assert( m_pReplayReminderPanel );
|
||||
#endif
|
||||
|
||||
ListenForGameEvent( "player_connect" );
|
||||
ListenForGameEvent( "player_connect_client" );
|
||||
ListenForGameEvent( "player_disconnect" );
|
||||
ListenForGameEvent( "player_team" );
|
||||
ListenForGameEvent( "server_cvar" );
|
||||
@ -421,7 +433,7 @@ void ClientModeShared::OverrideView( CViewSetup *pSetup )
|
||||
|
||||
if( ::input->CAM_IsThirdPerson() )
|
||||
{
|
||||
Vector cam_ofs = g_ThirdPersonManager.GetCameraOffsetAngles();
|
||||
const Vector& cam_ofs = g_ThirdPersonManager.GetCameraOffsetAngles();
|
||||
Vector cam_ofs_distance = g_ThirdPersonManager.GetFinalCameraOffset();
|
||||
|
||||
cam_ofs_distance *= g_ThirdPersonManager.GetDistanceFraction();
|
||||
@ -867,7 +879,7 @@ void ClientModeShared::LevelShutdown( void )
|
||||
|
||||
void ClientModeShared::Enable()
|
||||
{
|
||||
vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();;
|
||||
vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();
|
||||
|
||||
// Add our viewport to the root panel.
|
||||
if( pRoot != 0 )
|
||||
@ -894,7 +906,7 @@ void ClientModeShared::Enable()
|
||||
|
||||
void ClientModeShared::Disable()
|
||||
{
|
||||
vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();;
|
||||
vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();
|
||||
|
||||
// Remove our viewport from the root panel.
|
||||
if( pRoot != 0 )
|
||||
@ -923,7 +935,7 @@ void ClientModeShared::Layout()
|
||||
m_pViewport->SetBounds(0, 0, wide, tall);
|
||||
if ( changed )
|
||||
{
|
||||
ReloadScheme();
|
||||
ReloadScheme(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -955,7 +967,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
|
||||
|
||||
const char *eventname = event->GetName();
|
||||
|
||||
if ( Q_strcmp( "player_connect", eventname ) == 0 )
|
||||
if ( Q_strcmp( "player_connect_client", eventname ) == 0 )
|
||||
{
|
||||
if ( !hudChat )
|
||||
return;
|
||||
@ -1115,7 +1127,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
|
||||
{
|
||||
CBasePlayer *pSpectatorTarget = UTIL_PlayerByIndex( GetSpectatorTarget() );
|
||||
|
||||
if ( pSpectatorTarget && (GetSpectatorMode() == OBS_MODE_IN_EYE || GetSpectatorMode() == OBS_MODE_CHASE) )
|
||||
if ( pSpectatorTarget && (GetSpectatorMode() == OBS_MODE_IN_EYE || GetSpectatorMode() == OBS_MODE_CHASE || GetSpectatorMode() == OBS_MODE_POI) )
|
||||
{
|
||||
if ( pSpectatorTarget->GetTeamNumber() == team )
|
||||
{
|
||||
@ -1222,10 +1234,14 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
|
||||
entityquality_t iItemQuality = event->GetInt( "quality" );
|
||||
int iMethod = event->GetInt( "method" );
|
||||
int iItemDef = event->GetInt( "itemdef" );
|
||||
bool bIsStrange = event->GetInt( "isstrange" );
|
||||
bool bIsUnusual = event->GetInt( "isunusual" );
|
||||
float flWear = event->GetFloat( "wear" );
|
||||
|
||||
C_BasePlayer *pPlayer = UTIL_PlayerByIndex( iPlayerIndex );
|
||||
const GameItemDefinition_t *pItemDefinition = dynamic_cast<GameItemDefinition_t *>( GetItemSchema()->GetItemDefinition( iItemDef ) );
|
||||
|
||||
if ( !pPlayer || !pItemDefinition )
|
||||
if ( !pPlayer || !pItemDefinition || pItemDefinition->IsHidden() )
|
||||
return;
|
||||
|
||||
if ( g_PR )
|
||||
@ -1245,19 +1261,101 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
|
||||
_snwprintf( wszItemFound, ARRAYSIZE( wszItemFound ), L"%ls", g_pVGuiLocalize->Find( pszLocString ) );
|
||||
|
||||
wchar_t *colorMarker = wcsstr( wszItemFound, L"::" );
|
||||
const CEconItemRarityDefinition* pItemRarity = GetItemSchema()->GetRarityDefinition( pItemDefinition->GetRarity() );
|
||||
|
||||
if ( colorMarker )
|
||||
{
|
||||
const char *pszQualityColorString = EconQuality_GetColorString( (EEconItemQuality)iItemQuality );
|
||||
if ( pszQualityColorString )
|
||||
{
|
||||
if ( pItemRarity )
|
||||
{
|
||||
hudChat->SetCustomColor( pszQualityColorString );
|
||||
*(colorMarker+1) = COLOR_CUSTOM;
|
||||
attrib_colors_t colorRarity = pItemRarity->GetAttribColor();
|
||||
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
|
||||
vgui::IScheme *pScheme = vgui::scheme()->GetIScheme( scheme );
|
||||
Color color = pScheme->GetColor( GetColorNameForAttribColor( colorRarity ), Color( 255, 255, 255, 255 ) );
|
||||
hudChat->SetCustomColor( color );
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *pszQualityColorString = EconQuality_GetColorString( (EEconItemQuality)iItemQuality );
|
||||
if ( pszQualityColorString )
|
||||
{
|
||||
hudChat->SetCustomColor( pszQualityColorString );
|
||||
}
|
||||
}
|
||||
|
||||
*(colorMarker+1) = COLOR_CUSTOM;
|
||||
}
|
||||
|
||||
// TODO: Update the localization strings to only have two format parameters since that's all we need.
|
||||
wchar_t wszLocalizedString[256];
|
||||
g_pVGuiLocalize->ConstructString( wszLocalizedString, sizeof( wszLocalizedString ), wszItemFound, 3, wszPlayerName, CEconItemLocalizedFullNameGenerator( GLocalizationProvider(), pItemDefinition, iItemQuality ).GetFullName(), L"" );
|
||||
g_pVGuiLocalize->ConstructString(
|
||||
wszLocalizedString,
|
||||
sizeof( wszLocalizedString ),
|
||||
LOCCHAR( "%s1" ),
|
||||
1,
|
||||
CEconItemLocalizedFullNameGenerator( GLocalizationProvider(), pItemDefinition, iItemQuality ).GetFullName()
|
||||
);
|
||||
|
||||
locchar_t tempName[MAX_ITEM_NAME_LENGTH];
|
||||
if ( pItemRarity )
|
||||
{
|
||||
// grade and Wear
|
||||
loc_scpy_safe( tempName, wszLocalizedString );
|
||||
|
||||
const locchar_t *loc_WearText = LOCCHAR("");
|
||||
const char *pszTooltipText = "TFUI_InvTooltip_Rarity";
|
||||
|
||||
if ( !IsWearableSlot( pItemDefinition->GetDefaultLoadoutSlot() ) )
|
||||
{
|
||||
loc_WearText = g_pVGuiLocalize->Find( GetWearLocalizationString( flWear ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
pszTooltipText = "TFUI_InvTooltip_RarityNoWear";
|
||||
}
|
||||
|
||||
g_pVGuiLocalize->ConstructString( wszLocalizedString,
|
||||
ARRAYSIZE( wszLocalizedString ) * sizeof( locchar_t ),
|
||||
g_pVGuiLocalize->Find( pszTooltipText ),
|
||||
3,
|
||||
g_pVGuiLocalize->Find( pItemRarity->GetLocKey() ),
|
||||
tempName,
|
||||
loc_WearText
|
||||
);
|
||||
|
||||
if ( bIsUnusual )
|
||||
{
|
||||
loc_scpy_safe( tempName, wszLocalizedString );
|
||||
|
||||
g_pVGuiLocalize->ConstructString( wszLocalizedString,
|
||||
ARRAYSIZE( wszLocalizedString ) * sizeof( locchar_t ),
|
||||
LOCCHAR( "%s1 %s2" ),
|
||||
2,
|
||||
g_pVGuiLocalize->Find( "rarity4" ),
|
||||
tempName
|
||||
);
|
||||
}
|
||||
|
||||
if ( bIsStrange )
|
||||
{
|
||||
loc_scpy_safe( tempName, wszLocalizedString );
|
||||
|
||||
g_pVGuiLocalize->ConstructString( wszLocalizedString,
|
||||
ARRAYSIZE( wszLocalizedString ) * sizeof( locchar_t ),
|
||||
LOCCHAR( "%s1 %s2" ),
|
||||
2,
|
||||
g_pVGuiLocalize->Find( "strange" ),
|
||||
tempName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
loc_scpy_safe( tempName, wszLocalizedString );
|
||||
g_pVGuiLocalize->ConstructString(
|
||||
wszLocalizedString,
|
||||
sizeof( wszLocalizedString ),
|
||||
wszItemFound,
|
||||
3,
|
||||
wszPlayerName, tempName, L"" );
|
||||
|
||||
char szLocalized[256];
|
||||
g_pVGuiLocalize->ConvertUnicodeToANSI( wszLocalizedString, szLocalized, sizeof( szLocalized ) );
|
||||
|
Reference in New Issue
Block a user