NS/main/source/cl_dll/chud.h
pierow 99c40ae09e v3.2.3 features and fixes.
- Shotgun rework. Previously inconsistent shooting during reloads and desynced animations with server.
-- Shotgun reload can now be interrupted with a pump animation
-- Changed pellets 10 -> 17 and damage 17-> 10 to reduce inconsistency
- Networked ammo
- Client and server dll consistency checks added
- Backwards compatibility check for v3.2 servers to prevent prediction errors (popular demand)
- Players can change lifeform and use popupmenu in pregame warmup
- Fixed guns getting stuck in the air
- Reverted max speed to not be client cvar adjustable, fixing walk speed issues
- Added cl_mutemenu for players accidentally clicking on the scoreboard and going into squelch mode
- Removed default_fov as it did nothing but change sensitivty
- Fixed commander view scrolling keybinds
- cl_showspeed now works in readyroom and spectate
2021-02-05 16:18:16 -05:00

124 lines
3.3 KiB
C++

#ifndef CHUD_H
#define CHUD_H
#include "chudmisc.h"
#include "hud_spectator.h"
#include "AvHFont.h"
#include "hud_crosshairs.h"
class CHud
{
private:
HUDLIST *m_pHudList;
AVHHSPRITE m_hsprLogo;
int m_iLogo;
client_sprite_t *m_pSpriteList;
int m_iSpriteCount;
int m_iSpriteCountAllRes;
float m_flMouseSensitivity;
public:
AVHHSPRITE m_hsprCursor;
float m_flTime; // the current client time
float m_fOldTime; // the time at which the HUD was last redrawn
float m_wsFOV; //fov recalc corrected for widescreen
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()
AVHHSPRITE *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:
AVHHSPRITE 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;
CHudCrosshairs m_Crosshairs;
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