Skip to content

Commit

Permalink
Merge pull request #56 from fortressforever-2013/dev
Browse files Browse the repository at this point in the history
v3.0.0-alpha2
  • Loading branch information
YoYo178 authored Nov 11, 2024
2 parents 7249cd5 + f5c0482 commit 4180f1c
Show file tree
Hide file tree
Showing 53 changed files with 275 additions and 336 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ mathlib.lib
raytrace.lib
tier1.lib
vgui_controls.lib
mathlib.pdb
raytrace.pdb
tier1.pdb
vgui_controls.pdb
mathlib.a
raytrace.a
tier1.a
Expand Down
4 changes: 3 additions & 1 deletion mp/src/game/client/c_playerresource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ C_PlayerResource *g_PR;

IGameResources * GameResources( void ) { return g_PR; }

extern ConVar hud_newteamcolors;

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -422,7 +424,7 @@ int C_PlayerResource::GetClass(int iIndex)

const Color &C_PlayerResource::GetTeamColor(int index )
{
if ( index < 1 || index >= MAX_TEAMS )
if ( index < 0 || index >= MAX_TEAMS )
{
Assert( false );
static Color blah;
Expand Down
18 changes: 12 additions & 6 deletions mp/src/game/client/clientmode_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#include "iinput.h"
#include "view_shared.h"
#include "iviewrender.h"
#include "hud_basechat.h"
// #include "hud_basechat.h"
#include "ff_hud_chat.h"
#include "weapon_selection.h"
#include <vgui/IVGui.h>
#include <vgui/Cursor.h>
Expand Down Expand Up @@ -1175,24 +1176,26 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
}
else
{
_snwprintf ( wszTeam, sizeof( wszTeam ) / sizeof( wchar_t ), L"%d", team );
V_snwprintf ( wszTeam, sizeof( wszTeam ) / sizeof( wchar_t ), L"%d", team );
}

if ( !IsInCommentaryMode() )
{
wchar_t wszLocalized[100];
if ( bAutoTeamed )
{
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#game_player_joined_autoteam" ), 2, wszPlayerName, wszTeam );
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#FF_Joined_AutoTeam" ), 2, wszPlayerName, wszTeam );
}
else
{
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#game_player_joined_team" ), 2, wszPlayerName, wszTeam );
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#FF_Joined_Team" ), 2, wszPlayerName, wszTeam );
}

char szLocalized[100];
g_pVGuiLocalize->ConvertUnicodeToANSI( wszLocalized, szLocalized, sizeof(szLocalized) );

Color col = GetCustomClientColor( -1, team );
hudChat->SetCustomColor( col );
hudChat->Printf( CHAT_FILTER_TEAMCHANGE, "%s", szLocalized );
}
}
Expand All @@ -1208,6 +1211,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
if ( !hudChat )
return;

int iPlayerIndex = engine->GetPlayerForUserID( event->GetInt( "userid" ) );
const char *pszOldName = event->GetString("oldname");
if ( PlayerNameNotSetYet(pszOldName) )
return;
Expand All @@ -1219,11 +1223,13 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
g_pVGuiLocalize->ConvertANSIToUnicode( event->GetString( "newname" ), wszNewName, sizeof(wszNewName) );

wchar_t wszLocalized[100];
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#game_player_changed_name" ), 2, wszOldName, wszNewName );
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#FF_Name_Change" ), 2, wszOldName, wszNewName );

char szLocalized[100];
g_pVGuiLocalize->ConvertUnicodeToANSI( wszLocalized, szLocalized, sizeof(szLocalized) );

