o Added a new scoreboard column 'Info'

- In combat mode this displays the player level
- In classic mode for marines it displays an icon for the player's primary weapon
- In classic mode for aliens it displays the player's resources.
o reduced the frequency of scoreboard updates from 0.4 seconds to 0.6 seconds.


git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@391 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
puzl 2006-04-16 12:47:09 +00:00
parent e653265899
commit 59a9a610b1
14 changed files with 111 additions and 13 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -228,10 +228,10 @@ struct extra_player_info_t
short score;
short lastScore;
float timeOfLastScoreChange;
short frags;
short deaths;
short playerclass;
short extra;
short auth;
short teamnumber;
char teamname[MAX_TEAM_NAME];

View file

@ -75,6 +75,7 @@
#include "..\game_shared\vgui_loadtga.h"
#include "mod/AvHConstants.h"
#include "mod/AvHTitles.h"
#include "mod/AvHBasePlayerWeaponConstants.h"
#include "vgui_SpectatorPanel.h"
#include "cl_dll/demo.h"
#include "mod/AvHServerVariables.h"
@ -144,9 +145,10 @@ SBColumnInfo g_ColumnInfo[NUM_COLUMNS] =
{
{NULL, 24, Label::a_east}, // tracker column
{NULL, 24, Label::a_east}, // status icons
{NULL, 150, Label::a_east}, // name
{NULL, 110, Label::a_east}, // name
{NULL, 56, Label::a_east}, // class
{"#SCORE", 40, Label::a_east}, // score
{"#EXTRA", 40, Label::a_east}, // resources
{"#KILLS", 40, Label::a_east}, // kills
{"#DEATHS", 40, Label::a_east}, // deaths
{"#LATENCY", 40, Label::a_east}, // ping
@ -206,6 +208,12 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
m_pCheatingDeathIcon = NULL;
m_pVeteranIcon = NULL;
m_pHMG = NULL;
m_pLMG = NULL;
m_pGL = NULL;
m_pSG = NULL;
m_pTrackerIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardtracker.tga");
m_pDevIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboarddev.tga");
m_pPTIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardpt.tga");
@ -215,6 +223,13 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
m_pCheatingDeathIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcd.tga");
m_pVeteranIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardveteran.tga");
m_pHMG = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardhmg.tga");
m_pLMG = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardlmg.tga");
m_pGL = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardgl.tga");
m_pSG = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardsg.tga");
m_iIconFrame = 0;
m_iLastFrameIncrementTime = gHUD.GetTimeOfLastUpdate();
@ -896,6 +911,7 @@ void ScorePanel::FillGrid()
case COLUMN_SCORE:
case COLUMN_KILLS:
case COLUMN_EXTRA:
case COLUMN_DEATHS:
case COLUMN_LATENCY:
default:
@ -950,6 +966,8 @@ void ScorePanel::FillGrid()
// Don't show score for enemies unless spectating or in RR
if ((m_iIsATeam[row] == TEAM_YES) && team_info && ((theLocalPlayerTeam == 0) || (theLocalPlayerTeam == team_info->teamnumber)))
sprintf(sz, "%d", team_info->score);
break;
case COLUMN_EXTRA:
break;
case COLUMN_KILLS:
if ((m_iIsATeam[row] == TEAM_YES) && team_info)
@ -1202,6 +1220,40 @@ void ScorePanel::FillGrid()
}
break;
case COLUMN_EXTRA:
if(!theIsForEnemy && theExtraPlayerInfo->teamnumber != TEAM_IND && theExtraPlayerInfo->teamnumber != TEAM_SPECT )
{
if ( gHUD.GetIsMarine() && !gHUD.GetIsCombatMode() ) {
switch(theExtraPlayerInfo->extra) {
case AVH_WEAPON_HMG:
pLabel->setFgColorAsImageColor(false);
pLabel->setImage(m_pHMG);
m_pHMG->setColor(BuildColor(248, 252, 0, gHUD.GetGammaSlope()));
break;
case AVH_WEAPON_MG:
pLabel->setFgColorAsImageColor(false);
pLabel->setImage(m_pLMG);
m_pLMG->setColor(BuildColor(208, 16, 190, gHUD.GetGammaSlope()));
break;
case AVH_WEAPON_SONIC:
pLabel->setFgColorAsImageColor(false);
pLabel->setImage(m_pSG);
m_pSG->setColor(BuildColor(117, 214, 241, gHUD.GetGammaSlope()));
break;
case AVH_WEAPON_GRENADE_GUN:
pLabel->setFgColorAsImageColor(false);
pLabel->setImage(m_pGL);
m_pGL->setColor(BuildColor(255, 69, 9, gHUD.GetGammaSlope()));
break;
default:
break;
}
}
else {
sprintf(sz, "%d", theExtraPlayerInfo->extra);
}
}
break;
case COLUMN_KILLS:
sprintf(sz, "%d", theExtraPlayerInfo->frags);
break;

