Browse Source

Merge branch 'master' into residual_point

residual_point
Andrey Akhmichin 2 years ago
parent
commit
110d9cf961
No known key found for this signature in database
GPG Key ID: 1F180D249B0643C0
  1. 1
      cl_dll/Android.mk
  2. 1
      cl_dll/CMakeLists.txt
  3. 3
      cl_dll/MOTD.cpp
  4. 1
      cl_dll/compile.bat
  5. 5
      cl_dll/death.cpp
  6. 2
      cl_dll/ev_hldm.cpp
  7. 8
      cl_dll/hud.cpp
  8. 4
      cl_dll/hud_redraw.cpp
  9. 4
      cl_dll/hud_spectator.cpp
  10. 6
      cl_dll/menu.cpp
  11. 161
      cl_dll/overview.cpp
  12. 27
      cl_dll/overview.h
  13. 2
      cl_dll/saytext.cpp
  14. 6
      cl_dll/scoreboard.cpp
  15. 5
      cl_dll/statusbar.cpp
  16. 4
      cl_dll/tri.cpp
  17. 240
      cl_dll/vgui_ClassMenu.cpp
  18. 13
      cl_dll/vgui_CustomObjects.cpp
  19. 8
      cl_dll/vgui_SchemeManager.cpp
  20. 40
      cl_dll/vgui_ScorePanel.cpp
  21. 473
      cl_dll/vgui_TeamFortressViewport.cpp
  22. 82
      cl_dll/vgui_TeamFortressViewport.h
  23. 25
      cl_dll/voice_status.cpp
  24. 1
      cl_dll/wscript
  25. 14
      dlls/client.cpp
  26. 21
      dlls/teamplay_gamerules.cpp
  27. 3
      scripts/waifulib/library_naming.py

1
cl_dll/Android.mk

@ -73,7 +73,6 @@ SRCS+=./input_mouse.cpp @@ -73,7 +73,6 @@ SRCS+=./input_mouse.cpp
#SRCS+=./inputw32.cpp
SRCS+=./menu.cpp
SRCS+=./message.cpp
SRCS+=./overview.cpp
SRCS+=./parsemsg.cpp
SRCS_C+=../pm_shared/pm_debug.c
SRCS_C+=../pm_shared/pm_math.c

1
cl_dll/CMakeLists.txt

@ -101,7 +101,6 @@ set (CLDLL_SOURCES @@ -101,7 +101,6 @@ set (CLDLL_SOURCES
input_xash3d.cpp
menu.cpp
message.cpp
overview.cpp
parsemsg.cpp
../pm_shared/pm_debug.c
../pm_shared/pm_math.c

3
cl_dll/MOTD.cpp

@ -134,7 +134,8 @@ int CHudMOTD::MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf ) @@ -134,7 +134,8 @@ int CHudMOTD::MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
BEGIN_READ( pbuf, iSize );
int is_finished = READ_BYTE();
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) - 1 );
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) - strlen(m_szMOTD) - 1 );
m_szMOTD[sizeof(m_szMOTD) - 1] = '\0';
if( is_finished )
{

1
cl_dll/compile.bat

@ -54,7 +54,6 @@ set SOURCES=../dlls/crossbow.cpp ^ @@ -54,7 +54,6 @@ set SOURCES=../dlls/crossbow.cpp ^
input_xash3d.cpp ^
menu.cpp ^
message.cpp ^
overview.cpp ^
parsemsg.cpp ^
../pm_shared/pm_debug.c ^
../pm_shared/pm_math.c ^

5
cl_dll/death.cpp

@ -173,6 +173,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu @@ -173,6 +173,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
char killedwith[32];
strcpy( killedwith, "d_" );
strncat( killedwith, READ_STRING(), sizeof(killedwith) - strlen(killedwith) - 1 );
killedwith[sizeof(killedwith) - 1] = '\0';
#if USE_VGUI
if (gViewPort)
@ -206,7 +207,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu @@ -206,7 +207,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
else
{
rgDeathNoticeList[i].KillerColor = GetClientColor( killer );
strncpy( rgDeathNoticeList[i].szKiller, killer_name, MAX_PLAYER_NAME_LENGTH );
strncpy( rgDeathNoticeList[i].szKiller, killer_name, MAX_PLAYER_NAME_LENGTH - 1 );
rgDeathNoticeList[i].szKiller[MAX_PLAYER_NAME_LENGTH - 1] = 0;
}
@ -223,7 +224,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu @@ -223,7 +224,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
else
{
rgDeathNoticeList[i].VictimColor = GetClientColor( victim );
strncpy( rgDeathNoticeList[i].szVictim, victim_name, MAX_PLAYER_NAME_LENGTH );
strncpy( rgDeathNoticeList[i].szVictim, victim_name, MAX_PLAYER_NAME_LENGTH - 1 );
rgDeathNoticeList[i].szVictim[MAX_PLAYER_NAME_LENGTH - 1] = 0;
}

2
cl_dll/ev_hldm.cpp

@ -247,7 +247,7 @@ char *EV_HLDM_DamageDecal( physent_t *pe ) @@ -247,7 +247,7 @@ char *EV_HLDM_DamageDecal( physent_t *pe )
}
else if( pe->rendermode != kRenderNormal )
{
sprintf( decalname, "{bproof1" );
strcpy( decalname, "{bproof1" );
}
else
{

8
cl_dll/hud.cpp

@ -519,8 +519,8 @@ void CHud::VidInit( void ) @@ -519,8 +519,8 @@ void CHud::VidInit( void )
sprintf( sz, "sprites/%s.spr", p->szSprite );
m_rghSprites[index] = SPR_Load( sz );
m_rgrcRects[index] = p->rc;
strncpy( &m_rgszSpriteNames[index * MAX_SPRITE_NAME_LENGTH], p->szName, MAX_SPRITE_NAME_LENGTH );
strncpy( &m_rgszSpriteNames[index * MAX_SPRITE_NAME_LENGTH], p->szName, MAX_SPRITE_NAME_LENGTH - 1 );
m_rgszSpriteNames[index * MAX_SPRITE_NAME_LENGTH + ( MAX_SPRITE_NAME_LENGTH - 1 )] = '\0';
index++;
}
@ -562,8 +562,8 @@ void CHud::VidInit( void ) @@ -562,8 +562,8 @@ void CHud::VidInit( void )
sprintf( sz, "sprites/%s.spr", p->szSprite );
m_rghSprites[index] = SPR_Load( sz );
m_rgrcRects[index] = p->rc;
strncpy( &m_rgszSpriteNames[index * MAX_SPRITE_NAME_LENGTH], p->szName, MAX_SPRITE_NAME_LENGTH );
strncpy( &m_rgszSpriteNames[index * MAX_SPRITE_NAME_LENGTH], p->szName, MAX_SPRITE_NAME_LENGTH - 1 );
m_rgszSpriteNames[index * MAX_SPRITE_NAME_LENGTH + ( MAX_SPRITE_NAME_LENGTH - 1 )] = '\0';
index++;
}

4
cl_dll/hud_redraw.cpp

@ -201,9 +201,7 @@ int CHud::Redraw( float flTime, int intermission ) @@ -201,9 +201,7 @@ int CHud::Redraw( float flTime, int intermission )
if( m_hsprCursor == 0 )
{
char sz[256];
sprintf( sz, "sprites/cursor.spr" );
m_hsprCursor = SPR_Load( sz );
m_hsprCursor = SPR_Load( "sprites/cursor.spr" );
}
SPR_Set( m_hsprCursor, 250, 250, 250 );

4
cl_dll/hud_spectator.cpp

@ -448,7 +448,7 @@ int CHudSpectator::Draw( float flTime ) @@ -448,7 +448,7 @@ int CHudSpectator::Draw( float flTime )
color = GetClientColor( i + 1 );
// draw the players name and health underneath
sprintf( string, "%s", g_PlayerInfoList[i + 1].name );
strcpy( string, g_PlayerInfoList[i + 1].name );
lx = strlen( string ) * 3; // 3 is avg. character length :)
@ -537,7 +537,7 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf ) @@ -537,7 +537,7 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
msg->holdtime = READ_FLOAT(); // holdtime
msg->fxtime = READ_FLOAT(); // fxtime;
strncpy( m_HUDMessageText[m_lastHudMessage], READ_STRING(), 128 );
strncpy( m_HUDMessageText[m_lastHudMessage], READ_STRING(), 127 );
m_HUDMessageText[m_lastHudMessage][127] = 0; // text
msg->pMessage = m_HUDMessageText[m_lastHudMessage];

6
cl_dll/menu.cpp

@ -157,7 +157,7 @@ int CHudMenu::MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf ) @@ -157,7 +157,7 @@ int CHudMenu::MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
{
if( !m_fWaitingForMore ) // this is the start of a new menu
{
strncpy( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING );
strncpy( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - 1 );
}
else
{
@ -169,13 +169,13 @@ int CHudMenu::MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf ) @@ -169,13 +169,13 @@ int CHudMenu::MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
if( !NeedMore )
{
// we have the whole string, so we can localise it now
strncpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ), MAX_MENU_STRING );
strncpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ), MAX_MENU_STRING - 1 );
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
// Swap in characters
if( KB_ConvertString( g_szMenuString, &temp ) )
{
strncpy( g_szMenuString, temp, MAX_MENU_STRING );
strncpy( g_szMenuString, temp, MAX_MENU_STRING - 1 );
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
free( temp );
}

161
cl_dll/overview.cpp