Color col = GetCustomClientColor( iPlayerIndex );
hudChat->SetCustomColor( col );
hudChat->Printf( CHAT_FILTER_NAMECHANGE, "%s", szLocalized );
}
else if (Q_strcmp( "teamplay_broadcast_audio", eventname ) == 0 )
Expand Down Expand Up @@ -1373,7 +1379,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
if ( pszLocString )
{
wchar_t wszItemFound[256];
_snwprintf( wszItemFound, ARRAYSIZE( wszItemFound ), L"%ls", g_pVGuiLocalize->Find( pszLocString ) );
V_snwprintf( wszItemFound, ARRAYSIZE( wszItemFound ), L"%ls", g_pVGuiLocalize->Find( pszLocString ) );

wchar_t *colorMarker = wcsstr( wszItemFound, L"::" );
const CEconItemRarityDefinition* pItemRarity = GetItemSchema()->GetRarityDefinition( pItemDefinition->GetRarity() );
Expand Down
35 changes: 19 additions & 16 deletions mp/src/game/client/ff/c_ff_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,7 @@ C_FFPlayer::C_FFPlayer() :
m_pOldActiveWeapon = NULL;

m_flConcTime = 0;
m_angConced = vec3_angle;
m_bConcussed = false;

m_flTrueAimTime = 0.0f;
Expand Down Expand Up @@ -1303,6 +1304,8 @@ C_FFPlayer::C_FFPlayer() :

m_flNextJumpTimeForDouble = 0;

m_iClassStatus = 0;

//VOOGRU: I'll have bad nightmares if I don't do this.
memset(&m_DisguisedWeapons, 0, sizeof(m_DisguisedWeapons));

Expand Down Expand Up @@ -1547,6 +1550,22 @@ void C_FFPlayer::Spawn(void)
// was breaking a lot of stuff.
if (m_bFirstSpawn)
{
// Stop grenade 1 timers if they're playing
if (g_pGrenade1Timer && (m_iGrenadeState != FF_GREN_PRIMEONE))
{
// TODO: Stop sound
if (g_pGrenade1Timer->ActiveTimer())
g_pGrenade1Timer->ResetTimer();
}

// Stop grenade 2 timers if they're playing
if (g_pGrenade2Timer && (m_iGrenadeState != FF_GREN_PRIMETWO))
{
// TODO: Stop sound
if (g_pGrenade2Timer->ActiveTimer())
g_pGrenade2Timer->ResetTimer();
}

BaseClass::Spawn();
m_bFirstSpawn = false;
}
Expand Down Expand Up @@ -1580,22 +1599,6 @@ void C_FFPlayer::Spawn(void)
// Reset pipebomb counter!
GetPipebombCounter()->Reset();

// Stop grenade 1 timers if they're playing
if (g_pGrenade1Timer && (m_iGrenadeState != FF_GREN_PRIMEONE))
{
// TODO: Stop sound
if (g_pGrenade1Timer->ActiveTimer())
g_pGrenade1Timer->ResetTimer();
}

// Stop grenade 2 timers if they're playing
if (g_pGrenade2Timer && (m_iGrenadeState != FF_GREN_PRIMETWO))
{
// TODO: Stop sound
if (g_pGrenade2Timer->ActiveTimer())
g_pGrenade2Timer->ResetTimer();
}

// Jiggles: Start Hint Code
// Class Spawn Hints -- Display 7 seconds after spawning
if (GetClassSlot() > 0)
Expand Down
2 changes: 1 addition & 1 deletion mp/src/game/client/ff/c_ff_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ class C_FFPlayer : public C_BasePlayer, public IFFPlayerAnimStateHelpers
// <-- Mirv: Conc stuff

// --> Mirv: Hold some class info on the player side
int m_iClassStatus;
CNetworkVar( int, m_iClassStatus );
int GetClassSlot(void) const;

void ClassSpecificSkill();
Expand Down
44 changes: 19 additions & 25 deletions mp/src/game/client/ff/hud/ff_hud_addarmor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class CHudPlayerAddArmor : public CHudElement, public vgui::FFPanel
{
SetParent( g_pClientMode->GetViewport() );
SetHiddenBits( HIDEHUD_PLAYERDEAD | HIDEHUD_SPECTATING | HIDEHUD_UNASSIGNED );

m_flStartTime = 0.0f;
m_flDuration = 0.0f;
m_iArmorToAdd = 0;
}

virtual ~CHudPlayerAddArmor( void )
Expand All @@ -60,8 +64,7 @@ class CHudPlayerAddArmor : public CHudElement, public vgui::FFPanel
void MsgFunc_PlayerAddArmor( bf_read &msg );

protected:
wchar_t m_pTextArmor[ 1024 ]; // Unicode text buffer
int m_iArmor;
int m_iArmorToAdd;

private:

Expand All @@ -86,8 +89,6 @@ DECLARE_HUD_MESSAGE( CHudPlayerAddArmor, PlayerAddArmor );
void CHudPlayerAddArmor::Init( void )
{
HOOK_HUD_MESSAGE( CHudPlayerAddArmor, PlayerAddArmor );

m_pTextArmor[ 0 ] = '\0';
}

//-----------------------------------------------------------------------------
Expand All @@ -96,8 +97,10 @@ void CHudPlayerAddArmor::Init( void )
void CHudPlayerAddArmor::VidInit( void )
{
SetPaintBackgroundEnabled( false );

m_pTextArmor[ 0 ] = '\0';

m_flStartTime = 0.0f;
m_flDuration = 0.0f;
m_iArmorToAdd = 0;
}

void CHudPlayerAddArmor::MsgFunc_PlayerAddArmor( bf_read &msg )
Expand All @@ -107,12 +110,6 @@ void CHudPlayerAddArmor::MsgFunc_PlayerAddArmor( bf_read &msg )
if(ptVal==0)
return;

char szString2[ 1024 ];
Q_snprintf( szString2, sizeof(szString2), "%s%i", ptVal>0?"+":"",ptVal );

// convert int-string to unicode
g_pVGuiLocalize->ConvertANSIToUnicode( szString2, m_pTextArmor, sizeof( m_pTextArmor ) );

// play animation (new points value)
if(ptVal > 0)
{
Expand All @@ -123,6 +120,8 @@ void CHudPlayerAddArmor::MsgFunc_PlayerAddArmor( bf_read &msg )
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "NewSubtractArmor" );
}

