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. */
|
2023-11-19 19:17:51 +00:00
|
|
|
#ifndef GAME_CLIENT_COMPONENTS_INFOMESSAGES_H
|
|
|
|
#define GAME_CLIENT_COMPONENTS_INFOMESSAGES_H
|
2010-05-29 07:25:38 +00:00
|
|
|
#include <game/client/component.h>
|
|
|
|
|
2021-07-12 09:29:59 +00:00
|
|
|
#include <game/client/render.h>
|
2023-11-19 19:17:51 +00:00
|
|
|
class CInfoMessages : public CComponent
|
2010-05-29 07:25:38 +00:00
|
|
|
{
|
2018-03-13 20:55:47 +00:00
|
|
|
int m_SpriteQuadContainerIndex;
|
2023-04-17 21:33:30 +00:00
|
|
|
enum
|
|
|
|
{
|
2023-11-19 19:17:51 +00:00
|
|
|
MAX_INFOMSGS = 5,
|
2023-04-17 21:33:30 +00:00
|
|
|
MAX_KILLMSG_TEAM_MEMBERS = 4,
|
2023-11-20 11:23:56 +00:00
|
|
|
};
|
2023-11-19 19:17:51 +00:00
|
|
|
|
2023-11-20 11:23:56 +00:00
|
|
|
enum EType
|
|
|
|
{
|
|
|
|
TYPE_KILL,
|
|
|
|
TYPE_FINISH,
|
2023-04-17 21:33:30 +00:00
|
|
|
};
|
2020-09-26 19:41:58 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
public:
|
2023-11-19 19:17:51 +00:00
|
|
|
// info messages
|
|
|
|
struct CInfoMsg
|
2010-05-29 07:25:38 +00:00
|
|
|
{
|
2023-11-20 11:23:56 +00:00
|
|
|
EType m_Type;
|
2023-11-19 19:17:51 +00:00
|
|
|
int m_Tick;
|
2018-03-13 20:55:47 +00:00
|
|
|
|
2023-10-02 13:32:10 +00:00
|
|
|
int m_aVictimIds[MAX_KILLMSG_TEAM_MEMBERS];
|
2015-04-12 13:19:47 +00:00
|
|
|
int m_VictimDDTeam;
|
2010-06-06 13:38:03 +00:00
|
|
|
char m_aVictimName[64];
|
2023-05-05 13:58:17 +00:00
|
|
|
STextContainerIndex m_VictimTextContainerIndex;
|
2023-04-27 18:46:58 +00:00
|
|
|
float m_VictimTextWidth;
|
2023-10-02 13:32:10 +00:00
|
|
|
CTeeRenderInfo m_aVictimRenderInfo[MAX_KILLMSG_TEAM_MEMBERS];
|
2010-06-06 13:38:03 +00:00
|
|
|
int m_KillerID;
|
|
|
|
char m_aKillerName[64];
|
2023-05-05 13:58:17 +00:00
|
|
|
STextContainerIndex m_KillerTextContainerIndex;
|
2018-03-13 20:55:47 +00:00
|
|
|
float m_KillerTextWidth;
|
2010-06-06 13:38:03 +00:00
|
|
|
CTeeRenderInfo m_KillerRenderInfo;
|
2018-03-13 20:55:47 +00:00
|
|
|
|
2023-11-19 19:17:51 +00:00
|
|
|
// kill msg
|
|
|
|
int m_Weapon;
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_ModeSpecial; // for CTF, if the guy is carrying a flag for example
|
2019-07-29 14:36:44 +00:00
|
|
|
int m_FlagCarrierBlue;
|
2023-03-17 21:53:10 +00:00
|
|
|
int m_TeamSize;
|
2023-11-20 11:23:56 +00:00
|
|
|
|
|
|
|
// finish msg
|
|
|
|
int m_Diff;
|
|
|
|
char m_aTimeText[32];
|
|
|
|
char m_aDiffText[32];
|
|
|
|
STextContainerIndex m_TimeTextContainerIndex;
|
|
|
|
STextContainerIndex m_DiffTextContainerIndex;
|
|
|
|
float m_TimeTextWidth;
|
|
|
|
float m_DiffTextWidth;
|
|
|
|
bool m_RecordPersonal;
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
2020-12-13 00:08:34 +00:00
|
|
|
private:
|
2023-11-20 11:23:56 +00:00
|
|
|
void AddInfoMsg(EType Type, CInfoMsg NewMsg);
|
2023-11-19 19:17:51 +00:00
|
|
|
void RenderKillMsg(CInfoMsg *pInfoMsg, float x, float y);
|
2023-11-20 11:23:56 +00:00
|
|
|
void RenderFinishMsg(CInfoMsg *pInfoMsg, float x, float y);
|
|
|
|
|
|
|
|
void CreateNamesIfNotCreated(CInfoMsg *pInfoMsg);
|
|
|
|
void CreateFinishTextContainersIfNotCreated(CInfoMsg *pInfoMsg);
|
2023-11-19 19:17:51 +00:00
|
|
|
|
2023-11-20 11:23:56 +00:00
|
|
|
void DeleteTextContainers(CInfoMsg *pInfoMsg);
|
2020-12-13 00:08:34 +00:00
|
|
|
|
|
|
|
public:
|
2023-11-19 19:17:51 +00:00
|
|
|
CInfoMsg m_aInfoMsgs[MAX_INFOMSGS];
|
|
|
|
int m_InfoMsgCurrent;
|
2023-03-17 21:53:10 +00:00
|
|
|
|
2022-01-31 02:11:47 +00:00
|
|
|
virtual int Sizeof() const override { return sizeof(*this); }
|
2022-01-30 23:43:56 +00:00
|
|
|
virtual void OnWindowResize() override;
|
|
|
|
virtual void OnReset() override;
|
|
|
|
virtual void OnRender() override;
|
|
|
|
virtual void OnMessage(int MsgType, void *pRawMsg) override;
|
|
|
|
virtual void OnInit() override;
|
2020-11-08 05:39:16 +00:00
|
|
|
|
|
|
|
void RefindSkins();
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|