Skip to content

Commit

Permalink
fix scoreboard & minimap player color
Browse files Browse the repository at this point in the history
colors will repeat but thats probably better than having no colors at all
  • Loading branch information
siecvi committed Nov 10, 2024
1 parent ea64369 commit cf29d99
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions Sources/Client/MapView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,16 @@ namespace spades {
continue; // don't draw enemies when not spectating a player

IntVector3 iconColor = p.GetColor();
if (&p == &localPlayer && !localPlayerIsSpectator)
if (&p == &localPlayer && !localPlayerIsSpectator) {
iconColor = MakeIntVector3(0, 255, 255);
else if (colorMode)
iconColor = MakeIntVector3(palette[i][0], palette[i][1], palette[i][2]);
} else if (colorMode) {
int colorIndex = i % 32;
iconColor = MakeIntVector3(
palette[colorIndex][0],
palette[colorIndex][1],
palette[colorIndex][2]
);
}
Vector4 iconColorF = ModifyColor(iconColor) * alpha;

if (iconMode) {
Expand Down
12 changes: 9 additions & 3 deletions Sources/Client/ScoreboardView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace spades {
namespace client {

static const Vector4 white = {1, 1, 1, 1};
static const Vector4 gray = {0.5, 0.5, 0.5, 1};
static const Vector4 spectatorIdColor = {210.0F / 255, 210.0F / 255, 210.0F / 255, 1}; // Grey
static const Vector4 spectatorTextColor = {220.0F / 255, 220.0F / 255, 0, 1}; // Goldish yellow
static const int spectatorTeamId = 255; // Spectators have a team id of 255
Expand Down Expand Up @@ -334,15 +335,20 @@ namespace spades {
sprintf(buf, "#%d", ent.id); // FIXME: 1-base?
size = font.Measure(buf);
if (colorMode) {
IntVector3 colorplayer = MakeIntVector3(palette[ent.id][0], palette[ent.id][1], palette[ent.id][2]);
Vector4 colorplayerF = (ent.id > 32) ? white : ModifyColor(colorplayer);
int colorIndex = ent.id % 32;
IntVector3 colorplayer = MakeIntVector3(
palette[colorIndex][0],
palette[colorIndex][1],
palette[colorIndex][2]
);
Vector4 colorplayerF = ModifyColor(colorplayer);
font.Draw(buf, MakeVector2(colX + 35.0F - size.x, rowY), 1.0F, colorplayerF);
} else {
font.Draw(buf, MakeVector2(colX + 35.0F - size.x, rowY), 1.0F, white);
}

// draw player name
Vector4 color = ent.alive ? white : MakeVector4(0.5, 0.5, 0.5, 1);
Vector4 color = ent.alive ? white : gray;
if (stmp::make_optional(ent.id) == world->GetLocalPlayerIndex()) {
color = GetTeamColor(team);

Expand Down

0 comments on commit cf29d99

Please sign in to comment.