m_iArmorToAdd = ptVal;

m_flStartTime = gpGlobals->curtime;
m_flDuration = 3.0f;
}
Expand All @@ -132,26 +131,21 @@ void CHudPlayerAddArmor::MsgFunc_PlayerAddArmor( bf_read &msg )
//-----------------------------------------------------------------------------
void CHudPlayerAddArmor::Paint()
{
C_FFPlayer *pPlayer = C_FFPlayer::GetLocalFFPlayer();
if ( !pPlayer )
return;

if(!hud_addarmor.GetBool())
if( !hud_addarmor.GetBool() )
return;

if ( m_flStartTime + m_flDuration < gpGlobals->curtime )
return;

FFPanel::Paint(); // Draws the background glyphs

if( m_pTextArmor[ 0 ] != '\0' )
{
surface()->DrawSetTextFont( m_hArmorFont );
surface()->DrawSetTextColor( GetFgColor() );
surface()->DrawSetTextPos( ArmorFont_xpos, ArmorFont_ypos );
surface()->DrawSetTextFont( m_hArmorFont );
surface()->DrawSetTextColor( GetFgColor() );
surface()->DrawSetTextPos( ArmorFont_xpos, ArmorFont_ypos );

for( wchar_t *wch = m_pTextArmor; *wch != 0; wch++ )
surface()->DrawUnicodeChar( *wch );
wchar_t wBuf[20];

}
V_swprintf_safe( wBuf, L"%ls%d", m_iArmorToAdd > 0 ? L"+" : L"", m_iArmorToAdd );

vgui::surface()->DrawPrintText( wBuf, V_wcslen( wBuf ), FONT_DRAW_NONADDITIVE );
}
42 changes: 18 additions & 24 deletions mp/src/game/client/ff/hud/ff_hud_addhealth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class CHudPlayerAddHealth : public CHudElement, public vgui::FFPanel
{
SetParent( g_pClientMode->GetViewport() );
SetHiddenBits( HIDEHUD_PLAYERDEAD | HIDEHUD_SPECTATING | HIDEHUD_UNASSIGNED );

m_flStartTime = 0.0f;
m_flDuration = 0.0f;
m_iHealthToAdd = 0;
}

