Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoreboard scaling fix #367

Merged
merged 3 commits into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions source/cgame/cg_scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,9 @@ static int SCR_DrawTeamTab( const char **ptrptr, int *curteam, int x, int y, int
continue;

if (strcmp(token,"AVATAR") == 0){
// special case, don't draw any text, just skip ahead 32px
xoffset += 32;
// special case, don't draw any text, just skip ahead by avatarsize
int avatarsize = trap_SCR_FontHeight( font ) * 1.25;
xoffset += avatarsize;
continue;
}

Expand Down Expand Up @@ -682,9 +683,12 @@ static int SCR_DrawPlayerTab( const char **ptrptr, int team, int x, int y, int p
xoffset = 0;
yoffset = 0;

height = 32;

int textoffset = (32-trap_SCR_FontHeight( font ))/2;
int avatarsize = trap_SCR_FontHeight( font )*1.25;

height = avatarsize;

int textoffset = (avatarsize-trap_SCR_FontHeight( font ))/2;

// start from the center again
xoffset = CG_HorizontalAlignForWidth( 0, align, panelWidth );
Expand Down Expand Up @@ -804,7 +808,7 @@ static int SCR_DrawPlayerTab( const char **ptrptr, int team, int x, int y, int p
}
if (i >= 0 && i < gs.maxclients && cgs.clientInfo[i].steamid)
avatar = cgs.clientInfo[i].avatar;
width = 32;
width = avatarsize;
break;
}

Expand Down Expand Up @@ -834,14 +838,15 @@ static int SCR_DrawPlayerTab( const char **ptrptr, int team, int x, int y, int p
if (trans)
avColor[3] = 0.3;

RF_DrawStretchPic(x+xoffset,y+yoffset,32,32,0,0,1,1,avColor,avatar);
RF_DrawStretchPic(x+xoffset,y+yoffset,avatarsize,avatarsize,0,0,1,1,avColor,avatar);
}
}

// draw the column value
if( pass && string[0] )
{
trap_SCR_DrawClampString( x + xoffset, y + yoffset + textoffset, string,
// offset text by 2px so it isn't up against the cell wall
trap_SCR_DrawClampString( x + 2 + xoffset, y + yoffset + textoffset, string,
x + xoffset, y + yoffset + textoffset,
x + xoffset + width, y + yoffset + height + textoffset, font, color );
}
Expand All @@ -851,12 +856,12 @@ static int SCR_DrawPlayerTab( const char **ptrptr, int team, int x, int y, int p
xoffset += width;
}

int gap = 6;
int gap = trap_SCR_FontHeight(font) / 4;
if (pass && !last){
// draw scoreboard separator
CG_TeamColor( team, teamcolor );
teamcolor[3] = SCB_BACKGROUND_ALPHA - 0.17;
RF_DrawStretchPic( xstart, y + yoffset +32,panelWidth+gap, gap, 0, 0, 1, 1,teamcolor, cgs.shaderWhite );
RF_DrawStretchPic( xstart, y + yoffset + avatarsize,panelWidth+gap, gap, 0, 0, 1, 1,teamcolor, cgs.shaderWhite );
}

height += gap;
Expand Down
Loading