Browse Source

Show which player has flag. Use correct ScoreInfo message size for dmc/3wave.

dmc
Night Owl 7 years ago
parent
commit
4fc0286735
  1. 29
      cl_dll/3wave/CTF_FlagStatus.cpp
  2. 5
      cl_dll/hud.h
  3. 20
      cl_dll/scoreboard.cpp
  4. 4
      dlls/multiplay_gamerules.cpp
  5. 3
      dlls/player.cpp
  6. 1
      dlls/teamplay_gamerules.cpp

29
cl_dll/3wave/CTF_FlagStatus.cpp

@ -218,39 +218,20 @@ int CHudFlagStatus::MsgFunc_FlagStat(const char *pszName, int iSize, void *pbuf)
int CHudFlagStatus::MsgFunc_RuneStat(const char *pszName, int iSize, void *pbuf) int CHudFlagStatus::MsgFunc_RuneStat(const char *pszName, int iSize, void *pbuf)
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
m_iRuneStat = READ_BYTE(); m_iRuneStat = READ_BYTE();
return 1; return 1;
} }
int CHudFlagStatus::MsgFunc_FlagCarrier(const char *pszName, int iSize, void *pbuf) int CHudFlagStatus::MsgFunc_FlagCarrier(const char *pszName, int iSize, void *pbuf)
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int index = READ_BYTE(); int index = READ_BYTE();
bool bRedFlag = false; g_PlayerExtraInfo[index].iHasFlag = READ_BYTE();
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 );
return 1; return 1;
} }

5
cl_dll/hud.h

@ -598,6 +598,9 @@ public:
int iRedTeamScore; int iRedTeamScore;
int iBlueTeamScore; int iBlueTeamScore;
HSPRITE m_hBlueFlag;
HSPRITE m_hRedFlag;
private: private:
int m_iBlueAtBaseIndex; int m_iBlueAtBaseIndex;
int m_iBlueFlagIndex; int m_iBlueFlagIndex;
@ -615,12 +618,10 @@ private:
int m_iRune4Index; int m_iRune4Index;
int m_iRuneStat; int m_iRuneStat;
HSPRITE m_hBlueFlag;
HSPRITE m_hBlueAtBase; HSPRITE m_hBlueAtBase;
HSPRITE m_hBlueLost; HSPRITE m_hBlueLost;
HSPRITE m_hBlueStolen; HSPRITE m_hBlueStolen;
HSPRITE m_hRedFlag;
HSPRITE m_hRedAtBase; HSPRITE m_hRedAtBase;
HSPRITE m_hRedLost; HSPRITE m_hRedLost;
HSPRITE m_hRedStolen; HSPRITE m_hRedStolen;

20
cl_dll/scoreboard.cpp