virtual ~CHudPlayerAddHealth( void )
Expand All @@ -60,8 +64,7 @@ class CHudPlayerAddHealth : public CHudElement, public vgui::FFPanel
void MsgFunc_PlayerAddHealth( bf_read &msg );

protected:
wchar_t m_pTextHealth[ 1024 ]; // Unicode text buffer
int m_iHealth;
int m_iHealthToAdd;

private:

Expand All @@ -86,8 +89,6 @@ DECLARE_HUD_MESSAGE( CHudPlayerAddHealth, PlayerAddHealth );
void CHudPlayerAddHealth::Init( void )
{
HOOK_HUD_MESSAGE( CHudPlayerAddHealth, PlayerAddHealth );

m_pTextHealth[ 0 ] = '\0';
}

//-----------------------------------------------------------------------------
Expand All @@ -96,8 +97,10 @@ void CHudPlayerAddHealth::Init( void )
void CHudPlayerAddHealth::VidInit( void )
{
SetPaintBackgroundEnabled( false );

m_pTextHealth[ 0 ] = '\0';

m_flStartTime = 0.0f;
m_flDuration = 0.0f;
m_iHealthToAdd = 0;
}

void CHudPlayerAddHealth::MsgFunc_PlayerAddHealth( bf_read &msg )
Expand All @@ -107,12 +110,6 @@ void CHudPlayerAddHealth::MsgFunc_PlayerAddHealth( bf_read &msg )
if(ptVal==0)
return;

char szString2[ 1024 ];
Q_snprintf( szString2, sizeof(szString2), "%s%i", ptVal>0?"+":"",ptVal );

// convert int-string to unicode
g_pVGuiLocalize->ConvertANSIToUnicode( szString2, m_pTextHealth, sizeof( m_pTextHealth ) );

// play animation (new points value)
if(ptVal > 0)
{
Expand All @@ -122,6 +119,8 @@ void CHudPlayerAddHealth::MsgFunc_PlayerAddHealth( bf_read &msg )
{
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "NewSubtractHealth" );
}

m_iHealthToAdd = ptVal;

m_flStartTime = gpGlobals->curtime;
m_flDuration = 3.0f;
Expand All @@ -132,10 +131,6 @@ void CHudPlayerAddHealth::MsgFunc_PlayerAddHealth( bf_read &msg )
//-----------------------------------------------------------------------------
void CHudPlayerAddHealth::Paint()
{
C_FFPlayer *pPlayer = C_FFPlayer::GetLocalFFPlayer();
if ( !pPlayer )
return;

if(!hud_addhealth.GetBool())
return;

Expand All @@ -144,14 +139,13 @@ void CHudPlayerAddHealth::Paint()

FFPanel::Paint(); // Draws the background glyphs

if( m_pTextHealth[ 0 ] != '\0' )
{
surface()->DrawSetTextFont( m_hHealthFont );
surface()->DrawSetTextColor( GetFgColor() );
surface()->DrawSetTextPos( HealthFont_xpos, HealthFont_ypos );
surface()->DrawSetTextFont( m_hHealthFont );
surface()->DrawSetTextColor( GetFgColor() );
surface()->DrawSetTextPos( HealthFont_xpos, HealthFont_ypos );

for( wchar_t *wch = m_pTextHealth; *wch != 0; wch++ )
surface()->DrawUnicodeChar( *wch );
wchar_t wBuf[20];

}
V_swprintf_safe( wBuf, L"%ls%d", m_iHealthToAdd > 0 ? L"+" : L"", m_iHealthToAdd );

vgui::surface()->DrawPrintText( wBuf, V_wcslen( wBuf ), FONT_DRAW_NONADDITIVE );
}
Loading

0 comments on commit 4180f1c

Please sign in to comment.