summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8fc9556)
raw | patch | inline | side by side (parent: 8fc9556)
author | Joseph Stalin <granminigun@pm.me> | |
Thu, 12 Sep 2019 19:28:12 +0000 (00:28 +0500) | ||
committer | Joseph Stalin <granminigun@pm.me> | |
Sun, 22 Sep 2019 15:27:20 +0000 (20:27 +0500) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 9d74f10098815061f2f68583eba0eab319b593d1..b89b03736ce7c8d0f7b62425729ff69d3a3e856b 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
procedure DrawPlayer(p: TPlayer);
var
- px, py, a, b, c, d: Integer;
+ px, py, a, b, c, d, i: Integer;
//R: TRect;
begin
if (p = nil) or (p.FDummy) then
renderMapInternal(-c, -d, true);
if (gGameSettings.GameMode <> GM_SINGLE) and gPlayerIndicator then
- p.DrawIndicator();
+ if gPlayers[i] <> nil then
+ for i := 0 to High(gPlayers) do
+ if gPlayers[i] = p then gPlayers[i].DrawIndicator(_RGB(255, 255, 255))
+ else if (gPlayers[i].Team = p.Team) and (gPlayers[i].Team <> TEAM_NONE)
+ then
+ gPlayers[i].DrawIndicator(gPlayers[i].GetColor);
+
if p.FSpectator then
e_TextureFontPrintEx(p.GameX + PLAYER_RECT_CX - 4,
p.GameY + PLAYER_RECT_CY - 4,
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 962db668f7e716e36fc086c51cd19779f391d3b6..181d7da5c090f1c306c562bd3901f5e7e8df3753 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
procedure ReleaseKeys();
procedure SetModel(ModelName: String);
procedure SetColor(Color: TRGB);
+ function GetColor(): TRGB;
procedure SetWeapon(W: Byte);
function IsKeyPressed(K: Byte): Boolean;
function GetKeys(): Byte;
procedure DrawPickup();
procedure DrawRulez();
procedure DrawAim();
- procedure DrawIndicator();
+ procedure DrawIndicator(Color: TRGB);
procedure DrawBubble();
procedure DrawGUI();
procedure Update(); virtual;
if FModel <> nil then FModel.Color := Color;
end;
+function TPlayer.GetColor(): TRGB;
+begin
+ result := FModel.Color;
+end;
+
procedure TPlayer.SwitchTeam;
begin
if g_Game_IsClient then
inherited;
end;
-procedure TPlayer.DrawIndicator();
+procedure TPlayer.DrawIndicator(Color: TRGB);
var
indX, indY: Integer;
indW, indH: Word;
ID: DWORD;
+ c: TRGB;
begin
if FAlive then
+ begin
+ if g_Texture_Get('TEXTURE_PLAYER_INDICATOR', ID) then
begin
- if g_Texture_Get('TEXTURE_PLAYER_INDICATOR', ID) then
- begin
- e_GetTextureSize(ID, @indW, @indH);
- indX := FObj.X + FObj.Rect.X + (FObj.Rect.Width - indW) div 2;
- indY := FObj.Y;
- e_Draw(ID, indX, indY - indH, 0, True, False);
- end;
+ e_GetTextureSize(ID, @indW, @indH);
+ indX := FObj.X + FObj.Rect.X + (FObj.Rect.Width - indW) div 2;
+ indY := FObj.Y;
+
+ c := e_Colors;
+ e_Colors := Color;
+ e_Draw(ID, indX, indY - indH, 0, True, False);
+ e_Colors := c;
end;
+ end;
//e_TextureFontPrint(indX, indY, FName, gStdFont); // Shows player name overhead
end;