@ -1,161 +0,0 @@ @@ -1,161 +0,0 @@
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include "hud.h"
#include "cl_util.h"
#include "cl_entity.h"
#include "triangleapi.h"
#include "overview.h"
// these are included for the math functions
#include "com_model.h"
#include "studio_util.h"
#pragma warning(disable: 4244)
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int CHudOverview::Init()
{
gHUD.AddHudElem(this);
m_iFlags |= HUD_ACTIVE;
return 1;
}
//-----------------------------------------------------------------------------
// Purpose: Loads new icons
//-----------------------------------------------------------------------------
int CHudOverview::VidInit()
{
m_hsprPlayer = gEngfuncs.pfnSPR_Load( "sprites/ring.spr" );
m_hsprViewcone = gEngfuncs.pfnSPR_Load( "sprites/camera.spr" );
return 1;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : flTime -
// intermission -
//-----------------------------------------------------------------------------
int CHudOverview::Draw( float flTime )
{
#if 0
// only draw in overview mode
if( !gEngfuncs.Overview_GetOverviewState() )
return 1;
// make sure we have player info
//gViewPort->GetAllPlayersInfo();
gHUD.m_Scoreboard.GetAllPlayersInfo();
// calculate player size on the overview
int x1, y1, x2, y2;
float v0[3] = { 0.0f }, v1[3] = { 64.0f, 64.0f };
gEngfuncs.Overview_WorldToScreen( v0, &x1, &y1 );
gEngfuncs.Overview_WorldToScreen( v1, &x2, &y2 );
float scale = abs( x2 - x1 );
// loop through all the players and draw them on the map
for( int i = 1; i < MAX_PLAYERS; i++ )
{
cl_entity_t *pl = gEngfuncs.GetEntityByIndex( i );
if( pl && pl->player && pl->curstate.health > 0 && pl->curstate.solid != SOLID_NOT )
{
int x, y, z = 0;
float v[3] = { pl->origin[0], pl->origin[1], 0 };
gEngfuncs.Overview_WorldToScreen( v, &x, &y );
// hack in some team colors
float r, g, bc;
if( g_PlayerExtraInfo[i].teamnumber == 1 )
{
r = 0.0f; g = 0.0f; bc = 1.0f;
}
else if( g_PlayerExtraInfo[i].teamnumber == 2 )
{
r = 1.0f; g = 0.0f; bc = 0.0f;
}
else
{
// just use the default orange color if the team isn't set
r = 1.0f; g = 0.7f; bc = 0.0f;
}
// set the current texture
gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)gEngfuncs.GetSpritePointer( m_hsprPlayer ), 0 );
// additive render mode
gEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );
// no culling
gEngfuncs.pTriAPI->CullFace( TRI_NONE );
// draw a square
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
// set the color to be that of the team
gEngfuncs.pTriAPI->Color4f( r, g, bc, 1.0f );
// calculate rotational matrix
vec3_t a, b, angles;
float rmatrix[3][4]; // transformation matrix
VectorCopy( pl->angles, angles );
angles[0] = 0.0f;
angles[1] += 90.f;
angles[1] = -angles[1];
angles[2] = 0.0f;
AngleMatrix( angles, rmatrix );
a[2] = 0;
a[0] = -scale; a[1] = -scale;
VectorTransform( a, rmatrix, b );
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
gEngfuncs.pTriAPI->Vertex3f( x + b[0], y + b[1], z );
a[0] = -scale; a[1] = scale;
VectorTransform( a, rmatrix, b );
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
gEngfuncs.pTriAPI->Vertex3f( x + b[0], y + b[1], z );
a[0] = scale; a[1] = scale;
VectorTransform( a, rmatrix, b );
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
gEngfuncs.pTriAPI->Vertex3f( x + b[0], y + b[1], z );
a[0] = scale; a[1] = -scale;
VectorTransform( a, rmatrix, b );
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
gEngfuncs.pTriAPI->Vertex3f( x + b[0], y + b[1], z );
// finish up
gEngfuncs.pTriAPI->End();
gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
// draw the players name and health underneath
char string[256];
sprintf( string, "%s (%i%%)", g_PlayerInfoList[i].name, pl->curstate.health );
DrawConsoleString( x, y + ( 1.1 * scale ), string );
}
}
#endif
return 1;
}
//-----------------------------------------------------------------------------
// Purpose: called every time a server is connected to
//-----------------------------------------------------------------------------
void CHudOverview::InitHUDData()
{
//this block would force the spectator view to be on
//gEngfuncs.Overview_SetDrawOverview( 1 );
//gEngfuncs.Overview_SetDrawInset( 0 );
}

27
cl_dll/overview.h

@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#pragma once
#if !defined(OVERVIEW_H)
#define OVERVIEW_H
//-----------------------------------------------------------------------------
// Purpose: Handles the drawing of the top-down map and all the things on it
//-----------------------------------------------------------------------------
class CHudOverview : public CHudBase
{
public:
int Init();
int VidInit();
int Draw( float flTime );
void InitHUDData( void );
private:
HSPRITE m_hsprPlayer;
HSPRITE m_hsprViewcone;
};
#endif // OVERVIEW_H

2
cl_dll/saytext.cpp

@ -133,7 +133,7 @@ int CHudSayText::Draw( float flTime ) @@ -133,7 +133,7 @@ int CHudSayText::Draw( float flTime )
static char buf[MAX_PLAYER_NAME_LENGTH + 32];
// draw the first x characters in the player color
strncpy( buf, g_szLineBuffer[i], Q_min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) );
strncpy( buf, g_szLineBuffer[i], Q_min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 ) );
buf[Q_min( g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 )] = 0;
DrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] );
int x = DrawConsoleString( LINE_START, y, buf );

6
cl_dll/scoreboard.cpp

@ -453,7 +453,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, @@ -453,7 +453,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
if( g_PlayerInfoList[best_player].packetloss >= 63 )
{
UnpackRGB( r, g, b, RGB_REDISH );
sprintf( buf, " !!!!" );
strcpy( buf, " !!!!" );
}
else
{
@ -522,7 +522,7 @@ int CHudScoreboard::MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf @@ -522,7 +522,7 @@ int CHudScoreboard::MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf
if( cl > 0 && cl <= MAX_PLAYERS )
{
// set the players team
strncpy( g_PlayerExtraInfo[cl].teamname, READ_STRING(), MAX_TEAM_NAME );
strncpy( g_PlayerExtraInfo[cl].teamname, READ_STRING(), MAX_TEAM_NAME - 1 );
}
// rebuild the list of teams
@ -564,7 +564,7 @@ int CHudScoreboard::MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf @@ -564,7 +564,7 @@ int CHudScoreboard::MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf
}
m_iNumTeams = Q_max( j, m_iNumTeams );
strncpy( g_TeamInfo[j].name, g_PlayerExtraInfo[i].teamname, MAX_TEAM_NAME );
strncpy( g_TeamInfo[j].name, g_PlayerExtraInfo[i].teamname, MAX_TEAM_NAME - 1 );
g_TeamInfo[j].players = 0;
}

5
cl_dll/statusbar.cpp

@ -141,7 +141,8 @@ void CHudStatusBar::ParseStatusString( int line_num ) @@ -141,7 +141,8 @@ void CHudStatusBar::ParseStatusString( int line_num )
GetPlayerInfo( indexval, &g_PlayerInfoList[indexval] );
if( g_PlayerInfoList[indexval].name != NULL )
{
strncpy( szRepString, g_PlayerInfoList[indexval].name, MAX_PLAYER_NAME_LENGTH );
strncpy( szRepString, g_PlayerInfoList[indexval].name, MAX_PLAYER_NAME_LENGTH - 1 );
szRepString[MAX_PLAYER_NAME_LENGTH - 1] = '\0';
m_pflNameColors[line_num] = GetClientColor( indexval );
}
else
@ -231,7 +232,7 @@ int CHudStatusBar::MsgFunc_StatusText( const char *pszName, int iSize, void *pbu @@ -231,7 +232,7 @@ int CHudStatusBar::MsgFunc_StatusText( const char *pszName, int iSize, void *pbu
if( line < 0 || line >= MAX_STATUSBAR_LINES )
return 1;
strncpy( m_szStatusText[line], READ_STRING(), MAX_STATUSTEXT_LENGTH );
strncpy( m_szStatusText[line], READ_STRING(), MAX_STATUSTEXT_LENGTH - 1 );
m_szStatusText[line][MAX_STATUSTEXT_LENGTH - 1] = 0; // ensure it's null terminated ( strncpy() won't null terminate if read string too long)
if( m_szStatusText[0] == 0 )

4
cl_dll/tri.cpp

@ -50,9 +50,7 @@ void Draw_Triangles( void ) @@ -50,9 +50,7 @@ void Draw_Triangles( void )
if( gHUD.m_hsprCursor == 0 )
{
char sz[256];
sprintf( sz, "sprites/cursor.spr" );
gHUD.m_hsprCursor = SPR_Load( sz );
gHUD.m_hsprCursor = SPR_Load( "sprites/cursor.spr" );
}
if( !gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)gEngfuncs.GetSpritePointer( gHUD.m_hsprCursor ), 0 ) )

240
cl_dll/vgui_ClassMenu.cpp