View file

@ -21,12 +21,13 @@
#define COLUMN_NAME 2
#define COLUMN_CLASS 3
#define COLUMN_SCORE 4
#define COLUMN_KILLS 5
#define COLUMN_DEATHS 6
#define COLUMN_LATENCY 7
#define COLUMN_VOICE 8
#define COLUMN_BLANK 9
#define NUM_COLUMNS 10
#define COLUMN_EXTRA 5
#define COLUMN_KILLS 6
#define COLUMN_DEATHS 7
#define COLUMN_LATENCY 8
#define COLUMN_VOICE 9
#define COLUMN_BLANK 10
#define NUM_COLUMNS 11
#define NUM_ROWS (MAX_PLAYERS + (MAX_SCOREBOARD_TEAMS * 2))
using namespace vgui;
@ -86,6 +87,12 @@ private:
vgui::BitmapTGA *m_pContribIcon;
vgui::BitmapTGA *m_pCheatingDeathIcon;
vgui::BitmapTGA *m_pVeteranIcon;
vgui::BitmapTGA *m_pHMG;
vgui::BitmapTGA *m_pLMG;
vgui::BitmapTGA *m_pGL;
vgui::BitmapTGA *m_pSG;
vector< pair <vgui::BitmapTGA *, string> > m_CustomIconList;
unsigned int m_iIconFrame;

View file