@ -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 ); 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) // draw their name (left to right)
DrawUtfString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b ); 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 cl = READ_BYTE();
short frags = READ_SHORT(); short frags = READ_SHORT();
short deaths = READ_SHORT(); short deaths = READ_SHORT();
short playerclass = READ_SHORT(); // short playerclass = READ_SHORT();
short teamnumber = READ_SHORT(); short teamnumber = READ_SHORT();
if( cl > 0 && cl <= MAX_PLAYERS ) if( cl > 0 && cl <= MAX_PLAYERS )
{ {
g_PlayerExtraInfo[cl].frags = frags; g_PlayerExtraInfo[cl].frags = frags;
g_PlayerExtraInfo[cl].deaths = deaths; g_PlayerExtraInfo[cl].deaths = deaths;
g_PlayerExtraInfo[cl].playerclass = playerclass; // g_PlayerExtraInfo[cl].playerclass = playerclass;
g_PlayerExtraInfo[cl].teamnumber = teamnumber; g_PlayerExtraInfo[cl].teamnumber = teamnumber;
//gViewPort->UpdateOnPlayerInfo(); //gViewPort->UpdateOnPlayerInfo();

4
dlls/multiplay_gamerules.cpp

@ -501,7 +501,6 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl )
WRITE_SHORT( 0 ); WRITE_SHORT( 0 );
WRITE_SHORT( 0 ); WRITE_SHORT( 0 );
WRITE_SHORT( 0 ); WRITE_SHORT( 0 );
WRITE_SHORT( 0 );
MESSAGE_END(); MESSAGE_END();
SendMOTDToClient( pl->edict() ); SendMOTDToClient( pl->edict() );
@ -518,7 +517,6 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl )
WRITE_BYTE( i ); // client number WRITE_BYTE( i ); // client number
WRITE_SHORT( (int)plr->pev->frags ); WRITE_SHORT( (int)plr->pev->frags );
WRITE_SHORT( plr->m_iDeaths ); WRITE_SHORT( plr->m_iDeaths );
WRITE_SHORT( 0 );
WRITE_SHORT( GetTeamIndex( plr->m_szTeamName ) + 1 ); WRITE_SHORT( GetTeamIndex( plr->m_szTeamName ) + 1 );
MESSAGE_END(); MESSAGE_END();
} }
@ -746,7 +744,6 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
WRITE_BYTE( ENTINDEX(pVictim->edict()) ); WRITE_BYTE( ENTINDEX(pVictim->edict()) );
WRITE_SHORT( (int)pVictim->pev->frags ); WRITE_SHORT( (int)pVictim->pev->frags );
WRITE_SHORT( pVictim->m_iDeaths ); WRITE_SHORT( pVictim->m_iDeaths );
WRITE_SHORT( 0 );
WRITE_SHORT( GetTeamIndex( pVictim->m_szTeamName ) + 1 ); WRITE_SHORT( GetTeamIndex( pVictim->m_szTeamName ) + 1 );
MESSAGE_END(); MESSAGE_END();
@ -760,7 +757,6 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
WRITE_BYTE( ENTINDEX( PK->edict() ) ); WRITE_BYTE( ENTINDEX( PK->edict() ) );
WRITE_SHORT( (int)PK->pev->frags ); WRITE_SHORT( (int)PK->pev->frags );
WRITE_SHORT( PK->m_iDeaths ); WRITE_SHORT( PK->m_iDeaths );
WRITE_SHORT( 0 );
WRITE_SHORT( GetTeamIndex( PK->m_szTeamName ) + 1 ); WRITE_SHORT( GetTeamIndex( PK->m_szTeamName ) + 1 );
MESSAGE_END(); MESSAGE_END();

3
dlls/player.cpp

@ -236,7 +236,7 @@ void LinkUserMessages( void )
gmsgInitHUD = REG_USER_MSG( "InitHUD", -1 ); // called every time a new player joins the server gmsgInitHUD = REG_USER_MSG( "InitHUD", -1 ); // called every time a new player joins the server
gmsgShowGameTitle = REG_USER_MSG( "GameTitle", 1 ); gmsgShowGameTitle = REG_USER_MSG( "GameTitle", 1 );
gmsgDeathMsg = REG_USER_MSG( "DeathMsg", -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 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 gmsgTeamScore = REG_USER_MSG( "TeamScore", -1 ); // sets the score of a team on the scoreboard
gmsgGameMode = REG_USER_MSG( "GameMode", 1 ); gmsgGameMode = REG_USER_MSG( "GameMode", 1 );
@ -1406,7 +1406,6 @@ void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore )
WRITE_BYTE( ENTINDEX( edict() ) ); WRITE_BYTE( ENTINDEX( edict() ) );
WRITE_SHORT( (int)pev->frags ); WRITE_SHORT( (int)pev->frags );
WRITE_SHORT( m_iDeaths ); WRITE_SHORT( m_iDeaths );
WRITE_SHORT( 0 );
WRITE_SHORT( g_pGameRules->GetTeamIndex( m_szTeamName ) + 1 ); WRITE_SHORT( g_pGameRules->GetTeamIndex( m_szTeamName ) + 1 );
MESSAGE_END(); MESSAGE_END();
} }

1
dlls/teamplay_gamerules.cpp

@ -313,7 +313,6 @@ void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTea
WRITE_BYTE( clientIndex ); WRITE_BYTE( clientIndex );
WRITE_SHORT( (int)pPlayer->pev->frags ); WRITE_SHORT( (int)pPlayer->pev->frags );
WRITE_SHORT( pPlayer->m_iDeaths ); WRITE_SHORT( pPlayer->m_iDeaths );
WRITE_SHORT( 0 );
WRITE_SHORT( g_pGameRules->GetTeamIndex( pPlayer->m_szTeamName ) + 1 ); WRITE_SHORT( g_pGameRules->GetTeamIndex( pPlayer->m_szTeamName ) + 1 );
MESSAGE_END(); MESSAGE_END();
} }

Loading…
Cancel
Save