#ifndef CHUD_H #define CHUD_H #include "cl_dll/chudmisc.h" #include "cl_dll/hud_spectator.h" #include "mod/AvHFont.h" class CHud { private: HUDLIST *m_pHudList; HSPRITE m_hsprLogo; int m_iLogo; client_sprite_t *m_pSpriteList; int m_iSpriteCount; int m_iSpriteCountAllRes; float m_flMouseSensitivity; public: HSPRITE m_hsprCursor; float m_flTime; // the current client time float m_fOldTime; // the time at which the HUD was last redrawn double m_flTimeDelta; // the difference between flTime and fOldTime Vector m_vecOrigin; Vector m_vecAngles; int m_iKeyBits; int m_iHideHUDDisplay; int m_iFOV; int m_iRes; cvar_t *m_pCvarStealMouse; cvar_t *m_pCvarDraw; int m_iFontHeight; int DrawHudNumber(int x, int y, int iFlags, int iNumber, int r, int g, int b ); int DrawHudStringCentered(int x, int y, int iMaxX, const char *szString, int r, int g, int b ); int DrawHudString(int x, int y, int iMaxX, const char *szString, int r, int g, int b ); int GetHudStringHeight(); int GetHudStringWidth(const char* szIt); int DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b ); int DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b ); int GetNumWidth(int iNumber, int iFlags); private: // the memory for these arrays are allocated in the first call to CHud::VidInit(), when the hud.txt and associated sprites are loaded. // freed in ~CHud() HSPRITE *m_rghSprites; /*[HUD_SPRITE_COUNT]*/ // the sprites loaded from hud.txt wrect_t *m_rgrcRects; /*[HUD_SPRITE_COUNT]*/ char *m_rgszSpriteNames; /*[HUD_SPRITE_COUNT][MAX_SPRITE_NAME_LENGTH]*/ struct cvar_s *default_fov; public: HSPRITE GetSprite( int index ) { return (index < 0) ? 0 : m_rghSprites[index]; } wrect_t& GetSpriteRect( int index ) { return m_rgrcRects[index]; } int GetSpriteIndex( const char *SpriteName ); // gets a sprite index, for use in the m_rghSprites[] array CHudAmmo m_Ammo; CHudHealth m_Health; CHudSpectator m_Spectator; CHudGeiger m_Geiger; CHudBattery m_Battery; CHudTrain m_Train; CHudFlashlight m_Flash; CHudMessage m_Message; CHudStatusBar m_StatusBar; CHudDeathNotice m_DeathNotice; CHudSayText m_SayText; CHudMenu m_Menu; CHudAmmoSecondary m_AmmoSecondary; CHudTextMessage m_TextMessage; CHudStatusIcons m_StatusIcons; AvHFont mFont; AvHFont mSmallFont; void Init( void ); void VidInit( void ); void Think(void); int Redraw( float flTime, int intermission ); int UpdateClientData( client_data_t *cdata, float time ); CHud() : m_iSpriteCount(0), m_pHudList(NULL) {} ~CHud(); // destructor, frees allocated memory // user messages int _cdecl MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf); void _cdecl MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf ); void _cdecl MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf ); int _cdecl MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf); // Screen information SCREENINFO m_scrinfo; int m_iWeaponBits; int m_fPlayerDead; int m_iIntermission; // sprite indexes int m_HUD_number_0; void AddHudElem(CHudBase *p); float GetSensitivity(); }; #endif