@ -2557,6 +2557,7 @@ int TeamFortressViewport::MsgFunc_ScoreInfo( const char *pszName, int iSize, voi
// Update other info
g_PlayerExtraInfo[info.player_index].frags = info.frags;
g_PlayerExtraInfo[info.player_index].deaths = info.deaths;
g_PlayerExtraInfo[info.player_index].extra = info.extra;
g_PlayerExtraInfo[info.player_index].playerclass = info.player_class;
// puzl: 0001073
g_PlayerExtraInfo[info.player_index].auth = info.auth;

View file

@ -3838,7 +3838,9 @@ int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem )
CBasePlayerItem *pInsert;
pInsert = m_rgpPlayerItems[pItem->iItemSlot()];
if ( pItem->iItemSlot() == 1 ) {
this->EffectivePlayerClassChanged();
}
while (pInsert)
{
if (FClassnameIs( pInsert->pev, STRING( pItem->pev->classname) ))

View file

@ -44,7 +44,8 @@ bool AvHPlayer::GiveCombatModeUpgrade(AvHMessageID inMessageID, bool inInstantan
ASSERT(theCreatedItem);
if((inMessageID == BUILD_JETPACK) || (inMessageID == BUILD_HEAVY))
if((inMessageID == BUILD_JETPACK) || (inMessageID == BUILD_HEAVY) || (inMessageID == BUILD_HMG) ||
(inMessageID == BUILD_SHOTGUN) || (inMessageID == BUILD_GRENADE_GUN))
{
theEffectivePlayerClassChanged = true;
}
@ -216,6 +217,8 @@ void AvHPlayer::SetExperience(float inExperience)
int theIsMarine = this->GetIsMarine();
PLAYBACK_EVENT_FULL(0, this->edict(), gLevelUpEventID, 0, this->pev->origin, (float *)&g_vecZero, 0.0, 0.0, theIsMarine, 0, 0, 0 );
this->EffectivePlayerClassChanged();
// Give player health and armor back on level-up, to allow more soloing, heroics, and reduce dependence on hives/resupply
AvHUser3 theUser3 = AvHUser3(this->pev->iuser3);
float theMaxHealth = AvHPlayerUpgrade::GetMaxHealth(this->pev->iuser4, theUser3, theCurrentLevel);

View file

@ -485,6 +485,7 @@ void Net_InitializeMessages(void)
info.score = READ_SHORT();
info.frags = READ_SHORT();
info.deaths = READ_SHORT();
info.extra = READ_SHORT();
info.player_class = READ_BYTE();
info.auth = READ_SHORT();
info.team = READ_SHORT();
@ -513,6 +514,7 @@ void Net_InitializeMessages(void)
WRITE_SHORT( info.score );
WRITE_SHORT( info.frags );
WRITE_SHORT( info.deaths );
WRITE_SHORT( info.extra );
WRITE_BYTE( info.player_class );
WRITE_SHORT( info.auth );
WRITE_SHORT( info.team );

View file

@ -970,6 +970,8 @@ bool AvHPlayer::DropItem(const char* inItemName)
if(theOriginalDroppedWeapon->GetItemInfo(&theItemInfo) != 0)
{
int iAmmoIndex = GetAmmoIndex ( (char *) theItemInfo.pszAmmo1 );
if ( theItemInfo.iSlot == 0 )
this->EffectivePlayerClassChanged();
if ( iAmmoIndex != -1 && m_rgAmmo[ iAmmoIndex ] > 0)
this->DropAmmo((char *)theItemInfo.pszAmmo1, m_rgAmmo[ iAmmoIndex ], theItemInfo.iMaxAmmo1, theItemInfo.iId, theNewlyDroppedWeapon->pev->angles);
@ -7952,6 +7954,8 @@ void AvHPlayer::SetResources(float inResources, bool inPlaySound)
{
this->PlayHUDSound(HUD_SOUND_ALIEN_POINTS_RECEIVED);
}
if ( this->mResources != inResources )
this->EffectivePlayerClassChanged();
this->mResources = inResources;
}
@ -9215,7 +9219,7 @@ void AvHPlayer::UpdateClientData( void )
void AvHPlayer::UpdateEffectiveClassAndTeam()
{
// Don't send too many messages when these get updated really quickly. Too many messages are being sent on a game reset, and it's not needed. We only need the most recent message.
const float kClassAndTeamUpdateRate = .4f;
const float kClassAndTeamUpdateRate = .6f;
if((this->mTimeOfLastClassAndTeamUpdate == -1) || (gpGlobals->time > (this->mTimeOfLastClassAndTeamUpdate + kClassAndTeamUpdateRate)))
{
if(this->mEffectivePlayerClassChanged)
@ -9236,6 +9240,27 @@ void AvHPlayer::UpdateEffectiveClassAndTeam()
info.player_class = this->GetEffectivePlayerClass();
info.auth = this->GetAuthenticationMask();
info.team = GetGameRules()->GetTeamIndex(this->TeamID());
if ( GetGameRules()->GetIsCombatMode()) {
info.extra=this->GetExperienceLevel();
}
else {
if ( this->GetIsAlien() ) {
info.extra=(int)this->GetResources();
}
else {
info.extra=0;
if ( this->m_rgpPlayerItems ) {
CBasePlayerWeapon* thePrimaryWeapon = (CBasePlayerWeapon *)this->m_rgpPlayerItems[1];
if ( thePrimaryWeapon ) {
ItemInfo ii;
thePrimaryWeapon->GetItemInfo(&ii);
info.extra=ii.iId;
}
}
}
}
NetMsg_ScoreInfo( info );
this->mEffectivePlayerClassChanged = false;
}

View file

@ -58,6 +58,7 @@ typedef struct ScoreInfo_s
int player_index;
int score;
int frags;
int extra;
int deaths;
int player_class;
int auth;

View file

@ -371,6 +371,11 @@ KILLS
Kills
}
EXTRA
{
Info
}
DEATHS
{
Deaths