@ -100,147 +100,6 @@ CClassMenuPanel::CClassMenuPanel( int iTrans, int iRemoveMe, int x, int y, int w @@ -100,147 +100,6 @@ CClassMenuPanel::CClassMenuPanel( int iTrans, int iRemoveMe, int x, int y, int w
m_pScrollPanel->setScrollBarVisible( false, false );
m_pScrollPanel->validate();
// Create the Class buttons
#ifdef _TFC
for( int i = 0; i <= PC_RANDOM; i++ )
{
char sz[256];
int iYPos = CLASSMENU_TOPLEFT_BUTTON_Y + ( ( CLASSMENU_BUTTON_SIZE_Y + CLASSMENU_BUTTON_SPACER_Y ) * i );
ActionSignal *pASignal = new CMenuHandler_StringCommandClassSelect( sTFClassSelection[i], true );
// Class button
sprintf( sz, "%s", CHudTextMessage::BufferedLocaliseTextString( sLocalisedClasses[i] ) );
m_pButtons[i] = new ClassButton( i, sz, CLASSMENU_TOPLEFT_BUTTON_X, iYPos, CLASSMENU_BUTTON_SIZE_X, CLASSMENU_BUTTON_SIZE_Y, true );
// RandomPC uses '0'
if( i >= 1 && i <= 9 )
{
sprintf( sz, "%d", i );
}
else
{
strcpy( sz, "0" );
}
m_pButtons[i]->setBoundKey( sz[0] );
m_pButtons[i]->setContentAlignment( vgui::Label::a_west );
m_pButtons[i]->addActionSignal( pASignal );
m_pButtons[i]->addInputSignal( new CHandler_MenuButtonOver(this, i) );
m_pButtons[i]->setParent( this );
// Create the Class Info Window
// m_pClassInfoPanel[i] = new CTransparentPanel( 255, CLASSMENU_WINDOW_X, CLASSMENU_WINDOW_Y, CLASSMENU_WINDOW_SIZE_X, CLASSMENU_WINDOW_SIZE_Y );
m_pClassInfoPanel[i] = new CTransparentPanel( 255, 0, 0, clientWide, CLASSMENU_WINDOW_SIZE_Y );
m_pClassInfoPanel[i]->setParent( m_pScrollPanel->getClient() );
// m_pClassInfoPanel[i]->setVisible( false );
// don't show class pic in lower resolutions
int textOffs = XRES( 8 );
if( bShowClassGraphic )
{
textOffs = CLASSMENU_WINDOW_NAME_X;
}
// Create the Class Name Label
sprintf( sz, "#Title_%s", sTFClassSelection[i] );
char *localName=CHudTextMessage::BufferedLocaliseTextString( sz );
Label *pNameLabel = new Label( "", textOffs, CLASSMENU_WINDOW_NAME_Y );
pNameLabel->setFont( pSchemes->getFont( hTitleScheme ) );
pNameLabel->setParent( m_pClassInfoPanel[i] );
pSchemes->getFgColor( hTitleScheme, r, g, b, a );
pNameLabel->setFgColor( r, g, b, a );
pSchemes->getBgColor( hTitleScheme, r, g, b, a );
pNameLabel->setBgColor( r, g, b, a );
pNameLabel->setContentAlignment( vgui::Label::a_west );
// pNameLabel->setBorder( new LineBorder() );
pNameLabel->setText( "%s", localName);
// Create the Class Image
if( bShowClassGraphic )
{
for( int team = 0; team < 2; team++ )
{
if( team == 1 )
{
sprintf( sz, "%sred", sTFClassSelection[i] );
}
else
{
sprintf( sz, "%sblue", sTFClassSelection[i] );
}
m_pClassImages[team][i] = new CImageLabel( sz, 0, 0, CLASSMENU_WINDOW_TEXT_X, CLASSMENU_WINDOW_TEXT_Y );
CImageLabel *pLabel = m_pClassImages[team][i];
pLabel->setParent( m_pClassInfoPanel[i] );
// pLabel->setBorder( new LineBorder() );
if( team != 1 )
{
pLabel->setVisible( false );
}
// Reposition it based upon it's size
int xOut, yOut;
pNameLabel->getTextSize( xOut, yOut );
pLabel->setPos( ( CLASSMENU_WINDOW_TEXT_X - pLabel->getWide() ) / 2, yOut / 2 );
}
}
// Create the Player count string
gHUD.m_TextMessage.LocaliseTextString( "#Title_CurrentlyOnYourTeam", m_sPlayersOnTeamString, STRLENMAX_PLAYERSONTEAM );
m_pPlayers[i] = new Label( "", textOffs, CLASSMENU_WINDOW_PLAYERS_Y );
m_pPlayers[i]->setParent( m_pClassInfoPanel[i] );
m_pPlayers[i]->setBgColor( 0, 0, 0, 255 );
m_pPlayers[i]->setContentAlignment( vgui::Label::a_west );
m_pPlayers[i]->setFont( pSchemes->getFont( hClassWindowText ) );
// Open up the Class Briefing File
sprintf(sz, "classes/short_%s.txt", sTFClassSelection[i]);
char *cText = "Class Description not available.";
char *pfile = (char *)gEngfuncs.COM_LoadFile( sz, 5, NULL );
if( pfile )
{
cText = pfile;
}
// Create the Text info window
TextPanel *pTextWindow = new TextPanel( cText, textOffs, CLASSMENU_WINDOW_TEXT_Y, ( CLASSMENU_WINDOW_SIZE_X - textOffs ) - 5, CLASSMENU_WINDOW_SIZE_Y - CLASSMENU_WINDOW_TEXT_Y );
pTextWindow->setParent( m_pClassInfoPanel[i] );
pTextWindow->setFont( pSchemes->getFont( hClassWindowText ) );
pSchemes->getFgColor( hClassWindowText, r, g, b, a );
pTextWindow->setFgColor( r, g, b, a );
pSchemes->getBgColor( hClassWindowText, r, g, b, a );
pTextWindow->setBgColor( r, g, b, a );
// Resize the Info panel to fit it all
int wide,tall;
pTextWindow->getTextImage()->getTextSizeWrapped( wide, tall );
pTextWindow->setSize( wide, tall );
int xx, yy;
pTextWindow->getPos( xx, yy );
int maxX = xx + wide;
int maxY = yy + tall;
//check to see if the image goes lower than the text
//just use the red teams [0] images
if( m_pClassImages[0][i] != null )
{
m_pClassImages[0][i]->getPos( xx, yy );
if( ( yy + m_pClassImages[0][i]->getTall() ) > maxY )
{
maxY = yy + m_pClassImages[0][i]->getTall();
}
}
m_pClassInfoPanel[i]->setSize( maxX , maxY );
if( pfile )
gEngfuncs.COM_FreeFile( pfile );
// m_pClassInfoPanel[i]->setBorder( new LineBorder() );
}
#endif
// Create the Cancel button
m_pCancelButton = new CommandButton( gHUD.m_TextMessage.BufferedLocaliseTextString( "#Menu_Cancel" ), CLASSMENU_TOPLEFT_BUTTON_X, 0, CLASSMENU_BUTTON_SIZE_X, CLASSMENU_BUTTON_SIZE_Y );
m_pCancelButton->setParent( this );
@ -258,96 +117,6 @@ void CClassMenuPanel::Update() @@ -258,96 +117,6 @@ void CClassMenuPanel::Update()
int iYPos = CLASSMENU_TOPLEFT_BUTTON_Y;
// Cycle through the rest of the buttons
#ifdef _TFC
for( int i = 0; i <= PC_RANDOM; i++ )
{
bool bCivilian = ( gViewPort->GetValidClasses( g_iTeamNumber ) == -1 );
if( bCivilian )
{
// If this team can only be civilians, only the civilian button's visible
if( i == 0 )
{
m_pButtons[0]->setVisible( true );
SetActiveInfo( 0 );
iYPos += CLASSMENU_BUTTON_SIZE_Y + CLASSMENU_BUTTON_SPACER_Y;
}
else
{
m_pButtons[i]->setVisible( false );
}
}
else
{
if( m_pButtons[i]->IsNotValid() || i == 0 )
{
m_pButtons[i]->setVisible( false );
}
else
{
m_pButtons[i]->setVisible( true );
m_pButtons[i]->setPos( CLASSMENU_TOPLEFT_BUTTON_X, iYPos );
iYPos += CLASSMENU_BUTTON_SIZE_Y + CLASSMENU_BUTTON_SPACER_Y;
// Start with the first option up
if( !m_iCurrentInfo )
SetActiveInfo( i );
}
}
// Now count the number of teammembers of this class
int iTotal = 0;
for( int j = 1; j < MAX_PLAYERS; j++ )
{
if( g_PlayerInfoList[j].name == 0 )
continue; // empty player slot, skip
if( g_PlayerExtraInfo[j].teamname[0] == 0 )
continue; // skip over players who are not in a team
if( g_PlayerInfoList[j].thisplayer )
continue; // skip this player
if( g_PlayerExtraInfo[j].teamnumber != g_iTeamNumber )
continue; // skip over players in other teams
// If this team is forced to be civilians, just count the number of teammates
if( g_PlayerExtraInfo[j].playerclass != i && !bCivilian )
continue;
iTotal++;
}
char sz[256];
sprintf( sz, m_sPlayersOnTeamString, iTotal );
m_pPlayers[i]->setText( "%s", sz );
// Set the text color to the teamcolor
m_pPlayers[i]->setFgColor( iTeamColors[g_iTeamNumber % iNumberOfTeamColors][0],
iTeamColors[g_iTeamNumber % iNumberOfTeamColors][1],
iTeamColors[g_iTeamNumber % iNumberOfTeamColors][2],
0 );
// set the graphic to be the team pick
for( int team = 0; team < MAX_TEAMS; team++ )
{
// unset all the other images
if( m_pClassImages[team][i] )
{
m_pClassImages[team][i]->setVisible( false );
}
// set the current team image
if( m_pClassImages[g_iTeamNumber - 1][i] != 0 )
{
m_pClassImages[g_iTeamNumber - 1][i]->setVisible( true );
}
else if( m_pClassImages[0][i] )
{
m_pClassImages[0][i]->setVisible( true );
}
}
}
#endif
// If the player already has a class, make the cancel button visible
if( g_iPlayerClass )
{
@ -415,15 +184,6 @@ void CClassMenuPanel::Initialize( void ) @@ -415,15 +184,6 @@ void CClassMenuPanel::Initialize( void )
void CClassMenuPanel::SetActiveInfo( int iInput )
{
// Remove all the Info panels and bring up the specified one
#ifdef _TFC
for( int i = 0; i <= PC_RANDOM; i++ )
{
m_pButtons[i]->setArmed( false );
m_pClassInfoPanel[i]->setVisible( false );
}
if( iInput > PC_RANDOM || iInput < 0 )
#endif
iInput = 0;
m_pButtons[iInput]->setArmed( true );

13
cl_dll/vgui_CustomObjects.cpp

@ -154,7 +154,7 @@ void CommandButton::RecalculateText( void ) @@ -154,7 +154,7 @@ void CommandButton::RecalculateText( void )
void CommandButton::setText( const char *text )
{
strncpy( m_sMainText, text, MAX_BUTTON_SIZE );
strncpy( m_sMainText, text, MAX_BUTTON_SIZE - 1 );
m_sMainText[MAX_BUTTON_SIZE - 1] = 0;
RecalculateText();
@ -304,21 +304,12 @@ int ClassButton::IsNotValid() @@ -304,21 +304,12 @@ int ClassButton::IsNotValid()
return false;
}
// Is it an illegal class?
#ifdef _TFC
if( ( gViewPort->GetValidClasses( 0 ) & sTFValidClassInts[m_iPlayerClass] ) || ( gViewPort->GetValidClasses( g_iTeamNumber ) & sTFValidClassInts[m_iPlayerClass] ) )
return true;
#endif
// Only check current class if they've got autokill on
bool bAutoKill = CVAR_GET_FLOAT( "hud_classautokill" ) != 0;
if( bAutoKill )
{
// Is it the player's current class?
if (
#ifdef _TFC
(gViewPort->IsRandomPC() && m_iPlayerClass == PC_RANDOM) ||
#endif
(!gViewPort->IsRandomPC() && (m_iPlayerClass == g_iPlayerClass)) )
return true;
}
@ -542,10 +533,8 @@ void CMenuHandler_StringCommandClassSelect::actionPerformed( Panel *panel ) @@ -542,10 +533,8 @@ void CMenuHandler_StringCommandClassSelect::actionPerformed( Panel *panel )
// THIS IS NOW BEING DONE ON THE TFC SERVER TO AVOID KILLING SOMEONE THEN
// HAVE THE SERVER SAY "SORRY...YOU CAN'T BE THAT CLASS".
#if !defined _TFC
bool bAutoKill = CVAR_GET_FLOAT( "hud_classautokill" ) != 0;
if( bAutoKill && g_iPlayerClass != 0 )
gEngfuncs.pfnClientCmd( "kill" );
#endif
}

8
cl_dll/vgui_SchemeManager.cpp

@ -205,7 +205,7 @@ CSchemeManager::CSchemeManager( int xRes, int yRes ) @@ -205,7 +205,7 @@ CSchemeManager::CSchemeManager( int xRes, int yRes )
static const int tokenSize = 64;
char paramName[tokenSize], paramValue[tokenSize];
strncpy( paramName, token, tokenSize );
strncpy( paramName, token, tokenSize - 1 );
paramName[tokenSize-1] = 0; // ensure null termination
// get the '=' character
@ -225,7 +225,7 @@ CSchemeManager::CSchemeManager( int xRes, int yRes ) @@ -225,7 +225,7 @@ CSchemeManager::CSchemeManager( int xRes, int yRes )
// get paramValue
pFile = gEngfuncs.COM_ParseFile( pFile, token );
strncpy( paramValue, token, tokenSize );
strncpy( paramValue, token, tokenSize - 1 );
paramValue[tokenSize-1] = 0; // ensure null termination
// is this a new scheme?
@ -278,7 +278,7 @@ CSchemeManager::CSchemeManager( int xRes, int yRes ) @@ -278,7 +278,7 @@ CSchemeManager::CSchemeManager( int xRes, int yRes )
pScheme = &tmpSchemes[currentScheme];
hasFgColor = hasBgColor = hasArmedFgColor = hasArmedBgColor = hasMouseDownFgColor = hasMouseDownBgColor = false;
strncpy( pScheme->schemeName, paramValue, CScheme::SCHEME_NAME_LENGTH );
strncpy( pScheme->schemeName, paramValue, CScheme::SCHEME_NAME_LENGTH - 1 );
pScheme->schemeName[CScheme::SCHEME_NAME_LENGTH-1] = '\0'; // ensure null termination of string
}
@ -291,7 +291,7 @@ CSchemeManager::CSchemeManager( int xRes, int yRes ) @@ -291,7 +291,7 @@ CSchemeManager::CSchemeManager( int xRes, int yRes )
// pull the data out into the scheme
if ( !stricmp(paramName, "FontName") )
{
strncpy( pScheme->fontName, paramValue, CScheme::FONT_NAME_LENGTH );
strncpy( pScheme->fontName, paramValue, CScheme::FONT_NAME_LENGTH - 1 );
pScheme->fontName[CScheme::FONT_NAME_LENGTH-1] = 0;
}
else if ( !stricmp(paramName, "FontSize") )

40
cl_dll/vgui_ScorePanel.cpp

@ -256,10 +256,7 @@ void ScorePanel::Update() @@ -256,10 +256,7 @@ void ScorePanel::Update()
// Set the title
if( gViewPort->m_szServerName[0] != '\0' )
{
char sz[MAX_SERVERNAME_LENGTH + 16];
sprintf( sz, "%s", gViewPort->m_szServerName );
m_TitleLabel.setText( sz );
m_TitleLabel.setText( gViewPort->m_szServerName );
}
m_iRows = 0;
@ -502,7 +499,7 @@ void ScorePanel::RebuildTeams() @@ -502,7 +499,7 @@ void ScorePanel::RebuildTeams()
}
m_iNumTeams = Q_max( j, m_iNumTeams );
strncpy( g_TeamInfo[j].name, g_PlayerExtraInfo[i].teamname, MAX_TEAM_NAME );
strncpy( g_TeamInfo[j].name, g_PlayerExtraInfo[i].teamname, MAX_TEAM_NAME - 1 );
g_TeamInfo[j].players = 0;
}
@ -684,7 +681,7 @@ void ScorePanel::FillGrid() @@ -684,7 +681,7 @@ void ScorePanel::FillGrid()
}
// Fill out with the correct data
strcpy(sz, "");
sz[0] = '\0';
if ( m_iIsATeam[row] )
{
char sz2[128];
@ -694,11 +691,11 @@ void ScorePanel::FillGrid() @@ -694,11 +691,11 @@ void ScorePanel::FillGrid()
case COLUMN_NAME:
if ( m_iIsATeam[row] == TEAM_SPECTATORS )
{
sprintf( sz2, "%s", CHudTextMessage::BufferedLocaliseTextString( "#Spectators" ) );
strcpy( sz2, CHudTextMessage::BufferedLocaliseTextString( "#Spectators" ) );
}
else
{
sprintf( sz2, "%s", gViewPort->GetTeamName(team_info->teamnumber) );
strcpy( sz2, gViewPort->GetTeamName(team_info->teamnumber) );
}
strcpy(sz, sz2);
@ -776,11 +773,6 @@ void ScorePanel::FillGrid() @@ -776,11 +773,6 @@ void ScorePanel::FillGrid()
// Don't show classes if this client hasnt picked a team yet
if ( g_iTeamNumber == 0 )
bShowClass = false;
#ifdef _TFC
// in TFC show all classes in spectator mode
if ( g_iUser1 )
bShowClass = true;
#endif
if (bShowClass)
{
@ -795,7 +787,7 @@ void ScorePanel::FillGrid() @@ -795,7 +787,7 @@ void ScorePanel::FillGrid()
if (bNoClass)
sz[0] = '\0';
else
sprintf( sz, "%s", CHudTextMessage::BufferedLocaliseTextString( sLocalisedClasses[ g_PlayerExtraInfo[ m_iSortedRows[row] ].playerclass ] ) );
strcpy( sz, CHudTextMessage::BufferedLocaliseTextString( sLocalisedClasses[ g_PlayerExtraInfo[ m_iSortedRows[row] ].playerclass ] ) );
}
else
{
@ -819,21 +811,6 @@ void ScorePanel::FillGrid() @@ -819,21 +811,6 @@ void ScorePanel::FillGrid()
}
*/
break;
#ifdef _TFC
case COLUMN_KILLS:
if (g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber)
sprintf(sz, "%d", g_PlayerExtraInfo[ m_iSortedRows[row] ].frags );
break;
case COLUMN_DEATHS:
if (g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber)
sprintf(sz, "%d", g_PlayerExtraInfo[ m_iSortedRows[row] ].deaths );
break;
case COLUMN_LATENCY:
if (g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber)
sprintf(sz, "%d", g_PlayerInfoList[ m_iSortedRows[row] ].ping );
break;
#else
case COLUMN_KILLS:
sprintf(sz, "%d", g_PlayerExtraInfo[ m_iSortedRows[row] ].frags );
break;
@ -843,7 +820,6 @@ void ScorePanel::FillGrid() @@ -843,7 +820,6 @@ void ScorePanel::FillGrid()
case COLUMN_LATENCY:
sprintf(sz, "%d", g_PlayerInfoList[ m_iSortedRows[row] ].ping );
break;
#endif
default:
break;
}
@ -930,14 +906,12 @@ void ScorePanel::mousePressed(MouseCode code, Panel* panel) @@ -930,14 +906,12 @@ void ScorePanel::mousePressed(MouseCode code, Panel* panel)
else
{
char string1[1024];
char string2[1024];
// mute the player
GetClientVoiceMgr()->SetPlayerBlockedState(iPlayer, true);
sprintf( string1, CHudTextMessage::BufferedLocaliseTextString( "#Muted" ), pl_info->name );
sprintf( string2, "%s", CHudTextMessage::BufferedLocaliseTextString( "#No_longer_hear_that_player" ) );
sprintf( string, "%c** %s %s\n", HUD_PRINTTALK, string1, string2 );
sprintf( string, "%c** %s %s\n", HUD_PRINTTALK, string1, CHudTextMessage::BufferedLocaliseTextString( "#No_longer_hear_that_player" ) );
gHUD.m_TextMessage.MsgFunc_TextMsg(NULL, strlen(string)+1, string );
}

