GameInformation::GameInformation(GmkFile* gmk) : GmkResource(gmk), backgroundColor(BuildColor(255, 255, 225)), showInSeperateWindow(true), caption("Game Information"), left(-1), top(-1), width(600), height(400), showBorder(true), sizeable(true), alwaysOnTop(false), freeze(true), information("{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033" "{\\fonttbl{\\f0\\fnil Arial;}}{\\colortbl ;\\red0\\green0\\blue0;}" "\\viewkind4\\uc1\\pard\\cf1\\f0\\fs24}") { exists = true; }
void CD3DBillBoardParticleEmitter::BuildParticle(CD3DParticleEmitterResource::PARTICLE_EMITTER_INFO * pParticleEmitterInfo,CD3DParticleEmitterResource::PARTICLE_PARAM * pParam) { CD3DVector3 Dir(0.0f,1.0f,0.0f); FLOAT RotationX=0; FLOAT RotationZ=0; CD3DVector3 StartPos; if(pParticleEmitterInfo->EmitterType==CD3DParticleEmitterResource::EMITTER_PLANE) { if((pParticleEmitterInfo->Flags&CD3DParticleEmitterResource::PED_DIR_NO_HORIZONTAL_TRANS)==0) { RotationX=GetRandf(0.0f,pParam->HorizontalRange)-pParam->HorizontalRange/2; } //if(pParticleEmitterInfo->Flags&PEF_DIR_VERTICAL_TRANS) { RotationZ=GetRandf(0.0f,pParam->VerticalRange)-pParam->VerticalRange/2; } if(RotationX!=0.0f||RotationZ!=0.0f) { Dir=Dir*CD3DMatrix::FromRotationX(RotationX)*CD3DMatrix::FromRotationZ(RotationZ); Dir.Normalize(); } StartPos.x=GetRandf(-pParam->EmissionAreaLength/2,pParam->EmissionAreaLength/2); StartPos.y=0; StartPos.z=GetRandf(-pParam->EmissionAreaWidth/2,pParam->EmissionAreaWidth/2); } else { RotationX=GetRandf(0.0f,pParam->HorizontalRange)-pParam->HorizontalRange/2; RotationZ=GetRandf(0.0f,pParam->VerticalRange)-pParam->VerticalRange/2; Dir=Dir*CD3DMatrix::FromRotationX(RotationX)*CD3DMatrix::FromRotationZ(RotationZ); Dir.Normalize(); FLOAT S=GetRandf(0.0f,1.0f); FLOAT Radius1=pParam->EmissionAreaWidth*S; FLOAT Radius2=pParam->EmissionAreaLength*S; FLOAT Angle=GetRandf(0.0f,D3DX_PI*2); StartPos.y=GetRandf(-Radius2,Radius2); if(Radius2>0) { Radius1=sqrt((1.0f-(StartPos.y*StartPos.y)/(Radius2*Radius2))*(Radius1*Radius1)); } StartPos.x=Radius1*cos(Angle); StartPos.z=Radius1*sin(Angle); } m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Position=StartPos; m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Life=0.0f; m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Direction=Dir; m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.MaxLife=pParam->LifeSpan; m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Speed=pParam->Speed; if(pParticleEmitterInfo->Flags&CD3DParticleEmitterResource::PEF_HAVE_SPEED_VARIATION) { m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.SpeedVariation=pParam->SpeedVariation; } else { m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.SpeedVariation=0; } m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Gravity=pParam->Gravity; m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Decelerate=pParam->Decelerate; m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Slowdown=pParticleEmitterInfo->Slowdown; m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.ParticleRotation= GetRandf(-pParticleEmitterInfo->Rotation*D3DX_PI,pParticleEmitterInfo->Rotation*D3DX_PI); //m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.ColorLifeMid=pParticleEmitterInfo->ParticleColor.TimeStamps[1]; //m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.OpacityLifeMid=pParticleEmitterInfo->ParticleOpacity.TimeStamps[1]; // m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.SizeLifeMid=pParticleEmitterInfo->ParticleSizes.TimeStamps[1]; BuildColor(pParticleEmitterInfo->ParticleColor,pParticleEmitterInfo->ParticleOpacity, m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.ColorStart, m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.ColorMid, m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.ColorEnd, m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.ColorLifeMid, m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.OpacityLifeMid); //m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.ColorStart= // D3DCOLOR_RGBA( // (DWORD)pParticleEmitterInfo->ParticleColor.Keys[0].x, // (DWORD)pParticleEmitterInfo->ParticleColor.Keys[0].y, // (DWORD)pParticleEmitterInfo->ParticleColor.Keys[0].z, // (DWORD)(pParticleEmitterInfo->ParticleOpacity.Keys[0]*255) // ); //m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.ColorMid= // D3DCOLOR_RGBA( // (DWORD)pParticleEmitterInfo->ParticleColor.Keys[1].x, // (DWORD)pParticleEmitterInfo->ParticleColor.Keys[1].y, // (DWORD)pParticleEmitterInfo->ParticleColor.Keys[1].z, // (DWORD)(pParticleEmitterInfo->ParticleOpacity.Keys[1]*255) // ); //m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.ColorEnd= // D3DCOLOR_RGBA( // (DWORD)pParticleEmitterInfo->ParticleColor.Keys[2].x, // (DWORD)pParticleEmitterInfo->ParticleColor.Keys[2].y, // (DWORD)pParticleEmitterInfo->ParticleColor.Keys[2].z, // (DWORD)(pParticleEmitterInfo->ParticleOpacity.Keys[2]*255) // ); BuildSize(pParticleEmitterInfo->ParticleSizes, m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.SizeStart, m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.SizeMid, m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.SizeEnd, m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.SizeLifeMid); //m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.SizeStart=pParticleEmitterInfo->ParticleSizes.Keys[0]; //m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.SizeMid=pParticleEmitterInfo->ParticleSizes.Keys[1]; //m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.SizeEnd=pParticleEmitterInfo->ParticleSizes.Keys[2]; m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.TexColRow=pParticleEmitterInfo->TextureRows*100.0f+pParticleEmitterInfo->TextureCols; if(m_NoTrail) { m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Translation=0.0f; m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Rotation.SetIdentity(); m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Scaling=1.0f; } else { m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Translation=GetWorldMatrix().GetTranslation(); m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Rotation=GetWorldMatrix().GetRotationOnQuaternion(); m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info.Scaling=GetWorldMatrix().GetScale(); } m_pParticleVertexBuffer[m_ParticleCount].Vertex[1].Info=m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info; m_pParticleVertexBuffer[m_ParticleCount].Vertex[2].Info=m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info; m_pParticleVertexBuffer[m_ParticleCount].Vertex[3].Info=m_pParticleVertexBuffer[m_ParticleCount].Vertex[0].Info; m_ParticleCount++; }
void ScorePanel::FillGrid() { CSchemeManager *pSchemes = gViewPort->GetSchemeManager(); SchemeHandle_t hScheme = pSchemes->getSchemeHandle("Scoreboard Text"); SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text"); SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text"); SchemeHandle_t hTinyScheme = pSchemes->getSchemeHandle("Scoreboard Tiny Text"); Font *sfont = pSchemes->getFont(hScheme); Font *tfont = pSchemes->getFont(hTitleScheme); Font *smallfont = pSchemes->getFont(hSmallScheme); Font *tinyfont = pSchemes->getFont(hTinyScheme); // update highlight position int x, y; getApp()->getCursorPos(x, y); cursorMoved(x, y, this); // remove highlight row if we're not in squelch mode if (!GetClientVoiceMgr()->IsInSquelchMode()) { m_iHighlightRow = -1; } bool bNextRowIsGap = false; for(int row=0; row < NUM_ROWS; row++) { CGrid *pGridRow = &m_PlayerGrids[row]; pGridRow->SetRowUnderline(0, false, 0, 0, 0, 0, 0); if(row >= m_iRows) { for(int col=0; col < NUM_COLUMNS; col++) m_PlayerEntries[col][row].setVisible(false); continue; } bool bRowIsGap = false; if (bNextRowIsGap) { bNextRowIsGap = false; bRowIsGap = true; } // Get the player's data int theSortedRow = m_iSortedRows[row]; hud_player_info_t* pl_info = &g_PlayerInfoList[theSortedRow]; extra_player_info_t* theExtraPlayerInfo = &g_PlayerExtraInfo[theSortedRow]; int thePlayerClass = theExtraPlayerInfo->playerclass; short theTeamNumber = theExtraPlayerInfo->teamnumber; string theCustomIcon = (string)theExtraPlayerInfo->customicon; // puzl: 0001073 short thePlayerAuthentication = theExtraPlayerInfo->auth; bool thePlayerIsDead = false; switch( thePlayerClass ) { case PLAYERCLASS_DEAD_MARINE: case PLAYERCLASS_DEAD_ALIEN: case PLAYERCLASS_REINFORCING: thePlayerIsDead = true; break; } // Code to test DEBUG #if 0 #ifdef DEBUG extern int gGlobalDebugAuth; thePlayerAuthentication = 1; thePlayerAuthentication <<= gGlobalDebugAuth; #endif #endif team_info_t* team_info = &g_TeamInfo[m_iSortedRows[row]]; int theColorIndex = theTeamNumber % iNumberOfTeamColors; int theLocalPlayerTeam = 0; if(gEngfuncs.GetLocalPlayer()) { theLocalPlayerTeam = gEngfuncs.GetLocalPlayer()->curstate.team; } for(int col=0; col < NUM_COLUMNS; col++) { CLabelHeader *pLabel = &m_PlayerEntries[col][row]; pLabel->setVisible(true); pLabel->setText2(""); pLabel->setImage(NULL); pLabel->setFont(sfont); pLabel->setTextOffset(0, 0); int rowheight = 13; if (ScreenHeight() > 480) { rowheight = YRES(rowheight); } else { // more tweaking, make sure icons fit at low res rowheight = 15; } pLabel->setSize(pLabel->getWide(), rowheight); pLabel->setBgColor(0, 0, 0, 255); char sz[128]; Color gammaAdjustedTeamColor = BuildColor(kTeamColors[theColorIndex][0], kTeamColors[theColorIndex][1], kTeamColors[theColorIndex][2], gHUD.GetGammaSlope()); pLabel->setFgColor(gammaAdjustedTeamColor[0], gammaAdjustedTeamColor[1], gammaAdjustedTeamColor[2], 0); if (m_iIsATeam[row] == TEAM_BLANK) { pLabel->setText(" "); continue; } else if ( m_iIsATeam[row] == TEAM_YES ) { theColorIndex = team_info->teamnumber % iNumberOfTeamColors; // team color text for team names // different height for team header rows rowheight = 20; if (ScreenHeight() >= 480) { rowheight = YRES(rowheight); } pLabel->setSize(pLabel->getWide(), rowheight); pLabel->setFont(tfont); pGridRow->SetRowUnderline( 0, true, YRES(3), gammaAdjustedTeamColor[0], gammaAdjustedTeamColor[1], gammaAdjustedTeamColor[2], 0 ); } else if ( m_iIsATeam[row] == TEAM_SPECTATORS ) { // grey text for spectators pLabel->setFgColor(100, 100, 100, 0); // different height for team header rows rowheight = 20; if (ScreenHeight() >= 480) { rowheight = YRES(rowheight); } pLabel->setSize(pLabel->getWide(), rowheight); pLabel->setFont(tfont); pGridRow->SetRowUnderline(0, true, YRES(3), 100, 100, 100, 0); } else { if(thePlayerIsDead) { pLabel->setFgColor(255, 0, 0, 0); } else { // team color text for player names pLabel->setFgColor(gammaAdjustedTeamColor[0], gammaAdjustedTeamColor[1], gammaAdjustedTeamColor[2], 0); } // Set background color if ( pl_info && pl_info->thisplayer ) // if it is their name, draw it a different color { // Highlight this player pLabel->setFgColor(Scheme::sc_white); pLabel->setBgColor(gammaAdjustedTeamColor[0], gammaAdjustedTeamColor[1], gammaAdjustedTeamColor[2], 196 ); } else if ( theSortedRow == m_iLastKilledBy && m_fLastKillTime && m_fLastKillTime > gHUD.m_flTime ) { // Killer's name pLabel->setBgColor( 255,0,0, 255 - ((float)15 * (float)(m_fLastKillTime - gHUD.m_flTime)) ); } } // Align switch(col) { case COLUMN_NAME: case COLUMN_CLASS: pLabel->setContentAlignment( vgui::Label::a_west ); break; case COLUMN_TRACKER: case COLUMN_RANK_ICON: case COLUMN_VOICE: pLabel->setContentAlignment( vgui::Label::a_center ); break; case COLUMN_SCORE: case COLUMN_KILLS: case COLUMN_DEATHS: case COLUMN_LATENCY: default: pLabel->setContentAlignment( vgui::Label::a_east ); break; } // Fill out with the correct data strcpy(sz, ""); if ( m_iIsATeam[row] ) { char sz2[128]; switch (col) { case COLUMN_NAME: if ( m_iIsATeam[row] == TEAM_SPECTATORS ) { sprintf( sz2, CHudTextMessage::BufferedLocaliseTextString( "#Spectators" ) ); } else { if(team_info) { sprintf( sz2, gViewPort->GetTeamName(team_info->teamnumber) ); } } strcpy(sz, sz2); // Append the number of players if ( m_iIsATeam[row] == TEAM_YES && team_info) { if (team_info->players == 1) { sprintf(sz2, "(%d %s)", team_info->players, CHudTextMessage::BufferedLocaliseTextString( "#Player" ) ); } else { sprintf(sz2, "(%d %s)", team_info->players, CHudTextMessage::BufferedLocaliseTextString( "#Player_plural" ) ); } pLabel->setText2(sz2); pLabel->setFont2(smallfont); } break; case COLUMN_VOICE: break; case COLUMN_CLASS: break; case COLUMN_SCORE: // 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_KILLS: if ((m_iIsATeam[row] == TEAM_YES) && team_info) sprintf(sz, "%d", team_info->frags ); break; case COLUMN_DEATHS: if ((m_iIsATeam[row] == TEAM_YES) && team_info) sprintf(sz, "%d", team_info->deaths ); break; case COLUMN_LATENCY: if ((m_iIsATeam[row] == TEAM_YES) && team_info) sprintf(sz, "%d", team_info->ping ); break; default: break; } } else { // Are these stats for an enemy? Score and other stats shouldn't be drawn for enemies. bool theIsForEnemy = false; int theLocalPlayerTeam = 0; if(gEngfuncs.GetLocalPlayer()) { theLocalPlayerTeam = gEngfuncs.GetLocalPlayer()->curstate.team; } if((theLocalPlayerTeam != 0) && (theExtraPlayerInfo->teamnumber != theLocalPlayerTeam)) { theIsForEnemy = true; } switch (col) { case COLUMN_NAME: if (g_pTrackerUser) { int playerSlot = m_iSortedRows[row]; int trackerID = gEngfuncs.GetTrackerIDForPlayer(playerSlot); const char *trackerName = g_pTrackerUser->GetUserName(trackerID); if (trackerName && *trackerName) { sprintf(sz, " (%s)", trackerName); pLabel->setText2(sz); } } if(pl_info) { sprintf(sz, "%s ", pl_info->name); } break; case COLUMN_VOICE: sz[0] = 0; // in HLTV mode allow spectator to turn on/off commentator voice if (pl_info && (!pl_info->thisplayer || gEngfuncs.IsSpectateOnly())) { GetClientVoiceMgr()->UpdateSpeakerImage(pLabel, theSortedRow); } break; case COLUMN_CLASS: // No class for other team's members (unless allied or spectator, and make sure player is on our team) strcpy(sz, ""); if(team_info && ((theLocalPlayerTeam == theTeamNumber) || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER))) { switch(thePlayerClass) { case (int)(PLAYERCLASS_DEAD_MARINE): case (int)(PLAYERCLASS_DEAD_ALIEN): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassDead)); break; case (int)(PLAYERCLASS_REINFORCING): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassReinforcing)); break; case (int)(PLAYERCLASS_REINFORCINGCOMPLETE): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassReinforcingComplete)); break; case (int)(PLAYERCLASS_ALIVE_JETPACK_MARINE): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassJetpackMarine)); break; case (int)(PLAYERCLASS_ALIVE_HEAVY_MARINE): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassHeavyMarine)); break; case (int)(PLAYERCLASS_COMMANDER): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassCommander)); break; case (int)(PLAYERCLASS_ALIVE_LEVEL1): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassLevel1)); break; case (int)(PLAYERCLASS_ALIVE_LEVEL2): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassLevel2)); break; case (int)(PLAYERCLASS_ALIVE_LEVEL3): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassLevel3)); break; case (int)(PLAYERCLASS_ALIVE_LEVEL4): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassLevel4)); break; case (int)(PLAYERCLASS_ALIVE_LEVEL5): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassLevel5)); break; case (int)(PLAYERCLASS_ALIVE_DIGESTING): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassDigesting)); break; case (int)(PLAYERCLASS_ALIVE_GESTATING): sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassGestating)); break; default: break; } } break; case COLUMN_RANK_ICON: // puzl: 0001073 #ifdef USE_OLDAUTH // Check if we have authority. Right now these override the tracker icons. Listed in increasing order of "importance". if(thePlayerAuthentication & PLAYERAUTH_CHEATINGDEATH) { // Red pLabel->setImage(m_pCheatingDeathIcon); pLabel->setFgColorAsImageColor(false); m_pCheatingDeathIcon->setColor(BuildColor(255, 69, 9, gHUD.GetGammaSlope())); } if(thePlayerAuthentication & PLAYERAUTH_VETERAN) { // Yellow pLabel->setImage(m_pVeteranIcon); pLabel->setFgColorAsImageColor(false); m_pVeteranIcon->setColor(BuildColor(248, 252, 0, gHUD.GetGammaSlope())); } if(thePlayerAuthentication & PLAYERAUTH_BETASERVEROP) { // Whitish pLabel->setImage(m_pServerOpIcon); pLabel->setFgColorAsImageColor(false); m_pServerOpIcon->setColor(BuildColor(220, 220, 220, gHUD.GetGammaSlope())); } if(thePlayerAuthentication & PLAYERAUTH_CONTRIBUTOR) { // Light blue pLabel->setImage(m_pContribIcon); pLabel->setFgColorAsImageColor(false); m_pContribIcon->setColor(BuildColor(117, 214, 241, gHUD.GetGammaSlope())); } if(thePlayerAuthentication & PLAYERAUTH_GUIDE) { // Magenta pLabel->setImage(m_pGuideIcon); pLabel->setFgColorAsImageColor(false); m_pGuideIcon->setColor(BuildColor(208, 16, 190, gHUD.GetGammaSlope())); } if(thePlayerAuthentication & PLAYERAUTH_PLAYTESTER) { // Orange pLabel->setImage(m_pPTIcon); pLabel->setFgColorAsImageColor(false); m_pPTIcon->setColor(BuildColor(255, 167, 54, gHUD.GetGammaSlope())); } if(thePlayerAuthentication & PLAYERAUTH_DEVELOPER) { // TSA blue pLabel->setImage(m_pDevIcon); pLabel->setFgColorAsImageColor(false); m_pDevIcon->setColor(BuildColor(100, 215, 255, gHUD.GetGammaSlope())); } if(thePlayerAuthentication & PLAYERAUTH_SERVEROP) { // Bright green pLabel->setImage(m_pServerOpIcon); pLabel->setFgColorAsImageColor(false); m_pServerOpIcon->setColor(BuildColor(0, 255, 0, gHUD.GetGammaSlope())); } // Allow custom icons to override other general icons if(thePlayerAuthentication & PLAYERAUTH_CUSTOM) { if(theCustomIcon != "") { string theIconName = theCustomIcon.substr(0, strlen(theCustomIcon.c_str()) - 3); string theFullCustomIconString = string("gfx/vgui/640_") + theIconName + string(".tga"); vgui::BitmapTGA *pIcon = GetIconPointer(theCustomIcon); //Icon hasnt been loaded, load it now and add it to list of icons. if(pIcon == NULL) { pIcon = vgui_LoadTGANoInvertAlpha(theFullCustomIconString.c_str()); if(pIcon) m_CustomIconList.push_back( make_pair(pIcon, theCustomIcon) ); } if(pIcon) { pLabel->setImage(pIcon); pLabel->setFgColorAsImageColor(false); // Parse color (last 3 bytes are the RGB values 1-9) string theColor = theCustomIcon.substr( strlen(theCustomIcon.c_str())-3, 3); int theRed = (MakeIntFromString(theColor.substr(0, 1))/9.0f)*255; int theGreen = (MakeIntFromString(theColor.substr(1, 1))/9.0f)*255; int theBlue = (MakeIntFromString(theColor.substr(2, 1))/9.0f)*255; pIcon->setColor(BuildColor(theRed, theGreen, theBlue, gHUD.GetGammaSlope())); } } } if(g_pTrackerUser) { int playerSlot = theSortedRow; int trackerID = gEngfuncs.GetTrackerIDForPlayer(playerSlot); if (g_pTrackerUser->IsFriend(trackerID) && trackerID != g_pTrackerUser->GetTrackerID()) { pLabel->setImage(m_pTrackerIcon); pLabel->setFgColorAsImageColor(false); m_pTrackerIcon->setColor(Color(255, 255, 255, 0)); } } #else if( theExtraPlayerInfo->icon ) { vgui::Bitmap* image = theExtraPlayerInfo->icon->getImage( this->GetIconFrame() ); if( image ) { pLabel->setImage( image ); } } #endif break; case COLUMN_SCORE: if(!theIsForEnemy) { const float kDeltaDisplayTime = 3.0f; float theTimeSinceChange = gHUD.GetTimeOfLastUpdate() - theExtraPlayerInfo->timeOfLastScoreChange; if((theExtraPlayerInfo->score > theExtraPlayerInfo->lastScore) && (theTimeSinceChange > 0) && (theTimeSinceChange < kDeltaDisplayTime) && (theExtraPlayerInfo->teamnumber != 0)) { // draw score with change int theDelta = (theExtraPlayerInfo->score - theExtraPlayerInfo->lastScore); sprintf(sz, "(+%d) %d", theDelta, theExtraPlayerInfo->score); } else { sprintf(sz, "%d", theExtraPlayerInfo->score); } } break; case COLUMN_KILLS: sprintf(sz, "%d", theExtraPlayerInfo->frags); break; case COLUMN_DEATHS: sprintf(sz, "%d", theExtraPlayerInfo->deaths); break; case COLUMN_LATENCY: if(pl_info) { sprintf(sz, "%d", pl_info->ping ); } break; default: break; } } pLabel->setText(sz); } } for(row=0; row < NUM_ROWS; row++) { CGrid *pGridRow = &m_PlayerGrids[row]; pGridRow->AutoSetRowHeights(); pGridRow->setSize(PanelWidth(pGridRow), pGridRow->CalcDrawHeight()); pGridRow->RepositionContents(); } // hack, for the thing to resize m_PlayerList.getSize(x, y); m_PlayerList.setSize(x, y); }
//----------------------------------------------------------------------------- // Purpose: Recalculate the internal scoreboard data //----------------------------------------------------------------------------- void ScorePanel::Update() { // Set the title string theTitleName; if (gViewPort->m_szServerName) { int iServerNameLength = max((int)strlen(gViewPort->m_szServerName),MAX_SERVERNAME_LENGTH); theTitleName += string(gViewPort->m_szServerName,iServerNameLength); } string theMapName = gHUD.GetMapName(); if(theMapName != "") { if(theTitleName != "") { theTitleName += " "; } theTitleName += "("; theTitleName += theMapName; theTitleName += ")"; } m_TitleLabel.setText(theTitleName.c_str()); int theColorIndex = 0; // Set gamma-correct title color Color gammaAdjustedTeamColor = BuildColor(kTeamColors[theColorIndex][0], kTeamColors[theColorIndex][1], kTeamColors[theColorIndex][2], gHUD.GetGammaSlope()); int theR, theG, theB, theA; gammaAdjustedTeamColor.getColor(theR, theG, theB, theA); m_TitleLabel.setFgColor(theR, theG, theB, theA); m_iRows = 0; gViewPort->GetAllPlayersInfo(); // Clear out sorts int i = 0; for (i = 0; i < NUM_ROWS; i++) { m_iSortedRows[i] = 0; m_iIsATeam[i] = TEAM_IND; } // Fix for memory overrun bug for (i = 0; i < MAX_PLAYERS; i++) { m_bHasBeenSorted[i] = false; } SortTeams(); // set scrollbar range m_PlayerList.SetScrollRange(m_iRows); FillGrid(); if ( gViewPort->m_pSpectatorPanel->m_menuVisible ) { m_pCloseButton->setVisible ( true ); } else { m_pCloseButton->setVisible ( false ); } }
//----------------------------------------------------------------------------- // Purpose: Create the ScoreBoard panel //----------------------------------------------------------------------------- ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall) { CSchemeManager *pSchemes = gViewPort->GetSchemeManager(); SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text"); SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text"); SchemeHandle_t hTinyScheme = pSchemes->getSchemeHandle("Scoreboard Tiny Text"); Font *tfont = pSchemes->getFont(hTitleScheme); Font *smallfont = pSchemes->getFont(hSmallScheme); Font *tinyfont = pSchemes->getFont(hTinyScheme); setBgColor(0, 0, 0, 96); m_pCurrentHighlightLabel = NULL; m_iHighlightRow = -1; // puzl: 0001073 m_pTrackerIcon = NULL; m_pDevIcon = NULL; m_pPTIcon = NULL; m_pGuideIcon = NULL; m_pServerOpIcon = NULL; m_pContribIcon = NULL; m_pCheatingDeathIcon = NULL; m_pVeteranIcon = 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"); m_pGuideIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardguide.tga"); m_pServerOpIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardserverop.tga"); m_pContribIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcontrib.tga"); m_pCheatingDeathIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcd.tga"); m_pVeteranIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardveteran.tga"); m_iIconFrame = 0; m_iLastFrameIncrementTime = gHUD.GetTimeOfLastUpdate(); // Initialize the top title. m_TitleLabel.setFont(tfont); m_TitleLabel.setText(""); m_TitleLabel.setBgColor( 0, 0, 0, 255 ); m_TitleLabel.setFgColor( Scheme::sc_primary1 ); m_TitleLabel.setContentAlignment( vgui::Label::a_west ); LineBorder *border = new LineBorder(Color(60, 60, 60, 128)); setBorder(border); setPaintBorderEnabled(true); int xpos = g_ColumnInfo[0].m_Width + 3; if (ScreenWidth() >= 640) { // only expand column size for res greater than 640 xpos = XRES(xpos); } m_TitleLabel.setBounds(xpos, 4, wide, SBOARD_TITLE_SIZE_Y); m_TitleLabel.setContentFitted(false); m_TitleLabel.setParent(this); // Setup the header (labels like "name", "class", etc..). m_HeaderGrid.SetDimensions(NUM_COLUMNS, 1); m_HeaderGrid.SetSpacing(0, 0); for(int i=0; i < NUM_COLUMNS; i++) { if (g_ColumnInfo[i].m_pTitle && g_ColumnInfo[i].m_pTitle[0] == '#') m_HeaderLabels[i].setText(CHudTextMessage::BufferedLocaliseTextString(g_ColumnInfo[i].m_pTitle)); else if(g_ColumnInfo[i].m_pTitle) m_HeaderLabels[i].setText(g_ColumnInfo[i].m_pTitle); int xwide = g_ColumnInfo[i].m_Width; if (ScreenWidth() >= 640) { xwide = XRES(xwide); } else if (ScreenWidth() == 400) { // hack to make 400x300 resolution scoreboard fit if (i == 1) { // reduces size of player name cell xwide -= 28; } else if (i == 0) { // tracker icon cell xwide -= 8; } } m_HeaderGrid.SetColumnWidth(i, xwide); m_HeaderGrid.SetEntry(i, 0, &m_HeaderLabels[i]); m_HeaderLabels[i].setBgColor(0,0,0,255); m_HeaderLabels[i].setBgColor(0,0,0,255); int theColorIndex = 0; Color gammaAdjustedTeamColor = BuildColor(kTeamColors[theColorIndex][0], kTeamColors[theColorIndex][1], kTeamColors[theColorIndex][2], gHUD.GetGammaSlope()); int theR, theG, theB, theA; gammaAdjustedTeamColor.getColor(theR, theG, theB, theA); m_HeaderLabels[i].setFgColor(theR, theG, theB, theA); m_HeaderLabels[i].setFont(smallfont); m_HeaderLabels[i].setContentAlignment(g_ColumnInfo[i].m_Alignment); int yres = 12; if (ScreenHeight() >= 480) { yres = YRES(yres); } m_HeaderLabels[i].setSize(50, yres); } // Set the width of the last column to be the remaining space. int ex, ey, ew, eh; m_HeaderGrid.GetEntryBox(NUM_COLUMNS - 2, 0, ex, ey, ew, eh); m_HeaderGrid.SetColumnWidth(NUM_COLUMNS - 1, (wide - X_BORDER) - (ex + ew)); m_HeaderGrid.AutoSetRowHeights(); m_HeaderGrid.setBounds(X_BORDER, SBOARD_TITLE_SIZE_Y, wide - X_BORDER*2, m_HeaderGrid.GetRowHeight(0)); m_HeaderGrid.setParent(this); m_HeaderGrid.setBgColor(0,0,0,255); // Now setup the listbox with the actual player data in it. int headerX, headerY, headerWidth, headerHeight; m_HeaderGrid.getBounds(headerX, headerY, headerWidth, headerHeight); m_PlayerList.setBounds(headerX, headerY+headerHeight, headerWidth, tall - headerY - headerHeight - 6); m_PlayerList.setBgColor(0,0,0,255); m_PlayerList.setParent(this); for(int row=0; row < NUM_ROWS; row++) { CGrid *pGridRow = &m_PlayerGrids[row]; pGridRow->SetDimensions(NUM_COLUMNS, 1); for(int col=0; col < NUM_COLUMNS; col++) { m_PlayerEntries[col][row].setContentFitted(false); m_PlayerEntries[col][row].setRow(row); m_PlayerEntries[col][row].addInputSignal(this); pGridRow->SetEntry(col, 0, &m_PlayerEntries[col][row]); } pGridRow->setBgColor(0,0,0,255); // pGridRow->SetSpacing(2, 0);f pGridRow->SetSpacing(0, 0); pGridRow->CopyColumnWidths(&m_HeaderGrid); pGridRow->AutoSetRowHeights(); pGridRow->setSize(PanelWidth(pGridRow), pGridRow->CalcDrawHeight()); pGridRow->RepositionContents(); m_PlayerList.AddItem(pGridRow); } // Add the hit test panel. It is invisible and traps mouse clicks so we can go into squelch mode. m_HitTestPanel.setBgColor(0,0,0,255); m_HitTestPanel.setParent(this); m_HitTestPanel.setBounds(0, 0, wide, tall); m_HitTestPanel.addInputSignal(this); m_pCloseButton = new CommandButton( "x", wide-XRES(12 + 4), YRES(2), XRES( 12 ) , YRES( 12 ) ); m_pCloseButton->setParent( this ); m_pCloseButton->addActionSignal( new CMenuHandler_StringCommandWatch( "-showscores", true ) ); m_pCloseButton->setBgColor(0,0,0,255); m_pCloseButton->setFgColor( 255, 255, 255, 0 ); m_pCloseButton->setFont(tfont); m_pCloseButton->setBoundKey( (char)255 ); m_pCloseButton->setContentAlignment(Label::a_center); Initialize(); }
Settings::Settings(GmkFile* gmk) : GmkResource(gmk), fullscreen(false), interpolatePixels(false), noBorder(false), showCursor(true), scale(ScalingKeepAspectRatio), sizeable(false), stayOnTop(false), windowColor(BuildColor(0, 0, 0)), changeResolution(false), colorDepth(CdNoChange), resolution(ResolutionNoChange), frequency(FrequencyNoChange), noButtons(false), vsync(false), noScreenSaver(true), fullscreenKey(true), helpKey(true), quitKey(true), screenshotKey(true), closeSecondary(true), priority(PriorityNormal), freeze(false), showProgress(LpbtDefault), frontImage(NULL), backImage(NULL), loadImage(NULL), loadTransparent(false), loadAlpha(255), scaleProgress(true), iconImage(NULL), displayErrors(true), writeErrors(false), abortErrors(false), treatUninitializedVariablesAsZero(false), argumentError(true), author(""), versionString("100"), information(""), major(1), minor(0), release(0), build(0), company(""), product(""), copyright(""), description("") { exists = true; // Create new icon in memory stream iconImage = new Stream(); // Icon Header iconImage->WriteWord(0); // Reserved (magic) iconImage->WriteWord(1); // 1 = Icon, 2 = Cursor iconImage->WriteWord(1); // 1 image in file // Image Header iconImage->WriteByte(32); // 32px width iconImage->WriteByte(32); // 32px height iconImage->WriteByte(0); // Truecolor iconImage->WriteByte(0); // Reserved iconImage->WriteWord(0); // Color planes iconImage->WriteWord(32); // 32bits per pixel iconImage->WriteDword(22486 - 16 - 6); // Size of image iconImage->WriteDword(16 + 6); // Offset to image // DIB header iconImage->WriteDword(40); // Size of this header iconImage->WriteDword(32); // Width iconImage->WriteDword(64); // Height * 2 iconImage->WriteWord(1); // Color planes, must be 1 iconImage->WriteDword(32); // 32 bit color iconImage->WriteDword(0); // No compression iconImage->WriteDword(22486 - 40 - 16 - 6); iconImage->WriteDword(1); // Pixels per meter iconImage->WriteDword(1); // Pixels per meter iconImage->WriteDword(0); // Number of colors, set to 0 to default to 2 ^ n iconImage->WriteDword(0); // Number of important colors // Make white pixels for(unsigned int i = 0; i < 22486 - 40 - 16 - 6; i++) iconImage->WriteByte(0xFF); }