mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-11 15:38:12 +00:00
Improve client
This commit is contained in:
parent
06d38e3feb
commit
d254f1bd0e
1
Android.mk
Normal file
1
Android.mk
Normal file
@ -0,0 +1 @@
|
|||||||
|
include $(call all-subdir-makefiles)
|
@ -1,9 +1,9 @@
|
|||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
* Copyright (c) 1999, Valve LLC. All rights reserved.
|
* Copyright (c) 1999, Valve LLC. All rights reserved.
|
||||||
*
|
*
|
||||||
* This product contains software technology licensed from Id
|
* This product contains software technology licensed from Id
|
||||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use, distribution, and modification of this source code and/or resulting
|
* Use, distribution, and modification of this source code and/or resulting
|
||||||
@ -90,8 +90,9 @@ int CHudMOTD :: Draw( float fTime )
|
|||||||
gHUD.DrawDarkRectangle(xpos-5, ypos_r - 5, xmax - xpos+10, height + 10);
|
gHUD.DrawDarkRectangle(xpos-5, ypos_r - 5, xmax - xpos+10, height + 10);
|
||||||
while ( *ch )
|
while ( *ch )
|
||||||
{
|
{
|
||||||
|
char *next_line;
|
||||||
int line_length = 0; // count the length of the current line
|
int line_length = 0; // count the length of the current line
|
||||||
for ( char *next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ )
|
for ( next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ )
|
||||||
line_length += gHUD.m_scrinfo.charWidths[ *next_line ];
|
line_length += gHUD.m_scrinfo.charWidths[ *next_line ];
|
||||||
char *top = next_line;
|
char *top = next_line;
|
||||||
if ( *top == '\n' )
|
if ( *top == '\n' )
|
||||||
@ -105,7 +106,7 @@ int CHudMOTD :: Draw( float fTime )
|
|||||||
|
|
||||||
ypos += LINE_HEIGHT;
|
ypos += LINE_HEIGHT;
|
||||||
|
|
||||||
if ( top ) // restore
|
if ( top ) // restore
|
||||||
*top = '\n';
|
*top = '\n';
|
||||||
ch = next_line;
|
ch = next_line;
|
||||||
if ( *ch == '\n' )
|
if ( *ch == '\n' )
|
||||||
@ -114,7 +115,7 @@ int CHudMOTD :: Draw( float fTime )
|
|||||||
if ( ypos > (ScreenHeight - 20) )
|
if ( ypos > (ScreenHeight - 20) )
|
||||||
break; // don't let it draw too low
|
break; // don't let it draw too low
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +134,7 @@ int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
|
|||||||
if ( is_finished )
|
if ( is_finished )
|
||||||
{
|
{
|
||||||
int length = 0;
|
int length = 0;
|
||||||
|
|
||||||
m_iMaxLength = 0;
|
m_iMaxLength = 0;
|
||||||
m_iFlags |= HUD_ACTIVE;
|
m_iFlags |= HUD_ACTIVE;
|
||||||
|
|
||||||
@ -151,7 +152,7 @@ int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
|
|||||||
}
|
}
|
||||||
length++;
|
length++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_iLines++;
|
m_iLines++;
|
||||||
if( length > m_iMaxLength )
|
if( length > m_iMaxLength )
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
|
|||||||
pWeapon->rcCrosshair = p->rc;
|
pWeapon->rcCrosshair = p->rc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pWeapon->hCrosshair = NULL;
|
pWeapon->hCrosshair = 0;
|
||||||
|
|
||||||
p = GetSpriteList(pList, "autoaim", iRes, i);
|
p = GetSpriteList(pList, "autoaim", iRes, i);
|
||||||
if (p)
|
if (p)
|
||||||
|
@ -24,21 +24,21 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Macros to hook function calls into the HUD object
|
// Macros to hook function calls into the HUD object
|
||||||
|
|
||||||
#define HOOK_MESSAGE(x) gEngfuncs.pfnHookUserMsg(#x, __MsgFunc_##x );
|
#define HOOK_MESSAGE(x) gEngfuncs.pfnHookUserMsg(#x, __MsgFunc_##x );
|
||||||
|
|
||||||
#define DECLARE_MESSAGE(y, x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf) \
|
#define DECLARE_MESSAGE(y, x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf) \
|
||||||
{ \
|
{ \
|
||||||
return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \
|
return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y );
|
#define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y );
|
||||||
#define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \
|
#define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \
|
||||||
{ \
|
{ \
|
||||||
gHUD.y.UserCmd_##x( ); \
|
gHUD.y.UserCmd_##x( ); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( (char*)x ); }
|
inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( (char*)x ); }
|
||||||
inline char* CVAR_GET_STRING( const char *x ) { return gEngfuncs.pfnGetCvarString( (char*)x ); }
|
inline char* CVAR_GET_STRING( const char *x ) { return gEngfuncs.pfnGetCvarString( (char*)x ); }
|
||||||
@ -82,31 +82,45 @@ inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int fl
|
|||||||
#define ClientCmd (*gEngfuncs.pfnClientCmd)
|
#define ClientCmd (*gEngfuncs.pfnClientCmd)
|
||||||
#define SetCrosshair (*gEngfuncs.pfnSetCrosshair)
|
#define SetCrosshair (*gEngfuncs.pfnSetCrosshair)
|
||||||
#define AngleVectors (*gEngfuncs.pfnAngleVectors)
|
#define AngleVectors (*gEngfuncs.pfnAngleVectors)
|
||||||
|
extern cvar_t *hud_textmode;
|
||||||
|
extern float g_hud_text_color[3];
|
||||||
|
inline int DrawSetTextColor(float r, float g, float b)
|
||||||
|
{
|
||||||
|
if( hud_textmode->value == 1 )
|
||||||
|
g_hud_text_color[0]=r, g_hud_text_color[1] = g, g_hud_text_color[2] = b;
|
||||||
|
else
|
||||||
|
gEngfuncs.pfnDrawSetTextColor( r, g, b );
|
||||||
|
}
|
||||||
// Gets the height & width of a sprite, at the specified frame
|
// Gets the height & width of a sprite, at the specified frame
|
||||||
inline int SPR_Height( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Height(x, f); }
|
inline int SPR_Height( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Height(x, f); }
|
||||||
inline int SPR_Width( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Width(x, f); }
|
inline int SPR_Width( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Width(x, f); }
|
||||||
|
|
||||||
inline client_textmessage_t *TextMessageGet( const char *pName ) { return gEngfuncs.pfnTextMessageGet( pName ); }
|
inline client_textmessage_t *TextMessageGet( const char *pName ) { return gEngfuncs.pfnTextMessageGet( pName ); }
|
||||||
inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b )
|
inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b )
|
||||||
{
|
{
|
||||||
return gEngfuncs.pfnDrawCharacter( x, y, number, r, g, b );
|
return gEngfuncs.pfnDrawCharacter( x, y, number, r, g, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int DrawConsoleString( int x, int y, const char *string )
|
inline int DrawConsoleString( int x, int y, const char *string )
|
||||||
{
|
{
|
||||||
|
if( hud_textmode->value == 1 )
|
||||||
|
return gHUD.DrawHudString( x, y, 9999, (char*)string, 255*g_hud_text_color[0], 255*g_hud_text_color[1], 255*g_hud_text_color[2]);
|
||||||
return gEngfuncs.pfnDrawConsoleString( x, y, (char*) string );
|
return gEngfuncs.pfnDrawConsoleString( x, y, (char*) string );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void GetConsoleStringSize( const char *string, int *width, int *height )
|
inline void GetConsoleStringSize( const char *string, int *width, int *height )
|
||||||
{
|
{
|
||||||
gEngfuncs.pfnDrawConsoleStringLen( string, width, height );
|
if( hud_textmode->value == 1 )
|
||||||
|
*height = 13, *width = gHUD.DrawHudStringLen(string);
|
||||||
|
else
|
||||||
|
gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int ConsoleStringLen( const char *string )
|
inline int ConsoleStringLen( const char *string )
|
||||||
{
|
{
|
||||||
int _width, _height;
|
int _width = 0, _height = 0;
|
||||||
|
if( hud_textmode->value == 1 )
|
||||||
|
return gHUD.DrawHudStringLen((char*)string);
|
||||||
GetConsoleStringSize( string, &_width, &_height );
|
GetConsoleStringSize( string, &_width, &_height );
|
||||||
return _width;
|
return _width;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ int CHudDeathNotice :: Draw( float flTime )
|
|||||||
rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME );
|
rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME );
|
||||||
|
|
||||||
// Only draw if the viewport will let me
|
// Only draw if the viewport will let me
|
||||||
// vgui dropped out
|
// vgui dropped out
|
||||||
//if ( gViewPort && gViewPort->AllowedToPrintText() )
|
//if ( gViewPort && gViewPort->AllowedToPrintText() )
|
||||||
{
|
{
|
||||||
// Draw the death notice
|
// Draw the death notice
|
||||||
@ -125,7 +125,7 @@ int CHudDeathNotice :: Draw( float flTime )
|
|||||||
|
|
||||||
// Draw killers name
|
// Draw killers name
|
||||||
if ( rgDeathNoticeList[i].KillerColor )
|
if ( rgDeathNoticeList[i].KillerColor )
|
||||||
gEngfuncs.pfnDrawSetTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] );
|
DrawSetTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] );
|
||||||
x = 5 + DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller );
|
x = 5 + DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ int CHudDeathNotice :: Draw( float flTime )
|
|||||||
if (rgDeathNoticeList[i].iNonPlayerKill == FALSE)
|
if (rgDeathNoticeList[i].iNonPlayerKill == FALSE)
|
||||||
{
|
{
|
||||||
if ( rgDeathNoticeList[i].VictimColor )
|
if ( rgDeathNoticeList[i].VictimColor )
|
||||||
gEngfuncs.pfnDrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] );
|
DrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] );
|
||||||
x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim );
|
x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,8 +184,8 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
|
|||||||
|
|
||||||
//if (gViewPort)
|
//if (gViewPort)
|
||||||
// gViewPort->GetAllPlayersInfo();
|
// gViewPort->GetAllPlayersInfo();
|
||||||
gHUD.m_Scoreboard.GetAllPlayersInfo();
|
gHUD.m_Scoreboard.GetAllPlayersInfo();
|
||||||
|
|
||||||
|
|
||||||
// Get the Killer's name
|
// Get the Killer's name
|
||||||
char *killer_name = g_PlayerInfoList[ killer ].name;
|
char *killer_name = g_PlayerInfoList[ killer ].name;
|
||||||
@ -279,7 +279,7 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
|
|||||||
ConsolePrint( rgDeathNoticeList[i].szVictim );
|
ConsolePrint( rgDeathNoticeList[i].szVictim );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( killedwith && *killedwith && (*killedwith > 13 ) && strcmp( killedwith, "d_world" ) && !rgDeathNoticeList[i].iTeamKill )
|
if ( *killedwith && (*killedwith > 13 ) && strcmp( killedwith, "d_world" ) && !rgDeathNoticeList[i].iTeamKill )
|
||||||
{
|
{
|
||||||
ConsolePrint( " with " );
|
ConsolePrint( " with " );
|
||||||
|
|
||||||
|
@ -579,6 +579,12 @@ void CBasePlayerWeapon::PrintState( void )
|
|||||||
COM_Log( "c:\\hl.log", "%i ", m_iClip );
|
COM_Log( "c:\\hl.log", "%i ", m_iClip );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int RandomLong( int a, int b )
|
||||||
|
{
|
||||||
|
return gEngfuncs.pfnRandomLong(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=====================
|
=====================
|
||||||
HUD_InitClientWeapons
|
HUD_InitClientWeapons
|
||||||
@ -615,7 +621,7 @@ void HUD_InitClientWeapons( void )
|
|||||||
// Pass through to engine
|
// Pass through to engine
|
||||||
g_engfuncs.pfnPrecacheEvent = gEngfuncs.pfnPrecacheEvent;
|
g_engfuncs.pfnPrecacheEvent = gEngfuncs.pfnPrecacheEvent;
|
||||||
g_engfuncs.pfnRandomFloat = gEngfuncs.pfnRandomFloat;
|
g_engfuncs.pfnRandomFloat = gEngfuncs.pfnRandomFloat;
|
||||||
g_engfuncs.pfnRandomLong = gEngfuncs.pfnRandomLong;
|
g_engfuncs.pfnRandomLong = RandomLong;
|
||||||
|
|
||||||
// Allocate a slot for the local player
|
// Allocate a slot for the local player
|
||||||
HUD_PrepEntity( &player , NULL );
|
HUD_PrepEntity( &player , NULL );
|
||||||
|
@ -24,12 +24,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "parsemsg.h"
|
#include "parsemsg.h"
|
||||||
#include "hud_servers.h"
|
#include "hud_servers.h"
|
||||||
|
|
||||||
|
|
||||||
#include "demo.h"
|
#include "demo.h"
|
||||||
#include "demo_api.h"
|
#include "demo_api.h"
|
||||||
|
|
||||||
|
cvar_t *hud_textmode;
|
||||||
|
float g_hud_text_color[3];
|
||||||
|
|
||||||
|
|
||||||
extern client_sprite_t *GetSpriteList(client_sprite_t *pList, const char *psz, int iRes, int iCount);
|
extern client_sprite_t *GetSpriteList(client_sprite_t *pList, const char *psz, int iRes, int iCount);
|
||||||
@ -186,7 +187,7 @@ void CHud :: Init( void )
|
|||||||
|
|
||||||
CVAR_CREATE( "hud_classautokill", "1", FCVAR_ARCHIVE | FCVAR_USERINFO ); // controls whether or not to suicide immediately on TF class switch
|
CVAR_CREATE( "hud_classautokill", "1", FCVAR_ARCHIVE | FCVAR_USERINFO ); // controls whether or not to suicide immediately on TF class switch
|
||||||
CVAR_CREATE( "hud_takesshots", "0", FCVAR_ARCHIVE ); // controls whether or not to automatically take screenshots at the end of a round
|
CVAR_CREATE( "hud_takesshots", "0", FCVAR_ARCHIVE ); // controls whether or not to automatically take screenshots at the end of a round
|
||||||
|
hud_textmode = CVAR_CREATE ( "hud_textmode", "0", FCVAR_ARCHIVE );
|
||||||
|
|
||||||
m_iLogo = 0;
|
m_iLogo = 0;
|
||||||
m_iFOV = 0;
|
m_iFOV = 0;
|
||||||
@ -229,8 +230,8 @@ void CHud :: Init( void )
|
|||||||
m_AmmoSecondary.Init();
|
m_AmmoSecondary.Init();
|
||||||
m_TextMessage.Init();
|
m_TextMessage.Init();
|
||||||
m_StatusIcons.Init();
|
m_StatusIcons.Init();
|
||||||
m_MOTD.Init();
|
m_MOTD.Init();
|
||||||
m_Scoreboard.Init();
|
m_Scoreboard.Init();
|
||||||
|
|
||||||
m_Menu.Init();
|
m_Menu.Init();
|
||||||
|
|
||||||
@ -258,7 +259,7 @@ CHud :: ~CHud()
|
|||||||
m_pHudList = NULL;
|
m_pHudList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSpriteIndex()
|
// GetSpriteIndex()
|
||||||
@ -400,8 +401,8 @@ void CHud :: VidInit( void )
|
|||||||
m_AmmoSecondary.VidInit();
|
m_AmmoSecondary.VidInit();
|
||||||
m_TextMessage.VidInit();
|
m_TextMessage.VidInit();
|
||||||
m_StatusIcons.VidInit();
|
m_StatusIcons.VidInit();
|
||||||
m_Scoreboard.VidInit();
|
m_Scoreboard.VidInit();
|
||||||
m_MOTD.VidInit();
|
m_MOTD.VidInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ public:
|
|||||||
|
|
||||||
void GetAllPlayersInfo( void );
|
void GetAllPlayersInfo( void );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -610,7 +610,8 @@ public:
|
|||||||
int DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b );
|
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 DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b );
|
||||||
int GetNumWidth(int iNumber, int iFlags);
|
int GetNumWidth(int iNumber, int iFlags);
|
||||||
void DrawDarkRectangle( int x, int y, int wide, int tall);
|
int DrawHudStringLen( char *szIt );
|
||||||
|
void DrawDarkRectangle( int x, int y, int wide, int tall);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// the memory for these arrays are allocated in the first call to CHud::VidInit(), when the hud.txt and associated sprites are loaded.
|
// the memory for these arrays are allocated in the first call to CHud::VidInit(), when the hud.txt and associated sprites are loaded.
|
||||||
@ -651,7 +652,7 @@ public:
|
|||||||
CHudStatusIcons m_StatusIcons;
|
CHudStatusIcons m_StatusIcons;
|
||||||
CHudScoreboard m_Scoreboard;
|
CHudScoreboard m_Scoreboard;
|
||||||
CHudMOTD m_MOTD;
|
CHudMOTD m_MOTD;
|
||||||
|
|
||||||
|
|
||||||
void Init( void );
|
void Init( void );
|
||||||
void VidInit( void );
|
void VidInit( void );
|
||||||
@ -682,7 +683,7 @@ public:
|
|||||||
// sprite indexes
|
// sprite indexes
|
||||||
int m_HUD_number_0;
|
int m_HUD_number_0;
|
||||||
|
|
||||||
int m_iNoConsolePrint;
|
int m_iNoConsolePrint;
|
||||||
|
|
||||||
void AddHudElem(CHudBase *p);
|
void AddHudElem(CHudBase *p);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "hud.h"
|
#include "hud.h"
|
||||||
#include "cl_util.h"
|
#include "cl_util.h"
|
||||||
#include "triangleapi.h"
|
//#include "triangleapi.h"
|
||||||
|
|
||||||
|
|
||||||
#define MAX_LOGO_FRAMES 56
|
#define MAX_LOGO_FRAMES 56
|
||||||
@ -182,22 +182,58 @@ void ScaleColors( int &r, int &g, int &b, int a )
|
|||||||
b = (int)(b * x);
|
b = (int)(b * x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const unsigned char colors[8][3] =
|
||||||
|
{
|
||||||
|
{127, 127, 127}, // additive cannot be black
|
||||||
|
{255, 0, 0},
|
||||||
|
{ 0, 255, 0},
|
||||||
|
{255, 255, 0},
|
||||||
|
{ 0, 0, 255},
|
||||||
|
{ 0, 255, 255},
|
||||||
|
{255, 0, 255},
|
||||||
|
{240, 180, 24}
|
||||||
|
};
|
||||||
|
|
||||||
int CHud :: DrawHudString(int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b )
|
int CHud :: DrawHudString(int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b )
|
||||||
{
|
{
|
||||||
|
if( hud_textmode->value == 2 )
|
||||||
|
{
|
||||||
|
gEngfuncs.pfnDrawSetTextColor( r/255.0, g/255.0, b/255.0 );
|
||||||
|
return gEngfuncs.pfnDrawConsoleString( xpos, ypos, (char*) szIt );
|
||||||
|
}
|
||||||
// draw the string until we hit the null character or a newline character
|
// draw the string until we hit the null character or a newline character
|
||||||
for ( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
for ( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
||||||
{
|
{
|
||||||
int next = xpos + gHUD.m_scrinfo.charWidths[ *szIt ]; // variable-width fonts look cool
|
int w = gHUD.m_scrinfo.charWidths[ 'M' ];
|
||||||
if ( next > iMaxX )
|
if ( xpos + w > iMaxX )
|
||||||
return xpos;
|
return xpos;
|
||||||
|
if( *szIt == '^' && *(szIt + 1) >= '0' && *(szIt + 1) <= '7' )
|
||||||
|
{
|
||||||
|
szIt++;
|
||||||
|
r = colors[ *szIt - '0' ][0];
|
||||||
|
g = colors[ *szIt - '0' ][1];
|
||||||
|
b = colors[ *szIt - '0' ][2];
|
||||||
|
if( !*(++szIt))
|
||||||
|
return xpos;
|
||||||
|
}
|
||||||
|
|
||||||
TextMessageDrawChar( xpos, ypos, *szIt, r, g, b );
|
xpos += TextMessageDrawChar( xpos, ypos, *szIt, r, g, b );
|
||||||
xpos = next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return xpos;
|
return xpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CHud :: DrawHudStringLen( char *szIt )
|
||||||
|
{
|
||||||
|
int l = 0;
|
||||||
|
for ( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
||||||
|
{
|
||||||
|
l += gHUD.m_scrinfo.charWidths[ (unsigned int)*szIt ];
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int CHud :: DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b )
|
int CHud :: DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b )
|
||||||
{
|
{
|
||||||
char szString[32];
|
char szString[32];
|
||||||
@ -210,21 +246,11 @@ int CHud :: DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int
|
|||||||
int CHud :: DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b )
|
int CHud :: DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b )
|
||||||
{
|
{
|
||||||
// find the end of the string
|
// find the end of the string
|
||||||
for ( char *szIt = szString; *szIt != 0; szIt++ )
|
for( char *szIt = szString; *szIt != 0; szIt++ )
|
||||||
{ // we should count the length?
|
xpos -= gHUD.m_scrinfo.charWidths[ (unsigned char) *szIt ];
|
||||||
}
|
if( xpos < iMinX )
|
||||||
|
xpos = iMinX;
|
||||||
// iterate throug the string in reverse
|
DrawHudString( xpos, ypos, gHUD.m_scrinfo.iWidth, szString, r, g, b );
|
||||||
for ( szIt--; szIt != (szString-1); szIt-- )
|
|
||||||
{
|
|
||||||
int next = xpos - gHUD.m_scrinfo.charWidths[ *szIt ]; // variable-width fonts look cool
|
|
||||||
if ( next < iMinX )
|
|
||||||
return xpos;
|
|
||||||
xpos = next;
|
|
||||||
|
|
||||||
TextMessageDrawChar( xpos, ypos, *szIt, r, g, b );
|
|
||||||
}
|
|
||||||
|
|
||||||
return xpos;
|
return xpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,16 +351,8 @@ int CHud::GetNumWidth( int iNumber, int iFlags )
|
|||||||
|
|
||||||
void CHud::DrawDarkRectangle( int x, int y, int wide, int tall )
|
void CHud::DrawDarkRectangle( int x, int y, int wide, int tall )
|
||||||
{
|
{
|
||||||
FillRGBA( x, y, wide, tall, 0, 0, 0, 0 );
|
//gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture );
|
||||||
float m_flScale = 1;
|
gEngfuncs.pfnFillRGBABlend( x, y, wide, tall, 0, 0, 0, 255 * 0.6 );
|
||||||
gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture );
|
|
||||||
gEngfuncs.pTriAPI->Begin(TRI_QUADS);
|
|
||||||
gEngfuncs.pTriAPI->Color4f(0.0, 0.0, 0.0, 0.6);
|
|
||||||
gEngfuncs.pTriAPI->Vertex3f(x * m_flScale, (y+tall)*m_flScale, 0);
|
|
||||||
gEngfuncs.pTriAPI->Vertex3f(x * m_flScale, y*m_flScale, 0);
|
|
||||||
gEngfuncs.pTriAPI->Vertex3f((x + wide)*m_flScale, y*m_flScale, 0);
|
|
||||||
gEngfuncs.pTriAPI->Vertex3f((x + wide)*m_flScale, (y+tall)*m_flScale, 0);
|
|
||||||
gEngfuncs.pTriAPI->End();
|
|
||||||
FillRGBA( x+1, y, wide-1, 1, 255, 140, 0, 255 );
|
FillRGBA( x+1, y, wide-1, 1, 255, 140, 0, 255 );
|
||||||
FillRGBA( x, y, 1, tall-1, 255, 140, 0, 255 );
|
FillRGBA( x, y, 1, tall-1, 255, 140, 0, 255 );
|
||||||
FillRGBA( x+wide-1, y+1, 1, tall-1, 255, 140, 0, 255 );
|
FillRGBA( x+wide-1, y+1, 1, tall-1, 255, 140, 0, 255 );
|
||||||
|
@ -406,8 +406,8 @@ int CHudSpectator::Draw(float flTime)
|
|||||||
|
|
||||||
// make sure we have player info
|
// make sure we have player info
|
||||||
//gViewPort->GetAllPlayersInfo();
|
//gViewPort->GetAllPlayersInfo();
|
||||||
gHUD.m_Scoreboard.GetAllPlayersInfo();
|
gHUD.m_Scoreboard.GetAllPlayersInfo();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// loop through all the players and draw additional infos to their sprites on the map
|
// loop through all the players and draw additional infos to their sprites on the map
|
||||||
@ -434,7 +434,7 @@ int CHudSpectator::Draw(float flTime)
|
|||||||
|
|
||||||
lx = strlen(string)*3; // 3 is avg. character length :)
|
lx = strlen(string)*3; // 3 is avg. character length :)
|
||||||
|
|
||||||
gEngfuncs.pfnDrawSetTextColor( color[0], color[1], color[2] );
|
DrawSetTextColor( color[0], color[1], color[2] );
|
||||||
DrawConsoleString( m_vPlayerPos[i][0]-lx,m_vPlayerPos[i][1], string);
|
DrawConsoleString( m_vPlayerPos[i][0]-lx,m_vPlayerPos[i][1], string);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -609,8 +609,8 @@ void CHudSpectator::FindNextPlayer(bool bReverse)
|
|||||||
|
|
||||||
// make sure we have player info
|
// make sure we have player info
|
||||||
//gViewPort->GetAllPlayersInfo();
|
//gViewPort->GetAllPlayersInfo();
|
||||||
gHUD.m_Scoreboard.GetAllPlayersInfo();
|
gHUD.m_Scoreboard.GetAllPlayersInfo();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -94,7 +94,7 @@ float MoveToward( float cur, float goal, float maxspeed )
|
|||||||
{
|
{
|
||||||
if( cur != goal )
|
if( cur != goal )
|
||||||
{
|
{
|
||||||
if( abs( cur - goal ) > 180.0 )
|
if( fabs( cur - goal ) > 180.0 )
|
||||||
{
|
{
|
||||||
if( cur < goal )
|
if( cur < goal )
|
||||||
cur += 360.0;
|
cur += 360.0;
|
||||||
@ -376,7 +376,7 @@ void DLLEXPORT CAM_Think( void )
|
|||||||
if( camAngles[ PITCH ] - viewangles[ PITCH ] != cam_idealpitch->value )
|
if( camAngles[ PITCH ] - viewangles[ PITCH ] != cam_idealpitch->value )
|
||||||
camAngles[ PITCH ] = MoveToward( camAngles[ PITCH ], cam_idealpitch->value + viewangles[ PITCH ], CAM_ANGLE_SPEED );
|
camAngles[ PITCH ] = MoveToward( camAngles[ PITCH ], cam_idealpitch->value + viewangles[ PITCH ], CAM_ANGLE_SPEED );
|
||||||
|
|
||||||
if( abs( camAngles[ 2 ] - cam_idealdist->value ) < 2.0 )
|
if( fabs( camAngles[ 2 ] - cam_idealdist->value ) < 2.0 )
|
||||||
camAngles[ 2 ] = cam_idealdist->value;
|
camAngles[ 2 ] = cam_idealdist->value;
|
||||||
else
|
else
|
||||||
camAngles[ 2 ] += ( cam_idealdist->value - camAngles[ 2 ] ) / 4.0;
|
camAngles[ 2 ] += ( cam_idealdist->value - camAngles[ 2 ] ) / 4.0;
|
||||||
@ -617,4 +617,4 @@ int DLLEXPORT CL_IsThirdPerson( void )
|
|||||||
void DLLEXPORT CL_CameraOffset( float *ofs )
|
void DLLEXPORT CL_CameraOffset( float *ofs )
|
||||||
{
|
{
|
||||||
VectorCopy( cam_ofs, ofs );
|
VectorCopy( cam_ofs, ofs );
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,12 @@ int ac_movecount;
|
|||||||
float rel_yaw;
|
float rel_yaw;
|
||||||
float rel_pitch;
|
float rel_pitch;
|
||||||
|
|
||||||
#define F 1<<0 // Forward
|
#define F 1U<<0 // Forward
|
||||||
#define B 1<<1 // Back
|
#define B 1U<<1 // Back
|
||||||
#define L 1<<2 // Left
|
#define L 1U<<2 // Left
|
||||||
#define R 1<<3 // Right
|
#define R 1U<<3 // Right
|
||||||
#define T 1<<4 // Forward stop
|
#define T 1U<<4 // Forward stop
|
||||||
#define S 1<<5 // Side stop
|
#define S 1U<<5 // Side stop
|
||||||
|
|
||||||
#define BUTTON_DOWN 1
|
#define BUTTON_DOWN 1
|
||||||
#define IMPULSE_DOWN 2
|
#define IMPULSE_DOWN 2
|
||||||
@ -58,7 +58,7 @@ float rel_pitch;
|
|||||||
|
|
||||||
void IN_ToggleButtons( float forwardmove, float sidemove )
|
void IN_ToggleButtons( float forwardmove, float sidemove )
|
||||||
{
|
{
|
||||||
static uint moveflags = T | S;
|
static unsigned int moveflags = T | S;
|
||||||
|
|
||||||
if( forwardmove )
|
if( forwardmove )
|
||||||
moveflags &= ~T;
|
moveflags &= ~T;
|
||||||
@ -180,7 +180,7 @@ void IN_Move( float frametime, usercmd_t *cmd )
|
|||||||
viewangles[YAW] += rel_yaw;
|
viewangles[YAW] += rel_yaw;
|
||||||
if( fLadder )
|
if( fLadder )
|
||||||
{
|
{
|
||||||
if( ( cl_laddermode->value == 1 ) )
|
if( cl_laddermode->value == 1 )
|
||||||
viewangles[YAW] -= ac_sidemove * 5;
|
viewangles[YAW] -= ac_sidemove * 5;
|
||||||
ac_sidemove = 0;
|
ac_sidemove = 0;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ int CHudSayText :: Draw( float flTime )
|
|||||||
// draw the first x characters in the player color
|
// draw the first x characters in the player color
|
||||||
strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+32) );
|
strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+32) );
|
||||||
buf[ min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+31) ] = 0;
|
buf[ min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+31) ] = 0;
|
||||||
gEngfuncs.pfnDrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] );
|
DrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] );
|
||||||
int x = DrawConsoleString( LINE_START, y, buf );
|
int x = DrawConsoleString( LINE_START, y, buf );
|
||||||
|
|
||||||
// color is reset after each string draw
|
// color is reset after each string draw
|
||||||
@ -309,4 +309,4 @@ void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ int SCOREBOARD_WIDTH = 320;
|
|||||||
|
|
||||||
int CHudScoreboard :: Draw( float fTime )
|
int CHudScoreboard :: Draw( float fTime )
|
||||||
{
|
{
|
||||||
int can_show_packetloss = 0;
|
int i, j, can_show_packetloss = 0;
|
||||||
int FAR_RIGHT;
|
int FAR_RIGHT;
|
||||||
gHUD.m_iNoConsolePrint &= ~( 1 << 0 );
|
gHUD.m_iNoConsolePrint &= ~( 1 << 0 );
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ int CHudScoreboard :: Draw( float fTime )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// clear out team scores
|
// clear out team scores
|
||||||
for ( int i = 1; i <= m_iNumTeams; i++ )
|
for ( i = 1; i <= m_iNumTeams; i++ )
|
||||||
{
|
{
|
||||||
if ( !g_TeamInfo[i].scores_overriden )
|
if ( !g_TeamInfo[i].scores_overriden )
|
||||||
g_TeamInfo[i].frags = g_TeamInfo[i].deaths = 0;
|
g_TeamInfo[i].frags = g_TeamInfo[i].deaths = 0;
|
||||||
@ -195,7 +195,7 @@ int CHudScoreboard :: Draw( float fTime )
|
|||||||
continue; // skip over players who are not in a team
|
continue; // skip over players who are not in a team
|
||||||
|
|
||||||
// find what team this player is in
|
// find what team this player is in
|
||||||
for ( int j = 1; j <= m_iNumTeams; j++ )
|
for ( j = 1; j <= m_iNumTeams; j++ )
|
||||||
{
|
{
|
||||||
if ( !stricmp( g_PlayerExtraInfo[i].teamname, g_TeamInfo[j].name ) )
|
if ( !stricmp( g_PlayerExtraInfo[i].teamname, g_TeamInfo[j].name ) )
|
||||||
break;
|
break;
|
||||||
@ -485,6 +485,7 @@ int CHudScoreboard :: MsgFunc_ScoreInfo( const char *pszName, int iSize, void *p
|
|||||||
// string: client team name
|
// string: client team name
|
||||||
int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf )
|
int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf )
|
||||||
{
|
{
|
||||||
|
int i, j;
|
||||||
BEGIN_READ( pbuf, iSize );
|
BEGIN_READ( pbuf, iSize );
|
||||||
short cl = READ_BYTE();
|
short cl = READ_BYTE();
|
||||||
|
|
||||||
@ -496,7 +497,7 @@ int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pb
|
|||||||
// rebuild the list of teams
|
// rebuild the list of teams
|
||||||
|
|
||||||
// clear out player counts from teams
|
// clear out player counts from teams
|
||||||
for ( int i = 1; i <= m_iNumTeams; i++ )
|
for ( i = 1; i <= m_iNumTeams; i++ )
|
||||||
{
|
{
|
||||||
g_TeamInfo[i].players = 0;
|
g_TeamInfo[i].players = 0;
|
||||||
}
|
}
|
||||||
@ -513,7 +514,7 @@ int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pb
|
|||||||
continue; // skip over players who are not in a team
|
continue; // skip over players who are not in a team
|
||||||
|
|
||||||
// is this player in an existing team?
|
// is this player in an existing team?
|
||||||
for ( int j = 1; j <= m_iNumTeams; j++ )
|
for ( j = 1; j <= m_iNumTeams; j++ )
|
||||||
{
|
{
|
||||||
if ( g_TeamInfo[j].name[0] == '\0' )
|
if ( g_TeamInfo[j].name[0] == '\0' )
|
||||||
break;
|
break;
|
||||||
@ -559,9 +560,10 @@ int CHudScoreboard :: MsgFunc_TeamScore( const char *pszName, int iSize, void *p
|
|||||||
{
|
{
|
||||||
BEGIN_READ( pbuf, iSize );
|
BEGIN_READ( pbuf, iSize );
|
||||||
char *TeamName = READ_STRING();
|
char *TeamName = READ_STRING();
|
||||||
|
int i;
|
||||||
|
|
||||||
// find the team matching the name
|
// find the team matching the name
|
||||||
for ( int i = 1; i <= m_iNumTeams; i++ )
|
for ( i = 1; i <= m_iNumTeams; i++ )
|
||||||
{
|
{
|
||||||
if ( !stricmp( TeamName, g_TeamInfo[i].name ) )
|
if ( !stricmp( TeamName, g_TeamInfo[i].name ) )
|
||||||
break;
|
break;
|
||||||
|
@ -203,7 +203,7 @@ int CHudStatusBar :: Draw( float fTime )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( m_pflNameColors[i] )
|
if ( m_pflNameColors[i] )
|
||||||
gEngfuncs.pfnDrawSetTextColor( m_pflNameColors[i][0], m_pflNameColors[i][1], m_pflNameColors[i][2] );
|
DrawSetTextColor( m_pflNameColors[i][0], m_pflNameColors[i][1], m_pflNameColors[i][2] );
|
||||||
|
|
||||||
DrawConsoleString( x, y, m_szStatusBar[i] );
|
DrawConsoleString( x, y, m_szStatusBar[i] );
|
||||||
}
|
}
|
||||||
@ -262,4 +262,4 @@ int CHudStatusBar :: MsgFunc_StatusValue( const char *pszName, int iSize, void *
|
|||||||
m_bReparseString = TRUE;
|
m_bReparseString = TRUE;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user