473
cl_dll/vgui_TeamFortressViewport.cpp

@ -136,32 +136,6 @@ const char *sTFClassSelection[] = @@ -136,32 +136,6 @@ const char *sTFClassSelection[] =
"civilian",
};
#ifdef _TFC
int iBuildingCosts[] =
{
BUILD_COST_DISPENSER,
BUILD_COST_SENTRYGUN,
BUILD_COST_TELEPORTER
};
// This maps class numbers to the Invalid Class bit.
// This is needed for backwards compatability in maps that were finished before
// all the classes were in TF. Hence the wacky sequence.
int sTFValidClassInts[] =
{
0,
TF_ILL_SCOUT,
TF_ILL_SNIPER,
TF_ILL_SOLDIER,
TF_ILL_DEMOMAN,
TF_ILL_MEDIC,
TF_ILL_HVYWEP,
TF_ILL_PYRO,
TF_ILL_SPY,
TF_ILL_ENGINEER,
TF_ILL_RANDOMPC,
};
#endif
// Get the name of TGA file, based on GameDir
char *GetVGUITGAName( const char *pszName )
@ -760,7 +734,7 @@ int TeamFortressViewport::CreateCommandMenu( const char *menuFile, int direction @@ -760,7 +734,7 @@ int TeamFortressViewport::CreateCommandMenu( const char *menuFile, int direction
{
// Get the mapname
pfile = gEngfuncs.COM_ParseFile( pfile, token );
strncpy( szMap, token, MAX_MAPNAME );
strncpy( szMap, token, MAX_MAPNAME - 1 );
szMap[MAX_MAPNAME - 1] = '\0';
// Get the next token
@ -784,20 +758,6 @@ int TeamFortressViewport::CreateCommandMenu( const char *menuFile, int direction @@ -784,20 +758,6 @@ int TeamFortressViewport::CreateCommandMenu( const char *menuFile, int direction
else
{
// See if it's a Class
#ifdef _TFC
for( int i = 1; i <= PC_ENGINEER; i++ )
{
if( !strcmp( token, sTFClasses[i] ) )
{
// Save it off
iPlayerClass = i;
// Get the button text
pfile = gEngfuncs.COM_ParseFile( pfile, token );
break;
}
}
#endif
}
// Get the button bound key
@ -947,21 +907,6 @@ CCommandMenu *TeamFortressViewport::CreateDisguiseSubmenu( CommandButton *pButto @@ -947,21 +907,6 @@ CCommandMenu *TeamFortressViewport::CreateDisguiseSubmenu( CommandButton *pButto
m_pCommandMenus[m_iNumMenus] = pMenu;
m_iNumMenus++;
// create the class choice buttons
#ifdef _TFC
for( int i = PC_SCOUT; i <= PC_ENGINEER; i++ )
{
CommandButton *pDisguiseButton = new CommandButton( CHudTextMessage::BufferedLocaliseTextString( sLocalisedClasses[i] ), 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
char sz[256];
sprintf( sz, "%s %d", commandText, i );
pDisguiseButton->addActionSignal( new CMenuHandler_StringCommand( sz ) );
pMenu->AddButton( pDisguiseButton );
}
#endif
return pMenu;
}
@ -1018,268 +963,7 @@ CommandButton *TeamFortressViewport::CreateCustomButton( char *pButtonText, char @@ -1018,268 +963,7 @@ CommandButton *TeamFortressViewport::CreateCustomButton( char *pButtonText, char
pMenu = CreateSubMenu( pButton, m_pCurrentCommandMenu, iYOffset );
m_pCommandMenus[m_iNumMenus] = pMenu;
m_iNumMenus++;
#ifdef _TFC
for( int i = PC_SCOUT; i <= PC_RANDOM; i++ )
{
char sz[256];
// ChangeClass buttons
CHudTextMessage::LocaliseTextString( sLocalisedClasses[i], sz, 256 );
ClassButton *pClassButton = new ClassButton( i, sz, 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y, false );
sprintf( sz, "%s", sTFClassSelection[i] );
pClassButton->addActionSignal( new CMenuHandler_StringCommandClassSelect( sz ) );
pMenu->AddButton( pClassButton );
}
#endif
}
#ifdef _TFC
// Map Briefing
else if( !strcmp( pButtonName, "!MAPBRIEFING" ) )
{
pButton = new CommandButton( pButtonText, 0, BUTTON_SIZE_Y * m_pCurrentCommandMenu->GetNumButtons(), CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_TextWindow( MENU_MAPBRIEFING ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
// Class Descriptions
else if( !strcmp( pButtonName, "!CLASSDESC" ) )
{
pButton = new ClassButton( 0, pButtonText, 0, BUTTON_SIZE_Y * m_pCurrentCommandMenu->GetNumButtons(), CMENU_SIZE_X, BUTTON_SIZE_Y, false );
pButton->addActionSignal( new CMenuHandler_TextWindow( MENU_CLASSHELP ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
else if( !strcmp( pButtonName, "!SERVERINFO" ) )
{
pButton = new ClassButton( 0, pButtonText, 0, BUTTON_SIZE_Y * m_pCurrentCommandMenu->GetNumButtons(), CMENU_SIZE_X, BUTTON_SIZE_Y, false );
pButton->addActionSignal( new CMenuHandler_TextWindow( MENU_INTRO ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
// Spy abilities
else if( !strcmp( pButtonName, "!SPY" ) )
{
pButton = new DisguiseButton( 0, pButtonText, 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
}
// Feign
else if( !strcmp( pButtonName, "!FEIGN" ) )
{
pButton = new FeignButton( FALSE, pButtonText, 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "feign" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
// Feign Silently
else if( !strcmp( pButtonName, "!FEIGNSILENT" ) )
{
pButton = new FeignButton( FALSE, pButtonText, 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "sfeign" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
// Stop Feigning
else if( !strcmp( pButtonName, "!FEIGNSTOP" ) )
{
pButton = new FeignButton( TRUE, pButtonText, 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "feign" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
// Disguise
else if( !strcmp( pButtonName, "!DISGUISEENEMY" ) )
{
// Create the disguise enemy button, which active only if there are 2 teams
pButton = new DisguiseButton(DISGUISE_TEAM2, pButtonText, 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y);
CreateDisguiseSubmenu( pButton, m_pCurrentCommandMenu, "disguise_enemy", iYOffset);
}
else if( !strcmp( pButtonName, "!DISGUISEFRIENDLY" ) )
{
// Create the disguise friendly button, which active only if there are 1 or 2 teams
pButton = new DisguiseButton( DISGUISE_TEAM1 | DISGUISE_TEAM2, pButtonText, 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
CreateDisguiseSubmenu( pButton, m_pCurrentCommandMenu, "disguise_friendly", iYOffset );
}
else if( !strcmp( pButtonName, "!DISGUISE" ) )
{
// Create the Disguise button
pButton = new DisguiseButton( DISGUISE_TEAM3 | DISGUISE_TEAM4, pButtonText, 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
CCommandMenu *pDisguiseMenu = CreateSubMenu( pButton, m_pCurrentCommandMenu, iYOffset );
m_pCommandMenus[m_iNumMenus] = pDisguiseMenu;
m_iNumMenus++;
// Disguise Enemy submenu buttons
for( int i = 1; i <= 4; i++ )
{
// only show the 4th disguise button if we have 4 teams
m_pDisguiseButtons[i] = new DisguiseButton( ( ( i < 4 ) ? DISGUISE_TEAM3 : 0) | DISGUISE_TEAM4, "Disguise", 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
pDisguiseMenu->AddButton( m_pDisguiseButtons[i] );
m_pDisguiseButtons[i]->setParentMenu( pDisguiseMenu );
char sz[256];
sprintf( sz, "disguise %d", i );
CreateDisguiseSubmenu( m_pDisguiseButtons[i], pDisguiseMenu, sz, iYOffset, CMENU_SIZE_X - 1 );
}
}
// Start setting a Detpack
else if( !strcmp( pButtonName, "!DETPACKSTART" ) )
{
// Detpack Submenu
pButton = new DetpackButton( 2, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y );
// Create the submenu
pMenu = CreateSubMenu( pButton, m_pCurrentCommandMenu, iYOffset );
m_pCommandMenus[m_iNumMenus] = pMenu;
m_iNumMenus++;
// Set detpack buttons
CommandButton *pDetButton;
pDetButton = new CommandButton( m_sDetpackStrings[0], 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
pDetButton->addActionSignal( new CMenuHandler_StringCommand( "detstart 5" ) );
pMenu->AddButton( pDetButton );
pDetButton = new CommandButton( m_sDetpackStrings[1], 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
pDetButton->addActionSignal( new CMenuHandler_StringCommand( "detstart 20" ) );
pMenu->AddButton( pDetButton );
pDetButton = new CommandButton( m_sDetpackStrings[2], 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
pDetButton->addActionSignal( new CMenuHandler_StringCommand( "detstart 50" ) );
pMenu->AddButton( pDetButton );
}
// Stop setting a Detpack
else if( !strcmp( pButtonName, "!DETPACKSTOP" ) )
{
pButton = new DetpackButton( 1, pButtonText, 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "detstop" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
// Engineer building
else if( !strcmp( pButtonName, "!BUILD" ) )
{
// only appears if the player is an engineer, and either they have built something or have enough metal to build
pButton = new BuildButton( BUILDSTATE_BASE, 0, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y );
}
else if( !strcmp( pButtonName, "!BUILDSENTRY" ) )
{
pButton = new BuildButton( BUILDSTATE_CANBUILD, BuildButton::SENTRYGUN, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "build 2" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
else if( !strcmp( pButtonName, "!BUILDDISPENSER" ) )
{
pButton = new BuildButton( BUILDSTATE_CANBUILD, BuildButton::DISPENSER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "build 1" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
else if( !strcmp( pButtonName, "!ROTATESENTRY180" ) )
{
pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::SENTRYGUN, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "rotatesentry180" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
else if( !strcmp( pButtonName, "!ROTATESENTRY" ) )
{
pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::SENTRYGUN, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "rotatesentry" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) );
}
else if( !strcmp( pButtonName, "!DISMANTLEDISPENSER" ) )
{
pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::DISPENSER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "dismantle 1" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
else if( !strcmp( pButtonName, "!DISMANTLESENTRY" ) )
{
pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::SENTRYGUN, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "dismantle 2" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
else if( !strcmp( pButtonName, "!DETONATEDISPENSER" ) )
{
pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::DISPENSER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "detdispenser" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
else if( !strcmp( pButtonName, "!DETONATESENTRY" ) )
{
pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::SENTRYGUN, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "detsentry" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) );
}
else if ( !strcmp( pButtonName, "!BUILDENTRYTELEPORTER" ) )
{
pButton = new BuildButton( BUILDSTATE_CANBUILD, BuildButton::ENTRY_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y);
pButton->addActionSignal(new CMenuHandler_StringCommand("build 4"));
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) );
}
else if ( !strcmp( pButtonName, "!DISMANTLEENTRYTELEPORTER" ) )
{
pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::ENTRY_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y);
pButton->addActionSignal(new CMenuHandler_StringCommand("dismantle 4"));
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) );
}
else if ( !strcmp( pButtonName, "!DETONATEENTRYTELEPORTER" ) )
{
pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::ENTRY_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y);
pButton->addActionSignal(new CMenuHandler_StringCommand("detentryteleporter"));
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) );
}
else if ( !strcmp( pButtonName, "!BUILDEXITTELEPORTER" ) )
{
pButton = new BuildButton( BUILDSTATE_CANBUILD, BuildButton::EXIT_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y);
pButton->addActionSignal(new CMenuHandler_StringCommand("build 5"));
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) );
}
else if ( !strcmp( pButtonName, "!DISMANTLEEXITTELEPORTER" ) )
{
pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::EXIT_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y);
pButton->addActionSignal(new CMenuHandler_StringCommand("dismantle 5"));
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) );
}
else if ( !strcmp( pButtonName, "!DETONATEEXITTELEPORTER" ) )
{
pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::EXIT_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y);
pButton->addActionSignal(new CMenuHandler_StringCommand("detexitteleporter"));
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
// Stop building
else if( !strcmp( pButtonName, "!BUILDSTOP" ) )
{
pButton = new BuildButton( BUILDSTATE_BUILDING, 0, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y );
pButton->addActionSignal( new CMenuHandler_StringCommand( "build" ) );
// Create an input signal that'll popup the current menu
pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput( pButton, m_pCurrentCommandMenu ) );
}
#endif
return pButton;
}
@ -1433,23 +1117,9 @@ void TeamFortressViewport::InputPlayerSpecial( void ) @@ -1433,23 +1117,9 @@ void TeamFortressViewport::InputPlayerSpecial( void )
if( !m_iInitialized )
return;
#ifdef _TFC
if( g_iPlayerClass == PC_ENGINEER || g_iPlayerClass == PC_SPY )
{
ShowCommandMenu( gViewPort->m_StandardMenu );
if( m_pCurrentCommandMenu )
{
m_pCurrentCommandMenu->KeyInput( '7' );
}
}
else
#endif
{
// if it's any other class, just send the command down to the server
ClientCmd( "_special" );
}
}
// Set the submenu of the Command Menu
void TeamFortressViewport::SetCurrentCommandMenu( CCommandMenu *pNewMenu )
@ -1573,7 +1243,7 @@ void TeamFortressViewport::UpdateSpectatorPanel() @@ -1573,7 +1243,7 @@ void TeamFortressViewport::UpdateSpectatorPanel()
// create player & health string
if( player && name )
{
strncpy( bottomText, name, sizeof(bottomText) );
strncpy( bottomText, name, sizeof(bottomText) - 1 );
bottomText[ sizeof(bottomText) - 1 ] = 0;
pBottomText = bottomText;
}
@ -1639,9 +1309,9 @@ void TeamFortressViewport::UpdateSpectatorPanel() @@ -1639,9 +1309,9 @@ void TeamFortressViewport::UpdateSpectatorPanel()
if( timer < 0 )
timer = 0;
_snprintf( szText, 63, "%d:%02d\n", ( timer / 60 ), ( timer % 60 ) );
_snprintf( szText, sizeof(szText) - 1, "%d:%02d\n", ( timer / 60 ), ( timer % 60 ) );
szText[63] = 0;
szText[sizeof(szText) - 1] = '\0';
m_pSpectatorPanel->m_CurrentTime->setText( szText ); */
@ -1764,54 +1434,9 @@ CMenuPanel *TeamFortressViewport::CreateTextWindow( int iTextToShow ) @@ -1764,54 +1434,9 @@ CMenuPanel *TeamFortressViewport::CreateTextWindow( int iTextToShow )
cText = pfile;
strncpy( cTitle, m_sMapName, MAX_TITLE_LENGTH );
strncpy( cTitle, m_sMapName, MAX_TITLE_LENGTH - 1 );
cTitle[MAX_TITLE_LENGTH - 1] = 0;
}
#ifdef _TFC
else if( iTextToShow == SHOW_CLASSDESC )
{
switch( g_iPlayerClass )
{
case PC_SCOUT: cText = CHudTextMessage::BufferedLocaliseTextString( "#Help_scout" );
CHudTextMessage::LocaliseTextString( "#Title_scout", cTitle, MAX_TITLE_LENGTH ); break;
case PC_SNIPER: cText = CHudTextMessage::BufferedLocaliseTextString( "#Help_sniper" );
CHudTextMessage::LocaliseTextString( "#Title_sniper", cTitle, MAX_TITLE_LENGTH ); break;
case PC_SOLDIER: cText = CHudTextMessage::BufferedLocaliseTextString( "#Help_soldier" );
CHudTextMessage::LocaliseTextString( "#Title_soldier", cTitle, MAX_TITLE_LENGTH ); break;
case PC_DEMOMAN: cText = CHudTextMessage::BufferedLocaliseTextString( "#Help_demoman" );
CHudTextMessage::LocaliseTextString( "#Title_demoman", cTitle, MAX_TITLE_LENGTH ); break;
case PC_MEDIC: cText = CHudTextMessage::BufferedLocaliseTextString( "#Help_medic" );
CHudTextMessage::LocaliseTextString( "#Title_medic", cTitle, MAX_TITLE_LENGTH ); break;
case PC_HVYWEAP: cText = CHudTextMessage::BufferedLocaliseTextString( "#Help_hwguy" );
CHudTextMessage::LocaliseTextString( "#Title_hwguy", cTitle, MAX_TITLE_LENGTH ); break;
case PC_PYRO: cText = CHudTextMessage::BufferedLocaliseTextString( "#Help_pyro" );
CHudTextMessage::LocaliseTextString( "#Title_pyro", cTitle, MAX_TITLE_LENGTH ); break;
case PC_SPY: cText = CHudTextMessage::BufferedLocaliseTextString( "#Help_spy" );
CHudTextMessage::LocaliseTextString( "#Title_spy", cTitle, MAX_TITLE_LENGTH ); break;
case PC_ENGINEER: cText = CHudTextMessage::BufferedLocaliseTextString( "#Help_engineer" );
CHudTextMessage::LocaliseTextString( "#Title_engineer", cTitle, MAX_TITLE_LENGTH ); break;
case PC_CIVILIAN: cText = CHudTextMessage::BufferedLocaliseTextString( "#Help_civilian" );
CHudTextMessage::LocaliseTextString( "#Title_civilian", cTitle, MAX_TITLE_LENGTH ); break;
default:
return NULL;
}
if( g_iPlayerClass == PC_CIVILIAN )
{
strcpy(sz, "classes/long_civilian.txt");
}
else
{
sprintf( sz, "classes/long_%s.txt", sTFClassSelection[g_iPlayerClass] );
}
char *pfile = (char*)gEngfuncs.COM_LoadFile( sz, 5, NULL );
if( pfile )
{
cText = pfile;
}
}
#endif
else if( iTextToShow == SHOW_SPECHELP )
{
CHudTextMessage::LocaliseTextString( "#Spec_Help_Title", cTitle, MAX_TITLE_LENGTH );
@ -2413,7 +2038,7 @@ int TeamFortressViewport::MsgFunc_ServerName( const char *pszName, int iSize, vo @@ -2413,7 +2038,7 @@ int TeamFortressViewport::MsgFunc_ServerName( const char *pszName, int iSize, vo
{
BEGIN_READ( pbuf, iSize );
strncpy( m_szServerName, READ_STRING(), sizeof(m_szServerName) );
strncpy( m_szServerName, READ_STRING(), sizeof(m_szServerName) - 1 );
m_szServerName[sizeof(m_szServerName) - 1] = 0;
return 1;
@ -2534,100 +2159,14 @@ int TeamFortressViewport::MsgFunc_AllowSpec( const char *pszName, int iSize, voi @@ -2534,100 +2159,14 @@ int TeamFortressViewport::MsgFunc_AllowSpec( const char *pszName, int iSize, voi
return 1;
}
#if defined( _TFC )
const Vector& GetTeamColor( int team_no );
extern globalvars_t *gpGlobals;
#endif
// used to reset the player's screen immediately
int TeamFortressViewport::MsgFunc_ResetFade( const char *pszName, int iSize, void *pbuf )
{
#if defined( _TFC )
if ( !gpGlobals )
return 0;
screenfade_t sf;
gEngfuncs.pfnGetScreenFade( &sf );
sf.fader = 0;
sf.fadeg = 0;
sf.fadeb = 0;
sf.fadealpha = 0;
sf.fadeEnd = 0.1;
sf.fadeReset = 0.0;
sf.fadeSpeed = 0.0;
sf.fadeFlags = FFADE_IN;
sf.fadeReset += gpGlobals->time;
sf.fadeEnd += sf.fadeReset;
gEngfuncs.pfnSetScreenFade( &sf );
#endif
return 1;
}
// used to fade a player's screen out/in when they're spectating someone who is teleported
int TeamFortressViewport::MsgFunc_SpecFade( const char *pszName, int iSize, void *pbuf )
{
#if defined( _TFC )
BEGIN_READ( pbuf, iSize );
int iIndex = READ_BYTE();
// we're in first-person spectator mode (...not first-person in the PIP)
if ( g_iUser1 == OBS_IN_EYE )
{
// this is the person we're watching
if ( g_iUser2 == iIndex )
{
int iFade = READ_BYTE();
int iTeam = READ_BYTE();
float flTime = ( (float)READ_SHORT() / 100.0 );
int iAlpha = READ_BYTE();
Vector team = GetTeamColor( iTeam );
screenfade_t sf;
gEngfuncs.pfnGetScreenFade( &sf );
sf.fader = team[0];
sf.fadeg = team[1];
sf.fadeb = team[2];
sf.fadealpha = iAlpha;
sf.fadeEnd = flTime;
sf.fadeReset = 0.0;
sf.fadeSpeed = 0.0;
if ( iFade == BUILD_TELEPORTER_FADE_OUT )
{
sf.fadeFlags = FFADE_OUT;
sf.fadeReset = flTime;
if ( sf.fadeEnd )
sf.fadeSpeed = -(float)sf.fadealpha / sf.fadeEnd;
sf.fadeTotalEnd = sf.fadeEnd += gpGlobals->time;
sf.fadeReset += sf.fadeEnd;
}
else
{
sf.fadeFlags = FFADE_IN;
if ( sf.fadeEnd )
sf.fadeSpeed = (float)sf.fadealpha / sf.fadeEnd;
sf.fadeReset += gpGlobals->time;
sf.fadeEnd += sf.fadeReset;
}
gEngfuncs.pfnSetScreenFade( &sf );
}
}
#endif
return 1;
}

82
cl_dll/vgui_TeamFortressViewport.h

@ -32,9 +32,6 @@ @@ -32,9 +32,6 @@
#include "vgui_SchemeManager.h"
#define TF_DEFS_ONLY
#ifdef _TFC
#include "../tfc/tf_defs.h"
#else
#define PC_LASTCLASS 10
#define PC_UNDEFINED 0
#define MENU_DEFAULT 1
@ -46,7 +43,6 @@ @@ -46,7 +43,6 @@
#define MENU_CLASSHELP2 7
#define MENU_REPEATHELP 8
#define MENU_SPECHELP 9
#endif
using namespace vgui;
class Cursor;
@ -850,7 +846,7 @@ protected: @@ -850,7 +846,7 @@ protected:
public:
CMenuHandler_SpectateFollow( char *player )
{
strncpy( m_szplayer, player, MAX_COMMAND_SIZE);
strncpy( m_szplayer, player, MAX_COMMAND_SIZE - 1 );
m_szplayer[MAX_COMMAND_SIZE-1] = '\0';
}
@ -1031,12 +1027,6 @@ public: @@ -1031,12 +1027,6 @@ public:
virtual int IsNotValid()
{
// Only visible for spies
#ifdef _TFC
if( g_iPlayerClass != PC_SPY )
return true;
#endif
if( m_iFeignState == gViewPort->GetIsFeigning() )
return false;
@ -1079,12 +1069,6 @@ public: @@ -1079,12 +1069,6 @@ public:
virtual int IsNotValid()
{
#ifdef _TFC
// Only visible for spies
if( g_iPlayerClass != PC_SPY )
return true;
#endif
// if it's not tied to a specific team, then always show (for spies)
if( !m_iValidTeamsBits )
return false;
@ -1110,12 +1094,6 @@ public: @@ -1110,12 +1094,6 @@ public:
virtual int IsNotValid()
{
#ifdef _TFC
// Only visible for demomen
if( g_iPlayerClass != PC_DEMOMAN )
return true;
#endif
if( m_iDetpackState == gViewPort->GetIsSettingDetpack() )
return false;
@ -1152,64 +1130,6 @@ public: @@ -1152,64 +1130,6 @@ public:
virtual int IsNotValid()
{
#ifdef _TFC
// Only visible for engineers
if( g_iPlayerClass != PC_ENGINEER )
return true;
// If this isn't set, it's only active when they're not building
if( m_iBuildState & BUILDSTATE_BUILDING )
{
// Make sure the player's building
if( !( gViewPort->GetBuildState() & BS_BUILDING ) )
return true;
}
else
{
// Make sure the player's not building
if( gViewPort->GetBuildState() & BS_BUILDING )
return true;
}
if( m_iBuildState & BUILDSTATE_BASE )
{
// Only appear if we've got enough metal to build something, or something already built
if ( gViewPort->GetBuildState() & (BS_HAS_SENTRYGUN | BS_HAS_DISPENSER | BS_CANB_SENTRYGUN | BS_CANB_DISPENSER | BS_HAS_ENTRY_TELEPORTER | BS_HAS_EXIT_TELEPORTER | BS_CANB_ENTRY_TELEPORTER | BS_CANB_EXIT_TELEPORTER) )
return false;
return true;
}
// Must have a building
if( m_iBuildState & BUILDSTATE_HASBUILDING )
{
if( m_iBuildData == BuildButton::DISPENSER && !( gViewPort->GetBuildState() & BS_HAS_DISPENSER ) )
return true;
if( m_iBuildData == BuildButton::SENTRYGUN && !( gViewPort->GetBuildState() & BS_HAS_SENTRYGUN ) )
return true;
if ( m_iBuildData == BuildButton::ENTRY_TELEPORTER && !(gViewPort->GetBuildState() & BS_HAS_ENTRY_TELEPORTER) )
return true;
if ( m_iBuildData == BuildButton::EXIT_TELEPORTER && !(gViewPort->GetBuildState() & BS_HAS_EXIT_TELEPORTER) )
return true;
}
// Can build something
if( m_iBuildState & BUILDSTATE_CANBUILD )
{
// Make sure they've got the ammo and don't have one already
if( m_iBuildData == BuildButton::DISPENSER && ( gViewPort->GetBuildState() & BS_CANB_DISPENSER ) )
return false;
if( m_iBuildData == BuildButton::SENTRYGUN && ( gViewPort->GetBuildState() & BS_CANB_SENTRYGUN ) )
return false;
if ( m_iBuildData == BuildButton::ENTRY_TELEPORTER && (gViewPort->GetBuildState() & BS_CANB_ENTRY_TELEPORTER) )
return false;
if ( m_iBuildData == BuildButton::EXIT_TELEPORTER && (gViewPort->GetBuildState() & BS_CANB_EXIT_TELEPORTER) )
return false;
return true;
}
#endif
return false;
}
};

25
cl_dll/voice_status.cpp

@ -5,16 +5,7 @@ @@ -5,16 +5,7 @@
// $NoKeywords: $
//=============================================================================
// There are hud.h's coming out of the woodwork so this ensures that we get the right one.
#if defined(THREEWAVE) || defined(DMC_BUILD)
#include "../dmc/cl_dll/hud.h"
#elif defined(CSTRIKE)
#include "../cstrike/cl_dll/hud.h"
#elif defined(DOD)
#include "../dod/cl_dll/hud.h"
#else
#include "hud.h"
#endif
#include "cl_util.h"
#include <assert.h>
@ -89,16 +80,14 @@ int g_BannedPlayerPrintCount; @@ -89,16 +80,14 @@ int g_BannedPlayerPrintCount;
void ForEachBannedPlayer(char id[16])
{
char str[256];
sprintf(str, "Ban %d: %2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x\n",
sprintf(str, "BAN %d: %2X%2X%2X%2X%2X%2X%2X%2X%2X%2X%2X%2X%2X%2X%2X%2X\n",
g_BannedPlayerPrintCount++,
id[0], id[1], id[2], id[3],
id[4], id[5], id[6], id[7],
id[8], id[9], id[10], id[11],
id[12], id[13], id[14], id[15]
);
#ifdef _WIN32
strupr(str);
#endif
gEngfuncs.pfnConsolePrint(str);
}
@ -400,7 +389,7 @@ void CVoiceStatus::UpdateSpeakerStatus( int entindex, qboolean bTalking ) @@ -400,7 +389,7 @@ void CVoiceStatus::UpdateSpeakerStatus( int entindex, qboolean bTalking )
if ( gEngfuncs.pfnGetCvarFloat( "voice_clientdebug" ) )
{
char msg[256];
_snprintf( msg, sizeof( msg ), "CVoiceStatus::UpdateSpeakerStatus: ent %d talking = %d\n", entindex, bTalking );
sprintf( msg, "CVoiceStatus::UpdateSpeakerStatus: ent %d talking = %d\n", entindex, bTalking );
gEngfuncs.pfnConsolePrint( msg );
}
@ -455,7 +444,8 @@ void CVoiceStatus::UpdateSpeakerStatus( int entindex, qboolean bTalking ) @@ -455,7 +444,8 @@ void CVoiceStatus::UpdateSpeakerStatus( int entindex, qboolean bTalking )
gEngfuncs.pfnGetPlayerInfo( entindex, &info );
char paddedName[512];
_snprintf( paddedName, sizeof( paddedName ), "%s ", info.name );
_snprintf( paddedName, sizeof( paddedName ) - 1, "%s ", info.name );
paddedName[sizeof(paddedName) - 1] = '\0';
int color[3];
m_pHelper->GetPlayerTextColor( entindex, color );
@ -516,7 +506,7 @@ void CVoiceStatus::UpdateServerState(bool bForce) @@ -516,7 +506,7 @@ void CVoiceStatus::UpdateServerState(bool bForce)
m_bServerModEnable = bCVarModEnable;
char str[256];
_snprintf(str, sizeof(str), "VModEnable %d", m_bServerModEnable);
sprintf(str, "VModEnable %d", m_bServerModEnable);
ServerCmd(str);
if(gEngfuncs.pfnGetCvarFloat("voice_clientdebug"))
@ -527,8 +517,7 @@ void CVoiceStatus::UpdateServerState(bool bForce) @@ -527,8 +517,7 @@ void CVoiceStatus::UpdateServerState(bool bForce)
}
}
char str[2048];
sprintf(str, "vban");
char str[2048] = "vban";
bool bChange = false;
for(unsigned long dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++)

1
cl_dll/wscript

@ -73,7 +73,6 @@ def build(bld): @@ -73,7 +73,6 @@ def build(bld):
'input_xash3d.cpp',
'menu.cpp',
'message.cpp',
'overview.cpp',
'parsemsg.cpp',
'saytext.cpp',
'scoreboard.cpp',

14
dlls/client.cpp

@ -109,7 +109,10 @@ void ClientDisconnect( edict_t *pEntity ) @@ -109,7 +109,10 @@ void ClientDisconnect( edict_t *pEntity )
char text[256] = "";
if( pEntity->v.netname )
_snprintf( text, sizeof(text), "- %s has left the game\n", STRING( pEntity->v.netname ) );
{
_snprintf( text, sizeof(text) - 1, "- %s has left the game\n", STRING( pEntity->v.netname ) );
text[sizeof(text) - 1] = '\0';
}
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
WRITE_BYTE( ENTINDEX( pEntity ) );
WRITE_STRING( text );
@ -622,8 +625,8 @@ void ClientCommand( edict_t *pEntity ) @@ -622,8 +625,8 @@ void ClientCommand( edict_t *pEntity )
// check the length of the command (prevents crash)
// max total length is 192 ...and we're adding a string below ("Unknown command: %s\n")
strncpy( command, pcmd, 127 );
command[127] = '\0';
strncpy( command, pcmd, sizeof(command) - 1);
command[sizeof(command) - 1] = '\0';
// tell the user they entered an unknown command
ClientPrint( &pEntity->v, HUD_PRINTCONSOLE, UTIL_VarArgs( "Unknown command: %s\n", command ) );
@ -667,7 +670,8 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer ) @@ -667,7 +670,8 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
if( gpGlobals->maxClients > 1 )
{
char text[256];
_snprintf( text, 256, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
_snprintf( text, sizeof(text) - 1, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
text[sizeof(text) - 1] = '\0';
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
WRITE_BYTE( ENTINDEX( pEntity ) );
WRITE_STRING( text );
@ -817,7 +821,7 @@ void StartFrame( void ) @@ -817,7 +821,7 @@ void StartFrame( void )
g_ulFrameCount++;
int oldBhopcap = g_bhopcap;
g_bhopcap = ( g_pGameRules->IsMultiplayer() && bhopcap.value != 0.0f ) ? 1 : 0;
g_bhopcap = ( g_pGameRules && g_pGameRules->IsMultiplayer() && bhopcap.value != 0.0f ) ? 1 : 0;
if( g_bhopcap != oldBhopcap )
{
MESSAGE_BEGIN( MSG_ALL, gmsgBhopcap, NULL );

21
dlls/teamplay_gamerules.cpp

@ -44,7 +44,8 @@ CHalfLifeTeamplay::CHalfLifeTeamplay() @@ -44,7 +44,8 @@ CHalfLifeTeamplay::CHalfLifeTeamplay()
m_szTeamList[0] = 0;
// Cache this because the team code doesn't want to deal with changing this in the middle of a game
strncpy( m_szTeamList, teamlist.string, TEAMPLAY_TEAMLISTLENGTH );
strncpy( m_szTeamList, teamlist.string, TEAMPLAY_TEAMLISTLENGTH - 1 );
m_szTeamList[TEAMPLAY_TEAMLISTLENGTH - 1] = '\0';
edict_t *pWorld = INDEXENT( 0 );
if( pWorld && pWorld->v.team )
@ -54,7 +55,8 @@ CHalfLifeTeamplay::CHalfLifeTeamplay() @@ -54,7 +55,8 @@ CHalfLifeTeamplay::CHalfLifeTeamplay()
const char *pTeamList = STRING( pWorld->v.team );
if( pTeamList && pTeamList[0] != '\0' )
{
strncpy( m_szTeamList, pTeamList, TEAMPLAY_TEAMLISTLENGTH );
strncpy( m_szTeamList, pTeamList, TEAMPLAY_TEAMLISTLENGTH - 1 );
m_szTeamList[TEAMPLAY_TEAMLISTLENGTH - 1] = '\0';
}
}
}
@ -183,7 +185,8 @@ const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer ) @@ -183,7 +185,8 @@ const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer )
{
// copy out the team name from the model
char *mdls = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" );
strncpy( pPlayer->m_szTeamName, mdls, TEAM_NAME_LENGTH );
strncpy( pPlayer->m_szTeamName, mdls, TEAM_NAME_LENGTH - 1 );
pPlayer->m_szTeamName[TEAM_NAME_LENGTH - 1] = '\0';
RecountTeams();
@ -200,7 +203,8 @@ const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer ) @@ -200,7 +203,8 @@ const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer )
{
pTeamName = TeamWithFewestPlayers();
}
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH );
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH - 1 );
pPlayer->m_szTeamName[TEAM_NAME_LENGTH - 1] = '\0';
}
return pPlayer->m_szTeamName;
@ -287,8 +291,10 @@ void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTea @@ -287,8 +291,10 @@ void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTea
// copy out the team name from the model
if( pPlayer->m_szTeamName != pTeamName )
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH );
{
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH - 1 );
pPlayer->m_szTeamName[TEAM_NAME_LENGTH - 1] = '\0';
}
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName );
@ -603,7 +609,8 @@ void CHalfLifeTeamplay::RecountTeams( bool bResendInfo ) @@ -603,7 +609,8 @@ void CHalfLifeTeamplay::RecountTeams( bool bResendInfo )
tm = num_teams;
num_teams++;
team_scores[tm] = 0;
strncpy( team_names[tm], pTeamName, MAX_TEAMNAME_LENGTH );
strncpy( team_names[tm], pTeamName, MAX_TEAMNAME_LENGTH - 1 );
team_names[tm][MAX_TEAMNAME_LENGTH - 1] = '\0';
}
}

3
scripts/waifulib/library_naming.py

@ -99,7 +99,10 @@ def configure(conf): @@ -99,7 +99,10 @@ def configure(conf):
if conf.env.XASH_AMD64:
buildarch = "amd64"
elif conf.env.XASH_X86:
if conf.env.XASH_WIN32 or conf.env.XASH_LINUX or conf.env.XASH_APPLE:
buildarch = ""
else:
buildarch = "i386"
elif conf.env.XASH_ARM and conf.env.XASH_64BIT:
buildarch = "arm64"
elif conf.env.XASH_ARM:

Loading…
Cancel
Save