Various improvements to scoreboard rendering, refactoring

Scoreboard title

- In teamplay, color the title background red/blue for the respective teams (like in 0.7).
- In teamplay, swap the score location for the blue team, so the scores line up in the center (like in 0.7).
- Use textrender ellipsis instead of cutting the title string manually and potentially creating broken UTF-8.

Game over title

- Render the game over message in the color of the winning team (or yellow in case of draws).
- Adjust size and spacing of the message to prevent overlap.

Player list

- Add player list size variant for 17-24 players with two columns of up to 12 players. This previously used the variant for 32 players.

Goals

- Use textrender for alignment and properly center the time limit goal.
- Change localization text from `Round` to `Round %d/%d` so the numbers and punctuation can be formatted more correctly in some languages (e.g. right-to-left languages, Korean, Chinese).

Spectators

- Render spectators title and spectators starting in the same line to use space more effectively.
- Render as many lines of spectators as fit instead of only 4 lines.
- Render a placeholder text at the end when there are more spectators than fit.

Refactoring

- Use correct class for `NETMSGTYPE_SV_RECORDLEGACY` instead of depending on the structs `CNetMsg_Sv_Record` and `CNetMsg_Sv_RecordLegacy` being identical.
- Use `CUIRect` and `DoLabel` when possible.
This commit is contained in:
Robert Müller 2024-01-09 21:08:34 +01:00
parent 726e5c9a49
commit dc56651c39
2 changed files with 426 additions and 426 deletions

File diff suppressed because it is too large Load diff

View file

@ -6,36 +6,32 @@
#include <engine/console.h>
#include <game/client/component.h>
#include <game/client/ui_rect.h>
class CScoreboard : public CComponent
{
void RenderGoals(float x, float y, float w);
void RenderSpectators(float x, float y, float w, float h);
void RenderScoreboard(float x, float y, float w, int Team, const char *pTitle, int NumPlayers = -1);
void RenderTitle(CUIRect TitleBar, int Team, const char *pTitle);
void RenderGoals(CUIRect Goals);
void RenderSpectators(CUIRect Spectators);
void RenderScoreboard(CUIRect Scoreboard, int Team, int CountStart, int CountEnd);
void RenderRecordingNotification(float x);
static void ConKeyScoreboard(IConsole::IResult *pResult, void *pUserData);
const char *GetClanName(int Team);
const char *GetTeamName(int Team) const;
bool m_Active;
float m_ServerRecord;
public:
CScoreboard();
virtual int Sizeof() const override { return sizeof(*this); }
virtual void OnReset() override;
virtual void OnConsoleInit() override;
virtual void OnReset() override;
virtual void OnRender() override;
virtual void OnRelease() override;
bool Active();
// DDRace
virtual void OnMessage(int MsgType, void *pRawMsg) override;
private:
float m_ServerRecord;
bool Active() const;
};
#endif