05 Dec 2009
This commit is contained in:
parent
6b15abe0d3
commit
198aa61892
|
@ -23,9 +23,6 @@
|
||||||
|
|
||||||
#define SPR_Load (*g_engfuncs.pfnSPR_Load)
|
#define SPR_Load (*g_engfuncs.pfnSPR_Load)
|
||||||
#define TEX_Load( x ) (*g_engfuncs.pfnLoadShader)( x, false )
|
#define TEX_Load( x ) (*g_engfuncs.pfnLoadShader)( x, false )
|
||||||
#define DrawImageExt (*g_engfuncs.pfnDrawImageExt)
|
|
||||||
#define SetColor (*g_engfuncs.pfnSetColor)
|
|
||||||
#define SetParms (*g_engfuncs.pfnSetParms)
|
|
||||||
#define SetCrosshair (*g_engfuncs.pfnSetCrosshair)
|
#define SetCrosshair (*g_engfuncs.pfnSetCrosshair)
|
||||||
|
|
||||||
#define CVAR_REGISTER (*g_engfuncs.pfnRegisterVariable)
|
#define CVAR_REGISTER (*g_engfuncs.pfnRegisterVariable)
|
||||||
|
@ -35,8 +32,8 @@
|
||||||
#define SET_KEYDEST (*g_engfuncs.pfnSetKeyDest)
|
#define SET_KEYDEST (*g_engfuncs.pfnSetKeyDest)
|
||||||
#define SERVER_COMMAND (*g_engfuncs.pfnServerCmd)
|
#define SERVER_COMMAND (*g_engfuncs.pfnServerCmd)
|
||||||
#define CLIENT_COMMAND (*g_engfuncs.pfnClientCmd)
|
#define CLIENT_COMMAND (*g_engfuncs.pfnClientCmd)
|
||||||
#define GET_PLAYER_INFO (*g_engfuncs.pfnGetPlayerInfo)
|
#define GetPlayerInfo (*g_engfuncs.pfnGetPlayerInfo)
|
||||||
#define GET_GAME_MESSAGE (*g_engfuncs.pfnTextMessageGet)
|
#define TextMessageGet (*g_engfuncs.pfnTextMessageGet)
|
||||||
#define CMD_ARGC (*g_engfuncs.pfnCmdArgc)
|
#define CMD_ARGC (*g_engfuncs.pfnCmdArgc)
|
||||||
#define CMD_ARGV (*g_engfuncs.pfnCmdArgv)
|
#define CMD_ARGV (*g_engfuncs.pfnCmdArgv)
|
||||||
#define ALERT (*g_engfuncs.pfnAlertMessage)
|
#define ALERT (*g_engfuncs.pfnAlertMessage)
|
||||||
|
@ -111,11 +108,13 @@ inline void CL_PlaySound( int iSound, float flVolume, Vector &pos, float pitch =
|
||||||
g_engfuncs.pfnPlaySoundByIndex( iSound, flVolume, pitch, pos );
|
g_engfuncs.pfnPlaySoundByIndex( iSound, flVolume, pitch, pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TextMessageDrawChar (*g_engfuncs.pfnDrawCharacter)
|
||||||
|
#define TextMessageSetColor (*g_engfuncs.pfnDrawSetTextColor)
|
||||||
|
#define DrawConsoleString (*g_engfuncs.pfnDrawConsoleString)
|
||||||
|
#define GetConsoleStringSize (*g_engfuncs.pfnDrawConsoleStringLen)
|
||||||
#define AngleVectors (*g_engfuncs.pfnAngleVectors)
|
#define AngleVectors (*g_engfuncs.pfnAngleVectors)
|
||||||
#define DrawCenterPrint (*g_engfuncs.pfnDrawCenterPrint)
|
|
||||||
#define CenterPrint (*g_engfuncs.pfnCenterPrint)
|
#define CenterPrint (*g_engfuncs.pfnCenterPrint)
|
||||||
#define DrawString (*g_engfuncs.pfnDrawString)
|
#define ConsolePrint (*g_engfuncs.pfnConsolePrint)
|
||||||
#define GetParms (*g_engfuncs.pfnGetParms)
|
|
||||||
#define GetViewAngles (*g_engfuncs.pfnGetViewAngles)
|
#define GetViewAngles (*g_engfuncs.pfnGetViewAngles)
|
||||||
#define GetEntityByIndex (*g_engfuncs.pfnGetEntityByIndex)
|
#define GetEntityByIndex (*g_engfuncs.pfnGetEntityByIndex)
|
||||||
#define GetLocalPlayer (*g_engfuncs.pfnGetLocalPlayer)
|
#define GetLocalPlayer (*g_engfuncs.pfnGetLocalPlayer)
|
||||||
|
|
|
@ -174,13 +174,16 @@ Vector READ_DIR( void )
|
||||||
return BitsToDir( READ_BYTE() );
|
return BitsToDir( READ_BYTE() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw_VidInit( void )
|
/*
|
||||||
{
|
==============================================================================
|
||||||
}
|
|
||||||
|
|
||||||
|
HUD-SPRITES PARSING
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
SPRITE_GetList
|
ParseHudSprite
|
||||||
|
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
|
@ -296,51 +299,15 @@ client_sprite_t *SPR_GetList( const char *psz, int *piCount )
|
||||||
return phud;
|
return phud;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void SPR_AdjustSize( float *x, float *y, float *w, float *h )
|
/*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
DRAW HELPERS
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
*/
|
||||||
|
void Draw_VidInit( void )
|
||||||
{
|
{
|
||||||
if( !x && !y && !w && !h ) return;
|
|
||||||
|
|
||||||
// scale for screen sizes
|
|
||||||
float xscale = gHUD.m_scrinfo.iRealWidth / (float)gHUD.m_scrinfo.iWidth;
|
|
||||||
float yscale = gHUD.m_scrinfo.iRealHeight / (float)gHUD.m_scrinfo.iHeight;
|
|
||||||
|
|
||||||
if( x ) *x *= xscale;
|
|
||||||
if( y ) *y *= yscale;
|
|
||||||
if( w ) *w *= xscale;
|
|
||||||
if( h ) *h *= yscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline static void SPR_DrawChar( HSPRITE hFont, int xpos, int ypos, int width, int height, int ch )
|
|
||||||
{
|
|
||||||
float size, frow, fcol;
|
|
||||||
float ax, ay, aw, ah;
|
|
||||||
int fontWidth, fontHeight;
|
|
||||||
|
|
||||||
ch &= 255;
|
|
||||||
|
|
||||||
if( ch == ' ' ) return;
|
|
||||||
if( ypos < -height ) return;
|
|
||||||
|
|
||||||
ax = xpos;
|
|
||||||
ay = ypos;
|
|
||||||
aw = width;
|
|
||||||
ah = height;
|
|
||||||
|
|
||||||
SPR_AdjustSize( &ax, &ay, &aw, &ah );
|
|
||||||
GetParms( &fontWidth, &fontHeight, NULL, 0, hFont );
|
|
||||||
|
|
||||||
frow = (ch >> 4) * 0.0625f + (0.5f / (float)fontWidth);
|
|
||||||
fcol = (ch & 15) * 0.0625f + (0.5f / (float)fontHeight);
|
|
||||||
size = 0.0625f - (1.0f / (float)fontWidth);
|
|
||||||
|
|
||||||
DrawImageExt( hFont, ax, ay, aw, ah, fcol, frow, fcol + size, frow + size );
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextMessageDrawChar( int xpos, int ypos, int number, int r, int g, int b )
|
|
||||||
{
|
|
||||||
// tune char size by taste
|
|
||||||
SetColor( r, g, b, 255 );
|
|
||||||
SPR_DrawChar( gHUD.m_hHudFont, xpos, ypos, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, number );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawPause( void )
|
void DrawPause( void )
|
||||||
|
@ -387,7 +354,7 @@ void DrawProgressBar( void )
|
||||||
DrawImageBar( CVAR_GET_FLOAT( "scr_loading" ), "m_loading" );
|
DrawImageBar( CVAR_GET_FLOAT( "scr_loading" ), "m_loading" );
|
||||||
|
|
||||||
if( !CVAR_GET_FLOAT( "scr_download" )) return;
|
if( !CVAR_GET_FLOAT( "scr_download" )) return;
|
||||||
DrawImageBar( CVAR_GET_FLOAT( "scr_download" ), "m_download", (ScreenWidth-128)/2, ScreenHeight-60 );
|
DrawImageBar( CVAR_GET_FLOAT( "scr_download" ), "m_download", (ScreenWidth - 128)>>1, ScreenHeight - 60 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -598,34 +565,12 @@ void* Sys_GetProcAddress( dllhandle_t handle, const char* name )
|
||||||
return (void *)GET_PROC_ADDRESS( handle, name );
|
return (void *)GET_PROC_ADDRESS( handle, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
============
|
|
||||||
va
|
|
||||||
|
|
||||||
does a varargs printf into a temp buffer, so I don't need to have
|
|
||||||
varargs versions of all text functions.
|
|
||||||
FIXME: make this buffer size safe someday
|
|
||||||
============
|
|
||||||
*/
|
|
||||||
char *va( const char *format, ... )
|
|
||||||
{
|
|
||||||
va_list argptr;
|
|
||||||
static char string[32][1024], *s;
|
|
||||||
static int stringindex = 0;
|
|
||||||
|
|
||||||
s = string[stringindex];
|
|
||||||
stringindex = (stringindex + 1) & 31;
|
|
||||||
va_start( argptr, format );
|
|
||||||
_vsnprintf( s, sizeof( string[0] ), format, argptr );
|
|
||||||
va_end( argptr );
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
COM_ParseToken
|
COM_ParseToken
|
||||||
|
|
||||||
Parse a token out of a string
|
Parse a token out of a string
|
||||||
|
FIXME: move into engine
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
char *COM_ParseToken( const char **data_p )
|
char *COM_ParseToken( const char **data_p )
|
||||||
|
|
|
@ -120,39 +120,9 @@ inline byte LerpByte( byte oldpoint, byte curpoint, float frac )
|
||||||
|
|
||||||
inline int ConsoleStringLen( const char *string )
|
inline int ConsoleStringLen( const char *string )
|
||||||
{
|
{
|
||||||
// console using fixed font size
|
int _width, _height;
|
||||||
return strlen( string ) * SMALLCHAR_WIDTH;
|
GetConsoleStringSize( string, &_width, &_height );
|
||||||
}
|
return _width;
|
||||||
|
|
||||||
inline void GetConsoleStringSize( const char *string, int *width, int *height )
|
|
||||||
{
|
|
||||||
// console using fixed font size
|
|
||||||
if( width ) *width = ConsoleStringLen( string );
|
|
||||||
if( height ) *height = SMALLCHAR_HEIGHT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// simple huh ?
|
|
||||||
inline int DrawConsoleString( int x, int y, const char *string )
|
|
||||||
{
|
|
||||||
DrawString( x, y, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, string );
|
|
||||||
|
|
||||||
return ConsoleStringLen( string );
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ConsolePrint( const char *string )
|
|
||||||
{
|
|
||||||
ALERT( at_console, "%s", string );
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns the players name of entity no.
|
|
||||||
inline void GetPlayerInfo( int ent_num, hud_player_info_t *pinfo )
|
|
||||||
{
|
|
||||||
GET_PLAYER_INFO( ent_num, pinfo );
|
|
||||||
}
|
|
||||||
|
|
||||||
inline client_textmessage_t *TextMessageGet( const char *pName )
|
|
||||||
{
|
|
||||||
return GET_GAME_MESSAGE( pName );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern Vector BitsToDir( int bits );
|
extern Vector BitsToDir( int bits );
|
||||||
|
@ -174,7 +144,6 @@ extern void END_READ( void );
|
||||||
// drawing stuff
|
// drawing stuff
|
||||||
extern client_sprite_t *SPR_GetList( const char *name, int *count );
|
extern client_sprite_t *SPR_GetList( const char *name, int *count );
|
||||||
extern void ParseHudSprite( const char **pfile, char *psz, client_sprite_t *result );
|
extern void ParseHudSprite( const char **pfile, char *psz, client_sprite_t *result );
|
||||||
extern void TextMessageDrawChar( int xpos, int ypos, int number, int r, int g, int b );
|
|
||||||
extern void DrawPause( void );
|
extern void DrawPause( void );
|
||||||
extern void SetScreenFade( Vector fadeColor, float alpha, float duration, float holdTime, int fadeFlags );
|
extern void SetScreenFade( Vector fadeColor, float alpha, float duration, float holdTime, int fadeFlags );
|
||||||
extern void ClearAllFades( void );
|
extern void ClearAllFades( void );
|
||||||
|
@ -193,7 +162,6 @@ extern int v_paused;
|
||||||
extern float v_idlescale;
|
extern float v_idlescale;
|
||||||
|
|
||||||
// stdio stuff
|
// stdio stuff
|
||||||
extern char *va( const char *format, ... );
|
|
||||||
char *COM_ParseToken( const char **data_p );
|
char *COM_ParseToken( const char **data_p );
|
||||||
|
|
||||||
// dlls stuff
|
// dlls stuff
|
||||||
|
|
|
@ -274,7 +274,8 @@ void V_CalcGunAngle( ref_params_t *pparams )
|
||||||
viewent->v.effects |= EF_MINLIGHT;
|
viewent->v.effects |= EF_MINLIGHT;
|
||||||
|
|
||||||
viewent->v.angles[YAW] = pparams->viewangles[YAW] + pparams->crosshairangle[YAW];
|
viewent->v.angles[YAW] = pparams->viewangles[YAW] + pparams->crosshairangle[YAW];
|
||||||
viewent->v.angles[PITCH] = pparams->viewangles[PITCH] + pparams->crosshairangle[PITCH] * 0.25;
|
viewent->v.angles[PITCH] = pparams->viewangles[PITCH] - pparams->crosshairangle[PITCH] * 0.25;
|
||||||
|
viewent->v.angles[ROLL] = pparams->viewangles[ROLL];
|
||||||
viewent->v.angles[ROLL] -= v_idlescale * sin(pparams->time * v_iroll_cycle->value) * v_iroll_level->value;
|
viewent->v.angles[ROLL] -= v_idlescale * sin(pparams->time * v_iroll_cycle->value) * v_iroll_level->value;
|
||||||
|
|
||||||
// don't apply all of the v_ipitch to prevent normally unseen parts of viewmodel from coming into view.
|
// don't apply all of the v_ipitch to prevent normally unseen parts of viewmodel from coming into view.
|
||||||
|
|
|
@ -72,7 +72,6 @@ void CHud :: VidInit( void )
|
||||||
|
|
||||||
m_hsprCursor = 0;
|
m_hsprCursor = 0;
|
||||||
m_hHudError = 0;
|
m_hHudError = 0;
|
||||||
m_hHudFont = 0;
|
|
||||||
spot = NULL; // clear intermission spot
|
spot = NULL; // clear intermission spot
|
||||||
|
|
||||||
Draw_VidInit ();
|
Draw_VidInit ();
|
||||||
|
@ -133,7 +132,6 @@ void CHud :: VidInit( void )
|
||||||
// loading error sprite
|
// loading error sprite
|
||||||
m_HUD_error = GetSpriteIndex( "error" );
|
m_HUD_error = GetSpriteIndex( "error" );
|
||||||
m_hHudError = GetSprite( m_HUD_error );
|
m_hHudError = GetSprite( m_HUD_error );
|
||||||
m_hHudFont = GetSprite( GetSpriteIndex( "hud_font" ));
|
|
||||||
|
|
||||||
// loading TE shaders
|
// loading TE shaders
|
||||||
m_hDefaultParticle = TEX_Load( "textures/particles/default" );
|
m_hDefaultParticle = TEX_Load( "textures/particles/default" );
|
||||||
|
|
|
@ -702,7 +702,6 @@ public:
|
||||||
// error sprite
|
// error sprite
|
||||||
int m_HUD_error;
|
int m_HUD_error;
|
||||||
HSPRITE m_hHudError;
|
HSPRITE m_hHudError;
|
||||||
HSPRITE m_hHudFont;
|
|
||||||
|
|
||||||
// some const shaders
|
// some const shaders
|
||||||
HSPRITE m_hDefaultParticle;
|
HSPRITE m_hDefaultParticle;
|
||||||
|
|
|
@ -176,7 +176,7 @@ void *fmod_data = NULL;
|
||||||
static char songname[256];
|
static char songname[256];
|
||||||
int last_state = 0;
|
int last_state = 0;
|
||||||
|
|
||||||
int CheckFormat( BOOL skip_buffer )
|
static int CheckFormat( BOOL skip_buffer )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ int CheckFormat( BOOL skip_buffer )
|
||||||
// detect of music type
|
// detect of music type
|
||||||
for( i = 0; songname[i]; i++ )
|
for( i = 0; songname[i]; i++ )
|
||||||
{
|
{
|
||||||
if( songname[i] == '.' )//found extension
|
if( songname[i] == '.' ) // found extension
|
||||||
{
|
{
|
||||||
if( !strncmp( &songname[i+1], "mp3", 3 )) return STREAM;
|
if( !strncmp( &songname[i+1], "mp3", 3 )) return STREAM;
|
||||||
else if( !strncmp(&songname[i+1], "wma", 3 )) return STREAM;
|
else if( !strncmp(&songname[i+1], "wma", 3 )) return STREAM;
|
||||||
|
@ -251,7 +251,7 @@ int CHudSound :: MsgFunc_Fsound( const char *pszName, int iSize, void *pbuf )
|
||||||
|
|
||||||
BEGIN_READ( pszName, iSize, pbuf );
|
BEGIN_READ( pszName, iSize, pbuf );
|
||||||
|
|
||||||
strcpy( songname, va( "media/%s", READ_STRING( ))); // songname
|
sprintf( songname, "media/%s", READ_STRING( )); // songname
|
||||||
m_iTime = READ_SHORT(); // song position
|
m_iTime = READ_SHORT(); // song position
|
||||||
m_iStatus = READ_BYTE();
|
m_iStatus = READ_BYTE();
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ int CHudSound :: MsgFunc_Fsound( const char *pszName, int iSize, void *pbuf )
|
||||||
{
|
{
|
||||||
if( CheckFormat( FALSE ) == TRACK ) qfmod_freesong( fmod_data );
|
if( CheckFormat( FALSE ) == TRACK ) qfmod_freesong( fmod_data );
|
||||||
else if( CheckFormat( FALSE ) == STREAM ) qfmod_freestream( fmod_data );
|
else if( CheckFormat( FALSE ) == STREAM ) qfmod_freestream( fmod_data );
|
||||||
memset( (char*)songname, 0, sizeof( songname ));
|
memset( songname, 0, sizeof( songname ));
|
||||||
fmod_data = NULL;
|
fmod_data = NULL;
|
||||||
m_iTime = 0;
|
m_iTime = 0;
|
||||||
m_iStatus = 0;
|
m_iStatus = 0;
|
||||||
|
|
|
@ -182,7 +182,7 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf
|
||||||
{
|
{
|
||||||
case HUD_PRINTCENTER:
|
case HUD_PRINTCENTER:
|
||||||
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
|
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
|
||||||
CenterPrint( ConvertCRtoNL( psz ), 240.0f, BIGCHAR_WIDTH );
|
CenterPrint( ConvertCRtoNL( psz ) );
|
||||||
break;
|
break;
|
||||||
case HUD_PRINTNOTIFY:
|
case HUD_PRINTNOTIFY:
|
||||||
psz[0] = 1; // mark this message to go into the notify buffer
|
psz[0] = 1; // mark this message to go into the notify buffer
|
||||||
|
|
|
@ -128,38 +128,19 @@ typedef struct cl_enginefuncs_s
|
||||||
int (*pfnGetScreenInfo)( SCREENINFO *pscrinfo );
|
int (*pfnGetScreenInfo)( SCREENINFO *pscrinfo );
|
||||||
void (*pfnSetCrosshair)( HSPRITE hspr, wrect_t rc, int r, int g, int b );
|
void (*pfnSetCrosshair)( HSPRITE hspr, wrect_t rc, int r, int g, int b );
|
||||||
|
|
||||||
// engine memory manager
|
|
||||||
void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
|
||||||
void (*pfnMemCopy)( void *dest, const void *src, size_t cb, const char *filename, const int fileline );
|
|
||||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
|
||||||
|
|
||||||
// screen handlers
|
|
||||||
HSPRITE (*pfnLoadShader)( const char *szShaderName, int fShaderNoMip );
|
|
||||||
void (*pfnDrawImageExt)( HSPRITE shader, float x, float y, float w, float h, float s1, float t1, float s2, float t2 );
|
|
||||||
void (*pfnSetColor)( byte r, byte g, byte b, byte a );
|
|
||||||
|
|
||||||
// cvar handlers
|
// cvar handlers
|
||||||
cvar_t* (*pfnRegisterVariable)( const char *szName, const char *szValue, int flags, const char *szDesc );
|
cvar_t* (*pfnRegisterVariable)( const char *szName, const char *szValue, int flags, const char *szDesc );
|
||||||
void (*pfnCvarSetString)( const char *szName, const char *szValue );
|
|
||||||
void (*pfnCvarSetValue)( const char *szName, float flValue );
|
|
||||||
float (*pfnGetCvarFloat)( const char *szName );
|
float (*pfnGetCvarFloat)( const char *szName );
|
||||||
char* (*pfnGetCvarString)( const char *szName );
|
char* (*pfnGetCvarString)( const char *szName );
|
||||||
|
|
||||||
// command handlers
|
// command handlers
|
||||||
void (*pfnAddCommand)( const char *cmd_name, void (*function)(void), const char *cmd_desc );
|
void (*pfnAddCommand)( const char *cmd_name, void (*function)(void), const char *cmd_desc );
|
||||||
void (*pfnHookUserMsg)( const char *szMsgName, pfnUserMsgHook pfn );
|
void (*pfnHookUserMsg)( const char *szMsgName, pfnUserMsgHook pfn );
|
||||||
void (*pfnDelCommand)( const char *cmd_name );
|
|
||||||
void (*pfnServerCmd)( const char *szCmdString );
|
void (*pfnServerCmd)( const char *szCmdString );
|
||||||
void (*pfnClientCmd)( const char *szCmdString );
|
void (*pfnClientCmd)( const char *szCmdString );
|
||||||
void (*pfnSetKeyDest)( int key_dest );
|
|
||||||
|
|
||||||
void (*pfnGetPlayerInfo)( int player_num, hud_player_info_t *pinfo );
|
void (*pfnGetPlayerInfo)( int player_num, hud_player_info_t *pinfo );
|
||||||
client_textmessage_t *(*pfnTextMessageGet)( const char *pName );
|
|
||||||
|
|
||||||
int (*pfnCmdArgc)( void );
|
|
||||||
char* (*pfnCmdArgv)( int argc );
|
|
||||||
void (*pfnAlertMessage)( ALERT_TYPE, char *szFmt, ... );
|
|
||||||
|
|
||||||
// sound handlers (NULL origin == play at current client origin)
|
// sound handlers (NULL origin == play at current client origin)
|
||||||
void (*pfnPlaySoundByName)( const char *szSound, float volume, int pitch, const float *org );
|
void (*pfnPlaySoundByName)( const char *szSound, float volume, int pitch, const float *org );
|
||||||
void (*pfnPlaySoundByIndex)( int iSound, float volume, int pitch, const float *org );
|
void (*pfnPlaySoundByIndex)( int iSound, float volume, int pitch, const float *org );
|
||||||
|
@ -167,11 +148,33 @@ typedef struct cl_enginefuncs_s
|
||||||
// vector helpers
|
// vector helpers
|
||||||
void (*pfnAngleVectors)( const float *rgflVector, float *forward, float *right, float *up );
|
void (*pfnAngleVectors)( const float *rgflVector, float *forward, float *right, float *up );
|
||||||
|
|
||||||
void (*pfnDrawCenterPrint)( void );
|
// text message system
|
||||||
void (*pfnCenterPrint)( const char *text, int y, int charWidth );
|
client_textmessage_t *(*pfnTextMessageGet)( const char *pName );
|
||||||
void (*pfnDrawString)( int x, int y, int width, int height, const char *text );
|
int (*pfnDrawCharacter)( int x, int y, int number, int r, int g, int b );
|
||||||
void (*pfnGetParms)( int *w, int *h, int *frames, int frame, shader_t shader );
|
int (*pfnDrawConsoleString)( int x, int y, char *string );
|
||||||
void (*pfnSetParms)( shader_t handle, kRenderMode_t rendermode, int frame );
|
void (*pfnDrawSetTextColor)( float r, float g, float b );
|
||||||
|
void (*pfnDrawConsoleStringLen)( const char *string, int *length, int *height );
|
||||||
|
|
||||||
|
void (*pfnConsolePrint)( const char *string );
|
||||||
|
void (*pfnCenterPrint)( const char *string );
|
||||||
|
|
||||||
|
// engine memory manager
|
||||||
|
void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
||||||
|
void (*pfnMemCopy)( void *dest, const void *src, size_t cb, const char *filename, const int fileline );
|
||||||
|
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
||||||
|
|
||||||
|
// screen handlers
|
||||||
|
HSPRITE (*pfnLoadShader)( const char *szShaderName, int fShaderNoMip );
|
||||||
|
|
||||||
|
void (*pfnCvarSetString)( const char *szName, const char *szValue );
|
||||||
|
void (*pfnCvarSetValue)( const char *szName, float flValue );
|
||||||
|
|
||||||
|
void (*pfnDelCommand)( const char *cmd_name );
|
||||||
|
void (*pfnSetKeyDest)( int key_dest );
|
||||||
|
|
||||||
|
int (*pfnCmdArgc)( void );
|
||||||
|
char* (*pfnCmdArgv)( int argc );
|
||||||
|
void (*pfnAlertMessage)( ALERT_TYPE, char *szFmt, ... );
|
||||||
|
|
||||||
// local client handlers
|
// local client handlers
|
||||||
void (*pfnGetViewAngles)( float *angles );
|
void (*pfnGetViewAngles)( float *angles );
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
#define ATTN_NORM 0.8f
|
#define ATTN_NORM 0.8f
|
||||||
#define ATTN_IDLE 2.0f
|
#define ATTN_IDLE 2.0f
|
||||||
#define ATTN_STATIC 1.25f
|
#define ATTN_STATIC 1.25f
|
||||||
#define ATTN_RICOCHET 1.5f
|
|
||||||
#define ATTN_GUNFIRE 0.27f
|
|
||||||
|
|
||||||
// common conversion tools
|
// common conversion tools
|
||||||
#define ATTN_TO_SNDLVL( a ) (int)((a) ? (50 + 20 / ((float)a)) : 0 )
|
#define ATTN_TO_SNDLVL( a ) (int)((a) ? (50 + 20 / ((float)a)) : 0 )
|
||||||
|
|
|
@ -118,7 +118,7 @@ typedef struct enginefuncs_s
|
||||||
void (*pfnWriteEntity)( int iValue );
|
void (*pfnWriteEntity)( int iValue );
|
||||||
cvar_t* (*pfnCVarRegister)( const char *name, const char *value, int flags, const char *desc );
|
cvar_t* (*pfnCVarRegister)( const char *name, const char *value, int flags, const char *desc );
|
||||||
float (*pfnCVarGetFloat)( const char *szVarName );
|
float (*pfnCVarGetFloat)( const char *szVarName );
|
||||||
const char* (*pfnCVarGetString)( const char *szVarName );
|
char* (*pfnCVarGetString)( const char *szVarName );
|
||||||
void (*pfnCVarSetFloat)( const char *szVarName, float flValue );
|
void (*pfnCVarSetFloat)( const char *szVarName, float flValue );
|
||||||
void (*pfnCVarSetString)( const char *szVarName, const char *szValue );
|
void (*pfnCVarSetString)( const char *szVarName, const char *szValue );
|
||||||
void (*pfnAlertMessage)( ALERT_TYPE level, char *szFmt, ... );
|
void (*pfnAlertMessage)( ALERT_TYPE level, char *szFmt, ... );
|
||||||
|
|
|
@ -202,8 +202,8 @@ CL_ParseFrame
|
||||||
*/
|
*/
|
||||||
void CL_ParseFrame( sizebuf_t *msg )
|
void CL_ParseFrame( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int i, cmd, len, idx;
|
int cmd, len, idx;
|
||||||
edict_t *clent;
|
edict_t *clent;
|
||||||
|
|
||||||
Mem_Set( &cl.frame, 0, sizeof( cl.frame ));
|
Mem_Set( &cl.frame, 0, sizeof( cl.frame ));
|
||||||
|
|
||||||
|
@ -212,10 +212,6 @@ void CL_ParseFrame( sizebuf_t *msg )
|
||||||
cl.serverframetime = MSG_ReadLong( msg );
|
cl.serverframetime = MSG_ReadLong( msg );
|
||||||
cl.frame.deltaframe = MSG_ReadLong( msg );
|
cl.frame.deltaframe = MSG_ReadLong( msg );
|
||||||
cl.surpressCount = MSG_ReadByte( msg );
|
cl.surpressCount = MSG_ReadByte( msg );
|
||||||
cl.frame.recvtime = cls.realtime;
|
|
||||||
|
|
||||||
for( i = 0; i < cl.surpressCount; i++ )
|
|
||||||
cl.frames[(cls.netchan.incoming_acknowledged - 1 - i) & UPDATE_MASK ].recvtime = -2;
|
|
||||||
|
|
||||||
// If the frame is delta compressed from data that we
|
// If the frame is delta compressed from data that we
|
||||||
// no longer have available, we must suck up the rest of
|
// no longer have available, we must suck up the rest of
|
||||||
|
|
|
@ -129,6 +129,122 @@ prevframe_t *CL_GetPrevFrame( int entityIndex )
|
||||||
return &pEnt->pvClientData->latched;
|
return &pEnt->pvClientData->latched;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
================
|
||||||
|
CL_FadeAlpha
|
||||||
|
================
|
||||||
|
*/
|
||||||
|
void CL_FadeAlpha( int starttime, int endtime, rgba_t color )
|
||||||
|
{
|
||||||
|
int time, fade_time;
|
||||||
|
|
||||||
|
if( starttime == 0 )
|
||||||
|
{
|
||||||
|
MakeRGBA( color, 255, 255, 255, 255 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
time = cls.realtime - starttime;
|
||||||
|
|
||||||
|
if( time >= endtime )
|
||||||
|
{
|
||||||
|
MakeRGBA( color, 255, 255, 255, 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fade time is 1/4 of endtime
|
||||||
|
fade_time = endtime / 4;
|
||||||
|
fade_time = bound( 300, fade_time, 10000 );
|
||||||
|
|
||||||
|
color[0] = color[1] = color[2] = 255;
|
||||||
|
|
||||||
|
// fade out
|
||||||
|
if(( endtime - time ) < fade_time )
|
||||||
|
color[3] = bound( 0, ((endtime - time) * 1.0f / fade_time) * 255, 255 );
|
||||||
|
else color[3] = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
CL_DrawCenterPrint
|
||||||
|
|
||||||
|
called each frame
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
void CL_DrawCenterPrint( void )
|
||||||
|
{
|
||||||
|
char *start;
|
||||||
|
int l, x, y, w;
|
||||||
|
rgba_t color;
|
||||||
|
|
||||||
|
if( !re || !clgame.ds.centerPrintTime ) return;
|
||||||
|
|
||||||
|
CL_FadeAlpha( clgame.ds.centerPrintTime, scr_centertime->value * 1000, color );
|
||||||
|
|
||||||
|
if( *(int *)color == 0x00FFFFFF )
|
||||||
|
{
|
||||||
|
// faded out
|
||||||
|
clgame.ds.centerPrintTime = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
re->SetColor( color );
|
||||||
|
start = clgame.ds.centerPrint;
|
||||||
|
y = clgame.ds.centerPrintY - clgame.ds.centerPrintLines * BIGCHAR_HEIGHT / 2;
|
||||||
|
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
char linebuffer[1024];
|
||||||
|
|
||||||
|
for( l = 0; l < 50; l++ )
|
||||||
|
{
|
||||||
|
if( !start[l] || start[l] == '\n' )
|
||||||
|
break;
|
||||||
|
linebuffer[l] = start[l];
|
||||||
|
}
|
||||||
|
linebuffer[l] = 0;
|
||||||
|
|
||||||
|
w = clgame.ds.centerPrintCharWidth * com.cstrlen( linebuffer );
|
||||||
|
x = (SCREEN_WIDTH - w)>>1;
|
||||||
|
|
||||||
|
SCR_DrawStringExt( x, y, clgame.ds.centerPrintCharWidth, SMALLCHAR_HEIGHT, linebuffer, color, false );
|
||||||
|
|
||||||
|
y += clgame.ds.centerPrintCharWidth * 1.5;
|
||||||
|
while( *start && ( *start != '\n' )) start++;
|
||||||
|
if( !*start ) break;
|
||||||
|
start++;
|
||||||
|
}
|
||||||
|
re->SetColor( NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
CL_CenterPrint
|
||||||
|
|
||||||
|
print centerscreen message
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
void CL_CenterPrint( const char *text, int y, int charWidth )
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
|
||||||
|
com.strncpy( clgame.ds.centerPrint, text, sizeof( clgame.ds.centerPrint ));
|
||||||
|
clgame.ds.centerPrintTime = cls.realtime;
|
||||||
|
clgame.ds.centerPrintCharWidth = charWidth;
|
||||||
|
clgame.ds.centerPrintY = y;
|
||||||
|
|
||||||
|
// count the number of lines for centering
|
||||||
|
clgame.ds.centerPrintLines = 1;
|
||||||
|
s = clgame.ds.centerPrint;
|
||||||
|
|
||||||
|
while( *s )
|
||||||
|
{
|
||||||
|
if( *s == '\n' )
|
||||||
|
clgame.ds.centerPrintLines++;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
SPR_AdjustSize
|
SPR_AdjustSize
|
||||||
|
@ -404,86 +520,69 @@ int CL_GetMaxClients( void )
|
||||||
return clgame.globals->maxClients;
|
return clgame.globals->maxClients;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
================
|
|
||||||
CL_FadeAlpha
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
void CL_FadeAlpha( float starttime, float endtime, rgba_t color )
|
|
||||||
{
|
|
||||||
float time, fade_time;
|
|
||||||
|
|
||||||
if( starttime == 0 )
|
|
||||||
{
|
|
||||||
MakeRGBA( color, 255, 255, 255, 255 );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
time = (cls.realtime * 0.001f) - starttime;
|
|
||||||
if( time >= endtime )
|
|
||||||
{
|
|
||||||
MakeRGBA( color, 255, 255, 255, 0 );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// fade time is 1/4 of endtime
|
|
||||||
fade_time = endtime / 4;
|
|
||||||
fade_time = bound( 0.3f, fade_time, 10.0f );
|
|
||||||
|
|
||||||
color[0] = color[1] = color[2] = 255;
|
|
||||||
|
|
||||||
// fade out
|
|
||||||
if(( endtime - time ) < fade_time )
|
|
||||||
color[3] = bound( 0, ((endtime - time) * 1.0f / fade_time) * 255, 255 );
|
|
||||||
else color[3] = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CL_DrawCrosshair( void )
|
void CL_DrawCrosshair( void )
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y, width, height;
|
||||||
|
edict_t *pPlayer;
|
||||||
|
|
||||||
if( !re || clgame.ds.hCrosshair <= 0 || cl.refdef.crosshairangle[2] || !cl_crosshair->integer )
|
if( !re || clgame.ds.hCrosshair <= 0 || cl.refdef.crosshairangle[2] || !cl_crosshair->integer )
|
||||||
return;
|
return;
|
||||||
#if 0
|
|
||||||
if ( pPlayer && !pPlayer->IsAlive() )
|
pPlayer = CL_GetLocalPlayer();
|
||||||
|
|
||||||
|
if( pPlayer->v.health <= 0.0f || pPlayer->v.flags & FL_FROZEN )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_curViewAngles = CurrentViewAngles();
|
// camera on
|
||||||
m_curViewOrigin = CurrentViewOrigin();
|
if( pPlayer->serialnumber != cl.refdef.viewentity )
|
||||||
|
return;
|
||||||
|
|
||||||
float x, y;
|
// get crosshair dimension
|
||||||
QAngle angles;
|
width = clgame.ds.rcCrosshair.right - clgame.ds.rcCrosshair.left;
|
||||||
Vector forward;
|
height = clgame.ds.rcCrosshair.bottom - clgame.ds.rcCrosshair.top;
|
||||||
Vector point, screen;
|
|
||||||
|
|
||||||
x = ScreenWidth()/2;
|
// g-cont - cl.refdef.crosshairangle is the autoaim angle.
|
||||||
y = ScreenHeight()/2;
|
// if we're not using autoaim, just draw in the middle of the
|
||||||
|
// screen
|
||||||
|
if( !VectorIsNull( cl.refdef.crosshairangle ))
|
||||||
|
{
|
||||||
|
vec3_t angles;
|
||||||
|
vec3_t forward;
|
||||||
|
vec3_t point, screen;
|
||||||
|
|
||||||
// this code is wrong
|
// FIXME: this code is wrong
|
||||||
angles = m_curViewAngles + m_vecCrossHairOffsetAngle;
|
VectorAdd( cl.refdef.cl_viewangles, cl.refdef.crosshairangle, angles );
|
||||||
AngleVectors( angles, &forward );
|
AngleVectors( angles, forward, NULL, NULL );
|
||||||
VectorAdd( m_curViewOrigin, forward, point );
|
VectorAdd( cl.refdef.vieworg, forward, point );
|
||||||
ScreenTransform( point, screen );
|
re->WorldToScreen( point, screen );
|
||||||
|
|
||||||
x += 0.5f * screen[0] * ScreenWidth() + 0.5f;
|
if( clgame.scrInfo.iFlags & SCRINFO_VIRTUALSPACE )
|
||||||
y += 0.5f * screen[1] * ScreenHeight() + 0.5f;
|
{
|
||||||
|
float xscale, yscale;
|
||||||
m_pCrosshair->DrawSelf(
|
|
||||||
x - 0.5f * m_pCrosshair->Width(),
|
// NOTE: WorldToScreen returns real coordinates, we need to divide it
|
||||||
y - 0.5f * m_pCrosshair->Height(),
|
// into virtual screenspace
|
||||||
m_clrCrosshair );
|
xscale = clgame.scrInfo.iRealWidth / (float)clgame.scrInfo.iWidth;
|
||||||
#endif
|
yscale = clgame.scrInfo.iRealHeight / (float)clgame.scrInfo.iHeight;
|
||||||
|
x = screen[0] / xscale;
|
||||||
x = (clgame.scrInfo.iWidth - (clgame.ds.rcCrosshair.right - clgame.ds.rcCrosshair.left)) / 2;
|
y = screen[1] / yscale;
|
||||||
y = (clgame.scrInfo.iHeight - (clgame.ds.rcCrosshair.bottom - clgame.ds.rcCrosshair.top)) / 2;
|
}
|
||||||
|
else
|
||||||
// FIXME: apply crosshair angles properly
|
{
|
||||||
x += cl.refdef.crosshairangle[0];
|
x = screen[0];
|
||||||
y += cl.refdef.crosshairangle[1];
|
y = screen[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = clgame.scrInfo.iWidth / 2;
|
||||||
|
y = clgame.scrInfo.iHeight / 2;
|
||||||
|
}
|
||||||
|
|
||||||
clgame.ds.hSprite = clgame.ds.hCrosshair;
|
clgame.ds.hSprite = clgame.ds.hCrosshair;
|
||||||
re->SetColor( clgame.ds.rgbaCrosshair );
|
re->SetColor( clgame.ds.rgbaCrosshair );
|
||||||
re->SetParms( clgame.ds.hSprite, kRenderTransAlpha, 0 );
|
re->SetParms( clgame.ds.hSprite, kRenderTransAlpha, 0 );
|
||||||
SPR_DrawGeneric( 0, x, y, -1, -1, &clgame.ds.rcCrosshair );
|
SPR_DrawGeneric( 0, x - 0.5f * width, y - 0.5f * height, -1, -1, &clgame.ds.rcCrosshair );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_DrawHUD( int state )
|
void CL_DrawHUD( int state )
|
||||||
|
@ -497,7 +596,10 @@ void CL_DrawHUD( int state )
|
||||||
clgame.dllFuncs.pfnRedraw( cl.time * 0.001f, state );
|
clgame.dllFuncs.pfnRedraw( cl.time * 0.001f, state );
|
||||||
|
|
||||||
if( state == CL_ACTIVE || state == CL_PAUSED )
|
if( state == CL_ACTIVE || state == CL_PAUSED )
|
||||||
CL_DrawCrosshair();
|
{
|
||||||
|
CL_DrawCrosshair ();
|
||||||
|
CL_DrawCenterPrint ();
|
||||||
|
}
|
||||||
|
|
||||||
if( state == CL_ACTIVE )
|
if( state == CL_ACTIVE )
|
||||||
clgame.dllFuncs.pfnFrame( cl.time * 0.001f );
|
clgame.dllFuncs.pfnFrame( cl.time * 0.001f );
|
||||||
|
@ -844,7 +946,7 @@ pfnSPR_Load
|
||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
HSPRITE pfnSPR_Load( const char *szPicName )
|
static HSPRITE pfnSPR_Load( const char *szPicName )
|
||||||
{
|
{
|
||||||
if( !re ) return 0; // render not initialized
|
if( !re ) return 0; // render not initialized
|
||||||
if( !szPicName || !*szPicName )
|
if( !szPicName || !*szPicName )
|
||||||
|
@ -1066,17 +1168,21 @@ static int pfnGetScreenInfo( SCREENINFO *pscrinfo )
|
||||||
// see cl_screen.c from Quake3 code for more details
|
// see cl_screen.c from Quake3 code for more details
|
||||||
clgame.scrInfo.iWidth = SCREEN_WIDTH;
|
clgame.scrInfo.iWidth = SCREEN_WIDTH;
|
||||||
clgame.scrInfo.iHeight = SCREEN_HEIGHT;
|
clgame.scrInfo.iHeight = SCREEN_HEIGHT;
|
||||||
|
clgame.scrInfo.iFlags |= SCRINFO_VIRTUALSPACE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clgame.scrInfo.iWidth = scr_width->integer;
|
clgame.scrInfo.iWidth = scr_width->integer;
|
||||||
clgame.scrInfo.iHeight = scr_height->integer;
|
clgame.scrInfo.iHeight = scr_height->integer;
|
||||||
|
clgame.scrInfo.iFlags &= ~SCRINFO_VIRTUALSPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: build real table of fonts widthInChars
|
// TODO: build real table of fonts widthInChars
|
||||||
|
// TODO: load half-life credits font from wad
|
||||||
for( i = 0; i < 256; i++ )
|
for( i = 0; i < 256; i++ )
|
||||||
clgame.scrInfo.charWidths[i] = SMALLCHAR_WIDTH;
|
clgame.scrInfo.charWidths[i] = SMALLCHAR_WIDTH;
|
||||||
clgame.scrInfo.iCharHeight = SMALLCHAR_HEIGHT;
|
clgame.scrInfo.iCharHeight = SMALLCHAR_HEIGHT;
|
||||||
|
clgame.ds.hHudFont = cls.clientFont;
|
||||||
|
|
||||||
if( !pscrinfo ) return 0;
|
if( !pscrinfo ) return 0;
|
||||||
*pscrinfo = clgame.scrInfo; // copy screeninfo out
|
*pscrinfo = clgame.scrInfo; // copy screeninfo out
|
||||||
|
@ -1101,6 +1207,275 @@ static void pfnSetCrosshair( HSPRITE hspr, wrect_t rc, int r, int g, int b )
|
||||||
clgame.ds.rcCrosshair = rc;
|
clgame.ds.rcCrosshair = rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnAddCommand
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void pfnAddCommand( const char *cmd_name, xcommand_t func, const char *cmd_desc )
|
||||||
|
{
|
||||||
|
if( !cmd_name || !*cmd_name ) return;
|
||||||
|
if( !cmd_desc ) cmd_desc = ""; // hidden for makehelep system
|
||||||
|
|
||||||
|
// NOTE: if( func == NULL ) cmd will be forwarded to a server
|
||||||
|
Cmd_AddCommand( cmd_name, func, cmd_desc );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnHookUserMsg
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void pfnHookUserMsg( const char *szMsgName, pfnUserMsgHook pfn )
|
||||||
|
{
|
||||||
|
user_message_t *msg;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// ignore blank names
|
||||||
|
if( !szMsgName || !*szMsgName ) return;
|
||||||
|
|
||||||
|
// second call can change msgFunc
|
||||||
|
for( i = 0; i < clgame.numMessages; i++ )
|
||||||
|
{
|
||||||
|
msg = clgame.msg[i];
|
||||||
|
if( !msg ) continue;
|
||||||
|
|
||||||
|
if( !com.strcmp( szMsgName, msg->name ))
|
||||||
|
{
|
||||||
|
if( msg->func != pfn )
|
||||||
|
msg->func = pfn;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// allocate a new one
|
||||||
|
CL_CreateUserMessage( i, szMsgName, 0, 0, pfn );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnServerCmd
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void pfnServerCmd( const char *szCmdString )
|
||||||
|
{
|
||||||
|
// server command adding in cmds queue
|
||||||
|
Cbuf_AddText( va( "cmd %s", szCmdString ));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnClientCmd
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void pfnClientCmd( const char *szCmdString )
|
||||||
|
{
|
||||||
|
// client command executes immediately
|
||||||
|
Cmd_ExecuteString( szCmdString );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnGetPlayerInfo
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void pfnGetPlayerInfo( int ent_num, hud_player_info_t *pinfo )
|
||||||
|
{
|
||||||
|
player_info_t *player;
|
||||||
|
|
||||||
|
ent_num -= 1; // player list if offset by 1 from ents
|
||||||
|
|
||||||
|
if( ent_num >= clgame.globals->maxClients || ent_num < 0 || !cl.players[ent_num].name[0] )
|
||||||
|
{
|
||||||
|
Mem_Set( pinfo, 0, sizeof( *pinfo ));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player = &cl.players[ent_num];
|
||||||
|
pinfo->thisplayer = ( ent_num == cl.playernum ) ? true : false;
|
||||||
|
|
||||||
|
pinfo->name = player->name;
|
||||||
|
pinfo->model = player->model;
|
||||||
|
|
||||||
|
pinfo->ping = com.atoi( Info_ValueForKey( player->userinfo, "ping" ));
|
||||||
|
pinfo->spectator = com.atoi( Info_ValueForKey( player->userinfo, "spectator" ));
|
||||||
|
pinfo->packetloss = com.atoi( Info_ValueForKey( player->userinfo, "loss" ));
|
||||||
|
pinfo->topcolor = com.atoi( Info_ValueForKey( player->userinfo, "topcolor" ));
|
||||||
|
pinfo->bottomcolor = com.atoi( Info_ValueForKey( player->userinfo, "bottomcolor" ));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnPlaySoundByName
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void pfnPlaySoundByName( const char *szSound, float volume, int pitch, const float *org )
|
||||||
|
{
|
||||||
|
S_StartLocalSound( szSound, volume, pitch, org );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnPlaySoundByIndex
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void pfnPlaySoundByIndex( int iSound, float volume, int pitch, const float *org )
|
||||||
|
{
|
||||||
|
// make sure what we in-bounds
|
||||||
|
iSound = bound( 0, iSound, MAX_SOUNDS );
|
||||||
|
|
||||||
|
if( cl.sound_precache[iSound] == 0 )
|
||||||
|
{
|
||||||
|
MsgDev( D_ERROR, "CL_PlaySoundByIndex: invalid sound handle %i\n", iSound );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
S_StartSound( org, cl.refdef.viewentity, CHAN_AUTO, cl.sound_precache[iSound], volume, ATTN_NORM, pitch, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnTextMessageGet
|
||||||
|
|
||||||
|
returns specified message from titles.txt
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static client_textmessage_t *pfnTextMessageGet( const char *pName )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// find desired message
|
||||||
|
for( i = 0; i < clgame.numTitles; i++ )
|
||||||
|
{
|
||||||
|
if( !com.strcmp( pName, clgame.titles[i].pName ))
|
||||||
|
return clgame.titles + i;
|
||||||
|
}
|
||||||
|
return NULL; // found nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnDrawCharacter
|
||||||
|
|
||||||
|
returns drawed chachter width (in real screen pixels)
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static int pfnDrawCharacter( int x, int y, int number, int r, int g, int b )
|
||||||
|
{
|
||||||
|
float size, frow, fcol;
|
||||||
|
float ax, ay, aw, ah;
|
||||||
|
int fontWidth, fontHeight;
|
||||||
|
rgba_t color;
|
||||||
|
|
||||||
|
number &= 255;
|
||||||
|
|
||||||
|
if( !re ) return 0;
|
||||||
|
if( number == ' ' ) return 0;
|
||||||
|
if( y < -clgame.scrInfo.iCharHeight )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ax = x;
|
||||||
|
ay = y;
|
||||||
|
aw = clgame.scrInfo.charWidths[number];
|
||||||
|
ah = clgame.scrInfo.iCharHeight;
|
||||||
|
SPR_AdjustSize( &ax, &ay, &aw, &ah );
|
||||||
|
re->GetParms( &fontWidth, &fontHeight, NULL, 0, clgame.ds.hHudFont );
|
||||||
|
|
||||||
|
MakeRGBA( color, r, g, b, 255 );
|
||||||
|
re->SetColor( color );
|
||||||
|
|
||||||
|
frow = (number >> 4)*0.0625f + (0.5f / (float)fontWidth);
|
||||||
|
fcol = (number & 15)*0.0625f + (0.5f / (float)fontHeight);
|
||||||
|
size = 0.0625f - (1.0f / (float)fontWidth);
|
||||||
|
|
||||||
|
re->DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol + size, frow + size, clgame.ds.hHudFont );
|
||||||
|
re->SetColor( NULL ); // don't forget reset color
|
||||||
|
|
||||||
|
return clgame.scrInfo.charWidths[number];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnDrawConsoleString
|
||||||
|
|
||||||
|
drawing string like a console string
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static int pfnDrawConsoleString( int x, int y, char *string )
|
||||||
|
{
|
||||||
|
if( !string || !*string ) return 0; // silent ignore
|
||||||
|
SCR_DrawSmallStringExt( x, y, string, NULL, false );
|
||||||
|
return com.cstrlen( string ) * SMALLCHAR_WIDTH; // not includes color prexfixes
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnDrawSetTextColor
|
||||||
|
|
||||||
|
set color for anything
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void pfnDrawSetTextColor( float r, float g, float b )
|
||||||
|
{
|
||||||
|
rgba_t color;
|
||||||
|
|
||||||
|
// bound color and convert to byte
|
||||||
|
color[0] = (byte)bound( 0, r * 255, 255 );
|
||||||
|
color[1] = (byte)bound( 0, g * 255, 255 );
|
||||||
|
color[2] = (byte)bound( 0, b * 255, 255 );
|
||||||
|
color[3] = (byte)0xFF;
|
||||||
|
if( re ) re->SetColor( color );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnDrawConsoleStringLen
|
||||||
|
|
||||||
|
returns width and height (in real pixels)
|
||||||
|
for specified string
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void pfnDrawConsoleStringLen( const char *string, int *length, int *height )
|
||||||
|
{
|
||||||
|
// console used fixed font size
|
||||||
|
if( length ) *length = com.cstrlen( string ) * SMALLCHAR_WIDTH;
|
||||||
|
if( height ) *height = SMALLCHAR_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnConsolePrint
|
||||||
|
|
||||||
|
prints dirctly into console (can skip notify)
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void pfnConsolePrint( const char *string )
|
||||||
|
{
|
||||||
|
if( !string || !*string ) return;
|
||||||
|
if( *string == 1 ) Con_Print( string + 1 ); // show notify
|
||||||
|
else Con_Print( va( "[skipnotify]%s", string )); // skip notify
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnCenterPrint
|
||||||
|
|
||||||
|
holds and fade message at center of screen
|
||||||
|
like trigger_multiple message in q1
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void pfnCenterPrint( const char *string )
|
||||||
|
{
|
||||||
|
if( !string || !*string ) return; // someone stupid joke
|
||||||
|
CL_CenterPrint( string, 160, SMALLCHAR_WIDTH );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=========
|
=========
|
||||||
pfnMemAlloc
|
pfnMemAlloc
|
||||||
|
@ -1143,95 +1518,6 @@ shader_t pfnLoadShader( const char *szShaderName, int fShaderNoMip )
|
||||||
return re->RegisterShader( szShaderName, SHADER_GENERIC );
|
return re->RegisterShader( szShaderName, SHADER_GENERIC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnDrawImageExt
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnDrawImageExt( HSPRITE shader, float x, float y, float w, float h, float s1, float t1, float s2, float t2 )
|
|
||||||
{
|
|
||||||
if( !re ) return;
|
|
||||||
|
|
||||||
re->DrawStretchPic( x, y, w, h, s1, t1, s2, t2, shader );
|
|
||||||
re->SetColor( NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnSetColor
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnSetColor( byte r, byte g, byte b, byte a )
|
|
||||||
{
|
|
||||||
rgba_t color;
|
|
||||||
|
|
||||||
if( !re ) return; // render not initialized
|
|
||||||
MakeRGBA( color, r, g, b, a );
|
|
||||||
re->SetColor( color );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCvarSetString
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnCvarSetString( const char *szName, const char *szValue )
|
|
||||||
{
|
|
||||||
Cvar_Set( szName, szValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCvarSetValue
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnCvarSetValue( const char *szName, float flValue )
|
|
||||||
{
|
|
||||||
Cvar_SetValue( szName, flValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnGetCvarFloat
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
float pfnGetCvarFloat( const char *szName )
|
|
||||||
{
|
|
||||||
return Cvar_VariableValue( szName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnGetCvarString
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
char* pfnGetCvarString( const char *szName )
|
|
||||||
{
|
|
||||||
return Cvar_VariableString( szName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnAddCommand
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnAddCommand( const char *cmd_name, xcommand_t func, const char *cmd_desc )
|
|
||||||
{
|
|
||||||
if( !cmd_name || !*cmd_name ) return;
|
|
||||||
if( !cmd_desc ) cmd_desc = ""; // hidden for makehelep system
|
|
||||||
|
|
||||||
// NOTE: if( func == NULL ) cmd will be forwarded to a server
|
|
||||||
Cmd_AddCommand( cmd_name, func, cmd_desc );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnDelCommand
|
pfnDelCommand
|
||||||
|
@ -1245,62 +1531,6 @@ void pfnDelCommand( const char *cmd_name )
|
||||||
Cmd_RemoveCommand( cmd_name );
|
Cmd_RemoveCommand( cmd_name );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnHookUserMsg
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnHookUserMsg( const char *szMsgName, pfnUserMsgHook pfn )
|
|
||||||
{
|
|
||||||
user_message_t *msg;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// ignore blank names
|
|
||||||
if( !szMsgName || !*szMsgName ) return;
|
|
||||||
|
|
||||||
// second call can change msgFunc
|
|
||||||
for( i = 0; i < clgame.numMessages; i++ )
|
|
||||||
{
|
|
||||||
msg = clgame.msg[i];
|
|
||||||
if( !msg ) continue;
|
|
||||||
|
|
||||||
if( !com.strcmp( szMsgName, msg->name ))
|
|
||||||
{
|
|
||||||
if( msg->func != pfn )
|
|
||||||
msg->func = pfn;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// allocate a new one
|
|
||||||
CL_CreateUserMessage( i, szMsgName, 0, 0, pfn );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnServerCmd
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnServerCmd( const char *szCmdString )
|
|
||||||
{
|
|
||||||
// server command adding in cmds queue
|
|
||||||
Cbuf_AddText( va( "cmd %s", szCmdString ));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnClientCmd
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnClientCmd( const char *szCmdString )
|
|
||||||
{
|
|
||||||
// client command executes immediately
|
|
||||||
Cmd_ExecuteString( szCmdString );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnSetKeyDest
|
pfnSetKeyDest
|
||||||
|
@ -1322,39 +1552,6 @@ void pfnSetKeyDest( int key_dest )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnGetPlayerInfo
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnGetPlayerInfo( int player_num, hud_player_info_t *pinfo )
|
|
||||||
{
|
|
||||||
// FIXME: implement
|
|
||||||
static hud_player_info_t null_info;
|
|
||||||
|
|
||||||
Mem_Copy( pinfo, &null_info, sizeof( null_info ));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnTextMessageGet
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
client_textmessage_t *pfnTextMessageGet( const char *pName )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// find desired message
|
|
||||||
for( i = 0; i < clgame.numTitles; i++ )
|
|
||||||
{
|
|
||||||
if( !com.strcmp( pName, clgame.titles[i].pName ))
|
|
||||||
return clgame.titles + i;
|
|
||||||
}
|
|
||||||
return NULL; // found nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
|
@ -1380,160 +1577,6 @@ char *pfnCmdArgv( int argc )
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnPlaySoundByName
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnPlaySoundByName( const char *szSound, float volume, int pitch, const float *org )
|
|
||||||
{
|
|
||||||
S_StartLocalSound( szSound, volume, pitch, org );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnPlaySoundByIndex
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnPlaySoundByIndex( int iSound, float volume, int pitch, const float *org )
|
|
||||||
{
|
|
||||||
// make sure what we in-bounds
|
|
||||||
iSound = bound( 0, iSound, MAX_SOUNDS );
|
|
||||||
|
|
||||||
if( cl.sound_precache[iSound] == 0 )
|
|
||||||
{
|
|
||||||
MsgDev( D_ERROR, "CL_PlaySoundByIndex: invalid sound handle %i\n", iSound );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
S_StartSound( org, cl.refdef.viewentity, CHAN_AUTO, cl.sound_precache[iSound], volume, ATTN_NORM, pitch, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnDrawCenterPrint
|
|
||||||
|
|
||||||
called each frame
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnDrawCenterPrint( void )
|
|
||||||
{
|
|
||||||
char *start;
|
|
||||||
int l, x, y, w;
|
|
||||||
rgba_t color;
|
|
||||||
|
|
||||||
if( !clgame.centerPrintTime ) return;
|
|
||||||
CL_FadeAlpha( clgame.centerPrintTime, scr_centertime->value, color );
|
|
||||||
|
|
||||||
if( *( int *)color == 0xFFFFFFFF )
|
|
||||||
{
|
|
||||||
clgame.centerPrintTime = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
re->SetColor( color );
|
|
||||||
start = clgame.centerPrint;
|
|
||||||
y = clgame.centerPrintY - clgame.centerPrintLines * BIGCHAR_HEIGHT / 2;
|
|
||||||
|
|
||||||
while( 1 )
|
|
||||||
{
|
|
||||||
char linebuffer[1024];
|
|
||||||
|
|
||||||
for ( l = 0; l < 50; l++ )
|
|
||||||
{
|
|
||||||
if ( !start[l] || start[l] == '\n' )
|
|
||||||
break;
|
|
||||||
linebuffer[l] = start[l];
|
|
||||||
}
|
|
||||||
linebuffer[l] = 0;
|
|
||||||
|
|
||||||
w = clgame.centerPrintCharWidth * com.cstrlen( linebuffer );
|
|
||||||
x = ( SCREEN_WIDTH - w )>>1;
|
|
||||||
|
|
||||||
SCR_DrawStringExt( x, y, clgame.centerPrintCharWidth, BIGCHAR_HEIGHT, linebuffer, color, false );
|
|
||||||
|
|
||||||
y += clgame.centerPrintCharWidth * 1.5;
|
|
||||||
while( *start && ( *start != '\n' )) start++;
|
|
||||||
if( !*start ) break;
|
|
||||||
start++;
|
|
||||||
}
|
|
||||||
if( re ) re->SetColor( NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCenterPrint
|
|
||||||
|
|
||||||
called once from message
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void CL_CenterPrint( const char *text, int y, int charWidth )
|
|
||||||
{
|
|
||||||
char *s;
|
|
||||||
|
|
||||||
com.strncpy( clgame.centerPrint, text, sizeof( clgame.centerPrint ));
|
|
||||||
clgame.centerPrintTime = cls.realtime * 0.001f;
|
|
||||||
clgame.centerPrintY = y;
|
|
||||||
clgame.centerPrintCharWidth = charWidth;
|
|
||||||
|
|
||||||
// count the number of lines for centering
|
|
||||||
clgame.centerPrintLines = 1;
|
|
||||||
s = clgame.centerPrint;
|
|
||||||
while( *s )
|
|
||||||
{
|
|
||||||
if( *s == '\n' )
|
|
||||||
clgame.centerPrintLines++;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnDrawString
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnDrawString( int x, int y, int width, int height, const char *text )
|
|
||||||
{
|
|
||||||
if( !text || !*text )
|
|
||||||
{
|
|
||||||
MsgDev( D_ERROR, "SCR_DrawStringExt: passed null string!\n" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SCR_DrawStringExt( x, y, width, height, text, g_color_table[7], false );
|
|
||||||
if( re ) re->SetColor( NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnGetImageSize
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnGetDrawParms( int *w, int *h, int *f, int frame, shader_t shader )
|
|
||||||
{
|
|
||||||
if( re ) re->GetParms( w, h, f, frame, shader );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( w ) *w = 0;
|
|
||||||
if( h ) *h = 0;
|
|
||||||
if( f ) *f = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnSetDrawParms
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnSetDrawParms( shader_t handle, kRenderMode_t rendermode, int frame )
|
|
||||||
{
|
|
||||||
if( re ) re->SetParms( handle, rendermode, frame );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnGetViewAngles
|
pfnGetViewAngles
|
||||||
|
@ -2254,36 +2297,36 @@ static cl_enginefuncs_t gEngfuncs =
|
||||||
pfnFillRGBA,
|
pfnFillRGBA,
|
||||||
pfnGetScreenInfo,
|
pfnGetScreenInfo,
|
||||||
pfnSetCrosshair,
|
pfnSetCrosshair,
|
||||||
|
pfnCVarRegister,
|
||||||
|
pfnCVarGetValue,
|
||||||
|
pfnCVarGetString,
|
||||||
|
pfnAddCommand,
|
||||||
|
pfnHookUserMsg,
|
||||||
|
pfnServerCmd,
|
||||||
|
pfnClientCmd,
|
||||||
|
pfnGetPlayerInfo,
|
||||||
|
pfnPlaySoundByName,
|
||||||
|
pfnPlaySoundByIndex,
|
||||||
|
AngleVectors,
|
||||||
|
pfnTextMessageGet,
|
||||||
|
pfnDrawCharacter,
|
||||||
|
pfnDrawConsoleString,
|
||||||
|
pfnDrawSetTextColor,
|
||||||
|
pfnDrawConsoleStringLen,
|
||||||
|
pfnConsolePrint,
|
||||||
|
pfnCenterPrint,
|
||||||
|
|
||||||
pfnMemAlloc,
|
pfnMemAlloc,
|
||||||
pfnMemCopy,
|
pfnMemCopy,
|
||||||
pfnMemFree,
|
pfnMemFree,
|
||||||
pfnLoadShader,
|
pfnLoadShader,
|
||||||
pfnDrawImageExt,
|
pfnCVarSetString,
|
||||||
pfnSetColor,
|
pfnCVarSetValue,
|
||||||
pfnCVarRegister,
|
|
||||||
pfnCvarSetString,
|
|
||||||
pfnCvarSetValue,
|
|
||||||
pfnGetCvarFloat,
|
|
||||||
pfnGetCvarString,
|
|
||||||
pfnAddCommand,
|
|
||||||
pfnHookUserMsg,
|
|
||||||
pfnDelCommand,
|
pfnDelCommand,
|
||||||
pfnServerCmd,
|
|
||||||
pfnClientCmd,
|
|
||||||
pfnSetKeyDest,
|
pfnSetKeyDest,
|
||||||
pfnGetPlayerInfo,
|
|
||||||
pfnTextMessageGet,
|
|
||||||
pfnCmdArgc,
|
pfnCmdArgc,
|
||||||
pfnCmdArgv,
|
pfnCmdArgv,
|
||||||
pfnAlertMessage,
|
pfnAlertMessage,
|
||||||
pfnPlaySoundByName,
|
|
||||||
pfnPlaySoundByIndex,
|
|
||||||
AngleVectors,
|
|
||||||
pfnDrawCenterPrint,
|
|
||||||
CL_CenterPrint,
|
|
||||||
pfnDrawString,
|
|
||||||
pfnGetDrawParms,
|
|
||||||
pfnSetDrawParms,
|
|
||||||
pfnGetViewAngles,
|
pfnGetViewAngles,
|
||||||
CL_GetEdictByIndex,
|
CL_GetEdictByIndex,
|
||||||
CL_GetLocalPlayer,
|
CL_GetLocalPlayer,
|
||||||
|
|
|
@ -590,9 +590,6 @@ void CL_CreateNewCommands( void )
|
||||||
// generate a command for this frame
|
// generate a command for this frame
|
||||||
i = cl.cmd_number = cls.netchan.outgoing_sequence & CMD_MASK;
|
i = cl.cmd_number = cls.netchan.outgoing_sequence & CMD_MASK;
|
||||||
cl.refdef.cmd = &cl.cmds[i];
|
cl.refdef.cmd = &cl.cmds[i];
|
||||||
cl.frames[i].senttime = cls.realtime;
|
|
||||||
cl.frames[i].recvtime = -1; // we haven't gotten a reply yet
|
|
||||||
|
|
||||||
cl.cmd_time[i] = cls.realtime; // for netgraph ping calculation
|
cl.cmd_time[i] = cls.realtime; // for netgraph ping calculation
|
||||||
|
|
||||||
*cl.refdef.cmd = CL_CreateCmd();
|
*cl.refdef.cmd = CL_CreateCmd();
|
||||||
|
@ -625,7 +622,7 @@ void CL_WritePacket( void )
|
||||||
byte data[MAX_MSGLEN];
|
byte data[MAX_MSGLEN];
|
||||||
usercmd_t *cmd, *oldcmd;
|
usercmd_t *cmd, *oldcmd;
|
||||||
usercmd_t nullcmd;
|
usercmd_t nullcmd;
|
||||||
int key, lost;
|
int key;
|
||||||
|
|
||||||
// don't send anything if playing back a demo
|
// don't send anything if playing back a demo
|
||||||
if( cls.demoplayback || cls.state == ca_cinematic )
|
if( cls.demoplayback || cls.state == ca_cinematic )
|
||||||
|
@ -659,10 +656,6 @@ void CL_WritePacket( void )
|
||||||
key = buf.cursize;
|
key = buf.cursize;
|
||||||
MSG_WriteByte( &buf, 0 );
|
MSG_WriteByte( &buf, 0 );
|
||||||
|
|
||||||
// write our lossage percentage
|
|
||||||
lost = CL_CalcNet();
|
|
||||||
MSG_WriteByte( &buf, lost );
|
|
||||||
|
|
||||||
// let the server know what the last frame we
|
// let the server know what the last frame we
|
||||||
// got was, so the next message can be delta compressed
|
// got was, so the next message can be delta compressed
|
||||||
if( cl_nodelta->integer || !cl.frame.valid || cls.demowaiting )
|
if( cl_nodelta->integer || !cl.frame.valid || cls.demowaiting )
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ void CL_InitLocal( void )
|
||||||
// userinfo
|
// userinfo
|
||||||
info_password = Cvar_Get( "password", "", CVAR_USERINFO, "player password" );
|
info_password = Cvar_Get( "password", "", CVAR_USERINFO, "player password" );
|
||||||
info_spectator = Cvar_Get( "spectator", "0", CVAR_USERINFO, "spectator mode" );
|
info_spectator = Cvar_Get( "spectator", "0", CVAR_USERINFO, "spectator mode" );
|
||||||
name = Cvar_Get( "name", "unnamed", CVAR_USERINFO | CVAR_ARCHIVE, "player name" );
|
name = Cvar_Get( "name", SI->username, CVAR_USERINFO | CVAR_ARCHIVE, "player name" );
|
||||||
model = Cvar_Get( "model", "player", CVAR_USERINFO | CVAR_ARCHIVE, "player model ('player' it's a single player model)" );
|
model = Cvar_Get( "model", "player", CVAR_USERINFO | CVAR_ARCHIVE, "player model ('player' it's a single player model)" );
|
||||||
topcolor = Cvar_Get( "topcolor", "0", CVAR_USERINFO | CVAR_ARCHIVE, "player top color" );
|
topcolor = Cvar_Get( "topcolor", "0", CVAR_USERINFO | CVAR_ARCHIVE, "player top color" );
|
||||||
bottomcolor = Cvar_Get( "bottomcolor", "0", CVAR_USERINFO | CVAR_ARCHIVE, "player bottom color" );
|
bottomcolor = Cvar_Get( "bottomcolor", "0", CVAR_USERINFO | CVAR_ARCHIVE, "player bottom color" );
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "net_sound.h"
|
#include "net_sound.h"
|
||||||
|
|
||||||
#define NET_TIMINGS 256
|
|
||||||
#define NET_TIMINGSMASK (NET_TIMINGS - 1)
|
|
||||||
|
|
||||||
char *svc_strings[256] =
|
char *svc_strings[256] =
|
||||||
{
|
{
|
||||||
"svc_bad",
|
"svc_bad",
|
||||||
|
@ -41,39 +38,6 @@ char *svc_strings[256] =
|
||||||
"svc_event_reliable"
|
"svc_event_reliable"
|
||||||
};
|
};
|
||||||
|
|
||||||
int packet_latency[NET_TIMINGS];
|
|
||||||
int packet_loss;
|
|
||||||
|
|
||||||
int CL_CalcNet( void )
|
|
||||||
{
|
|
||||||
int a, i;
|
|
||||||
frame_t *frame;
|
|
||||||
int lost = 0;
|
|
||||||
|
|
||||||
for( i = cls.netchan.outgoing_sequence - UPDATE_BACKUP + 1; i <= cls.netchan.outgoing_sequence; i++ )
|
|
||||||
{
|
|
||||||
frame = &cl.frames[i & UPDATE_MASK];
|
|
||||||
|
|
||||||
if( frame->recvtime == -1 )
|
|
||||||
packet_latency[i & NET_TIMINGSMASK] = 9999; // dropped
|
|
||||||
else if( frame->recvtime == -2 )
|
|
||||||
packet_latency[i & NET_TIMINGSMASK] = 10000; // choked
|
|
||||||
else if( !frame->valid )
|
|
||||||
packet_latency[i&NET_TIMINGSMASK] = 9998; // invalid delta
|
|
||||||
else packet_latency[i & NET_TIMINGSMASK] = (frame->recvtime - frame->senttime) * 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
for( a = 0; a < NET_TIMINGS; a++ )
|
|
||||||
{
|
|
||||||
i = (cls.netchan.outgoing_sequence - a) & NET_TIMINGSMASK;
|
|
||||||
if( packet_latency[i] == 9999 ) lost++;
|
|
||||||
}
|
|
||||||
|
|
||||||
packet_loss = lost * 100 / NET_TIMINGS;
|
|
||||||
|
|
||||||
return packet_loss;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
CL_CheckOrDownloadFile
|
CL_CheckOrDownloadFile
|
||||||
|
@ -545,7 +509,37 @@ void CL_ParseCrosshairAngle( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
cl.refdef.crosshairangle[0] = MSG_ReadAngle8( msg );
|
cl.refdef.crosshairangle[0] = MSG_ReadAngle8( msg );
|
||||||
cl.refdef.crosshairangle[1] = MSG_ReadAngle8( msg );
|
cl.refdef.crosshairangle[1] = MSG_ReadAngle8( msg );
|
||||||
cl.refdef.crosshairangle[2] = 0; // not used for screen space
|
cl.refdef.crosshairangle[2] = 0.0f; // not used for screen space
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
================
|
||||||
|
CL_UpdateUserinfo
|
||||||
|
|
||||||
|
collect userinfo from all players
|
||||||
|
================
|
||||||
|
*/
|
||||||
|
void CL_UpdateUserinfo( sizebuf_t *msg )
|
||||||
|
{
|
||||||
|
int slot;
|
||||||
|
bool active;
|
||||||
|
player_info_t *player;
|
||||||
|
|
||||||
|
slot = MSG_ReadByte( msg );
|
||||||
|
|
||||||
|
if( slot >= MAX_CLIENTS )
|
||||||
|
Host_EndGame( "CL_ParseServerMessage: svc_updateuserinfo > MAX_CLIENTS\n" );
|
||||||
|
|
||||||
|
player = &cl.players[slot];
|
||||||
|
active = MSG_ReadByte( msg ) ? true : false;
|
||||||
|
|
||||||
|
if( active )
|
||||||
|
{
|
||||||
|
com.strncpy( player->userinfo, MSG_ReadString( msg ), sizeof( player->userinfo ));
|
||||||
|
com.strncpy( player->name, Info_ValueForKey( player->userinfo, "name" ), sizeof( player->name ));
|
||||||
|
com.strncpy( player->model, Info_ValueForKey( player->userinfo, "model" ), sizeof( player->model ));
|
||||||
|
}
|
||||||
|
else Mem_Set( player, 0, sizeof( *player ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -638,7 +632,7 @@ void CL_ParseServerMessage( sizebuf_t *msg )
|
||||||
Con_Print( va( "^6%s\n", MSG_ReadString( msg )));
|
Con_Print( va( "^6%s\n", MSG_ReadString( msg )));
|
||||||
break;
|
break;
|
||||||
case svc_centerprint:
|
case svc_centerprint:
|
||||||
CL_CenterPrint( MSG_ReadString( msg ), SCREEN_HEIGHT/2, BIGCHAR_WIDTH );
|
CL_CenterPrint( MSG_ReadString( msg ), 160, SMALLCHAR_WIDTH );
|
||||||
break;
|
break;
|
||||||
case svc_setpause:
|
case svc_setpause:
|
||||||
cl.refdef.paused = (MSG_ReadByte( msg ) != 0 );
|
cl.refdef.paused = (MSG_ReadByte( msg ) != 0 );
|
||||||
|
@ -661,6 +655,9 @@ void CL_ParseServerMessage( sizebuf_t *msg )
|
||||||
case svc_event_reliable:
|
case svc_event_reliable:
|
||||||
CL_ParseReliableEvent( msg, FEV_RELIABLE );
|
CL_ParseReliableEvent( msg, FEV_RELIABLE );
|
||||||
break;
|
break;
|
||||||
|
case svc_updateuserinfo:
|
||||||
|
CL_UpdateUserinfo( msg );
|
||||||
|
break;
|
||||||
case svc_frame:
|
case svc_frame:
|
||||||
CL_ParseFrame( msg );
|
CL_ParseFrame( msg );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -420,6 +420,8 @@ void SCR_RegisterShaders( void )
|
||||||
{
|
{
|
||||||
if( re )
|
if( re )
|
||||||
{
|
{
|
||||||
|
Mem_Set( &clgame.ds, 0, sizeof( clgame.ds )); // reset a draw state
|
||||||
|
|
||||||
// register console images
|
// register console images
|
||||||
cls.consoleFont = re->RegisterShader( va( "gfx/fonts/%s", con_font->string ), SHADER_FONT );
|
cls.consoleFont = re->RegisterShader( va( "gfx/fonts/%s", con_font->string ), SHADER_FONT );
|
||||||
cls.clientFont = re->RegisterShader( va( "gfx/fonts/%s", cl_font->string ), SHADER_FONT );
|
cls.clientFont = re->RegisterShader( va( "gfx/fonts/%s", cl_font->string ), SHADER_FONT );
|
||||||
|
@ -435,7 +437,6 @@ void SCR_RegisterShaders( void )
|
||||||
// vid_state has changed
|
// vid_state has changed
|
||||||
if( clgame.hInstance ) clgame.dllFuncs.pfnVidInit();
|
if( clgame.hInstance ) clgame.dllFuncs.pfnVidInit();
|
||||||
|
|
||||||
Mem_Set( &clgame.ds, 0, sizeof( clgame.ds )); // reset a draw state
|
|
||||||
g_console_field_width = scr_width->integer / SMALLCHAR_WIDTH - 2;
|
g_console_field_width = scr_width->integer / SMALLCHAR_WIDTH - 2;
|
||||||
g_consoleField.widthInChars = g_console_field_width;
|
g_consoleField.widthInChars = g_console_field_width;
|
||||||
cls.drawplaque = true;
|
cls.drawplaque = true;
|
||||||
|
|
|
@ -22,6 +22,13 @@
|
||||||
#define STRING( offset ) CL_GetString( offset )
|
#define STRING( offset ) CL_GetString( offset )
|
||||||
#define MAKE_STRING(str) CL_AllocString( str )
|
#define MAKE_STRING(str) CL_AllocString( str )
|
||||||
|
|
||||||
|
typedef struct player_info_s
|
||||||
|
{
|
||||||
|
char name[CS_SIZE];
|
||||||
|
char userinfo[MAX_INFO_STRING];
|
||||||
|
char model[CS_SIZE];
|
||||||
|
} player_info_t;
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
typedef struct frame_s
|
typedef struct frame_s
|
||||||
{
|
{
|
||||||
|
@ -29,8 +36,6 @@ typedef struct frame_s
|
||||||
int serverframe;
|
int serverframe;
|
||||||
int servertime;
|
int servertime;
|
||||||
int deltaframe;
|
int deltaframe;
|
||||||
int recvtime;
|
|
||||||
int senttime;
|
|
||||||
byte areabits[MAX_MAP_AREA_BYTES]; // portalarea visibility bits
|
byte areabits[MAX_MAP_AREA_BYTES]; // portalarea visibility bits
|
||||||
int num_entities;
|
int num_entities;
|
||||||
int parse_entities; // non-masked index into cl_parse_entities array
|
int parse_entities; // non-masked index into cl_parse_entities array
|
||||||
|
@ -91,6 +96,7 @@ typedef struct
|
||||||
|
|
||||||
cinematics_t *cin;
|
cinematics_t *cin;
|
||||||
|
|
||||||
|
player_info_t players[MAX_CLIENTS];
|
||||||
event_state_t events;
|
event_state_t events;
|
||||||
|
|
||||||
// predicting stuff
|
// predicting stuff
|
||||||
|
@ -230,6 +236,15 @@ typedef struct
|
||||||
int scissor_height;
|
int scissor_height;
|
||||||
bool scissor_test;
|
bool scissor_test;
|
||||||
|
|
||||||
|
// centerprint stuff
|
||||||
|
int centerPrintY;
|
||||||
|
int centerPrintTime;
|
||||||
|
int centerPrintCharWidth;
|
||||||
|
char centerPrint[2048];
|
||||||
|
int centerPrintLines;
|
||||||
|
|
||||||
|
HSPRITE hHudFont;
|
||||||
|
|
||||||
// crosshair members
|
// crosshair members
|
||||||
HSPRITE hCrosshair;
|
HSPRITE hCrosshair;
|
||||||
wrect_t rcCrosshair;
|
wrect_t rcCrosshair;
|
||||||
|
@ -286,13 +301,6 @@ typedef struct
|
||||||
void *vp; // acess by offset in bytes
|
void *vp; // acess by offset in bytes
|
||||||
};
|
};
|
||||||
|
|
||||||
// misc 2d drawing stuff
|
|
||||||
float centerPrintTime;
|
|
||||||
int centerPrintCharWidth;
|
|
||||||
int centerPrintY;
|
|
||||||
char centerPrint[1024];
|
|
||||||
int centerPrintLines;
|
|
||||||
|
|
||||||
// movement values from server
|
// movement values from server
|
||||||
movevars_t movevars;
|
movevars_t movevars;
|
||||||
movevars_t oldmovevars;
|
movevars_t oldmovevars;
|
||||||
|
@ -505,7 +513,7 @@ void CL_InitClientProgs( void );
|
||||||
void CL_FreeClientProgs( void );
|
void CL_FreeClientProgs( void );
|
||||||
void CL_DrawHUD( int state );
|
void CL_DrawHUD( int state );
|
||||||
edict_t *CL_GetEdict( int entnum );
|
edict_t *CL_GetEdict( int entnum );
|
||||||
void CL_FadeAlpha( float starttime, float endtime, rgba_t color );
|
void CL_FadeAlpha( int starttime, int endtime, rgba_t color );
|
||||||
void CL_InitEdicts( void );
|
void CL_InitEdicts( void );
|
||||||
void CL_FreeEdicts( void );
|
void CL_FreeEdicts( void );
|
||||||
void CL_InitWorld( void );
|
void CL_InitWorld( void );
|
||||||
|
|
|
@ -141,6 +141,10 @@ cvar_t *pfnCVarRegister( const char *szName, const char *szValue, int flags, con
|
||||||
char *pfnMemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, int bufferSize );
|
char *pfnMemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, int bufferSize );
|
||||||
byte* pfnLoadFile( const char *filename, int *pLength );
|
byte* pfnLoadFile( const char *filename, int *pLength );
|
||||||
char *pfnParseToken( const char **data_p );
|
char *pfnParseToken( const char **data_p );
|
||||||
|
void pfnCVarSetString( const char *szName, const char *szValue );
|
||||||
|
void pfnCVarSetValue( const char *szName, float flValue );
|
||||||
|
float pfnCVarGetValue( const char *szName );
|
||||||
|
char* pfnCVarGetString( const char *szName );
|
||||||
void pfnFreeFile( void *buffer );
|
void pfnFreeFile( void *buffer );
|
||||||
int pfnFileExists( const char *filename );
|
int pfnFileExists( const char *filename );
|
||||||
void *pfnLoadLibrary( const char *name );
|
void *pfnLoadLibrary( const char *name );
|
||||||
|
@ -224,6 +228,7 @@ void SCR_UpdateScreen( void );
|
||||||
void SCR_Shutdown( void );
|
void SCR_Shutdown( void );
|
||||||
void Con_Print( const char *txt );
|
void Con_Print( const char *txt );
|
||||||
char *Info_ValueForKey( const char *s, const char *key );
|
char *Info_ValueForKey( const char *s, const char *key );
|
||||||
|
void Info_RemovePrefixedKeys( char *start, char prefix );
|
||||||
bool Info_RemoveKey( char *s, const char *key );
|
bool Info_RemoveKey( char *s, const char *key );
|
||||||
bool Info_SetValueForKey( char *s, const char *key, const char *value );
|
bool Info_SetValueForKey( char *s, const char *key, const char *value );
|
||||||
bool Info_Validate( const char *s );
|
bool Info_Validate( const char *s );
|
||||||
|
|
|
@ -238,6 +238,49 @@ cvar_t *pfnCVarRegister( const char *szName, const char *szValue, int flags, con
|
||||||
|
|
||||||
return Cvar_Get( szName, szValue, real_flags, szDesc );
|
return Cvar_Get( szName, szValue, real_flags, szDesc );
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnCVarSetString
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
void pfnCVarSetString( const char *szName, const char *szValue )
|
||||||
|
{
|
||||||
|
Cvar_Set( szName, szValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnCVarSetValue
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
void pfnCVarSetValue( const char *szName, float flValue )
|
||||||
|
{
|
||||||
|
Cvar_SetValue( szName, flValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnCVarGetString
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
char* pfnCVarGetString( const char *szName )
|
||||||
|
{
|
||||||
|
return Cvar_VariableString( szName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnCVarGetValue
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
float pfnCVarGetValue( const char *szName )
|
||||||
|
{
|
||||||
|
return Cvar_VariableValue( szName );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
|
|
|
@ -151,6 +151,45 @@ bool Info_RemoveKey( char *s, const char *key )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Info_RemovePrefixedKeys( char *start, char prefix )
|
||||||
|
{
|
||||||
|
char *s, *o;
|
||||||
|
char pkey[MAX_INFO_STRING];
|
||||||
|
char value[MAX_INFO_STRING];
|
||||||
|
|
||||||
|
s = start;
|
||||||
|
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
if( *s == '\\' )
|
||||||
|
s++;
|
||||||
|
o = pkey;
|
||||||
|
while( *s != '\\' )
|
||||||
|
{
|
||||||
|
if( !*s ) return;
|
||||||
|
*o++ = *s++;
|
||||||
|
}
|
||||||
|
*o = 0;
|
||||||
|
s++;
|
||||||
|
|
||||||
|
o = value;
|
||||||
|
while( *s != '\\' && *s )
|
||||||
|
{
|
||||||
|
if( !*s ) return;
|
||||||
|
*o++ = *s++;
|
||||||
|
}
|
||||||
|
*o = 0;
|
||||||
|
|
||||||
|
if( pkey[0] == prefix )
|
||||||
|
{
|
||||||
|
Info_RemoveKey( start, pkey );
|
||||||
|
s = start;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !*s ) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
Info_Validate
|
Info_Validate
|
||||||
|
|
|
@ -77,6 +77,7 @@ enum svc_ops_e
|
||||||
svc_bspdecal, // [float*3][short][short][short]
|
svc_bspdecal, // [float*3][short][short][short]
|
||||||
svc_event, // playback event queue
|
svc_event, // playback event queue
|
||||||
svc_event_reliable, // playback event directly from message, not queue
|
svc_event_reliable, // playback event directly from message, not queue
|
||||||
|
svc_updateuserinfo, // [byte] playernum, [string] userinfo
|
||||||
};
|
};
|
||||||
|
|
||||||
// client to server
|
// client to server
|
||||||
|
|
|
@ -609,7 +609,7 @@ void Host_Print( const char *txt )
|
||||||
{
|
{
|
||||||
if( host.rd.target )
|
if( host.rd.target )
|
||||||
{
|
{
|
||||||
if((com.strlen (txt) + com.strlen(host.rd.buffer)) > (host.rd.buffersize - 1))
|
if(( com.strlen( txt ) + com.strlen( host.rd.buffer )) > ( host.rd.buffersize - 1 ))
|
||||||
{
|
{
|
||||||
if( host.rd.flush )
|
if( host.rd.flush )
|
||||||
{
|
{
|
||||||
|
|
|
@ -89,6 +89,7 @@ typedef struct sv_client_s
|
||||||
char userinfo[MAX_INFO_STRING]; // name, etc (received from client)
|
char userinfo[MAX_INFO_STRING]; // name, etc (received from client)
|
||||||
char physinfo[MAX_INFO_STRING]; // set on server (transmit to client)
|
char physinfo[MAX_INFO_STRING]; // set on server (transmit to client)
|
||||||
bool physinfo_modified; // transmit at next opportunity
|
bool physinfo_modified; // transmit at next opportunity
|
||||||
|
bool sendinfo;
|
||||||
|
|
||||||
int lastframe; // for delta compression
|
int lastframe; // for delta compression
|
||||||
usercmd_t lastcmd; // for filling in big drops
|
usercmd_t lastcmd; // for filling in big drops
|
||||||
|
@ -303,7 +304,6 @@ int SV_CalcPacketLoss( sv_client_t *cl );
|
||||||
void SV_ExecuteUserCommand (char *s);
|
void SV_ExecuteUserCommand (char *s);
|
||||||
void SV_InitOperatorCommands( void );
|
void SV_InitOperatorCommands( void );
|
||||||
void SV_KillOperatorCommands( void );
|
void SV_KillOperatorCommands( void );
|
||||||
void SV_SendServerinfo( sv_client_t *client );
|
|
||||||
void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo );
|
void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo );
|
||||||
void Master_Heartbeat (void);
|
void Master_Heartbeat (void);
|
||||||
void Master_Packet (void);
|
void Master_Packet (void);
|
||||||
|
@ -354,6 +354,7 @@ void SV_GetChallenge( netadr_t from );
|
||||||
void SV_DirectConnect( netadr_t from );
|
void SV_DirectConnect( netadr_t from );
|
||||||
void SV_TogglePause( const char *msg );
|
void SV_TogglePause( const char *msg );
|
||||||
void SV_PutClientInServer( edict_t *ent );
|
void SV_PutClientInServer( edict_t *ent );
|
||||||
|
void SV_FullClientUpdate( sv_client_t *cl, sizebuf_t *msg );
|
||||||
bool SV_ClientConnect( edict_t *ent, char *userinfo );
|
bool SV_ClientConnect( edict_t *ent, char *userinfo );
|
||||||
void SV_ClientThink( sv_client_t *cl, usercmd_t *cmd );
|
void SV_ClientThink( sv_client_t *cl, usercmd_t *cmd );
|
||||||
void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg );
|
void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg );
|
||||||
|
|
|
@ -128,12 +128,7 @@ void SV_DirectConnect( netadr_t from )
|
||||||
svs.challenges[i].connected = true;
|
svs.challenges[i].connected = true;
|
||||||
MsgDev( D_INFO, "Client %i connecting with challenge %p\n", i, challenge );
|
MsgDev( D_INFO, "Client %i connecting with challenge %p\n", i, challenge );
|
||||||
}
|
}
|
||||||
else
|
else Info_SetValueForKey( userinfo, "ip", "127.0.0.1" ); // force the "ip" info key to "localhost"
|
||||||
{
|
|
||||||
// force the "ip" info key to "localhost"
|
|
||||||
Info_SetValueForKey( userinfo, "ip", "127.0.0.1" );
|
|
||||||
Info_SetValueForKey( userinfo, "name", SI->username ); // can be overwrited later
|
|
||||||
}
|
|
||||||
|
|
||||||
newcl = &temp;
|
newcl = &temp;
|
||||||
Mem_Set( newcl, 0, sizeof( sv_client_t ));
|
Mem_Set( newcl, 0, sizeof( sv_client_t ));
|
||||||
|
@ -278,7 +273,7 @@ edict_t *SV_FakeConnect( const char *netname )
|
||||||
newcl->state = cs_spawned;
|
newcl->state = cs_spawned;
|
||||||
newcl->lastmessage = svs.realtime; // don't timeout
|
newcl->lastmessage = svs.realtime; // don't timeout
|
||||||
newcl->lastconnect = svs.realtime;
|
newcl->lastconnect = svs.realtime;
|
||||||
|
|
||||||
return ent;
|
return ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,6 +544,39 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
|
||||||
SV_EndRedirect();
|
SV_EndRedirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
===================
|
||||||
|
SV_FullClientUpdate
|
||||||
|
|
||||||
|
Writes all update values to a sizebuf
|
||||||
|
===================
|
||||||
|
*/
|
||||||
|
void SV_FullClientUpdate( sv_client_t *cl, sizebuf_t *msg )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char info[MAX_INFO_STRING];
|
||||||
|
|
||||||
|
i = cl - svs.clients;
|
||||||
|
|
||||||
|
MSG_WriteByte( msg, svc_updateuserinfo );
|
||||||
|
MSG_WriteByte( msg, i );
|
||||||
|
|
||||||
|
if( cl->name[0] )
|
||||||
|
{
|
||||||
|
MSG_WriteByte( msg, true );
|
||||||
|
|
||||||
|
com.strncpy( info, cl->userinfo, sizeof( info ));
|
||||||
|
|
||||||
|
// remove server passwords, etc.
|
||||||
|
Info_RemovePrefixedKeys( info, '_' );
|
||||||
|
MSG_WriteString( msg, info );
|
||||||
|
}
|
||||||
|
else MSG_WriteByte( msg, false );
|
||||||
|
|
||||||
|
MSG_DirectSend( MSG_ALL, vec3_origin, NULL );
|
||||||
|
MSG_Clear( msg );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===========
|
===========
|
||||||
PutClientInServer
|
PutClientInServer
|
||||||
|
@ -681,6 +709,9 @@ void SV_New_f( sv_client_t *cl )
|
||||||
MSG_WriteString( &cl->netchan.message, sv.configstrings[CS_NAME] );
|
MSG_WriteString( &cl->netchan.message, sv.configstrings[CS_NAME] );
|
||||||
MSG_WriteString( &cl->netchan.message, STRING( EDICT_NUM( 0 )->v.message )); // Map Message
|
MSG_WriteString( &cl->netchan.message, STRING( EDICT_NUM( 0 )->v.message )); // Map Message
|
||||||
|
|
||||||
|
// refresh userinfo on spawn
|
||||||
|
cl->sendinfo = true;
|
||||||
|
|
||||||
// game server
|
// game server
|
||||||
if( sv.state == ss_active )
|
if( sv.state == ss_active )
|
||||||
{
|
{
|
||||||
|
@ -967,6 +998,7 @@ void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo )
|
||||||
svgame.globals->time = sv.time * 0.001f;
|
svgame.globals->time = sv.time * 0.001f;
|
||||||
svgame.globals->frametime = sv.frametime * 0.001f;
|
svgame.globals->frametime = sv.frametime * 0.001f;
|
||||||
svgame.dllFuncs.pfnClientUserInfoChanged( cl->edict, cl->userinfo );
|
svgame.dllFuncs.pfnClientUserInfoChanged( cl->edict, cl->userinfo );
|
||||||
|
if( cl->state >= cs_connected ) cl->sendinfo = true; // needs for update client info
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1487,7 +1519,6 @@ static void SV_ReadClientMove( sv_client_t *cl, sizebuf_t *msg )
|
||||||
|
|
||||||
key = msg->readcount;
|
key = msg->readcount;
|
||||||
checksum1 = MSG_ReadByte( msg );
|
checksum1 = MSG_ReadByte( msg );
|
||||||
cl->packet_loss = MSG_ReadByte( msg );
|
|
||||||
lastframe = MSG_ReadLong( msg );
|
lastframe = MSG_ReadLong( msg );
|
||||||
|
|
||||||
if( lastframe != cl->lastframe )
|
if( lastframe != cl->lastframe )
|
||||||
|
|
|
@ -547,6 +547,13 @@ void SV_SendClientMessages( void )
|
||||||
if( cl->edict && (cl->edict->v.flags & (FL_FAKECLIENT|FL_SPECTATOR)))
|
if( cl->edict && (cl->edict->v.flags & (FL_FAKECLIENT|FL_SPECTATOR)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// update any userinfo packets that have changed
|
||||||
|
if( cl->sendinfo )
|
||||||
|
{
|
||||||
|
cl->sendinfo = false;
|
||||||
|
SV_FullClientUpdate( cl, &sv.multicast );
|
||||||
|
}
|
||||||
|
|
||||||
// if the reliable message overflowed, drop the client
|
// if the reliable message overflowed, drop the client
|
||||||
if( cl->netchan.message.overflowed )
|
if( cl->netchan.message.overflowed )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2239,50 +2239,6 @@ void pfnWriteEntity( int iValue )
|
||||||
svgame.msg_realsize += 2;
|
svgame.msg_realsize += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCVarGetFloat
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
float pfnCVarGetFloat( const char *szVarName )
|
|
||||||
{
|
|
||||||
return Cvar_VariableValue( szVarName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCVarGetString
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
const char* pfnCVarGetString( const char *szVarName )
|
|
||||||
{
|
|
||||||
return Cvar_VariableString( szVarName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCVarSetFloat
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnCVarSetFloat( const char *szVarName, float flValue )
|
|
||||||
{
|
|
||||||
Cvar_SetValue( szVarName, flValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCVarSetString
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnCVarSetString( const char *szVarName, const char *szValue )
|
|
||||||
{
|
|
||||||
Cvar_Set( szVarName, szValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnPvAllocEntPrivateData
|
pfnPvAllocEntPrivateData
|
||||||
|
@ -3043,6 +2999,7 @@ void pfnSetClientKeyValue( int clientIndex, char *infobuffer, char *key, char *v
|
||||||
|
|
||||||
cl = svs.clients + clientIndex;
|
cl = svs.clients + clientIndex;
|
||||||
Info_SetValueForKey( cl->userinfo, key, value );
|
Info_SetValueForKey( cl->userinfo, key, value );
|
||||||
|
cl->sendinfo = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3563,9 +3520,9 @@ static enginefuncs_t gEngfuncs =
|
||||||
pfnWriteString,
|
pfnWriteString,
|
||||||
pfnWriteEntity,
|
pfnWriteEntity,
|
||||||
pfnCVarRegister,
|
pfnCVarRegister,
|
||||||
pfnCVarGetFloat,
|
pfnCVarGetValue,
|
||||||
pfnCVarGetString,
|
pfnCVarGetString,
|
||||||
pfnCVarSetFloat,
|
pfnCVarSetValue,
|
||||||
pfnCVarSetString,
|
pfnCVarSetString,
|
||||||
pfnAlertMessage,
|
pfnAlertMessage,
|
||||||
pfnEngineFprintf,
|
pfnEngineFprintf,
|
||||||
|
|
|
@ -92,8 +92,8 @@ typedef struct
|
||||||
{
|
{
|
||||||
const char **credits;
|
const char **credits;
|
||||||
int startTime;
|
int startTime;
|
||||||
float showTime;
|
int showTime;
|
||||||
float fadeTime;
|
int fadeTime;
|
||||||
int numLines;
|
int numLines;
|
||||||
bool active;
|
bool active;
|
||||||
bool finalCredits;
|
bool finalCredits;
|
||||||
|
@ -136,7 +136,7 @@ static void UI_Credits_DrawFunc( void )
|
||||||
|
|
||||||
if(( y < (scr_height->integer - h) / 2 ) && i == uiCredits.numLines - 1 )
|
if(( y < (scr_height->integer - h) / 2 ) && i == uiCredits.numLines - 1 )
|
||||||
{
|
{
|
||||||
if( !uiCredits.fadeTime ) uiCredits.fadeTime = (uiStatic.realTime * 0.001f);
|
if( !uiCredits.fadeTime ) uiCredits.fadeTime = uiStatic.realTime;
|
||||||
CL_FadeAlpha( uiCredits.fadeTime, uiCredits.showTime, color );
|
CL_FadeAlpha( uiCredits.fadeTime, uiCredits.showTime, color );
|
||||||
if( color[3] ) UI_DrawString( 0, (scr_height->integer - h) / 2, 1024 * uiStatic.scaleX, h, uiCredits.credits[i], color, true, w, h, 1, true );
|
if( color[3] ) UI_DrawString( 0, (scr_height->integer - h) / 2, 1024 * uiStatic.scaleX, h, uiCredits.credits[i], color, true, w, h, 1, true );
|
||||||
}
|
}
|
||||||
|
@ -225,8 +225,8 @@ static void UI_Credits_Init( void )
|
||||||
|
|
||||||
// run credits
|
// run credits
|
||||||
uiCredits.startTime = uiStatic.realTime + 500; // make half-seconds delay
|
uiCredits.startTime = uiStatic.realTime + 500; // make half-seconds delay
|
||||||
uiCredits.showTime = bound( 0.1f, com.strlen( uiCredits.credits[uiCredits.numLines - 1]), 12.0f );
|
uiCredits.showTime = bound( 100, com.strlen( uiCredits.credits[uiCredits.numLines - 1]) * 1000, 12000 );
|
||||||
uiCredits.fadeTime = 0.0f; // will be determined later
|
uiCredits.fadeTime = 0; // will be determined later
|
||||||
uiCredits.active = true;
|
uiCredits.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,8 +280,6 @@ bool Key_IsDown( int keynum );
|
||||||
//
|
//
|
||||||
// cl_game.c
|
// cl_game.c
|
||||||
//
|
//
|
||||||
void CL_FadeAlpha( float starttime, float endtime, rgba_t color );
|
|
||||||
|
|
||||||
extern rgba_t uiColorWhite;
|
extern rgba_t uiColorWhite;
|
||||||
extern rgba_t uiColorLtGrey;
|
extern rgba_t uiColorLtGrey;
|
||||||
extern rgba_t uiColorMdGrey;
|
extern rgba_t uiColorMdGrey;
|
||||||
|
|
12
launch/cmd.c
12
launch/cmd.c
|
@ -250,10 +250,10 @@ next frame. This allows commands like:
|
||||||
bind g "cmd use rocket ; +attack ; wait ; -attack ; cmd use blaster"
|
bind g "cmd use rocket ; +attack ; wait ; -attack ; cmd use blaster"
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cmd_Wait_f (void)
|
void Cmd_Wait_f( void )
|
||||||
{
|
{
|
||||||
if(Cmd_Argc() == 1) cmd_wait = 1;
|
if( Cmd_Argc() == 1 ) cmd_wait = 1;
|
||||||
else cmd_wait = com.atoi(Cmd_Argv( 1 ));
|
else cmd_wait = com.atoi( Cmd_Argv( 1 ));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ void Cmd_Wait_f (void)
|
||||||
Cmd_Exec_f
|
Cmd_Exec_f
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void Cmd_Exec_f (void)
|
void Cmd_Exec_f( void )
|
||||||
{
|
{
|
||||||
string rcpath;
|
string rcpath;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -542,9 +542,9 @@ bool Cmd_Exists (const char *cmd_name)
|
||||||
{
|
{
|
||||||
cmd_function_t *cmd;
|
cmd_function_t *cmd;
|
||||||
|
|
||||||
for (cmd = cmd_functions; cmd; cmd = cmd->next)
|
for( cmd = cmd_functions; cmd; cmd = cmd->next )
|
||||||
{
|
{
|
||||||
if (!com.strcmp(cmd_name, cmd->name))
|
if (!com.strcmp( cmd_name, cmd->name ))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -50,8 +50,8 @@ playermove_t *pmove = (playermove_t *)NULL;
|
||||||
#define VEC_VIEW 28
|
#define VEC_VIEW 28
|
||||||
#define WJ_HEIGHT 8
|
#define WJ_HEIGHT 8
|
||||||
#define STOP_EPSILON 0.1
|
#define STOP_EPSILON 0.1
|
||||||
#define CTEXTURESMAX 512 // max number of textures loaded
|
|
||||||
#define MAX_CLIENTS 32
|
#define MAX_CLIENTS 32
|
||||||
|
#define CTEXTURESMAX 512 // max number of textures loaded
|
||||||
#define pev (&pmove->player->v)
|
#define pev (&pmove->player->v)
|
||||||
|
|
||||||
#define BUNNYJUMP_MAX_SPEED_FACTOR 1.7f // Only allow bunny jumping up to 1.7x server / player maxspeed setting
|
#define BUNNYJUMP_MAX_SPEED_FACTOR 1.7f // Only allow bunny jumping up to 1.7x server / player maxspeed setting
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
//
|
//
|
||||||
// engine constant limits, touching networking protocol modify with precaution
|
// engine constant limits, touching networking protocol modify with precaution
|
||||||
//
|
//
|
||||||
|
#define MAX_CLIENTS 32 // max allowed clients (modify with precaution)
|
||||||
#define MAX_DLIGHTS 32 // dynamic lights (rendered per one frame)
|
#define MAX_DLIGHTS 32 // dynamic lights (rendered per one frame)
|
||||||
#define MAX_LIGHTSTYLES 256 // can't be blindly increased
|
#define MAX_LIGHTSTYLES 256 // can't be blindly increased
|
||||||
#define MAX_DECALS 256 // server decal indexes (different decalnames, not a render limit)
|
#define MAX_DECALS 256 // server decal indexes (different decalnames, not a render limit)
|
||||||
|
|
|
@ -1347,19 +1347,23 @@ int CBasePlayerWeapon :: Shoot ( const char *ammo, Vector vecSpread, int firemod
|
||||||
SetPlayerEffects( ammo, firemode );
|
SetPlayerEffects( ammo, firemode );
|
||||||
PlayAttackSound( firemode );
|
PlayAttackSound( firemode );
|
||||||
|
|
||||||
//viewmodel animation
|
// viewmodel animation
|
||||||
ZoomReset();
|
ZoomReset();
|
||||||
if(!PlayEmptyFire())
|
if( !PlayEmptyFire( ))
|
||||||
{
|
{
|
||||||
if(!firemode)PlayRangeAttack();
|
if ( !firemode )
|
||||||
else PlayMeleeAttack();
|
PlayRangeAttack ();
|
||||||
|
else PlayMeleeAttack ();
|
||||||
}
|
}
|
||||||
|
|
||||||
float flDistance;//set max distance
|
float flDistance;//set max distance
|
||||||
|
|
||||||
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
||||||
Vector vecAiming = gpGlobals->v_forward;
|
Vector vecAiming, vecDir;
|
||||||
Vector vecDir;
|
|
||||||
|
if( iFlags() & ITEM_FLAG_USEAUTOAIM )
|
||||||
|
vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
|
||||||
|
else vecAiming = gpGlobals->v_forward;
|
||||||
|
|
||||||
// eject brass
|
// eject brass
|
||||||
for( int i = 0; cShots > i; i++ )
|
for( int i = 0; cShots > i; i++ )
|
||||||
|
@ -1474,9 +1478,9 @@ int CBasePlayerWeapon::Swing( int fFirst )
|
||||||
|
|
||||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3;
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3;
|
||||||
|
|
||||||
UTIL_MakeVectors (m_pPlayer->pev->viewangles);
|
UTIL_MakeVectors( m_pPlayer->pev->viewangles );
|
||||||
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
||||||
Vector vecEnd = vecSrc + gpGlobals->v_forward * 32;
|
Vector vecEnd = vecSrc + gpGlobals->v_forward * 32;
|
||||||
|
|
||||||
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );
|
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );
|
||||||
|
|
||||||
|
|
|
@ -4193,6 +4193,8 @@ Vector CBasePlayer :: GetAutoaimVector( float flDelta )
|
||||||
Vector vecSrc = GetGunPosition( );
|
Vector vecSrc = GetGunPosition( );
|
||||||
float flDist = 8192;
|
float flDist = 8192;
|
||||||
|
|
||||||
|
m_vecAutoAim = Vector( 0, 0, 0 );
|
||||||
|
|
||||||
BOOL m_fOldTargeting = m_fOnTarget;
|
BOOL m_fOldTargeting = m_fOnTarget;
|
||||||
Vector angles = AutoaimDeflection(vecSrc, flDist, flDelta );
|
Vector angles = AutoaimDeflection(vecSrc, flDist, flDelta );
|
||||||
|
|
||||||
|
|
Reference in New Issue