18 Nov 2016
This commit is contained in:
parent
ad1c92a0c0
commit
d5cac2bc91
|
@ -70,7 +70,8 @@ void CL_PlayCDTrack_f( void )
|
|||
if( Cmd_Argc() < 2 ) return;
|
||||
command = Cmd_Argv( 1 );
|
||||
|
||||
if( !enabled && Q_stricmp( command, "on" )) return; // CD-player is disabled
|
||||
if( !enabled && Q_stricmp( command, "on" ))
|
||||
return; // CD-player is disabled
|
||||
|
||||
if( !Q_stricmp( command, "play" ))
|
||||
{
|
||||
|
|
|
@ -340,7 +340,7 @@ void CL_WriteDemoHeader( const char *name )
|
|||
cls.demorecording = true;
|
||||
cls.demowaiting = true; // don't start saving messages until a non-delta compressed message is received
|
||||
|
||||
Q_memset( &demo.header, 0, sizeof( demo.header ));
|
||||
memset( &demo.header, 0, sizeof( demo.header ));
|
||||
|
||||
demo.header.id = IDEMOHEADER;
|
||||
demo.header.dem_protocol = DEMO_PROTOCOL;
|
||||
|
@ -444,7 +444,7 @@ void CL_StopRecord( void )
|
|||
cls.demofile = NULL;
|
||||
cls.demorecording = false;
|
||||
cls.demoname[0] = '\0';
|
||||
menu.globals->demoname[0] = '\0';
|
||||
gameui.globals->demoname[0] = '\0';
|
||||
|
||||
Msg( "Completed demo\n" );
|
||||
MsgDev( D_INFO, "Recording time: %02d:%02d", (int)(cls.demotime / 60.0f ), (int)fmod( cls.demotime, 60.0f ));
|
||||
|
@ -525,7 +525,7 @@ void CL_ReadDemoUserCmd( qboolean discard )
|
|||
sizebuf_t buf;
|
||||
demoangle_t *a;
|
||||
|
||||
Q_memset( &nullcmd, 0, sizeof( nullcmd ));
|
||||
memset( &nullcmd, 0, sizeof( nullcmd ));
|
||||
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||
|
||||
pcmd = &cl.commands[cmdnumber & CL_UPDATE_MASK];
|
||||
|
@ -805,8 +805,8 @@ void CL_DemoFindInterpolatedViewAngles( float t, float *frac, demoangle_t **prev
|
|||
float at;
|
||||
|
||||
imod = demo.angle_position - 1;
|
||||
i0 = (imod + 1) & HISTORY_MASK;
|
||||
i1 = (imod + 0) & HISTORY_MASK;
|
||||
i0 = (imod + 1) & ANGLE_MASK;
|
||||
i1 = (imod + 0) & ANGLE_MASK;
|
||||
|
||||
if( demo.cmds[i0].starttime >= t )
|
||||
{
|
||||
|
@ -896,7 +896,7 @@ void CL_StopPlayback( void )
|
|||
demo.entry = NULL;
|
||||
|
||||
cls.demoname[0] = '\0'; // clear demoname too
|
||||
menu.globals->demoname[0] = '\0';
|
||||
gameui.globals->demoname[0] = '\0';
|
||||
|
||||
if( cls.changedemo )
|
||||
{
|
||||
|
@ -1121,7 +1121,7 @@ void CL_Record_f( void )
|
|||
// write demoshot for preview
|
||||
Cbuf_AddText( va( "demoshot \"%s\"\n", demoname ));
|
||||
Q_strncpy( cls.demoname, demoname, sizeof( cls.demoname ));
|
||||
Q_strncpy( menu.globals->demoname, demoname, sizeof( menu.globals->demoname ));
|
||||
Q_strncpy( gameui.globals->demoname, demoname, sizeof( gameui.globals->demoname ));
|
||||
|
||||
CL_WriteDemoHeader( demopath );
|
||||
}
|
||||
|
@ -1168,7 +1168,7 @@ void CL_PlayDemo_f( void )
|
|||
|
||||
cls.demofile = FS_Open( filename, "rb", true );
|
||||
Q_strncpy( cls.demoname, demoname, sizeof( cls.demoname ));
|
||||
Q_strncpy( menu.globals->demoname, demoname, sizeof( menu.globals->demoname ));
|
||||
Q_strncpy( gameui.globals->demoname, demoname, sizeof( gameui.globals->demoname ));
|
||||
|
||||
// read in the m_DemoHeader
|
||||
FS_Read( cls.demofile, &demo.header, sizeof( demoheader_t ));
|
||||
|
@ -1249,7 +1249,7 @@ void CL_PlayDemo_f( void )
|
|||
|
||||
Netchan_Setup( NS_CLIENT, &cls.netchan, net_from, Cvar_VariableValue( "net_qport" ));
|
||||
|
||||
Q_memset( demo.cmds, 0, sizeof( demo.cmds ));
|
||||
memset( demo.cmds, 0, sizeof( demo.cmds ));
|
||||
demo.angle_position = 1;
|
||||
demo.framecount = 0;
|
||||
cls.lastoutgoingcommand = -1;
|
||||
|
|
|
@ -26,7 +26,7 @@ CL_ResetEvent
|
|||
*/
|
||||
void CL_ResetEvent( event_info_t *ei )
|
||||
{
|
||||
Q_memset( ei, 0, sizeof( *ei ));
|
||||
memset( ei, 0, sizeof( *ei ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -111,7 +111,7 @@ void CL_RegisterEvent( int lastnum, const char *szEvName, pfnEventHook func )
|
|||
// clear existing or allocate new one
|
||||
if( !clgame.events[lastnum] )
|
||||
clgame.events[lastnum] = Mem_Alloc( cls.mempool, sizeof( cl_user_event_t ));
|
||||
else Q_memset( clgame.events[lastnum], 0, sizeof( cl_user_event_t ));
|
||||
else memset( clgame.events[lastnum], 0, sizeof( cl_user_event_t ));
|
||||
|
||||
ev = clgame.events[lastnum];
|
||||
|
||||
|
@ -299,7 +299,7 @@ void CL_ParseReliableEvent( sizebuf_t *msg )
|
|||
float delay = 0.0f;
|
||||
cl_entity_t *pEnt;
|
||||
|
||||
Q_memset( &nullargs, 0, sizeof( nullargs ));
|
||||
memset( &nullargs, 0, sizeof( nullargs ));
|
||||
|
||||
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
|
||||
|
@ -340,7 +340,7 @@ void CL_ParseEvent( sizebuf_t *msg )
|
|||
cl_entity_t *pEnt;
|
||||
float delay;
|
||||
|
||||
Q_memset( &nullargs, 0, sizeof( nullargs ));
|
||||
memset( &nullargs, 0, sizeof( nullargs ));
|
||||
|
||||
num_events = MSG_ReadUBitLong( msg, 5 );
|
||||
|
||||
|
@ -348,7 +348,7 @@ void CL_ParseEvent( sizebuf_t *msg )
|
|||
for( i = 0 ; i < num_events; i++ )
|
||||
{
|
||||
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
Q_memset( &args, 0, sizeof( args ));
|
||||
memset( &args, 0, sizeof( args ));
|
||||
has_update = false;
|
||||
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
|
|
|
@ -799,7 +799,7 @@ void CL_FlushEntityPacket( sizebuf_t *msg )
|
|||
int newnum;
|
||||
entity_state_t from, to;
|
||||
|
||||
Q_memset( &from, 0, sizeof( from ));
|
||||
memset( &from, 0, sizeof( from ));
|
||||
|
||||
cl.frames[cl.parsecountmod].valid = false;
|
||||
cl.validsequence = 0; // can't render a frame
|
||||
|
@ -849,7 +849,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
newframe->first_entity = cls.next_client_entities;
|
||||
newframe->num_entities = 0;
|
||||
newframe->valid = true; // assume valid
|
||||
Q_memset( &newframe->graphdata, 0, sizeof( netbandwidthgraph_t ));
|
||||
memset( &newframe->graphdata, 0, sizeof( netbandwidthgraph_t ));
|
||||
|
||||
if( delta )
|
||||
{
|
||||
|
|
|
@ -407,30 +407,6 @@ static void SPR_AdjustSize( float *x, float *y, float *w, float *h )
|
|||
if( h ) *h *= yscale;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
TextAdjustSize
|
||||
|
||||
draw hudsprite routine
|
||||
====================
|
||||
*/
|
||||
void TextAdjustSize( int *x, int *y, int *w, int *h )
|
||||
{
|
||||
float xscale, yscale;
|
||||
|
||||
if( !clgame.ds.adjust_size ) return;
|
||||
if( !x && !y && !w && !h ) return;
|
||||
|
||||
// scale for screen sizes
|
||||
xscale = scr_width->integer / (float)clgame.scrInfo.iWidth;
|
||||
yscale = scr_height->integer / (float)clgame.scrInfo.iHeight;
|
||||
|
||||
if( x ) *x *= xscale;
|
||||
if( y ) *y *= yscale;
|
||||
if( w ) *w *= xscale;
|
||||
if( h ) *h *= yscale;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
PictAdjustSize
|
||||
|
@ -649,7 +625,7 @@ void CL_DrawScreenFade( void )
|
|||
// all done?
|
||||
if(( cl.time > sf->fadeReset ) && ( cl.time > sf->fadeEnd ))
|
||||
{
|
||||
Q_memset( &clgame.fade, 0, sizeof( clgame.fade ));
|
||||
memset( &clgame.fade, 0, sizeof( clgame.fade ));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1495,7 +1471,7 @@ static int pfnGetScreenInfo( SCREENINFO *pscrinfo )
|
|||
clgame.scrInfo.iSize = pscrinfo->iSize;
|
||||
|
||||
// copy screeninfo out
|
||||
Q_memcpy( pscrinfo, &clgame.scrInfo, clgame.scrInfo.iSize );
|
||||
memcpy( pscrinfo, &clgame.scrInfo, clgame.scrInfo.iSize );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1604,7 +1580,7 @@ static void pfnGetPlayerInfo( int ent_num, hud_player_info_t *pinfo )
|
|||
|
||||
if( ent_num >= cl.maxclients || ent_num < 0 || !cl.players[ent_num].name[0] )
|
||||
{
|
||||
Q_memset( pinfo, 0, sizeof( *pinfo ));
|
||||
memset( pinfo, 0, sizeof( *pinfo ));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1959,7 +1935,7 @@ void pfnCalcShake( void )
|
|||
|
||||
if(( cl.time > clgame.shake.time ) || clgame.shake.amplitude <= 0 || clgame.shake.frequency <= 0 )
|
||||
{
|
||||
Q_memset( &clgame.shake, 0, sizeof( clgame.shake ));
|
||||
memset( &clgame.shake, 0, sizeof( clgame.shake ));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3416,7 +3392,7 @@ void NetAPI_SendRequest( int context, int request, int flags, double timeout, ne
|
|||
ASSERT( nr != NULL );
|
||||
|
||||
// clear slot
|
||||
Q_memset( nr, 0, sizeof( *nr ));
|
||||
memset( nr, 0, sizeof( *nr ));
|
||||
|
||||
// create a new request
|
||||
nr->timesend = host.realtime;
|
||||
|
@ -3473,7 +3449,7 @@ void NetAPI_CancelRequest( int context )
|
|||
nr->pfnFunc( &nr->resp );
|
||||
}
|
||||
|
||||
Q_memset( &clgame.net_requests[i], 0, sizeof( net_request_t ));
|
||||
memset( &clgame.net_requests[i], 0, sizeof( net_request_t ));
|
||||
|
||||
if( clgame.net_requests[i].resp.type == NETAPI_REQUEST_SERVERLIST && &clgame.net_requests[i] == clgame.master_request )
|
||||
{
|
||||
|
@ -3507,7 +3483,7 @@ void NetAPI_CancelAllRequests( void )
|
|||
nr->pfnFunc( &nr->resp );
|
||||
}
|
||||
|
||||
Q_memset( clgame.net_requests, 0, sizeof( clgame.net_requests ));
|
||||
memset( clgame.net_requests, 0, sizeof( clgame.net_requests ));
|
||||
clgame.request_type = NET_REQUEST_CANCEL;
|
||||
clgame.master_request = NULL;
|
||||
}
|
||||
|
@ -3827,10 +3803,10 @@ static cl_enginefunc_t gEngfuncs =
|
|||
CL_FillRGBA,
|
||||
pfnGetScreenInfo,
|
||||
pfnSetCrosshair,
|
||||
pfnCvar_RegisterVariable,
|
||||
pfnCvar_RegisterClientVariable,
|
||||
Cvar_VariableValue,
|
||||
Cvar_VariableString,
|
||||
pfnAddClientCommand,
|
||||
Cmd_AddClientCommand,
|
||||
pfnHookUserMsg,
|
||||
pfnServerCmd,
|
||||
pfnClientCmd,
|
||||
|
@ -3971,9 +3947,9 @@ void CL_UnloadProgs( void )
|
|||
Com_FreeLibrary( clgame.hInstance );
|
||||
Mem_FreePool( &cls.mempool );
|
||||
Mem_FreePool( &clgame.mempool );
|
||||
Q_memset( &clgame, 0, sizeof( clgame ));
|
||||
memset( &clgame, 0, sizeof( clgame ));
|
||||
|
||||
Cvar_Unlink();
|
||||
Cvar_Unlink( CVAR_CLIENTDLL );
|
||||
Cmd_Unlink( CMD_CLIENTDLL );
|
||||
}
|
||||
|
||||
|
|
|
@ -21,42 +21,42 @@ GNU General Public License for more details.
|
|||
#include "input.h"
|
||||
|
||||
static MENUAPI GetMenuAPI;
|
||||
static void UI_UpdateUserinfo( void );
|
||||
static void UI_UpdateUserinfo( void );
|
||||
|
||||
menu_static_t menu;
|
||||
gameui_static_t gameui;
|
||||
|
||||
void UI_UpdateMenu( float realtime )
|
||||
{
|
||||
if( !menu.hInstance ) return;
|
||||
menu.dllFuncs.pfnRedraw( realtime );
|
||||
if( !gameui.hInstance ) return;
|
||||
gameui.dllFuncs.pfnRedraw( realtime );
|
||||
UI_UpdateUserinfo();
|
||||
}
|
||||
|
||||
void UI_KeyEvent( int key, qboolean down )
|
||||
{
|
||||
if( !menu.hInstance ) return;
|
||||
menu.dllFuncs.pfnKeyEvent( key, down );
|
||||
if( !gameui.hInstance ) return;
|
||||
gameui.dllFuncs.pfnKeyEvent( key, down );
|
||||
}
|
||||
|
||||
void UI_MouseMove( int x, int y )
|
||||
{
|
||||
if( !menu.hInstance ) return;
|
||||
menu.dllFuncs.pfnMouseMove( x, y );
|
||||
if( !gameui.hInstance ) return;
|
||||
gameui.dllFuncs.pfnMouseMove( x, y );
|
||||
}
|
||||
|
||||
void UI_SetActiveMenu( qboolean fActive )
|
||||
{
|
||||
movie_state_t *cin_state;
|
||||
|
||||
if( !menu.hInstance )
|
||||
if( !gameui.hInstance )
|
||||
{
|
||||
if( !fActive )
|
||||
Key_SetKeyDest( key_game );
|
||||
return;
|
||||
}
|
||||
|
||||
menu.drawLogo = fActive;
|
||||
menu.dllFuncs.pfnSetActiveMenu( fActive );
|
||||
gameui.drawLogo = fActive;
|
||||
gameui.dllFuncs.pfnSetActiveMenu( fActive );
|
||||
|
||||
if( !fActive )
|
||||
{
|
||||
|
@ -68,50 +68,50 @@ void UI_SetActiveMenu( qboolean fActive )
|
|||
|
||||
void UI_AddServerToList( netadr_t adr, const char *info )
|
||||
{
|
||||
if( !menu.hInstance ) return;
|
||||
menu.dllFuncs.pfnAddServerToList( adr, info );
|
||||
if( !gameui.hInstance ) return;
|
||||
gameui.dllFuncs.pfnAddServerToList( adr, info );
|
||||
}
|
||||
|
||||
void UI_GetCursorPos( int *pos_x, int *pos_y )
|
||||
{
|
||||
if( !menu.hInstance ) return;
|
||||
menu.dllFuncs.pfnGetCursorPos( pos_x, pos_y );
|
||||
if( !gameui.hInstance ) return;
|
||||
gameui.dllFuncs.pfnGetCursorPos( pos_x, pos_y );
|
||||
}
|
||||
|
||||
void UI_SetCursorPos( int pos_x, int pos_y )
|
||||
{
|
||||
if( !menu.hInstance ) return;
|
||||
menu.dllFuncs.pfnSetCursorPos( pos_x, pos_y );
|
||||
if( !gameui.hInstance ) return;
|
||||
gameui.dllFuncs.pfnSetCursorPos( pos_x, pos_y );
|
||||
}
|
||||
|
||||
void UI_ShowCursor( qboolean show )
|
||||
{
|
||||
if( !menu.hInstance ) return;
|
||||
menu.dllFuncs.pfnShowCursor( show );
|
||||
if( !gameui.hInstance ) return;
|
||||
gameui.dllFuncs.pfnShowCursor( show );
|
||||
}
|
||||
|
||||
qboolean UI_CreditsActive( void )
|
||||
{
|
||||
if( !menu.hInstance ) return 0;
|
||||
return menu.dllFuncs.pfnCreditsActive();
|
||||
if( !gameui.hInstance ) return 0;
|
||||
return gameui.dllFuncs.pfnCreditsActive();
|
||||
}
|
||||
|
||||
void UI_CharEvent( int key )
|
||||
{
|
||||
if( !menu.hInstance ) return;
|
||||
menu.dllFuncs.pfnCharEvent( key );
|
||||
if( !gameui.hInstance ) return;
|
||||
gameui.dllFuncs.pfnCharEvent( key );
|
||||
}
|
||||
|
||||
qboolean UI_MouseInRect( void )
|
||||
{
|
||||
if( !menu.hInstance ) return 1;
|
||||
return menu.dllFuncs.pfnMouseInRect();
|
||||
if( !gameui.hInstance ) return 1;
|
||||
return gameui.dllFuncs.pfnMouseInRect();
|
||||
}
|
||||
|
||||
qboolean UI_IsVisible( void )
|
||||
{
|
||||
if( !menu.hInstance ) return 0;
|
||||
return menu.dllFuncs.pfnIsVisible();
|
||||
if( !gameui.hInstance ) return 0;
|
||||
return gameui.dllFuncs.pfnIsVisible();
|
||||
}
|
||||
|
||||
static void UI_DrawLogo( const char *filename, float x, float y, float width, float height )
|
||||
|
@ -123,7 +123,7 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
|
|||
int cin_frame;
|
||||
qboolean redraw = false;
|
||||
|
||||
if( !menu.drawLogo ) return;
|
||||
if( !gameui.drawLogo ) return;
|
||||
cin_state = AVI_GetState( CIN_LOGO );
|
||||
|
||||
if( !AVI_IsActive( cin_state ))
|
||||
|
@ -139,15 +139,15 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
|
|||
if( FS_FileExists( path, false ) && !fullpath )
|
||||
{
|
||||
MsgDev( D_ERROR, "Couldn't load %s from packfile. Please extract it\n", path );
|
||||
menu.drawLogo = false;
|
||||
gameui.drawLogo = false;
|
||||
return;
|
||||
}
|
||||
|
||||
AVI_OpenVideo( cin_state, fullpath, false, false, true );
|
||||
if( !( AVI_GetVideoInfo( cin_state, &menu.logo_xres, &menu.logo_yres, &menu.logo_length )))
|
||||
if( !( AVI_GetVideoInfo( cin_state, &gameui.logo_xres, &gameui.logo_yres, &gameui.logo_length )))
|
||||
{
|
||||
AVI_CloseVideo( cin_state );
|
||||
menu.drawLogo = false;
|
||||
gameui.drawLogo = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
|
|||
cin_time += host.realframetime;
|
||||
|
||||
// restarts the cinematic
|
||||
if( cin_time > menu.logo_length )
|
||||
if( cin_time > gameui.logo_length )
|
||||
cin_time = 0.0f;
|
||||
|
||||
// read the next frame
|
||||
|
@ -180,22 +180,22 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
|
|||
redraw = true;
|
||||
}
|
||||
|
||||
R_DrawStretchRaw( x, y, width, height, menu.logo_xres, menu.logo_yres, cin_data, redraw );
|
||||
R_DrawStretchRaw( x, y, width, height, gameui.logo_xres, gameui.logo_yres, cin_data, redraw );
|
||||
}
|
||||
|
||||
static int UI_GetLogoWidth( void )
|
||||
{
|
||||
return menu.logo_xres;
|
||||
return gameui.logo_xres;
|
||||
}
|
||||
|
||||
static int UI_GetLogoHeight( void )
|
||||
{
|
||||
return menu.logo_yres;
|
||||
return gameui.logo_yres;
|
||||
}
|
||||
|
||||
static float UI_GetLogoLength( void )
|
||||
{
|
||||
return menu.logo_length;
|
||||
return gameui.logo_length;
|
||||
}
|
||||
|
||||
static void UI_UpdateUserinfo( void )
|
||||
|
@ -203,7 +203,7 @@ static void UI_UpdateUserinfo( void )
|
|||
player_info_t *player;
|
||||
|
||||
if( !userinfo->modified ) return;
|
||||
player = &menu.playerinfo;
|
||||
player = &gameui.playerinfo;
|
||||
|
||||
Q_strncpy( player->userinfo, Cvar_Userinfo(), sizeof( player->userinfo ));
|
||||
Q_strncpy( player->name, Info_ValueForKey( player->userinfo, "name" ), sizeof( player->name ));
|
||||
|
@ -214,8 +214,8 @@ static void UI_UpdateUserinfo( void )
|
|||
|
||||
void Host_Credits( void )
|
||||
{
|
||||
if( !menu.hInstance ) return;
|
||||
menu.dllFuncs.pfnFinalCredits();
|
||||
if( !gameui.hInstance ) return;
|
||||
gameui.dllFuncs.pfnFinalCredits();
|
||||
}
|
||||
|
||||
static void UI_ConvertGameInfo( GAMEINFO *out, gameinfo_t *in )
|
||||
|
@ -246,42 +246,42 @@ static qboolean PIC_Scissor( float *x, float *y, float *width, float *height, fl
|
|||
if(( width == 0 ) || ( height == 0 ))
|
||||
return false;
|
||||
|
||||
if( *x + *width <= menu.ds.scissor_x )
|
||||
if( *x + *width <= gameui.ds.scissor_x )
|
||||
return false;
|
||||
if( *x >= menu.ds.scissor_x + menu.ds.scissor_width )
|
||||
if( *x >= gameui.ds.scissor_x + gameui.ds.scissor_width )
|
||||
return false;
|
||||
if( *y + *height <= menu.ds.scissor_y )
|
||||
if( *y + *height <= gameui.ds.scissor_y )
|
||||
return false;
|
||||
if( *y >= menu.ds.scissor_y + menu.ds.scissor_height )
|
||||
if( *y >= gameui.ds.scissor_y + gameui.ds.scissor_height )
|
||||
return false;
|
||||
|
||||
dudx = (*u1 - *u0) / *width;
|
||||
dvdy = (*v1 - *v0) / *height;
|
||||
|
||||
if( *x < menu.ds.scissor_x )
|
||||
if( *x < gameui.ds.scissor_x )
|
||||
{
|
||||
*u0 += (menu.ds.scissor_x - *x) * dudx;
|
||||
*width -= menu.ds.scissor_x - *x;
|
||||
*x = menu.ds.scissor_x;
|
||||
*u0 += (gameui.ds.scissor_x - *x) * dudx;
|
||||
*width -= gameui.ds.scissor_x - *x;
|
||||
*x = gameui.ds.scissor_x;
|
||||
}
|
||||
|
||||
if( *x + *width > menu.ds.scissor_x + menu.ds.scissor_width )
|
||||
if( *x + *width > gameui.ds.scissor_x + gameui.ds.scissor_width )
|
||||
{
|
||||
*u1 -= (*x + *width - (menu.ds.scissor_x + menu.ds.scissor_width)) * dudx;
|
||||
*width = menu.ds.scissor_x + menu.ds.scissor_width - *x;
|
||||
*u1 -= (*x + *width - (gameui.ds.scissor_x + gameui.ds.scissor_width)) * dudx;
|
||||
*width = gameui.ds.scissor_x + gameui.ds.scissor_width - *x;
|
||||
}
|
||||
|
||||
if( *y < menu.ds.scissor_y )
|
||||
if( *y < gameui.ds.scissor_y )
|
||||
{
|
||||
*v0 += (menu.ds.scissor_y - *y) * dvdy;
|
||||
*height -= menu.ds.scissor_y - *y;
|
||||
*y = menu.ds.scissor_y;
|
||||
*v0 += (gameui.ds.scissor_y - *y) * dvdy;
|
||||
*height -= gameui.ds.scissor_y - *y;
|
||||
*y = gameui.ds.scissor_y;
|
||||
}
|
||||
|
||||
if( *y + *height > menu.ds.scissor_y + menu.ds.scissor_height )
|
||||
if( *y + *height > gameui.ds.scissor_y + gameui.ds.scissor_height )
|
||||
{
|
||||
*v1 -= (*y + *height - (menu.ds.scissor_y + menu.ds.scissor_height)) * dvdy;
|
||||
*height = menu.ds.scissor_y + menu.ds.scissor_height - *y;
|
||||
*v1 -= (*y + *height - (gameui.ds.scissor_y + gameui.ds.scissor_height)) * dvdy;
|
||||
*height = gameui.ds.scissor_y + gameui.ds.scissor_height - *y;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ static void PIC_DrawGeneric( float x, float y, float width, float height, const
|
|||
int w, h;
|
||||
|
||||
// assume we get sizes from image
|
||||
R_GetTextureParms( &w, &h, menu.ds.gl_texturenum );
|
||||
R_GetTextureParms( &w, &h, gameui.ds.gl_texturenum );
|
||||
|
||||
if( prc )
|
||||
{
|
||||
|
@ -328,11 +328,11 @@ static void PIC_DrawGeneric( float x, float y, float width, float height, const
|
|||
}
|
||||
|
||||
// pass scissor test if supposed
|
||||
if( menu.ds.scissor_test && !PIC_Scissor( &x, &y, &width, &height, &s1, &t1, &s2, &t2 ))
|
||||
if( gameui.ds.scissor_test && !PIC_Scissor( &x, &y, &width, &height, &s1, &t1, &s2, &t2 ))
|
||||
return;
|
||||
|
||||
PicAdjustSize( &x, &y, &width, &height );
|
||||
R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, menu.ds.gl_texturenum );
|
||||
R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, gameui.ds.gl_texturenum );
|
||||
pglColor4ub( 255, 255, 255, 255 );
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ pfnPIC_Set
|
|||
*/
|
||||
void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
||||
{
|
||||
menu.ds.gl_texturenum = hPic;
|
||||
gameui.ds.gl_texturenum = hPic;
|
||||
r = bound( 0, r, 255 );
|
||||
g = bound( 0, g, 255 );
|
||||
b = bound( 0, b, 255 );
|
||||
|
@ -471,16 +471,16 @@ pfnPIC_EnableScissor
|
|||
static void pfnPIC_EnableScissor( int x, int y, int width, int height )
|
||||
{
|
||||
// check bounds
|
||||
x = bound( 0, x, menu.globals->scrWidth );
|
||||
y = bound( 0, y, menu.globals->scrHeight );
|
||||
width = bound( 0, width, menu.globals->scrWidth - x );
|
||||
height = bound( 0, height, menu.globals->scrHeight - y );
|
||||
x = bound( 0, x, gameui.globals->scrWidth );
|
||||
y = bound( 0, y, gameui.globals->scrHeight );
|
||||
width = bound( 0, width, gameui.globals->scrWidth - x );
|
||||
height = bound( 0, height, gameui.globals->scrHeight - y );
|
||||
|
||||
menu.ds.scissor_x = x;
|
||||
menu.ds.scissor_width = width;
|
||||
menu.ds.scissor_y = y;
|
||||
menu.ds.scissor_height = height;
|
||||
menu.ds.scissor_test = true;
|
||||
gameui.ds.scissor_x = x;
|
||||
gameui.ds.scissor_width = width;
|
||||
gameui.ds.scissor_y = y;
|
||||
gameui.ds.scissor_height = height;
|
||||
gameui.ds.scissor_test = true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -491,11 +491,11 @@ pfnPIC_DisableScissor
|
|||
*/
|
||||
static void pfnPIC_DisableScissor( void )
|
||||
{
|
||||
menu.ds.scissor_x = 0;
|
||||
menu.ds.scissor_width = 0;
|
||||
menu.ds.scissor_y = 0;
|
||||
menu.ds.scissor_height = 0;
|
||||
menu.ds.scissor_test = false;
|
||||
gameui.ds.scissor_x = 0;
|
||||
gameui.ds.scissor_width = 0;
|
||||
gameui.ds.scissor_y = 0;
|
||||
gameui.ds.scissor_height = 0;
|
||||
gameui.ds.scissor_test = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -583,7 +583,7 @@ static void pfnDrawCharacter( int ix, int iy, int iwidth, int iheight, int ch, i
|
|||
t2 = t1 + size;
|
||||
|
||||
// pass scissor test if supposed
|
||||
if( menu.ds.scissor_test && !PIC_Scissor( &x, &y, &width, &height, &s1, &t1, &s2, &t2 ))
|
||||
if( gameui.ds.scissor_test && !PIC_Scissor( &x, &y, &width, &height, &s1, &t1, &s2, &t2 ))
|
||||
return;
|
||||
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
|
@ -603,8 +603,8 @@ static int UI_DrawConsoleString( int x, int y, const char *string )
|
|||
int drawLen;
|
||||
|
||||
if( !string || !*string ) return 0; // silent ignore
|
||||
drawLen = Con_DrawString( x, y, string, menu.ds.textColor );
|
||||
MakeRGBA( menu.ds.textColor, 255, 255, 255, 255 );
|
||||
drawLen = Con_DrawString( x, y, string, gameui.ds.textColor );
|
||||
MakeRGBA( gameui.ds.textColor, 255, 255, 255, 255 );
|
||||
|
||||
return (x + drawLen); // exclude color prexfixes
|
||||
}
|
||||
|
@ -619,10 +619,10 @@ set color for anything
|
|||
static void UI_DrawSetTextColor( int r, int g, int b, int alpha )
|
||||
{
|
||||
// bound color and convert to byte
|
||||
menu.ds.textColor[0] = r;
|
||||
menu.ds.textColor[1] = g;
|
||||
menu.ds.textColor[2] = b;
|
||||
menu.ds.textColor[3] = alpha;
|
||||
gameui.ds.textColor[0] = r;
|
||||
gameui.ds.textColor[1] = g;
|
||||
gameui.ds.textColor[2] = b;
|
||||
gameui.ds.textColor[3] = alpha;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -634,7 +634,7 @@ for drawing playermodel previews
|
|||
*/
|
||||
static cl_entity_t* pfnGetPlayerModel( void )
|
||||
{
|
||||
return &menu.playermodel;
|
||||
return &gameui.playermodel;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -724,7 +724,7 @@ pfnMemAlloc
|
|||
*/
|
||||
static void *pfnMemAlloc( size_t cb, const char *filename, const int fileline )
|
||||
{
|
||||
return _Mem_Alloc( menu.mempool, cb, filename, fileline );
|
||||
return _Mem_Alloc( gameui.mempool, cb, filename, fileline );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -748,7 +748,7 @@ static int pfnGetGameInfo( GAMEINFO *pgameinfo )
|
|||
{
|
||||
if( !pgameinfo ) return 0;
|
||||
|
||||
*pgameinfo = menu.gameInfo;
|
||||
*pgameinfo = gameui.gameInfo;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -761,7 +761,7 @@ pfnGetGamesList
|
|||
static GAMEINFO **pfnGetGamesList( int *numGames )
|
||||
{
|
||||
if( numGames ) *numGames = SI.numgames;
|
||||
return menu.modsInfo;
|
||||
return gameui.modsInfo;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -891,12 +891,12 @@ static ui_enginefuncs_t gEngfuncs =
|
|||
pfnPIC_EnableScissor,
|
||||
pfnPIC_DisableScissor,
|
||||
pfnFillRGBA,
|
||||
pfnCvar_RegisterVariable,
|
||||
pfnCvar_RegisterGameUIVariable,
|
||||
Cvar_VariableValue,
|
||||
Cvar_VariableString,
|
||||
Cvar_Set,
|
||||
Cvar_SetFloat,
|
||||
pfnAddClientCommand,
|
||||
Cmd_AddGameUICommand,
|
||||
pfnClientCmd,
|
||||
Cmd_RemoveCommand,
|
||||
Cmd_Argc,
|
||||
|
@ -963,14 +963,19 @@ static ui_enginefuncs_t gEngfuncs =
|
|||
|
||||
void UI_UnloadProgs( void )
|
||||
{
|
||||
if( !menu.hInstance ) return;
|
||||
if( !gameui.hInstance ) return;
|
||||
|
||||
// deinitialize game
|
||||
menu.dllFuncs.pfnShutdown();
|
||||
gameui.dllFuncs.pfnShutdown();
|
||||
|
||||
Com_FreeLibrary( menu.hInstance );
|
||||
Mem_FreePool( &menu.mempool );
|
||||
Q_memset( &menu, 0, sizeof( menu ));
|
||||
Cvar_FullSet( "host_gameuiloaded", "0", CVAR_INIT );
|
||||
|
||||
Com_FreeLibrary( gameui.hInstance );
|
||||
Mem_FreePool( &gameui.mempool );
|
||||
memset( &gameui, 0, sizeof( gameui ));
|
||||
|
||||
Cvar_Unlink( CVAR_GAMEUIDLL );
|
||||
Cmd_Unlink( CMD_GAMEUIDLL );
|
||||
}
|
||||
|
||||
qboolean UI_LoadProgs( void )
|
||||
|
@ -979,16 +984,16 @@ qboolean UI_LoadProgs( void )
|
|||
static ui_globalvars_t gpGlobals;
|
||||
int i;
|
||||
|
||||
if( menu.hInstance ) UI_UnloadProgs();
|
||||
if( gameui.hInstance ) UI_UnloadProgs();
|
||||
|
||||
// setup globals
|
||||
menu.globals = &gpGlobals;
|
||||
gameui.globals = &gpGlobals;
|
||||
|
||||
if(!( menu.hInstance = Com_LoadLibrary( va( "%s/menu.dll", GI->dll_path ), false )))
|
||||
if(!( gameui.hInstance = Com_LoadLibrary( va( "%s/menu.dll", GI->dll_path ), false )))
|
||||
{
|
||||
FS_AllowDirectPaths( true );
|
||||
|
||||
if(!( menu.hInstance = Com_LoadLibrary( "../menu.dll", false )))
|
||||
if(!( gameui.hInstance = Com_LoadLibrary( "../menu.dll", false )))
|
||||
{
|
||||
FS_AllowDirectPaths( false );
|
||||
return false;
|
||||
|
@ -997,42 +1002,44 @@ qboolean UI_LoadProgs( void )
|
|||
FS_AllowDirectPaths( false );
|
||||
}
|
||||
|
||||
if(!( GetMenuAPI = (MENUAPI)Com_GetProcAddress( menu.hInstance, "GetMenuAPI" )))
|
||||
if(!( GetMenuAPI = (MENUAPI)Com_GetProcAddress( gameui.hInstance, "GetMenuAPI" )))
|
||||
{
|
||||
Com_FreeLibrary( menu.hInstance );
|
||||
Com_FreeLibrary( gameui.hInstance );
|
||||
MsgDev( D_NOTE, "UI_LoadProgs: can't init menu API\n" );
|
||||
menu.hInstance = NULL;
|
||||
gameui.hInstance = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
// make local copy of engfuncs to prevent overwrite it with user dll
|
||||
Q_memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
|
||||
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
|
||||
|
||||
menu.mempool = Mem_AllocPool( "Menu Pool" );
|
||||
gameui.mempool = Mem_AllocPool( "Menu Pool" );
|
||||
|
||||
if( !GetMenuAPI( &menu.dllFuncs, &gpEngfuncs, menu.globals ))
|
||||
if( !GetMenuAPI( &gameui.dllFuncs, &gpEngfuncs, gameui.globals ))
|
||||
{
|
||||
Com_FreeLibrary( menu.hInstance );
|
||||
Com_FreeLibrary( gameui.hInstance );
|
||||
MsgDev( D_NOTE, "UI_LoadProgs: can't init menu API\n" );
|
||||
Mem_FreePool( &menu.mempool );
|
||||
menu.hInstance = NULL;
|
||||
Mem_FreePool( &gameui.mempool );
|
||||
gameui.hInstance = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
Cvar_FullSet( "host_gameuiloaded", "1", CVAR_INIT );
|
||||
|
||||
// setup gameinfo
|
||||
for( i = 0; i < SI.numgames; i++ )
|
||||
{
|
||||
menu.modsInfo[i] = Mem_Alloc( menu.mempool, sizeof( GAMEINFO ));
|
||||
UI_ConvertGameInfo( menu.modsInfo[i], SI.games[i] );
|
||||
gameui.modsInfo[i] = Mem_Alloc( gameui.mempool, sizeof( GAMEINFO ));
|
||||
UI_ConvertGameInfo( gameui.modsInfo[i], SI.games[i] );
|
||||
}
|
||||
|
||||
UI_ConvertGameInfo( &menu.gameInfo, SI.GameInfo ); // current gameinfo
|
||||
UI_ConvertGameInfo( &gameui.gameInfo, SI.GameInfo ); // current gameinfo
|
||||
|
||||
// setup globals
|
||||
menu.globals->developer = host.developer;
|
||||
gameui.globals->developer = host.developer;
|
||||
|
||||
// initialize game
|
||||
menu.dllFuncs.pfnInit();
|
||||
gameui.dllFuncs.pfnInit();
|
||||
|
||||
return true;
|
||||
}
|
|
@ -160,7 +160,7 @@ qboolean CL_ChangeGame( const char *gamefolder, qboolean bReset )
|
|||
Q_strncpy( clgame.maptitle, maptitle, MAX_STRING );
|
||||
|
||||
// invalidate fonts so we can reloading them again
|
||||
Q_memset( &cls.creditsFont, 0, sizeof( cls.creditsFont ));
|
||||
memset( &cls.creditsFont, 0, sizeof( cls.creditsFont ));
|
||||
SCR_InstallParticlePalette();
|
||||
SCR_LoadCreditsFont();
|
||||
Con_InvalidateFonts();
|
||||
|
@ -173,8 +173,8 @@ qboolean CL_ChangeGame( const char *gamefolder, qboolean bReset )
|
|||
clgame.dllFuncs.IN_ActivateMouse();
|
||||
|
||||
// restore mlook state
|
||||
if( mlook_active ) Cmd_ExecuteString( "+mlook\n", src_command );
|
||||
if( jlook_active ) Cmd_ExecuteString( "+jlook\n", src_command );
|
||||
if( mlook_active ) Cmd_ExecuteString( "+mlook\n" );
|
||||
if( jlook_active ) Cmd_ExecuteString( "+jlook\n" );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,6 @@ static float CL_LerpPoint( void )
|
|||
if( f > 0.1f )
|
||||
{
|
||||
// dropped packet, or start of demo
|
||||
MsgDev( D_WARN, "CL_LerpPoint: %f > 0.1\n", f );
|
||||
cl.mtime[1] = cl.mtime[0] - 0.1f;
|
||||
f = 0.1f;
|
||||
}
|
||||
|
@ -385,7 +384,7 @@ void CL_CreateCmd( void )
|
|||
if( ms > 250 ) ms = 100; // time was unreasonable
|
||||
else if( ms <= 0 ) ms = 1; // keep time an actual
|
||||
|
||||
Q_memset( &cmd, 0, sizeof( cmd ));
|
||||
memset( &cmd, 0, sizeof( cmd ));
|
||||
input_override = 0;
|
||||
|
||||
CL_PushPMStates();
|
||||
|
@ -474,7 +473,7 @@ void CL_WriteUsercmd( sizebuf_t *msg, int from, int to )
|
|||
|
||||
if( from == -1 )
|
||||
{
|
||||
Q_memset( &nullcmd, 0, sizeof( nullcmd ));
|
||||
memset( &nullcmd, 0, sizeof( nullcmd ));
|
||||
f = &nullcmd;
|
||||
}
|
||||
else
|
||||
|
@ -897,10 +896,10 @@ void CL_ClearState( void )
|
|||
CL_ClearPhysEnts ();
|
||||
|
||||
// wipe the entire cl structure
|
||||
Q_memset( &cl, 0, sizeof( cl ));
|
||||
memset( &cl, 0, sizeof( cl ));
|
||||
MSG_Clear( &cls.netchan.message );
|
||||
Q_memset( &clgame.fade, 0, sizeof( clgame.fade ));
|
||||
Q_memset( &clgame.shake, 0, sizeof( clgame.shake ));
|
||||
memset( &clgame.fade, 0, sizeof( clgame.fade ));
|
||||
memset( &clgame.shake, 0, sizeof( clgame.shake ));
|
||||
Cvar_FullSet( "cl_background", "0", CVAR_READ_ONLY );
|
||||
cl.refdef.movevars = &clgame.movevars;
|
||||
cl.maxclients = 1; // allow to drawing player in menu
|
||||
|
@ -1048,7 +1047,7 @@ void CL_InternetServers_f( void )
|
|||
|
||||
// now we clearing the vgui request
|
||||
if( clgame.master_request != NULL )
|
||||
Q_memset( clgame.master_request, 0, sizeof( net_request_t ));
|
||||
memset( clgame.master_request, 0, sizeof( net_request_t ));
|
||||
clgame.request_type = NET_REQUEST_GAMEUI;
|
||||
}
|
||||
|
||||
|
@ -1241,17 +1240,17 @@ CL_ParseNETInfoMessage
|
|||
Handle a reply from a netinfo
|
||||
=================
|
||||
*/
|
||||
void CL_ParseNETInfoMessage( netadr_t from, sizebuf_t *msg )
|
||||
void CL_ParseNETInfoMessage( netadr_t from, sizebuf_t *msg, const char *s )
|
||||
{
|
||||
char *s, *val;
|
||||
net_request_t *nr;
|
||||
static char infostring[MAX_INFO_STRING+8];
|
||||
int i, context, type;
|
||||
int errorBits = 0;
|
||||
char *val;
|
||||
|
||||
context = Q_atoi( Cmd_Argv( 1 ));
|
||||
type = Q_atoi( Cmd_Argv( 2 ));
|
||||
s = Cmd_Argv( 3 );
|
||||
while( *s != '\\' ) s++; // fetching infostring
|
||||
|
||||
// check for errors
|
||||
val = Info_ValueForKey( s, "neterror" );
|
||||
|
@ -1283,7 +1282,7 @@ void CL_ParseNETInfoMessage( netadr_t from, sizebuf_t *msg )
|
|||
nr->pfnFunc( &nr->resp );
|
||||
|
||||
if( !FBitSet( nr->flags, FNETAPI_MULTIPLE_RESPONSE ))
|
||||
Q_memset( nr, 0, sizeof( *nr )); // done
|
||||
memset( nr, 0, sizeof( *nr )); // done
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1314,7 +1313,7 @@ void CL_ProcessNetRequests( void )
|
|||
nr->resp.ping = host.realtime - nr->timesend;
|
||||
|
||||
nr->pfnFunc( &nr->resp );
|
||||
Q_memset( nr, 0, sizeof( *nr )); // done
|
||||
memset( nr, 0, sizeof( *nr )); // done
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1423,7 +1422,7 @@ void CL_PrepVideo( void )
|
|||
CL_RegisterMuzzleFlashes ();
|
||||
|
||||
// invalidate all decal indexes
|
||||
Q_memset( cl.decal_index, 0, sizeof( cl.decal_index ));
|
||||
memset( cl.decal_index, 0, sizeof( cl.decal_index ));
|
||||
|
||||
CL_ClearWorld ();
|
||||
|
||||
|
@ -1512,7 +1511,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
|||
else if( !Q_strcmp( c, "netinfo" ))
|
||||
{
|
||||
// server responding to a status broadcast
|
||||
CL_ParseNETInfoMessage( from, msg );
|
||||
CL_ParseNETInfoMessage( from, msg, args );
|
||||
}
|
||||
else if( !Q_strcmp( c, "cmd" ))
|
||||
{
|
||||
|
@ -1597,7 +1596,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
|||
*prev = list->next;
|
||||
Mem_Free( list );
|
||||
}
|
||||
Q_memset( nr, 0, sizeof( *nr )); // done
|
||||
memset( nr, 0, sizeof( *nr )); // done
|
||||
clgame.request_type = NET_REQUEST_CANCEL;
|
||||
clgame.master_request = NULL;
|
||||
}
|
||||
|
@ -2033,13 +2032,13 @@ void Host_ClientFrame( void )
|
|||
if( cls.demorecording && !cls.demowaiting )
|
||||
cls.demotime += host.frametime;
|
||||
|
||||
if( menu.hInstance )
|
||||
if( gameui.hInstance )
|
||||
{
|
||||
// menu time (not paused, not clamped)
|
||||
menu.globals->time = host.realtime;
|
||||
menu.globals->frametime = host.realframetime;
|
||||
menu.globals->demoplayback = cls.demoplayback;
|
||||
menu.globals->demorecording = cls.demorecording;
|
||||
gameui.globals->time = host.realtime;
|
||||
gameui.globals->frametime = host.realframetime;
|
||||
gameui.globals->demoplayback = cls.demoplayback;
|
||||
gameui.globals->demorecording = cls.demorecording;
|
||||
}
|
||||
|
||||
// if in the debugger last frame, don't timeout
|
||||
|
|
|
@ -139,7 +139,7 @@ void NetGraph_GetFrameData( int *choke_count, int *loss_count, int *biggest_mess
|
|||
}
|
||||
}
|
||||
|
||||
Q_memcpy( g, &f->graphdata, sizeof( netbandwidthgraph_t ));
|
||||
memcpy( g, &f->graphdata, sizeof( netbandwidthgraph_t ));
|
||||
|
||||
if( *biggest_message < g->msgbytes )
|
||||
*biggest_message = g->msgbytes;
|
||||
|
@ -302,17 +302,17 @@ void NetGraph_ColorForHeight( struct packet_latency_t *packet, byte color[3], by
|
|||
switch( packet->latency )
|
||||
{
|
||||
case 9999:
|
||||
Q_memcpy( color, netcolors[0], sizeof( byte ) * 3 ); // dropped
|
||||
memcpy( color, netcolors[0], sizeof( byte ) * 3 ); // dropped
|
||||
*ping = 0;
|
||||
*alpha = netcolors[0][3];
|
||||
break;
|
||||
case 9998:
|
||||
Q_memcpy( color, netcolors[1], sizeof( byte ) * 3 ); // invalid
|
||||
memcpy( color, netcolors[1], sizeof( byte ) * 3 ); // invalid
|
||||
*alpha = netcolors[1][3];
|
||||
*ping = 0;
|
||||
break;
|
||||
case 9997:
|
||||
Q_memcpy( color, netcolors[2], sizeof( byte ) * 3 ); // skipped
|
||||
memcpy( color, netcolors[2], sizeof( byte ) * 3 ); // skipped
|
||||
*alpha = netcolors[2][3];
|
||||
*ping = 0;
|
||||
break;
|
||||
|
@ -320,12 +320,12 @@ void NetGraph_ColorForHeight( struct packet_latency_t *packet, byte color[3], by
|
|||
*ping = 1;
|
||||
if( packet->choked )
|
||||
{
|
||||
Q_memcpy( color, netcolors[3], sizeof( byte ) * 3 );
|
||||
memcpy( color, netcolors[3], sizeof( byte ) * 3 );
|
||||
*alpha = netcolors[3][3];
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_memcpy( color, netcolors[4], sizeof( byte ) * 3 );
|
||||
memcpy( color, netcolors[4], sizeof( byte ) * 3 );
|
||||
*alpha = netcolors[4][3];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ void CL_ParseMovevars( sizebuf_t *msg )
|
|||
if( Q_strcmp( clgame.oldmovevars.skyName, clgame.movevars.skyName ) && cl.video_prepped )
|
||||
R_SetupSky( clgame.movevars.skyName );
|
||||
|
||||
Q_memcpy( &clgame.oldmovevars, &clgame.movevars, sizeof( movevars_t ));
|
||||
memcpy( &clgame.oldmovevars, &clgame.movevars, sizeof( movevars_t ));
|
||||
// keep features an actual!
|
||||
clgame.oldmovevars.features = clgame.movevars.features = host.features;
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ void CL_ParseStaticEntity( sizebuf_t *msg )
|
|||
cl_entity_t *ent;
|
||||
int i;
|
||||
|
||||
Q_memset( &state, 0, sizeof( state ));
|
||||
memset( &state, 0, sizeof( state ));
|
||||
|
||||
state.modelindex = MSG_ReadShort( msg );
|
||||
state.sequence = MSG_ReadByte( msg );
|
||||
|
@ -636,8 +636,8 @@ void CL_ParseServerData( sizebuf_t *msg )
|
|||
|
||||
cl.refdef.viewentity = cl.playernum + 1; // always keep viewent an actual
|
||||
|
||||
menu.globals->maxClients = cl.maxclients;
|
||||
Q_strncpy( menu.globals->maptitle, clgame.maptitle, sizeof( menu.globals->maptitle ));
|
||||
gameui.globals->maxClients = cl.maxclients;
|
||||
Q_strncpy( gameui.globals->maptitle, clgame.maptitle, sizeof( gameui.globals->maptitle ));
|
||||
|
||||
if( !cls.changelevel && !cls.changedemo )
|
||||
CL_InitEdicts (); // re-arrange edicts
|
||||
|
@ -684,8 +684,8 @@ void CL_ParseServerData( sizebuf_t *msg )
|
|||
cl.video_prepped = false;
|
||||
cl.audio_prepped = false;
|
||||
|
||||
Q_memset( &clgame.movevars, 0, sizeof( clgame.movevars ));
|
||||
Q_memset( &clgame.oldmovevars, 0, sizeof( clgame.oldmovevars ));
|
||||
memset( &clgame.movevars, 0, sizeof( clgame.movevars ));
|
||||
memset( &clgame.oldmovevars, 0, sizeof( clgame.oldmovevars ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -842,7 +842,7 @@ void CL_ParseBaseline( sizebuf_t *msg )
|
|||
if( newnum >= clgame.maxEntities ) Host_Error( "CL_AllocEdict: no free edicts\n" );
|
||||
|
||||
ent = CL_EDICT_NUM( newnum );
|
||||
Q_memset( &ent->prevstate, 0, sizeof( ent->prevstate ));
|
||||
memset( &ent->prevstate, 0, sizeof( ent->prevstate ));
|
||||
ent->index = newnum;
|
||||
|
||||
if( cls.state == ca_active )
|
||||
|
@ -965,9 +965,9 @@ void CL_UpdateUserinfo( sizebuf_t *msg )
|
|||
player->topcolor = Q_atoi( Info_ValueForKey( player->userinfo, "topcolor" ));
|
||||
player->bottomcolor = Q_atoi( Info_ValueForKey( player->userinfo, "bottomcolor" ));
|
||||
|
||||
if( slot == cl.playernum ) Q_memcpy( &menu.playerinfo, player, sizeof( player_info_t ));
|
||||
if( slot == cl.playernum ) memcpy( &gameui.playerinfo, player, sizeof( player_info_t ));
|
||||
}
|
||||
else Q_memset( player, 0, sizeof( *player ));
|
||||
else memset( player, 0, sizeof( *player ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1139,7 +1139,7 @@ void CL_ParseResourceList( sizebuf_t *msg )
|
|||
{
|
||||
int i = 0;
|
||||
|
||||
Q_memset( &reslist, 0, sizeof( resourcelist_t ));
|
||||
memset( &reslist, 0, sizeof( resourcelist_t ));
|
||||
|
||||
reslist.rescount = MSG_ReadWord( msg ) - 1;
|
||||
|
||||
|
|
|
@ -217,8 +217,8 @@ qboolean CL_CopyEntityToPhysEnt( physent_t *pe, cl_entity_t *ent )
|
|||
pe->frame = ent->curstate.frame;
|
||||
pe->sequence = ent->curstate.sequence;
|
||||
|
||||
Q_memcpy( &pe->controller[0], &ent->curstate.controller[0], 4 * sizeof( byte ));
|
||||
Q_memcpy( &pe->blending[0], &ent->curstate.blending[0], 2 * sizeof( byte ));
|
||||
memcpy( &pe->controller[0], &ent->curstate.controller[0], 4 * sizeof( byte ));
|
||||
memcpy( &pe->blending[0], &ent->curstate.blending[0], 2 * sizeof( byte ));
|
||||
|
||||
pe->movetype = ent->curstate.movetype;
|
||||
pe->takedamage = ( pe->player ) ? DAMAGE_AIM : DAMAGE_YES;
|
||||
|
@ -766,8 +766,8 @@ void CL_InitClientMove( void )
|
|||
clgame.player_maxs[i][0], clgame.player_maxs[i][1], clgame.player_maxs[i][2] );
|
||||
}
|
||||
|
||||
Q_memcpy( clgame.pmove->player_mins, clgame.player_mins, sizeof( clgame.player_mins ));
|
||||
Q_memcpy( clgame.pmove->player_maxs, clgame.player_maxs, sizeof( clgame.player_maxs ));
|
||||
memcpy( clgame.pmove->player_mins, clgame.player_mins, sizeof( clgame.player_mins ));
|
||||
memcpy( clgame.pmove->player_maxs, clgame.player_maxs, sizeof( clgame.player_maxs ));
|
||||
|
||||
// common utilities
|
||||
clgame.pmove->PM_Info_ValueForKey = Info_ValueForKey;
|
||||
|
@ -959,7 +959,7 @@ void CL_RunUsercmd( local_state_t *from, local_state_t *to, usercmd_t *u, qboole
|
|||
local_state_t temp;
|
||||
usercmd_t split;
|
||||
|
||||
Q_memset( &temp, 0, sizeof( temp ));
|
||||
memset( &temp, 0, sizeof( temp ));
|
||||
|
||||
while( u->msec > 50 )
|
||||
{
|
||||
|
@ -1045,9 +1045,9 @@ void CL_PostRunCmd( usercmd_t *ucmd, int random_seed )
|
|||
{
|
||||
local_state_t from, to;
|
||||
|
||||
Q_memset( &from, 0, sizeof( local_state_t ));
|
||||
Q_memset( &to, 0, sizeof( local_state_t ));
|
||||
Q_memcpy( from.weapondata, cl.frame.weapondata, sizeof( from.weapondata ));
|
||||
memset( &from, 0, sizeof( local_state_t ));
|
||||
memset( &to, 0, sizeof( local_state_t ));
|
||||
memcpy( from.weapondata, cl.frame.weapondata, sizeof( from.weapondata ));
|
||||
from.playerstate = cl.frame.playerstate[cl.playernum];
|
||||
from.client = cl.frame.client;
|
||||
to = from;
|
||||
|
@ -1133,7 +1133,7 @@ void CL_PredictMovement( void )
|
|||
from = &cl.predict[cl.parsecountmod];
|
||||
from->playerstate = cl.frame.playerstate[cl.playernum];
|
||||
from->client = cl.frame.client;
|
||||
Q_memcpy( from->weapondata, cl.frame.weapondata, sizeof( from->weapondata ));
|
||||
memcpy( from->weapondata, cl.frame.weapondata, sizeof( from->weapondata ));
|
||||
|
||||
time = cl.frame.time;
|
||||
|
||||
|
@ -1172,7 +1172,7 @@ void CL_PredictMovement( void )
|
|||
outgoing_command = cls.netchan.outgoing_sequence;
|
||||
|
||||
from = &cl.predict[cl.parsecountmod];
|
||||
Q_memcpy( from->weapondata, cl.frame.weapondata, sizeof( from->weapondata ));
|
||||
memcpy( from->weapondata, cl.frame.weapondata, sizeof( from->weapondata ));
|
||||
from->playerstate = cl.frame.playerstate[cl.playernum];
|
||||
from->client = cl.frame.client;
|
||||
|
||||
|
|
|
@ -123,13 +123,13 @@ void CL_DuplicateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomco
|
|||
|
||||
// backup original palette
|
||||
pal = (byte *)(tx + 1) + (tx->width * tx->height);
|
||||
Q_memcpy( paletteBackup, pal, 768 );
|
||||
memcpy( paletteBackup, pal, 768 );
|
||||
|
||||
raw = CL_CreateRawTextureFromPixels( tx, &size, topcolor, bottomcolor );
|
||||
ptexture->index = GL_LoadTexture( texname, raw, size, TF_FORCE_COLOR, NULL ); // do copy
|
||||
|
||||
// restore original palette
|
||||
Q_memcpy( pal, paletteBackup, 768 );
|
||||
memcpy( pal, paletteBackup, 768 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -173,7 +173,7 @@ void CL_UpdateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomcolor
|
|||
|
||||
// backup original palette
|
||||
pal = (byte *)(tx + 1) + (tx->width * tx->height);
|
||||
Q_memcpy( paletteBackup, pal, 768 );
|
||||
memcpy( paletteBackup, pal, 768 );
|
||||
|
||||
raw = CL_CreateRawTextureFromPixels( tx, &size, topcolor, bottomcolor );
|
||||
pic = FS_LoadImage( glt->name, raw, size );
|
||||
|
@ -187,7 +187,7 @@ void CL_UpdateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomcolor
|
|||
FS_FreeImage( pic );
|
||||
|
||||
// restore original palette
|
||||
Q_memcpy( pal, paletteBackup, 768 );
|
||||
memcpy( pal, paletteBackup, 768 );
|
||||
|
||||
ASSERT( index == ptexture->index );
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
|||
dst = info->ptexture;
|
||||
|
||||
// copy unchanged first
|
||||
Q_memcpy( dst, src, sizeof( mstudiotexture_t ) * phdr->numtextures );
|
||||
memcpy( dst, src, sizeof( mstudiotexture_t ) * phdr->numtextures );
|
||||
|
||||
// make local copies for remap textures
|
||||
for( i = 0; i < info->numtextures; i++ )
|
||||
|
|
|
@ -44,21 +44,21 @@ static qboolean scr_init = false;
|
|||
SCR_DrawFPS
|
||||
==============
|
||||
*/
|
||||
void SCR_DrawFPS( void )
|
||||
void SCR_DrawFPS( int height )
|
||||
{
|
||||
float calc;
|
||||
rgba_t color;
|
||||
double newtime;
|
||||
static double nexttime = 0, lasttime = 0;
|
||||
static double framerate = 0;
|
||||
static int framecount = 0;
|
||||
static int minfps = 9999;
|
||||
static int maxfps = 0;
|
||||
double newtime;
|
||||
char fpsstring[64];
|
||||
int offset;
|
||||
|
||||
if( cls.state != ca_active ) return;
|
||||
if( !cl_showfps->integer || cl.background ) return;
|
||||
if( cls.state != ca_active || !cl_showfps->integer || cl.background )
|
||||
return;
|
||||
|
||||
switch( cls.scrshot_action )
|
||||
{
|
||||
|
@ -74,12 +74,12 @@ void SCR_DrawFPS( void )
|
|||
{
|
||||
framerate = framecount / (newtime - lasttime);
|
||||
lasttime = newtime;
|
||||
nexttime = max( nexttime + 1, lasttime - 1 );
|
||||
nexttime = Q_max( nexttime + 1.0, lasttime - 1.0 );
|
||||
framecount = 0;
|
||||
}
|
||||
|
||||
framecount++;
|
||||
calc = framerate;
|
||||
framecount++;
|
||||
|
||||
if( calc < 1.0f )
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ void SCR_DrawFPS( void )
|
|||
}
|
||||
|
||||
Con_DrawStringLen( fpsstring, &offset, NULL );
|
||||
Con_DrawString( scr_width->integer - offset - 3, 4, fpsstring, color );
|
||||
Con_DrawString( scr_width->integer - offset - 4, height, fpsstring, color );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -555,13 +555,13 @@ SCR_VidInit
|
|||
*/
|
||||
void SCR_VidInit( void )
|
||||
{
|
||||
Q_memset( &clgame.ds, 0, sizeof( clgame.ds )); // reset a draw state
|
||||
Q_memset( &menu.ds, 0, sizeof( menu.ds )); // reset a draw state
|
||||
Q_memset( &clgame.centerPrint, 0, sizeof( clgame.centerPrint ));
|
||||
memset( &clgame.ds, 0, sizeof( clgame.ds )); // reset a draw state
|
||||
memset( &gameui.ds, 0, sizeof( gameui.ds )); // reset a draw state
|
||||
memset( &clgame.centerPrint, 0, sizeof( clgame.centerPrint ));
|
||||
|
||||
// update screen sizes for menu
|
||||
menu.globals->scrWidth = scr_width->integer;
|
||||
menu.globals->scrHeight = scr_height->integer;
|
||||
gameui.globals->scrWidth = scr_width->integer;
|
||||
gameui.globals->scrHeight = scr_height->integer;
|
||||
|
||||
SCR_RebuildGammaTable();
|
||||
VGui_Startup ();
|
||||
|
@ -569,7 +569,7 @@ void SCR_VidInit( void )
|
|||
clgame.load_sequence++; // now all hud sprites are invalid
|
||||
|
||||
// vid_state has changed
|
||||
if( menu.hInstance ) menu.dllFuncs.pfnVidInit();
|
||||
if( gameui.hInstance ) gameui.dllFuncs.pfnVidInit();
|
||||
if( clgame.hInstance ) clgame.dllFuncs.pfnVidInit();
|
||||
|
||||
// restart console size
|
||||
|
@ -605,7 +605,7 @@ void SCR_Init( void )
|
|||
|
||||
if( host.state != HOST_RESTART && !UI_LoadProgs( ))
|
||||
{
|
||||
Msg( "^1Error: ^7can't initialize menu.dll\n" ); // there is non fatal for us
|
||||
Msg( "^1Error: ^7can't initialize gameui.dll\n" ); // there is non fatal for us
|
||||
if( !host.developer ) host.developer = 1; // we need console, because menu is missing
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ void CL_PrepareTEnt( TEMPENTITY *pTemp, model_t *pmodel )
|
|||
int modelIndex = 0;
|
||||
int modelHandle = pTemp->entity.trivial_accept;
|
||||
|
||||
Q_memset( pTemp, 0, sizeof( *pTemp ));
|
||||
memset( pTemp, 0, sizeof( *pTemp ));
|
||||
|
||||
// use these to set per-frame and termination conditions / actions
|
||||
pTemp->entity.trivial_accept = modelHandle; // keep unchanged
|
||||
|
@ -2309,7 +2309,7 @@ CL_ClearLightStyles
|
|||
*/
|
||||
void CL_ClearLightStyles( void )
|
||||
{
|
||||
Q_memset( cl.lightstyles, 0, sizeof( cl.lightstyles ));
|
||||
memset( cl.lightstyles, 0, sizeof( cl.lightstyles ));
|
||||
}
|
||||
|
||||
void CL_SetLightstyle( int style, const char *s, float f )
|
||||
|
@ -2366,8 +2366,8 @@ CL_ClearDlights
|
|||
*/
|
||||
void CL_ClearDlights( void )
|
||||
{
|
||||
Q_memset( cl_dlights, 0, sizeof( cl_dlights ));
|
||||
Q_memset( cl_elights, 0, sizeof( cl_elights ));
|
||||
memset( cl_dlights, 0, sizeof( cl_dlights ));
|
||||
memset( cl_elights, 0, sizeof( cl_elights ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2389,7 +2389,7 @@ dlight_t *CL_AllocDlight( int key )
|
|||
if( dl->key == key )
|
||||
{
|
||||
// reuse this light
|
||||
Q_memset( dl, 0, sizeof( *dl ));
|
||||
memset( dl, 0, sizeof( *dl ));
|
||||
dl->key = key;
|
||||
return dl;
|
||||
}
|
||||
|
@ -2401,7 +2401,7 @@ dlight_t *CL_AllocDlight( int key )
|
|||
{
|
||||
if( dl->die < cl.time && dl->key == 0 )
|
||||
{
|
||||
Q_memset( dl, 0, sizeof( *dl ));
|
||||
memset( dl, 0, sizeof( *dl ));
|
||||
dl->key = key;
|
||||
return dl;
|
||||
}
|
||||
|
@ -2409,7 +2409,7 @@ dlight_t *CL_AllocDlight( int key )
|
|||
|
||||
// otherwise grab first dlight
|
||||
dl = &cl_dlights[0];
|
||||
Q_memset( dl, 0, sizeof( *dl ));
|
||||
memset( dl, 0, sizeof( *dl ));
|
||||
dl->key = key;
|
||||
|
||||
return dl;
|
||||
|
@ -2434,7 +2434,7 @@ dlight_t *CL_AllocElight( int key )
|
|||
if( dl->key == key )
|
||||
{
|
||||
// reuse this light
|
||||
Q_memset( dl, 0, sizeof( *dl ));
|
||||
memset( dl, 0, sizeof( *dl ));
|
||||
dl->key = key;
|
||||
return dl;
|
||||
}
|
||||
|
@ -2446,7 +2446,7 @@ dlight_t *CL_AllocElight( int key )
|
|||
{
|
||||
if( dl->die < cl.time && dl->key == 0 )
|
||||
{
|
||||
Q_memset( dl, 0, sizeof( *dl ));
|
||||
memset( dl, 0, sizeof( *dl ));
|
||||
dl->key = key;
|
||||
return dl;
|
||||
}
|
||||
|
@ -2454,7 +2454,7 @@ dlight_t *CL_AllocElight( int key )
|
|||
|
||||
// otherwise grab first dlight
|
||||
dl = &cl_elights[0];
|
||||
Q_memset( dl, 0, sizeof( *dl ));
|
||||
memset( dl, 0, sizeof( *dl ));
|
||||
dl->key = key;
|
||||
|
||||
return dl;
|
||||
|
@ -2482,7 +2482,7 @@ void CL_DecayLights( void )
|
|||
if( dl->radius < 0 ) dl->radius = 0;
|
||||
|
||||
if( dl->die < cl.time || !dl->radius )
|
||||
Q_memset( dl, 0, sizeof( *dl ));
|
||||
memset( dl, 0, sizeof( *dl ));
|
||||
}
|
||||
|
||||
for( i = 0, dl = cl_elights; i < MAX_ELIGHTS; i++, dl++ )
|
||||
|
@ -2493,7 +2493,7 @@ void CL_DecayLights( void )
|
|||
if( dl->radius < 0 ) dl->radius = 0;
|
||||
|
||||
if( dl->die < cl.time || !dl->radius )
|
||||
Q_memset( dl, 0, sizeof( *dl ));
|
||||
memset( dl, 0, sizeof( *dl ));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2744,7 +2744,7 @@ void CL_ClearEfrags( void )
|
|||
{
|
||||
int i;
|
||||
|
||||
Q_memset( cl_efrags, 0, sizeof( cl_efrags ));
|
||||
memset( cl_efrags, 0, sizeof( cl_efrags ));
|
||||
|
||||
// allocate the efrags and chain together into a free list
|
||||
clgame.free_efrags = cl_efrags;
|
||||
|
|
|
@ -299,7 +299,6 @@ void V_PostRender( void )
|
|||
{
|
||||
SCR_RSpeeds();
|
||||
SCR_NetSpeeds();
|
||||
SCR_DrawFPS();
|
||||
SCR_DrawNetGraph();
|
||||
SV_DrawOrthoTriangles();
|
||||
CL_DrawDemoRecording();
|
||||
|
|
|
@ -449,7 +449,7 @@ typedef struct
|
|||
long logo_xres;
|
||||
long logo_yres;
|
||||
float logo_length;
|
||||
} menu_static_t;
|
||||
} gameui_static_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -549,7 +549,7 @@ extern "C" {
|
|||
extern client_t cl;
|
||||
extern client_static_t cls;
|
||||
extern clgame_static_t clgame;
|
||||
extern menu_static_t menu;
|
||||
extern gameui_static_t gameui;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -690,7 +690,6 @@ void NetAPI_CancelAllRequests( void );
|
|||
int CL_FindModelIndex( const char *m );
|
||||
HSPRITE pfnSPR_Load( const char *szPicName );
|
||||
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
|
||||
void TextAdjustSize( int *x, int *y, int *w, int *h );
|
||||
void PicAdjustSize( float *x, float *y, float *w, float *h );
|
||||
void CL_FillRGBA( int x, int y, int width, int height, int r, int g, int b, int a );
|
||||
void CL_FillRGBABlend( int x, int y, int width, int height, int r, int g, int b, int a );
|
||||
|
@ -729,7 +728,7 @@ void SCR_MakeScreenShot( void );
|
|||
void SCR_MakeLevelShot( void );
|
||||
void SCR_NetSpeeds( void );
|
||||
void SCR_RSpeeds( void );
|
||||
void SCR_DrawFPS( void );
|
||||
void SCR_DrawFPS( int height );
|
||||
|
||||
//
|
||||
// cl_netgraph.c
|
||||
|
@ -873,7 +872,7 @@ void S_RenderFrame( struct ref_params_s *fd );
|
|||
void S_ExtraUpdate( void );
|
||||
|
||||
//
|
||||
// cl_menu.c
|
||||
// cl_gameui.c
|
||||
//
|
||||
void UI_UnloadProgs( void );
|
||||
qboolean UI_LoadProgs( void );
|
||||
|
|
|
@ -95,7 +95,7 @@ void GL_BackendEndFrame( void )
|
|||
break;
|
||||
}
|
||||
|
||||
Q_memset( &r_stats, 0, sizeof( r_stats ));
|
||||
memset( &r_stats, 0, sizeof( r_stats ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -634,7 +634,7 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
|
|||
r_side->buffer = temp;
|
||||
|
||||
if( flags ) Image_Process( &r_side, 0, 0, 0.0f, flags, NULL );
|
||||
Q_memcpy( buffer + (size * size * 3 * i), r_side->buffer, size * size * 3 );
|
||||
memcpy( buffer + (size * size * 3 * i), r_side->buffer, size * size * 3 );
|
||||
}
|
||||
|
||||
RI.params &= ~RP_ENVVIEW;
|
||||
|
|
|
@ -997,7 +997,7 @@ BEAM *CL_AllocBeam( void )
|
|||
pBeam = cl_free_beams;
|
||||
cl_free_beams = pBeam->next;
|
||||
|
||||
Q_memset( pBeam, 0, sizeof( *pBeam ));
|
||||
memset( pBeam, 0, sizeof( *pBeam ));
|
||||
|
||||
pBeam->next = cl_active_beams;
|
||||
cl_active_beams = pBeam;
|
||||
|
@ -1497,7 +1497,7 @@ void CL_DrawCustomBeam( cl_entity_t *pbeam )
|
|||
if( Mod_GetType( pbeam->curstate.modelindex ) != mod_sprite )
|
||||
return;
|
||||
|
||||
Q_memset( &beam, 0, sizeof( beam ));
|
||||
memset( &beam, 0, sizeof( beam ));
|
||||
|
||||
beamType = ( pbeam->curstate.rendermode & 0x0F );
|
||||
beamFlags = ( pbeam->curstate.rendermode & 0xF0 );
|
||||
|
|
|
@ -60,7 +60,7 @@ static int gDecalCount;
|
|||
|
||||
void R_ClearDecals( void )
|
||||
{
|
||||
Q_memset( gDecalPool, 0, sizeof( gDecalPool ));
|
||||
memset( gDecalPool, 0, sizeof( gDecalPool ));
|
||||
gDecalCount = 0;
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ static int SHClip( float *vert, int vertCount, float *out, int edge )
|
|||
if( R_ClipInside( s, edge ))
|
||||
{
|
||||
// Add a vertex and advance out to next vertex
|
||||
Q_memcpy( out, p, sizeof( float ) * VERTEXSIZE );
|
||||
memcpy( out, p, sizeof( float ) * VERTEXSIZE );
|
||||
out += VERTEXSIZE;
|
||||
outCount++;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ static int SHClip( float *vert, int vertCount, float *out, int edge )
|
|||
out += VERTEXSIZE;
|
||||
outCount++;
|
||||
|
||||
Q_memcpy( out, p, sizeof( float ) * VERTEXSIZE );
|
||||
memcpy( out, p, sizeof( float ) * VERTEXSIZE );
|
||||
out += VERTEXSIZE;
|
||||
outCount++;
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ msurfmesh_t *R_DecalCreateMesh( decalinfo_t *decalinfo, decal_t *pdecal, msurfac
|
|||
out->sccoord[1] = (( DotProduct( v , surf->texinfo->vecs[1] ) + surf->texinfo->vecs[1][3] ) / surf->texinfo->texture->height );
|
||||
|
||||
// clear colors (it can be used for vertex lighting)
|
||||
Q_memset( out->color, 0xFF, sizeof( out->color ));
|
||||
memset( out->color, 0xFF, sizeof( out->color ));
|
||||
}
|
||||
|
||||
pdecal->mesh = mesh;
|
||||
|
|
|
@ -1335,7 +1335,7 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags, i
|
|||
|
||||
if( !GL_UploadTexture( tex, pic ))
|
||||
{
|
||||
Q_memset( tex, 0, sizeof( gltexture_t ));
|
||||
memset( tex, 0, sizeof( gltexture_t ));
|
||||
FS_FreeImage( pic ); // release source texture
|
||||
return 0;
|
||||
}
|
||||
|
@ -1450,7 +1450,7 @@ int GL_LoadTextureArray( const char **names, int flags, imgfilter_t *filter )
|
|||
{
|
||||
// create new image
|
||||
pic = Mem_Alloc( host.imagepool, sizeof( rgbdata_t ));
|
||||
Q_memcpy( pic, src, sizeof( rgbdata_t ));
|
||||
memcpy( pic, src, sizeof( rgbdata_t ));
|
||||
|
||||
// expand pic buffer for all layers
|
||||
pic->buffer = Mem_Alloc( host.imagepool, pic->size * numLayers );
|
||||
|
@ -1464,7 +1464,7 @@ int GL_LoadTextureArray( const char **names, int flags, imgfilter_t *filter )
|
|||
int width = max( 1, ( pic->width >> j ));
|
||||
int height = max( 1, ( pic->height >> j ));
|
||||
mipsize = GL_CalcImageSize( pic->type, width, height, 1 );
|
||||
Q_memcpy( pic->buffer + dstsize + mipsize * i, src->buffer + srcsize, mipsize );
|
||||
memcpy( pic->buffer + dstsize + mipsize * i, src->buffer + srcsize, mipsize );
|
||||
dstsize += mipsize * numLayers;
|
||||
srcsize += mipsize;
|
||||
}
|
||||
|
@ -1510,7 +1510,7 @@ int GL_LoadTextureArray( const char **names, int flags, imgfilter_t *filter )
|
|||
GL_ProcessImage( tex, pic, filter );
|
||||
if( !GL_UploadTexture( tex, pic ))
|
||||
{
|
||||
Q_memset( tex, 0, sizeof( gltexture_t ));
|
||||
memset( tex, 0, sizeof( gltexture_t ));
|
||||
FS_FreeImage( pic ); // release source texture
|
||||
return 0;
|
||||
}
|
||||
|
@ -1597,7 +1597,7 @@ int GL_LoadTextureInternal( const char *name, rgbdata_t *pic, texFlags_t flags,
|
|||
GL_ProcessImage( tex, pic, NULL );
|
||||
if( !GL_UploadTexture( tex, pic ))
|
||||
{
|
||||
Q_memset( tex, 0, sizeof( gltexture_t ));
|
||||
memset( tex, 0, sizeof( gltexture_t ));
|
||||
FS_FreeImage( pic ); // release source texture
|
||||
return 0;
|
||||
}
|
||||
|
@ -1627,7 +1627,7 @@ int GL_CreateTexture( const char *name, int width, int height, const void *buffe
|
|||
rgbdata_t r_empty;
|
||||
int texture;
|
||||
|
||||
Q_memset( &r_empty, 0, sizeof( r_empty ));
|
||||
memset( &r_empty, 0, sizeof( r_empty ));
|
||||
r_empty.width = width;
|
||||
r_empty.height = height;
|
||||
r_empty.type = PF_RGBA_32;
|
||||
|
@ -1672,7 +1672,7 @@ int GL_CreateTextureArray( const char *name, int width, int height, int depth, c
|
|||
rgbdata_t r_empty;
|
||||
int texture;
|
||||
|
||||
Q_memset( &r_empty, 0, sizeof( r_empty ));
|
||||
memset( &r_empty, 0, sizeof( r_empty ));
|
||||
r_empty.width = width;
|
||||
r_empty.height = height;
|
||||
r_empty.depth = depth;
|
||||
|
@ -1876,7 +1876,7 @@ void R_FreeImage( gltexture_t *image )
|
|||
FS_FreeImage( image->original );
|
||||
|
||||
pglDeleteTextures( 1, &image->texnum );
|
||||
Q_memset( image, 0, sizeof( *image ));
|
||||
memset( image, 0, sizeof( *image ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2191,7 +2191,7 @@ static rgbdata_t *R_InitAttenuationTextureNoAtten( texFlags_t *flags )
|
|||
r_image.type = PF_RGBA_32;
|
||||
r_image.size = r_image.width * r_image.height * 4;
|
||||
|
||||
Q_memset( data2D, 0xFF, r_image.size );
|
||||
memset( data2D, 0xFF, r_image.size );
|
||||
*flags = TF_UNCOMPRESSED|TF_NOMIPMAP|TF_CLAMP|TF_TEXTURE_1D;
|
||||
|
||||
return &r_image;
|
||||
|
@ -2261,7 +2261,7 @@ static rgbdata_t *R_InitDlightTexture( texFlags_t *flags )
|
|||
r_image.size = r_image.width * r_image.height * 4;
|
||||
r_image.buffer = data2D;
|
||||
|
||||
Q_memset( data2D, 0x00, r_image.size );
|
||||
memset( data2D, 0x00, r_image.size );
|
||||
|
||||
*flags = TF_NOPICMIP|TF_UNCOMPRESSED|TF_NOMIPMAP;
|
||||
|
||||
|
@ -2278,7 +2278,7 @@ static rgbdata_t *R_InitDlightTexture2( texFlags_t *flags )
|
|||
r_image.size = r_image.width * r_image.height * 4;
|
||||
r_image.buffer = data2D;
|
||||
|
||||
Q_memset( data2D, 0x00, r_image.size );
|
||||
memset( data2D, 0x00, r_image.size );
|
||||
|
||||
*flags = TF_NOPICMIP|TF_UNCOMPRESSED|TF_NOMIPMAP;
|
||||
|
||||
|
@ -2401,7 +2401,7 @@ static rgbdata_t *R_InitGrayCubemap( texFlags_t *flags )
|
|||
return NULL;
|
||||
|
||||
// gray cubemap - just stub for pointlights
|
||||
Q_memset( dataCM, 0x7F, size * size * 6 * 4 );
|
||||
memset( dataCM, 0x7F, size * size * 6 * 4 );
|
||||
|
||||
*flags = (TF_NOPICMIP|TF_NOMIPMAP|TF_UNCOMPRESSED|TF_CUBEMAP|TF_CLAMP);
|
||||
|
||||
|
@ -2428,7 +2428,7 @@ static rgbdata_t *R_InitWhiteCubemap( texFlags_t *flags )
|
|||
return NULL;
|
||||
|
||||
// white cubemap - just stub for pointlights
|
||||
Q_memset( dataCM, 0xFF, size * size * 6 * 4 );
|
||||
memset( dataCM, 0xFF, size * size * 6 * 4 );
|
||||
|
||||
*flags = (TF_NOPICMIP|TF_NOMIPMAP|TF_UNCOMPRESSED|TF_CUBEMAP|TF_CLAMP);
|
||||
|
||||
|
@ -2522,8 +2522,8 @@ static void R_InitBuiltinTextures( void )
|
|||
|
||||
for( i = 0; i < num_builtin_textures; i++ )
|
||||
{
|
||||
Q_memset( &r_image, 0, sizeof( rgbdata_t ));
|
||||
Q_memset( data2D, 0xFF, sizeof( data2D ));
|
||||
memset( &r_image, 0, sizeof( rgbdata_t ));
|
||||
memset( data2D, 0xFF, sizeof( data2D ));
|
||||
|
||||
pic = textures[i].init( &flags );
|
||||
if( pic == NULL ) continue;
|
||||
|
@ -2740,8 +2740,8 @@ void R_InitImages( void )
|
|||
uint i, hash;
|
||||
float f;
|
||||
|
||||
Q_memset( r_textures, 0, sizeof( r_textures ));
|
||||
Q_memset( r_texturesHashTable, 0, sizeof( r_texturesHashTable ));
|
||||
memset( r_textures, 0, sizeof( r_textures ));
|
||||
memset( r_texturesHashTable, 0, sizeof( r_texturesHashTable ));
|
||||
r_numTextures = 0;
|
||||
|
||||
// create unused 0-entry
|
||||
|
@ -2786,8 +2786,8 @@ void R_ShutdownImages( void )
|
|||
for( i = 0, image = r_textures; i < r_numTextures; i++, image++ )
|
||||
R_FreeImage( image );
|
||||
|
||||
Q_memset( tr.lightmapTextures, 0, sizeof( tr.lightmapTextures ));
|
||||
Q_memset( r_texturesHashTable, 0, sizeof( r_texturesHashTable ));
|
||||
Q_memset( r_textures, 0, sizeof( r_textures ));
|
||||
memset( tr.lightmapTextures, 0, sizeof( tr.lightmapTextures ));
|
||||
memset( r_texturesHashTable, 0, sizeof( r_texturesHashTable ));
|
||||
memset( r_textures, 0, sizeof( r_textures ));
|
||||
r_numTextures = 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -150,7 +150,7 @@ int R_AllocateMirrorTexture( void )
|
|||
if( !texture )
|
||||
{
|
||||
// not initialized ?
|
||||
Q_memset( &r_screen, 0, sizeof( r_screen ));
|
||||
memset( &r_screen, 0, sizeof( r_screen ));
|
||||
Q_snprintf( txName, sizeof( txName ), "*screen%i", i );
|
||||
|
||||
r_screen.width = RI.viewport[2];
|
||||
|
|
|
@ -1348,7 +1348,10 @@ void R_EndFrame( void )
|
|||
R_Set2DMode( false );
|
||||
|
||||
if( !pwglSwapBuffers( glw_state.hDC ))
|
||||
Sys_Error( "wglSwapBuffers() failed!\n" );
|
||||
{
|
||||
Msg( "Error: WGL: failed to swap buffers\n" );
|
||||
Host_NewInstance( va("#%s", GI->gamefolder ), "stopped" );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1727,7 +1730,7 @@ Initialize client external rendering
|
|||
qboolean R_InitRenderAPI( void )
|
||||
{
|
||||
// make sure what render functions is cleared
|
||||
Q_memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
|
||||
memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
|
||||
|
||||
if( clgame.dllFuncs.pfnGetRenderInterface )
|
||||
{
|
||||
|
@ -1738,7 +1741,7 @@ qboolean R_InitRenderAPI( void )
|
|||
}
|
||||
|
||||
// make sure what render functions is cleared
|
||||
Q_memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
|
||||
memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
|
||||
|
||||
return false; // just tell user about problems
|
||||
}
|
||||
|
|
|
@ -319,7 +319,7 @@ void R_ParseTexFilters( const char *filename )
|
|||
{
|
||||
imgfilter_t filter;
|
||||
|
||||
Q_memset( &filter, 0, sizeof( filter ));
|
||||
memset( &filter, 0, sizeof( filter ));
|
||||
Q_strncpy( texname, token, sizeof( texname ));
|
||||
|
||||
// parse filter
|
||||
|
|
|
@ -213,7 +213,7 @@ static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts
|
|||
}
|
||||
|
||||
// copy first vertex to last
|
||||
Q_memcpy( poly->verts[i+1], poly->verts[1], sizeof( poly->verts[0] ));
|
||||
memcpy( poly->verts[i+1], poly->verts[1], sizeof( poly->verts[0] ));
|
||||
}
|
||||
|
||||
void GL_SetupFogColorForSurfaces( void )
|
||||
|
@ -560,7 +560,7 @@ void R_SetCacheState( msurface_t *surf )
|
|||
*/
|
||||
static void LM_InitBlock( void )
|
||||
{
|
||||
Q_memset( gl_lms.allocated, 0, sizeof( gl_lms.allocated ));
|
||||
memset( gl_lms.allocated, 0, sizeof( gl_lms.allocated ));
|
||||
}
|
||||
|
||||
static int LM_AllocBlock( int w, int h, int *x, int *y )
|
||||
|
@ -627,7 +627,7 @@ static void LM_UploadBlock( qboolean dynamic )
|
|||
i = gl_lms.current_lightmap_texture;
|
||||
|
||||
// upload static lightmaps only during loading
|
||||
Q_memset( &r_lightmap, 0, sizeof( r_lightmap ));
|
||||
memset( &r_lightmap, 0, sizeof( r_lightmap ));
|
||||
Q_snprintf( lmName, sizeof( lmName ), "*lightmap%i", i );
|
||||
|
||||
r_lightmap.width = BLOCK_SIZE;
|
||||
|
@ -664,7 +664,7 @@ static void R_BuildLightMap( msurface_t *surf, byte *dest, int stride, qboolean
|
|||
|
||||
lm = surf->samples;
|
||||
|
||||
Q_memset( r_blocklights, 0, sizeof( uint ) * size * 3 );
|
||||
memset( r_blocklights, 0, sizeof( uint ) * size * 3 );
|
||||
|
||||
// add all the lightmaps
|
||||
for( map = 0; map < MAXLIGHTMAPS && surf->styles[map] != 255 && lm; map++ )
|
||||
|
@ -1421,7 +1421,7 @@ void R_DrawBrushModel( cl_entity_t *e )
|
|||
if( R_CullBox( mins, maxs, RI.clipFlags ))
|
||||
return;
|
||||
|
||||
Q_memset( gl_lms.lightmap_surfaces, 0, sizeof( gl_lms.lightmap_surfaces ));
|
||||
memset( gl_lms.lightmap_surfaces, 0, sizeof( gl_lms.lightmap_surfaces ));
|
||||
gl_lms.dynamic_surfaces = NULL;
|
||||
|
||||
if( rotated ) R_RotateForEntity( e );
|
||||
|
@ -1899,9 +1899,9 @@ void R_DrawWorld( void )
|
|||
return;
|
||||
|
||||
VectorCopy( RI.cullorigin, tr.modelorg );
|
||||
Q_memset( gl_lms.lightmap_surfaces, 0, sizeof( gl_lms.lightmap_surfaces ));
|
||||
Q_memset( fullbright_polys, 0, sizeof( fullbright_polys ));
|
||||
Q_memset( detail_surfaces, 0, sizeof( detail_surfaces ));
|
||||
memset( gl_lms.lightmap_surfaces, 0, sizeof( gl_lms.lightmap_surfaces ));
|
||||
memset( fullbright_polys, 0, sizeof( fullbright_polys ));
|
||||
memset( detail_surfaces, 0, sizeof( detail_surfaces ));
|
||||
|
||||
RI.currentWaveHeight = RI.waveHeight;
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
|
@ -1987,7 +1987,7 @@ void R_MarkLeaves( void )
|
|||
{
|
||||
int longs = ( cl.worldmodel->numleafs + 31 ) >> 5;
|
||||
|
||||
Q_memcpy( visbytes, vis, longs << 2 );
|
||||
memcpy( visbytes, vis, longs << 2 );
|
||||
vis = Mod_LeafPVS( r_viewleaf2, cl.worldmodel );
|
||||
|
||||
for( i = 0; i < longs; i++ )
|
||||
|
@ -2074,7 +2074,7 @@ void GL_RebuildLightmaps( void )
|
|||
GL_FreeTexture( tr.lightmapTextures[i] );
|
||||
}
|
||||
|
||||
Q_memset( tr.lightmapTextures, 0, sizeof( tr.lightmapTextures ));
|
||||
memset( tr.lightmapTextures, 0, sizeof( tr.lightmapTextures ));
|
||||
gl_lms.current_lightmap_texture = 0;
|
||||
|
||||
// setup all the lightstyles
|
||||
|
@ -2131,10 +2131,10 @@ void GL_BuildLightmaps( void )
|
|||
GL_FreeTexture( tr.mirrorTextures[i] );
|
||||
}
|
||||
|
||||
Q_memset( tr.lightmapTextures, 0, sizeof( tr.lightmapTextures ));
|
||||
Q_memset( tr.mirror_entities, 0, sizeof( tr.mirror_entities ));
|
||||
Q_memset( tr.mirrorTextures, 0, sizeof( tr.mirrorTextures ));
|
||||
Q_memset( visbytes, 0x00, sizeof( visbytes ));
|
||||
memset( tr.lightmapTextures, 0, sizeof( tr.lightmapTextures ));
|
||||
memset( tr.mirror_entities, 0, sizeof( tr.mirror_entities ));
|
||||
memset( tr.mirrorTextures, 0, sizeof( tr.mirrorTextures ));
|
||||
memset( visbytes, 0x00, sizeof( visbytes ));
|
||||
|
||||
skychain = NULL;
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean
|
|||
mod->maxs[2] = h / 2;
|
||||
|
||||
// create a temporary pic
|
||||
Q_memset( &temp, 0, sizeof( temp ));
|
||||
memset( &temp, 0, sizeof( temp ));
|
||||
temp.width = w;
|
||||
temp.height = h;
|
||||
temp.type = pix->type;
|
||||
|
@ -443,7 +443,7 @@ void Mod_UnloadSpriteModel( model_t *mod )
|
|||
}
|
||||
|
||||
Mem_FreePool( &mod->mempool );
|
||||
Q_memset( mod, 0, sizeof( *mod ));
|
||||
memset( mod, 0, sizeof( *mod ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -309,7 +309,7 @@ pfnPlayerInfo
|
|||
static player_info_t *pfnPlayerInfo( int index )
|
||||
{
|
||||
if( cls.key_dest == key_menu && !index )
|
||||
return &menu.playerinfo;
|
||||
return &gameui.playerinfo;
|
||||
|
||||
if( index < 0 || index > cl.maxclients )
|
||||
return NULL;
|
||||
|
@ -677,7 +677,7 @@ mstudioanim_t *R_StudioGetAnim( model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc
|
|||
MsgDev( D_INFO, "loading: %s\n", filepath );
|
||||
|
||||
paSequences[pseqdesc->seqgroup].data = Mem_Alloc( com_studiocache, filesize );
|
||||
Q_memcpy( paSequences[pseqdesc->seqgroup].data, buf, filesize );
|
||||
memcpy( paSequences[pseqdesc->seqgroup].data, buf, filesize );
|
||||
Mem_Free( buf );
|
||||
}
|
||||
|
||||
|
@ -2444,8 +2444,8 @@ static model_t *R_StudioSetupPlayerModel( int index )
|
|||
|
||||
if( cls.key_dest == key_menu && !index )
|
||||
{
|
||||
// we are in menu.
|
||||
info = &menu.playerinfo;
|
||||
// we are in gameui.
|
||||
info = &gameui.playerinfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3044,7 +3044,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
|||
if( RI.currententity->index > 0 )
|
||||
{
|
||||
cl_entity_t *ent = CL_GetEntityByIndex( RI.currententity->index );
|
||||
Q_memcpy( ent->attachment, RI.currententity->attachment, sizeof( vec3_t ) * 4 );
|
||||
memcpy( ent->attachment, RI.currententity->attachment, sizeof( vec3_t ) * 4 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3187,7 +3187,7 @@ static int R_StudioDrawModel( int flags )
|
|||
if( RI.currententity->index > 0 )
|
||||
{
|
||||
cl_entity_t *ent = CL_GetEntityByIndex( RI.currententity->index );
|
||||
Q_memcpy( ent->attachment, RI.currententity->attachment, sizeof( vec3_t ) * 4 );
|
||||
memcpy( ent->attachment, RI.currententity->attachment, sizeof( vec3_t ) * 4 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3425,7 +3425,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
|
|||
|
||||
// the pixels immediately follow the structures
|
||||
pixels = (byte *)phdr + ptexture->index;
|
||||
Q_memcpy( tx+1, pixels, size );
|
||||
memcpy( tx+1, pixels, size );
|
||||
|
||||
ptexture->flags |= STUDIO_NF_COLORMAP; // yes, this is colormap image
|
||||
flags |= TF_FORCE_COLOR;
|
||||
|
@ -3560,7 +3560,7 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||
size1 = thdr->numtextures * sizeof( mstudiotexture_t );
|
||||
size2 = thdr->numskinfamilies * thdr->numskinref * sizeof( short );
|
||||
mod->cache.data = Mem_Alloc( loadmodel->mempool, phdr->length + size1 + size2 );
|
||||
Q_memcpy( loadmodel->cache.data, buffer, phdr->length ); // copy main mdl buffer
|
||||
memcpy( loadmodel->cache.data, buffer, phdr->length ); // copy main mdl buffer
|
||||
phdr = (studiohdr_t *)loadmodel->cache.data; // get the new pointer on studiohdr
|
||||
phdr->numskinfamilies = thdr->numskinfamilies;
|
||||
phdr->numtextures = thdr->numtextures;
|
||||
|
@ -3570,7 +3570,7 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||
|
||||
in = (byte *)thdr + thdr->textureindex;
|
||||
out = (byte *)phdr + phdr->textureindex;
|
||||
Q_memcpy( out, in, size1 + size2 ); // copy textures + skinrefs
|
||||
memcpy( out, in, size1 + size2 ); // copy textures + skinrefs
|
||||
phdr->length += size1 + size2;
|
||||
Mem_Free( buffer2 ); // release T.mdl
|
||||
}
|
||||
|
@ -3579,13 +3579,13 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||
{
|
||||
// NOTE: we wan't keep raw textures in memory. just cutoff model pointer above texture base
|
||||
loadmodel->cache.data = Mem_Alloc( loadmodel->mempool, phdr->texturedataindex );
|
||||
Q_memcpy( loadmodel->cache.data, buffer, phdr->texturedataindex );
|
||||
memcpy( loadmodel->cache.data, buffer, phdr->texturedataindex );
|
||||
phdr->length = phdr->texturedataindex; // update model size
|
||||
}
|
||||
#else
|
||||
// just copy model into memory
|
||||
loadmodel->cache.data = Mem_Alloc( loadmodel->mempool, phdr->length );
|
||||
Q_memcpy( loadmodel->cache.data, buffer, phdr->length );
|
||||
memcpy( loadmodel->cache.data, buffer, phdr->length );
|
||||
#endif
|
||||
// setup bounding box
|
||||
VectorCopy( phdr->bbmin, loadmodel->mins );
|
||||
|
@ -3640,7 +3640,7 @@ void Mod_UnloadStudioModel( model_t *mod )
|
|||
}
|
||||
|
||||
Mem_FreePool( &mod->mempool );
|
||||
Q_memset( mod, 0, sizeof( *mod ));
|
||||
memset( mod, 0, sizeof( *mod ));
|
||||
}
|
||||
|
||||
static engine_studio_api_t gStudioAPI =
|
||||
|
|
|
@ -659,7 +659,7 @@ void GL_BuildGammaTable( void )
|
|||
invGamma = 1.0 / bound( 0.5, vid_gamma->value, 2.3 );
|
||||
div = (double) 1.0 / 255.5;
|
||||
|
||||
Q_memcpy( glState.gammaRamp, glState.stateRamp, sizeof( glState.gammaRamp ));
|
||||
memcpy( glState.gammaRamp, glState.stateRamp, sizeof( glState.gammaRamp ));
|
||||
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
|
@ -716,9 +716,9 @@ static void GL_SetDefaultTexState( void )
|
|||
{
|
||||
int i;
|
||||
|
||||
Q_memset( glState.currentTextures, -1, MAX_TEXTURE_UNITS * sizeof( *glState.currentTextures ));
|
||||
Q_memset( glState.texCoordArrayMode, 0, MAX_TEXTURE_UNITS * sizeof( *glState.texCoordArrayMode ));
|
||||
Q_memset( glState.genSTEnabled, 0, MAX_TEXTURE_UNITS * sizeof( *glState.genSTEnabled ));
|
||||
memset( glState.currentTextures, -1, MAX_TEXTURE_UNITS * sizeof( *glState.currentTextures ));
|
||||
memset( glState.texCoordArrayMode, 0, MAX_TEXTURE_UNITS * sizeof( *glState.texCoordArrayMode ));
|
||||
memset( glState.genSTEnabled, 0, MAX_TEXTURE_UNITS * sizeof( *glState.genSTEnabled ));
|
||||
|
||||
for( i = 0; i < MAX_TEXTURE_UNITS; i++ )
|
||||
{
|
||||
|
@ -734,7 +734,7 @@ GL_SetDefaultState
|
|||
*/
|
||||
static void GL_SetDefaultState( void )
|
||||
{
|
||||
Q_memset( &glState, 0, sizeof( glState ));
|
||||
memset( &glState, 0, sizeof( glState ));
|
||||
GL_SetDefaultTexState ();
|
||||
}
|
||||
|
||||
|
@ -965,7 +965,7 @@ void VID_StartupGamma( void )
|
|||
byte *savedGamma;
|
||||
|
||||
// init gamma ramp
|
||||
Q_memset( glState.stateRamp, 0, sizeof( glState.stateRamp ));
|
||||
memset( glState.stateRamp, 0, sizeof( glState.stateRamp ));
|
||||
|
||||
glConfig.deviceSupportsGamma = GetDeviceGammaRamp( glw_state.hDC, glState.stateRamp );
|
||||
|
||||
|
@ -997,20 +997,20 @@ void VID_StartupGamma( void )
|
|||
GL_BuildGammaTable();
|
||||
|
||||
// validate base gamma
|
||||
if( !Q_memcmp( savedGamma, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
if( !memcmp( savedGamma, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
{
|
||||
// all ok, previous gamma is valid
|
||||
MsgDev( D_NOTE, "VID_StartupGamma: validate screen gamma - ok\n" );
|
||||
}
|
||||
else if( !Q_memcmp( glState.gammaRamp, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
else if( !memcmp( glState.gammaRamp, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
{
|
||||
// screen gamma is equal to render gamma (probably previous instance crashed)
|
||||
// run additional check to make sure for it
|
||||
if( Q_memcmp( savedGamma, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
if( memcmp( savedGamma, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
{
|
||||
// yes, current gamma it's totally wrong, restore it from gamma.dat
|
||||
MsgDev( D_NOTE, "VID_StartupGamma: restore original gamma after crash\n" );
|
||||
Q_memcpy( glState.stateRamp, savedGamma, sizeof( glState.gammaRamp ));
|
||||
memcpy( glState.stateRamp, savedGamma, sizeof( glState.gammaRamp ));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1019,11 +1019,11 @@ void VID_StartupGamma( void )
|
|||
MsgDev( D_NOTE, "VID_StartupGamma: validate screen gamma - disabled\n" );
|
||||
}
|
||||
}
|
||||
else if( !Q_memcmp( glState.gammaRamp, savedGamma, sizeof( glState.stateRamp )))
|
||||
else if( !memcmp( glState.gammaRamp, savedGamma, sizeof( glState.stateRamp )))
|
||||
{
|
||||
// saved gamma is equal render gamma, probably gamma.dat wroted after crash
|
||||
// run additional check to make sure it
|
||||
if( Q_memcmp( savedGamma, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
if( memcmp( savedGamma, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
{
|
||||
// yes, saved gamma it's totally wrong, get origianl gamma from screen
|
||||
MsgDev( D_NOTE, "VID_StartupGamma: merge gamma.dat after crash\n" );
|
||||
|
@ -1040,7 +1040,7 @@ void VID_StartupGamma( void )
|
|||
{
|
||||
// current gamma unset by other application, so we can restore it here
|
||||
MsgDev( D_NOTE, "VID_StartupGamma: restore original gamma after crash\n" );
|
||||
Q_memcpy( glState.stateRamp, savedGamma, sizeof( glState.gammaRamp ));
|
||||
memcpy( glState.stateRamp, savedGamma, sizeof( glState.gammaRamp ));
|
||||
}
|
||||
|
||||
Mem_Free( savedGamma );
|
||||
|
@ -1386,7 +1386,7 @@ rserr_t R_ChangeDisplaySettings( int vid_mode, qboolean fullscreen )
|
|||
{
|
||||
DEVMODE dm;
|
||||
|
||||
Q_memset( &dm, 0, sizeof( dm ));
|
||||
memset( &dm, 0, sizeof( dm ));
|
||||
dm.dmSize = sizeof( dm );
|
||||
dm.dmPelsWidth = width;
|
||||
dm.dmPelsHeight = height;
|
||||
|
@ -1609,7 +1609,7 @@ void R_Free_OpenGL( void )
|
|||
Sys_FreeLibrary( &opengl_dll );
|
||||
|
||||
// now all extensions are disabled
|
||||
Q_memset( glConfig.extension, 0, sizeof( glConfig.extension ));
|
||||
memset( glConfig.extension, 0, sizeof( glConfig.extension ));
|
||||
glw_state.initialized = false;
|
||||
}
|
||||
|
||||
|
@ -2082,7 +2082,7 @@ void R_Shutdown( void )
|
|||
if( !clgame.sprites[i].name[0] ) continue;
|
||||
Mod_UnloadSpriteModel( &clgame.sprites[i] );
|
||||
}
|
||||
Q_memset( clgame.sprites, 0, sizeof( clgame.sprites ));
|
||||
memset( clgame.sprites, 0, sizeof( clgame.sprites ));
|
||||
|
||||
GL_RemoveCommands();
|
||||
R_ShutdownImages();
|
||||
|
|
|
@ -363,7 +363,7 @@ void R_UnloadSkybox( void )
|
|||
|
||||
tr.skyboxbasenum = 5800; // set skybox base (to let some mods load hi-res skyboxes)
|
||||
|
||||
Q_memset( tr.skyboxTextures, 0, sizeof( tr.skyboxTextures ));
|
||||
memset( tr.skyboxTextures, 0, sizeof( tr.skyboxTextures ));
|
||||
world.custom_skybox = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ static qboolean DS_CreateBuffers( void *hInst )
|
|||
DSBCAPS dsbcaps;
|
||||
WAVEFORMATEX pformat, format;
|
||||
|
||||
Q_memset( &format, 0, sizeof( format ));
|
||||
memset( &format, 0, sizeof( format ));
|
||||
|
||||
format.wFormatTag = WAVE_FORMAT_PCM;
|
||||
format.nChannels = 2;
|
||||
|
@ -111,13 +111,13 @@ static qboolean DS_CreateBuffers( void *hInst )
|
|||
MsgDev( D_NOTE, "- ok\n" );
|
||||
|
||||
// get access to the primary buffer, if possible, so we can set the sound hardware format
|
||||
Q_memset( &dsbuf, 0, sizeof( dsbuf ));
|
||||
memset( &dsbuf, 0, sizeof( dsbuf ));
|
||||
dsbuf.dwSize = sizeof( DSBUFFERDESC );
|
||||
dsbuf.dwFlags = DSBCAPS_PRIMARYBUFFER;
|
||||
dsbuf.dwBufferBytes = 0;
|
||||
dsbuf.lpwfxFormat = NULL;
|
||||
|
||||
Q_memset( &dsbcaps, 0, sizeof( dsbcaps ));
|
||||
memset( &dsbcaps, 0, sizeof( dsbcaps ));
|
||||
dsbcaps.dwSize = sizeof( dsbcaps );
|
||||
primary_format_set = false;
|
||||
|
||||
|
@ -147,13 +147,13 @@ static qboolean DS_CreateBuffers( void *hInst )
|
|||
if( !primary_format_set || !s_primary->integer )
|
||||
{
|
||||
// create the secondary buffer we'll actually work with
|
||||
Q_memset( &dsbuf, 0, sizeof( dsbuf ));
|
||||
memset( &dsbuf, 0, sizeof( dsbuf ));
|
||||
dsbuf.dwSize = sizeof( DSBUFFERDESC );
|
||||
dsbuf.dwFlags = (DSBCAPS_CTRLFREQUENCY|DSBCAPS_LOCSOFTWARE);
|
||||
dsbuf.dwBufferBytes = SECONDARY_BUFFER_SIZE;
|
||||
dsbuf.lpwfxFormat = &format;
|
||||
|
||||
Q_memset( &dsbcaps, 0, sizeof( dsbcaps ));
|
||||
memset( &dsbcaps, 0, sizeof( dsbcaps ));
|
||||
dsbcaps.dwSize = sizeof( dsbcaps );
|
||||
|
||||
MsgDev( D_NOTE, "DS_CreateBuffers: creating secondary buffer " );
|
||||
|
@ -220,7 +220,7 @@ static qboolean DS_CreateBuffers( void *hInst )
|
|||
dma.buffer = (byte *)lpData;
|
||||
|
||||
SNDDMA_BeginPainting();
|
||||
if( dma.buffer ) Q_memset( dma.buffer, 0, dma.samples * 2 );
|
||||
if( dma.buffer ) memset( dma.buffer, 0, dma.samples * 2 );
|
||||
SNDDMA_Submit();
|
||||
|
||||
return true;
|
||||
|
@ -346,7 +346,7 @@ int SNDDMA_Init( void *hInst )
|
|||
// already initialized
|
||||
if( dma.initialized ) return true;
|
||||
|
||||
Q_memset( &dma, 0, sizeof( dma ));
|
||||
memset( &dma, 0, sizeof( dma ));
|
||||
|
||||
s_primary = Cvar_Get( "s_primary", "0", CVAR_INIT, "use direct primary buffer" );
|
||||
|
||||
|
|
|
@ -177,8 +177,8 @@ Starts sound crackling system
|
|||
*/
|
||||
void SX_Init( void )
|
||||
{
|
||||
Q_memset( rgsxdly, 0, sizeof( rgsxdly ) );
|
||||
Q_memset( rgsxlp, 0, sizeof( rgsxlp ) );
|
||||
memset( rgsxdly, 0, sizeof( rgsxdly ) );
|
||||
memset( rgsxlp, 0, sizeof( rgsxlp ) );
|
||||
|
||||
sxamodr = sxamodl = sxamodrt = sxamodlt = 255;
|
||||
|
||||
|
@ -443,7 +443,7 @@ void DLY_CheckNewDelayVal( void )
|
|||
|
||||
if( dly->lpdelayline )
|
||||
{
|
||||
Q_memset( dly->lpdelayline, 0, dly->cdelaysamplesmax * sizeof( int ) );
|
||||
memset( dly->lpdelayline, 0, dly->cdelaysamplesmax * sizeof( int ) );
|
||||
dly->lp0 = dly->lp1 = dly->lp2 = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ sfx_t *S_FindName( const char *pname, int *pfInCache )
|
|||
}
|
||||
|
||||
sfx = &s_knownSfx[i];
|
||||
Q_memset( sfx, 0, sizeof( *sfx ));
|
||||
memset( sfx, 0, sizeof( *sfx ));
|
||||
if( pfInCache ) *pfInCache = false;
|
||||
Q_strncpy( sfx->name, name, MAX_STRING );
|
||||
sfx->touchFrame = s_registration_sequence;
|
||||
|
@ -252,7 +252,7 @@ void S_FreeSound( sfx_t *sfx )
|
|||
}
|
||||
|
||||
if( sfx->cache ) FS_FreeSound( sfx->cache );
|
||||
Q_memset( sfx, 0, sizeof( *sfx ));
|
||||
memset( sfx, 0, sizeof( *sfx ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -386,8 +386,8 @@ void S_FreeSounds( void )
|
|||
for( i = 0, sfx = s_knownSfx; i < s_numSfx; i++, sfx++ )
|
||||
S_FreeSound( sfx );
|
||||
|
||||
Q_memset( s_knownSfx, 0, sizeof( s_knownSfx ));
|
||||
Q_memset( s_sfxHashList, 0, sizeof( s_sfxHashList ));
|
||||
memset( s_knownSfx, 0, sizeof( s_knownSfx ));
|
||||
memset( s_sfxHashList, 0, sizeof( s_sfxHashList ));
|
||||
|
||||
s_numSfx = 0;
|
||||
}
|
|
@ -144,7 +144,7 @@ void S_FreeChannel( channel_t *ch )
|
|||
ch->isSentence = false;
|
||||
|
||||
// clear mixer
|
||||
Q_memset( &ch->pMixer, 0, sizeof( ch->pMixer ));
|
||||
memset( &ch->pMixer, 0, sizeof( ch->pMixer ));
|
||||
|
||||
SND_CloseMouth( ch );
|
||||
}
|
||||
|
@ -891,7 +891,7 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
|
|||
}
|
||||
|
||||
// spatialize
|
||||
Q_memset( target_chan, 0, sizeof( *target_chan ));
|
||||
memset( target_chan, 0, sizeof( *target_chan ));
|
||||
|
||||
VectorCopy( pos, target_chan->origin );
|
||||
target_chan->staticsound = ( ent == 0 ) ? true : false;
|
||||
|
@ -1016,7 +1016,7 @@ void S_RestoreSound( const vec3_t pos, int ent, int chan, sound_t handle, float
|
|||
}
|
||||
|
||||
// spatialize
|
||||
Q_memset( target_chan, 0, sizeof( *target_chan ));
|
||||
memset( target_chan, 0, sizeof( *target_chan ));
|
||||
|
||||
VectorCopy( pos, target_chan->origin );
|
||||
target_chan->staticsound = ( ent == 0 ) ? true : false;
|
||||
|
@ -1747,7 +1747,7 @@ void S_ClearBuffer( void )
|
|||
S_ClearRawChannels();
|
||||
|
||||
SNDDMA_BeginPainting ();
|
||||
if( dma.buffer ) Q_memset( dma.buffer, 0, dma.samples * 2 );
|
||||
if( dma.buffer ) memset( dma.buffer, 0, dma.samples * 2 );
|
||||
SNDDMA_Submit ();
|
||||
|
||||
MIX_ClearAllPaintBuffers( PAINTBUFFER_SIZE, true );
|
||||
|
@ -1790,7 +1790,7 @@ void S_StopAllSounds( void )
|
|||
DSP_ClearState();
|
||||
|
||||
// clear all the channels
|
||||
Q_memset( channels, 0, sizeof( channels ));
|
||||
memset( channels, 0, sizeof( channels ));
|
||||
|
||||
// restart the ambient sounds
|
||||
S_InitAmbientChannels ();
|
||||
|
@ -1798,7 +1798,7 @@ void S_StopAllSounds( void )
|
|||
S_ClearBuffer ();
|
||||
|
||||
// clear any remaining soundfade
|
||||
Q_memset( &soundfade, 0, sizeof( soundfade ));
|
||||
memset( &soundfade, 0, sizeof( soundfade ));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -2168,7 +2168,7 @@ qboolean S_Init( void )
|
|||
paintedtime = 0;
|
||||
|
||||
// clear ambient sounds
|
||||
Q_memset( ambient_sfx, 0, sizeof( ambient_sfx ));
|
||||
memset( ambient_sfx, 0, sizeof( ambient_sfx ));
|
||||
|
||||
MIX_InitAllPaintbuffers ();
|
||||
|
||||
|
|
|
@ -191,14 +191,14 @@ _inline paintbuffer_t *MIX_GetPPaintFromIPaint( int ipaint )
|
|||
void MIX_FreeAllPaintbuffers( void )
|
||||
{
|
||||
// clear paintbuffer structs
|
||||
Q_memset( paintbuffers, 0, CPAINTBUFFERS * sizeof( paintbuffer_t ));
|
||||
memset( paintbuffers, 0, CPAINTBUFFERS * sizeof( paintbuffer_t ));
|
||||
}
|
||||
|
||||
// Initialize paintbuffers array, set current paint buffer to main output buffer IPAINTBUFFER
|
||||
void MIX_InitAllPaintbuffers( void )
|
||||
{
|
||||
// clear paintbuffer structs
|
||||
Q_memset( paintbuffers, 0, CPAINTBUFFERS * sizeof( paintbuffer_t ));
|
||||
memset( paintbuffers, 0, CPAINTBUFFERS * sizeof( paintbuffer_t ));
|
||||
|
||||
paintbuffers[IPAINTBUFFER].pbuf = paintbuffer;
|
||||
paintbuffers[IROOMBUFFER].pbuf = roombuffer;
|
||||
|
@ -807,11 +807,11 @@ void MIX_ClearAllPaintBuffers( int SampleCount, qboolean clearFilters )
|
|||
for( i = 0; i < CPAINTBUFFERS; i++ )
|
||||
{
|
||||
if( paintbuffers[i].pbuf != NULL )
|
||||
Q_memset( paintbuffers[i].pbuf, 0, (count+1) * sizeof( portable_samplepair_t ));
|
||||
memset( paintbuffers[i].pbuf, 0, (count+1) * sizeof( portable_samplepair_t ));
|
||||
|
||||
if( clearFilters )
|
||||
{
|
||||
Q_memset( paintbuffers[i].fltmem, 0, sizeof( paintbuffers[i].fltmem ));
|
||||
memset( paintbuffers[i].fltmem, 0, sizeof( paintbuffers[i].fltmem ));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -897,7 +897,7 @@ void MIX_MixStreamBuffer( int end )
|
|||
// clear the paint buffer
|
||||
if( s_listener.paused || !ch || ch->s_rawend < paintedtime )
|
||||
{
|
||||
Q_memset( pbuf, 0, (end - paintedtime) * sizeof( portable_samplepair_t ));
|
||||
memset( pbuf, 0, (end - paintedtime) * sizeof( portable_samplepair_t ));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ void S_StartBackgroundTrack( const char *introTrack, const char *mainTrack, long
|
|||
// open stream
|
||||
s_bgTrack.stream = FS_OpenStream( va( "media/%s", introTrack ));
|
||||
Q_strncpy( s_bgTrack.current, introTrack, sizeof( s_bgTrack.current ));
|
||||
Q_memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade
|
||||
memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade
|
||||
s_bgTrack.source = cls.key_dest;
|
||||
|
||||
if( position != 0 )
|
||||
|
@ -116,8 +116,8 @@ void S_StopBackgroundTrack( void )
|
|||
if( !s_bgTrack.stream ) return;
|
||||
|
||||
FS_FreeStream( s_bgTrack.stream );
|
||||
Q_memset( &s_bgTrack, 0, sizeof( bg_track_t ));
|
||||
Q_memset( &musicfade, 0, sizeof( musicfade ));
|
||||
memset( &s_bgTrack, 0, sizeof( bg_track_t ));
|
||||
memset( &musicfade, 0, sizeof( musicfade ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -94,7 +94,7 @@ static char *VOX_GetDirectory( char *szpath, char *psz )
|
|||
}
|
||||
|
||||
cb = Q_strlen( psz ) - cb;
|
||||
Q_memcpy( szpath, psz, cb );
|
||||
memcpy( szpath, psz, cb );
|
||||
szpath[cb] = 0;
|
||||
|
||||
return p + 1;
|
||||
|
@ -134,7 +134,7 @@ char **VOX_ParseString( char *psz )
|
|||
int i, fdone = 0;
|
||||
char c, *p = psz;
|
||||
|
||||
Q_memset( rgpparseword, 0, sizeof( char* ) * CVOXWORDMAX );
|
||||
memset( rgpparseword, 0, sizeof( char* ) * CVOXWORDMAX );
|
||||
|
||||
if( !psz ) return NULL;
|
||||
|
||||
|
@ -300,7 +300,7 @@ int VOX_ParseWordParams( char *psz, voxword_t *pvoxword, int fFirst )
|
|||
if( ct == ')' )
|
||||
break;
|
||||
|
||||
Q_memset( sznum, 0, sizeof( sznum ));
|
||||
memset( sznum, 0, sizeof( sznum ));
|
||||
i = 0;
|
||||
|
||||
c = *(++psz);
|
||||
|
@ -459,8 +459,8 @@ void VOX_LoadSound( channel_t *pchan, const char *pszin )
|
|||
if( !pszin || !*pszin )
|
||||
return;
|
||||
|
||||
Q_memset( rgvoxword, 0, sizeof( voxword_t ) * CVOXWORDMAX );
|
||||
Q_memset( buffer, 0, sizeof( buffer ));
|
||||
memset( rgvoxword, 0, sizeof( voxword_t ) * CVOXWORDMAX );
|
||||
memset( buffer, 0, sizeof( buffer ));
|
||||
|
||||
// lookup actual string in g_Sentences,
|
||||
// set pointer to string data
|
||||
|
@ -549,7 +549,7 @@ void VOX_ParseLineCommands( char *pSentenceData, int sentenceIndex )
|
|||
}
|
||||
|
||||
// Copy good string to temp buffer
|
||||
Q_memcpy( tempBuffer + tempBufferPos, pSentenceData, length );
|
||||
memcpy( tempBuffer + tempBufferPos, pSentenceData, length );
|
||||
|
||||
// move the copy position
|
||||
tempBufferPos += length;
|
||||
|
@ -672,7 +672,7 @@ void VOX_ReadSentenceFile( const char *psentenceFileName )
|
|||
|
||||
void VOX_Init( void )
|
||||
{
|
||||
Q_memset( g_Sentences, 0, sizeof( g_Sentences ));
|
||||
memset( g_Sentences, 0, sizeof( g_Sentences ));
|
||||
g_numSentences = 0;
|
||||
|
||||
VOX_ReadSentenceFile( "sound/sentences.txt" );
|
||||
|
|
|
@ -332,7 +332,7 @@ void CUtlVector<T>::ShiftElementsLeft( int elem, int num )
|
|||
memmove( &Element(elem), &Element(elem+num), numToMove * sizeof(T) );
|
||||
|
||||
#ifdef _DEBUG
|
||||
Q_memset( &Element(m_Size-num), 0xDD, num * sizeof(T) );
|
||||
memset( &Element(m_Size-num), 0xDD, num * sizeof(T) );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ Startup VGUI backend
|
|||
*/
|
||||
void VGUI_DrawInit( void )
|
||||
{
|
||||
Q_memset( g_textures, 0, sizeof( g_textures ));
|
||||
memset( g_textures, 0, sizeof( g_textures ));
|
||||
g_textureId = g_iBoundTexture = 0;
|
||||
|
||||
vgui_colorstrings = Cvar_Get( "vgui_colorstrings", "0", CVAR_ARCHIVE, "allow colorstrings in VGUI texts" );
|
||||
|
@ -65,7 +65,7 @@ generate unique texture number
|
|||
int VGUI_GenerateTexture( void )
|
||||
{
|
||||
if( ++g_textureId >= VGUI_MAX_TEXTURES )
|
||||
Sys_Error( "VGUI_GenerateTexture: VGUI_MAX_TEXTURES limit exceeded\n" );
|
||||
Host_Error( "VGUI_GenerateTexture: VGUI_MAX_TEXTURES limit exceeded\n" );
|
||||
return g_textureId;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void VGUI_UploadTexture( int id, const char *buffer, int width, int height )
|
|||
}
|
||||
|
||||
Q_snprintf( texName, sizeof( texName ), "*vgui%i", id );
|
||||
Q_memset( &r_image, 0, sizeof( r_image ));
|
||||
memset( &r_image, 0, sizeof( r_image ));
|
||||
|
||||
r_image.width = width;
|
||||
r_image.height = height;
|
||||
|
@ -120,7 +120,7 @@ void VGUI_CreateTexture( int id, int width, int height )
|
|||
}
|
||||
|
||||
Q_snprintf( texName, sizeof( texName ), "*vgui%i", id );
|
||||
Q_memset( &r_image, 0, sizeof( r_image ));
|
||||
memset( &r_image, 0, sizeof( r_image ));
|
||||
|
||||
r_image.width = width;
|
||||
r_image.height = height;
|
||||
|
|
|
@ -106,7 +106,7 @@ void VGUI_InitKeyTranslationTable( void )
|
|||
bInitted = true;
|
||||
|
||||
// set virtual key translation table
|
||||
Q_memset( s_pVirtualKeyTrans, -1, sizeof( s_pVirtualKeyTrans ));
|
||||
memset( s_pVirtualKeyTrans, -1, sizeof( s_pVirtualKeyTrans ));
|
||||
|
||||
s_pVirtualKeyTrans['0'] = KEY_0;
|
||||
s_pVirtualKeyTrans['1'] = KEY_1;
|
||||
|
|
|
@ -68,7 +68,7 @@ void VGui_Startup( void )
|
|||
{
|
||||
if( rootpanel )
|
||||
{
|
||||
rootpanel->setSize( menu.globals->scrWidth, menu.globals->scrHeight );
|
||||
rootpanel->setSize( gameui.globals->scrWidth, gameui.globals->scrHeight );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ CEngineSurface :: CEngineSurface( Panel *embeddedPanel ):SurfaceBase( embeddedPa
|
|||
_drawTextColor[0] = _drawTextColor[1] = _drawTextColor[2] = _drawTextColor[3] = 255;
|
||||
|
||||
_surfaceExtents[0] = _surfaceExtents[1] = 0;
|
||||
_surfaceExtents[2] = menu.globals->scrWidth;
|
||||
_surfaceExtents[3] = menu.globals->scrHeight;
|
||||
_surfaceExtents[2] = gameui.globals->scrWidth;
|
||||
_surfaceExtents[3] = gameui.globals->scrHeight;
|
||||
_drawTextPos[0] = _drawTextPos[1] = 0;
|
||||
_hCurrentFont = null;
|
||||
|
||||
|
|
|
@ -444,7 +444,7 @@ long AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long l
|
|||
blockread = length;
|
||||
|
||||
// copy the data
|
||||
Q_memcpy( audiodata + result, (void *)( Avi->cpa_dstbuffer + Avi->cpa_blockpos ), blockread );
|
||||
memcpy( audiodata + result, (void *)( Avi->cpa_dstbuffer + Avi->cpa_blockpos ), blockread );
|
||||
|
||||
Avi->cpa_blockpos += blockread;
|
||||
result += blockread;
|
||||
|
@ -484,7 +484,7 @@ void AVI_CloseVideo( movie_state_t *Avi )
|
|||
DeleteDC( Avi->hDC );
|
||||
}
|
||||
|
||||
Q_memset( Avi, 0, sizeof( movie_state_t ));
|
||||
memset( Avi, 0, sizeof( movie_state_t ));
|
||||
}
|
||||
|
||||
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, qboolean ignore_hwgamma, int quiet )
|
||||
|
|
|
@ -23,7 +23,7 @@ static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
|||
int Q_buildnum( void )
|
||||
{
|
||||
// do not touch this! Only author of Xash3D can increase buildnumbers!
|
||||
#if 0
|
||||
#if 1
|
||||
int m = 0, d = 0, y = 0;
|
||||
static int b = 0;
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ qboolean cmd_wait;
|
|||
cmdbuf_t cmd_text;
|
||||
byte cmd_text_buf[MAX_CMD_BUFFER];
|
||||
cmdalias_t *cmd_alias;
|
||||
uint cmd_condition;
|
||||
int cmd_condlevel;
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
@ -58,7 +60,7 @@ Cbuf_Clear
|
|||
*/
|
||||
void Cbuf_Clear( void )
|
||||
{
|
||||
Q_memset( cmd_text.data, 0, sizeof( cmd_text_buf ));
|
||||
memset( cmd_text.data, 0, sizeof( cmd_text_buf ));
|
||||
cmd_text.cursize = 0;
|
||||
}
|
||||
|
||||
|
@ -92,17 +94,16 @@ Adds command text at the end of the buffer
|
|||
*/
|
||||
void Cbuf_AddText( const char *text )
|
||||
{
|
||||
int l;
|
||||
|
||||
l = Q_strlen( text );
|
||||
int l = Q_strlen( text );
|
||||
|
||||
if( cmd_text.cursize + l >= cmd_text.maxsize )
|
||||
{
|
||||
MsgDev( D_WARN, "Cbuf_AddText: overflow\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
Q_memcpy( Cbuf_GetSpace( &cmd_text, l ), text, l );
|
||||
else
|
||||
{
|
||||
memcpy( Cbuf_GetSpace( &cmd_text, l ), text, l );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -115,28 +116,17 @@ Adds a \n to the text
|
|||
*/
|
||||
void Cbuf_InsertText( const char *text )
|
||||
{
|
||||
char *temp;
|
||||
int templen;
|
||||
int l = Q_strlen( text );
|
||||
|
||||
// copy off any commands still remaining in the exec buffer
|
||||
templen = cmd_text.cursize;
|
||||
|
||||
if( templen )
|
||||
if( cmd_text.cursize + l >= cmd_text.maxsize )
|
||||
{
|
||||
temp = Z_Malloc( templen );
|
||||
Q_memcpy( temp, cmd_text.data, templen );
|
||||
cmd_text.cursize = 0;
|
||||
MsgDev( D_WARN, "Cbuf_InsertText: overflow\n" );
|
||||
}
|
||||
else temp = NULL;
|
||||
|
||||
// add the entire text of the file
|
||||
Cbuf_AddText( text );
|
||||
|
||||
// add the copied off data
|
||||
if( templen )
|
||||
else
|
||||
{
|
||||
Q_memcpy( Cbuf_GetSpace( &cmd_text, templen ), temp, templen );
|
||||
Z_Free( temp );
|
||||
memmove( cmd_text.data + l, cmd_text.data, cmd_text.cursize );
|
||||
memcpy( cmd_text.data, text, l );
|
||||
cmd_text.cursize += l;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,28 +140,50 @@ void Cbuf_Execute( void )
|
|||
char *text;
|
||||
char line[MAX_CMD_LINE];
|
||||
int i, quotes;
|
||||
char *comment;
|
||||
|
||||
while( cmd_text.cursize )
|
||||
{
|
||||
// find a \n or ; line break
|
||||
text = (char *)cmd_text.data;
|
||||
|
||||
quotes = 0;
|
||||
quotes = false;
|
||||
comment = NULL;
|
||||
|
||||
for( i = 0; i < cmd_text.cursize; i++ )
|
||||
{
|
||||
if( text[i] == '"' ) quotes++;
|
||||
if(!( quotes & 1 ) && text[i] == ';' )
|
||||
break; // don't break if inside a quoted string
|
||||
if( !comment )
|
||||
{
|
||||
if( text[i] == '"' ) quotes = !quotes;
|
||||
|
||||
if( quotes )
|
||||
{
|
||||
// make sure i doesn't get > cursize which causes a negative size in memmove, which is fatal --blub
|
||||
if( i < ( cmd_text.cursize - 1 ) && ( text[i+0] == '\\' && (text[i+1] == '"' || text[i+1] == '\\')))
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( text[i+0] == '/' && text[i+1] == '/' && ( i == 0 || (byte)text[i - 1] <= ' ' ))
|
||||
comment = &text[i];
|
||||
if( text[i] == ';' ) break; // don't break if inside a quoted string or comment
|
||||
}
|
||||
}
|
||||
|
||||
if( text[i] == '\n' || text[i] == '\r' )
|
||||
break;
|
||||
}
|
||||
|
||||
if( i >= ( MAX_CMD_LINE - 1 ))
|
||||
Sys_Error( "Cbuf_Execute: command string owerflow\n" );
|
||||
|
||||
Q_memcpy( line, text, i );
|
||||
line[i] = 0;
|
||||
{
|
||||
MsgDev( D_ERROR, "Cbuf_Execute: command string owerflow\n" );
|
||||
line[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( line, text, comment ? (comment - text) : i );
|
||||
line[comment ? (comment - text) : i] = 0;
|
||||
}
|
||||
|
||||
// delete the text from the command buffer and move remaining commands down
|
||||
// this is necessary because commands (exec) can insert data at the
|
||||
|
@ -184,11 +196,11 @@ void Cbuf_Execute( void )
|
|||
{
|
||||
i++;
|
||||
cmd_text.cursize -= i;
|
||||
Q_memcpy( text, text + i, cmd_text.cursize );
|
||||
memmove( cmd_text.data, text + i, cmd_text.cursize );
|
||||
}
|
||||
|
||||
// execute the command line
|
||||
Cmd_ExecuteString( line, src_command );
|
||||
Cmd_ExecuteString( line );
|
||||
|
||||
if( cmd_wait )
|
||||
{
|
||||
|
@ -332,7 +344,7 @@ void Cmd_Alias_f( void )
|
|||
return;
|
||||
}
|
||||
|
||||
// if the alias allready exists, reuse it
|
||||
// if the alias already exists, reuse it
|
||||
for( a = cmd_alias; a; a = a->next )
|
||||
{
|
||||
if( !Q_strcmp( s, a->name ))
|
||||
|
@ -344,12 +356,19 @@ void Cmd_Alias_f( void )
|
|||
|
||||
if( !a )
|
||||
{
|
||||
a = Z_Malloc( sizeof( cmdalias_t ));
|
||||
a->next = cmd_alias;
|
||||
cmd_alias = a;
|
||||
}
|
||||
cmdalias_t *cur, *prev;
|
||||
|
||||
Q_strncpy( a->name, s, sizeof( a->name ));
|
||||
a = Z_Malloc( sizeof( cmdalias_t ));
|
||||
|
||||
Q_strncpy( a->name, s, sizeof( a->name ));
|
||||
|
||||
// insert it at the right alphanumeric position
|
||||
for( prev = NULL, cur = cmd_alias; cur && Q_strcmp( cur->name, a->name ) < 0; prev = cur, cur = cur->next );
|
||||
|
||||
if( prev ) prev->next = a;
|
||||
else cmd_alias = a;
|
||||
a->next = cur;
|
||||
}
|
||||
|
||||
// copy the rest of the command line
|
||||
cmd[0] = 0; // start out with a null string
|
||||
|
@ -358,14 +377,55 @@ void Cmd_Alias_f( void )
|
|||
|
||||
for( i = 2; i < c; i++ )
|
||||
{
|
||||
Q_strcat( cmd, Cmd_Argv( i ));
|
||||
if( i != c ) Q_strcat( cmd, " " );
|
||||
if( i != 2 ) Q_strncat( cmd, " ", sizeof( cmd ));
|
||||
Q_strncat( cmd, Cmd_Argv( i ), sizeof( cmd ));
|
||||
}
|
||||
|
||||
Q_strcat( cmd, "\n" );
|
||||
Q_strncat( cmd, "\n", sizeof( cmd ));
|
||||
a->value = copystring( cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Cmd_UnAlias_f
|
||||
|
||||
Remove existing aliases.
|
||||
===============
|
||||
*/
|
||||
static void Cmd_UnAlias_f ( void )
|
||||
{
|
||||
cmdalias_t *a, *p;
|
||||
const char *s;
|
||||
int i;
|
||||
|
||||
if( Cmd_Argc() == 1 )
|
||||
{
|
||||
Msg( "Usage: unalias alias1 [alias2 ...]\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
for( i = 1; i < Cmd_Argc(); i++ )
|
||||
{
|
||||
s = Cmd_Argv( i );
|
||||
p = NULL;
|
||||
|
||||
for( a = cmd_alias; a; p = a, a = a->next )
|
||||
{
|
||||
if( !Q_strcmp( s, a->name ))
|
||||
{
|
||||
if( a == cmd_alias )
|
||||
cmd_alias = a->next;
|
||||
if( p ) p->next = a->next;
|
||||
Mem_Free( a->value );
|
||||
Mem_Free( a );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !a ) Msg( "unalias: %s alias not found\n", s );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
|
@ -387,7 +447,6 @@ static char *cmd_args = NULL;
|
|||
static char *cmd_argv[MAX_CMD_TOKENS];
|
||||
static char cmd_tokenized[MAX_CMD_BUFFER]; // will have 0 bytes inserted
|
||||
static cmd_t *cmd_functions; // possible commands to execute
|
||||
cmd_source_t cmd_source;
|
||||
|
||||
/*
|
||||
============
|
||||
|
@ -489,12 +548,14 @@ void Cmd_TokenizeString( char *text )
|
|||
while( 1 )
|
||||
{
|
||||
// skip whitespace up to a /n
|
||||
while( *text && ((byte)*text) <= ' ' && *text != '\n' )
|
||||
while( *text && ((byte)*text) <= ' ' && *text != '\r' && *text != '\n' )
|
||||
text++;
|
||||
|
||||
if( *text == '\n' )
|
||||
{
|
||||
|
||||
if( *text == '\n' || *text == '\r' )
|
||||
{
|
||||
// a newline seperates commands in the buffer
|
||||
if( *text == '\r' && text[1] == '\n' )
|
||||
text++;
|
||||
text++;
|
||||
break;
|
||||
}
|
||||
|
@ -516,7 +577,6 @@ void Cmd_TokenizeString( char *text )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_AddCommand
|
||||
|
@ -524,7 +584,7 @@ Cmd_AddCommand
|
|||
*/
|
||||
void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc )
|
||||
{
|
||||
cmd_t *cmd;
|
||||
cmd_t *cmd, *cur, *prev;
|
||||
|
||||
// fail if the command is a variable name
|
||||
if( Cvar_FindVar( cmd_name ))
|
||||
|
@ -545,41 +605,57 @@ void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_
|
|||
cmd->name = copystring( cmd_name );
|
||||
cmd->desc = copystring( cmd_desc );
|
||||
cmd->function = function;
|
||||
cmd->next = cmd_functions;
|
||||
cmd_functions = cmd;
|
||||
|
||||
// insert it at the right alphanumeric position
|
||||
for( prev = NULL, cur = cmd_functions; cur && Q_strcmp( cur->name, cmd_name ) < 0; prev = cur, cur = cur->next );
|
||||
|
||||
if( prev ) prev->next = cmd;
|
||||
else cmd_functions = cmd;
|
||||
cmd->next = cur;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_AddGameCommand
|
||||
Cmd_AddServerCommand
|
||||
============
|
||||
*/
|
||||
void Cmd_AddGameCommand( const char *cmd_name, xcommand_t function )
|
||||
void Cmd_AddServerCommand( const char *cmd_name, xcommand_t function )
|
||||
{
|
||||
cmd_t *cmd;
|
||||
cmd_t *cmd, *cur, *prev;
|
||||
|
||||
if( !cmd_name || !*cmd_name )
|
||||
{
|
||||
MsgDev( D_INFO, "Cmd_AddServerCommand: NULL name\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// fail if the command is a variable name
|
||||
if( Cvar_FindVar( cmd_name ))
|
||||
{
|
||||
MsgDev( D_INFO, "Cmd_AddCommand: %s already defined as a var\n", cmd_name );
|
||||
MsgDev( D_ERROR, "Cmd_AddServerCommand: %s already defined as a var\n", cmd_name );
|
||||
return;
|
||||
}
|
||||
|
||||
// fail if the command already exists
|
||||
if( Cmd_Exists( cmd_name ))
|
||||
{
|
||||
MsgDev(D_INFO, "Cmd_AddCommand: %s already defined\n", cmd_name);
|
||||
MsgDev( D_ERROR, "Cmd_AddServerCommand: %s already defined\n", cmd_name );
|
||||
return;
|
||||
}
|
||||
|
||||
// use a small malloc to avoid zone fragmentation
|
||||
cmd = Z_Malloc( sizeof( cmd_t ));
|
||||
cmd->name = copystring( cmd_name );
|
||||
cmd->desc = copystring( "game command" );
|
||||
cmd->desc = copystring( "server command" );
|
||||
cmd->function = function;
|
||||
cmd->flags = CMD_EXTDLL;
|
||||
cmd->next = cmd_functions;
|
||||
cmd_functions = cmd;
|
||||
cmd->flags = CMD_SERVERDLL;
|
||||
|
||||
// insert it at the right alphanumeric position
|
||||
for( prev = NULL, cur = cmd_functions; cur && Q_strcmp( cur->name, cmd_name ) < 0; prev = cur, cur = cur->next );
|
||||
|
||||
if( prev ) prev->next = cmd;
|
||||
else cmd_functions = cmd;
|
||||
cmd->next = cur;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -587,22 +663,28 @@ void Cmd_AddGameCommand( const char *cmd_name, xcommand_t function )
|
|||
Cmd_AddClientCommand
|
||||
============
|
||||
*/
|
||||
void Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
||||
int Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
||||
{
|
||||
cmd_t *cmd;
|
||||
cmd_t *cmd, *cur, *prev;
|
||||
|
||||
if( !cmd_name || !*cmd_name )
|
||||
{
|
||||
MsgDev( D_INFO, "Cmd_AddClientCommand: NULL name\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fail if the command is a variable name
|
||||
if( Cvar_FindVar( cmd_name ))
|
||||
{
|
||||
MsgDev( D_INFO, "Cmd_AddCommand: %s already defined as a var\n", cmd_name );
|
||||
return;
|
||||
MsgDev( D_INFO, "Cmd_AddClientCommand: %s already defined as a var\n", cmd_name );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fail if the command already exists
|
||||
if( Cmd_Exists( cmd_name ))
|
||||
{
|
||||
MsgDev(D_INFO, "Cmd_AddCommand: %s already defined\n", cmd_name);
|
||||
return;
|
||||
MsgDev(D_INFO, "Cmd_AddClientCommand: %s already defined\n", cmd_name );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// use a small malloc to avoid zone fragmentation
|
||||
|
@ -611,8 +693,61 @@ void Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
|||
cmd->desc = copystring( "client command" );
|
||||
cmd->function = function;
|
||||
cmd->flags = CMD_CLIENTDLL;
|
||||
cmd->next = cmd_functions;
|
||||
cmd_functions = cmd;
|
||||
|
||||
// insert it at the right alphanumeric position
|
||||
for( prev = NULL, cur = cmd_functions; cur && Q_strcmp( cur->name, cmd_name ) < 0; prev = cur, cur = cur->next );
|
||||
|
||||
if( prev ) prev->next = cmd;
|
||||
else cmd_functions = cmd;
|
||||
cmd->next = cur;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_AddGameUICommand
|
||||
============
|
||||
*/
|
||||
int Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function )
|
||||
{
|
||||
cmd_t *cmd, *cur, *prev;
|
||||
|
||||
if( !cmd_name || !*cmd_name )
|
||||
{
|
||||
MsgDev( D_INFO, "Cmd_AddGameUICommand: NULL name\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fail if the command is a variable name
|
||||
if( Cvar_FindVar( cmd_name ))
|
||||
{
|
||||
MsgDev( D_INFO, "Cmd_AddGameUICommand: %s already defined as a var\n", cmd_name );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fail if the command already exists
|
||||
if( Cmd_Exists( cmd_name ))
|
||||
{
|
||||
MsgDev(D_INFO, "Cmd_AddGameUICommand: %s already defined\n", cmd_name );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// use a small malloc to avoid zone fragmentation
|
||||
cmd = Z_Malloc( sizeof( cmd_t ));
|
||||
cmd->name = copystring( cmd_name );
|
||||
cmd->desc = copystring( "GameUI command" );
|
||||
cmd->function = function;
|
||||
cmd->flags = CMD_GAMEUIDLL;
|
||||
|
||||
// insert it at the right alphanumeric position
|
||||
for( prev = NULL, cur = cmd_functions; cur && Q_strcmp( cur->name, cmd_name ) < 0; prev = cur, cur = cur->next );
|
||||
|
||||
if( prev ) prev->next = cmd;
|
||||
else cmd_functions = cmd;
|
||||
cmd->next = cur;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -691,6 +826,79 @@ qboolean Cmd_Exists( const char *cmd_name )
|
|||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_If_f
|
||||
|
||||
Compare and et condition bit if true
|
||||
============
|
||||
*/
|
||||
void Cmd_If_f( void )
|
||||
{
|
||||
// reset bit first
|
||||
cmd_condition &= ~BIT( cmd_condlevel );
|
||||
|
||||
// usage
|
||||
if( cmd_argc == 1 )
|
||||
{
|
||||
Msg( "Usage: if <op1> [ <operator> <op2> ]\n");
|
||||
Msg( ":<action1>\n" );
|
||||
Msg( ":<action2>\n" );
|
||||
Msg( "else\n" );
|
||||
Msg( ":<action3>\n" );
|
||||
Msg( "operands are string or float values\n" );
|
||||
Msg( "and substituted cvars like '$cl_lw'\n" );
|
||||
Msg( "operator is '='', '==', '>', '<', '>=', '<=' or '!='\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// one argument - check if nonzero
|
||||
if( cmd_argc == 2 )
|
||||
{
|
||||
if( Q_atof( cmd_argv[1] ))
|
||||
cmd_condition |= BIT( cmd_condlevel );
|
||||
}
|
||||
else if( cmd_argc == 4 )
|
||||
{
|
||||
// simple compare
|
||||
float f1 = Q_atof( cmd_argv[1] );
|
||||
float f2 = Q_atof( cmd_argv[3] );
|
||||
|
||||
if( !cmd_argv[2][0] ) // this is wrong
|
||||
return;
|
||||
|
||||
if(( cmd_argv[2][0] == '=' ) || ( cmd_argv[2][1] == '=' )) // =, ==, >=, <=
|
||||
{
|
||||
if( !Q_strcmp( cmd_argv[1], cmd_argv[3] ) || (( f1 || f2 ) && ( f1 == f2 )))
|
||||
cmd_condition |= BIT( cmd_condlevel );
|
||||
}
|
||||
|
||||
if( cmd_argv[2][0] == '!' ) // !=
|
||||
{
|
||||
cmd_condition ^= BIT( cmd_condlevel );
|
||||
return;
|
||||
}
|
||||
|
||||
if(( cmd_argv[2][0] == '>' ) && ( f1 > f2 )) // >, >=
|
||||
cmd_condition |= BIT( cmd_condlevel );
|
||||
|
||||
if(( cmd_argv[2][0] == '<' ) && ( f1 < f2 )) // <, <=
|
||||
cmd_condition |= BIT( cmd_condlevel );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_Else_f
|
||||
|
||||
Invert condition bit
|
||||
============
|
||||
*/
|
||||
void Cmd_Else_f( void )
|
||||
{
|
||||
cmd_condition ^= BIT( cmd_condlevel );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_ExecuteString
|
||||
|
@ -698,20 +906,65 @@ Cmd_ExecuteString
|
|||
A complete command line has been parsed, so try to execute it
|
||||
============
|
||||
*/
|
||||
void Cmd_ExecuteString( char *text, cmd_source_t src )
|
||||
void Cmd_ExecuteString( char *text )
|
||||
{
|
||||
cmd_t *cmd;
|
||||
cmd_t *cmd;
|
||||
cmdalias_t *a;
|
||||
char command[MAX_CMD_LINE];
|
||||
char *pcmd = command;
|
||||
int len = 0;
|
||||
|
||||
cmd_condlevel = 0;
|
||||
|
||||
// cvar value substitution
|
||||
if( cmd_scripting && cmd_scripting->integer )
|
||||
{
|
||||
while( *text )
|
||||
{
|
||||
// check for escape
|
||||
if(( *text == '\\' || *text == '$' ) && (*( text + 1 ) == '$' ))
|
||||
{
|
||||
text ++;
|
||||
}
|
||||
else if( *text == '$' )
|
||||
{
|
||||
char token[MAX_CMD_LINE];
|
||||
char *ptoken = token;
|
||||
|
||||
// check for correct cvar name
|
||||
text++;
|
||||
while(( *text >= '0' && *text <= '9' ) || ( *text >= 'A' && *text <= 'Z' ) || ( *text >= 'a' && *text <= 'z' ) || ( *text == '_' ))
|
||||
*ptoken++ = *text++;
|
||||
*ptoken = 0;
|
||||
|
||||
len += Q_strncpy( pcmd, Cvar_VariableString( token ), MAX_CMD_LINE - len );
|
||||
pcmd = command + len;
|
||||
|
||||
if( !*text ) break;
|
||||
}
|
||||
|
||||
*pcmd++ = *text++;
|
||||
len++;
|
||||
}
|
||||
|
||||
*pcmd = 0;
|
||||
text = command;
|
||||
|
||||
while( *text == ':' )
|
||||
{
|
||||
if( !FBitSet( cmd_condition, BIT( cmd_condlevel )))
|
||||
return;
|
||||
cmd_condlevel++;
|
||||
text++;
|
||||
}
|
||||
}
|
||||
|
||||
// set cmd source
|
||||
cmd_source = src;
|
||||
|
||||
// execute the command line
|
||||
Cmd_TokenizeString( text );
|
||||
|
||||
if( !Cmd_Argc()) return; // no tokens
|
||||
|
||||
// check alias
|
||||
// check aliases
|
||||
for( a = cmd_alias; a; a = a->next )
|
||||
{
|
||||
if( !Q_stricmp( cmd_argv[0], a->name ))
|
||||
|
@ -735,13 +988,10 @@ void Cmd_ExecuteString( char *text, cmd_source_t src )
|
|||
if( Cvar_Command( )) return;
|
||||
|
||||
// forward the command line to the server, so the entity DLL can parse it
|
||||
if( cmd_source == src_command && host.type == HOST_NORMAL )
|
||||
if( host.type == HOST_NORMAL )
|
||||
{
|
||||
if( cls.state >= ca_connected )
|
||||
{
|
||||
Cmd_ForwardToServer();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if( text[0] != '@' && host.type == HOST_NORMAL )
|
||||
{
|
||||
|
@ -808,11 +1058,16 @@ void Cmd_List_f( void )
|
|||
|
||||
for( cmd = cmd_functions; cmd; cmd = cmd->next )
|
||||
{
|
||||
if( cmd->name[0] == '@' )
|
||||
continue; // never show system cmds
|
||||
|
||||
if( match && !Q_stricmpext( match, cmd->name ))
|
||||
continue;
|
||||
Msg( "%10s %s\n", cmd->name, cmd->desc );
|
||||
|
||||
Msg( " %-*s ^3%s^7\n", 32, cmd->name, cmd->desc );
|
||||
i++;
|
||||
}
|
||||
|
||||
Msg( "%i commands\n", i );
|
||||
}
|
||||
|
||||
|
@ -820,7 +1075,7 @@ void Cmd_List_f( void )
|
|||
============
|
||||
Cmd_Unlink
|
||||
|
||||
unlink all commands with flag CVAR_EXTDLL
|
||||
unlink all commands with specified flag
|
||||
============
|
||||
*/
|
||||
void Cmd_Unlink( int group )
|
||||
|
@ -829,15 +1084,21 @@ void Cmd_Unlink( int group )
|
|||
cmd_t **prev;
|
||||
int count = 0;
|
||||
|
||||
if( Cvar_VariableInteger( "host_gameloaded" ) && ( group & CMD_EXTDLL ))
|
||||
if( Cvar_VariableInteger( "host_gameloaded" ) && FBitSet( group, CMD_SERVERDLL ))
|
||||
{
|
||||
Msg( "can't unlink cvars while game is loaded\n" );
|
||||
MsgDev( D_INFO, "can't unlink commands while server is loaded\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( Cvar_VariableInteger( "host_clientloaded" ) && ( group & CMD_CLIENTDLL ))
|
||||
if( Cvar_VariableInteger( "host_clientloaded" ) && FBitSet( group, CMD_CLIENTDLL ))
|
||||
{
|
||||
Msg( "can't unlink cvars while client is loaded\n" );
|
||||
MsgDev( D_INFO, "can't unlink commands while client is loaded\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( Cvar_VariableInteger( "host_gameuiloaded" ) && FBitSet( group, CMD_GAMEUIDLL ))
|
||||
{
|
||||
MsgDev( D_INFO, "can't unlink commands while GameUI is loaded\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -847,7 +1108,8 @@ void Cmd_Unlink( int group )
|
|||
cmd = *prev;
|
||||
if( !cmd ) break;
|
||||
|
||||
if( group && !( cmd->flags & group ))
|
||||
// do filter by specified group
|
||||
if( group && !FBitSet( cmd->flags, group ))
|
||||
{
|
||||
prev = &cmd->next;
|
||||
continue;
|
||||
|
@ -855,11 +1117,8 @@ void Cmd_Unlink( int group )
|
|||
|
||||
*prev = cmd->next;
|
||||
|
||||
if( cmd->name )
|
||||
Mem_Free( cmd->name );
|
||||
|
||||
if( cmd->desc )
|
||||
Mem_Free( cmd->desc );
|
||||
if( cmd->name ) Mem_Free( cmd->name );
|
||||
if( cmd->desc ) Mem_Free( cmd->desc );
|
||||
|
||||
Mem_Free( cmd );
|
||||
count++;
|
||||
|
@ -885,13 +1144,21 @@ Cmd_Init
|
|||
void Cmd_Init( void )
|
||||
{
|
||||
Cbuf_Init();
|
||||
|
||||
cmd_functions = NULL;
|
||||
cmd_condition = 0;
|
||||
cmd_alias = NULL;
|
||||
cmd_args = NULL;
|
||||
cmd_argc = 0;
|
||||
|
||||
// register our commands
|
||||
Cmd_AddCommand ("echo", Cmd_Echo_f, "print a message to the console (useful in scripts)" );
|
||||
Cmd_AddCommand ("wait", Cmd_Wait_f, "make script execution wait for some rendered frames" );
|
||||
Cmd_AddCommand ("cmdlist", Cmd_List_f, "display all console commands beginning with the specified prefix" );
|
||||
Cmd_AddCommand ("stuffcmds", Cmd_StuffCmds_f, va( "execute commandline parameters (must be present in %s.rc script)", SI.ModuleName ));
|
||||
Cmd_AddCommand ("cmd", Cmd_ForwardToServer, "send a console commandline to the server" );
|
||||
Cmd_AddCommand ("alias", Cmd_Alias_f, "create a script function. Without arguments show the list of all alias" );
|
||||
Cmd_AddCommand( "echo", Cmd_Echo_f, "print a message to the console (useful in scripts)" );
|
||||
Cmd_AddCommand( "wait", Cmd_Wait_f, "make script execution wait for some rendered frames" );
|
||||
Cmd_AddCommand( "cmdlist", Cmd_List_f, "display all console commands beginning with the specified prefix" );
|
||||
Cmd_AddCommand( "stuffcmds", Cmd_StuffCmds_f, va( "execute commandline parameters (must be present in %s.rc script)", SI.ModuleName ));
|
||||
Cmd_AddCommand( "cmd", Cmd_ForwardToServer, "send a console commandline to the server" );
|
||||
Cmd_AddCommand( "alias", Cmd_Alias_f, "create a script function. Without arguments show the list of all alias" );
|
||||
Cmd_AddCommand( "unalias", Cmd_UnAlias_f, "remove a script function" );
|
||||
Cmd_AddCommand( "if", Cmd_If_f, "compare and set condition bits" );
|
||||
Cmd_AddCommand( "else", Cmd_Else_f, "invert condition bit" );
|
||||
}
|
|
@ -27,8 +27,7 @@ COM_IsSingleChar
|
|||
interpert this character as single
|
||||
==============
|
||||
*/
|
||||
|
||||
qboolean COM_IsSingleChar( char c )
|
||||
static int COM_IsSingleChar( char c )
|
||||
{
|
||||
if( c == '{' || c == '}' || c == ')' || c == '(' || c == '\'' || c == ',' )
|
||||
return true;
|
||||
|
@ -39,6 +38,21 @@ qboolean COM_IsSingleChar( char c )
|
|||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
COM_IsWhiteSpace
|
||||
|
||||
interpret symbol as whitespace
|
||||
==============
|
||||
*/
|
||||
|
||||
static int COM_IsWhiteSpace( char space )
|
||||
{
|
||||
if( space == ' ' || space == '\t' || space == '\r' || space == '\n' )
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
COM_ParseFile
|
||||
|
@ -182,6 +196,39 @@ int COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBu
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
COM_TrimSpace
|
||||
|
||||
trims all whitespace from the front
|
||||
and end of a string
|
||||
=============
|
||||
*/
|
||||
void COM_TrimSpace( const char *source, char *dest )
|
||||
{
|
||||
int start, end, length;
|
||||
|
||||
start = 0;
|
||||
end = Q_strlen( source );
|
||||
|
||||
while( source[start] && COM_IsWhiteSpace( source[start] ))
|
||||
start++;
|
||||
end--;
|
||||
|
||||
while( end > 0 && COM_IsWhiteSpace( source[end] ))
|
||||
end--;
|
||||
end++;
|
||||
|
||||
length = end - start;
|
||||
|
||||
if( length > 0 )
|
||||
memcpy( dest, source + start, length );
|
||||
else length = 0;
|
||||
|
||||
// terminate the dest string
|
||||
dest[length] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
COM_FixSlashes
|
||||
|
@ -232,7 +279,6 @@ char *COM_MemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, i
|
|||
i++;
|
||||
}
|
||||
|
||||
|
||||
// if we actually advanced the pointer, copy it over
|
||||
if( i != *filePos )
|
||||
{
|
||||
|
@ -240,7 +286,7 @@ char *COM_MemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, i
|
|||
int size = i - *filePos;
|
||||
|
||||
// copy it out
|
||||
Q_memcpy( pBuffer, pMemFile + *filePos, size );
|
||||
memcpy( pBuffer, pMemFile + *filePos, size );
|
||||
|
||||
// If the buffer isn't full, terminate (this is always true)
|
||||
if( size < bufferSize ) pBuffer[size] = 0;
|
||||
|
@ -285,7 +331,8 @@ byte* COM_LoadFileForMe( const char *filename, int *pLength )
|
|||
|
||||
if( !filename || !*filename )
|
||||
{
|
||||
if( pLength ) *pLength = 0;
|
||||
if( pLength )
|
||||
*pLength = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -298,8 +345,11 @@ byte* COM_LoadFileForMe( const char *filename, int *pLength )
|
|||
if( pfile )
|
||||
{
|
||||
file = malloc( iLength + 1 );
|
||||
Q_memcpy( file, pfile, iLength );
|
||||
file[iLength] = '\0';
|
||||
if( file != NULL )
|
||||
{
|
||||
memcpy( file, pfile, iLength );
|
||||
file[iLength] = '\0';
|
||||
}
|
||||
Mem_Free( pfile );
|
||||
pfile = file;
|
||||
}
|
||||
|
@ -315,34 +365,7 @@ COM_LoadFile
|
|||
*/
|
||||
byte *COM_LoadFile( const char *filename, int usehunk, int *pLength )
|
||||
{
|
||||
string name;
|
||||
byte *file, *pfile;
|
||||
int iLength;
|
||||
|
||||
ASSERT( usehunk == 5 );
|
||||
|
||||
if( !filename || !*filename )
|
||||
{
|
||||
if( pLength ) *pLength = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Q_strncpy( name, filename, sizeof( name ));
|
||||
COM_FixSlashes( name );
|
||||
|
||||
pfile = FS_LoadFile( name, &iLength, false );
|
||||
if( pLength ) *pLength = iLength;
|
||||
|
||||
if( pfile )
|
||||
{
|
||||
file = malloc( iLength + 1 );
|
||||
Q_memcpy( file, pfile, iLength );
|
||||
file[iLength] = '\0';
|
||||
Mem_Free( pfile );
|
||||
pfile = file;
|
||||
}
|
||||
|
||||
return pfile;
|
||||
return COM_LoadFileForMe( filename, pLength );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -395,13 +418,26 @@ pfnCvar_RegisterVariable
|
|||
|
||||
=============
|
||||
*/
|
||||
cvar_t *pfnCvar_RegisterVariable( const char *szName, const char *szValue, int flags )
|
||||
cvar_t *pfnCvar_RegisterClientVariable( const char *szName, const char *szValue, int flags )
|
||||
{
|
||||
if( flags & FCVAR_GLCONFIG )
|
||||
if( FBitSet( flags, FCVAR_GLCONFIG ))
|
||||
return (cvar_t *)Cvar_Get( szName, szValue, flags, va( "enable or disable %s", szName ));
|
||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|CVAR_CLIENTDLL, "client cvar" );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnCvar_RegisterVariable
|
||||
|
||||
=============
|
||||
*/
|
||||
cvar_t *pfnCvar_RegisterGameUIVariable( const char *szName, const char *szValue, int flags )
|
||||
{
|
||||
if( FBitSet( flags, FCVAR_GLCONFIG ))
|
||||
return (cvar_t *)Cvar_Get( szName, szValue, flags, va( "enable or disable %s", szName ));
|
||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|CVAR_GAMEUIDLL, "GameUI cvar" );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnCVarGetPointer
|
||||
|
@ -411,28 +447,7 @@ can return NULL
|
|||
*/
|
||||
cvar_t *pfnCVarGetPointer( const char *szVarName )
|
||||
{
|
||||
cvar_t *cvPtr;
|
||||
|
||||
cvPtr = (cvar_t *)Cvar_FindVar( szVarName );
|
||||
|
||||
return cvPtr;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnAddClientCommand
|
||||
|
||||
=============
|
||||
*/
|
||||
int pfnAddClientCommand( const char *cmd_name, xcommand_t func )
|
||||
{
|
||||
if( !cmd_name || !*cmd_name )
|
||||
return 0;
|
||||
|
||||
// NOTE: if( func == NULL ) cmd will be forwarded to a server
|
||||
Cmd_AddClientCommand( cmd_name, func );
|
||||
|
||||
return 1;
|
||||
return (cvar_t *)Cvar_FindVar( szVarName );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -450,7 +465,7 @@ void Con_Printf( char *szFmt, ... )
|
|||
return;
|
||||
|
||||
va_start( args, szFmt );
|
||||
Q_vsnprintf( buffer, 16384, szFmt, args );
|
||||
Q_vsnprintf( buffer, sizeof( buffer ), szFmt, args );
|
||||
va_end( args );
|
||||
|
||||
Sys_Print( buffer );
|
||||
|
@ -471,7 +486,7 @@ void Con_DPrintf( char *szFmt, ... )
|
|||
return;
|
||||
|
||||
va_start( args, szFmt );
|
||||
Q_vsnprintf( buffer, 16384, szFmt, args );
|
||||
Q_vsnprintf( buffer, sizeof( buffer ), szFmt, args );
|
||||
va_end( args );
|
||||
|
||||
Sys_Print( buffer );
|
||||
|
|
|
@ -143,6 +143,7 @@ extern convar_t *scr_width;
|
|||
extern convar_t *scr_height;
|
||||
extern convar_t *scr_loading;
|
||||
extern convar_t *scr_download;
|
||||
extern convar_t *cmd_scripting;
|
||||
extern convar_t *cl_allow_levelshots;
|
||||
extern convar_t *mod_allow_materials;
|
||||
extern convar_t *host_limitlocal;
|
||||
|
@ -444,9 +445,9 @@ typedef enum
|
|||
PF_BGRA_32, // big endian RGBA (MacOS)
|
||||
PF_RGB_24, // uncompressed dds or another 24-bit image
|
||||
PF_BGR_24, // big-endian RGB (MacOS)
|
||||
PF_DXT1, // nvidia DXT1 format
|
||||
PF_DXT3, // nvidia DXT3 format
|
||||
PF_DXT5, // nvidia DXT5 format
|
||||
PF_DXT1, // s3tc DXT1 format
|
||||
PF_DXT3, // s3tc DXT3 format
|
||||
PF_DXT5, // s3tc DXT5 format
|
||||
PF_TOTALCOUNT, // must be last
|
||||
} pixformat_t;
|
||||
|
||||
|
@ -689,15 +690,16 @@ qboolean SV_Active( void );
|
|||
|
||||
==============================================================
|
||||
*/
|
||||
cvar_t *pfnCvar_RegisterVariable( const char *szName, const char *szValue, int flags );
|
||||
cvar_t *pfnCvar_RegisterClientVariable( const char *szName, const char *szValue, int flags );
|
||||
cvar_t *pfnCvar_RegisterGameUIVariable( const char *szName, const char *szValue, int flags );
|
||||
char *COM_MemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, int bufferSize );
|
||||
byte* COM_LoadFileForMe( const char *filename, int *pLength );
|
||||
cvar_t *pfnCVarGetPointer( const char *szVarName );
|
||||
int pfnDrawConsoleString( int x, int y, char *string );
|
||||
void pfnDrawSetTextColor( float r, float g, float b );
|
||||
void pfnDrawConsoleStringLen( const char *pText, int *length, int *height );
|
||||
int pfnAddClientCommand( const char *cmd_name, xcommand_t func );
|
||||
void *Cache_Check( byte *mempool, struct cache_user_s *c );
|
||||
void COM_TrimSpace( const char *source, char *dest );
|
||||
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
|
||||
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
||||
void pfnGetGameDir( char *szGetGameDir );
|
||||
|
|
|
@ -79,7 +79,7 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
|||
dheader_t *header;
|
||||
dextrahdr_t *hdrext;
|
||||
|
||||
Q_memset( buf, 0, sizeof( buf ));
|
||||
memset( buf, 0, sizeof( buf ));
|
||||
FS_Read( f, buf, sizeof( buf ));
|
||||
header = (dheader_t *)buf;
|
||||
ver = header->version;
|
||||
|
@ -713,7 +713,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
|||
int num_spawnpoints = 0;
|
||||
dheader_t *header;
|
||||
|
||||
Q_memset( buf, 0, MAX_SYSPATH );
|
||||
memset( buf, 0, MAX_SYSPATH );
|
||||
FS_Read( f, buf, MAX_SYSPATH );
|
||||
ver = *(uint *)buf;
|
||||
|
||||
|
|
|
@ -37,14 +37,14 @@ convar_t *con_fontsize;
|
|||
// console color typeing
|
||||
rgba_t g_color_table[8] =
|
||||
{
|
||||
{ 0, 0, 0, 255}, // black
|
||||
{255, 0, 0, 255}, // red
|
||||
{ 0, 255, 0, 255}, // green
|
||||
{255, 255, 0, 255}, // yellow
|
||||
{ 0, 0, 255, 255}, // blue
|
||||
{ 0, 255, 255, 255}, // cyan
|
||||
{255, 0, 255, 255}, // magenta
|
||||
{240, 180, 24, 255}, // default color (can be changed by user)
|
||||
{ 0, 0, 0, 255 }, // black
|
||||
{ 255, 0, 0, 255 }, // red
|
||||
{ 0, 255, 0, 255 }, // green
|
||||
{ 255, 255, 0, 255 }, // yellow
|
||||
{ 0, 0, 255, 255 }, // blue
|
||||
{ 0, 255, 255, 255 }, // cyan
|
||||
{ 255, 0, 255, 255 }, // magenta
|
||||
{ 240, 180, 24, 255 }, // default color (can be changed by user)
|
||||
};
|
||||
|
||||
typedef struct
|
||||
|
@ -108,6 +108,7 @@ typedef struct
|
|||
string shortestMatch;
|
||||
field_t *completionField; // con.input or dedicated server fake field-line
|
||||
char *completionString;
|
||||
char *completionBuffer;
|
||||
char *cmds[CON_MAXCMDS];
|
||||
int matchCount;
|
||||
} console_t;
|
||||
|
@ -179,7 +180,7 @@ Con_ClearField
|
|||
*/
|
||||
void Con_ClearField( field_t *edit )
|
||||
{
|
||||
Q_memset( edit->buffer, 0, MAX_STRING );
|
||||
memset( edit->buffer, 0, MAX_STRING );
|
||||
edit->cursor = 0;
|
||||
edit->scroll = 0;
|
||||
}
|
||||
|
@ -272,9 +273,8 @@ Con_ToggleConsole_f
|
|||
*/
|
||||
void Con_ToggleConsole_f( void )
|
||||
{
|
||||
if( !host.developer ) return; // disabled
|
||||
|
||||
if( UI_CreditsActive( )) return; // disabled by final credits
|
||||
if( !host.developer || UI_CreditsActive( ))
|
||||
return; // disabled
|
||||
|
||||
// show console only in game or by special call from menu
|
||||
if( cls.state != ca_active || cls.key_dest == key_menu )
|
||||
|
@ -311,9 +311,10 @@ void Con_CheckResize( void )
|
|||
int charWidth = 8;
|
||||
|
||||
if( con.curFont && con.curFont->hFontTexture )
|
||||
charWidth = con.curFont->charWidths['M'] - 1;
|
||||
charWidth = con.curFont->charWidths[' '] - 1;
|
||||
|
||||
width = ( scr_width->integer / charWidth );
|
||||
con.vislines = 0; // FIXME: sometimes here get unthinkable values
|
||||
|
||||
if( width == con.linewidth )
|
||||
return;
|
||||
|
@ -343,7 +344,7 @@ void Con_CheckResize( void )
|
|||
if( con.linewidth < numchars )
|
||||
numchars = con.linewidth;
|
||||
|
||||
Q_memcpy( tbuf, con.text, CON_TEXTSIZE * sizeof( short ));
|
||||
memcpy( tbuf, con.text, CON_TEXTSIZE * sizeof( short ));
|
||||
|
||||
for( i = 0; i < CON_TEXTSIZE; i++ )
|
||||
con.text[i] = ( ColorIndex( COLOR_DEFAULT ) << 8 ) | ' ';
|
||||
|
@ -424,7 +425,7 @@ Con_Visible
|
|||
*/
|
||||
qboolean Con_Visible( void )
|
||||
{
|
||||
return (con.displayFrac != 0.0f);
|
||||
return (con.vislines > 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -441,7 +442,7 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||
if( font->valid ) return; // already loaded
|
||||
|
||||
// loading conchars
|
||||
font->hFontTexture = GL_LoadTexture( va( "fonts.wad/font%i", fontNumber ), NULL, 0, TF_FONT|TF_NEAREST, NULL );
|
||||
font->hFontTexture = GL_LoadTexture( va( "fonts.wad/font%i", fontNumber ), NULL, 0, TF_FONT, NULL );
|
||||
R_GetTextureParms( &fontWidth, NULL, font->hFontTexture );
|
||||
|
||||
// setup creditsfont
|
||||
|
@ -501,6 +502,37 @@ static void Con_LoadConchars( void )
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
TextAdjustSize
|
||||
|
||||
draw charcters routine
|
||||
====================
|
||||
*/
|
||||
static void Con_TextAdjustSize( int *x, int *y, int *w, int *h )
|
||||
{
|
||||
float xscale, yscale;
|
||||
|
||||
if( !clgame.ds.adjust_size ) return;
|
||||
if( !x && !y && !w && !h ) return;
|
||||
|
||||
// scale for screen sizes
|
||||
xscale = scr_width->integer / (float)clgame.scrInfo.iWidth;
|
||||
yscale = scr_height->integer / (float)clgame.scrInfo.iHeight;
|
||||
|
||||
if( x ) *x *= xscale;
|
||||
if( y ) *y *= yscale;
|
||||
if( w ) *w *= xscale;
|
||||
if( h ) *h *= yscale;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Con_DrawGenericChar
|
||||
|
||||
draw console single character
|
||||
====================
|
||||
*/
|
||||
static int Con_DrawGenericChar( int x, int y, int number, rgba_t color )
|
||||
{
|
||||
int width, height;
|
||||
|
@ -529,36 +561,72 @@ static int Con_DrawGenericChar( int x, int y, int number, rgba_t color )
|
|||
width = rc->right - rc->left;
|
||||
height = rc->bottom - rc->top;
|
||||
|
||||
TextAdjustSize( &x, &y, &width, &height );
|
||||
Con_TextAdjustSize( &x, &y, &width, &height );
|
||||
R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, con.curFont->hFontTexture );
|
||||
pglColor4ub( 255, 255, 255, 255 ); // don't forget reset color
|
||||
|
||||
return con.curFont->charWidths[number];
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Con_SetFont
|
||||
|
||||
choose font size
|
||||
====================
|
||||
*/
|
||||
void Con_SetFont( int fontNum )
|
||||
{
|
||||
fontNum = bound( 0, fontNum, 2 );
|
||||
con.curFont = &con.chars[fontNum];
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Con_RestoreFont
|
||||
|
||||
restore auto-selected console font
|
||||
(that based on screen resolution)
|
||||
====================
|
||||
*/
|
||||
void Con_RestoreFont( void )
|
||||
{
|
||||
con.curFont = con.lastUsedFont;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Con_DrawCharacter
|
||||
|
||||
client version of routine
|
||||
====================
|
||||
*/
|
||||
int Con_DrawCharacter( int x, int y, int number, rgba_t color )
|
||||
{
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
return Con_DrawGenericChar( x, y, number, color );
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Con_DrawCharacterLen
|
||||
|
||||
returns character sizes in screen pixels
|
||||
====================
|
||||
*/
|
||||
void Con_DrawCharacterLen( int number, int *width, int *height )
|
||||
{
|
||||
if( width && con.curFont ) *width = con.curFont->charWidths[number];
|
||||
if( height && con.curFont ) *height = con.curFont->charHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Con_DrawStringLen
|
||||
|
||||
compute string width and height in screen pixels
|
||||
====================
|
||||
*/
|
||||
void Con_DrawStringLen( const char *pText, int *length, int *height )
|
||||
{
|
||||
int curLength = 0;
|
||||
|
@ -630,7 +698,7 @@ int Con_DrawGenericString( int x, int y, const char *string, rgba_t setColor, qb
|
|||
{
|
||||
if( !forceColor )
|
||||
{
|
||||
Q_memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ));
|
||||
memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ));
|
||||
color[3] = setColor[3];
|
||||
}
|
||||
|
||||
|
@ -652,6 +720,13 @@ int Con_DrawGenericString( int x, int y, const char *string, rgba_t setColor, qb
|
|||
return drawLen;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Con_DrawString
|
||||
|
||||
client version of routine
|
||||
====================
|
||||
*/
|
||||
int Con_DrawString( int x, int y, const char *string, rgba_t setColor )
|
||||
{
|
||||
return Con_DrawGenericString( x, y, string, setColor, false, -1 );
|
||||
|
@ -669,8 +744,8 @@ void Con_Init( void )
|
|||
// must be init before startup video subsystem
|
||||
scr_width = Cvar_Get( "width", "640", 0, "screen width" );
|
||||
scr_height = Cvar_Get( "height", "480", 0, "screen height" );
|
||||
scr_conspeed = Cvar_Get( "scr_conspeed", "600", 0, "console moving speed" );
|
||||
con_notifytime = Cvar_Get( "con_notifytime", "3", 0, "notify time to live" );
|
||||
scr_conspeed = Cvar_Get( "scr_conspeed", "600", CVAR_ARCHIVE, "console moving speed" );
|
||||
con_notifytime = Cvar_Get( "con_notifytime", "3", CVAR_ARCHIVE, "notify time to live" );
|
||||
con_fontsize = Cvar_Get( "con_fontsize", "1", CVAR_ARCHIVE, "console font number (0, 1 or 2)" );
|
||||
|
||||
Con_CheckResize();
|
||||
|
@ -697,7 +772,6 @@ void Con_Init( void )
|
|||
con.initialized = true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
Con_Linefeed
|
||||
|
@ -735,9 +809,9 @@ void Con_Print( const char *txt )
|
|||
int y, c, l, color;
|
||||
|
||||
// client not running
|
||||
if( host.type == HOST_DEDICATED ) return;
|
||||
if( !con.initialized ) return;
|
||||
|
||||
if( !con.initialized || host.type == HOST_DEDICATED )
|
||||
return;
|
||||
|
||||
color = ColorIndex( COLOR_DEFAULT );
|
||||
|
||||
while(( c = *txt ) != 0 )
|
||||
|
@ -751,10 +825,7 @@ void Con_Print( const char *txt )
|
|||
|
||||
// count word length
|
||||
for( l = 0; l < con.linewidth; l++ )
|
||||
{
|
||||
if( txt[l] <= ' ')
|
||||
break;
|
||||
}
|
||||
if( txt[l] <= ' ' ) break;
|
||||
txt++;
|
||||
|
||||
switch( c )
|
||||
|
@ -793,7 +864,7 @@ void Con_NPrintf( int idx, char *fmt, ... )
|
|||
if( idx < 0 || idx >= MAX_DBG_NOTIFY )
|
||||
return;
|
||||
|
||||
Q_memset( con.notify[idx].szNotify, 0, MAX_STRING );
|
||||
memset( con.notify[idx].szNotify, 0, MAX_STRING );
|
||||
|
||||
va_start( args, fmt );
|
||||
Q_vsnprintf( con.notify[idx].szNotify, MAX_STRING, fmt, args );
|
||||
|
@ -822,7 +893,7 @@ void Con_NXPrintf( con_nprint_t *info, char *fmt, ... )
|
|||
if( info->index < 0 || info->index >= MAX_DBG_NOTIFY )
|
||||
return;
|
||||
|
||||
Q_memset( con.notify[info->index].szNotify, 0, MAX_STRING );
|
||||
memset( con.notify[info->index].szNotify, 0, MAX_STRING );
|
||||
|
||||
va_start( args, fmt );
|
||||
Q_vsnprintf( con.notify[info->index].szNotify, MAX_STRING, fmt, args );
|
||||
|
@ -849,7 +920,7 @@ void UI_NPrintf( int idx, char *fmt, ... )
|
|||
if( idx < 0 || idx >= MAX_DBG_NOTIFY )
|
||||
return;
|
||||
|
||||
Q_memset( con.notify[idx].szNotify, 0, MAX_STRING );
|
||||
memset( con.notify[idx].szNotify, 0, MAX_STRING );
|
||||
|
||||
va_start( args, fmt );
|
||||
Q_vsnprintf( con.notify[idx].szNotify, MAX_STRING, fmt, args );
|
||||
|
@ -878,7 +949,7 @@ void UI_NXPrintf( con_nprint_t *info, char *fmt, ... )
|
|||
if( info->index < 0 || info->index >= MAX_DBG_NOTIFY )
|
||||
return;
|
||||
|
||||
Q_memset( con.notify[info->index].szNotify, 0, MAX_STRING );
|
||||
memset( con.notify[info->index].szNotify, 0, MAX_STRING );
|
||||
|
||||
va_start( args, fmt );
|
||||
Q_vsnprintf( con.notify[info->index].szNotify, MAX_STRING, fmt, args );
|
||||
|
@ -943,7 +1014,7 @@ static int Con_SortCmds( const char **arg1, const char **arg2 )
|
|||
|
||||
/*
|
||||
===============
|
||||
pfnPrintMatches
|
||||
Con_PrintMatches
|
||||
===============
|
||||
*/
|
||||
static void Con_PrintMatches( const char *s, const char *unused1, const char *m, void *unused2 )
|
||||
|
@ -955,7 +1026,12 @@ static void Con_PrintMatches( const char *s, const char *unused1, const char *m,
|
|||
}
|
||||
}
|
||||
|
||||
static void ConcatRemaining( const char *src, const char *start )
|
||||
/*
|
||||
===============
|
||||
Con_ConcatRemaining
|
||||
===============
|
||||
*/
|
||||
static void Con_ConcatRemaining( const char *src, const char *start )
|
||||
{
|
||||
char *arg;
|
||||
int i;
|
||||
|
@ -1012,11 +1088,16 @@ void Con_CompleteCommand( field_t *field )
|
|||
nextcmd = ( con.completionField->buffer[Q_strlen( con.completionField->buffer ) - 1] == ' ' ) ? true : false;
|
||||
|
||||
con.completionString = Cmd_Argv( 0 );
|
||||
con.completionBuffer = Cmd_Argv( 1 );
|
||||
|
||||
// skip backslash
|
||||
while( *con.completionString && ( *con.completionString == '\\' || *con.completionString == '/' ))
|
||||
con.completionString++;
|
||||
|
||||
// skip backslash
|
||||
while( *con.completionBuffer && ( *con.completionBuffer == '\\' || *con.completionBuffer == '/' ))
|
||||
con.completionBuffer++;
|
||||
|
||||
if( !Q_strlen( con.completionString ))
|
||||
return;
|
||||
|
||||
|
@ -1039,18 +1120,21 @@ void Con_CompleteCommand( field_t *field )
|
|||
|
||||
if( !con.matchCount ) return; // no matches
|
||||
|
||||
Q_memcpy( &temp, con.completionField, sizeof( field_t ));
|
||||
memcpy( &temp, con.completionField, sizeof( field_t ));
|
||||
|
||||
if(( Cmd_Argc() == 2 ) || (( Cmd_Argc() == 1 ) && nextcmd ))
|
||||
{
|
||||
qboolean result = false;
|
||||
|
||||
if( !Q_strlen( con.completionBuffer ))
|
||||
return;
|
||||
|
||||
// autocomplete second arg
|
||||
for( list = cmd_list; list->name; list++ )
|
||||
{
|
||||
if( Cmd_CheckName( list->name ))
|
||||
{
|
||||
result = list->func( Cmd_Argv( 1 ), filename, MAX_STRING );
|
||||
result = list->func( con.completionBuffer, filename, MAX_STRING );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1074,7 +1158,7 @@ void Con_CompleteCommand( field_t *field )
|
|||
{
|
||||
Q_sprintf( con.completionField->buffer, "\\%s", con.cmds[0] );
|
||||
if( Cmd_Argc() == 1 ) Q_strncat( con.completionField->buffer, " ", sizeof( con.completionField->buffer ));
|
||||
else ConcatRemaining( temp.buffer, con.completionString );
|
||||
else Con_ConcatRemaining( temp.buffer, con.completionString );
|
||||
con.completionField->cursor = Q_strlen( con.completionField->buffer );
|
||||
}
|
||||
else
|
||||
|
@ -1102,7 +1186,7 @@ void Con_CompleteCommand( field_t *field )
|
|||
// multiple matches, complete to shortest
|
||||
Q_sprintf( con.completionField->buffer, "\\%s", con.shortestMatch );
|
||||
con.completionField->cursor = Q_strlen( con.completionField->buffer );
|
||||
ConcatRemaining( temp.buffer, con.completionString );
|
||||
Con_ConcatRemaining( temp.buffer, con.completionString );
|
||||
|
||||
Msg( "]%s\n", con.completionField->buffer );
|
||||
|
||||
|
@ -1158,7 +1242,7 @@ void Field_KeyDownEvent( field_t *edit, int key )
|
|||
if( key == K_DEL )
|
||||
{
|
||||
if( edit->cursor < len )
|
||||
Q_memmove( edit->buffer + edit->cursor, edit->buffer + edit->cursor + 1, len - edit->cursor );
|
||||
memmove( edit->buffer + edit->cursor, edit->buffer + edit->cursor + 1, len - edit->cursor );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1166,7 +1250,7 @@ void Field_KeyDownEvent( field_t *edit, int key )
|
|||
{
|
||||
if( edit->cursor > 0 )
|
||||
{
|
||||
Q_memmove( edit->buffer + edit->cursor - 1, edit->buffer + edit->cursor, len - edit->cursor + 1 );
|
||||
memmove( edit->buffer + edit->cursor - 1, edit->buffer + edit->cursor, len - edit->cursor + 1 );
|
||||
edit->cursor--;
|
||||
if( edit->scroll ) edit->scroll--;
|
||||
}
|
||||
|
@ -1261,7 +1345,7 @@ void Field_CharEvent( field_t *edit, int ch )
|
|||
{
|
||||
// insert mode
|
||||
if ( len == MAX_STRING - 1 ) return; // all full
|
||||
Q_memmove( edit->buffer + edit->cursor + 1, edit->buffer + edit->cursor, len + 1 - edit->cursor );
|
||||
memmove( edit->buffer + edit->cursor + 1, edit->buffer + edit->cursor, len + 1 - edit->cursor );
|
||||
edit->buffer[edit->cursor] = ch;
|
||||
edit->cursor++;
|
||||
}
|
||||
|
@ -1309,7 +1393,7 @@ void Field_DrawInputLine( int x, int y, field_t *edit )
|
|||
// extract <drawLen> characters from the field at <prestep>
|
||||
ASSERT( drawLen < MAX_SYSPATH );
|
||||
|
||||
Q_memcpy( str, edit->buffer + prestep, drawLen );
|
||||
memcpy( str, edit->buffer + prestep, drawLen );
|
||||
str[drawLen] = 0;
|
||||
|
||||
// save char for overstrike
|
||||
|
@ -1562,7 +1646,7 @@ int Con_DrawDebugLines( void )
|
|||
int fontTall;
|
||||
|
||||
Con_DrawStringLen( con.notify[i].szNotify, &len, &fontTall );
|
||||
x = scr_width->integer - max( defaultX, len ) - 10;
|
||||
x = scr_width->integer - Q_max( defaultX, len ) - 10;
|
||||
fontTall += 1;
|
||||
|
||||
if( y + fontTall > (int)scr_height->integer - 20 )
|
||||
|
@ -1677,15 +1761,14 @@ void Con_DrawSolidConsole( float frac )
|
|||
int i, x, y;
|
||||
int rows;
|
||||
short *text;
|
||||
int row;
|
||||
int lines, start;
|
||||
int row, start;
|
||||
int currentColor;
|
||||
string curbuild;
|
||||
|
||||
lines = scr_height->integer * frac;
|
||||
if( lines <= 0 ) return;
|
||||
if( lines > scr_height->integer )
|
||||
lines = scr_height->integer;
|
||||
con.vislines = scr_height->integer * frac;
|
||||
if( con.vislines <= 0 ) return;
|
||||
if( con.vislines > scr_height->integer )
|
||||
con.vislines = scr_height->integer;
|
||||
|
||||
// draw the background
|
||||
y = frac * scr_height->integer;
|
||||
|
@ -1693,6 +1776,7 @@ void Con_DrawSolidConsole( float frac )
|
|||
if( y >= 1 )
|
||||
{
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
pglColor4ub( 255, 255, 255, 255 ); // to prevent grab color from screenfade
|
||||
R_DrawStretchPic( 0, y - scr_height->integer, scr_width->integer, scr_height->integer, 0, 0, 1, 1, con.background );
|
||||
}
|
||||
else y = 0;
|
||||
|
@ -1702,22 +1786,25 @@ void Con_DrawSolidConsole( float frac )
|
|||
if( host.developer )
|
||||
{
|
||||
// draw current version
|
||||
byte *color = g_color_table[7];
|
||||
int stringLen, width = 0, charH;
|
||||
byte color[4];
|
||||
|
||||
memcpy( color, g_color_table[7], sizeof( color ));
|
||||
|
||||
Q_snprintf( curbuild, MAX_STRING, "Xash3D %i/%g (hw build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum( ));
|
||||
Con_DrawStringLen( curbuild, &stringLen, &charH );
|
||||
start = scr_width->integer - stringLen;
|
||||
stringLen = Con_StringLength( curbuild );
|
||||
|
||||
color[3] = min( con.displayFrac * 2.0f, 1.0f ) * 255; // fadeout version number
|
||||
|
||||
for( i = 0; i < stringLen; i++ )
|
||||
width += Con_DrawCharacter( start + width, 0, curbuild[i], color );
|
||||
}
|
||||
|
||||
// draw the text
|
||||
con.vislines = lines;
|
||||
rows = ( lines - QCHAR_WIDTH ) / QCHAR_WIDTH; // rows of text to draw
|
||||
y = lines - ( con.curFont->charHeight * 3 );
|
||||
rows = ( con.vislines - QCHAR_WIDTH ) / QCHAR_WIDTH; // rows of text to draw
|
||||
y = con.vislines - ( con.curFont->charHeight * 3 );
|
||||
|
||||
// draw from the bottom up
|
||||
if( con.display != con.current )
|
||||
|
@ -1759,6 +1846,10 @@ void Con_DrawSolidConsole( float frac )
|
|||
|
||||
// draw the input prompt, user text, and cursor if desired
|
||||
Con_DrawInput();
|
||||
|
||||
y = con.vislines - ( con.curFont->charHeight * 1.2f );
|
||||
SCR_DrawFPS( max( y, 4 )); // to avoid to hide fps counter
|
||||
|
||||
pglColor4ub( 255, 255, 255, 255 );
|
||||
}
|
||||
|
||||
|
@ -1834,6 +1925,8 @@ void Con_DrawConsole( void )
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if( !Con_Visible( )) SCR_DrawFPS( 4 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1898,7 +1991,11 @@ void Con_RunConsole( void )
|
|||
|
||||
// when level is loading frametime may be is wrong
|
||||
if( cls.state == ca_connecting || cls.state == ca_connected )
|
||||
host.realframetime = ( MAX_FPS / host_maxfps->value ) * MIN_FRAMETIME;
|
||||
{
|
||||
if( !FBitSet( host.features, ENGINE_FIXED_FRAMERATE ))
|
||||
host.realframetime = ( MAX_FPS / host_maxfps->value ) * MIN_FRAMETIME;
|
||||
else host.realframetime = HOST_FRAMETIME;
|
||||
}
|
||||
|
||||
if( con.finalFrac < con.displayFrac )
|
||||
{
|
||||
|
@ -1948,45 +2045,59 @@ void Con_VidInit( void )
|
|||
// loading console image
|
||||
if( host.developer )
|
||||
{
|
||||
if( scr_width->integer < 640 )
|
||||
// trying to load truecolor image first
|
||||
if( FS_FileExists( "gfx/shell/conback.bmp", false ) || FS_FileExists( "gfx/shell/conback.tga", false ))
|
||||
con.background = GL_LoadTexture( "gfx/shell/conback", NULL, 0, TF_IMAGE, NULL );
|
||||
|
||||
if( !con.background )
|
||||
{
|
||||
if( FS_FileExists( "cached/conback400", false ))
|
||||
con.background = GL_LoadTexture( "cached/conback400", NULL, 0, TF_IMAGE, NULL );
|
||||
else con.background = GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( FS_FileExists( "cached/conback640", false ))
|
||||
con.background = GL_LoadTexture( "cached/conback640", NULL, 0, TF_IMAGE, NULL );
|
||||
else con.background = GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE, NULL );
|
||||
if( scr_width->integer < 640 )
|
||||
{
|
||||
if( FS_FileExists( "cached/conback400", false ))
|
||||
con.background = GL_LoadTexture( "cached/conback400", NULL, 0, TF_IMAGE, NULL );
|
||||
else con.background = GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( FS_FileExists( "cached/conback640", false ))
|
||||
con.background = GL_LoadTexture( "cached/conback640", NULL, 0, TF_IMAGE, NULL );
|
||||
else con.background = GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE, NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( scr_width->integer < 640 )
|
||||
// trying to load truecolor image first
|
||||
if( FS_FileExists( "gfx/shell/loading.bmp", false ) || FS_FileExists( "gfx/shell/loading.tga", false ))
|
||||
con.background = GL_LoadTexture( "gfx/shell/loading", NULL, 0, TF_IMAGE, NULL );
|
||||
|
||||
if( !con.background )
|
||||
{
|
||||
if( FS_FileExists( "cached/loading400", false ))
|
||||
con.background = GL_LoadTexture( "cached/loading400", NULL, 0, TF_IMAGE, NULL );
|
||||
else con.background = GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( FS_FileExists( "cached/loading640", false ))
|
||||
con.background = GL_LoadTexture( "cached/loading640", NULL, 0, TF_IMAGE, NULL );
|
||||
else con.background = GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE, NULL );
|
||||
if( scr_width->integer < 640 )
|
||||
{
|
||||
if( FS_FileExists( "cached/loading400", false ))
|
||||
con.background = GL_LoadTexture( "cached/loading400", NULL, 0, TF_IMAGE, NULL );
|
||||
else con.background = GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( FS_FileExists( "cached/loading640", false ))
|
||||
con.background = GL_LoadTexture( "cached/loading640", NULL, 0, TF_IMAGE, NULL );
|
||||
else con.background = GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE, NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// missed console image will be replaced as white (GoldSrc rules)
|
||||
// missed console image will be replaced as gray background like X-Ray or Crysis
|
||||
if( con.background == tr.defaultTexture || con.background == 0 )
|
||||
con.background = tr.whiteTexture;
|
||||
con.background = tr.grayTexture;
|
||||
|
||||
Con_LoadConchars();
|
||||
}
|
||||
|
||||
void Con_InvalidateFonts( void )
|
||||
{
|
||||
Q_memset( con.chars, 0, sizeof( con.chars ));
|
||||
memset( con.chars, 0, sizeof( con.chars ));
|
||||
con.curFont = con.lastUsedFont = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ byte CRC32_BlockSequence( byte *base, int length, int sequence )
|
|||
ptr = (char *)crc32table + (sequence % 0x3FC);
|
||||
|
||||
if( length > 60 ) length = 60;
|
||||
Q_memcpy( buffer, base, length );
|
||||
memcpy( buffer, base, length );
|
||||
|
||||
buffer[length+0] = ptr[0];
|
||||
buffer[length+1] = ptr[1];
|
||||
|
@ -362,11 +362,11 @@ void MD5Update( MD5Context_t *ctx, const byte *buf, uint len )
|
|||
t = 64 - t;
|
||||
if( len < t )
|
||||
{
|
||||
Q_memcpy( p, buf, len );
|
||||
memcpy( p, buf, len );
|
||||
return;
|
||||
}
|
||||
|
||||
Q_memcpy( p, buf, t );
|
||||
memcpy( p, buf, t );
|
||||
MD5Transform( ctx->buf, (uint *)ctx->in );
|
||||
buf += t;
|
||||
len -= t;
|
||||
|
@ -375,14 +375,14 @@ void MD5Update( MD5Context_t *ctx, const byte *buf, uint len )
|
|||
// process data in 64-byte chunks
|
||||
while( len >= 64 )
|
||||
{
|
||||
Q_memcpy( ctx->in, buf, 64 );
|
||||
memcpy( ctx->in, buf, 64 );
|
||||
MD5Transform( ctx->buf, (uint *)ctx->in );
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
// handle any remaining bytes of data.
|
||||
Q_memcpy( ctx->in, buf, len );
|
||||
memcpy( ctx->in, buf, len );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -414,16 +414,16 @@ void MD5Final( byte digest[16], MD5Context_t *ctx )
|
|||
{
|
||||
|
||||
// two lots of padding: pad the first block to 64 bytes
|
||||
Q_memset( p, 0, count );
|
||||
memset( p, 0, count );
|
||||
MD5Transform( ctx->buf, (uint *)ctx->in );
|
||||
|
||||
// now fill the next block with 56 bytes
|
||||
Q_memset( ctx->in, 0, 56 );
|
||||
memset( ctx->in, 0, 56 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// pad block to 56 bytes
|
||||
Q_memset( p, 0, count - 8 );
|
||||
memset( p, 0, count - 8 );
|
||||
}
|
||||
|
||||
// append length in bits and transform
|
||||
|
@ -431,8 +431,8 @@ void MD5Final( byte digest[16], MD5Context_t *ctx )
|
|||
((uint *)ctx->in)[15] = ctx->bits[1];
|
||||
|
||||
MD5Transform( ctx->buf, (uint *)ctx->in );
|
||||
Q_memcpy( digest, ctx->buf, 16 );
|
||||
Q_memset( ctx, 0, sizeof( ctx )); // in case it's sensitive
|
||||
memcpy( digest, ctx->buf, 16 );
|
||||
memset( ctx, 0, sizeof( ctx )); // in case it's sensitive
|
||||
}
|
||||
|
||||
// The four core functions
|
||||
|
@ -546,7 +546,7 @@ qboolean MD5_HashFile( byte digest[16], const char *pszFileName, uint seed[4] )
|
|||
if(( file = FS_Open( pszFileName, "rb", false )) == NULL )
|
||||
return false;
|
||||
|
||||
Q_memset( &MD5_Hash, 0, sizeof( MD5Context_t ));
|
||||
memset( &MD5_Hash, 0, sizeof( MD5Context_t ));
|
||||
|
||||
MD5Init( &MD5_Hash );
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ void Q_atov( float *vec, const char *str, size_t siz )
|
|||
int j;
|
||||
|
||||
Q_strncpy( buffer, str, sizeof( buffer ));
|
||||
Q_memset( vec, 0, sizeof( vec_t ) * siz );
|
||||
memset( vec, 0, sizeof( vec_t ) * siz );
|
||||
pstr = pfront = buffer;
|
||||
|
||||
for( j = 0; j < siz; j++ )
|
||||
|
@ -572,6 +572,26 @@ int Q_sprintf( char *buffer, const char *format, ... )
|
|||
return result;
|
||||
}
|
||||
|
||||
uint Q_hashkey( const char *string, uint hashSize, qboolean caseinsensitive )
|
||||
{
|
||||
uint i, hashKey = 0;
|
||||
|
||||
if( caseinsensitive )
|
||||
{
|
||||
for( i = 0; string[i]; i++)
|
||||
hashKey += (i * 119) * Q_tolower( string[i] );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( i = 0; string[i]; i++ )
|
||||
hashKey += (i + 119) * (int)string[i];
|
||||
}
|
||||
|
||||
hashKey = ((hashKey ^ (hashKey >> 10)) ^ (hashKey >> 20)) & (hashSize - 1);
|
||||
|
||||
return hashKey;
|
||||
}
|
||||
|
||||
char *Q_pretifymem( float value, int digitsafterdecimal )
|
||||
{
|
||||
static char output[8][32];
|
||||
|
@ -666,36 +686,4 @@ char *va( const char *format, ... )
|
|||
va_end( argptr );
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void _Q_memcpy( void *dest, const void *src, size_t count, const char *filename, int fileline )
|
||||
{
|
||||
if( src == NULL || count <= 0 ) return; // nothing to copy
|
||||
if( dest == NULL ) Sys_Error( "memcpy: dest == NULL (called at %s:%i)\n", filename, fileline );
|
||||
memcpy( dest, src, count );
|
||||
}
|
||||
|
||||
void _Q_memset( void *dest, int set, size_t count, const char *filename, int fileline )
|
||||
{
|
||||
if( dest == NULL ) Sys_Error( "memset: dest == NULL (called at %s:%i)\n", filename, fileline );
|
||||
memset( dest, set, count );
|
||||
}
|
||||
|
||||
int _Q_memcmp( const void *src0, const void *src1, size_t count, const char *filename, int fileline )
|
||||
{
|
||||
if( src0 == NULL ) Sys_Error( "memcmp: src1 == NULL (called at %s:%i)\n", filename, fileline );
|
||||
if( src1 == NULL ) Sys_Error( "memcmp: src2 == NULL (called at %s:%i)\n", filename, fileline );
|
||||
return memcmp( src0, src1, count );
|
||||
}
|
||||
|
||||
void _Q_memmove( void *dest, const void *src, size_t count, const char *filename, int fileline )
|
||||
{
|
||||
if( src == NULL || count <= 0 ) return; // nothing to move
|
||||
if( dest == NULL ) Sys_Error( "memmove: dest == NULL (called at %s:%i)\n", filename, fileline );
|
||||
memmove( dest, src, count );
|
||||
}
|
||||
|
||||
void CRT_Init( void )
|
||||
{
|
||||
Memory_Init();
|
||||
}
|
|
@ -27,21 +27,13 @@ enum
|
|||
TIME_FILENAME,
|
||||
};
|
||||
|
||||
#define CMD_EXTDLL BIT( 0 ) // added by game.dll
|
||||
#define CMD_SERVERDLL BIT( 0 ) // added by server.dll
|
||||
#define CMD_CLIENTDLL BIT( 1 ) // added by client.dll
|
||||
#define CMD_GAMEUIDLL BIT( 2 ) // added by GameUI.dll
|
||||
|
||||
typedef void (*setpair_t)( const char *key, const char *value, void *buffer, void *numpairs );
|
||||
typedef void (*xcommand_t)( void );
|
||||
|
||||
typedef enum
|
||||
{
|
||||
src_client, // came in over a net connection as a clc_stringcmd
|
||||
// host_client will be valid during this state.
|
||||
src_command // from the command buffer
|
||||
} cmd_source_t;
|
||||
|
||||
extern cmd_source_t cmd_source;
|
||||
|
||||
// NOTE: if this is changed, it must be changed in cvardef.h too
|
||||
typedef struct convar_s
|
||||
{
|
||||
|
@ -66,7 +58,7 @@ typedef enum
|
|||
CVAR_ARCHIVE = BIT( 0 ), // set to cause it to be saved to config.cfg
|
||||
CVAR_USERINFO = BIT( 1 ), // added to userinfo when changed
|
||||
CVAR_SERVERNOTIFY = BIT( 2 ), // notifies players when changed
|
||||
CVAR_EXTDLL = BIT( 3 ), // defined by external DLL
|
||||
CVAR_SERVERDLL = BIT( 3 ), // defined by the server DLL
|
||||
CVAR_CLIENTDLL = BIT( 4 ), // defined by the client dll
|
||||
CVAR_PROTECTED = BIT( 5 ), // it's a server cvar, but we don't send the data since it's a password, etc.
|
||||
CVAR_SPONLY = BIT( 6 ), // this cvar cannot be changed by clients connected to a multiplayer server.
|
||||
|
@ -79,7 +71,7 @@ typedef enum
|
|||
CVAR_INIT = BIT( 13 ), // don't allow change from console at all, but can be set from the command line
|
||||
CVAR_LATCH = BIT( 14 ), // save changes until server restart
|
||||
CVAR_READ_ONLY = BIT( 15 ), // display only, cannot be set by user at all
|
||||
// reserved
|
||||
CVAR_GAMEUIDLL = BIT( 16 ), // defined by the GameUI DLL
|
||||
CVAR_USER_CREATED = BIT( 17 ), // created by a set command (dll's used)
|
||||
CVAR_GLCONFIG = BIT( 18 ), // set to cause it to be saved to opengl.cfg
|
||||
} cvar_flags_t;
|
||||
|
@ -109,7 +101,7 @@ void Cvar_WriteVariables( file_t *f );
|
|||
void Cvar_Init( void );
|
||||
char *Cvar_Userinfo( void );
|
||||
char *Cvar_Serverinfo( void );
|
||||
void Cvar_Unlink( void );
|
||||
void Cvar_Unlink( int group );
|
||||
|
||||
//
|
||||
// cmd.c
|
||||
|
@ -125,8 +117,9 @@ char *Cmd_Argv( int arg );
|
|||
void Cmd_Init( void );
|
||||
void Cmd_Unlink( int group );
|
||||
void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc );
|
||||
void Cmd_AddGameCommand( const char *cmd_name, xcommand_t function );
|
||||
void Cmd_AddClientCommand( const char *cmd_name, xcommand_t function );
|
||||
void Cmd_AddServerCommand( const char *cmd_name, xcommand_t function );
|
||||
int Cmd_AddClientCommand( const char *cmd_name, xcommand_t function );
|
||||
int Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function );
|
||||
void Cmd_RemoveCommand( const char *cmd_name );
|
||||
qboolean Cmd_Exists( const char *cmd_name );
|
||||
void Cmd_LookupCmds( char *buffer, void *ptr, setpair_t callback );
|
||||
|
@ -134,7 +127,7 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length );
|
|||
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length );
|
||||
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length );
|
||||
void Cmd_TokenizeString( char *text );
|
||||
void Cmd_ExecuteString( char *text, cmd_source_t src );
|
||||
void Cmd_ExecuteString( char *text );
|
||||
void Cmd_ForwardToServer( void );
|
||||
|
||||
//
|
||||
|
@ -153,6 +146,7 @@ size_t Q_strncat( char *dst, const char *src, size_t siz );
|
|||
size_t Q_strncpy( char *dst, const char *src, size_t siz );
|
||||
#define copystring( s ) _copystring( host.mempool, s, __FILE__, __LINE__ )
|
||||
char *_copystring( byte *mempool, const char *s, const char *filename, int fileline );
|
||||
uint Q_hashkey( const char *string, uint hashSize, qboolean caseinsensitive );
|
||||
qboolean Q_isdigit( const char *str );
|
||||
int Q_atoi( const char *str );
|
||||
float Q_atof( const char *str );
|
||||
|
@ -174,14 +168,6 @@ int Q_sprintf( char *buffer, const char *format, ... );
|
|||
#define Q_memprint( val ) Q_pretifymem( val, 2 )
|
||||
char *Q_pretifymem( float value, int digitsafterdecimal );
|
||||
char *va( const char *format, ... );
|
||||
#define Q_memcpy( dest, src, size ) _Q_memcpy( dest, src, size, __FILE__, __LINE__ )
|
||||
#define Q_memset( dest, val, size ) _Q_memset( dest, val, size, __FILE__, __LINE__ )
|
||||
#define Q_memcmp( src0, src1, siz ) _Q_memcmp( src0, src1, siz, __FILE__, __LINE__ )
|
||||
#define Q_memmove( dest, src, size ) _Q_memmove( dest, src, size, __FILE__, __LINE__ )
|
||||
void _Q_memset( void *dest, int set, size_t count, const char *filename, int fileline );
|
||||
void _Q_memcpy( void *dest, const void *src, size_t count, const char *filename, int fileline );
|
||||
int _Q_memcmp( const void *src0, const void *src1, size_t count, const char *filename, int fileline );
|
||||
void _Q_memmove( void *dest, const void *src, size_t count, const char *filename, int fileline );
|
||||
|
||||
//
|
||||
// zone.c
|
||||
|
@ -206,7 +192,5 @@ void Mem_PrintStats( void );
|
|||
#define Mem_EmptyPool( pool ) _Mem_EmptyPool( pool, __FILE__, __LINE__ )
|
||||
#define Mem_IsAllocated( mem ) Mem_IsAllocatedExt( NULL, mem )
|
||||
#define Mem_Check() _Mem_Check( __FILE__, __LINE__ )
|
||||
|
||||
void CRT_Init( void ); // must be call first
|
||||
|
||||
#endif//STDLIB_H
|
|
@ -17,6 +17,7 @@ GNU General Public License for more details.
|
|||
|
||||
convar_t *cvar_vars; // head of list
|
||||
convar_t *userinfo, *physinfo, *serverinfo, *renderinfo;
|
||||
convar_t *cmd_scripting;
|
||||
|
||||
/*
|
||||
============
|
||||
|
@ -139,7 +140,7 @@ void Cvar_LookupVars( int checkbit, void *buffer, void *ptr, setpair_t callback
|
|||
else
|
||||
{
|
||||
// NOTE: dlls cvars doesn't have description
|
||||
if( cvar->flags & CVAR_EXTDLL )
|
||||
if( FBitSet( cvar->flags, CVAR_SERVERDLL ))
|
||||
callback( cvar->name, cvar->string, "game cvar", ptr );
|
||||
else callback( cvar->name, cvar->string, cvar->description, ptr );
|
||||
}
|
||||
|
@ -156,18 +157,25 @@ The flags will be or'ed in if the variable exists.
|
|||
*/
|
||||
convar_t *Cvar_Get( const char *var_name, const char *var_value, int flags, const char *var_desc )
|
||||
{
|
||||
convar_t *var;
|
||||
convar_t *cur, *find, *var;
|
||||
|
||||
if( !var_name )
|
||||
{
|
||||
Sys_Error( "Cvar_Get: passed NULL name\n" );
|
||||
MsgDev( D_ERROR, "Cvar_Get: passed NULL name\n" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// check for command coexisting
|
||||
if( Cmd_Exists( var_name ))
|
||||
{
|
||||
MsgDev( D_ERROR, "Cvar_Get: %s is a command\n", var_name );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( !var_value ) var_value = "0"; // just apply default value
|
||||
|
||||
// all broadcast cvars must be passed this check
|
||||
if( flags & ( CVAR_USERINFO|CVAR_SERVERINFO|CVAR_PHYSICINFO ))
|
||||
if( FBitSet( flags, CVAR_USERINFO|CVAR_SERVERINFO|CVAR_PHYSICINFO ))
|
||||
{
|
||||
if( !Cvar_ValidateString( var_name, false ))
|
||||
{
|
||||
|
@ -182,37 +190,30 @@ convar_t *Cvar_Get( const char *var_name, const char *var_value, int flags, cons
|
|||
}
|
||||
}
|
||||
|
||||
// check for command coexisting
|
||||
if( Cmd_Exists( var_name ))
|
||||
{
|
||||
MsgDev( D_ERROR, "Cvar_Get: %s is a command\n", var_name );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
var = Cvar_FindVar( var_name );
|
||||
|
||||
if( var )
|
||||
{
|
||||
// fast check for short cvars
|
||||
if( var->flags & CVAR_EXTDLL )
|
||||
if( FBitSet( var->flags, CVAR_SERVERDLL ))
|
||||
{
|
||||
var->flags |= flags;
|
||||
SetBits( var->flags, flags );
|
||||
return var;
|
||||
}
|
||||
|
||||
// if the C code is now specifying a variable that the user already
|
||||
// set a value for, take the new value as the reset value
|
||||
if(( var->flags & CVAR_USER_CREATED ) && !( flags & CVAR_USER_CREATED ) && var_value[0] )
|
||||
if( FBitSet( var->flags, CVAR_USER_CREATED ) && !FBitSet( flags, CVAR_USER_CREATED ) && var_value[0] )
|
||||
{
|
||||
var->flags &= ~CVAR_USER_CREATED;
|
||||
Mem_Free( var->reset_string );
|
||||
var->reset_string = copystring( var_value );
|
||||
ClearBits( var->flags, CVAR_USER_CREATED );
|
||||
}
|
||||
|
||||
var->flags |= flags;
|
||||
SetBits( var->flags, flags );
|
||||
|
||||
// only allow one non-empty reset string without a warning
|
||||
if( !var->reset_string[0] )
|
||||
if( var->reset_string != NULL && !var->reset_string[0] )
|
||||
{
|
||||
// we don't have a reset string yet
|
||||
Mem_Free( var->reset_string );
|
||||
|
@ -220,7 +221,7 @@ convar_t *Cvar_Get( const char *var_name, const char *var_value, int flags, cons
|
|||
}
|
||||
|
||||
// if we have a latched string, take that value now
|
||||
if( var->latched_string )
|
||||
if( var->latched_string != NULL )
|
||||
{
|
||||
char *s = var->latched_string;
|
||||
var->latched_string = NULL; // otherwise cvar_set2 would free it
|
||||
|
@ -228,12 +229,13 @@ convar_t *Cvar_Get( const char *var_name, const char *var_value, int flags, cons
|
|||
Mem_Free( s );
|
||||
}
|
||||
|
||||
if( var_desc )
|
||||
if( var_desc != NULL )
|
||||
{
|
||||
// update description if needs
|
||||
if( var->description ) Mem_Free( var->description );
|
||||
var->description = copystring( var_desc );
|
||||
}
|
||||
|
||||
return var;
|
||||
}
|
||||
|
||||
|
@ -248,9 +250,12 @@ convar_t *Cvar_Get( const char *var_name, const char *var_value, int flags, cons
|
|||
var->modified = true;
|
||||
var->flags = flags;
|
||||
|
||||
// link the variable in
|
||||
var->next = cvar_vars;
|
||||
cvar_vars = var;
|
||||
// link the variable in alphanumerical order
|
||||
for( cur = NULL, find = cvar_vars; find && Q_strcmp( find->name, var->name ) < 0; cur = find, find = find->next );
|
||||
|
||||
if( cur ) cur->next = var;
|
||||
else cvar_vars = var;
|
||||
var->next = find;
|
||||
|
||||
return var;
|
||||
}
|
||||
|
@ -264,7 +269,7 @@ Adds a freestanding variable to the variable list.
|
|||
*/
|
||||
void Cvar_RegisterVariable( cvar_t *var )
|
||||
{
|
||||
convar_t **prev, *cur = NULL;
|
||||
convar_t *cur = NULL;
|
||||
convar_t *find;
|
||||
|
||||
ASSERT( var != NULL );
|
||||
|
@ -281,64 +286,54 @@ void Cvar_RegisterVariable( cvar_t *var )
|
|||
{
|
||||
// this cvar is already registered with Cvar_RegisterVariable
|
||||
// so we can't replace it
|
||||
if( cur->flags & CVAR_EXTDLL )
|
||||
if( FBitSet( cur->flags, CVAR_SERVERDLL ))
|
||||
{
|
||||
MsgDev( D_ERROR, "can't register variable %s, allready defined\n", var->name );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( cur )
|
||||
{
|
||||
prev = &cvar_vars;
|
||||
|
||||
while( 1 )
|
||||
else
|
||||
{
|
||||
find = *prev;
|
||||
var->string = cur->string; // we already have right string
|
||||
var->value = Q_atof( var->string );
|
||||
SetBits( var->flags, CVAR_SERVERDLL ); // all cvars passed this function are game cvars
|
||||
var->next = (cvar_t *)cur->next;
|
||||
|
||||
ASSERT( find != NULL );
|
||||
|
||||
if( cur == cvar_vars )
|
||||
if( cvar_vars == cur )
|
||||
{
|
||||
// relink at tail
|
||||
cvar_vars = (convar_t *)var;
|
||||
break;
|
||||
}
|
||||
|
||||
// search for previous cvar
|
||||
if( cur != find->next )
|
||||
else
|
||||
{
|
||||
prev = &find->next;
|
||||
continue;
|
||||
// otherwise find it somewhere in the list
|
||||
for( find = cvar_vars; find->next != cur; find = find->next );
|
||||
|
||||
ASSERT( find != NULL );
|
||||
|
||||
find->next = (convar_t *)var;
|
||||
}
|
||||
|
||||
// link new variable
|
||||
find->next = (convar_t *)var;
|
||||
break;
|
||||
// release current cvar (but keep string)
|
||||
if( cur->name ) Mem_Free( cur->name );
|
||||
if( cur->latched_string ) Mem_Free( cur->latched_string );
|
||||
if( cur->reset_string ) Mem_Free( cur->reset_string );
|
||||
if( cur->description ) Mem_Free( cur->description );
|
||||
Mem_Free( cur );
|
||||
}
|
||||
|
||||
var->string = cur->string; // we already have right string
|
||||
var->value = Q_atof( var->string );
|
||||
var->flags |= CVAR_EXTDLL; // all cvars passed this function are game cvars
|
||||
var->next = (cvar_t *)cur->next;
|
||||
|
||||
// release current cvar (but keep string)
|
||||
if( cur->name ) Mem_Free( cur->name );
|
||||
if( cur->latched_string ) Mem_Free( cur->latched_string );
|
||||
if( cur->reset_string ) Mem_Free( cur->reset_string );
|
||||
if( cur->description ) Mem_Free( cur->description );
|
||||
Mem_Free( cur );
|
||||
}
|
||||
else
|
||||
{
|
||||
// copy the value off, because future sets will Z_Free it
|
||||
var->string = copystring( var->string );
|
||||
var->value = Q_atof( var->string );
|
||||
var->flags |= CVAR_EXTDLL; // all cvars passed this function are game cvars
|
||||
SetBits( var->flags, CVAR_SERVERDLL ); // all cvars passed this function are game cvars
|
||||
|
||||
// link the variable in alphanumerical order
|
||||
for( cur = NULL, find = cvar_vars; find && Q_strcmp( find->name, var->name ) < 0; cur = find, find = find->next );
|
||||
|
||||
// link the variable in
|
||||
var->next = (cvar_t *)cvar_vars;
|
||||
cvar_vars = (convar_t *)var;
|
||||
if( cur ) cur->next = (convar_t *)var;
|
||||
else cvar_vars = (convar_t *)var;
|
||||
var->next = (cvar_t *)find;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -352,7 +347,6 @@ convar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force )
|
|||
convar_t *var;
|
||||
const char *pszValue;
|
||||
char szNew[MAX_SYSPATH];
|
||||
qboolean dll_variable = false;
|
||||
|
||||
if( !Cvar_ValidateString( var_name, false ))
|
||||
{
|
||||
|
@ -361,6 +355,7 @@ convar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force )
|
|||
}
|
||||
|
||||
var = Cvar_FindVar( var_name );
|
||||
|
||||
if( !var )
|
||||
{
|
||||
// create it
|
||||
|
@ -369,14 +364,10 @@ convar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force )
|
|||
|
||||
}
|
||||
|
||||
// use this check to prevent acessing for unexisting fields
|
||||
// for cvar_t: latched_string, description, etc
|
||||
if( var->flags & CVAR_EXTDLL )
|
||||
dll_variable = true;
|
||||
|
||||
if( !value )
|
||||
{
|
||||
if( dll_variable ) value = "0";
|
||||
if( FBitSet( var->flags, CVAR_SERVERDLL ))
|
||||
value = "0";
|
||||
else value = var->reset_string;
|
||||
}
|
||||
|
||||
|
@ -384,23 +375,24 @@ convar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force )
|
|||
return var;
|
||||
|
||||
// any latched values not allowed for game cvars
|
||||
if( dll_variable ) force = true;
|
||||
if( FBitSet( var->flags, CVAR_SERVERDLL ))
|
||||
force = true;
|
||||
|
||||
if( !force )
|
||||
{
|
||||
if( var->flags & ( CVAR_READ_ONLY|CVAR_GLCONFIG ))
|
||||
if( FBitSet( var->flags, CVAR_READ_ONLY|CVAR_GLCONFIG ))
|
||||
{
|
||||
MsgDev( D_INFO, "%s is read only.\n", var_name );
|
||||
return var;
|
||||
}
|
||||
|
||||
if( var->flags & CVAR_INIT )
|
||||
if( FBitSet( var->flags, CVAR_INIT ))
|
||||
{
|
||||
MsgDev( D_INFO, "%s is write protected.\n", var_name );
|
||||
return var;
|
||||
}
|
||||
|
||||
if( var->flags & CVAR_LATCH )
|
||||
if( FBitSet( var->flags, CVAR_LATCH ))
|
||||
{
|
||||
if( var->latched_string )
|
||||
{
|
||||
|
@ -414,7 +406,7 @@ convar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force )
|
|||
return var;
|
||||
}
|
||||
|
||||
if( var->flags & CVAR_LATCH && Cvar_VariableInteger( "host_serverstate" ))
|
||||
if( FBitSet( var->flags, CVAR_LATCH ) && Cvar_VariableInteger( "host_serverstate" ))
|
||||
{
|
||||
MsgDev( D_INFO, "%s will be changed upon restarting.\n", var->name );
|
||||
var->latched_string = copystring( value );
|
||||
|
@ -431,7 +423,7 @@ convar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force )
|
|||
return var;
|
||||
}
|
||||
|
||||
if(( var->flags & CVAR_CHEAT ) && !Cvar_VariableInteger( "sv_cheats" ))
|
||||
if( FBitSet( var->flags, CVAR_CHEAT ) && !Cvar_VariableInteger( "sv_cheats" ))
|
||||
{
|
||||
MsgDev( D_INFO, "%s is cheat protected.\n", var_name );
|
||||
return var;
|
||||
|
@ -439,7 +431,7 @@ convar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( !dll_variable && var->latched_string )
|
||||
if( !FBitSet( var->flags, CVAR_SERVERDLL ) && var->latched_string )
|
||||
{
|
||||
Mem_Free( var->latched_string );
|
||||
var->latched_string = NULL;
|
||||
|
@ -448,39 +440,32 @@ convar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force )
|
|||
|
||||
pszValue = value;
|
||||
|
||||
// This cvar's string must only contain printable characters.
|
||||
// Strip out any other crap.
|
||||
// We'll fill in "empty" if nothing is left
|
||||
if( var->flags & CVAR_PRINTABLEONLY )
|
||||
// this cvar's string must only contain printable characters.
|
||||
// strip out any other crap.
|
||||
// we'll fill in "empty" if nothing is left
|
||||
if( FBitSet( var->flags, CVAR_PRINTABLEONLY ))
|
||||
{
|
||||
const char *pS;
|
||||
char *pD;
|
||||
const char *s;
|
||||
char *d;
|
||||
|
||||
// clear out new string
|
||||
szNew[0] = '\0';
|
||||
|
||||
pS = pszValue;
|
||||
pD = szNew;
|
||||
s = pszValue;
|
||||
d = szNew;
|
||||
|
||||
// step through the string, only copying back in characters that are printable
|
||||
while( *pS )
|
||||
while( *s )
|
||||
{
|
||||
if( ((byte)*pS) < 32 || ((byte)*pS) > 255 )
|
||||
if( ((byte)*s) < 32 )
|
||||
{
|
||||
pS++;
|
||||
s++;
|
||||
continue;
|
||||
}
|
||||
*pD++ = *pS++;
|
||||
*d++ = *s++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
// terminate the new string
|
||||
*pD = '\0';
|
||||
|
||||
// if it's empty, then insert a marker string
|
||||
if( !Q_strlen( szNew ))
|
||||
{
|
||||
Q_strcpy( szNew, "default" );
|
||||
}
|
||||
Q_strncpy( szNew, "default", sizeof( szNew ));
|
||||
|
||||
// point the value here.
|
||||
pszValue = szNew;
|
||||
|
@ -490,24 +475,24 @@ convar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force )
|
|||
if( !Q_strcmp( pszValue, var->string ))
|
||||
return var;
|
||||
|
||||
if( var->flags & CVAR_USERINFO )
|
||||
userinfo->modified = true; // transmit at next oportunity
|
||||
if( FBitSet( var->flags, CVAR_USERINFO ))
|
||||
userinfo->modified = true; // transmit at next oportunity
|
||||
|
||||
if( var->flags & CVAR_PHYSICINFO )
|
||||
physinfo->modified = true; // transmit at next oportunity
|
||||
if( FBitSet( var->flags, CVAR_PHYSICINFO ))
|
||||
physinfo->modified = true; // transmit at next oportunity
|
||||
|
||||
if( var->flags & CVAR_SERVERINFO )
|
||||
serverinfo->modified = true; // transmit at next oportunity
|
||||
if( FBitSet( var->flags, CVAR_SERVERINFO ))
|
||||
serverinfo->modified = true; // transmit at next oportunity
|
||||
|
||||
if( var->flags & CVAR_RENDERINFO )
|
||||
renderinfo->modified = true; // transmit at next oportunity
|
||||
if( FBitSet( var->flags, CVAR_RENDERINFO ))
|
||||
renderinfo->modified = true; // transmit at next oportunity
|
||||
|
||||
// free the old value string
|
||||
Mem_Free( var->string );
|
||||
var->string = copystring( pszValue );
|
||||
var->value = Q_atof( var->string );
|
||||
|
||||
if( !dll_variable )
|
||||
if( !FBitSet( var->flags, CVAR_SERVERDLL ))
|
||||
{
|
||||
var->integer = Q_atoi( var->string );
|
||||
var->modified = true;
|
||||
|
@ -544,53 +529,33 @@ Cvar_FullSet
|
|||
void Cvar_FullSet( const char *var_name, const char *value, int flags )
|
||||
{
|
||||
convar_t *var;
|
||||
qboolean dll_variable = false;
|
||||
|
||||
var = Cvar_FindVar( var_name );
|
||||
if( !var )
|
||||
if(( var = Cvar_FindVar( var_name )) == NULL )
|
||||
{
|
||||
// create it
|
||||
Cvar_Get( var_name, value, flags, "" );
|
||||
return;
|
||||
}
|
||||
|
||||
// use this check to prevent acessing for unexisting fields
|
||||
// for cvar_t: latechd_string, description, etc
|
||||
if( var->flags & CVAR_EXTDLL )
|
||||
{
|
||||
dll_variable = true;
|
||||
}
|
||||
if( FBitSet( var->flags, CVAR_USERINFO ))
|
||||
userinfo->modified = true; // transmit at next oportunity
|
||||
|
||||
if( var->flags & CVAR_USERINFO )
|
||||
{
|
||||
// transmit at next oportunity
|
||||
userinfo->modified = true;
|
||||
}
|
||||
if( FBitSet( var->flags, CVAR_PHYSICINFO ))
|
||||
physinfo->modified = true; // transmit at next oportunity
|
||||
|
||||
if( var->flags & CVAR_PHYSICINFO )
|
||||
{
|
||||
// transmit at next oportunity
|
||||
physinfo->modified = true;
|
||||
}
|
||||
if( FBitSet( var->flags, CVAR_SERVERINFO ))
|
||||
serverinfo->modified = true; // transmit at next oportunity
|
||||
|
||||
if( var->flags & CVAR_SERVERINFO )
|
||||
{
|
||||
// transmit at next oportunity
|
||||
serverinfo->modified = true;
|
||||
}
|
||||
|
||||
if( var->flags & CVAR_RENDERINFO )
|
||||
{
|
||||
// transmit at next oportunity
|
||||
renderinfo->modified = true;
|
||||
}
|
||||
if( FBitSet( var->flags, CVAR_RENDERINFO ))
|
||||
renderinfo->modified = true; // transmit at next oportunity
|
||||
|
||||
Mem_Free( var->string ); // free the old value string
|
||||
var->string = copystring( value );
|
||||
var->value = Q_atof( var->string );
|
||||
var->flags = flags;
|
||||
|
||||
if( dll_variable ) return; // below fields doesn't exist in cvar_t
|
||||
if( FBitSet( var->flags, CVAR_SERVERDLL ))
|
||||
return; // below fields doesn't exist in cvar_t
|
||||
|
||||
var->integer = Q_atoi( var->string );
|
||||
var->modified = true;
|
||||
|
@ -603,15 +568,17 @@ Cvar_DirectSet
|
|||
*/
|
||||
void Cvar_DirectSet( cvar_t *var, const char *value )
|
||||
{
|
||||
cvar_t *test;
|
||||
const char *pszValue;
|
||||
char szNew[MAX_SYSPATH];
|
||||
|
||||
if( !var ) return; // GET_CVAR_POINTER is failed ?
|
||||
|
||||
// make sure what is really pointer to the cvar
|
||||
test = (cvar_t *)Cvar_FindVar( var->name );
|
||||
ASSERT( var == test );
|
||||
if( var != (cvar_t *)Cvar_FindVar( var->name ))
|
||||
{
|
||||
MsgDev( D_ERROR, "Cvar_DirectSet: invalid pointer to cvar\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( value && !Cvar_ValidateString( value, true ))
|
||||
{
|
||||
|
@ -619,60 +586,59 @@ void Cvar_DirectSet( cvar_t *var, const char *value )
|
|||
value = "0";
|
||||
}
|
||||
|
||||
if( !value ) value = "0";
|
||||
if( !value )
|
||||
{
|
||||
if( FBitSet( var->flags, CVAR_SERVERDLL ))
|
||||
value = "0";
|
||||
else value = ((convar_t *)var)->reset_string;
|
||||
}
|
||||
|
||||
if( var->flags & ( CVAR_READ_ONLY|CVAR_GLCONFIG|CVAR_INIT|CVAR_RENDERINFO|CVAR_LATCH ))
|
||||
if( FBitSet( var->flags, CVAR_READ_ONLY|CVAR_GLCONFIG|CVAR_INIT|CVAR_RENDERINFO|CVAR_LATCH ))
|
||||
{
|
||||
// Cvar_DirectSet cannot change these cvars at all
|
||||
return;
|
||||
}
|
||||
|
||||
if(( var->flags & CVAR_CHEAT ) && !Cvar_VariableInteger( "sv_cheats" ))
|
||||
if( FBitSet( var->flags, CVAR_CHEAT ) && !Cvar_VariableInteger( "sv_cheats" ))
|
||||
{
|
||||
// cheats are disabled
|
||||
MsgDev( D_INFO, "%s is cheat protected.\n", var->name );
|
||||
return;
|
||||
}
|
||||
|
||||
pszValue = value;
|
||||
|
||||
// This cvar's string must only contain printable characters.
|
||||
// Strip out any other crap.
|
||||
// We'll fill in "empty" if nothing is left
|
||||
if( var->flags & CVAR_PRINTABLEONLY )
|
||||
// this cvar's string must only contain printable characters.
|
||||
// strip out any other crap.
|
||||
// we'll fill in "empty" if nothing is left
|
||||
if( FBitSet( var->flags, CVAR_PRINTABLEONLY ))
|
||||
{
|
||||
const char *pS;
|
||||
char *pD;
|
||||
const char *s;
|
||||
char *d;
|
||||
|
||||
// clear out new string
|
||||
szNew[0] = '\0';
|
||||
|
||||
pS = pszValue;
|
||||
pD = szNew;
|
||||
s = pszValue;
|
||||
d = szNew;
|
||||
|
||||
// step through the string, only copying back in characters that are printable
|
||||
while( *pS )
|
||||
while( *s )
|
||||
{
|
||||
if( *pS < 32 || *pS > 255 )
|
||||
if( ((byte)*s) < 32 )
|
||||
{
|
||||
pS++;
|
||||
s++;
|
||||
continue;
|
||||
}
|
||||
*pD++ = *pS++;
|
||||
*d++ = *s++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
// terminate the new string
|
||||
*pD = '\0';
|
||||
|
||||
// if it's empty, then insert a marker string
|
||||
if( !Q_strlen( szNew ))
|
||||
{
|
||||
Q_strcpy( szNew, "default" );
|
||||
}
|
||||
Q_strncpy( szNew, "default", sizeof( szNew ));
|
||||
|
||||
// point the value here.
|
||||
pszValue = szNew;
|
||||
}
|
||||
|
||||
// nothing to change
|
||||
if( !Q_strcmp( pszValue, var->string ))
|
||||
return;
|
||||
|
||||
|
@ -692,6 +658,12 @@ void Cvar_DirectSet( cvar_t *var, const char *value )
|
|||
Mem_Free( var->string );
|
||||
var->string = copystring( pszValue );
|
||||
var->value = Q_atof( var->string );
|
||||
|
||||
if( FBitSet( var->flags, CVAR_SERVERDLL ))
|
||||
return; // below fields doesn't exist in cvar_t
|
||||
|
||||
((convar_t *)var)->integer = Q_atoi( var->string );
|
||||
((convar_t *)var)->modified = true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -734,10 +706,10 @@ void Cvar_SetCheatState( void )
|
|||
for( var = cvar_vars; var; var = var->next )
|
||||
{
|
||||
// can't process dll cvars - missed latched_string, reset_string
|
||||
if( var->flags & CVAR_EXTDLL )
|
||||
if( FBitSet( var->flags, CVAR_SERVERDLL ))
|
||||
continue;
|
||||
|
||||
if( var->flags & CVAR_CHEAT )
|
||||
if( FBitSet( var->flags, CVAR_CHEAT ))
|
||||
{
|
||||
// the CVAR_LATCHED|CVAR_CHEAT vars might escape the reset here
|
||||
// because of a different var->latched_string
|
||||
|
@ -748,9 +720,7 @@ void Cvar_SetCheatState( void )
|
|||
}
|
||||
|
||||
if( Q_strcmp( var->reset_string, var->string ))
|
||||
{
|
||||
Cvar_Set( var->name, var->reset_string );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -773,7 +743,8 @@ qboolean Cvar_Command( void )
|
|||
// perform a variable print or set
|
||||
if( Cmd_Argc() == 1 )
|
||||
{
|
||||
if( v->flags & ( CVAR_INIT|CVAR_EXTDLL )) Msg( "%s: %s\n", v->name, v->string );
|
||||
if( FBitSet( v->flags, CVAR_INIT|CVAR_SERVERDLL ))
|
||||
Msg( "%s: %s\n", v->name, v->string );
|
||||
else Msg( "%s: %s ( ^3%s^7 )\n", v->name, v->string, v->reset_string );
|
||||
return true;
|
||||
}
|
||||
|
@ -800,8 +771,7 @@ void Cvar_Toggle_f( void )
|
|||
return;
|
||||
}
|
||||
|
||||
v = Cvar_VariableValue( Cmd_Argv( 1 ));
|
||||
v = !v;
|
||||
v = !Cvar_VariableInteger( Cmd_Argv( 1 ));
|
||||
|
||||
Cvar_Set2( Cmd_Argv( 1 ), va( "%i", v ), false );
|
||||
}
|
||||
|
@ -820,16 +790,18 @@ void Cvar_Set_f( void )
|
|||
char combined[MAX_CMD_TOKENS];
|
||||
|
||||
c = Cmd_Argc();
|
||||
|
||||
if( c < 3 )
|
||||
{
|
||||
Msg( "Usage: set <variable> <value>\n" );
|
||||
return;
|
||||
}
|
||||
combined[0] = 0;
|
||||
|
||||
combined[0] = '\0';
|
||||
|
||||
for( i = 2; i < c; i++ )
|
||||
{
|
||||
len = Q_strlen( Cmd_Argv(i) + 1 );
|
||||
len = Q_strlen( Cmd_Argv( i ) + 1 );
|
||||
if( l + len >= MAX_CMD_TOKENS - 2 )
|
||||
break;
|
||||
Q_strcat( combined, Cmd_Argv( i ));
|
||||
|
@ -861,7 +833,7 @@ void Cvar_SetU_f( void )
|
|||
v = Cvar_FindVar( Cmd_Argv( 1 ));
|
||||
|
||||
if( !v ) return;
|
||||
v->flags |= CVAR_USERINFO;
|
||||
SetBits( v->flags, CVAR_USERINFO );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -885,7 +857,7 @@ void Cvar_SetP_f( void )
|
|||
v = Cvar_FindVar( Cmd_Argv( 1 ));
|
||||
|
||||
if( !v ) return;
|
||||
v->flags |= CVAR_PHYSICINFO;
|
||||
SetBits( v->flags, CVAR_PHYSICINFO );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -904,11 +876,12 @@ void Cvar_SetS_f( void )
|
|||
Msg( "Usage: sets <variable> <value>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
Cvar_Set_f();
|
||||
v = Cvar_FindVar( Cmd_Argv( 1 ));
|
||||
|
||||
if( !v ) return;
|
||||
v->flags |= CVAR_SERVERINFO;
|
||||
SetBits( v->flags, CVAR_SERVERINFO );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -932,7 +905,7 @@ void Cvar_SetA_f( void )
|
|||
v = Cvar_FindVar( Cmd_Argv( 1 ));
|
||||
|
||||
if( !v ) return;
|
||||
v->flags |= CVAR_ARCHIVE;
|
||||
SetBits( v->flags, CVAR_ARCHIVE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -983,6 +956,7 @@ void Cvar_Reset_f( void )
|
|||
Msg( "Usage: reset <variable>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
Cvar_Reset( Cmd_Argv( 1 ));
|
||||
}
|
||||
|
||||
|
@ -995,12 +969,12 @@ void Cvar_List_f( void )
|
|||
{
|
||||
convar_t *var;
|
||||
char *match = NULL;
|
||||
int i = 0, j = 0;
|
||||
int i = 0;
|
||||
|
||||
if( Cmd_Argc() > 1 )
|
||||
match = Cmd_Argv( 1 );
|
||||
|
||||
for( var = cvar_vars; var; var = var->next, i++ )
|
||||
for( var = cvar_vars; var; var = var->next )
|
||||
{
|
||||
if( var->name[0] == '@' )
|
||||
continue; // never shows system cvars
|
||||
|
@ -1008,41 +982,13 @@ void Cvar_List_f( void )
|
|||
if( match && !Q_stricmpext( match, var->name ))
|
||||
continue;
|
||||
|
||||
if( var->flags & CVAR_SERVERINFO ) Msg( "SV " );
|
||||
else Msg( " " );
|
||||
|
||||
if( var->flags & CVAR_USERINFO ) Msg( "USER " );
|
||||
else Msg( " " );
|
||||
|
||||
if( var->flags & CVAR_PHYSICINFO ) Msg( "PHYS " );
|
||||
else Msg( " " );
|
||||
|
||||
if( var->flags & CVAR_READ_ONLY ) Msg( "READ " );
|
||||
else Msg( " " );
|
||||
|
||||
if( var->flags & CVAR_INIT ) Msg( "INIT " );
|
||||
else Msg( " " );
|
||||
|
||||
if( var->flags & CVAR_ARCHIVE ) Msg( "ARCH " );
|
||||
else Msg( " " );
|
||||
|
||||
if( var->flags & CVAR_LATCH ) Msg( "LATCH " );
|
||||
else Msg( " " );
|
||||
|
||||
if( var->flags & CVAR_GLCONFIG ) Msg( "OPENGL" );
|
||||
else Msg( " " );
|
||||
|
||||
if( var->flags & CVAR_CHEAT ) Msg( "CHEAT " );
|
||||
else Msg( " " );
|
||||
|
||||
if( var->flags & CVAR_EXTDLL )
|
||||
Msg(" %s \"%s\" %s\n", var->name, var->string, "game cvar" );
|
||||
else Msg(" %s \"%s\" %s\n", var->name, var->string, var->description );
|
||||
j++;
|
||||
if( FBitSet( var->flags, CVAR_SERVERDLL ))
|
||||
Msg( " %-*s \"^2%s^7\" ^3%s^7\n", 32, var->name, var->string, "server cvar" );
|
||||
else Msg( " %-*s \"^2%s^7\" ^3%s^7\n", 32, var->name, var->string, var->description );
|
||||
i++;
|
||||
}
|
||||
|
||||
Msg( "\n%i cvars\n", j );
|
||||
Msg( "%i total cvars\n", i );
|
||||
Msg( "\n%i cvars\n", i );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1064,16 +1010,15 @@ void Cvar_Restart_f( void )
|
|||
var = *prev;
|
||||
if( !var ) break;
|
||||
|
||||
// don't mess with rom values, or some inter-module
|
||||
// communication will get broken (cl.active, etc)
|
||||
if( var->flags & ( CVAR_READ_ONLY|CVAR_GLCONFIG|CVAR_INIT|CVAR_RENDERINFO|CVAR_EXTDLL ))
|
||||
// don't mess with rom values, or some inter-module communication will get broken (cl.active, etc)
|
||||
if( FBitSet( var->flags, CVAR_READ_ONLY|CVAR_GLCONFIG|CVAR_INIT|CVAR_RENDERINFO|CVAR_SERVERDLL ))
|
||||
{
|
||||
prev = &var->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
// throw out any variables the user created
|
||||
if( var->flags & CVAR_USER_CREATED )
|
||||
if( FBitSet( var->flags, CVAR_USER_CREATED ))
|
||||
{
|
||||
*prev = var->next;
|
||||
if( var->name ) Mem_Free( var->name );
|
||||
|
@ -1110,78 +1055,51 @@ void Cvar_Latched_f( void )
|
|||
var = *prev;
|
||||
if( !var ) break;
|
||||
|
||||
if( var->flags & CVAR_EXTDLL )
|
||||
if( FBitSet( var->flags, CVAR_SERVERDLL ))
|
||||
{
|
||||
prev = &var->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( var->flags & CVAR_LATCH && var->latched_string )
|
||||
if( FBitSet( var->flags, CVAR_LATCH ) && var->latched_string )
|
||||
{
|
||||
Cvar_FullSet( var->name, var->latched_string, var->flags );
|
||||
Mem_Free( var->latched_string );
|
||||
var->latched_string = NULL;
|
||||
}
|
||||
|
||||
prev = &var->next;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Unlink_f
|
||||
|
||||
unlink all cvars with flag CVAR_EXTDLL
|
||||
============
|
||||
*/
|
||||
void Cvar_Unlink_f( void )
|
||||
{
|
||||
convar_t *var;
|
||||
convar_t **prev;
|
||||
int count = 0;
|
||||
|
||||
if( Cvar_VariableInteger( "host_gameloaded" ))
|
||||
{
|
||||
MsgDev( D_NOTE, "can't unlink cvars while game is loaded\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
prev = &cvar_vars;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
var = *prev;
|
||||
if( !var ) break;
|
||||
|
||||
// ignore all non-game cvars
|
||||
if( !( var->flags & CVAR_EXTDLL ))
|
||||
{
|
||||
prev = &var->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
// throw out any variables the game created
|
||||
*prev = var->next;
|
||||
if( var->string ) Mem_Free( var->string );
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Unlink
|
||||
|
||||
unlink all cvars with flag CVAR_CLIENTDLL
|
||||
unlink all cvars with specified flag
|
||||
============
|
||||
*/
|
||||
void Cvar_Unlink( void )
|
||||
void Cvar_Unlink( int group )
|
||||
{
|
||||
convar_t *var;
|
||||
convar_t **prev;
|
||||
int count = 0;
|
||||
|
||||
if( Cvar_VariableInteger( "host_clientloaded" ))
|
||||
if( Cvar_VariableInteger( "host_gameloaded" ) && FBitSet( group, CVAR_SERVERDLL ))
|
||||
{
|
||||
MsgDev( D_NOTE, "can't unlink cvars while client is loaded\n" );
|
||||
MsgDev( D_INFO, "can't unlink variables while server is loaded\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( Cvar_VariableInteger( "host_clientloaded" ) && FBitSet( group, CVAR_CLIENTDLL ))
|
||||
{
|
||||
MsgDev( D_INFO, "can't unlink variables while client is loaded\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( Cvar_VariableInteger( "host_gameuiloaded" ) && FBitSet( group, CVAR_GAMEUIDLL ))
|
||||
{
|
||||
MsgDev( D_INFO, "can't unlink variables while GameUI is loaded\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1192,8 +1110,8 @@ void Cvar_Unlink( void )
|
|||
var = *prev;
|
||||
if( !var ) break;
|
||||
|
||||
// ignore all non-client cvars
|
||||
if(!( var->flags & CVAR_CLIENTDLL ))
|
||||
// do filter by specified group
|
||||
if( group && !FBitSet( var->flags, group ))
|
||||
{
|
||||
prev = &var->next;
|
||||
continue;
|
||||
|
@ -1201,12 +1119,17 @@ void Cvar_Unlink( void )
|
|||
|
||||
// throw out any variables the game created
|
||||
*prev = var->next;
|
||||
if( var->name ) Mem_Free( var->name );
|
||||
if( var->string ) Mem_Free( var->string );
|
||||
if( var->latched_string ) Mem_Free( var->latched_string );
|
||||
if( var->reset_string ) Mem_Free( var->reset_string );
|
||||
if( var->description ) Mem_Free( var->description );
|
||||
Mem_Free( var );
|
||||
|
||||
if( !FBitSet( var->flags, CVAR_SERVERDLL ))
|
||||
{
|
||||
if( var->name ) Mem_Free( var->name );
|
||||
if( var->latched_string ) Mem_Free( var->latched_string );
|
||||
if( var->reset_string ) Mem_Free( var->reset_string );
|
||||
if( var->description ) Mem_Free( var->description );
|
||||
Mem_Free( var );
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -1225,18 +1148,18 @@ void Cvar_Init( void )
|
|||
physinfo = Cvar_Get( "@physinfo", "0", CVAR_READ_ONLY, "" ); // use ->modified value only
|
||||
serverinfo = Cvar_Get( "@serverinfo", "0", CVAR_READ_ONLY, "" ); // use ->modified value only
|
||||
renderinfo = Cvar_Get( "@renderinfo", "0", CVAR_READ_ONLY, "" ); // use ->modified value only
|
||||
cmd_scripting = Cvar_Get( "cmd_scripting", "0", CVAR_ARCHIVE, "enable simple condition checking and variable operations" );
|
||||
|
||||
Cmd_AddCommand ("toggle", Cvar_Toggle_f, "toggles a console variable's values (use for more info)" );
|
||||
Cmd_AddCommand ("set", Cvar_Set_f, "create or change the value of a console variable" );
|
||||
Cmd_AddCommand ("sets", Cvar_SetS_f, "create or change the value of a serverinfo variable" );
|
||||
Cmd_AddCommand ("setu", Cvar_SetU_f, "create or change the value of a userinfo variable" );
|
||||
Cmd_AddCommand ("setp", Cvar_SetP_f, "create or change the value of a physicinfo variable" );
|
||||
Cmd_AddCommand ("setr", Cvar_SetR_f, "create or change the value of a renderinfo variable" );
|
||||
Cmd_AddCommand ("setgl", Cvar_SetGL_f, "create or change the value of a opengl variable" );
|
||||
Cmd_AddCommand ("seta", Cvar_SetA_f, "create or change the value of a console variable that will be saved to config.cfg" );
|
||||
Cmd_AddCommand ("reset", Cvar_Reset_f, "reset any type variable to initial value" );
|
||||
Cmd_AddCommand ("latch", Cvar_Latched_f, "apply latched values" );
|
||||
Cmd_AddCommand ("cvarlist", Cvar_List_f, "display all console variables beginning with the specified prefix" );
|
||||
Cmd_AddCommand ("unsetall", Cvar_Restart_f, "reset all console variables to their default values" );
|
||||
Cmd_AddCommand ("@unlink", Cvar_Unlink_f, "unlink static cvars defined in gamedll" );
|
||||
}
|
||||
Cmd_AddCommand( "toggle", Cvar_Toggle_f, "toggles a console variable's values (use for more info)" );
|
||||
Cmd_AddCommand( "set", Cvar_Set_f, "create or change the value of a console variable" );
|
||||
Cmd_AddCommand( "sets", Cvar_SetS_f, "create or change the value of a serverinfo variable" );
|
||||
Cmd_AddCommand( "setu", Cvar_SetU_f, "create or change the value of a userinfo variable" );
|
||||
Cmd_AddCommand( "setp", Cvar_SetP_f, "create or change the value of a physicinfo variable" );
|
||||
Cmd_AddCommand( "setr", Cvar_SetR_f, "create or change the value of a renderinfo variable" );
|
||||
Cmd_AddCommand( "setgl", Cvar_SetGL_f, "create or change the value of a opengl variable" );
|
||||
Cmd_AddCommand( "seta", Cvar_SetA_f, "create or change the value of a console variable that will be saved to config.cfg" );
|
||||
Cmd_AddCommand( "reset", Cvar_Reset_f, "reset any type variable to initial value" );
|
||||
Cmd_AddCommand( "latch", Cvar_Latched_f, "apply latched values" );
|
||||
Cmd_AddCommand( "cvarlist", Cvar_List_f, "display all console variables beginning with the specified prefix" );
|
||||
Cmd_AddCommand( "unsetall", Cvar_Restart_f, "reset all console variables to their default values" );
|
||||
}
|
|
@ -180,7 +180,7 @@ int matchpattern( const char *in, const char *pattern, qboolean caseinsensitive
|
|||
|
||||
void stringlistinit( stringlist_t *list )
|
||||
{
|
||||
Q_memset( list, 0, sizeof( *list ));
|
||||
memset( list, 0, sizeof( *list ));
|
||||
}
|
||||
|
||||
void stringlistfreecontents( stringlist_t *list )
|
||||
|
@ -209,13 +209,13 @@ void stringlistappend( stringlist_t *list, char *text )
|
|||
oldstrings = list->strings;
|
||||
list->maxstrings += 4096;
|
||||
list->strings = Mem_Alloc( fs_mempool, list->maxstrings * sizeof( *list->strings ));
|
||||
if( list->numstrings ) Q_memcpy( list->strings, oldstrings, list->numstrings * sizeof( *list->strings ));
|
||||
if( list->numstrings ) memcpy( list->strings, oldstrings, list->numstrings * sizeof( *list->strings ));
|
||||
if( oldstrings ) Mem_Free( oldstrings );
|
||||
}
|
||||
|
||||
textlen = Q_strlen( text ) + 1;
|
||||
list->strings[list->numstrings] = Mem_Alloc( fs_mempool, textlen );
|
||||
Q_memcpy( list->strings[list->numstrings], text, textlen );
|
||||
memcpy( list->strings[list->numstrings], text, textlen );
|
||||
list->numstrings++;
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ static packfile_t* FS_AddFileToPack( const char* name, pack_t* pack, long offset
|
|||
|
||||
// We have to move the right of the list by one slot to free the one we need
|
||||
pfile = &pack->files[left];
|
||||
Q_memmove( pfile + 1, pfile, (pack->numfiles - left) * sizeof( *pfile ));
|
||||
memmove( pfile + 1, pfile, (pack->numfiles - left) * sizeof( *pfile ));
|
||||
pack->numfiles++;
|
||||
|
||||
Q_strncpy( pfile->name, name, sizeof( pfile->name ));
|
||||
|
@ -804,7 +804,7 @@ void FS_ExtractFilePath( const char* const path, char* dest )
|
|||
|
||||
if( src != path )
|
||||
{
|
||||
Q_memcpy( dest, path, src - path );
|
||||
memcpy( dest, path, src - path );
|
||||
dest[src - path - 1] = 0; // cutoff backslash
|
||||
}
|
||||
else Q_strcpy( dest, "" ); // file without path
|
||||
|
@ -927,7 +927,7 @@ static qboolean FS_ParseVector( char **pfile, float *v, size_t size )
|
|||
if( v == NULL || size == 0 )
|
||||
return false;
|
||||
|
||||
Q_memset( v, 0, sizeof( *v ) * size );
|
||||
memset( v, 0, sizeof( *v ) * size );
|
||||
|
||||
if( size == 1 )
|
||||
{
|
||||
|
@ -1079,7 +1079,7 @@ void FS_CreateDefaultGameInfo( const char *filename )
|
|||
{
|
||||
gameinfo_t defGI;
|
||||
|
||||
Q_memset( &defGI, 0, sizeof( defGI ));
|
||||
memset( &defGI, 0, sizeof( defGI ));
|
||||
|
||||
// setup default values
|
||||
defGI.max_edicts = 900; // default value if not specified
|
||||
|
@ -1262,7 +1262,7 @@ void FS_ConvertGameInfo( const char *gamedir, const char *gameinfo_path, const c
|
|||
{
|
||||
gameinfo_t GameInfo;
|
||||
|
||||
Q_memset( &GameInfo, 0, sizeof( GameInfo ));
|
||||
memset( &GameInfo, 0, sizeof( GameInfo ));
|
||||
|
||||
if( FS_ParseLiblistGam( liblist_path, gamedir, &GameInfo ))
|
||||
{
|
||||
|
@ -1618,7 +1618,7 @@ void FS_Shutdown( void )
|
|||
for( i = 0; i < SI.numgames; i++ )
|
||||
if( SI.games[i] ) Mem_Free( SI.games[i] );
|
||||
|
||||
Q_memset( &SI, 0, sizeof( sysinfo_t ));
|
||||
memset( &SI, 0, sizeof( sysinfo_t ));
|
||||
|
||||
FS_ClearSearchPath(); // release all wad files too
|
||||
Mem_FreePool( &fs_mempool );
|
||||
|
@ -1735,7 +1735,7 @@ file_t *FS_OpenPackedFile( pack_t *pack, int pack_ind )
|
|||
return NULL;
|
||||
|
||||
file = (file_t *)Mem_Alloc( fs_mempool, sizeof( *file ));
|
||||
Q_memset( file, 0, sizeof( *file ));
|
||||
memset( file, 0, sizeof( *file ));
|
||||
file->handle = dup_handle;
|
||||
file->real_length = pfile->realsize;
|
||||
file->offset = pfile->offset;
|
||||
|
@ -1888,7 +1888,7 @@ static searchpath_t *FS_FindFile( const char *name, int* index, qboolean gamedir
|
|||
|
||||
// clear searchpath
|
||||
search = &fs_directpath;
|
||||
Q_memset( search, 0, sizeof( searchpath_t ));
|
||||
memset( search, 0, sizeof( searchpath_t ));
|
||||
|
||||
// root folder has a more priority than netpath
|
||||
Q_strncpy( search->filename, host.rootdir, sizeof( search->filename ));
|
||||
|
@ -2079,7 +2079,7 @@ long FS_Read( file_t *file, void *buffer, size_t buffersize )
|
|||
count = file->buff_len - file->buff_ind;
|
||||
|
||||
done += ((long)buffersize > count ) ? count : (long)buffersize;
|
||||
Q_memcpy( buffer, &file->buff[file->buff_ind], done );
|
||||
memcpy( buffer, &file->buff[file->buff_ind], done );
|
||||
file->buff_ind += done;
|
||||
|
||||
buffersize -= done;
|
||||
|
@ -2122,7 +2122,7 @@ long FS_Read( file_t *file, void *buffer, size_t buffersize )
|
|||
|
||||
// copy the requested data in "buffer" (as much as we can)
|
||||
count = (long)buffersize > file->buff_len ? file->buff_len : (long)buffersize;
|
||||
Q_memcpy( &((byte *)buffer)[done], file->buff, count );
|
||||
memcpy( &((byte *)buffer)[done], file->buff, count );
|
||||
file->buff_ind = count;
|
||||
done += count;
|
||||
}
|
||||
|
@ -2781,7 +2781,7 @@ search_t *FS_Search( const char *pattern, int caseinsensitive, int gamedironly )
|
|||
separator = max( separator, colon );
|
||||
basepathlength = separator ? (separator + 1 - pattern) : 0;
|
||||
basepath = Mem_Alloc( fs_mempool, basepathlength + 1 );
|
||||
if( basepathlength ) Q_memcpy( basepath, pattern, basepathlength );
|
||||
if( basepathlength ) memcpy( basepath, pattern, basepathlength );
|
||||
basepath[basepathlength] = 0;
|
||||
|
||||
// search through the path, one element at a time
|
||||
|
@ -2949,7 +2949,7 @@ search_t *FS_Search( const char *pattern, int caseinsensitive, int gamedironly )
|
|||
|
||||
search->filenames[numfiles] = search->filenamesbuffer + numchars;
|
||||
textlen = Q_strlen(resultlist.strings[resultlistindex]) + 1;
|
||||
Q_memcpy( search->filenames[numfiles], resultlist.strings[resultlistindex], textlen );
|
||||
memcpy( search->filenames[numfiles], resultlist.strings[resultlistindex], textlen );
|
||||
numfiles++;
|
||||
numchars += (int)textlen;
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ void Host_Exec_f( void )
|
|||
|
||||
// adds \n\0 at end of the file
|
||||
txt = Z_Malloc( len + 2 );
|
||||
Q_memcpy( txt, f, len );
|
||||
memcpy( txt, f, len );
|
||||
Q_strncat( txt, "\n", len + 2 );
|
||||
Mem_Free( f );
|
||||
|
||||
|
@ -349,7 +349,7 @@ void Host_InitDecals( void )
|
|||
search_t *t;
|
||||
int i, num_decals = 0;
|
||||
|
||||
Q_memset( host.draw_decals, 0, sizeof( host.draw_decals ));
|
||||
memset( host.draw_decals, 0, sizeof( host.draw_decals ));
|
||||
|
||||
// lookup all decals in decals.wad
|
||||
t = FS_Search( "decals.wad/*.*", true, false );
|
||||
|
@ -807,7 +807,7 @@ void Host_InitCommon( const char *progname, qboolean bChangeGame )
|
|||
GlobalMemoryStatus( &lpBuffer );
|
||||
|
||||
if( !GetCurrentDirectory( sizeof( host.rootdir ), host.rootdir ))
|
||||
Sys_Error( "couldn't determine current directory" );
|
||||
Sys_Error( "couldn't determine current directory\n" );
|
||||
|
||||
if( host.rootdir[Q_strlen( host.rootdir ) - 1] == '/' )
|
||||
host.rootdir[Q_strlen( host.rootdir ) - 1] = 0;
|
||||
|
@ -818,7 +818,7 @@ void Host_InitCommon( const char *progname, qboolean bChangeGame )
|
|||
host.state = HOST_INIT; // initialzation started
|
||||
host.developer = host.old_developer = 0;
|
||||
|
||||
CRT_Init(); // init some CRT functions
|
||||
Memory_Init(); // init memory subsystem
|
||||
|
||||
// some commands may turn engine into infinity loop,
|
||||
// e.g. xash.exe +game xash -game xash
|
||||
|
@ -1043,7 +1043,7 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func
|
|||
Cmd_RemoveCommand( "setgl" );
|
||||
|
||||
// we need to execute it again here
|
||||
Cmd_ExecuteString( "exec config.cfg\n", src_command );
|
||||
Cmd_ExecuteString( "exec config.cfg\n" );
|
||||
oldtime = Sys_DoubleTime();
|
||||
SCR_CheckStartupVids(); // must be last
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void HPAK_AddToQueue( const char *name, resource_t *DirEnt, byte *data, file_t *
|
|||
ptr->size = DirEnt->nDownloadSize;
|
||||
ptr->data = Z_Malloc( ptr->size );
|
||||
|
||||
if( data ) Q_memcpy( ptr->data, data, ptr->size );
|
||||
if( data ) memcpy( ptr->data, data, ptr->size );
|
||||
else if( f ) FS_Read( f, ptr->data, ptr->size );
|
||||
else Host_Error( "HPAK_AddToQueue: data == NULL.\n" );
|
||||
|
||||
|
@ -106,7 +106,7 @@ void HPAK_CreatePak( const char *filename, resource_t *DirEnt, byte *data, file_
|
|||
}
|
||||
|
||||
// let's hash it.
|
||||
Q_memset( &MD5_Hash, 0, sizeof( MD5Context_t ));
|
||||
memset( &MD5_Hash, 0, sizeof( MD5Context_t ));
|
||||
MD5Init( &MD5_Hash );
|
||||
|
||||
if( data == NULL )
|
||||
|
@ -127,7 +127,7 @@ void HPAK_CreatePak( const char *filename, resource_t *DirEnt, byte *data, file_
|
|||
|
||||
MD5Final( md5, &MD5_Hash );
|
||||
|
||||
if( Q_memcmp( md5, DirEnt->rgucMD5_hash, 16 ))
|
||||
if( memcmp( md5, DirEnt->rgucMD5_hash, 16 ))
|
||||
{
|
||||
MsgDev( D_ERROR, "HPAK_CreatePak: bad checksum for %s. Ignored\n", pakname );
|
||||
return;
|
||||
|
@ -159,7 +159,7 @@ void HPAK_CreatePak( const char *filename, resource_t *DirEnt, byte *data, file_
|
|||
FS_Write( fout, &hash_pack_dir.dirs[0], sizeof( hpak_dir_t ));
|
||||
|
||||
Mem_Free( hash_pack_dir.dirs );
|
||||
Q_memset( &hash_pack_dir, 0, sizeof( hpak_container_t ));
|
||||
memset( &hash_pack_dir, 0, sizeof( hpak_container_t ));
|
||||
|
||||
hash_pack_header.seek = filelocation;
|
||||
FS_Seek( fout, 0, SEEK_SET );
|
||||
|
@ -173,7 +173,7 @@ qboolean HPAK_FindResource( hpak_container_t *hpk, char *inHash, resource_t *pRe
|
|||
|
||||
for( i = 0; i < hpk->count; i++ )
|
||||
{
|
||||
if( !Q_memcmp( hpk->dirs[i].DirectoryResource.rgucMD5_hash, inHash, 16 ))
|
||||
if( !memcmp( hpk->dirs[i].DirectoryResource.rgucMD5_hash, inHash, 16 ))
|
||||
{
|
||||
if( pRes ) *pRes = hpk->dirs[i].DirectoryResource; // get full copy
|
||||
|
||||
|
@ -219,7 +219,7 @@ void HPAK_AddLump( qboolean add_to_queue, const char *name, resource_t *DirEnt,
|
|||
}
|
||||
|
||||
// hash it
|
||||
Q_memset( &MD5_Hash, 0, sizeof( MD5Context_t ));
|
||||
memset( &MD5_Hash, 0, sizeof( MD5Context_t ));
|
||||
MD5Init( &MD5_Hash );
|
||||
|
||||
if( data == NULL )
|
||||
|
@ -240,7 +240,7 @@ void HPAK_AddLump( qboolean add_to_queue, const char *name, resource_t *DirEnt,
|
|||
|
||||
MD5Final( md5, &MD5_Hash );
|
||||
|
||||
if( Q_memcmp( md5, DirEnt->rgucMD5_hash, 0x10 ))
|
||||
if( memcmp( md5, DirEnt->rgucMD5_hash, 0x10 ))
|
||||
{
|
||||
MsgDev( D_ERROR, "HPAK_AddLump: bad checksum for %s. Ignored\n", DirEnt->szFileName );
|
||||
return;
|
||||
|
@ -317,11 +317,11 @@ void HPAK_AddLump( qboolean add_to_queue, const char *name, resource_t *DirEnt,
|
|||
// make a new container
|
||||
hpak2.count = hpak1.count;
|
||||
hpak2.dirs = Z_Malloc( sizeof( hpak_dir_t ) * hpak2.count );
|
||||
Q_memcpy( hpak2.dirs, hpak1.dirs, hpak1.count );
|
||||
memcpy( hpak2.dirs, hpak1.dirs, hpak1.count );
|
||||
|
||||
for( i = 0, dirs = NULL; i < hpak1.count; i++ )
|
||||
{
|
||||
if( Q_memcmp( hpak1.dirs[i].DirectoryResource.rgucMD5_hash, DirEnt->rgucMD5_hash, 16 ) < 0 )
|
||||
if( memcmp( hpak1.dirs[i].DirectoryResource.rgucMD5_hash, DirEnt->rgucMD5_hash, 16 ) < 0 )
|
||||
{
|
||||
dirs = &hpak1.dirs[i];
|
||||
while( i < hpak1.count )
|
||||
|
@ -335,7 +335,7 @@ void HPAK_AddLump( qboolean add_to_queue, const char *name, resource_t *DirEnt,
|
|||
|
||||
if( dirs == NULL ) dirs = &hpak2.dirs[hpak2.count-1];
|
||||
|
||||
Q_memset( dirs, 0, sizeof( hpak_dir_t ));
|
||||
memset( dirs, 0, sizeof( hpak_dir_t ));
|
||||
FS_Seek( f2, hash_pack_header.seek, SEEK_SET );
|
||||
dirs->DirectoryResource = *DirEnt;
|
||||
dirs->seek = FS_Tell( f2 );
|
||||
|
@ -449,7 +449,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
|
|||
FS_Seek( f, dataDir[i].seek, SEEK_SET );
|
||||
FS_Read( f, dataPak, dataDir[i].size );
|
||||
|
||||
Q_memset( &MD5_Hash, 0, sizeof( MD5Context_t ));
|
||||
memset( &MD5_Hash, 0, sizeof( MD5Context_t ));
|
||||
MD5Init( &MD5_Hash );
|
||||
MD5Update( &MD5_Hash, dataPak, dataDir[i].size );
|
||||
MD5Final( md5, &MD5_Hash );
|
||||
|
@ -459,7 +459,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
|
|||
MsgDev( D_INFO, "%i: %s %s %s: ", i, HPAK_TypeFromIndex( pRes->type ),
|
||||
Q_pretifymem( pRes->nDownloadSize, 2 ), pRes->szFileName );
|
||||
|
||||
if( Q_memcmp( md5, pRes->rgucMD5_hash, 0x10 ))
|
||||
if( memcmp( md5, pRes->rgucMD5_hash, 0x10 ))
|
||||
{
|
||||
if( quiet )
|
||||
{
|
||||
|
@ -533,7 +533,7 @@ qboolean HPAK_ResourceForHash( const char *filename, char *inHash, resource_t *p
|
|||
|
||||
for( hpak = hpak_queue; hpak != NULL; hpak = hpak->next )
|
||||
{
|
||||
if( !Q_stricmp( hpak->name, filename ) && !Q_memcmp( hpak->HpakResource.rgucMD5_hash, inHash, 0x10 ))
|
||||
if( !Q_stricmp( hpak->name, filename ) && !memcmp( hpak->HpakResource.rgucMD5_hash, inHash, 0x10 ))
|
||||
{
|
||||
if( pRes != NULL ) *pRes = hpak->HpakResource;
|
||||
return true;
|
||||
|
@ -659,12 +659,12 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte
|
|||
|
||||
for( queue = hpak_queue; queue != NULL; queue = queue->next )
|
||||
{
|
||||
if( !Q_stricmp(queue->name, filename ) && !Q_memcmp( queue->HpakResource.rgucMD5_hash, pResource->rgucMD5_hash, 16 ))
|
||||
if( !Q_stricmp(queue->name, filename ) && !memcmp( queue->HpakResource.rgucMD5_hash, pResource->rgucMD5_hash, 16 ))
|
||||
{
|
||||
if( buffer )
|
||||
{
|
||||
tmpbuf = Z_Malloc( queue->size );
|
||||
Q_memcpy( tmpbuf, queue->data, queue->size );
|
||||
memcpy( tmpbuf, queue->data, queue->size );
|
||||
*buffer = tmpbuf;
|
||||
}
|
||||
|
||||
|
@ -712,7 +712,7 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte
|
|||
|
||||
for( i = 0; i < num_lumps; i++ )
|
||||
{
|
||||
if( !Q_memcmp( direntries[i].DirectoryResource.rgucMD5_hash, pResource->rgucMD5_hash, 16 ))
|
||||
if( !memcmp( direntries[i].DirectoryResource.rgucMD5_hash, pResource->rgucMD5_hash, 16 ))
|
||||
{
|
||||
FS_Seek( f, direntries[i].seek, SEEK_SET );
|
||||
|
||||
|
@ -830,7 +830,7 @@ void HPAK_RemoveLump( const char *name, resource_t *resource )
|
|||
// If there's a collision, we've just corrupted this hpak.
|
||||
for( i = 0, j = 0; i < hpak_read.count; i++ )
|
||||
{
|
||||
if( !Q_memcmp( hpak_read.dirs[i].DirectoryResource.rgucMD5_hash, resource->rgucMD5_hash, 16 ))
|
||||
if( !memcmp( hpak_read.dirs[i].DirectoryResource.rgucMD5_hash, resource->rgucMD5_hash, 16 ))
|
||||
continue;
|
||||
|
||||
hpak_save.dirs[j] = hpak_read.dirs[i];
|
||||
|
|
|
@ -55,7 +55,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
|
|||
if( bhdr.reserved0 != 0 ) return false;
|
||||
if( bhdr.planes != 1 ) return false;
|
||||
|
||||
if( Q_memcmp( bhdr.id, "BM", 2 ))
|
||||
if( memcmp( bhdr.id, "BM", 2 ))
|
||||
{
|
||||
MsgDev( D_ERROR, "Image_LoadBMP: only Windows-style BMP files supported (%s)\n", name );
|
||||
return false;
|
||||
|
@ -110,7 +110,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
|
|||
else cbPalBytes = bhdr.colors * sizeof( RGBQUAD );
|
||||
}
|
||||
|
||||
Q_memcpy( palette, buf_p, cbPalBytes );
|
||||
memcpy( palette, buf_p, cbPalBytes );
|
||||
|
||||
if( host.overview_loading && bhdr.bitsPerPixel == 8 )
|
||||
{
|
||||
|
@ -387,7 +387,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix )
|
|||
|
||||
if( host.write_to_clipboard )
|
||||
{
|
||||
Q_memcpy( clipbuf + cur_size, &bmih, sizeof( bmih ));
|
||||
memcpy( clipbuf + cur_size, &bmih, sizeof( bmih ));
|
||||
cur_size += sizeof( bmih );
|
||||
}
|
||||
else
|
||||
|
@ -418,7 +418,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix )
|
|||
|
||||
if( host.write_to_clipboard )
|
||||
{
|
||||
Q_memcpy( clipbuf + cur_size, rgrgbPalette, cbPalBytes );
|
||||
memcpy( clipbuf + cur_size, rgrgbPalette, cbPalBytes );
|
||||
cur_size += cbPalBytes;
|
||||
}
|
||||
else
|
||||
|
@ -459,7 +459,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix )
|
|||
|
||||
if( host.write_to_clipboard )
|
||||
{
|
||||
Q_memcpy( clipbuf + cur_size, pbBmpBits, cbBmpBits );
|
||||
memcpy( clipbuf + cur_size, pbBmpBits, cbBmpBits );
|
||||
cur_size += cbBmpBits;
|
||||
Sys_SetClipboardData( clipbuf, total_size );
|
||||
Z_Free( clipbuf );
|
||||
|
|
|
@ -247,7 +247,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
|
|||
return false;
|
||||
}
|
||||
|
||||
Q_memcpy( &header, buffer, sizeof( dds_t ));
|
||||
memcpy( &header, buffer, sizeof( dds_t ));
|
||||
|
||||
if( header.dwIdent != DDSHEADER )
|
||||
return false; // it's not a dds file, just skip it
|
||||
|
@ -324,7 +324,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
|
|||
|
||||
// dds files will be uncompressed on a render. requires minimal of info for set this
|
||||
image.rgba = Mem_Alloc( host.imagepool, image.size );
|
||||
Q_memcpy( image.rgba, fin, image.size );
|
||||
memcpy( image.rgba, fin, image.size );
|
||||
image.flags |= IMAGE_DDS_FORMAT;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -203,7 +203,7 @@ qboolean FS_AddSideToPack( const char *name, int adjust_flags )
|
|||
if( resampled ) image.rgba = Image_Copy( image.size );
|
||||
|
||||
image.cubemap = Mem_Realloc( host.imagepool, image.cubemap, image.ptr + image.size );
|
||||
Q_memcpy( image.cubemap + image.ptr, image.rgba, image.size ); // add new side
|
||||
memcpy( image.cubemap + image.ptr, image.rgba, image.size ); // add new side
|
||||
|
||||
Mem_Free( image.rgba ); // release source buffer
|
||||
image.ptr += image.size; // move to next
|
||||
|
@ -494,13 +494,13 @@ rgbdata_t *FS_CopyImage( rgbdata_t *in )
|
|||
if( palSize )
|
||||
{
|
||||
out->palette = Mem_Alloc( host.imagepool, palSize );
|
||||
Q_memcpy( out->palette, in->palette, palSize );
|
||||
memcpy( out->palette, in->palette, palSize );
|
||||
}
|
||||
|
||||
if( in->size )
|
||||
{
|
||||
out->buffer = Mem_Alloc( host.imagepool, in->size );
|
||||
Q_memcpy( out->buffer, in->buffer, in->size );
|
||||
memcpy( out->buffer, in->buffer, in->size );
|
||||
}
|
||||
|
||||
return out;
|
||||
|
|
|
@ -470,7 +470,7 @@ rgbdata_t *Image_Quantize( rgbdata_t *pic )
|
|||
}
|
||||
|
||||
pic->buffer = Mem_Realloc( host.imagepool, pic->buffer, image.size );
|
||||
Q_memcpy( pic->buffer, image.tempbuffer, image.size );
|
||||
memcpy( pic->buffer, image.tempbuffer, image.size );
|
||||
pic->type = PF_INDEXED_24;
|
||||
pic->size = image.size;
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ qboolean Image_SaveTGA( const char *name, rgbdata_t *pix )
|
|||
else outsize = pix->width * pix->height * 3 + 18 + Q_strlen( comment );
|
||||
|
||||
buffer = (byte *)Mem_Alloc( host.imagepool, outsize );
|
||||
Q_memset( buffer, 0, 18 );
|
||||
memset( buffer, 0, 18 );
|
||||
|
||||
// prepare header
|
||||
buffer[0] = Q_strlen( comment ); // tga comment length
|
||||
|
|
|
@ -197,7 +197,7 @@ byte *Image_Copy( size_t size )
|
|||
byte *out;
|
||||
|
||||
out = Mem_Alloc( host.imagepool, size );
|
||||
Q_memcpy( out, image.tempbuffer, size );
|
||||
memcpy( out, image.tempbuffer, size );
|
||||
|
||||
return out;
|
||||
}
|
||||
|
@ -279,9 +279,9 @@ int Image_ComparePalette( const byte *pal )
|
|||
{
|
||||
if( pal == NULL )
|
||||
return PAL_INVALID;
|
||||
else if( !Q_memcmp( palette_q1, pal, 768 ))
|
||||
else if( !memcmp( palette_q1, pal, 768 ))
|
||||
return PAL_QUAKE1;
|
||||
else if( !Q_memcmp( palette_hl, pal, 768 ))
|
||||
else if( !memcmp( palette_hl, pal, 768 ))
|
||||
return PAL_HALFLIFE;
|
||||
return PAL_CUSTOM;
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ void Image_CopyPalette32bit( void )
|
|||
{
|
||||
if( image.palette ) return; // already created ?
|
||||
image.palette = Mem_Alloc( host.imagepool, 1024 );
|
||||
Q_memcpy( image.palette, image.d_currentpal, 1024 );
|
||||
memcpy( image.palette, image.d_currentpal, 1024 );
|
||||
}
|
||||
|
||||
void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end )
|
||||
|
@ -530,7 +530,7 @@ void Image_CopyParms( rgbdata_t *src )
|
|||
image.size = src->size;
|
||||
image.palette = src->palette; // may be NULL
|
||||
|
||||
Q_memcpy( image.fogParams, src->fogParams, sizeof( image.fogParams ));
|
||||
memcpy( image.fogParams, src->fogParams, sizeof( image.fogParams ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -715,7 +715,7 @@ void Image_Resample32Lerp( const void *indata, int inwidth, int inheight, void *
|
|||
if( yi != oldy )
|
||||
{
|
||||
inrow = (byte *)indata + inwidth4 * yi;
|
||||
if (yi == oldy+1) Q_memcpy( resamplerow1, resamplerow2, outwidth4 );
|
||||
if (yi == oldy+1) memcpy( resamplerow1, resamplerow2, outwidth4 );
|
||||
else Image_Resample32LerpLine( inrow, resamplerow1, inwidth, outwidth );
|
||||
Image_Resample32LerpLine( inrow + inwidth4, resamplerow2, inwidth, outwidth );
|
||||
oldy = yi;
|
||||
|
@ -781,12 +781,12 @@ void Image_Resample32Lerp( const void *indata, int inwidth, int inheight, void *
|
|||
if( yi != oldy )
|
||||
{
|
||||
inrow = (byte *)indata + inwidth4*yi;
|
||||
if( yi == oldy + 1 ) Q_memcpy( resamplerow1, resamplerow2, outwidth4 );
|
||||
if( yi == oldy + 1 ) memcpy( resamplerow1, resamplerow2, outwidth4 );
|
||||
else Image_Resample32LerpLine( inrow, resamplerow1, inwidth, outwidth);
|
||||
oldy = yi;
|
||||
}
|
||||
|
||||
Q_memcpy( out, resamplerow1, outwidth4 );
|
||||
memcpy( out, resamplerow1, outwidth4 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -862,7 +862,7 @@ void Image_Resample24Lerp( const void *indata, int inwidth, int inheight, void *
|
|||
if( yi != oldy )
|
||||
{
|
||||
inrow = (byte *)indata + inwidth3 * yi;
|
||||
if( yi == oldy + 1) Q_memcpy( resamplerow1, resamplerow2, outwidth3 );
|
||||
if( yi == oldy + 1) memcpy( resamplerow1, resamplerow2, outwidth3 );
|
||||
else Image_Resample24LerpLine( inrow, resamplerow1, inwidth, outwidth );
|
||||
Image_Resample24LerpLine( inrow + inwidth3, resamplerow2, inwidth, outwidth );
|
||||
oldy = yi;
|
||||
|
@ -921,12 +921,12 @@ void Image_Resample24Lerp( const void *indata, int inwidth, int inheight, void *
|
|||
if( yi != oldy )
|
||||
{
|
||||
inrow = (byte *)indata + inwidth3*yi;
|
||||
if( yi == oldy + 1) Q_memcpy( resamplerow1, resamplerow2, outwidth3 );
|
||||
if( yi == oldy + 1) memcpy( resamplerow1, resamplerow2, outwidth3 );
|
||||
else Image_Resample24LerpLine( inrow, resamplerow1, inwidth, outwidth );
|
||||
oldy = yi;
|
||||
}
|
||||
|
||||
Q_memcpy( out, resamplerow1, outwidth3 );
|
||||
memcpy( out, resamplerow1, outwidth3 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1105,8 +1105,8 @@ byte *Image_FloodInternal( const byte *indata, int inwidth, int inheight, int ou
|
|||
return (byte *)indata;
|
||||
}
|
||||
|
||||
if( samples == 1 ) Q_memset( out, 0xFF, newsize ); // last palette color
|
||||
else Q_memset( out, 0x00808080, newsize ); // gray (alpha leaved 0x00)
|
||||
if( samples == 1 ) memset( out, 0xFF, newsize ); // last palette color
|
||||
else memset( out, 0x00808080, newsize ); // gray (alpha leaved 0x00)
|
||||
|
||||
for( y = 0; y < outheight; y++ )
|
||||
{
|
||||
|
@ -1262,7 +1262,7 @@ qboolean Image_AddIndexedImageToPack( const byte *in, int width, int height )
|
|||
|
||||
// reallocate image buffer
|
||||
image.rgba = Mem_Alloc( host.imagepool, image.size );
|
||||
if( !expand_to_rgba ) Q_memcpy( image.rgba, in, image.size );
|
||||
if( !expand_to_rgba ) memcpy( image.rgba, in, image.size );
|
||||
else if( !Image_Copy8bitRGBA( in, image.rgba, mipsize ))
|
||||
return false; // probably pallette not installed
|
||||
|
||||
|
@ -1333,7 +1333,7 @@ qboolean Image_Decompress( const byte *data )
|
|||
break;
|
||||
case PF_RGBA_32:
|
||||
// fast default case
|
||||
Q_memcpy( fout, fin, size );
|
||||
memcpy( fout, fin, size );
|
||||
break;
|
||||
default: return false;
|
||||
}
|
||||
|
@ -1359,7 +1359,7 @@ rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
|
|||
pic->type = PF_RGBA_32;
|
||||
|
||||
pic->buffer = Mem_Realloc( host.imagepool, pic->buffer, image.size );
|
||||
Q_memcpy( pic->buffer, image.tempbuffer, image.size );
|
||||
memcpy( pic->buffer, image.tempbuffer, image.size );
|
||||
if( pic->palette ) Mem_Free( pic->palette );
|
||||
pic->flags = image.flags;
|
||||
pic->palette = NULL;
|
||||
|
@ -1540,7 +1540,7 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
|
|||
}
|
||||
|
||||
// copy result back
|
||||
Q_memcpy( fin, fout, size );
|
||||
memcpy( fin, fout, size );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1569,7 +1569,7 @@ qboolean Image_Process( rgbdata_t **pix, int width, int height, float gamma, uin
|
|||
if( flags & IMAGE_MAKE_LUMA )
|
||||
{
|
||||
out = Image_CreateLumaInternal( pic->buffer, pic->width, pic->height, pic->type, pic->flags );
|
||||
if( pic->buffer != out ) Q_memcpy( pic->buffer, image.tempbuffer, pic->size );
|
||||
if( pic->buffer != out ) memcpy( pic->buffer, image.tempbuffer, pic->size );
|
||||
pic->flags &= ~IMAGE_HAS_LUMA;
|
||||
}
|
||||
|
||||
|
@ -1587,7 +1587,7 @@ qboolean Image_Process( rgbdata_t **pix, int width, int height, float gamma, uin
|
|||
if( filter ) Image_ApplyFilter( pic, filter->filter, filter->factor, filter->bias, filter->flags, filter->blendFunc );
|
||||
|
||||
out = Image_FlipInternal( pic->buffer, &pic->width, &pic->height, pic->type, flags );
|
||||
if( pic->buffer != out ) Q_memcpy( pic->buffer, image.tempbuffer, pic->size );
|
||||
if( pic->buffer != out ) memcpy( pic->buffer, image.tempbuffer, pic->size );
|
||||
|
||||
if(( flags & IMAGE_RESAMPLE && width > 0 && height > 0 ) || ( flags & IMAGE_ROUND ) || ( flags & IMAGE_ROUNDFILLER ))
|
||||
{
|
||||
|
|
|
@ -81,7 +81,7 @@ qboolean Image_LoadFNT( const char *name, const byte *buffer, size_t filesize )
|
|||
if( filesize < sizeof( font ))
|
||||
return false;
|
||||
|
||||
Q_memcpy( &font, buffer, sizeof( font ));
|
||||
memcpy( &font, buffer, sizeof( font ));
|
||||
|
||||
// last sixty four bytes - what the hell ????
|
||||
size = sizeof( qfont_t ) - 4 + ( font.height * font.width * QCHAR_WIDTH ) + sizeof( short ) + 768 + 64;
|
||||
|
@ -269,7 +269,7 @@ qboolean Image_LoadLMP( const char *name, const byte *buffer, size_t filesize )
|
|||
else
|
||||
{
|
||||
fin = (byte *)buffer;
|
||||
Q_memcpy( &lmp, fin, sizeof( lmp ));
|
||||
memcpy( &lmp, fin, sizeof( lmp ));
|
||||
image.width = lmp.width;
|
||||
image.height = lmp.height;
|
||||
rendermode = LUMP_NORMAL;
|
||||
|
@ -334,14 +334,14 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
|
|||
return false;
|
||||
}
|
||||
|
||||
Q_memcpy( &mip, buffer, sizeof( mip ));
|
||||
memcpy( &mip, buffer, sizeof( mip ));
|
||||
image.width = mip.width;
|
||||
image.height = mip.height;
|
||||
|
||||
if( !Image_ValidSize( name ))
|
||||
return false;
|
||||
|
||||
Q_memcpy( ofs, mip.offsets, sizeof( ofs ));
|
||||
memcpy( ofs, mip.offsets, sizeof( ofs ));
|
||||
pixels = image.width * image.height;
|
||||
|
||||
if( image.hint != IL_HINT_Q1 && filesize >= (int)sizeof(mip) + ((pixels * 85)>>6) + sizeof(short) + 768)
|
||||
|
|
|
@ -51,7 +51,7 @@ void Info_Print( const char *s )
|
|||
l = o - key;
|
||||
if( l < 20 )
|
||||
{
|
||||
Q_memset( o, ' ', 20 - l );
|
||||
memset( o, ' ', 20 - l );
|
||||
key[20] = 0;
|
||||
}
|
||||
else *o = 0;
|
||||
|
|
|
@ -46,18 +46,18 @@ keyname_t keynames[] =
|
|||
{"RIGHTARROW", K_RIGHTARROW, "+right" },
|
||||
{"ALT", K_ALT, "+strafe" },
|
||||
{"CTRL", K_CTRL, "+attack" },
|
||||
{"SHIFT", K_SHIFT, "+speed" }, // replace with +attack2 ?
|
||||
{"SHIFT", K_SHIFT, "+speed" },
|
||||
{"CAPSLOCK", K_CAPSLOCK, "" },
|
||||
{"F1", K_F1, "cmd help" },
|
||||
{"F2", K_F2, "menu_savegame" },
|
||||
{"F3", K_F3, "menu_loadgame" },
|
||||
{"F4", K_F4, "menu_keys" },
|
||||
{"F5", K_F5, "menu_startserver" },
|
||||
{"F4", K_F4, "menu_controls" },
|
||||
{"F5", K_F5, "menu_creategame" },
|
||||
{"F6", K_F6, "savequick" },
|
||||
{"F7", K_F7, "loadquick" },
|
||||
{"F8", K_F8, "stop" },
|
||||
{"F9", K_F9, "" },
|
||||
{"F10", K_F10, "menu_quit" },
|
||||
{"F10", K_F10, "menu_main" },
|
||||
{"F11", K_F11, "" },
|
||||
{"F12", K_F12, "screenshot" },
|
||||
{"INS", K_INS, "" },
|
||||
|
@ -556,8 +556,6 @@ void Key_Event( int key, qboolean down )
|
|||
// escape is always handled special
|
||||
if( key == K_ESCAPE && down )
|
||||
{
|
||||
kb = keys[key].binding;
|
||||
|
||||
switch( cls.key_dest )
|
||||
{
|
||||
case key_game:
|
||||
|
|
|
@ -70,7 +70,7 @@ static void CopySections( const byte *data, PIMAGE_NT_HEADERS old_headers, PMEMO
|
|||
{
|
||||
dest = (byte *)VirtualAlloc((byte *)CALCULATE_ADDRESS(codeBase, section->VirtualAddress), size, MEM_COMMIT, PAGE_READWRITE );
|
||||
section->Misc.PhysicalAddress = (DWORD)dest;
|
||||
Q_memset( dest, 0, size );
|
||||
memset( dest, 0, size );
|
||||
}
|
||||
// section is empty
|
||||
continue;
|
||||
|
@ -78,7 +78,7 @@ static void CopySections( const byte *data, PIMAGE_NT_HEADERS old_headers, PMEMO
|
|||
|
||||
// commit memory block and copy data from dll
|
||||
dest = (byte *)VirtualAlloc((byte *)CALCULATE_ADDRESS(codeBase, section->VirtualAddress), section->SizeOfRawData, MEM_COMMIT, PAGE_READWRITE );
|
||||
Q_memcpy( dest, (byte *)CALCULATE_ADDRESS(data, section->PointerToRawData), section->SizeOfRawData );
|
||||
memcpy( dest, (byte *)CALCULATE_ADDRESS(data, section->PointerToRawData), section->SizeOfRawData );
|
||||
section->Misc.PhysicalAddress = (DWORD)dest;
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ static void FinalizeSections( MEMORYMODULE *module )
|
|||
{
|
||||
// change memory access flags
|
||||
if( !VirtualProtect((LPVOID)section->Misc.PhysicalAddress, size, protect, &oldProtect ))
|
||||
Sys_Error( "Com_FinalizeSections: error protecting memory page\n" );
|
||||
Sys_Error( "FinalizeSections: error protecting memory page\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ void *MemoryLoadLibrary( const char *name )
|
|||
headers = (byte *)VirtualAlloc( code, old_header->OptionalHeader.SizeOfHeaders, MEM_COMMIT, PAGE_READWRITE );
|
||||
|
||||
// copy PE header to code
|
||||
Q_memcpy( headers, dos_header, dos_header->e_lfanew + old_header->OptionalHeader.SizeOfHeaders );
|
||||
memcpy( headers, dos_header, dos_header->e_lfanew + old_header->OptionalHeader.SizeOfHeaders );
|
||||
result->headers = (PIMAGE_NT_HEADERS)&((const byte *)(headers))[dos_header->e_lfanew];
|
||||
|
||||
// update position
|
||||
|
|
|
@ -144,7 +144,7 @@ float ApproachVal( float target, float value, float speed );
|
|||
// matrixlib.c
|
||||
//
|
||||
#define Matrix3x4_LoadIdentity( mat ) Matrix3x4_Copy( mat, matrix3x4_identity )
|
||||
#define Matrix3x4_Copy( out, in ) Q_memcpy( out, in, sizeof( matrix3x4 ))
|
||||
#define Matrix3x4_Copy( out, in ) memcpy( out, in, sizeof( matrix3x4 ))
|
||||
|
||||
void Matrix3x4_VectorTransform( const matrix3x4 in, const float v[3], float out[3] );
|
||||
void Matrix3x4_VectorITransform( const matrix3x4 in, const float v[3], float out[3] );
|
||||
|
@ -160,7 +160,7 @@ void Matrix3x4_OriginFromMatrix( const matrix3x4 in, float *out );
|
|||
void Matrix3x4_AnglesFromMatrix( const matrix3x4 in, vec3_t out );
|
||||
|
||||
#define Matrix4x4_LoadIdentity( mat ) Matrix4x4_Copy( mat, matrix4x4_identity )
|
||||
#define Matrix4x4_Copy( out, in ) Q_memcpy( out, in, sizeof( matrix4x4 ))
|
||||
#define Matrix4x4_Copy( out, in ) memcpy( out, in, sizeof( matrix4x4 ))
|
||||
|
||||
void Matrix4x4_VectorTransform( const matrix4x4 in, const float v[3], float out[3] );
|
||||
void Matrix4x4_VectorITransform( const matrix4x4 in, const float v[3], float out[3] );
|
||||
|
|
|
@ -104,7 +104,7 @@ ClearStudioCache
|
|||
*/
|
||||
void Mod_ClearStudioCache( void )
|
||||
{
|
||||
Q_memset( cache_studio, 0, sizeof( cache_studio ));
|
||||
memset( cache_studio, 0, sizeof( cache_studio ));
|
||||
cache_current_hull = cache_current_plane = 0;
|
||||
|
||||
cache_current = 0;
|
||||
|
@ -131,16 +131,16 @@ void Mod_AddToStudioCache( float frame, int sequence, vec3_t angles, vec3_t orig
|
|||
VectorCopy( origin, pCache->origin );
|
||||
VectorCopy( size, pCache->size );
|
||||
|
||||
Q_memcpy( pCache->controler, pcontroller, 4 );
|
||||
Q_memcpy( pCache->blending, pblending, 2 );
|
||||
memcpy( pCache->controler, pcontroller, 4 );
|
||||
memcpy( pCache->blending, pblending, 2 );
|
||||
|
||||
pCache->model = model;
|
||||
pCache->current_hull = cache_current_hull;
|
||||
pCache->current_plane = cache_current_plane;
|
||||
|
||||
Q_memcpy( &cache_hull[cache_current_hull], hull, numhitboxes * sizeof( hull_t ));
|
||||
Q_memcpy( &cache_planes[cache_current_plane], studio_planes, numhitboxes * sizeof( mplane_t ) * 6 );
|
||||
Q_memcpy( &cache_hull_hitgroup[cache_current_hull], studio_hull_hitgroup, numhitboxes * sizeof( uint ));
|
||||
memcpy( &cache_hull[cache_current_hull], hull, numhitboxes * sizeof( hull_t ));
|
||||
memcpy( &cache_planes[cache_current_plane], studio_planes, numhitboxes * sizeof( mplane_t ) * 6 );
|
||||
memcpy( &cache_hull_hitgroup[cache_current_hull], studio_hull_hitgroup, numhitboxes * sizeof( uint ));
|
||||
|
||||
cache_current_hull += numhitboxes;
|
||||
cache_current_plane += numhitboxes * 6;
|
||||
|
@ -163,7 +163,7 @@ mstudiocache_t *Mod_CheckStudioCache( model_t *model, float frame, int sequence,
|
|||
|
||||
if( pCache->model == model && pCache->frame == frame && pCache->sequence == sequence &&
|
||||
VectorCompare( angles, pCache->angles ) && VectorCompare( origin, pCache->origin ) && VectorCompare( size, pCache->size ) &&
|
||||
!Q_memcmp( pCache->controler, pcontroller, 4 ) && !Q_memcmp( pCache->blending, pblending, 2 ))
|
||||
!memcmp( pCache->controler, pcontroller, 4 ) && !memcmp( pCache->blending, pblending, 2 ))
|
||||
{
|
||||
return pCache;
|
||||
}
|
||||
|
@ -218,9 +218,9 @@ hull_t *Mod_HullForStudio( model_t *model, float frame, int sequence, vec3_t ang
|
|||
|
||||
if( bonecache != NULL )
|
||||
{
|
||||
Q_memcpy( studio_planes, &cache_planes[bonecache->current_plane], bonecache->numhitboxes * sizeof( mplane_t ) * 6 );
|
||||
Q_memcpy( studio_hull_hitgroup, &cache_hull_hitgroup[bonecache->current_hull], bonecache->numhitboxes * sizeof( uint ));
|
||||
Q_memcpy( studio_hull, &cache_hull[bonecache->current_hull], bonecache->numhitboxes * sizeof( hull_t ));
|
||||
memcpy( studio_planes, &cache_planes[bonecache->current_plane], bonecache->numhitboxes * sizeof( mplane_t ) * 6 );
|
||||
memcpy( studio_hull_hitgroup, &cache_hull_hitgroup[bonecache->current_hull], bonecache->numhitboxes * sizeof( uint ));
|
||||
memcpy( studio_hull, &cache_hull[bonecache->current_hull], bonecache->numhitboxes * sizeof( hull_t ));
|
||||
|
||||
*numhitboxes = bonecache->numhitboxes;
|
||||
return studio_hull;
|
||||
|
@ -623,7 +623,7 @@ static mstudioanim_t *Mod_StudioGetAnim( model_t *m_pSubModel, mstudioseqdesc_t
|
|||
MsgDev( D_INFO, "loading: %s\n", filepath );
|
||||
|
||||
paSequences[pseqdesc->seqgroup].data = Mem_Alloc( com_studiocache, filesize );
|
||||
Q_memcpy( paSequences[pseqdesc->seqgroup].data, buf, filesize );
|
||||
memcpy( paSequences[pseqdesc->seqgroup].data, buf, filesize );
|
||||
Mem_Free( buf );
|
||||
}
|
||||
return (mstudioanim_t *)((byte *)paSequences[pseqdesc->seqgroup].data + pseqdesc->animindex);
|
||||
|
|
|
@ -198,8 +198,8 @@ Mod_SetupHulls
|
|||
*/
|
||||
void Mod_SetupHulls( vec3_t mins[MAX_MAP_HULLS], vec3_t maxs[MAX_MAP_HULLS] )
|
||||
{
|
||||
Q_memcpy( mins, cm_hullmins, sizeof( cm_hullmins ));
|
||||
Q_memcpy( maxs, cm_hullmaxs, sizeof( cm_hullmaxs ));
|
||||
memcpy( mins, cm_hullmins, sizeof( cm_hullmins ));
|
||||
memcpy( maxs, cm_hullmaxs, sizeof( cm_hullmaxs ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -931,8 +931,8 @@ static void Mod_LoadTextures( const dlump_t *l )
|
|||
continue; // allready sequenced
|
||||
|
||||
// find the number of frames in the animation
|
||||
Q_memset( anims, 0, sizeof( anims ));
|
||||
Q_memset( altanims, 0, sizeof( altanims ));
|
||||
memset( anims, 0, sizeof( anims ));
|
||||
memset( altanims, 0, sizeof( altanims ));
|
||||
|
||||
max = tx->name[1];
|
||||
altmax = 0;
|
||||
|
@ -1016,7 +1016,7 @@ static void Mod_LoadTextures( const dlump_t *l )
|
|||
continue; // allready sequenced
|
||||
|
||||
// find the number of frames in the sequence
|
||||
Q_memset( anims, 0, sizeof( anims ));
|
||||
memset( anims, 0, sizeof( anims ));
|
||||
|
||||
max = tx->name[1];
|
||||
|
||||
|
@ -1169,7 +1169,7 @@ static void Mod_LoadDeluxemap( void )
|
|||
|
||||
MsgDev( D_INFO, "Mod_LoadDeluxemap: %s loaded\n", path );
|
||||
world.deluxedata = Mem_Alloc( loadmodel->mempool, world.vecdatasize );
|
||||
Q_memcpy( world.deluxedata, in + 8, world.vecdatasize );
|
||||
memcpy( world.deluxedata, in + 8, world.vecdatasize );
|
||||
Mem_Free( in );
|
||||
}
|
||||
|
||||
|
@ -1218,7 +1218,7 @@ static void Mod_LoadLighting( const dlump_t *l )
|
|||
case XTBSP_VERSION:
|
||||
// load colored lighting
|
||||
loadmodel->lightdata = Mem_Alloc( loadmodel->mempool, l->filelen );
|
||||
Q_memcpy( loadmodel->lightdata, in, l->filelen );
|
||||
memcpy( loadmodel->lightdata, in, l->filelen );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1396,7 +1396,7 @@ static void Mod_BuildPolygon( mextrasurf_t *info, msurface_t *surf, int numVerts
|
|||
out->lmcoord[1] = t;
|
||||
|
||||
// clear colors (it can be used for vertex lighting)
|
||||
Q_memset( out->color, 0xFF, sizeof( out->color ));
|
||||
memset( out->color, 0xFF, sizeof( out->color ));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1572,7 +1572,7 @@ static void Mod_SubdividePolygon( mextrasurf_t *info, msurface_t *surf, int numV
|
|||
totalLM[1] += t;
|
||||
|
||||
// clear colors (it can be used for vertex lighting)
|
||||
Q_memset( out->color, 0xFF, sizeof( out->color ));
|
||||
memset( out->color, 0xFF, sizeof( out->color ));
|
||||
}
|
||||
|
||||
// vertex
|
||||
|
@ -1596,7 +1596,7 @@ static void Mod_SubdividePolygon( mextrasurf_t *info, msurface_t *surf, int numV
|
|||
mesh->verts[0].lmcoord[1] = totalLM[1] * oneDivVerts;
|
||||
|
||||
// copy first vertex to last
|
||||
Q_memcpy( &mesh->verts[i+1], &mesh->verts[1], sizeof( glvert_t ));
|
||||
memcpy( &mesh->verts[i+1], &mesh->verts[1], sizeof( glvert_t ));
|
||||
|
||||
mesh->next = info->mesh;
|
||||
mesh->surf = surf; // NOTE: meshchains can be linked with one surface
|
||||
|
@ -1668,7 +1668,7 @@ static void Mod_ConvertSurface( mextrasurf_t *info, msurface_t *surf )
|
|||
outElems[i*3+2] = numVerts + i + 2;
|
||||
}
|
||||
|
||||
Q_memcpy( outVerts, poly->verts, sizeof( glvert_t ) * poly->numVerts );
|
||||
memcpy( outVerts, poly->verts, sizeof( glvert_t ) * poly->numVerts );
|
||||
|
||||
numElems += (poly->numVerts - 2) * 3;
|
||||
numVerts += poly->numVerts;
|
||||
|
@ -1986,7 +1986,7 @@ static void Mod_LoadSurfEdges( const dlump_t *l )
|
|||
loadmodel->surfedges = Mem_Alloc( loadmodel->mempool, count * sizeof( dsurfedge_t ));
|
||||
loadmodel->numsurfedges = count;
|
||||
|
||||
Q_memcpy( loadmodel->surfedges, in, count * sizeof( dsurfedge_t ));
|
||||
memcpy( loadmodel->surfedges, in, count * sizeof( dsurfedge_t ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2186,7 +2186,7 @@ static void Mod_LoadVisibility( const dlump_t *l )
|
|||
}
|
||||
|
||||
loadmodel->visdata = Mem_Alloc( loadmodel->mempool, l->filelen );
|
||||
Q_memcpy( loadmodel->visdata, (void *)(mod_base + l->fileofs), l->filelen );
|
||||
memcpy( loadmodel->visdata, (void *)(mod_base + l->fileofs), l->filelen );
|
||||
world.visdatasize = l->filelen; // save it for PHS allocation
|
||||
}
|
||||
|
||||
|
@ -2204,7 +2204,7 @@ static void Mod_LoadEntities( const dlump_t *l )
|
|||
|
||||
// make sure what we really has terminator
|
||||
loadmodel->entities = Mem_Alloc( loadmodel->mempool, l->filelen + 1 );
|
||||
Q_memcpy( loadmodel->entities, mod_base + l->fileofs, l->filelen );
|
||||
memcpy( loadmodel->entities, mod_base + l->fileofs, l->filelen );
|
||||
if( !world.loading ) return;
|
||||
|
||||
world.entdatasize = l->filelen;
|
||||
|
@ -2545,7 +2545,7 @@ void Mod_CalcPHS( void )
|
|||
// uncompress pvs first
|
||||
for( i = 0; i < num; i++, scan += rowbytes )
|
||||
{
|
||||
Q_memcpy( scan, Mod_LeafPVS( worldmodel->leafs + i, worldmodel ), rowbytes );
|
||||
memcpy( scan, Mod_LeafPVS( worldmodel->leafs + i, worldmodel ), rowbytes );
|
||||
if( i == 0 ) continue;
|
||||
|
||||
for( j = 0; j < num; j++ )
|
||||
|
@ -2562,7 +2562,7 @@ void Mod_CalcPHS( void )
|
|||
|
||||
for( i = 0; i < num; i++, dest += rowwords, scan += rowbytes )
|
||||
{
|
||||
Q_memcpy( dest, scan, rowbytes );
|
||||
memcpy( dest, scan, rowbytes );
|
||||
|
||||
for( j = 0; j < rowbytes; j++ )
|
||||
{
|
||||
|
@ -2594,7 +2594,7 @@ void Mod_CalcPHS( void )
|
|||
Host_Error( "CalcPHS: vismap expansion overflow %s > %s\n", Q_memprint( total_size ), Q_memprint( phsdatasize ));
|
||||
}
|
||||
|
||||
Q_memcpy( vismap_p, comp, rowsize );
|
||||
memcpy( vismap_p, comp, rowsize );
|
||||
vismap_p += rowsize; // move pointer
|
||||
|
||||
if( i == 0 ) continue;
|
||||
|
@ -2656,7 +2656,7 @@ void Mod_UnloadBrushModel( model_t *mod )
|
|||
Mem_FreePool( &mod->mempool );
|
||||
}
|
||||
|
||||
Q_memset( mod, 0, sizeof( *mod ));
|
||||
memset( mod, 0, sizeof( *mod ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2920,7 +2920,7 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
|
|||
|
||||
if( !buf )
|
||||
{
|
||||
Q_memset( mod, 0, sizeof( model_t ));
|
||||
memset( mod, 0, sizeof( model_t ));
|
||||
|
||||
if( crash ) Host_Error( "Mod_ForName: %s couldn't load\n", tempname );
|
||||
else MsgDev( D_ERROR, "Mod_ForName: %s couldn't load\n", tempname );
|
||||
|
@ -3004,7 +3004,7 @@ void Mod_LoadWorld( const char *name, uint *checksum, qboolean multiplayer )
|
|||
int i;
|
||||
|
||||
// now replacement table is invalidate
|
||||
Q_memset( com_models, 0, sizeof( com_models ));
|
||||
memset( com_models, 0, sizeof( com_models ));
|
||||
|
||||
com_models[1] = cm_models; // make link to world
|
||||
|
||||
|
@ -3187,7 +3187,7 @@ void Mod_LoadCacheFile( const char *filename, cache_user_t *cu )
|
|||
buf = FS_LoadFile( name, &size, false );
|
||||
if( !buf || !size ) Host_Error( "LoadCacheFile: ^1can't load %s^7\n", filename );
|
||||
cu->data = Mem_Alloc( com_studiocache, size );
|
||||
Q_memcpy( cu->data, buf, size );
|
||||
memcpy( cu->data, buf, size );
|
||||
Mem_Free( buf );
|
||||
}
|
||||
|
||||
|
|
|
@ -26,15 +26,7 @@ static dword ExtraMasks[32];
|
|||
|
||||
short MSG_BigShort( short swap )
|
||||
{
|
||||
short *s = &swap;
|
||||
|
||||
__asm {
|
||||
mov ebx, s
|
||||
mov al, [ebx+1]
|
||||
mov ah, [ebx ]
|
||||
mov [ebx], ax
|
||||
}
|
||||
return *s;
|
||||
return (swap >> 8)|(swap << 8);
|
||||
}
|
||||
|
||||
void MSG_InitMasks( void )
|
||||
|
@ -57,32 +49,32 @@ void MSG_InitMasks( void )
|
|||
ExtraMasks[maskBit] = (uint)BIT( maskBit ) - 1;
|
||||
}
|
||||
|
||||
void MSG_InitExt( sizebuf_t *bf, const char *pDebugName, void *pData, int nBytes, int nMaxBits )
|
||||
void MSG_InitExt( sizebuf_t *sb, const char *pDebugName, void *pData, int nBytes, int nMaxBits )
|
||||
{
|
||||
bf->pDebugName = pDebugName;
|
||||
sb->pDebugName = pDebugName;
|
||||
|
||||
MSG_StartWriting( bf, pData, nBytes, 0, nMaxBits );
|
||||
MSG_StartWriting( sb, pData, nBytes, 0, nMaxBits );
|
||||
}
|
||||
|
||||
void MSG_StartWriting( sizebuf_t *bf, void *pData, int nBytes, int iStartBit, int nBits )
|
||||
void MSG_StartWriting( sizebuf_t *sb, void *pData, int nBytes, int iStartBit, int nBits )
|
||||
{
|
||||
// make sure it's dword aligned and padded.
|
||||
Assert(((dword)pData & 3 ) == 0 );
|
||||
|
||||
bf->pData = (byte *)pData;
|
||||
sb->pData = (byte *)pData;
|
||||
|
||||
if( nBits == -1 )
|
||||
{
|
||||
bf->nDataBits = nBytes << 3;
|
||||
sb->nDataBits = nBytes << 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert( nBits <= nBytes * 8 );
|
||||
bf->nDataBits = nBits;
|
||||
sb->nDataBits = nBits;
|
||||
}
|
||||
|
||||
bf->iCurBit = iStartBit;
|
||||
bf->bOverflow = false;
|
||||
sb->iCurBit = iStartBit;
|
||||
sb->bOverflow = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -92,70 +84,68 @@ MSG_Clear
|
|||
for clearing overflowed buffer
|
||||
=======================
|
||||
*/
|
||||
void MSG_Clear( sizebuf_t *bf )
|
||||
void MSG_Clear( sizebuf_t *sb )
|
||||
{
|
||||
bf->iCurBit = 0;
|
||||
bf->bOverflow = false;
|
||||
sb->iCurBit = 0;
|
||||
sb->bOverflow = false;
|
||||
}
|
||||
|
||||
static qboolean MSG_Overflow( sizebuf_t *bf, int nBits )
|
||||
static qboolean MSG_Overflow( sizebuf_t *sb, int nBits )
|
||||
{
|
||||
if( bf->iCurBit + nBits > bf->nDataBits )
|
||||
bf->bOverflow = true;
|
||||
return bf->bOverflow;
|
||||
if( sb->iCurBit + nBits > sb->nDataBits )
|
||||
sb->bOverflow = true;
|
||||
return sb->bOverflow;
|
||||
}
|
||||
|
||||
qboolean MSG_CheckOverflow( sizebuf_t *bf )
|
||||
qboolean MSG_CheckOverflow( sizebuf_t *sb )
|
||||
{
|
||||
ASSERT( bf );
|
||||
|
||||
return MSG_Overflow( bf, 0 );
|
||||
return MSG_Overflow( sb, 0 );
|
||||
}
|
||||
|
||||
void MSG_SeekToBit( sizebuf_t *bf, int bitPos )
|
||||
void MSG_SeekToBit( sizebuf_t *sb, int bitPos )
|
||||
{
|
||||
bf->iCurBit = bitPos;
|
||||
sb->iCurBit = bitPos;
|
||||
}
|
||||
|
||||
void MSG_SeekToByte( sizebuf_t *bf, int bytePos )
|
||||
void MSG_SeekToByte( sizebuf_t *sb, int bytePos )
|
||||
{
|
||||
bf->iCurBit = bytePos << 3;
|
||||
sb->iCurBit = bytePos << 3;
|
||||
}
|
||||
|
||||
void MSG_WriteOneBit( sizebuf_t *bf, int nValue )
|
||||
void MSG_WriteOneBit( sizebuf_t *sb, int nValue )
|
||||
{
|
||||
if( !MSG_Overflow( bf, 1 ))
|
||||
if( !MSG_Overflow( sb, 1 ))
|
||||
{
|
||||
if( nValue ) bf->pData[bf->iCurBit>>3] |= BIT( bf->iCurBit & 7 );
|
||||
else bf->pData[bf->iCurBit>>3] &= ~BIT( bf->iCurBit & 7 );
|
||||
if( nValue ) sb->pData[sb->iCurBit>>3] |= BIT( sb->iCurBit & 7 );
|
||||
else sb->pData[sb->iCurBit>>3] &= ~BIT( sb->iCurBit & 7 );
|
||||
|
||||
bf->iCurBit++;
|
||||
sb->iCurBit++;
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, qboolean bCheckRange )
|
||||
void MSG_WriteUBitLong( sizebuf_t *sb, uint curData, int numbits )
|
||||
{
|
||||
Assert( numbits >= 0 && numbits <= 32 );
|
||||
|
||||
// bounds checking..
|
||||
if(( bf->iCurBit + numbits ) > bf->nDataBits )
|
||||
if(( sb->iCurBit + numbits ) > sb->nDataBits )
|
||||
{
|
||||
bf->bOverflow = true;
|
||||
bf->iCurBit = bf->nDataBits;
|
||||
sb->bOverflow = true;
|
||||
sb->iCurBit = sb->nDataBits;
|
||||
}
|
||||
else
|
||||
{
|
||||
int nBitsLeft = numbits;
|
||||
int iCurBit = bf->iCurBit;
|
||||
int iCurBit = sb->iCurBit;
|
||||
uint iDWord = iCurBit >> 5; // Mask in a dword.
|
||||
dword iCurBitMasked;
|
||||
int nBitsWritten;
|
||||
|
||||
Assert(( iDWord * 4 + sizeof( long )) <= (uint)MSG_GetMaxBytes( bf ));
|
||||
Assert(( iDWord * 4 + sizeof( long )) <= (uint)MSG_GetMaxBytes( sb ));
|
||||
|
||||
iCurBitMasked = iCurBit & 31;
|
||||
((dword *)bf->pData)[iDWord] &= BitWriteMasks[iCurBitMasked][nBitsLeft];
|
||||
((dword *)bf->pData)[iDWord] |= curData << iCurBitMasked;
|
||||
((dword *)sb->pData)[iDWord] &= BitWriteMasks[iCurBitMasked][nBitsLeft];
|
||||
((dword *)sb->pData)[iDWord] |= curData << iCurBitMasked;
|
||||
|
||||
// did it span a dword?
|
||||
nBitsWritten = 32 - iCurBitMasked;
|
||||
|
@ -167,10 +157,10 @@ void MSG_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, qboolean bC
|
|||
curData >>= nBitsWritten;
|
||||
|
||||
iCurBitMasked = iCurBit & 31;
|
||||
((dword *)bf->pData)[iDWord+1] &= BitWriteMasks[iCurBitMasked][nBitsLeft];
|
||||
((dword *)bf->pData)[iDWord+1] |= curData << iCurBitMasked;
|
||||
((dword *)sb->pData)[iDWord+1] &= BitWriteMasks[iCurBitMasked][nBitsLeft];
|
||||
((dword *)sb->pData)[iDWord+1] |= curData << iCurBitMasked;
|
||||
}
|
||||
bf->iCurBit += numbits;
|
||||
sb->iCurBit += numbits;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,33 +171,33 @@ MSG_WriteSBitLong
|
|||
sign bit comes first
|
||||
=======================
|
||||
*/
|
||||
void MSG_WriteSBitLong( sizebuf_t *bf, int data, int numbits )
|
||||
void MSG_WriteSBitLong( sizebuf_t *sb, int data, int numbits )
|
||||
{
|
||||
// do we have a valid # of bits to encode with?
|
||||
Assert( numbits >= 1 );
|
||||
Assert( numbits >= 1 && numbits <= 32 );
|
||||
|
||||
// NOTE: it does this wierdness here so it's bit-compatible with regular integer data in the buffer.
|
||||
// (Some old code writes direct integers right into the buffer).
|
||||
if( data < 0 )
|
||||
{
|
||||
MSG_WriteUBitLongExt( bf, (uint)( 0x80000000 + data ), numbits - 1, false );
|
||||
MSG_WriteOneBit( bf, 1 );
|
||||
MSG_WriteUBitLong( sb, (uint)( 0x80000000 + data ), numbits - 1 );
|
||||
MSG_WriteOneBit( sb, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
MSG_WriteUBitLong( bf, (uint)data, numbits - 1 );
|
||||
MSG_WriteOneBit( bf, 0 );
|
||||
MSG_WriteUBitLong( sb, (uint)data, numbits - 1 );
|
||||
MSG_WriteOneBit( sb, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_WriteBitLong( sizebuf_t *bf, uint data, int numbits, qboolean bSigned )
|
||||
void MSG_WriteBitLong( sizebuf_t *sb, uint data, int numbits, qboolean bSigned )
|
||||
{
|
||||
if( bSigned )
|
||||
MSG_WriteSBitLong( bf, (int)data, numbits );
|
||||
else MSG_WriteUBitLong( bf, data, numbits );
|
||||
MSG_WriteSBitLong( sb, (int)data, numbits );
|
||||
else MSG_WriteUBitLong( sb, data, numbits );
|
||||
}
|
||||
|
||||
qboolean MSG_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
|
||||
qboolean MSG_WriteBits( sizebuf_t *sb, const void *pData, int nBits )
|
||||
{
|
||||
byte *pOut = (byte *)pData;
|
||||
int nBitsLeft = nBits;
|
||||
|
@ -215,7 +205,7 @@ qboolean MSG_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
|
|||
// get output dword-aligned.
|
||||
while((( dword )pOut & 3 ) != 0 && nBitsLeft >= 8 )
|
||||
{
|
||||
MSG_WriteUBitLongExt( bf, *pOut, 8, false );
|
||||
MSG_WriteUBitLong( sb, *pOut, 8 );
|
||||
|
||||
nBitsLeft -= 8;
|
||||
++pOut;
|
||||
|
@ -224,7 +214,7 @@ qboolean MSG_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
|
|||
// read dwords.
|
||||
while( nBitsLeft >= 32 )
|
||||
{
|
||||
MSG_WriteUBitLongExt( bf, *(( dword *)pOut ), 32, false );
|
||||
MSG_WriteUBitLong( sb, *(( dword *)pOut ), 32 );
|
||||
|
||||
pOut += sizeof( dword );
|
||||
nBitsLeft -= 32;
|
||||
|
@ -233,7 +223,7 @@ qboolean MSG_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
|
|||
// read the remaining bytes.
|
||||
while( nBitsLeft >= 8 )
|
||||
{
|
||||
MSG_WriteUBitLongExt( bf, *pOut, 8, false );
|
||||
MSG_WriteUBitLong( sb, *pOut, 8 );
|
||||
|
||||
nBitsLeft -= 8;
|
||||
++pOut;
|
||||
|
@ -242,13 +232,13 @@ qboolean MSG_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
|
|||
// Read the remaining bits.
|
||||
if( nBitsLeft )
|
||||
{
|
||||
MSG_WriteUBitLongExt( bf, *pOut, nBitsLeft, false );
|
||||
MSG_WriteUBitLong( sb, *pOut, nBitsLeft );
|
||||
}
|
||||
|
||||
return !bf->bOverflow;
|
||||
return !sb->bOverflow;
|
||||
}
|
||||
|
||||
void MSG_WriteBitAngle( sizebuf_t *bf, float fAngle, int numbits )
|
||||
void MSG_WriteBitAngle( sizebuf_t *sb, float fAngle, int numbits )
|
||||
{
|
||||
uint mask, shift;
|
||||
int d;
|
||||
|
@ -263,25 +253,25 @@ void MSG_WriteBitAngle( sizebuf_t *bf, float fAngle, int numbits )
|
|||
d = (int)(( fAngle * shift ) / 360.0f );
|
||||
d &= mask;
|
||||
|
||||
MSG_WriteUBitLong( bf, (uint)d, numbits );
|
||||
MSG_WriteUBitLong( sb, (uint)d, numbits );
|
||||
}
|
||||
|
||||
void MSG_WriteCoord( sizebuf_t *bf, float val )
|
||||
void MSG_WriteCoord( sizebuf_t *sb, float val )
|
||||
{
|
||||
// g-cont. we loose precision here but keep old size of coord variable!
|
||||
if( host.features & ENGINE_WRITE_LARGE_COORD )
|
||||
MSG_WriteShort( bf, (int)( val * 2.0f ));
|
||||
else MSG_WriteShort( bf, (int)( val * 8.0f ));
|
||||
if( FBitSet( host.features, ENGINE_WRITE_LARGE_COORD ))
|
||||
MSG_WriteShort( sb, (int)( val * 2.0f ));
|
||||
else MSG_WriteShort( sb, (int)( val * 8.0f ));
|
||||
}
|
||||
|
||||
void MSG_WriteVec3Coord( sizebuf_t *bf, const float *fa )
|
||||
void MSG_WriteVec3Coord( sizebuf_t *sb, const float *fa )
|
||||
{
|
||||
MSG_WriteCoord( bf, fa[0] );
|
||||
MSG_WriteCoord( bf, fa[1] );
|
||||
MSG_WriteCoord( bf, fa[2] );
|
||||
MSG_WriteCoord( sb, fa[0] );
|
||||
MSG_WriteCoord( sb, fa[1] );
|
||||
MSG_WriteCoord( sb, fa[2] );
|
||||
}
|
||||
|
||||
void MSG_WriteBitFloat( sizebuf_t *bf, float val )
|
||||
void MSG_WriteBitFloat( sizebuf_t *sb, float val )
|
||||
{
|
||||
long intVal;
|
||||
|
||||
|
@ -289,110 +279,115 @@ void MSG_WriteBitFloat( sizebuf_t *bf, float val )
|
|||
ASSERT( sizeof( float ) == 4 );
|
||||
|
||||
intVal = *((long *)&val );
|
||||
MSG_WriteUBitLong( bf, intVal, 32 );
|
||||
MSG_WriteUBitLong( sb, intVal, 32 );
|
||||
}
|
||||
|
||||
void MSG_WriteChar( sizebuf_t *bf, int val )
|
||||
void MSG_WriteChar( sizebuf_t *sb, int val )
|
||||
{
|
||||
MSG_WriteSBitLong( bf, val, sizeof( char ) << 3 );
|
||||
MSG_WriteSBitLong( sb, val, sizeof( char ) << 3 );
|
||||
}
|
||||
|
||||
void MSG_WriteByte( sizebuf_t *bf, int val )
|
||||
void MSG_WriteByte( sizebuf_t *sb, int val )
|
||||
{
|
||||
MSG_WriteUBitLong( bf, val, sizeof( byte ) << 3 );
|
||||
MSG_WriteUBitLong( sb, val, sizeof( byte ) << 3 );
|
||||
}
|
||||
|
||||
void MSG_WriteShort( sizebuf_t *bf, int val )
|
||||
void MSG_WriteShort( sizebuf_t *sb, int val )
|
||||
{
|
||||
MSG_WriteSBitLong( bf, val, sizeof(short ) << 3 );
|
||||
MSG_WriteSBitLong( sb, val, sizeof(short ) << 3 );
|
||||
}
|
||||
|
||||
void MSG_WriteWord( sizebuf_t *bf, int val )
|
||||
void MSG_WriteWord( sizebuf_t *sb, int val )
|
||||
{
|
||||
MSG_WriteUBitLong( bf, val, sizeof( word ) << 3 );
|
||||
MSG_WriteUBitLong( sb, val, sizeof( word ) << 3 );
|
||||
}
|
||||
|
||||
void MSG_WriteLong( sizebuf_t *bf, long val )
|
||||
void MSG_WriteLong( sizebuf_t *sb, long val )
|
||||
{
|
||||
MSG_WriteSBitLong( bf, val, sizeof( long ) << 3 );
|
||||
MSG_WriteSBitLong( sb, val, sizeof( long ) << 3 );
|
||||
}
|
||||
|
||||
void MSG_WriteFloat( sizebuf_t *bf, float val )
|
||||
void MSG_WriteDword( sizebuf_t *sb, dword val )
|
||||
{
|
||||
MSG_WriteBits( bf, &val, sizeof( val ) << 3 );
|
||||
MSG_WriteUBitLong( sb, val, sizeof( dword ) << 3 );
|
||||
}
|
||||
|
||||
qboolean MSG_WriteBytes( sizebuf_t *bf, const void *pBuf, int nBytes )
|
||||
void MSG_WriteFloat( sizebuf_t *sb, float val )
|
||||
{
|
||||
return MSG_WriteBits( bf, pBuf, nBytes << 3 );
|
||||
MSG_WriteBits( sb, &val, sizeof( val ) << 3 );
|
||||
}
|
||||
|
||||
qboolean MSG_WriteString( sizebuf_t *bf, const char *pStr )
|
||||
qboolean MSG_WriteBytes( sizebuf_t *sb, const void *pBuf, int nBytes )
|
||||
{
|
||||
return MSG_WriteBits( sb, pBuf, nBytes << 3 );
|
||||
}
|
||||
|
||||
qboolean MSG_WriteString( sizebuf_t *sb, const char *pStr )
|
||||
{
|
||||
if( pStr )
|
||||
{
|
||||
do
|
||||
{
|
||||
MSG_WriteChar( bf, *pStr );
|
||||
MSG_WriteChar( sb, *pStr );
|
||||
pStr++;
|
||||
} while( *( pStr - 1 ));
|
||||
}
|
||||
else MSG_WriteChar( bf, 0 );
|
||||
else MSG_WriteChar( sb, 0 );
|
||||
|
||||
return !bf->bOverflow;
|
||||
return !sb->bOverflow;
|
||||
}
|
||||
|
||||
int MSG_ReadOneBit( sizebuf_t *bf )
|
||||
int MSG_ReadOneBit( sizebuf_t *sb )
|
||||
{
|
||||
if( !MSG_Overflow( bf, 1 ))
|
||||
if( !MSG_Overflow( sb, 1 ))
|
||||
{
|
||||
int value = bf->pData[bf->iCurBit >> 3] & (1 << ( bf->iCurBit & 7 ));
|
||||
bf->iCurBit++;
|
||||
int value = sb->pData[sb->iCurBit >> 3] & (1 << ( sb->iCurBit & 7 ));
|
||||
sb->iCurBit++;
|
||||
return !!value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint MSG_ReadUBitLong( sizebuf_t *bf, int numbits )
|
||||
uint MSG_ReadUBitLong( sizebuf_t *sb, int numbits )
|
||||
{
|
||||
int idword1;
|
||||
uint dword1, ret;
|
||||
|
||||
if( numbits == 8 )
|
||||
{
|
||||
int leftBits = MSG_GetNumBitsLeft( bf );
|
||||
int leftBits = MSG_GetNumBitsLeft( sb );
|
||||
|
||||
if( leftBits >= 0 && leftBits < 8 )
|
||||
return 0; // end of message
|
||||
}
|
||||
|
||||
if(( bf->iCurBit + numbits ) > bf->nDataBits )
|
||||
if(( sb->iCurBit + numbits ) > sb->nDataBits )
|
||||
{
|
||||
bf->bOverflow = true;
|
||||
bf->iCurBit = bf->nDataBits;
|
||||
sb->bOverflow = true;
|
||||
sb->iCurBit = sb->nDataBits;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ASSERT( numbits > 0 && numbits <= 32 );
|
||||
|
||||
// Read the current dword.
|
||||
idword1 = bf->iCurBit >> 5;
|
||||
dword1 = ((uint *)bf->pData)[idword1];
|
||||
dword1 >>= ( bf->iCurBit & 31 ); // get the bits we're interested in.
|
||||
idword1 = sb->iCurBit >> 5;
|
||||
dword1 = ((uint *)sb->pData)[idword1];
|
||||
dword1 >>= ( sb->iCurBit & 31 ); // get the bits we're interested in.
|
||||
|
||||
bf->iCurBit += numbits;
|
||||
sb->iCurBit += numbits;
|
||||
ret = dword1;
|
||||
|
||||
// Does it span this dword?
|
||||
if(( bf->iCurBit - 1 ) >> 5 == idword1 )
|
||||
if(( sb->iCurBit - 1 ) >> 5 == idword1 )
|
||||
{
|
||||
if( numbits != 32 )
|
||||
ret &= ExtraMasks[numbits];
|
||||
}
|
||||
else
|
||||
{
|
||||
int nExtraBits = bf->iCurBit & 31;
|
||||
uint dword2 = ((uint *)bf->pData)[idword1+1] & ExtraMasks[nExtraBits];
|
||||
int nExtraBits = sb->iCurBit & 31;
|
||||
uint dword2 = ((uint *)sb->pData)[idword1+1] & ExtraMasks[nExtraBits];
|
||||
|
||||
// no need to mask since we hit the end of the dword.
|
||||
// shift the second dword's part into the high bits.
|
||||
|
@ -401,7 +396,7 @@ uint MSG_ReadUBitLong( sizebuf_t *bf, int numbits )
|
|||
return ret;
|
||||
}
|
||||
|
||||
float MSG_ReadBitFloat( sizebuf_t *bf )
|
||||
float MSG_ReadBitFloat( sizebuf_t *sb )
|
||||
{
|
||||
long val;
|
||||
int bit, byte;
|
||||
|
@ -409,25 +404,25 @@ float MSG_ReadBitFloat( sizebuf_t *bf )
|
|||
ASSERT( sizeof( float ) == sizeof( long ));
|
||||
ASSERT( sizeof( float ) == 4 );
|
||||
|
||||
if( MSG_Overflow( bf, 32 ))
|
||||
if( MSG_Overflow( sb, 32 ))
|
||||
return 0.0f;
|
||||
|
||||
bit = bf->iCurBit & 0x7;
|
||||
byte = bf->iCurBit >> 3;
|
||||
bit = sb->iCurBit & 0x7;
|
||||
byte = sb->iCurBit >> 3;
|
||||
|
||||
val = bf->pData[byte] >> bit;
|
||||
val |= ((int)bf->pData[byte + 1]) << ( 8 - bit );
|
||||
val |= ((int)bf->pData[byte + 2]) << ( 16 - bit );
|
||||
val |= ((int)bf->pData[byte + 3]) << ( 24 - bit );
|
||||
val = sb->pData[byte] >> bit;
|
||||
val |= ((int)sb->pData[byte + 1]) << ( 8 - bit );
|
||||
val |= ((int)sb->pData[byte + 2]) << ( 16 - bit );
|
||||
val |= ((int)sb->pData[byte + 3]) << ( 24 - bit );
|
||||
|
||||
if( bit != 0 )
|
||||
val |= ((int)bf->pData[byte + 4]) << ( 32 - bit );
|
||||
bf->iCurBit += 32;
|
||||
val |= ((int)sb->pData[byte + 4]) << ( 32 - bit );
|
||||
sb->iCurBit += 32;
|
||||
|
||||
return *((float *)&val);
|
||||
}
|
||||
|
||||
qboolean MSG_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
|
||||
qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits )
|
||||
{
|
||||
byte *pOut = (byte *)pOutData;
|
||||
int nBitsLeft = nBits;
|
||||
|
@ -435,7 +430,7 @@ qboolean MSG_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
|
|||
// get output dword-aligned.
|
||||
while((( dword )pOut & 3) != 0 && nBitsLeft >= 8 )
|
||||
{
|
||||
*pOut = (byte)MSG_ReadUBitLong( bf, 8 );
|
||||
*pOut = (byte)MSG_ReadUBitLong( sb, 8 );
|
||||
++pOut;
|
||||
nBitsLeft -= 8;
|
||||
}
|
||||
|
@ -443,7 +438,7 @@ qboolean MSG_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
|
|||
// read dwords.
|
||||
while( nBitsLeft >= 32 )
|
||||
{
|
||||
*((dword *)pOut) = MSG_ReadUBitLong( bf, 32 );
|
||||
*((dword *)pOut) = MSG_ReadUBitLong( sb, 32 );
|
||||
pOut += sizeof( dword );
|
||||
nBitsLeft -= 32;
|
||||
}
|
||||
|
@ -451,7 +446,7 @@ qboolean MSG_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
|
|||
// read the remaining bytes.
|
||||
while( nBitsLeft >= 8 )
|
||||
{
|
||||
*pOut = MSG_ReadUBitLong( bf, 8 );
|
||||
*pOut = MSG_ReadUBitLong( sb, 8 );
|
||||
++pOut;
|
||||
nBitsLeft -= 8;
|
||||
}
|
||||
|
@ -459,20 +454,20 @@ qboolean MSG_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
|
|||
// read the remaining bits.
|
||||
if( nBitsLeft )
|
||||
{
|
||||
*pOut = MSG_ReadUBitLong( bf, nBitsLeft );
|
||||
*pOut = MSG_ReadUBitLong( sb, nBitsLeft );
|
||||
}
|
||||
|
||||
return !bf->bOverflow;
|
||||
return !sb->bOverflow;
|
||||
}
|
||||
|
||||
float MSG_ReadBitAngle( sizebuf_t *bf, int numbits )
|
||||
float MSG_ReadBitAngle( sizebuf_t *sb, int numbits )
|
||||
{
|
||||
float fReturn, shift;
|
||||
int i;
|
||||
|
||||
shift = (float)( 1 << numbits );
|
||||
|
||||
i = MSG_ReadUBitLong( bf, numbits );
|
||||
i = MSG_ReadUBitLong( sb, numbits );
|
||||
fReturn = (float)i * ( 360.0f / shift );
|
||||
|
||||
// clamp the finale angle
|
||||
|
@ -483,83 +478,88 @@ float MSG_ReadBitAngle( sizebuf_t *bf, int numbits )
|
|||
}
|
||||
|
||||
// Append numbits least significant bits from data to the current bit stream
|
||||
int MSG_ReadSBitLong( sizebuf_t *bf, int numbits )
|
||||
int MSG_ReadSBitLong( sizebuf_t *sb, int numbits )
|
||||
{
|
||||
int r, sign;
|
||||
|
||||
r = MSG_ReadUBitLong( bf, numbits - 1 );
|
||||
r = MSG_ReadUBitLong( sb, numbits - 1 );
|
||||
|
||||
// NOTE: it does this wierdness here so it's bit-compatible with regular integer data in the buffer.
|
||||
// (Some old code writes direct integers right into the buffer).
|
||||
sign = MSG_ReadOneBit( bf );
|
||||
sign = MSG_ReadOneBit( sb );
|
||||
if( sign ) r = -( BIT( numbits - 1 ) - r );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
uint MSG_ReadBitLong( sizebuf_t *bf, int numbits, qboolean bSigned )
|
||||
uint MSG_ReadBitLong( sizebuf_t *sb, int numbits, qboolean bSigned )
|
||||
{
|
||||
if( bSigned )
|
||||
return (uint)MSG_ReadSBitLong( bf, numbits );
|
||||
return MSG_ReadUBitLong( bf, numbits );
|
||||
return (uint)MSG_ReadSBitLong( sb, numbits );
|
||||
return MSG_ReadUBitLong( sb, numbits );
|
||||
}
|
||||
|
||||
int MSG_ReadChar( sizebuf_t *bf )
|
||||
int MSG_ReadChar( sizebuf_t *sb )
|
||||
{
|
||||
return MSG_ReadSBitLong( bf, sizeof( char ) << 3 );
|
||||
return MSG_ReadSBitLong( sb, sizeof( char ) << 3 );
|
||||
}
|
||||
|
||||
int MSG_ReadByte( sizebuf_t *bf )
|
||||
int MSG_ReadByte( sizebuf_t *sb )
|
||||
{
|
||||
return MSG_ReadUBitLong( bf, sizeof( byte ) << 3 );
|
||||
return MSG_ReadUBitLong( sb, sizeof( byte ) << 3 );
|
||||
}
|
||||
|
||||
int MSG_ReadShort( sizebuf_t *bf )
|
||||
int MSG_ReadShort( sizebuf_t *sb )
|
||||
{
|
||||
return MSG_ReadSBitLong( bf, sizeof( short ) << 3 );
|
||||
return MSG_ReadSBitLong( sb, sizeof( short ) << 3 );
|
||||
}
|
||||
|
||||
int MSG_ReadWord( sizebuf_t *bf )
|
||||
int MSG_ReadWord( sizebuf_t *sb )
|
||||
{
|
||||
return MSG_ReadUBitLong( bf, sizeof( word ) << 3 );
|
||||
return MSG_ReadUBitLong( sb, sizeof( word ) << 3 );
|
||||
}
|
||||
|
||||
float MSG_ReadCoord( sizebuf_t *bf )
|
||||
float MSG_ReadCoord( sizebuf_t *sb )
|
||||
{
|
||||
// g-cont. we loose precision here but keep old size of coord variable!
|
||||
if( host.features & ENGINE_WRITE_LARGE_COORD )
|
||||
return (float)(MSG_ReadShort( bf ) * ( 1.0f / 2.0f ));
|
||||
return (float)(MSG_ReadShort( bf ) * ( 1.0f / 8.0f ));
|
||||
if( FBitSet( host.features, ENGINE_WRITE_LARGE_COORD ))
|
||||
return (float)(MSG_ReadShort( sb ) * ( 1.0f / 2.0f ));
|
||||
return (float)(MSG_ReadShort( sb ) * ( 1.0f / 8.0f ));
|
||||
}
|
||||
|
||||
void MSG_ReadVec3Coord( sizebuf_t *bf, vec3_t fa )
|
||||
void MSG_ReadVec3Coord( sizebuf_t *sb, vec3_t fa )
|
||||
{
|
||||
fa[0] = MSG_ReadCoord( bf );
|
||||
fa[1] = MSG_ReadCoord( bf );
|
||||
fa[2] = MSG_ReadCoord( bf );
|
||||
fa[0] = MSG_ReadCoord( sb );
|
||||
fa[1] = MSG_ReadCoord( sb );
|
||||
fa[2] = MSG_ReadCoord( sb );
|
||||
}
|
||||
|
||||
long MSG_ReadLong( sizebuf_t *bf )
|
||||
long MSG_ReadLong( sizebuf_t *sb )
|
||||
{
|
||||
return MSG_ReadSBitLong( bf, sizeof( long ) << 3 );
|
||||
return MSG_ReadSBitLong( sb, sizeof( long ) << 3 );
|
||||
}
|
||||
|
||||
float MSG_ReadFloat( sizebuf_t *bf )
|
||||
dword MSG_ReadDword( sizebuf_t *sb )
|
||||
{
|
||||
return MSG_ReadUBitLong( sb, sizeof( dword ) << 3 );
|
||||
}
|
||||
|
||||
float MSG_ReadFloat( sizebuf_t *sb )
|
||||
{
|
||||
float ret;
|
||||
ASSERT( sizeof( ret ) == 4 );
|
||||
|
||||
MSG_ReadBits( bf, &ret, 32 );
|
||||
MSG_ReadBits( sb, &ret, 32 );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
qboolean MSG_ReadBytes( sizebuf_t *bf, void *pOut, int nBytes )
|
||||
qboolean MSG_ReadBytes( sizebuf_t *sb, void *pOut, int nBytes )
|
||||
{
|
||||
return MSG_ReadBits( bf, pOut, nBytes << 3 );
|
||||
return MSG_ReadBits( sb, pOut, nBytes << 3 );
|
||||
}
|
||||
|
||||
char *MSG_ReadStringExt( sizebuf_t *bf, qboolean bLine )
|
||||
char *MSG_ReadStringExt( sizebuf_t *sb, qboolean bLine )
|
||||
{
|
||||
static char string[MAX_SYSPATH];
|
||||
int l = 0, c;
|
||||
|
@ -567,7 +567,7 @@ char *MSG_ReadStringExt( sizebuf_t *bf, qboolean bLine )
|
|||
do
|
||||
{
|
||||
// use MSG_ReadByte so -1 is out of bounds
|
||||
c = MSG_ReadByte( bf );
|
||||
c = MSG_ReadByte( sb );
|
||||
|
||||
if( c == 0 ) break;
|
||||
else if( bLine && c == '\n' )
|
||||
|
@ -585,20 +585,20 @@ char *MSG_ReadStringExt( sizebuf_t *bf, qboolean bLine )
|
|||
return string;
|
||||
}
|
||||
|
||||
void MSG_ExciseBits( sizebuf_t *bf, int startbit, int bitstoremove )
|
||||
void MSG_ExciseBits( sizebuf_t *sb, int startbit, int bitstoremove )
|
||||
{
|
||||
int i, endbit = startbit + bitstoremove;
|
||||
int remaining_to_end = bf->nDataBits - endbit;
|
||||
int remaining_to_end = sb->nDataBits - endbit;
|
||||
sizebuf_t temp;
|
||||
|
||||
MSG_StartWriting( &temp, bf->pData, bf->nDataBits << 3, startbit, -1 );
|
||||
MSG_SeekToBit( bf, endbit );
|
||||
MSG_StartWriting( &temp, sb->pData, sb->nDataBits << 3, startbit, -1 );
|
||||
MSG_SeekToBit( sb, endbit );
|
||||
|
||||
for( i = 0; i < remaining_to_end; i++ )
|
||||
{
|
||||
MSG_WriteOneBit( &temp, MSG_ReadOneBit( bf ));
|
||||
MSG_WriteOneBit( &temp, MSG_ReadOneBit( sb ));
|
||||
}
|
||||
|
||||
MSG_SeekToBit( bf, startbit );
|
||||
bf->nDataBits -= bitstoremove;
|
||||
MSG_SeekToBit( sb, startbit );
|
||||
sb->nDataBits -= bitstoremove;
|
||||
}
|
|
@ -45,7 +45,6 @@ typedef struct sizebuf_s
|
|||
int nDataBits;
|
||||
} sizebuf_t;
|
||||
|
||||
#define MSG_WriteUBitLong( bf, data, bits ) MSG_WriteUBitLongExt( bf, data, bits, true );
|
||||
#define MSG_StartReading MSG_StartWriting
|
||||
#define MSG_GetNumBytesRead MSG_GetNumBytesWritten
|
||||
#define MSG_GetRealBytesRead MSG_GetRealBytesWritten
|
||||
|
@ -71,7 +70,7 @@ void MSG_Clear( sizebuf_t *bf );
|
|||
|
||||
// Bit-write functions
|
||||
void MSG_WriteOneBit( sizebuf_t *bf, int nValue );
|
||||
void MSG_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, qboolean bCheckRange );
|
||||
void MSG_WriteUBitLong( sizebuf_t *bf, uint curData, int numbits );
|
||||
void MSG_WriteSBitLong( sizebuf_t *bf, int data, int numbits );
|
||||
void MSG_WriteBitLong( sizebuf_t *bf, uint data, int numbits, qboolean bSigned );
|
||||
qboolean MSG_WriteBits( sizebuf_t *bf, const void *pData, int nBits );
|
||||
|
@ -84,6 +83,7 @@ void MSG_WriteByte( sizebuf_t *bf, int val );
|
|||
void MSG_WriteShort( sizebuf_t *bf, int val );
|
||||
void MSG_WriteWord( sizebuf_t *bf, int val );
|
||||
void MSG_WriteLong( sizebuf_t *bf, long val );
|
||||
void MSG_WriteDword( sizebuf_t *sb, dword val );
|
||||
void MSG_WriteCoord( sizebuf_t *bf, float val );
|
||||
void MSG_WriteFloat( sizebuf_t *bf, float val );
|
||||
void MSG_WriteVec3Coord( sizebuf_t *bf, const float *fa );
|
||||
|
|
|
@ -154,7 +154,7 @@ void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport )
|
|||
{
|
||||
Netchan_Clear( chan );
|
||||
|
||||
Q_memset( chan, 0, sizeof( *chan ));
|
||||
memset( chan, 0, sizeof( *chan ));
|
||||
|
||||
chan->sock = sock;
|
||||
chan->remote_address = adr;
|
||||
|
@ -332,7 +332,7 @@ void Netchan_Clear( netchan_t *chan )
|
|||
chan->incomingready[i] = false;
|
||||
}
|
||||
|
||||
Q_memset( chan->flow, 0, sizeof( chan->flow ));
|
||||
memset( chan->flow, 0, sizeof( chan->flow ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1027,11 +1027,11 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
|
|||
{
|
||||
// copy it in
|
||||
cursize -= MSG_GetNumBytesRead( msg );
|
||||
Q_memcpy( &buffer[pos], &p->frag_message.pData[MSG_GetNumBytesRead( msg )], cursize );
|
||||
memcpy( &buffer[pos], &p->frag_message.pData[MSG_GetNumBytesRead( msg )], cursize );
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_memcpy( &buffer[pos], p->frag_message.pData, cursize );
|
||||
memcpy( &buffer[pos], p->frag_message.pData, cursize );
|
||||
}
|
||||
|
||||
pos += cursize;
|
||||
|
@ -1256,7 +1256,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
|
||||
if( send_from_regular )
|
||||
{
|
||||
Q_memcpy( chan->reliable_buf, chan->message_buf, MSG_GetNumBytesWritten( &chan->message ));
|
||||
memcpy( chan->reliable_buf, chan->message_buf, MSG_GetNumBytesWritten( &chan->message ));
|
||||
chan->reliable_length = MSG_GetNumBitsWritten( &chan->message );
|
||||
MSG_Clear( &chan->message );
|
||||
|
||||
|
|
|
@ -747,10 +747,7 @@ void Delta_InitFields( void )
|
|||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
||||
{
|
||||
dt = Delta_FindStruct( token );
|
||||
if( dt == NULL )
|
||||
{
|
||||
Sys_Error( "delta.lst: unknown struct %s\n", token );
|
||||
}
|
||||
if( dt == NULL ) Sys_Error( "delta.lst: unknown struct %s\n", token );
|
||||
|
||||
pfile = COM_ParseFile( pfile, encodeDll );
|
||||
|
||||
|
@ -760,10 +757,7 @@ void Delta_InitFields( void )
|
|||
|
||||
// jump to '{'
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
if( token[0] != '{' )
|
||||
{
|
||||
Sys_Error( "delta.lst: missing '{' in section %s\n", dt->pName );
|
||||
}
|
||||
if( token[0] != '{' ) Sys_Error( "delta.lst: missing '{' in section %s\n", dt->pName );
|
||||
|
||||
Delta_ParseTable( &pfile, dt, encodeDll, encodeFunc );
|
||||
}
|
||||
|
@ -826,6 +820,7 @@ void Delta_Init( void )
|
|||
Delta_AddField( "movevars_t", "skyangle", DT_ANGLE, 16, 1.0f, 1.0f ); // 0 - 360
|
||||
Delta_AddField( "movevars_t", "wateralpha", DT_FLOAT|DT_SIGNED, 16, 32.0f, 1.0f );
|
||||
Delta_AddField( "movevars_t", "fog_settings", DT_INTEGER, 32, 1.0f, 1.0f );
|
||||
|
||||
// now done
|
||||
dt->bInitialized = true;
|
||||
}
|
||||
|
@ -1739,7 +1734,7 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state
|
|||
if( fRemoveType )
|
||||
{
|
||||
// check for a remove
|
||||
Q_memset( to, 0, sizeof( *to ));
|
||||
memset( to, 0, sizeof( *to ));
|
||||
|
||||
if( fRemoveType & 1 )
|
||||
{
|
||||
|
|
|
@ -90,7 +90,7 @@ static _inline void Huff_PrepareTree( tree_t tree )
|
|||
{
|
||||
void **node;
|
||||
|
||||
Q_memset( tree, 0, sizeof( tree_t ));
|
||||
memset( tree, 0, sizeof( tree_t ));
|
||||
|
||||
// create first node
|
||||
node = &tree[263];
|
||||
|
@ -532,7 +532,7 @@ void Huff_CompressPacket( sizebuf_t *msg, int offset )
|
|||
|
||||
outLen = (huffBitPos >> 3) + 1;
|
||||
msg->iCurBit = (offset + outLen) << 3;
|
||||
Q_memcpy( data, buffer, outLen );
|
||||
memcpy( data, buffer, outLen );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -588,7 +588,7 @@ void Huff_DecompressPacket( sizebuf_t *msg, int offset )
|
|||
}
|
||||
|
||||
msg->nDataBits = ( offset + outLen ) << 3;
|
||||
Q_memcpy( data, buffer, outLen );
|
||||
memcpy( data, buffer, outLen );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -175,7 +175,7 @@ char *NET_ErrorString( void )
|
|||
|
||||
static void NET_NetadrToSockadr( netadr_t *a, struct sockaddr *s )
|
||||
{
|
||||
Q_memset( s, 0, sizeof( *s ));
|
||||
memset( s, 0, sizeof( *s ));
|
||||
|
||||
if( a->type == NA_BROADCAST )
|
||||
{
|
||||
|
@ -192,15 +192,15 @@ static void NET_NetadrToSockadr( netadr_t *a, struct sockaddr *s )
|
|||
else if( a->type == NA_IPX )
|
||||
{
|
||||
((struct sockaddr_ipx *)s)->sa_family = AF_IPX;
|
||||
Q_memcpy(((struct sockaddr_ipx *)s)->sa_netnum, &a->ipx[0], 4 );
|
||||
Q_memcpy(((struct sockaddr_ipx *)s)->sa_nodenum, &a->ipx[4], 6 );
|
||||
memcpy(((struct sockaddr_ipx *)s)->sa_netnum, &a->ipx[0], 4 );
|
||||
memcpy(((struct sockaddr_ipx *)s)->sa_nodenum, &a->ipx[4], 6 );
|
||||
((struct sockaddr_ipx *)s)->sa_socket = a->port;
|
||||
}
|
||||
else if( a->type == NA_BROADCAST_IPX )
|
||||
{
|
||||
((struct sockaddr_ipx *)s)->sa_family = AF_IPX;
|
||||
Q_memset(((struct sockaddr_ipx *)s)->sa_netnum, 0, 4 );
|
||||
Q_memset(((struct sockaddr_ipx *)s)->sa_nodenum, 0xff, 6 );
|
||||
memset(((struct sockaddr_ipx *)s)->sa_netnum, 0, 4 );
|
||||
memset(((struct sockaddr_ipx *)s)->sa_nodenum, 0xff, 6 );
|
||||
((struct sockaddr_ipx *)s)->sa_socket = a->port;
|
||||
}
|
||||
}
|
||||
|
@ -217,8 +217,8 @@ static void NET_SockadrToNetadr( struct sockaddr *s, netadr_t *a )
|
|||
else if( s->sa_family == AF_IPX )
|
||||
{
|
||||
a->type = NA_IPX;
|
||||
Q_memcpy( &a->ipx[0], ((struct sockaddr_ipx *)s)->sa_netnum, 4 );
|
||||
Q_memcpy( &a->ipx[4], ((struct sockaddr_ipx *)s)->sa_nodenum, 6 );
|
||||
memcpy( &a->ipx[0], ((struct sockaddr_ipx *)s)->sa_netnum, 4 );
|
||||
memcpy( &a->ipx[4], ((struct sockaddr_ipx *)s)->sa_nodenum, 6 );
|
||||
a->port = ((struct sockaddr_ipx *)s)->sa_socket;
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ static qboolean NET_StringToSockaddr( const char *s, struct sockaddr *sadr )
|
|||
char copy[MAX_SYSPATH];
|
||||
int val;
|
||||
|
||||
Q_memset( sadr, 0, sizeof( *sadr ));
|
||||
memset( sadr, 0, sizeof( *sadr ));
|
||||
|
||||
if((Q_strlen( s ) >= 23 ) && ( s[8] == ':' ) && ( s[21] == ':' )) // check for an IPX address
|
||||
{
|
||||
|
@ -333,14 +333,14 @@ qboolean NET_CompareBaseAdr( const netadr_t a, const netadr_t b )
|
|||
|
||||
if( a.type == NA_IP )
|
||||
{
|
||||
if( !Q_memcmp( a.ip, b.ip, 4 ))
|
||||
if( !memcmp( a.ip, b.ip, 4 ))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( a.type == NA_IPX )
|
||||
{
|
||||
if( !Q_memcmp( a.ipx, b.ipx, 10 ))
|
||||
if( !memcmp( a.ipx, b.ipx, 10 ))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -359,14 +359,14 @@ qboolean NET_CompareAdr( const netadr_t a, const netadr_t b )
|
|||
|
||||
if( a.type == NA_IP )
|
||||
{
|
||||
if(!Q_memcmp( a.ip, b.ip, 4 ) && a.port == b.port )
|
||||
if(!memcmp( a.ip, b.ip, 4 ) && a.port == b.port )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( a.type == NA_IPX )
|
||||
{
|
||||
if(!Q_memcmp( a.ipx, b.ipx, 10 ) && a.port == b.port )
|
||||
if(!memcmp( a.ipx, b.ipx, 10 ) && a.port == b.port )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ qboolean NET_StringToAdr( const char *string, netadr_t *adr )
|
|||
|
||||
if( !Q_stricmp( string, "localhost" ))
|
||||
{
|
||||
Q_memset( adr, 0, sizeof( netadr_t ));
|
||||
memset( adr, 0, sizeof( netadr_t ));
|
||||
adr->type = NA_LOOPBACK;
|
||||
return true;
|
||||
}
|
||||
|
@ -431,10 +431,10 @@ static qboolean NET_GetLoopPacket( netsrc_t sock, netadr_t *from, byte *data, si
|
|||
i = loop->get & MASK_LOOPBACK;
|
||||
loop->get++;
|
||||
|
||||
Q_memcpy( data, loop->msgs[i].data, loop->msgs[i].datalen );
|
||||
memcpy( data, loop->msgs[i].data, loop->msgs[i].datalen );
|
||||
*length = loop->msgs[i].datalen;
|
||||
|
||||
Q_memset( from, 0, sizeof( *from ));
|
||||
memset( from, 0, sizeof( *from ));
|
||||
from->type = NA_LOOPBACK;
|
||||
|
||||
return true;
|
||||
|
@ -450,7 +450,7 @@ static void NET_SendLoopPacket( netsrc_t sock, size_t length, const void *data,
|
|||
i = loop->send & MASK_LOOPBACK;
|
||||
loop->send++;
|
||||
|
||||
Q_memcpy( loop->msgs[i].data, data, length );
|
||||
memcpy( loop->msgs[i].data, data, length );
|
||||
loop->msgs[i].datalen = length;
|
||||
}
|
||||
|
||||
|
@ -710,8 +710,8 @@ static int NET_IPXSocket( int port )
|
|||
}
|
||||
|
||||
addr.sa_family = AF_IPX;
|
||||
Q_memset( addr.sa_netnum, 0, 4 );
|
||||
Q_memset( addr.sa_nodenum, 0, 6 );
|
||||
memset( addr.sa_netnum, 0, 4 );
|
||||
memset( addr.sa_nodenum, 0, 6 );
|
||||
|
||||
if( port == PORT_ANY ) addr.sa_socket = 0;
|
||||
else addr.sa_socket = pHtons((short)port );
|
||||
|
@ -773,7 +773,7 @@ void NET_GetLocalAddress( void )
|
|||
struct sockaddr_in address;
|
||||
int namelen;
|
||||
|
||||
Q_memset( &net_local, 0, sizeof( netadr_t ));
|
||||
memset( &net_local, 0, sizeof( netadr_t ));
|
||||
|
||||
if( noip )
|
||||
{
|
||||
|
|
|
@ -202,7 +202,7 @@ qboolean PM_RecursiveHullCheck( hull_t *hull, int num, float p1f, float p2f, vec
|
|||
}
|
||||
|
||||
if( num < hull->firstclipnode || num > hull->lastclipnode )
|
||||
Sys_Error( "PM_RecursiveHullCheck: bad node number\n" );
|
||||
Host_Error( "PM_RecursiveHullCheck: bad node number %i\n", num );
|
||||
|
||||
// find the point distances
|
||||
node = hull->clipnodes + num;
|
||||
|
@ -299,7 +299,7 @@ pmtrace_t PM_PlayerTraceExt( playermove_t *pmove, vec3_t start, vec3_t end, int
|
|||
qboolean rotated, transform_bbox;
|
||||
hull_t *hull = NULL;
|
||||
|
||||
Q_memset( &trace_total, 0, sizeof( trace_total ));
|
||||
memset( &trace_total, 0, sizeof( trace_total ));
|
||||
VectorCopy( end, trace_total.endpos );
|
||||
trace_total.fraction = 1.0f;
|
||||
trace_total.ent = -1;
|
||||
|
@ -418,7 +418,7 @@ pmtrace_t PM_PlayerTraceExt( playermove_t *pmove, vec3_t start, vec3_t end, int
|
|||
VectorSubtract( end, offset, end_l );
|
||||
}
|
||||
|
||||
Q_memset( &trace_bbox, 0, sizeof( trace_bbox ));
|
||||
memset( &trace_bbox, 0, sizeof( trace_bbox ));
|
||||
VectorCopy( end, trace_bbox.endpos );
|
||||
trace_bbox.allsolid = true;
|
||||
trace_bbox.fraction = 1.0f;
|
||||
|
@ -445,7 +445,7 @@ pmtrace_t PM_PlayerTraceExt( playermove_t *pmove, vec3_t start, vec3_t end, int
|
|||
|
||||
for( last_hitgroup = 0, j = 0; j < hullcount; j++ )
|
||||
{
|
||||
Q_memset( &trace_hitbox, 0, sizeof( trace_hitbox ));
|
||||
memset( &trace_hitbox, 0, sizeof( trace_hitbox ));
|
||||
VectorCopy( end, trace_hitbox.endpos );
|
||||
trace_hitbox.allsolid = true;
|
||||
trace_hitbox.fraction = 1.0f;
|
||||
|
@ -592,7 +592,7 @@ int PM_TestPlayerPosition( playermove_t *pmove, vec3_t pos, pmtrace_t *ptrace, p
|
|||
{
|
||||
pmtrace_t trace;
|
||||
|
||||
Q_memset( &trace, 0, sizeof( trace ));
|
||||
memset( &trace, 0, sizeof( trace ));
|
||||
VectorCopy( pos, trace.endpos );
|
||||
trace.allsolid = true;
|
||||
trace.fraction = 1.0f;
|
||||
|
|
|
@ -119,7 +119,7 @@ qboolean Sound_LoadMPG( const char *name, const byte *buffer, size_t filesize )
|
|||
outsize = ( sound.size - bytesWrite );
|
||||
else outsize = mpeg.outsize;
|
||||
|
||||
Q_memcpy( &sound.wav[bytesWrite], mpeg.out, outsize );
|
||||
memcpy( &sound.wav[bytesWrite], mpeg.out, outsize );
|
||||
bytesWrite += outsize;
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ long Stream_ReadMPG( stream_t *stream, long needBytes, void *buffer )
|
|||
|
||||
// copy raw sample to output buffer
|
||||
data = (byte *)buffer + bytesWritten;
|
||||
Q_memcpy( data, &mpg->out[stream->buffsize], outsize );
|
||||
memcpy( data, &mpg->out[stream->buffsize], outsize );
|
||||
bytesWritten += outsize;
|
||||
mpg->outsize -= outsize;
|
||||
stream->buffsize += outsize;
|
||||
|
|
|
@ -88,7 +88,7 @@ byte *Sound_Copy( size_t size )
|
|||
byte *out;
|
||||
|
||||
out = Mem_Alloc( host.soundpool, size );
|
||||
Q_memcpy( out, sound.tempbuffer, size );
|
||||
memcpy( out, sound.tempbuffer, size );
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -270,7 +270,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
|
|||
if(( filesize - hdr_size ) < 16384 )
|
||||
{
|
||||
sound.tempbuffer = (byte *)Mem_Realloc( host.soundpool, sound.tempbuffer, 16384 );
|
||||
Q_memcpy( sound.tempbuffer, buffer + (iff_dataPtr - buffer), filesize - hdr_size );
|
||||
memcpy( sound.tempbuffer, buffer + (iff_dataPtr - buffer), filesize - hdr_size );
|
||||
return Sound_LoadMPG( name, sound.tempbuffer, 16384 );
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
|
|||
sound.size = sound.samples * sound.width * sound.channels;
|
||||
sound.wav = Mem_Alloc( host.soundpool, sound.size );
|
||||
|
||||
Q_memcpy( sound.wav, buffer + (iff_dataPtr - buffer), sound.size );
|
||||
memcpy( sound.wav, buffer + (iff_dataPtr - buffer), sound.size );
|
||||
|
||||
// now convert 8-bit sounds to signed
|
||||
if( sound.width == 1 )
|
||||
|
|
|
@ -85,7 +85,7 @@ void Sys_SetClipboardData( const byte *buffer, size_t size )
|
|||
HGLOBAL hResult = GlobalAlloc( GMEM_MOVEABLE, size );
|
||||
byte *bufferCopy = (byte *)GlobalLock( hResult );
|
||||
|
||||
Q_memcpy( bufferCopy, buffer, size );
|
||||
memcpy( bufferCopy, buffer, size );
|
||||
GlobalUnlock( hResult );
|
||||
|
||||
if( SetClipboardData( CF_DIB, hResult ) == NULL )
|
||||
|
|
|
@ -121,32 +121,6 @@ static int ParseFloats( const char *pText, float *pFloat, int count )
|
|||
return 0;
|
||||
}
|
||||
|
||||
// trims all whitespace from the front and end of a string
|
||||
void TrimSpace( const char *source, char *dest )
|
||||
{
|
||||
int start, end, length;
|
||||
|
||||
start = 0;
|
||||
end = Q_strlen( source );
|
||||
|
||||
while( source[start] && IsWhiteSpace( source[start] ))
|
||||
start++;
|
||||
|
||||
end--;
|
||||
while( end > 0 && IsWhiteSpace( source[end] ))
|
||||
end--;
|
||||
|
||||
end++;
|
||||
|
||||
length = end - start;
|
||||
if( length > 0 )
|
||||
Q_memcpy( dest, source + start, length );
|
||||
else length = 0;
|
||||
|
||||
// terminate the dest string
|
||||
dest[length] = 0;
|
||||
}
|
||||
|
||||
static int IsToken( const char *pText, const char *pTokenName )
|
||||
{
|
||||
if( !pText || !pTokenName )
|
||||
|
@ -253,7 +227,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
|
|||
|
||||
while( COM_MemFgets( pMemFile, fileSize, &filePos, buf, 512 ) != NULL )
|
||||
{
|
||||
TrimSpace( buf, trim );
|
||||
COM_TrimSpace( buf, trim );
|
||||
|
||||
switch( mode )
|
||||
{
|
||||
|
@ -346,11 +320,11 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
|
|||
clgame.titles = (client_textmessage_t *)Mem_Alloc( cls.mempool, textHeapSize + nameHeapSize + messageSize );
|
||||
|
||||
// copy table over
|
||||
Q_memcpy( clgame.titles, textMessages, messageSize );
|
||||
memcpy( clgame.titles, textMessages, messageSize );
|
||||
|
||||
// copy Name heap
|
||||
pNameHeap = ((char *)clgame.titles) + messageSize;
|
||||
Q_memcpy( pNameHeap, nameHeap, nameHeapSize );
|
||||
memcpy( pNameHeap, nameHeap, nameHeapSize );
|
||||
nameOffset = pNameHeap - clgame.titles[0].pName;
|
||||
|
||||
// copy text & fixup pointers
|
||||
|
|
|
@ -115,7 +115,7 @@ loopcontinue:;
|
|||
pool->realsize += sizeof( memclump_t );
|
||||
clump = malloc( sizeof( memclump_t ));
|
||||
if( clump == NULL ) Sys_Error( "Mem_Alloc: out of memory (alloc at %s:%i)\n", filename, fileline );
|
||||
_Q_memset( clump, 0, sizeof( memclump_t ), filename, fileline );
|
||||
memset( clump, 0, sizeof( memclump_t ));
|
||||
*clumpchainpointer = clump;
|
||||
clump->sentinel1 = MEMCLUMP_SENTINEL;
|
||||
clump->sentinel2 = MEMCLUMP_SENTINEL;
|
||||
|
@ -153,7 +153,7 @@ choseclump:
|
|||
mem->prev = NULL;
|
||||
pool->chain = mem;
|
||||
if( mem->next ) mem->next->prev = mem;
|
||||
_Q_memset((void *)((byte *)mem + sizeof( memheader_t )), 0, mem->size, filename, fileline );
|
||||
memset((void *)((byte *)mem + sizeof( memheader_t )), 0, mem->size );
|
||||
|
||||
return (void *)((byte *)mem + sizeof( memheader_t ));
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ static void Mem_FreeBlock( memheader_t *mem, const char *filename, int fileline
|
|||
}
|
||||
|
||||
pool->realsize -= sizeof( memclump_t );
|
||||
_Q_memset( clump, 0xBF, sizeof( memclump_t ), filename, fileline );
|
||||
memset( clump, 0xBF, sizeof( memclump_t ));
|
||||
free( clump );
|
||||
}
|
||||
else
|
||||
|
@ -279,11 +279,8 @@ void *_Mem_Realloc( byte *poolptr, void *memptr, size_t size, const char *filena
|
|||
|
||||
if( memptr ) // first allocate?
|
||||
{
|
||||
size_t newsize;
|
||||
|
||||
// get size of old block
|
||||
newsize = memhdr->size < size ? memhdr->size : size; // upper data can be trucnated!
|
||||
_Q_memcpy( nb, memptr, newsize, filename, fileline );
|
||||
size_t newsize = memhdr->size < size ? memhdr->size : size; // upper data can be trucnated!
|
||||
memcpy( nb, memptr, newsize );
|
||||
_Mem_Free( memptr, filename, fileline ); // free unused old block
|
||||
}
|
||||
|
||||
|
@ -296,7 +293,7 @@ byte *_Mem_AllocPool( const char *name, const char *filename, int fileline )
|
|||
|
||||
pool = (mempool_t *)malloc( sizeof( mempool_t ));
|
||||
if( pool == NULL ) Sys_Error( "Mem_AllocPool: out of memory (allocpool at %s:%i)\n", filename, fileline );
|
||||
_Q_memset( pool, 0, sizeof( mempool_t ), filename, fileline );
|
||||
memset( pool, 0, sizeof( mempool_t ));
|
||||
|
||||
// fill header
|
||||
pool->sentinel1 = MEMHEADER_SENTINEL1;
|
||||
|
@ -322,15 +319,15 @@ void _Mem_FreePool( byte **poolptr, const char *filename, int fileline )
|
|||
{
|
||||
// unlink pool from chain
|
||||
for( chainaddress = &poolchain; *chainaddress && *chainaddress != pool; chainaddress = &((*chainaddress)->next));
|
||||
if( *chainaddress != pool) Sys_Error("Mem_FreePool: pool already free (freepool at %s:%i)\n", filename, fileline );
|
||||
if( pool->sentinel1 != MEMHEADER_SENTINEL1 ) Sys_Error("Mem_FreePool: trashed pool sentinel 1 (allocpool at %s:%i, freepool at %s:%i)\n", pool->filename, pool->fileline, filename, fileline );
|
||||
if( pool->sentinel2 != MEMHEADER_SENTINEL1 ) Sys_Error("Mem_FreePool: trashed pool sentinel 2 (allocpool at %s:%i, freepool at %s:%i)\n", pool->filename, pool->fileline, filename, fileline );
|
||||
if( *chainaddress != pool ) Sys_Error( "Mem_FreePool: pool already free (freepool at %s:%i)\n", filename, fileline );
|
||||
if( pool->sentinel1 != MEMHEADER_SENTINEL1 ) Sys_Error( "Mem_FreePool: trashed pool sentinel 1 (allocpool at %s:%i, freepool at %s:%i)\n", pool->filename, pool->fileline, filename, fileline );
|
||||
if( pool->sentinel2 != MEMHEADER_SENTINEL1 ) Sys_Error( "Mem_FreePool: trashed pool sentinel 2 (allocpool at %s:%i, freepool at %s:%i)\n", pool->filename, pool->fileline, filename, fileline );
|
||||
*chainaddress = pool->next;
|
||||
|
||||
// free memory owned by the pool
|
||||
while( pool->chain ) Mem_FreeBlock( pool->chain, filename, fileline );
|
||||
// free the pool itself
|
||||
_Q_memset( pool, 0xBF, sizeof( mempool_t ), filename, fileline );
|
||||
memset( pool, 0xBF, sizeof( mempool_t ));
|
||||
free( pool );
|
||||
*poolptr = NULL;
|
||||
}
|
||||
|
@ -386,13 +383,15 @@ void Mem_CheckHeaderSentinels( void *data, const char *filename, int fileline )
|
|||
{
|
||||
memheader_t *mem;
|
||||
|
||||
if (data == NULL) Sys_Error( "Mem_CheckSentinels: data == NULL (sentinel check at %s:%i)\n", filename, fileline );
|
||||
if( data == NULL ) Sys_Error( "Mem_CheckSentinels: data == NULL (sentinel check at %s:%i)\n", filename, fileline );
|
||||
mem = (memheader_t *)((byte *) data - sizeof(memheader_t));
|
||||
|
||||
if( mem->sentinel1 != MEMHEADER_SENTINEL1 )
|
||||
{
|
||||
mem->filename = Mem_CheckFilename( mem->filename ); // make sure what we don't crash var_args
|
||||
Sys_Error( "Mem_CheckSentinels: trashed header sentinel 1 (block allocated at %s:%i, sentinel check at %s:%i)\n", mem->filename, mem->fileline, filename, fileline );
|
||||
}
|
||||
|
||||
if( *((byte *) mem + sizeof(memheader_t) + mem->size) != MEMHEADER_SENTINEL2 )
|
||||
{
|
||||
mem->filename = Mem_CheckFilename( mem->filename ); // make sure what we don't crash var_args
|
||||
|
|
|
@ -156,11 +156,11 @@ SOURCE=.\client\cl_game.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_main.c
|
||||
SOURCE=.\client\cl_gameui.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_menu.c
|
||||
SOURCE=.\client\cl_main.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ void SV_DirectConnect( netadr_t from )
|
|||
Info_SetValueForKey( userinfo, "ip", NET_AdrToString( from ));
|
||||
|
||||
newcl = &temp;
|
||||
Q_memset( newcl, 0, sizeof( sv_client_t ));
|
||||
memset( newcl, 0, sizeof( sv_client_t ));
|
||||
|
||||
// if there is already a slot for this ip, reuse it
|
||||
for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ )
|
||||
|
@ -323,7 +323,7 @@ edict_t *SV_FakeConnect( const char *netname )
|
|||
|
||||
// find a client slot
|
||||
newcl = &temp;
|
||||
Q_memset( newcl, 0, sizeof( sv_client_t ));
|
||||
memset( newcl, 0, sizeof( sv_client_t ));
|
||||
|
||||
for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ )
|
||||
{
|
||||
|
@ -449,8 +449,8 @@ void SV_DropClient( sv_client_t *drop )
|
|||
Netchan_Clear( &drop->netchan );
|
||||
|
||||
// clean client data on disconnect
|
||||
Q_memset( drop->userinfo, 0, MAX_INFO_STRING );
|
||||
Q_memset( drop->physinfo, 0, MAX_INFO_STRING );
|
||||
memset( drop->userinfo, 0, MAX_INFO_STRING );
|
||||
memset( drop->physinfo, 0, MAX_INFO_STRING );
|
||||
drop->edict->v.frags = 0;
|
||||
|
||||
// send notification to all other clients
|
||||
|
@ -813,7 +813,7 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
|
|||
Q_strcat( remaining, Cmd_Argv( i ));
|
||||
Q_strcat( remaining, " " );
|
||||
}
|
||||
Cmd_ExecuteString( remaining, src_command );
|
||||
Cmd_ExecuteString( remaining );
|
||||
}
|
||||
else MsgDev( D_ERROR, "Bad rcon_password.\n" );
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ void SV_FullUpdateMovevars( sv_client_t *cl, sizebuf_t *msg )
|
|||
{
|
||||
movevars_t nullmovevars;
|
||||
|
||||
Q_memset( &nullmovevars, 0, sizeof( nullmovevars ));
|
||||
memset( &nullmovevars, 0, sizeof( nullmovevars ));
|
||||
MSG_WriteDeltaMovevars( msg, &nullmovevars, &svgame.movevars );
|
||||
}
|
||||
|
||||
|
@ -1248,7 +1248,7 @@ void SV_New_f( sv_client_t *cl )
|
|||
// NOTE: custom resources download is disabled until is done
|
||||
if( /*sv_maxclients->integer ==*/ 1 )
|
||||
{
|
||||
Q_memset( &cl->lastcmd, 0, sizeof( cl->lastcmd ));
|
||||
memset( &cl->lastcmd, 0, sizeof( cl->lastcmd ));
|
||||
|
||||
// begin fetching modellist
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
|
@ -1276,7 +1276,7 @@ void SV_ContinueLoading_f( sv_client_t *cl )
|
|||
return;
|
||||
}
|
||||
|
||||
Q_memset( &cl->lastcmd, 0, sizeof( cl->lastcmd ));
|
||||
memset( &cl->lastcmd, 0, sizeof( cl->lastcmd ));
|
||||
|
||||
// begin fetching modellist
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
|
@ -1298,7 +1298,7 @@ void SV_SendResourceList_f( sv_client_t *cl )
|
|||
resourcelist_t reslist; // g-cont. what about stack???
|
||||
size_t msg_size;
|
||||
|
||||
Q_memset( &reslist, 0, sizeof( resourcelist_t ));
|
||||
memset( &reslist, 0, sizeof( resourcelist_t ));
|
||||
|
||||
reslist.restype[rescount] = t_world; // terminator
|
||||
Q_strcpy( reslist.resnames[rescount], "NULL" );
|
||||
|
@ -1675,7 +1675,7 @@ void SV_Baselines_f( sv_client_t *cl )
|
|||
|
||||
start = Q_atoi( Cmd_Argv( 2 ));
|
||||
|
||||
Q_memset( &nullstate, 0, sizeof( nullstate ));
|
||||
memset( &nullstate, 0, sizeof( nullstate ));
|
||||
|
||||
// write a packet full of data
|
||||
while( MSG_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < svgame.numEntities )
|
||||
|
@ -1806,7 +1806,7 @@ void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo )
|
|||
|
||||
val = Info_ValueForKey( cl->userinfo, "name" );
|
||||
Q_strncpy( temp2, val, sizeof( temp2 ));
|
||||
TrimSpace( temp2, temp1 );
|
||||
COM_TrimSpace( temp2, temp1 );
|
||||
|
||||
if( !Q_stricmp( temp1, "console" )) // keyword came from OSHLDS
|
||||
{
|
||||
|
@ -2195,8 +2195,8 @@ static void SV_ParseClientMove( sv_client_t *cl, sizebuf_t *msg )
|
|||
player = cl->edict;
|
||||
|
||||
frame = &cl->frames[cl->netchan.incoming_acknowledged & SV_UPDATE_MASK];
|
||||
Q_memset( &nullcmd, 0, sizeof( usercmd_t ));
|
||||
Q_memset( cmds, 0, sizeof( cmds ));
|
||||
memset( &nullcmd, 0, sizeof( usercmd_t ));
|
||||
memset( cmds, 0, sizeof( cmds ));
|
||||
|
||||
key = MSG_GetRealBytesRead( msg );
|
||||
checksum1 = MSG_ReadByte( msg );
|
||||
|
|
|
@ -158,7 +158,7 @@ void SV_CreateCustomizationList( sv_client_t *cl )
|
|||
|
||||
for( pCust = cl->customization.pNext; pCust != NULL; pCust = pCust->pNext )
|
||||
{
|
||||
if( !Q_memcmp( pCust->resource.rgucMD5_hash, pRes->rgucMD5_hash, 16 ))
|
||||
if( !memcmp( pCust->resource.rgucMD5_hash, pRes->rgucMD5_hash, 16 ))
|
||||
{
|
||||
duplicated = true;
|
||||
break;
|
||||
|
@ -279,13 +279,13 @@ int SV_TransferConsistencyInfo( void )
|
|||
Host_Error( "Mod_GetStudioBounds: couldn't get bounds for %s\n", filepath );
|
||||
|
||||
res->rguc_reserved[0x00] = check->force_state;
|
||||
Q_memcpy( &res->rguc_reserved[0x01], mins, sizeof( mins ));
|
||||
Q_memcpy( &res->rguc_reserved[0x0D], maxs, sizeof( maxs ));
|
||||
memcpy( &res->rguc_reserved[0x01], mins, sizeof( mins ));
|
||||
memcpy( &res->rguc_reserved[0x0D], maxs, sizeof( maxs ));
|
||||
break;
|
||||
case force_model_specifybounds:
|
||||
res->rguc_reserved[0x00] = check->force_state;
|
||||
Q_memcpy( &res->rguc_reserved[0x01], check->mins, sizeof( check->mins ));
|
||||
Q_memcpy( &res->rguc_reserved[0x0D], check->maxs, sizeof( check->maxs ));
|
||||
memcpy( &res->rguc_reserved[0x01], check->mins, sizeof( check->mins ));
|
||||
memcpy( &res->rguc_reserved[0x0D], check->maxs, sizeof( check->maxs ));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ void SV_SendResources( sizebuf_t *msg )
|
|||
byte nullrguc[32];
|
||||
int i;
|
||||
|
||||
Q_memset( nullrguc, 0, sizeof( nullrguc ));
|
||||
memset( nullrguc, 0, sizeof( nullrguc ));
|
||||
|
||||
MSG_WriteByte( msg, svc_customization );
|
||||
MSG_WriteLong( msg, svs.spawncount );
|
||||
|
@ -351,7 +351,7 @@ void SV_SendResources( sizebuf_t *msg )
|
|||
MSG_WriteBits( msg, sv.resources[i].rgucMD5_hash, sizeof( sv.resources[i].rgucMD5_hash ));
|
||||
}
|
||||
|
||||
if( Q_memcmp( nullrguc, sv.resources[i].rguc_reserved, sizeof( nullrguc )))
|
||||
if( memcmp( nullrguc, sv.resources[i].rguc_reserved, sizeof( nullrguc )))
|
||||
{
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteBits( msg, sv.resources[i].rguc_reserved, sizeof( sv.resources[i].rguc_reserved ));
|
||||
|
|
|
@ -290,7 +290,7 @@ static void SV_EmitEvents( sv_client_t *cl, client_frame_t *to, sizebuf_t *msg )
|
|||
int count, ent_index;
|
||||
int i, j, ev;
|
||||
|
||||
Q_memset( &nullargs, 0, sizeof( nullargs ));
|
||||
memset( &nullargs, 0, sizeof( nullargs ));
|
||||
|
||||
es = &cl->events;
|
||||
|
||||
|
@ -369,7 +369,7 @@ static void SV_EmitEvents( sv_client_t *cl, client_frame_t *to, sizebuf_t *msg )
|
|||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteUBitLong( msg, info->packet_index, MAX_ENTITY_BITS );
|
||||
|
||||
if( !Q_memcmp( &nullargs, &info->args, sizeof( event_args_t )))
|
||||
if( !memcmp( &nullargs, &info->args, sizeof( event_args_t )))
|
||||
{
|
||||
MSG_WriteOneBit( msg, 0 );
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ void SV_WriteClientdataToMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
edict_t *clent;
|
||||
int i;
|
||||
|
||||
Q_memset( &nullcd, 0, sizeof( nullcd ));
|
||||
memset( &nullcd, 0, sizeof( nullcd ));
|
||||
|
||||
clent = cl->edict;
|
||||
frame = &cl->frames[cl->netchan.outgoing_sequence & SV_UPDATE_MASK];
|
||||
|
@ -478,7 +478,7 @@ void SV_WriteClientdataToMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
|
||||
clent->v.fixangle = 0; // reset fixangle
|
||||
clent->v.pushmsec = 0; // reset net framenum
|
||||
Q_memset( &frame->clientdata, 0, sizeof( frame->clientdata ));
|
||||
memset( &frame->clientdata, 0, sizeof( frame->clientdata ));
|
||||
|
||||
// update clientdata_t
|
||||
svgame.dllFuncs.pfnUpdateClientData( clent, cl->local_weapons, &frame->clientdata );
|
||||
|
@ -505,7 +505,7 @@ void SV_WriteClientdataToMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
|
||||
if( cl->local_weapons && svgame.dllFuncs.pfnGetWeaponData( clent, frame->weapondata ))
|
||||
{
|
||||
Q_memset( &nullwd, 0, sizeof( nullwd ));
|
||||
memset( &nullwd, 0, sizeof( nullwd ));
|
||||
|
||||
for( i = 0; i < 64; i++ )
|
||||
{
|
||||
|
@ -607,7 +607,7 @@ void SV_SendClientDatagram( sv_client_t *cl )
|
|||
svs.currentPlayer = cl;
|
||||
svs.currentPlayerNum = (cl - svs.clients);
|
||||
|
||||
Q_memset( msg_buf, 0, NET_MAX_PAYLOAD );
|
||||
memset( msg_buf, 0, NET_MAX_PAYLOAD );
|
||||
MSG_Init( &msg, "Datagram", msg_buf, sizeof( msg_buf ));
|
||||
|
||||
// always send servertime at new frame
|
||||
|
|
|
@ -609,7 +609,7 @@ void SV_WriteEntityPatch( const char *filename )
|
|||
f = FS_Open( va( "maps/%s.bsp", filename ), "rb", false );
|
||||
if( !f ) return;
|
||||
|
||||
Q_memset( buf, 0, MAX_SYSPATH );
|
||||
memset( buf, 0, MAX_SYSPATH );
|
||||
FS_Read( f, buf, MAX_SYSPATH );
|
||||
ver = *(uint *)buf;
|
||||
|
||||
|
@ -676,7 +676,7 @@ char *SV_ReadEntityScript( const char *filename, int *flags )
|
|||
|
||||
*flags |= MAP_IS_EXIST;
|
||||
|
||||
Q_memset( buf, 0, MAX_SYSPATH );
|
||||
memset( buf, 0, MAX_SYSPATH );
|
||||
FS_Read( f, buf, MAX_SYSPATH );
|
||||
ver = *(uint *)buf;
|
||||
|
||||
|
@ -820,7 +820,7 @@ void SV_InitEdict( edict_t *pEdict )
|
|||
ASSERT( pEdict );
|
||||
|
||||
SV_FreePrivateData( pEdict );
|
||||
Q_memset( &pEdict->v, 0, sizeof( entvars_t ));
|
||||
memset( &pEdict->v, 0, sizeof( entvars_t ));
|
||||
|
||||
// g-cont. trying to setup controllers here...
|
||||
pEdict->v.controller[0] = 0x7F;
|
||||
|
@ -961,7 +961,7 @@ void SV_PlaybackReliableEvent( sizebuf_t *msg, word eventindex, float delay, eve
|
|||
{
|
||||
event_args_t nullargs;
|
||||
|
||||
Q_memset( &nullargs, 0, sizeof( nullargs ));
|
||||
memset( &nullargs, 0, sizeof( nullargs ));
|
||||
|
||||
MSG_WriteByte( msg, svc_event_reliable );
|
||||
|
||||
|
@ -1056,7 +1056,7 @@ void SV_BaselineForEntity( edict_t *pEdict )
|
|||
}
|
||||
|
||||
// take current state as baseline
|
||||
Q_memset( &baseline, 0, sizeof( baseline ));
|
||||
memset( &baseline, 0, sizeof( baseline ));
|
||||
baseline.number = NUM_FOR_EDICT( pEdict );
|
||||
|
||||
svgame.dllFuncs.pfnCreateBaseline( player, baseline.number, &baseline, pEdict, modelindex, mins, maxs );
|
||||
|
@ -1473,7 +1473,7 @@ int SV_CheckClientPVS( int check, qboolean bMergePVS )
|
|||
VectorAdd( ent->v.origin, ent->v.view_ofs, view );
|
||||
leaf = Mod_PointInLeaf( view, sv.worldmodel->nodes );
|
||||
pvs = Mod_LeafPVS( leaf, sv.worldmodel );
|
||||
Q_memcpy( clientpvs, pvs, pvsbytes );
|
||||
memcpy( clientpvs, pvs, pvsbytes );
|
||||
|
||||
// transition in progress
|
||||
if( !cl ) return i;
|
||||
|
@ -3487,7 +3487,7 @@ void pfnRunPlayerMove( edict_t *pClient, const float *v_angle, float fmove, floa
|
|||
svs.currentPlayerNum = (svs.currentPlayer - svs.clients);
|
||||
svs.currentPlayer->timebase = (sv.time + host.frametime) - (msec / 1000.0f);
|
||||
|
||||
Q_memset( &cmd, 0, sizeof( cmd ));
|
||||
memset( &cmd, 0, sizeof( cmd ));
|
||||
if( v_angle ) VectorCopy( v_angle, cmd.viewangles );
|
||||
cmd.forwardmove = fmove;
|
||||
cmd.sidemove = smove;
|
||||
|
@ -3679,7 +3679,7 @@ void SV_PlaybackEventFull( int flags, const edict_t *pInvoker, word eventindex,
|
|||
return;
|
||||
}
|
||||
|
||||
Q_memset( &args, 0, sizeof( args ));
|
||||
memset( &args, 0, sizeof( args ));
|
||||
|
||||
if( origin && !VectorIsNull( origin ))
|
||||
{
|
||||
|
@ -3893,7 +3893,7 @@ byte *pfnSetFatPVS( const float *org )
|
|||
else VectorCopy( org, viewPos );
|
||||
|
||||
// build a new PVS frame
|
||||
Q_memset( bitvector, 0, fatbytes );
|
||||
memset( bitvector, 0, fatbytes );
|
||||
|
||||
SV_AddToFatPVS( viewPos, DVIS_PVS, sv.worldmodel->nodes );
|
||||
VectorCopy( viewPos, viewPoint[svs.currentPlayerNum] );
|
||||
|
@ -3945,7 +3945,7 @@ byte *pfnSetFatPAS( const float *org )
|
|||
else VectorCopy( org, viewPos );
|
||||
|
||||
// build a new PHS frame
|
||||
Q_memset( bitvector, 0, fatbytes );
|
||||
memset( bitvector, 0, fatbytes );
|
||||
|
||||
SV_AddToFatPVS( viewPos, DVIS_PHS, sv.worldmodel->nodes );
|
||||
}
|
||||
|
@ -4517,7 +4517,7 @@ static enginefuncs_t gEngfuncs =
|
|||
Cvar_DirectSet,
|
||||
pfnForceUnmodified,
|
||||
pfnGetPlayerStats,
|
||||
Cmd_AddGameCommand,
|
||||
Cmd_AddServerCommand,
|
||||
pfnVoice_GetClientListening,
|
||||
pfnVoice_SetClientListening,
|
||||
pfnGetPlayerAuthId,
|
||||
|
@ -4783,14 +4783,14 @@ void SV_UnloadProgs( void )
|
|||
|
||||
// must unlink all game cvars,
|
||||
// before pointers on them will be lost...
|
||||
Cmd_ExecuteString( "@unlink\n", src_command );
|
||||
Cmd_Unlink( CMD_EXTDLL );
|
||||
Cvar_Unlink( CVAR_SERVERDLL );
|
||||
Cmd_Unlink( CMD_SERVERDLL );
|
||||
|
||||
Mod_ResetStudioAPI ();
|
||||
|
||||
Com_FreeLibrary( svgame.hInstance );
|
||||
Mem_FreePool( &svgame.mempool );
|
||||
Q_memset( &svgame, 0, sizeof( svgame ));
|
||||
memset( &svgame, 0, sizeof( svgame ));
|
||||
}
|
||||
|
||||
qboolean SV_LoadProgs( const char *name )
|
||||
|
@ -4815,13 +4815,13 @@ qboolean SV_LoadProgs( const char *name )
|
|||
if( !svgame.hInstance ) return false;
|
||||
|
||||
// make sure what new dll functions is cleared
|
||||
Q_memset( &svgame.dllFuncs2, 0, sizeof( svgame.dllFuncs2 ));
|
||||
memset( &svgame.dllFuncs2, 0, sizeof( svgame.dllFuncs2 ));
|
||||
|
||||
// make sure what physic functions is cleared
|
||||
Q_memset( &svgame.physFuncs, 0, sizeof( svgame.physFuncs ));
|
||||
memset( &svgame.physFuncs, 0, sizeof( svgame.physFuncs ));
|
||||
|
||||
// make local copy of engfuncs to prevent overwrite it with bots.dll
|
||||
Q_memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
|
||||
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
|
||||
|
||||
GetEntityAPI = (APIFUNCTION)Com_GetProcAddress( svgame.hInstance, "GetEntityAPI" );
|
||||
GetEntityAPI2 = (APIFUNCTION2)Com_GetProcAddress( svgame.hInstance, "GetEntityAPI2" );
|
||||
|
@ -4856,7 +4856,7 @@ qboolean SV_LoadProgs( const char *name )
|
|||
{
|
||||
if( version != NEW_DLL_FUNCTIONS_VERSION )
|
||||
MsgDev( D_WARN, "SV_LoadProgs: new interface version %i should be %i\n", NEW_DLL_FUNCTIONS_VERSION, version );
|
||||
Q_memset( &svgame.dllFuncs2, 0, sizeof( svgame.dllFuncs2 ));
|
||||
memset( &svgame.dllFuncs2, 0, sizeof( svgame.dllFuncs2 ));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -325,7 +325,7 @@ void SV_ActivateServer( void )
|
|||
}
|
||||
|
||||
// invoke to refresh all movevars
|
||||
Q_memset( &svgame.oldmovevars, 0, sizeof( movevars_t ));
|
||||
memset( &svgame.oldmovevars, 0, sizeof( movevars_t ));
|
||||
svgame.globals->changelevel = false; // changelevel ends here
|
||||
|
||||
// setup hostflags
|
||||
|
@ -492,7 +492,7 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot )
|
|||
if( sv.state == ss_dead )
|
||||
SV_InitGame(); // the game is just starting
|
||||
else if( !sv_maxclients->modified )
|
||||
Cmd_ExecuteString( "latch\n", src_command );
|
||||
Cmd_ExecuteString( "latch\n" );
|
||||
else MsgDev( D_ERROR, "SV_SpawnServer: while 'maxplayers' was modified.\n" );
|
||||
|
||||
sv_maxclients->modified = false;
|
||||
|
@ -518,7 +518,7 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot )
|
|||
|
||||
sv.state = ss_dead;
|
||||
Host_SetServerState( sv.state );
|
||||
Q_memset( &sv, 0, sizeof( sv )); // wipe the entire per-level structure
|
||||
memset( &sv, 0, sizeof( sv )); // wipe the entire per-level structure
|
||||
|
||||
// restore state
|
||||
sv.paused = paused;
|
||||
|
@ -631,7 +631,7 @@ void SV_InitGame( void )
|
|||
}
|
||||
|
||||
// now apply latched commands
|
||||
Cmd_ExecuteString( "latch\n", src_command );
|
||||
Cmd_ExecuteString( "latch\n" );
|
||||
|
||||
if( Cvar_VariableValue( "coop" ) && Cvar_VariableValue ( "deathmatch" ) && Cvar_VariableValue( "teamplay" ))
|
||||
{
|
||||
|
|
|
@ -256,7 +256,7 @@ void SV_UpdateMovevars( qboolean initialize )
|
|||
if( initialize ) return; // too early
|
||||
|
||||
if( MSG_WriteDeltaMovevars( &sv.reliable_datagram, &svgame.oldmovevars, &svgame.movevars ))
|
||||
Q_memcpy( &svgame.oldmovevars, &svgame.movevars, sizeof( movevars_t )); // oldstate changed
|
||||
memcpy( &svgame.oldmovevars, &svgame.movevars, sizeof( movevars_t )); // oldstate changed
|
||||
|
||||
physinfo->modified = false;
|
||||
}
|
||||
|
@ -885,7 +885,7 @@ void SV_Shutdown( qboolean reconnect )
|
|||
else SV_DeactivateServer ();
|
||||
|
||||
// free current level
|
||||
Q_memset( &sv, 0, sizeof( sv ));
|
||||
memset( &sv, 0, sizeof( sv ));
|
||||
Host_SetServerState( sv.state );
|
||||
|
||||
// free server static data
|
||||
|
|
|
@ -1981,7 +1981,7 @@ qboolean SV_InitPhysicsAPI( void )
|
|||
}
|
||||
|
||||
// make sure what physic functions is cleared
|
||||
Q_memset( &svgame.physFuncs, 0, sizeof( svgame.physFuncs ));
|
||||
memset( &svgame.physFuncs, 0, sizeof( svgame.physFuncs ));
|
||||
|
||||
return false; // just tell user about problems
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ void SV_ClearPhysEnts( void )
|
|||
|
||||
void SV_ConvertPMTrace( trace_t *out, pmtrace_t *in, edict_t *ent )
|
||||
{
|
||||
Q_memcpy( out, in, 48 ); // matched
|
||||
memcpy( out, in, 48 ); // matched
|
||||
out->hitgroup = in->hitgroup;
|
||||
out->ent = ent;
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ qboolean SV_CopyEdictToPhysEnt( physent_t *pe, edict_t *ed )
|
|||
pe->frame = ed->v.frame;
|
||||
pe->sequence = ed->v.sequence;
|
||||
|
||||
Q_memcpy( &pe->controller[0], &ed->v.controller[0], 4 * sizeof( byte ));
|
||||
Q_memcpy( &pe->blending[0], &ed->v.blending[0], 2 * sizeof( byte ));
|
||||
memcpy( &pe->controller[0], &ed->v.controller[0], 4 * sizeof( byte ));
|
||||
memcpy( &pe->blending[0], &ed->v.blending[0], 2 * sizeof( byte ));
|
||||
|
||||
pe->movetype = ed->v.movetype;
|
||||
pe->takedamage = ed->v.takedamage;
|
||||
|
@ -570,8 +570,8 @@ void SV_InitClientMove( void )
|
|||
svgame.player_maxs[i][0], svgame.player_maxs[i][1], svgame.player_maxs[i][2] );
|
||||
}
|
||||
|
||||
Q_memcpy( svgame.pmove->player_mins, svgame.player_mins, sizeof( svgame.player_mins ));
|
||||
Q_memcpy( svgame.pmove->player_maxs, svgame.player_maxs, sizeof( svgame.player_maxs ));
|
||||
memcpy( svgame.pmove->player_mins, svgame.player_mins, sizeof( svgame.player_mins ));
|
||||
memcpy( svgame.pmove->player_maxs, svgame.player_maxs, sizeof( svgame.player_maxs ));
|
||||
|
||||
// common utilities
|
||||
svgame.pmove->PM_Info_ValueForKey = Info_ValueForKey;
|
||||
|
@ -815,7 +815,7 @@ void SV_SetupMoveInterpolant( sv_client_t *cl )
|
|||
sv_client_t *check;
|
||||
sv_interp_t *lerp;
|
||||
|
||||
Q_memset( svgame.interp, 0, sizeof( svgame.interp ));
|
||||
memset( svgame.interp, 0, sizeof( svgame.interp ));
|
||||
has_update = false;
|
||||
|
||||
// don't allow unlag in singleplayer
|
||||
|
@ -900,7 +900,7 @@ void SV_SetupMoveInterpolant( sv_client_t *cl )
|
|||
|
||||
if( i == SV_UPDATE_BACKUP || finalpush - frame->senttime > 1.0 )
|
||||
{
|
||||
Q_memset( svgame.interp, 0, sizeof( svgame.interp ));
|
||||
memset( svgame.interp, 0, sizeof( svgame.interp ));
|
||||
has_update = false;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ qboolean SaveRestore_Write( SAVERESTOREDATA *pSaveData, const void *pData, int n
|
|||
return false;
|
||||
}
|
||||
|
||||
Q_memcpy( pSaveData->pCurrentData, pData, nBytes );
|
||||
memcpy( pSaveData->pCurrentData, pData, nBytes );
|
||||
SaveRestore_MoveCurPos( pSaveData, nBytes );
|
||||
|
||||
return true;
|
||||
|
@ -249,7 +249,7 @@ qboolean SaveRestore_Read( SAVERESTOREDATA *pSaveData, void *pOutput, int nBytes
|
|||
return false;
|
||||
}
|
||||
|
||||
if( pOutput ) Q_memcpy( pOutput, pSaveData->pCurrentData, nBytes );
|
||||
if( pOutput ) memcpy( pOutput, pSaveData->pCurrentData, nBytes );
|
||||
SaveRestore_MoveCurPos( pSaveData, nBytes );
|
||||
|
||||
return true;
|
||||
|
@ -974,7 +974,7 @@ void SV_ParseSaveTables( SAVERESTOREDATA *pSaveData, SAVE_HEADER *pHeader, int s
|
|||
}
|
||||
|
||||
if( setupLightstyles )
|
||||
Q_memset( sv.lightstyles, 0, sizeof( sv.lightstyles ));
|
||||
memset( sv.lightstyles, 0, sizeof( sv.lightstyles ));
|
||||
|
||||
for( i = 0; i < pHeader->lightStyleCount; i++ )
|
||||
{
|
||||
|
@ -1083,7 +1083,7 @@ void SV_SaveClientState( SAVERESTOREDATA *pSaveData, const char *level )
|
|||
FS_Write( pFile, &id, sizeof( int ));
|
||||
FS_Write( pFile, &version, sizeof( int ));
|
||||
|
||||
Q_memset( §ions, -1, sizeof( sections ));
|
||||
memset( §ions, -1, sizeof( sections ));
|
||||
header_offset = FS_Tell( pFile ); // save header offset
|
||||
|
||||
// write offsets (will be merged later)
|
||||
|
@ -1321,7 +1321,7 @@ void SV_LoadClientState( SAVERESTOREDATA *pSaveData, const char *level, qboolean
|
|||
FS_Read( pFile, &sv.num_static_entities, sizeof( int ));
|
||||
|
||||
// clear old entities
|
||||
Q_memset( sv.static_entities, 0, sizeof( sv.static_entities ));
|
||||
memset( sv.static_entities, 0, sizeof( sv.static_entities ));
|
||||
|
||||
for( i = 0; i < sv.num_static_entities; i++ )
|
||||
{
|
||||
|
@ -1815,7 +1815,7 @@ void SV_LoadAdjacentEnts( const char *pOldLevel, const char *pLandmarkName )
|
|||
qboolean foundprevious = false;
|
||||
vec3_t landmarkOrigin;
|
||||
|
||||
Q_memset( ¤tLevelData, 0, sizeof( SAVERESTOREDATA ));
|
||||
memset( ¤tLevelData, 0, sizeof( SAVERESTOREDATA ));
|
||||
svgame.globals->pSaveData = ¤tLevelData;
|
||||
|
||||
// build the adjacent map list
|
||||
|
|
|
@ -423,7 +423,7 @@ void SV_ClearWorld( void )
|
|||
sv.lightstyles[i].time = 0.0f;
|
||||
}
|
||||
|
||||
Q_memset( sv_areanodes, 0, sizeof( sv_areanodes ));
|
||||
memset( sv_areanodes, 0, sizeof( sv_areanodes ));
|
||||
iTouchLinkSemaphore = 0;
|
||||
sv_numareanodes = 0;
|
||||
|
||||
|
@ -625,7 +625,7 @@ void SV_LinkEdict( edict_t *ent, qboolean touch_triggers )
|
|||
{
|
||||
ent->headnode = ent->v.aiment->headnode;
|
||||
ent->num_leafs = ent->v.aiment->num_leafs;
|
||||
Q_memcpy( ent->leafnums, ent->v.aiment->leafnums, sizeof( ent->leafnums ));
|
||||
memcpy( ent->leafnums, ent->v.aiment->leafnums, sizeof( ent->leafnums ));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -639,7 +639,7 @@ void SV_LinkEdict( edict_t *ent, qboolean touch_triggers )
|
|||
|
||||
if( ent->num_leafs > MAX_ENT_LEAFS )
|
||||
{
|
||||
Q_memset( ent->leafnums, -1, sizeof( ent->leafnums ));
|
||||
memset( ent->leafnums, -1, sizeof( ent->leafnums ));
|
||||
ent->num_leafs = 0; // so we use headnode instead
|
||||
ent->headnode = headnode;
|
||||
}
|
||||
|
@ -962,7 +962,7 @@ void SV_ClipMoveToEntity( edict_t *ent, const vec3_t start, vec3_t mins, vec3_t
|
|||
qboolean rotated, transform_bbox;
|
||||
matrix4x4 matrix;
|
||||
|
||||
Q_memset( trace, 0, sizeof( trace_t ));
|
||||
memset( trace, 0, sizeof( trace_t ));
|
||||
VectorCopy( end, trace->endpos );
|
||||
trace->fraction = 1.0f;
|
||||
trace->allsolid = 1;
|
||||
|
@ -1036,7 +1036,7 @@ void SV_ClipMoveToEntity( edict_t *ent, const vec3_t start, vec3_t mins, vec3_t
|
|||
|
||||
for( i = 0; i < hullcount; i++ )
|
||||
{
|
||||
Q_memset( &trace_hitbox, 0, sizeof( trace_t ));
|
||||
memset( &trace_hitbox, 0, sizeof( trace_t ));
|
||||
VectorCopy( end, trace_hitbox.endpos );
|
||||
trace_hitbox.fraction = 1.0;
|
||||
trace_hitbox.allsolid = 1;
|
||||
|
@ -1090,7 +1090,7 @@ or custom physics implementation
|
|||
*/
|
||||
void SV_CustomClipMoveToEntity( edict_t *ent, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, trace_t *trace )
|
||||
{
|
||||
Q_memset( trace, 0, sizeof( trace_t ));
|
||||
memset( trace, 0, sizeof( trace_t ));
|
||||
VectorCopy( end, trace->endpos );
|
||||
trace->allsolid = true;
|
||||
trace->fraction = 1.0f;
|
||||
|
@ -1270,7 +1270,7 @@ trace_t SV_Move( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end,
|
|||
vec3_t trace_endpos;
|
||||
float trace_fraction;
|
||||
|
||||
Q_memset( &clip, 0, sizeof( moveclip_t ));
|
||||
memset( &clip, 0, sizeof( moveclip_t ));
|
||||
SV_ClipMoveToEntity( EDICT_NUM( 0 ), start, mins, maxs, end, &clip.trace );
|
||||
|
||||
if( clip.trace.fraction != 0.0f )
|
||||
|
@ -1320,7 +1320,7 @@ trace_t SV_MoveNoEnts( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_
|
|||
vec3_t trace_endpos;
|
||||
float trace_fraction;
|
||||
|
||||
Q_memset( &clip, 0, sizeof( moveclip_t ));
|
||||
memset( &clip, 0, sizeof( moveclip_t ));
|
||||
SV_ClipMoveToEntity( EDICT_NUM( 0 ), start, mins, maxs, end, &clip.trace );
|
||||
|
||||
if( clip.trace.fraction != 0.0f )
|
||||
|
|
|
@ -1596,7 +1596,6 @@ void UI_Shutdown( void )
|
|||
Cmd_RemoveCommand( "menu_defaults" );
|
||||
Cmd_RemoveCommand( "menu_cinematics" );
|
||||
Cmd_RemoveCommand( "menu_customgame" );
|
||||
Cmd_RemoveCommand( "menu_quit" );
|
||||
|
||||
memset( &uiStatic, 0, sizeof( uiStatic_t ));
|
||||
}
|
||||
|
|
Reference in New Issue