mirror of https://github.com/FWGS/hlsdk-xash3d
Show which player has flag. Use correct ScoreInfo message size for dmc/3wave.
This commit is contained in:
parent
b85dfbd8ba
commit
4fc0286735
|
@ -231,26 +231,7 @@ int CHudFlagStatus::MsgFunc_FlagCarrier(const char *pszName, int iSize, void *pb
|
|||
|
||||
int index = READ_BYTE();
|
||||
|
||||
bool bRedFlag = false;
|
||||
bool bBlueFlag = false;
|
||||
|
||||
g_PlayerExtraInfo[ index ].iHasFlag = READ_BYTE();
|
||||
|
||||
for ( int i = 1; i < MAX_PLAYERS + 1; i++ )
|
||||
{
|
||||
if ( g_PlayerExtraInfo[ i ].iHasFlag )
|
||||
{
|
||||
if ( g_PlayerExtraInfo[ i ].teamnumber == 1 )
|
||||
bRedFlag = true;
|
||||
else if ( g_PlayerExtraInfo[ i ].teamnumber == 2 )
|
||||
bBlueFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !bRedFlag );
|
||||
//gViewPort->m_pScoreBoard->m_pImages[ 5 ]->setVisible( false );
|
||||
if ( !bBlueFlag );
|
||||
//gViewPort->m_pScoreBoard->m_pImages[ 4 ]->setVisible( false );
|
||||
g_PlayerExtraInfo[index].iHasFlag = READ_BYTE();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -598,6 +598,9 @@ public:
|
|||
int iRedTeamScore;
|
||||
int iBlueTeamScore;
|
||||
|
||||
HSPRITE m_hBlueFlag;
|
||||
HSPRITE m_hRedFlag;
|
||||
|
||||
private:
|
||||
int m_iBlueAtBaseIndex;
|
||||
int m_iBlueFlagIndex;
|
||||
|
@ -615,12 +618,10 @@ private:
|
|||
int m_iRune4Index;
|
||||
int m_iRuneStat;
|
||||
|
||||
HSPRITE m_hBlueFlag;
|
||||
HSPRITE m_hBlueAtBase;
|
||||
HSPRITE m_hBlueLost;
|
||||
HSPRITE m_hBlueStolen;
|
||||
|
||||
HSPRITE m_hRedFlag;
|
||||
HSPRITE m_hRedAtBase;
|
||||
HSPRITE m_hRedLost;
|
||||
HSPRITE m_hRedStolen;
|
||||
|
|
|
@ -427,6 +427,22 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
|
|||
FillRGBA( xpos - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 );
|
||||
}
|
||||
|
||||
if( g_PlayerExtraInfo[best_player].iHasFlag )
|
||||
{
|
||||
HSPRITE hFlag;
|
||||
|
||||
if( g_PlayerExtraInfo[best_player].teamnumber == 1 )
|
||||
{
|
||||
hFlag = gHUD.m_FlagStat.m_hBlueFlag;
|
||||
}
|
||||
else if( g_PlayerExtraInfo[best_player].teamnumber == 2 )
|
||||
{
|
||||
hFlag = gHUD.m_FlagStat.m_hRedFlag;
|
||||
}
|
||||
SPR_Set( hFlag, 255, 255, 255 );
|
||||
SPR_DrawHoles( 1, xpos, ypos + 5, NULL );
|
||||
}
|
||||
|
||||
// draw their name (left to right)
|
||||
DrawUtfString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b );
|
||||
|
||||
|
@ -492,14 +508,14 @@ int CHudScoreboard::MsgFunc_ScoreInfo( const char *pszName, int iSize, void *pbu
|
|||
short cl = READ_BYTE();
|
||||
short frags = READ_SHORT();
|
||||
short deaths = READ_SHORT();
|
||||
short playerclass = READ_SHORT();
|
||||
// short playerclass = READ_SHORT();
|
||||
short teamnumber = READ_SHORT();
|
||||
|
||||
if( cl > 0 && cl <= MAX_PLAYERS )
|
||||
{
|
||||
g_PlayerExtraInfo[cl].frags = frags;
|
||||
g_PlayerExtraInfo[cl].deaths = deaths;
|
||||
g_PlayerExtraInfo[cl].playerclass = playerclass;
|
||||
// g_PlayerExtraInfo[cl].playerclass = playerclass;
|
||||
g_PlayerExtraInfo[cl].teamnumber = teamnumber;
|
||||
|
||||
//gViewPort->UpdateOnPlayerInfo();
|
||||
|
|
|
@ -501,7 +501,6 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl )
|
|||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( 0 );
|
||||
MESSAGE_END();
|
||||
|
||||
SendMOTDToClient( pl->edict() );
|
||||
|
@ -518,7 +517,6 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl )
|
|||
WRITE_BYTE( i ); // client number
|
||||
WRITE_SHORT( (int)plr->pev->frags );
|
||||
WRITE_SHORT( plr->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( GetTeamIndex( plr->m_szTeamName ) + 1 );
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
@ -746,7 +744,6 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
|
|||
WRITE_BYTE( ENTINDEX(pVictim->edict()) );
|
||||
WRITE_SHORT( (int)pVictim->pev->frags );
|
||||
WRITE_SHORT( pVictim->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( GetTeamIndex( pVictim->m_szTeamName ) + 1 );
|
||||
MESSAGE_END();
|
||||
|
||||
|
@ -760,7 +757,6 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
|
|||
WRITE_BYTE( ENTINDEX( PK->edict() ) );
|
||||
WRITE_SHORT( (int)PK->pev->frags );
|
||||
WRITE_SHORT( PK->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( GetTeamIndex( PK->m_szTeamName ) + 1 );
|
||||
MESSAGE_END();
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ void LinkUserMessages( void )
|
|||
gmsgInitHUD = REG_USER_MSG( "InitHUD", -1 ); // called every time a new player joins the server
|
||||
gmsgShowGameTitle = REG_USER_MSG( "GameTitle", 1 );
|
||||
gmsgDeathMsg = REG_USER_MSG( "DeathMsg", -1 );
|
||||
gmsgScoreInfo = REG_USER_MSG( "ScoreInfo", 9 );
|
||||
gmsgScoreInfo = REG_USER_MSG( "ScoreInfo", 7 );
|
||||
gmsgTeamInfo = REG_USER_MSG( "TeamInfo", -1 ); // sets the name of a player's team
|
||||
gmsgTeamScore = REG_USER_MSG( "TeamScore", -1 ); // sets the score of a team on the scoreboard
|
||||
gmsgGameMode = REG_USER_MSG( "GameMode", 1 );
|
||||
|
@ -1406,7 +1406,6 @@ void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore )
|
|||
WRITE_BYTE( ENTINDEX( edict() ) );
|
||||
WRITE_SHORT( (int)pev->frags );
|
||||
WRITE_SHORT( m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( g_pGameRules->GetTeamIndex( m_szTeamName ) + 1 );
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
|
|
@ -313,7 +313,6 @@ void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTea
|
|||
WRITE_BYTE( clientIndex );
|
||||
WRITE_SHORT( (int)pPlayer->pev->frags );
|
||||
WRITE_SHORT( pPlayer->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( g_pGameRules->GetTeamIndex( pPlayer->m_szTeamName ) + 1 );
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue