@@ -44,46 +44,51 @@ inline const char* CVAR_GET_STRING(const char* x) { return gEngfuncs.pfnGetCvarS
4444inline struct cvar_s * CVAR_CREATE (const char * cv , const char * val , const int flags ) { return gEngfuncs .pfnRegisterVariable ((char * )cv , (char * )val , flags ); }
4545
4646#define SPR_Load (*gEngfuncs.pfnSPR_Load)
47- #define SPR_Set (*gEngfuncs.pfnSPR_Set)
47+ void SPR_Set ( HSPRITE hPic , int r , int g , int b );
4848#define SPR_Frames (*gEngfuncs.pfnSPR_Frames)
4949#define SPR_GetList (*gEngfuncs.pfnSPR_GetList)
5050
5151// SPR_Draw draws a the current sprite as solid
52- #define SPR_Draw (*gEngfuncs.pfnSPR_Draw)
52+ void SPR_Draw ( int frame , int x , int y , const Rect * prc );
5353// SPR_DrawHoles draws the current sprites, with color index255 not drawn (transparent)
54- #define SPR_DrawHoles (*gEngfuncs.pfnSPR_DrawHoles)
54+ void SPR_DrawHoles ( int frame , int x , int y , const Rect * prc );
5555// SPR_DrawAdditive adds the sprites RGB values to the background (additive transulency)
56- #define SPR_DrawAdditive (*gEngfuncs.pfnSPR_DrawAdditive)
56+ void SPR_DrawAdditive ( int frame , int x , int y , const Rect * prc );
5757
5858// SPR_EnableScissor sets a clipping rect for HUD sprites. (0,0) is the top-left hand corner of the screen.
5959#define SPR_EnableScissor (*gEngfuncs.pfnSPR_EnableScissor)
6060// SPR_DisableScissor disables the clipping rect
6161#define SPR_DisableScissor (*gEngfuncs.pfnSPR_DisableScissor)
6262//
63- #define FillRGBA (*gEngfuncs.pfnFillRGBA)
63+ void FillRGBA ( int x , int y , int width , int height , int r , int g , int b , int a );
6464
6565
66- // ScreenHeight returns the height of the screen, in pixels
67- #define ScreenHeight (gHUD.m_scrinfo.iHeight)
68- // ScreenWidth returns the width of the screen, in pixels
69- #define ScreenWidth (gHUD.m_scrinfo.iWidth)
66+ // ScreenHeight returns the reference height of the HUD
67+ #define ScreenHeight (gHUD.m_iConHeight)
68+ // ScreenWidth returns the reference width of the HUD
69+ #define ScreenWidth (gHUD.m_iConWidth)
70+
71+ // RealScreenHeight returns the height of the screen, in pixels
72+ #define RealScreenHeight (gHUD.m_scrinfo.iHeight)
73+ // RealScreenWidth returns the width of the screen, in pixels
74+ #define RealScreenWidth (gHUD.m_scrinfo.iWidth)
7075
7176#define BASE_XRES 640.f
7277
7378// use this to project world coordinates to screen coordinates
74- #define XPROJECT (x ) ((1.0f + (x)) * ScreenWidth * 0.5f)
75- #define YPROJECT (y ) ((1.0f - (y)) * ScreenHeight * 0.5f)
79+ #define XPROJECT (x ) ((1.0f + (x)) * RealScreenWidth * 0.5f)
80+ #define YPROJECT (y ) ((1.0f - (y)) * RealScreenHeight * 0.5f)
7681
77- #define XRES (x ) ((x) * ((float)ScreenWidth / 640))
78- #define YRES (y ) ((y) * ((float)ScreenHeight / 480))
79- #define XRES_HD (x ) ((x) * V_max(1, (float)ScreenWidth / 1280))
80- #define YRES_HD (y ) ((y) * V_max(1, (float)ScreenHeight / 720))
82+ #define XRES (x ) ((x) * ((float)RealScreenWidth / 640))
83+ #define YRES (y ) ((y) * ((float)RealScreenHeight / 480))
84+ #define XRES_HD (x ) ((x) * V_max(1, (float)RealScreenWidth / 1280))
85+ #define YRES_HD (y ) ((y) * V_max(1, (float)RealScreenHeight / 720))
8186
8287#define GetScreenInfo (*gEngfuncs.pfnGetScreenInfo)
8388#define ServerCmd (*gEngfuncs.pfnServerCmd)
8489#define EngineClientCmd (*gEngfuncs.pfnClientCmd)
8590#define EngineFilteredClientCmd (*gEngfuncs.pfnFilteredClientCmd)
86- #define SetCrosshair (*gEngfuncs.pfnSetCrosshair)
91+ void SetCrosshair ( HSPRITE hspr , Rect rc , int r , int g , int b );
8792#define AngleVectors (*gEngfuncs.pfnAngleVectors)
8893
8994
@@ -99,12 +104,20 @@ inline int TextMessageDrawChar(int x, int y, int number, int r, int g, int b)
99104
100105inline int DrawConsoleString (int x , int y , const char * string )
101106{
102- return gEngfuncs .pfnDrawConsoleString (x , y , (char * )string );
107+ const int width = gEngfuncs .pfnDrawConsoleString (
108+ gHUD .m_flOffsetX + gHUD .m_flScaleX * x ,
109+ gHUD .m_flOffsetY + gHUD .m_flScaleY * y ,
110+ (char * )string );
111+
112+ return (width - gHUD .m_flOffsetX ) / gHUD .m_flScaleX ;
103113}
104114
105115inline void GetConsoleStringSize (const char * string , int * width , int * height )
106116{
107117 gEngfuncs .pfnDrawConsoleStringLen (string , width , height );
118+
119+ * width = * width / gHUD .m_flScaleX ;
120+ * height = * height / gHUD .m_flScaleY ;
108121}
109122
110123inline int ConsoleStringLen (const char * string )
0 commit comments