![]() |
|
Mapping Mapping sizes Limits Entities Bugs & Work-a-rounds Notes Scripting reference Mapping - Tutorials Brushwork from blueprint Tools Brush generator Vehicle generator MD3 Tag The Dummy Modding Project: Bug Fix Project: Crockett Other stuff Forum Server Info Colors Voice Chats Scripts Links |
Project: Bug FixThe objectiveThe goal of this project is to provide modders in the ET community with a SDK code base that contains fixes for various bugs which are present in the stock etmain game (version 2.60).26th september 2006: Sadly bugfix 088 had a bug :-( There were 3 lines that should have been deleted for the fix to work correctly. Show index Previous bug: Compact scoreboard - Spectators written with wrong char size Next bug: Mine flags blocking other mines from being spotted Bugfix 035 - Compact scoreboard - Normal background is used when names are compactProblem:Several problems. The background color painting code, didn't have any support for the compact size. The number of players was counted after the background got painted.Solution:Some parts of the code needed to be switched around. I also split the maxrows into two: maxrows for when to use the compact scoreboard and absmaxrows for when to stop writing names.Notes:The bug is still present in version 2.602.56 & 2.60 Code
cg_scoreboard.c @ 507 (2.56) @ 541 (2.60)
}
// CHRUKER: b035 - Added absolute maximum rows
static int WM_TeamScoreboard( int x, int y, team_t team, float fade, int maxrows, int absmaxrows ) {
vec4_t hcolor;
float tempx, tempy;
int height, width;
int i;
int count = 0;
qboolean use_mini_chars = qfalse; // CHRUKER: b035 - Needed to check if using mini chars
vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f };
height = SMALLCHAR_HEIGHT * maxrows;
width = INFO_PLAYER_WIDTH + INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH;
CG_FillRect( x-5, y-2, width+5, 21, clrUiBack );
CG_FillRect( x-5, y-2, width+5, 21, clrUiBar );
Vector4Set( hcolor, 0, 0, 0, fade );
CG_DrawRect_FixedBorder( x-5, y-2, width+5, 21, 1, colorBlack );
// draw header
if( cg_gameType.integer == GT_WOLF_LMS ) {
char *s;
if ( team == TEAM_AXIS ) {
s = va( "%s [%d] (%d %s)", CG_TranslateString( "AXIS" ), cg.teamScores[0], cg.teamPlayers[team], CG_TranslateString("PLAYERS") );
s = va( "%s ^3%s", s, cg.teamFirstBlood == TEAM_AXIS ? CG_TranslateString("FIRST BLOOD") : "" );
CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 );
} else if ( team == TEAM_ALLIES ) {
s = va( "%s [%d] (%d %s)", CG_TranslateString( "ALLIES" ), cg.teamScores[1], cg.teamPlayers[team], CG_TranslateString("PLAYERS") );
s = va( "%s ^3%s", s, cg.teamFirstBlood == TEAM_ALLIES ? CG_TranslateString("FIRST BLOOD") : "" );
CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 );
}
} else {
if ( team == TEAM_AXIS ) {
CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, va( "%s [%d] (%d %s)", CG_TranslateString( "AXIS" ), cg.teamScores[0], cg.teamPlayers[team], CG_TranslateString("PLAYERS") ), 0, 0, 0, &cgs.media.limboFont1 );
} else if ( team == TEAM_ALLIES ) {
CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, va( "%s [%d] (%d %s)", CG_TranslateString( "ALLIES" ), cg.teamScores[1], cg.teamPlayers[team], CG_TranslateString("PLAYERS") ), 0, 0, 0, &cgs.media.limboFont1 );
}
}
y += SMALLCHAR_HEIGHT + 3;
// save off y val
tempy = y;
// draw color bands
for ( i = 0; i <= maxrows; i++ ) {
if ( i % 2 == 0 )
VectorSet( hcolor, (80.f/255.f), (80.f/255.f), (80.f/255.f) ); // LIGHT BLUE
else
VectorSet( hcolor, (0.f/255.f), (0.f/255.f), (0.f/255.f) ); // DARK BLUE
hcolor[3] = fade * 0.3;
CG_FillRect( x-5, y, width+5, SMALLCHAR_HEIGHT+1, hcolor );
trap_R_SetColor( colorBlack );
CG_DrawTopBottom( x-5, y, width+5, SMALLCHAR_HEIGHT+1, 1 );
trap_R_SetColor( NULL );
y += SMALLCHAR_HEIGHT;
}
hcolor[3] = 1;
y = tempy;
tempx = x;
CG_FillRect( x-5, y-1, width+5, 18, clrUiBack );
//CG_FillRect( x-5, y-1, width+5, 18, clrUiBar );
trap_R_SetColor( colorBlack );
CG_DrawTopBottom( x-5, y-1, width+5, 18, 1 );
trap_R_SetColor( NULL );
// draw player info headings
CG_DrawSmallString( tempx, y, CG_TranslateString( "Name" ), fade );
tempx += INFO_PLAYER_WIDTH;
CG_DrawSmallString( tempx, y, CG_TranslateString( "Class" ), fade );
tempx += INFO_CLASS_WIDTH;
if( cgs.gametype == GT_WOLF_LMS ) {
CG_DrawSmallString( tempx, y, CG_TranslateString( "Score" ), fade );
tempx += INFO_SCORE_WIDTH;
} else {
CG_DrawSmallString( tempx + 1 * SMALLCHAR_WIDTH, y, CG_TranslateString( "XP" ), fade );
tempx += INFO_XP_WIDTH;
}
CG_DrawSmallString( tempx, y, CG_TranslateString( "Ping" ), fade );
tempx += INFO_LATENCY_WIDTH;
if( cgs.gametype != GT_WOLF_LMS ) {
CG_DrawPicST( tempx + 2, y, INFO_LIVES_WIDTH - 4, 16, 0.f, 0.f, 0.5f, 1.f, team == TEAM_ALLIES ? cgs.media.hudAlliedHelmet : cgs.media.hudAxisHelmet );
tempx += INFO_LIVES_WIDTH;
}
y += SMALLCHAR_HEIGHT;
// draw player info
VectorSet( hcolor, 1, 1, 1 );
hcolor[3] = fade;
cg.teamPlayers[team] = 0; // JPW NERVE
for ( i = 0; i < cg.numScores; i++ ) {
if ( team != cgs.clientinfo[ cg.scores[i].client ].team )
continue;
cg.teamPlayers[team]++;
}
// CHRUKER: b035 - Adjust maxrows
if ( cg.teamPlayers[team] > maxrows ) {
maxrows = absmaxrows;
use_mini_chars = qtrue;
}
// save off y val
tempy = y;
// draw color bands
for ( i = 0; i < maxrows; i++ ) {
if ( i % 2 == 0 )
VectorSet( hcolor, (80.f/255.f), (80.f/255.f), (80.f/255.f) ); // LIGHT BLUE
else
VectorSet( hcolor, (0.f/255.f), (0.f/255.f), (0.f/255.f) ); // DARK BLUE
hcolor[3] = fade * 0.3;
if ( use_mini_chars ) {
CG_FillRect( x-5, y, width+5, MINICHAR_HEIGHT+1, hcolor );
trap_R_SetColor( colorBlack );
CG_DrawTopBottom( x-5, y, width+5, MINICHAR_HEIGHT+1, 1 );
trap_R_SetColor( NULL );
y += MINICHAR_HEIGHT;
} else {
CG_FillRect( x-5, y, width+5, SMALLCHAR_HEIGHT+1, hcolor );
trap_R_SetColor( colorBlack );
CG_DrawTopBottom( x-5, y, width+5, SMALLCHAR_HEIGHT+1, 1 );
trap_R_SetColor( NULL );
y += SMALLCHAR_HEIGHT;
}
}
hcolor[3] = 1;
y = tempy;
// draw player info
VectorSet( hcolor, 1, 1, 1 );
hcolor[3] = fade;
count = 0;
for( i = 0; i < cg.numScores && count < maxrows; i++ ) {
if( team != cgs.clientinfo[ cg.scores[i].client ].team ) {
continue;
}
// CHRUKER: b035 - Using the flag instead
if( use_mini_chars ) {
WM_DrawClientScore_Small( x, y, &cg.scores[i], hcolor, fade );
y += MINICHAR_HEIGHT;
} else {
WM_DrawClientScore( x, y, &cg.scores[i], hcolor, fade );
y += SMALLCHAR_HEIGHT;
}
count++;
}
// draw spectators
// CHRUKER: b035 - Missing support for mini char height scoreboard background
if ( use_mini_chars )
y += MINICHAR_HEIGHT;
else
y += SMALLCHAR_HEIGHT;
for ( i = 0; i < cg.numScores; i++ ) {
if ( cgs.clientinfo[ cg.scores[i].client ].team != TEAM_SPECTATOR )
continue;
if ( team == TEAM_AXIS && ( i % 2 ) )
continue;
if ( team == TEAM_ALLIES && ( ( i + 1 ) % 2 ) )
continue;
// CHRUKER: b034 - Missing support for minichars; b035 - Using the flag instead
if( use_mini_chars ) {
WM_DrawClientScore_Small( x, y, &cg.scores[i], hcolor, fade );
y += MINICHAR_HEIGHT;
} else {
WM_DrawClientScore( x, y, &cg.scores[i], hcolor, fade );
y += SMALLCHAR_HEIGHT;
}
}
return y;
}
// -NERVE - SMF
cg_scoreboard.c @ 712 (2.56) @ 767 (2.60)
y = WM_DrawInfoLine( x, 155, fade );
// CHRUKER: b035 - The maxrows has been split into one for when to use the mini chars and one for when to stop writing.
WM_TeamScoreboard( x, y, TEAM_AXIS, fade, 8, 10 );
x = x_right;
WM_TeamScoreboard( x, y, TEAM_ALLIES, fade, 8, 10 );
} else {
if(cg.snap->ps.pm_type == PM_INTERMISSION) {
WM_TeamScoreboard( x, y, TEAM_AXIS, fade, 9, 12 );
x = x_right;
WM_TeamScoreboard( x, y, TEAM_ALLIES, fade, 9, 12 );
} else {
WM_TeamScoreboard( x, y, TEAM_AXIS, fade, 25, 33 );
x = x_right;
WM_TeamScoreboard( x, y, TEAM_ALLIES, fade, 25, 33 );
} // b035
}
Show index Previous bug: Compact scoreboard - Spectators written with wrong char size Next bug: Mine flags blocking other mines from being spotted Color codingSample = New codeSample = Changed code (the new version is what is displayed) Sample = Deleted code |
©2018 Chruker |