2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef GAME_CLIENT_COMPONENTS_HUD_H
|
|
|
|
#define GAME_CLIENT_COMPONENTS_HUD_H
|
|
|
|
#include <game/client/component.h>
|
|
|
|
|
2018-03-13 20:56:37 +00:00
|
|
|
struct SScoreInfo
|
|
|
|
{
|
|
|
|
SScoreInfo()
|
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
}
|
2020-09-26 19:41:58 +00:00
|
|
|
|
2018-03-13 20:56:37 +00:00
|
|
|
void Reset()
|
|
|
|
{
|
|
|
|
m_TextRankContainerIndex = m_TextScoreContainerIndex = m_RoundRectQuadContainerIndex = m_OptionalNameTextContainerIndex = -1;
|
|
|
|
m_aScoreText[0] = 0;
|
|
|
|
m_aRankText[0] = 0;
|
|
|
|
m_aPlayerNameText[0] = 0;
|
|
|
|
m_ScoreTextWidth = 0.f;
|
|
|
|
m_Initialized = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
int m_TextRankContainerIndex;
|
|
|
|
int m_TextScoreContainerIndex;
|
|
|
|
float m_ScoreTextWidth;
|
|
|
|
char m_aScoreText[16];
|
|
|
|
char m_aRankText[16];
|
|
|
|
char m_aPlayerNameText[MAX_NAME_LENGTH];
|
|
|
|
int m_RoundRectQuadContainerIndex;
|
|
|
|
int m_OptionalNameTextContainerIndex;
|
|
|
|
|
|
|
|
bool m_Initialized;
|
|
|
|
};
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
class CHud : public CComponent
|
2011-04-13 18:37:12 +00:00
|
|
|
{
|
2011-03-10 09:08:14 +00:00
|
|
|
float m_Width, m_Height;
|
2018-01-14 16:21:50 +00:00
|
|
|
float m_FrameTimeAvg;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2018-03-13 20:56:37 +00:00
|
|
|
int m_HudQuadContainerIndex;
|
|
|
|
SScoreInfo m_aScoreInfo[2];
|
2018-03-21 14:53:29 +00:00
|
|
|
int m_FPSTextContainerIndex;
|
2018-03-13 20:56:37 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void RenderCursor();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2016-05-03 14:06:10 +00:00
|
|
|
void RenderTextInfo();
|
2010-05-29 07:25:38 +00:00
|
|
|
void RenderConnectionWarning();
|
|
|
|
void RenderTeambalanceWarning();
|
|
|
|
void RenderVoting();
|
2018-03-13 20:56:37 +00:00
|
|
|
|
2022-03-18 10:11:58 +00:00
|
|
|
void PrepareAmmoHealthAndArmorQuads();
|
|
|
|
void RenderAmmoHealthAndArmor(const CNetObj_Character *pCharacter);
|
2018-03-13 20:56:37 +00:00
|
|
|
|
2022-03-20 13:18:02 +00:00
|
|
|
void PreparePlayerStateQuads();
|
2022-03-21 22:55:35 +00:00
|
|
|
void RenderPlayerState(const int ClientID);
|
2022-04-01 19:48:06 +00:00
|
|
|
void RenderDummyActions();
|
2022-04-14 11:31:00 +00:00
|
|
|
void RenderMovementInformation(const int ClientID);
|
2022-03-20 13:18:02 +00:00
|
|
|
|
2010-05-30 12:01:11 +00:00
|
|
|
void RenderGameTimer();
|
2012-01-10 21:40:48 +00:00
|
|
|
void RenderPauseNotification();
|
2010-05-30 12:01:11 +00:00
|
|
|
void RenderSuddenDeath();
|
|
|
|
void RenderScoreHud();
|
2011-03-10 09:08:14 +00:00
|
|
|
void RenderSpectatorHud();
|
2010-05-30 12:01:11 +00:00
|
|
|
void RenderWarmupTimer();
|
2016-04-27 17:22:55 +00:00
|
|
|
void RenderLocalTime(float x);
|
2010-05-30 12:01:11 +00:00
|
|
|
|
2022-05-10 16:41:46 +00:00
|
|
|
static constexpr float MOVEMENT_INFORMATION_LINE_HEIGHT = 8.0f;
|
2022-05-17 12:28:37 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
public:
|
|
|
|
CHud();
|
2022-01-31 02:11:47 +00:00
|
|
|
virtual int Sizeof() const override { return sizeof(*this); }
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2018-03-21 14:53:29 +00:00
|
|
|
void ResetHudContainers();
|
2022-01-30 23:43:56 +00:00
|
|
|
virtual void OnWindowResize() override;
|
|
|
|
virtual void OnReset() override;
|
|
|
|
virtual void OnRender() override;
|
|
|
|
virtual void OnInit() override;
|
2011-04-09 06:41:31 +00:00
|
|
|
|
|
|
|
// DDRace
|
|
|
|
|
2022-01-30 23:43:56 +00:00
|
|
|
virtual void OnMessage(int MsgType, void *pRawMsg) override;
|
2022-03-29 21:24:39 +00:00
|
|
|
void RenderNinjaBarPos(float x, const float y, const float width, const float height, float Progress, float Alpha = 1.0f);
|
2011-04-09 06:41:31 +00:00
|
|
|
|
|
|
|
private:
|
2014-02-06 22:49:25 +00:00
|
|
|
void RenderRecord();
|
2011-04-09 06:41:31 +00:00
|
|
|
void RenderDDRaceEffects();
|
|
|
|
float m_CheckpointDiff;
|
2014-02-06 22:49:25 +00:00
|
|
|
float m_ServerRecord;
|
2020-10-18 14:51:26 +00:00
|
|
|
float m_PlayerRecord[NUM_DUMMIES];
|
2011-04-09 06:41:31 +00:00
|
|
|
int m_DDRaceTime;
|
|
|
|
int m_LastReceivedTimeTick;
|
|
|
|
int m_CheckpointTick;
|
|
|
|
bool m_FinishTime;
|
|
|
|
bool m_DDRaceTimeReceived;
|
2022-03-18 10:11:58 +00:00
|
|
|
|
2022-05-10 16:41:46 +00:00
|
|
|
inline float GetMovementInformationBoxHeight();
|
2022-04-14 12:07:01 +00:00
|
|
|
inline int GetDigitsIndex(int Value, int Max);
|
2022-04-14 11:31:00 +00:00
|
|
|
|
2022-03-18 10:11:58 +00:00
|
|
|
// Quad Offsets
|
|
|
|
int m_AmmoOffset[NUM_WEAPONS];
|
|
|
|
int m_HealthOffset;
|
|
|
|
int m_EmptyHealthOffset;
|
|
|
|
int m_ArmorOffset;
|
|
|
|
int m_EmptyArmorOffset;
|
|
|
|
int m_CursorOffset[NUM_WEAPONS];
|
|
|
|
int m_FlagOffset;
|
2022-03-20 13:18:02 +00:00
|
|
|
int m_AirjumpOffset;
|
|
|
|
int m_AirjumpEmptyOffset;
|
2022-03-24 00:05:41 +00:00
|
|
|
int m_WeaponHammerOffset;
|
|
|
|
int m_WeaponGunOffset;
|
2022-03-21 22:55:35 +00:00
|
|
|
int m_WeaponShotgunOffset;
|
|
|
|
int m_WeaponGrenadeOffset;
|
|
|
|
int m_WeaponLaserOffset;
|
2022-03-24 00:05:41 +00:00
|
|
|
int m_WeaponNinjaOffset;
|
2022-03-20 13:18:02 +00:00
|
|
|
int m_EndlessJumpOffset;
|
|
|
|
int m_EndlessHookOffset;
|
|
|
|
int m_JetpackOffset;
|
2022-03-21 22:55:35 +00:00
|
|
|
int m_TeleportGrenadeOffset;
|
|
|
|
int m_TeleportGunOffset;
|
|
|
|
int m_TeleportLaserOffset;
|
|
|
|
int m_SoloOffset;
|
|
|
|
int m_NoCollisionOffset;
|
2022-03-20 13:18:02 +00:00
|
|
|
int m_NoHookHitOffset;
|
|
|
|
int m_NoHammerHitOffset;
|
2022-06-25 14:05:38 +00:00
|
|
|
int m_NoGunHitOffset;
|
2022-03-20 13:18:02 +00:00
|
|
|
int m_NoShotgunHitOffset;
|
|
|
|
int m_NoGrenadeHitOffset;
|
|
|
|
int m_NoLaserHitOffset;
|
2022-03-25 09:09:13 +00:00
|
|
|
int m_DeepFrozenOffset;
|
|
|
|
int m_LiveFrozenOffset;
|
2022-03-20 13:18:02 +00:00
|
|
|
int m_DummyHammerOffset;
|
|
|
|
int m_DummyCopyOffset;
|
2022-03-31 16:05:16 +00:00
|
|
|
int m_PracticeModeOffset;
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|