15 Nov 2016
This commit is contained in:
parent
7aef3bf258
commit
8bc12edbac
|
@ -25,5 +25,6 @@ GNU General Public License for more details.
|
|||
#define ENGINE_COMPENSATE_QUAKE_BUG (1<<5) // compensate stupid quake bug (inverse pitch) for mods where this bug is fixed
|
||||
#define ENGINE_DISABLE_HDTEXTURES (1<<6) // disable support of HD-textures in case custom renderer have separate way to load them
|
||||
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
|
||||
#define ENGINE_FIXED_FRAMERATE (1<<8) // keep constant rate for client and server (but don't clamp renderer calls)
|
||||
|
||||
#endif//FEATURES_H
|
|
@ -104,10 +104,12 @@ typedef enum
|
|||
TF_STATIC = (1<<21), // obsolete (not used)
|
||||
TF_TEXTURE_RECTANGLE= (1<<22), // this is GL_TEXTURE_RECTANGLE
|
||||
|
||||
TF_DXT_FORMAT = (1<<23), // internal flag who indicated DXT-compressed texture
|
||||
TF_TEXTURE_2D_ARRAY = (1<<24), // this is 2D texture array (multi-layers)
|
||||
TF_IMG_UPLOADED = (1<<25), // this is set for first time when called glTexImage, otherwise it will be call glTexSubImage
|
||||
TF_ARB_FLOAT = (1<<26), // float textures
|
||||
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
|
||||
TF_ARB_16BIT = (1<<28), // keep image as 16-bit (not 24)
|
||||
} texFlags_t;
|
||||
|
||||
typedef struct beam_s BEAM;
|
||||
|
|
|
@ -64,6 +64,8 @@ typedef struct cldll_func_s
|
|||
// Xash3D extension
|
||||
int (*pfnGetRenderInterface)( int version, render_api_t *renderfuncs, render_interface_t *callback );
|
||||
void (*pfnClipMoveToEntity)( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr );
|
||||
void (*pfnUpdateEntityState)( cl_entity_t *ent, entity_state_t *newstate, int noInterp ); // custom interp
|
||||
void (*pfnInterpolateEntity)( cl_entity_t *ent );
|
||||
} cldll_func_t;
|
||||
|
||||
#endif//CDLL_EXP_H
|
|
@ -30,7 +30,7 @@ GNU General Public License for more details.
|
|||
#define DEMO_NORMAL 1 // this lump contains playback info of messages, etc., needed during playback.
|
||||
|
||||
#define IDEMOHEADER (('M'<<24)+('E'<<16)+('D'<<8)+'I') // little-endian "IDEM"
|
||||
#define DEMO_PROTOCOL 1
|
||||
#define DEMO_PROTOCOL 2
|
||||
|
||||
const char *demo_cmd[dem_lastcmd+1] =
|
||||
{
|
||||
|
@ -49,6 +49,7 @@ typedef struct
|
|||
int dem_protocol; // should be DEMO_PROTOCOL
|
||||
int net_protocol; // should be PROTOCOL_VERSION
|
||||
char mapname[64]; // name of map
|
||||
char comment[64]; // comment for demo
|
||||
char gamedir[64]; // name of game directory (FS_Gamedir())
|
||||
int directory_offset; // offset of Entry Directory.
|
||||
} demoheader_t;
|
||||
|
@ -68,6 +69,13 @@ typedef struct
|
|||
int numentries; // number of tracks
|
||||
} demodirectory_t;
|
||||
|
||||
// add angles
|
||||
typedef struct
|
||||
{
|
||||
float starttime;
|
||||
vec3_t viewangles;
|
||||
} demoangle_t;
|
||||
|
||||
// private demo states
|
||||
struct
|
||||
{
|
||||
|
@ -77,7 +85,13 @@ struct
|
|||
int framecount;
|
||||
float starttime;
|
||||
float realstarttime;
|
||||
float timestamp;
|
||||
float lasttime;
|
||||
int entryIndex;
|
||||
|
||||
// interpolation stuff
|
||||
demoangle_t cmds[ANGLE_BACKUP];
|
||||
int angle_position;
|
||||
} demo;
|
||||
|
||||
/*
|
||||
|
@ -209,10 +223,10 @@ void CL_WriteDemoUserCmd( int cmdnumber )
|
|||
FS_Write( cls.demofile, &cmdnumber, sizeof( int ));
|
||||
|
||||
// write usercmd_t
|
||||
BF_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||
CL_WriteUsercmd( &buf, -1, cmdnumber ); // always no delta
|
||||
|
||||
bytes = BF_GetNumBytesWritten( &buf );
|
||||
bytes = MSG_GetNumBytesWritten( &buf );
|
||||
|
||||
FS_Write( cls.demofile, &bytes, sizeof( word ));
|
||||
FS_Write( cls.demofile, data, bytes );
|
||||
|
@ -258,14 +272,10 @@ void CL_WriteDemoMessage( qboolean startup, int start, sizebuf_t *msg )
|
|||
if( !startup && !cls.demorecording )
|
||||
return;
|
||||
|
||||
swlen = BF_GetNumBytesWritten( msg ) - start;
|
||||
swlen = MSG_GetNumBytesWritten( msg ) - start;
|
||||
if( swlen <= 0 ) return;
|
||||
|
||||
if( !startup )
|
||||
{
|
||||
cls.demotime += host.frametime;
|
||||
demo.framecount++;
|
||||
}
|
||||
if( !startup ) demo.framecount++;
|
||||
|
||||
// demo playback should read this as an incoming message.
|
||||
c = (cls.state != ca_active) ? dem_norewind : dem_read;
|
||||
|
@ -277,7 +287,7 @@ void CL_WriteDemoMessage( qboolean startup, int start, sizebuf_t *msg )
|
|||
FS_Write( file, &swlen, sizeof( int ));
|
||||
|
||||
// output the buffer. Skip the network packet stuff.
|
||||
FS_Write( file, BF_GetData( msg ) + start, swlen );
|
||||
FS_Write( file, MSG_GetData( msg ) + start, swlen );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -313,9 +323,9 @@ Write demo header
|
|||
*/
|
||||
void CL_WriteDemoHeader( const char *name )
|
||||
{
|
||||
fs_offset_t copysize;
|
||||
fs_offset_t savepos;
|
||||
fs_offset_t curpos;
|
||||
long copysize;
|
||||
long savepos;
|
||||
long curpos;
|
||||
|
||||
MsgDev( D_INFO, "recording to %s.\n", name );
|
||||
cls.demofile = FS_Open( name, "wb", false );
|
||||
|
@ -336,6 +346,7 @@ void CL_WriteDemoHeader( const char *name )
|
|||
demo.header.dem_protocol = DEMO_PROTOCOL;
|
||||
demo.header.net_protocol = PROTOCOL_VERSION;
|
||||
Q_strncpy( demo.header.mapname, clgame.mapname, sizeof( demo.header.mapname ));
|
||||
Q_strncpy( demo.header.comment, clgame.maptitle, sizeof( demo.header.comment ));
|
||||
Q_strncpy( demo.header.gamedir, FS_Gamedir(), sizeof( demo.header.gamedir ));
|
||||
|
||||
// write header
|
||||
|
@ -420,9 +431,7 @@ void CL_StopRecord( void )
|
|||
FS_Write( cls.demofile, &demo.directory.numentries, sizeof( int ));
|
||||
|
||||
for( i = 0; i < demo.directory.numentries; i++ )
|
||||
{
|
||||
FS_Write( cls.demofile, &demo.directory.entries[i], sizeof( demoentry_t ));
|
||||
}
|
||||
|
||||
Mem_Free( demo.directory.entries );
|
||||
demo.directory.numentries = 0;
|
||||
|
@ -438,7 +447,7 @@ void CL_StopRecord( void )
|
|||
menu.globals->demoname[0] = '\0';
|
||||
|
||||
Msg( "Completed demo\n" );
|
||||
MsgDev( D_INFO, "Recording time %.2f\n", cls.demotime );
|
||||
MsgDev( D_INFO, "Recording time: %02d:%02d", (int)(cls.demotime / 60.0f ), (int)fmod( cls.demotime, 60.0f ));
|
||||
cls.demotime = 0.0;
|
||||
}
|
||||
|
||||
|
@ -451,14 +460,15 @@ void CL_DrawDemoRecording( void )
|
|||
{
|
||||
char string[64];
|
||||
rgba_t color = { 255, 255, 255, 255 };
|
||||
fs_offset_t pos;
|
||||
long pos;
|
||||
int len;
|
||||
|
||||
if(!( host.developer && cls.demorecording ))
|
||||
return;
|
||||
|
||||
pos = FS_Tell( cls.demofile );
|
||||
Q_snprintf( string, sizeof( string ), "RECORDING %s: %ik", cls.demoname, pos / 1024 );
|
||||
Q_snprintf( string, sizeof( string ), "^1RECORDING:^7 %s: %s time: %02d:%02d", cls.demoname,
|
||||
Q_memprint( pos ), (int)(cls.demotime / 60.0f ), (int)fmod( cls.demotime, 60.0f ));
|
||||
|
||||
Con_DrawStringLen( string, &len, NULL );
|
||||
Con_DrawString(( scr_width->integer - len) >> 1, scr_height->integer >> 2, string, color );
|
||||
|
@ -513,9 +523,10 @@ void CL_ReadDemoUserCmd( qboolean discard )
|
|||
{
|
||||
usercmd_t nullcmd;
|
||||
sizebuf_t buf;
|
||||
demoangle_t *a;
|
||||
|
||||
Q_memset( &nullcmd, 0, sizeof( nullcmd ));
|
||||
BF_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||
|
||||
pcmd = &cl.commands[cmdnumber & CL_UPDATE_MASK];
|
||||
pcmd->processedfuncs = false;
|
||||
|
@ -530,6 +541,20 @@ void CL_ReadDemoUserCmd( qboolean discard )
|
|||
|
||||
MSG_ReadDeltaUsercmd( &buf, &nullcmd, cl.refdef.cmd );
|
||||
|
||||
// make sure what interp info contain angles from different frames
|
||||
// or lerping will stop working
|
||||
if( demo.lasttime != demo.timestamp )
|
||||
{
|
||||
// select entry into circular buffer
|
||||
demo.angle_position = (demo.angle_position + 1) & ANGLE_MASK;
|
||||
a = &demo.cmds[demo.angle_position];
|
||||
|
||||
// record update
|
||||
a->starttime = demo.timestamp;
|
||||
VectorCopy( cl.refdef.cmd->viewangles, a->viewangles );
|
||||
demo.lasttime = demo.timestamp;
|
||||
}
|
||||
|
||||
// NOTE: we need to have the current outgoing sequence correct
|
||||
// so we can do prediction correctly during playback
|
||||
cls.netchan.outgoing_sequence = outgoing_sequence;
|
||||
|
@ -674,7 +699,6 @@ reads demo data and write it to client
|
|||
*/
|
||||
qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
||||
{
|
||||
float f = 0.0f;
|
||||
long curpos = 0;
|
||||
float fElapsedTime = 0.0f;
|
||||
qboolean swallowmessages = true;
|
||||
|
@ -690,8 +714,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
|||
}
|
||||
|
||||
// HACKHACK: changedemo issues
|
||||
if( !cls.netchan.remote_address.type )
|
||||
cls.netchan.remote_address.type = NA_LOOPBACK;
|
||||
if( !cls.netchan.remote_address.type ) cls.netchan.remote_address.type = NA_LOOPBACK;
|
||||
|
||||
if(( !cl.background && ( cl.refdef.paused || cls.key_dest != key_game )) || cls.key_dest == key_console )
|
||||
{
|
||||
|
@ -706,16 +729,14 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
|||
if( !cls.demofile ) break;
|
||||
curpos = FS_Tell( cls.demofile );
|
||||
|
||||
CL_ReadDemoCmdHeader( &cmd, &f );
|
||||
CL_ReadDemoCmdHeader( &cmd, &demo.timestamp );
|
||||
|
||||
fElapsedTime = CL_GetDemoPlaybackClock() - demo.starttime;
|
||||
bSkipMessage = (f >= fElapsedTime) ? true : false;
|
||||
|
||||
if( cls.changelevel )
|
||||
demo.framecount = 1;
|
||||
bSkipMessage = ((demo.timestamp - cl_serverframetime()) >= fElapsedTime) ? true : false;
|
||||
if( cls.changelevel ) demo.framecount = 1;
|
||||
|
||||
// HACKHACK: changelevel issues
|
||||
if( demo.framecount <= 10 && ( fElapsedTime - f ) > host.frametime )
|
||||
if( demo.framecount <= 2 && ( fElapsedTime - demo.timestamp ) > host.frametime )
|
||||
demo.starttime = CL_GetDemoPlaybackClock();
|
||||
|
||||
// not ready for a message yet, put it back on the file.
|
||||
|
@ -778,6 +799,79 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
|||
return CL_ReadRawNetworkData( buffer, length );
|
||||
}
|
||||
|
||||
void CL_DemoFindInterpolatedViewAngles( float t, float *frac, demoangle_t **prev, demoangle_t **next )
|
||||
{
|
||||
int i, i0, i1, imod;
|
||||
float at;
|
||||
|
||||
imod = demo.angle_position - 1;
|
||||
i0 = (imod + 1) & HISTORY_MASK;
|
||||
i1 = (imod + 0) & HISTORY_MASK;
|
||||
|
||||
if( demo.cmds[i0].starttime >= t )
|
||||
{
|
||||
for( i = 0; i < ANGLE_BACKUP - 2; i++ )
|
||||
{
|
||||
at = demo.cmds[imod & ANGLE_MASK].starttime;
|
||||
if( at == 0.0f ) break;
|
||||
|
||||
if( at < t )
|
||||
{
|
||||
i0 = (imod + 1) & ANGLE_MASK;
|
||||
i1 = (imod + 0) & ANGLE_MASK;
|
||||
break;
|
||||
}
|
||||
imod--;
|
||||
}
|
||||
}
|
||||
|
||||
*next = &demo.cmds[i0];
|
||||
*prev = &demo.cmds[i1];
|
||||
|
||||
// avoid division by zero (probably this should never happens)
|
||||
if((*prev)->starttime == (*next)->starttime )
|
||||
{
|
||||
*prev = *next;
|
||||
*frac = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
// time spans the two entries
|
||||
*frac = ( t - (*prev)->starttime ) / ((*next)->starttime - (*prev)->starttime );
|
||||
*frac = bound( 0.0f, *frac, 1.0f );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CL_DemoInterpolateAngles
|
||||
|
||||
We can predict or inpolate player movement with standed client code
|
||||
but viewangles interpolate here
|
||||
==============
|
||||
*/
|
||||
void CL_DemoInterpolateAngles( void )
|
||||
{
|
||||
float curtime = (CL_GetDemoPlaybackClock() - demo.starttime) - host.frametime;
|
||||
demoangle_t *prev = NULL, *next = NULL;
|
||||
float frac = 0.0f;
|
||||
|
||||
if( curtime > demo.timestamp )
|
||||
curtime = demo.timestamp; // don't run too far
|
||||
|
||||
CL_DemoFindInterpolatedViewAngles( curtime, &frac, &prev, &next );
|
||||
|
||||
if( prev && next )
|
||||
{
|
||||
vec4_t q, q1, q2;
|
||||
|
||||
AngleQuaternion( next->viewangles, q1, false );
|
||||
AngleQuaternion( prev->viewangles, q2, false );
|
||||
QuaternionSlerp( q2, q1, frac, q );
|
||||
QuaternionAngle( q, cl.refdef.cl_viewangles );
|
||||
}
|
||||
else VectorCopy( cl.refdef.cmd->viewangles, cl.refdef.cl_viewangles );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CL_StopPlayback
|
||||
|
@ -804,16 +898,21 @@ void CL_StopPlayback( void )
|
|||
cls.demoname[0] = '\0'; // clear demoname too
|
||||
menu.globals->demoname[0] = '\0';
|
||||
|
||||
if( cls.changedemo )
|
||||
{
|
||||
S_StopAllSounds();
|
||||
S_StopBackgroundTrack();
|
||||
|
||||
if( !cls.changedemo )
|
||||
}
|
||||
else
|
||||
{
|
||||
// let game known about demo state
|
||||
Cvar_FullSet( "cl_background", "0", CVAR_READ_ONLY );
|
||||
cls.state = ca_disconnected;
|
||||
cl.background = 0;
|
||||
cls.connect_time = 0;
|
||||
cls.demonum = -1;
|
||||
|
||||
// and finally clear the state
|
||||
CL_ClearState ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -876,7 +975,7 @@ qboolean CL_GetComment( const char *demoname, char *comment )
|
|||
|
||||
// split comment to sections
|
||||
Q_strncpy( comment, demohdr.mapname, CS_SIZE );
|
||||
Q_strncpy( comment + CS_SIZE, "<No Title>", CS_SIZE ); // TODO: write titles or somewhat
|
||||
Q_strncpy( comment + CS_SIZE, demohdr.comment, CS_SIZE );
|
||||
Q_strncpy( comment + CS_SIZE * 2, va( "%g sec", playtime ), CS_TIME );
|
||||
|
||||
// all done
|
||||
|
@ -889,8 +988,7 @@ qboolean CL_GetComment( const char *demoname, char *comment )
|
|||
==================
|
||||
CL_NextDemo
|
||||
|
||||
Called when a demo or cinematic finishes
|
||||
If the "nextdemo" cvar is set, that command will be issued
|
||||
Called when a demo finishes
|
||||
==================
|
||||
*/
|
||||
qboolean CL_NextDemo( void )
|
||||
|
@ -1086,14 +1184,11 @@ void CL_PlayDemo_f( void )
|
|||
|
||||
if( demo.header.net_protocol != PROTOCOL_VERSION || demo.header.dem_protocol != DEMO_PROTOCOL )
|
||||
{
|
||||
MsgDev( D_ERROR, "demo protocol outdated\n"
|
||||
"Demo file protocols Network(%i), Demo(%i)\n"
|
||||
"Server protocol is at Network(%i), Demo(%i)\n",
|
||||
demo.header.net_protocol,
|
||||
demo.header.dem_protocol,
|
||||
PROTOCOL_VERSION,
|
||||
DEMO_PROTOCOL
|
||||
);
|
||||
if( demo.header.dem_protocol != DEMO_PROTOCOL )
|
||||
MsgDev( D_ERROR, "playdemo: demo protocol outdated (%i should be %i)\n", demo.header.dem_protocol, DEMO_PROTOCOL );
|
||||
|
||||
if( demo.header.net_protocol != PROTOCOL_VERSION )
|
||||
MsgDev( D_ERROR, "playdemo: net protocol outdated (%i should be %i)\n", demo.header.net_protocol, PROTOCOL_VERSION );
|
||||
|
||||
FS_Close( cls.demofile );
|
||||
cls.demofile = NULL;
|
||||
|
@ -1154,9 +1249,12 @@ 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 ));
|
||||
demo.angle_position = 1;
|
||||
demo.framecount = 0;
|
||||
cls.lastoutgoingcommand = -1;
|
||||
cls.nextcmdtime = host.realtime;
|
||||
cl.last_command_ack = -1;
|
||||
|
||||
// g-cont. is this need?
|
||||
Q_strncpy( cls.servername, demoname, sizeof( cls.servername ));
|
||||
|
|
|
@ -142,7 +142,7 @@ qboolean CL_FireEvent( event_info_t *ei )
|
|||
|
||||
if( !ev )
|
||||
{
|
||||
idx = bound( 1, ei->index, MAX_EVENTS );
|
||||
idx = bound( 1, ei->index, ( MAX_EVENTS - 1 ));
|
||||
MsgDev( D_ERROR, "CL_FireEvent: %s not precached\n", cl.event_precache[idx] );
|
||||
break;
|
||||
}
|
||||
|
@ -173,10 +173,9 @@ called right before draw frame
|
|||
*/
|
||||
void CL_FireEvents( void )
|
||||
{
|
||||
int i;
|
||||
event_state_t *es;
|
||||
event_info_t *ei;
|
||||
qboolean success;
|
||||
int i;
|
||||
|
||||
es = &cl.events;
|
||||
|
||||
|
@ -191,7 +190,7 @@ void CL_FireEvents( void )
|
|||
if( ei->fire_time && ( ei->fire_time > cl.time ))
|
||||
continue;
|
||||
|
||||
success = CL_FireEvent( ei );
|
||||
CL_FireEvent( ei );
|
||||
|
||||
// zero out the remaining fields
|
||||
CL_ResetEvent( ei );
|
||||
|
@ -302,10 +301,10 @@ void CL_ParseReliableEvent( sizebuf_t *msg )
|
|||
|
||||
Q_memset( &nullargs, 0, sizeof( nullargs ));
|
||||
|
||||
event_index = BF_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
|
||||
if( BF_ReadOneBit( msg ))
|
||||
delay = (float)BF_ReadWord( msg ) * (1.0f / 100.0f);
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);
|
||||
|
||||
// reliable events not use delta-compression just null-compression
|
||||
MSG_ReadDeltaEvent( msg, &nullargs, &args );
|
||||
|
@ -343,20 +342,20 @@ void CL_ParseEvent( sizebuf_t *msg )
|
|||
|
||||
Q_memset( &nullargs, 0, sizeof( nullargs ));
|
||||
|
||||
num_events = BF_ReadUBitLong( msg, 5 );
|
||||
num_events = MSG_ReadUBitLong( msg, 5 );
|
||||
|
||||
// parse events queue
|
||||
for( i = 0 ; i < num_events; i++ )
|
||||
{
|
||||
event_index = BF_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
Q_memset( &args, 0, sizeof( args ));
|
||||
has_update = false;
|
||||
|
||||
if( BF_ReadOneBit( msg ))
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
{
|
||||
packet_ent = BF_ReadUBitLong( msg, MAX_ENTITY_BITS );
|
||||
packet_ent = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
|
||||
|
||||
if( BF_ReadOneBit( msg ))
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
{
|
||||
MSG_ReadDeltaEvent( msg, &nullargs, &args );
|
||||
has_update = true;
|
||||
|
@ -421,8 +420,8 @@ void CL_ParseEvent( sizebuf_t *msg )
|
|||
VectorCopy( pEnt->curstate.velocity, args.velocity );
|
||||
}
|
||||
|
||||
if( BF_ReadOneBit( msg ))
|
||||
delay = (float)BF_ReadWord( msg ) * (1.0f / 100.0f);
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);
|
||||
else delay = 0.0f;
|
||||
|
||||
// g-cont. should we need find the event with same index?
|
||||
|
|
|
@ -38,7 +38,7 @@ qboolean CL_IsPredicted( void )
|
|||
if( !cl_predict->integer || !cl.frame.valid || cl.background )
|
||||
return false;
|
||||
|
||||
if(( cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged ) >= ( CL_UPDATE_BACKUP - 1 ))
|
||||
if( !cl.validsequence || ( cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged ) >= CL_UPDATE_MASK )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -131,6 +131,8 @@ int CL_InterpolateModel( cl_entity_t *e )
|
|||
VectorCopy( e->curstate.origin, e->origin );
|
||||
VectorCopy( e->curstate.angles, e->angles );
|
||||
|
||||
if( cl.first_frame ) return 0;
|
||||
|
||||
if( !e->model || ( e->model->name[0] == '*' && !cl_bmodelinterp->integer ) || RP_LOCALCLIENT( e ) || cl.maxclients <= 1 )
|
||||
return 1;
|
||||
|
||||
|
@ -762,6 +764,12 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
|
|||
ent->prevstate = ent->curstate;
|
||||
}
|
||||
|
||||
if( clgame.dllFuncs.pfnUpdateEntityState != NULL )
|
||||
{
|
||||
clgame.dllFuncs.pfnUpdateEntityState( ent, state, newent );
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOTE: always check modelindex for new state not current
|
||||
if( Mod_GetType( state->modelindex ) == mod_studio )
|
||||
{
|
||||
|
@ -771,6 +779,7 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
|
|||
{
|
||||
CL_UpdateBmodelVars( ent, state, newent );
|
||||
}
|
||||
}
|
||||
|
||||
// set right current state
|
||||
ent->curstate = *state;
|
||||
|
@ -798,10 +807,10 @@ void CL_FlushEntityPacket( sizebuf_t *msg )
|
|||
// read it all, but ignore it
|
||||
while( 1 )
|
||||
{
|
||||
newnum = BF_ReadWord( msg );
|
||||
newnum = MSG_ReadWord( msg );
|
||||
if( !newnum ) break; // done
|
||||
|
||||
if( BF_CheckOverflow( msg ))
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
Host_Error( "CL_FlushEntityPacket: read overflow\n" );
|
||||
|
||||
MSG_ReadDeltaEntity( msg, &from, &to, newnum, CL_IsPlayerIndex( newnum ), cl.mtime[0] );
|
||||
|
@ -816,11 +825,13 @@ An svc_packetentities has just been parsed, deal with the
|
|||
rest of the data stream.
|
||||
==================
|
||||
*/
|
||||
void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
||||
int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
||||
{
|
||||
frame_t *newframe, *oldframe;
|
||||
int oldindex, newnum, oldnum;
|
||||
int playerbytes = 0;
|
||||
int oldpacket;
|
||||
int bufStart;
|
||||
cl_entity_t *player;
|
||||
entity_state_t *oldent;
|
||||
int i, count;
|
||||
|
@ -830,7 +841,7 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
CL_WriteDemoJumpTime();
|
||||
|
||||
// first, allocate packet for new frame
|
||||
count = BF_ReadWord( msg );
|
||||
count = MSG_ReadWord( msg );
|
||||
|
||||
newframe = &cl.frames[cl.parsecountmod];
|
||||
|
||||
|
@ -838,12 +849,13 @@ void 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 ));
|
||||
|
||||
if( delta )
|
||||
{
|
||||
int subtracted;
|
||||
|
||||
oldpacket = BF_ReadByte( msg );
|
||||
oldpacket = MSG_ReadByte( msg );
|
||||
subtracted = ((( cls.netchan.incoming_sequence & 0xFF ) - oldpacket ) & 0xFF );
|
||||
|
||||
if( subtracted == 0 )
|
||||
|
@ -851,7 +863,7 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
MsgDev( D_NOTE, "CL_DeltaPacketEntities: update too old (flush)\n" );
|
||||
Con_NPrintf( 2, "^3Warning:^1 update too old\n^7\n" );
|
||||
CL_FlushEntityPacket( msg );
|
||||
return;
|
||||
return playerbytes;
|
||||
}
|
||||
|
||||
if( subtracted >= CL_UPDATE_MASK )
|
||||
|
@ -860,7 +872,7 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
MsgDev( D_NOTE, "CL_ParsePacketEntities: delta frame is too old: overflow (flush)\n");
|
||||
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
|
||||
CL_FlushEntityPacket( msg );
|
||||
return;
|
||||
return playerbytes;
|
||||
}
|
||||
|
||||
oldframe = &cl.frames[oldpacket & CL_UPDATE_MASK];
|
||||
|
@ -870,7 +882,7 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
MsgDev( D_NOTE, "CL_ParsePacketEntities: delta frame is too old (flush)\n");
|
||||
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
|
||||
CL_FlushEntityPacket( msg );
|
||||
return;
|
||||
return playerbytes;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -878,7 +890,7 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
// this is a full update that we can start delta compressing from now
|
||||
oldframe = NULL;
|
||||
oldpacket = -1; // delta too old or is initial message
|
||||
cl.force_send_usercmd = true; // send reply
|
||||
cl.send_reply = true; // send reply
|
||||
cls.demowaiting = false; // we can start recording now
|
||||
}
|
||||
|
||||
|
@ -907,16 +919,19 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
|
||||
while( 1 )
|
||||
{
|
||||
newnum = BF_ReadWord( msg );
|
||||
newnum = MSG_ReadWord( msg );
|
||||
if( !newnum ) break; // end of packet entities
|
||||
|
||||
if( BF_CheckOverflow( msg ))
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
Host_Error( "CL_ParsePacketEntities: read overflow\n" );
|
||||
|
||||
while( oldnum < newnum )
|
||||
{
|
||||
bufStart = MSG_GetNumBytesRead( msg );
|
||||
// one or more entities from the old packet are unchanged
|
||||
CL_DeltaEntity( msg, newframe, oldnum, oldent, true );
|
||||
if( CL_IsPlayerIndex( oldnum ) )
|
||||
playerbytes += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
|
||||
oldindex++;
|
||||
|
||||
|
@ -934,7 +949,10 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
if( oldnum == newnum )
|
||||
{
|
||||
// delta from previous state
|
||||
bufStart = MSG_GetNumBytesRead( msg );
|
||||
CL_DeltaEntity( msg, newframe, newnum, oldent, false );
|
||||
if( CL_IsPlayerIndex( newnum ) )
|
||||
playerbytes += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
oldindex++;
|
||||
|
||||
if( oldindex >= oldframe->num_entities )
|
||||
|
@ -952,7 +970,10 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
if( oldnum > newnum )
|
||||
{
|
||||
// delta from baseline ?
|
||||
bufStart = MSG_GetNumBytesRead( msg );
|
||||
CL_DeltaEntity( msg, newframe, newnum, NULL, false );
|
||||
if( CL_IsPlayerIndex( newnum ) )
|
||||
playerbytes += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -961,7 +982,10 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
while( oldnum != MAX_ENTNUMBER )
|
||||
{
|
||||
// one or more entities from the old packet are unchanged
|
||||
bufStart = MSG_GetNumBytesRead( msg );
|
||||
CL_DeltaEntity( msg, newframe, oldnum, oldent, true );
|
||||
if( CL_IsPlayerIndex( oldnum ) )
|
||||
playerbytes += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
oldindex++;
|
||||
|
||||
if( oldindex >= oldframe->num_entities )
|
||||
|
@ -980,7 +1004,7 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
|
||||
cl.frame = *newframe;
|
||||
|
||||
if( !cl.frame.valid ) return;
|
||||
if( !cl.frame.valid ) return playerbytes; // frame is not valid but message was parsed
|
||||
|
||||
player = CL_GetLocalPlayer();
|
||||
|
||||
|
@ -1014,11 +1038,15 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
|
||||
if(( cls.demoplayback || cls.disable_servercount != cl.servercount ) && cl.video_prepped )
|
||||
SCR_EndLoadingPlaque(); // get rid of loading plaque
|
||||
cl.first_frame = true; // first server frame received
|
||||
}
|
||||
else
|
||||
{
|
||||
CL_CheckPredictionError();
|
||||
cl.first_frame = false;
|
||||
}
|
||||
|
||||
return playerbytes;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1127,7 +1155,9 @@ void CL_AddPacketEntities( frame_t *frame )
|
|||
if( !ent || ent == clgame.entities )
|
||||
continue;
|
||||
|
||||
CL_UpdateEntityFields( ent );
|
||||
if( clgame.dllFuncs.pfnInterpolateEntity != NULL )
|
||||
clgame.dllFuncs.pfnInterpolateEntity( ent );
|
||||
else CL_UpdateEntityFields( ent );
|
||||
|
||||
if( ent->player ) entityType = ET_PLAYER;
|
||||
else if( ent->curstate.entityType == ENTITY_BEAM )
|
||||
|
|
|
@ -89,6 +89,8 @@ static dllfunc_t cdll_new_exports[] = // allowed only in SDK 2.3 and higher
|
|||
{ "HUD_GetRenderInterface", (void **)&clgame.dllFuncs.pfnGetRenderInterface }, // Xash3D ext
|
||||
{ "HUD_GetPlayerTeam", (void **)&clgame.dllFuncs.pfnGetPlayerTeam },
|
||||
{ "HUD_ClipMoveToEntity", (void **)&clgame.dllFuncs.pfnClipMoveToEntity }, // Xash3D ext
|
||||
{ "HUD_UpdateEntityState", (void **)&clgame.dllFuncs.pfnUpdateEntityState },
|
||||
{ "HUD_InterpolateEntity", (void **)&clgame.dllFuncs.pfnInterpolateEntity },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
@ -722,7 +724,7 @@ void CL_ParseTextMessage( sizebuf_t *msg )
|
|||
int channel;
|
||||
|
||||
// read channel ( 0 - auto)
|
||||
channel = BF_ReadByte( msg );
|
||||
channel = MSG_ReadByte( msg );
|
||||
|
||||
if( channel <= 0 || channel > ( MAX_TEXTCHANNELS - 1 ))
|
||||
{
|
||||
|
@ -735,27 +737,27 @@ void CL_ParseTextMessage( sizebuf_t *msg )
|
|||
// grab message channel
|
||||
text = &cl_textmessage[channel];
|
||||
|
||||
text->x = (float)(BF_ReadShort( msg ) / 8192.0f);
|
||||
text->y = (float)(BF_ReadShort( msg ) / 8192.0f);
|
||||
text->effect = BF_ReadByte( msg );
|
||||
text->r1 = BF_ReadByte( msg );
|
||||
text->g1 = BF_ReadByte( msg );
|
||||
text->b1 = BF_ReadByte( msg );
|
||||
text->a1 = BF_ReadByte( msg );
|
||||
text->r2 = BF_ReadByte( msg );
|
||||
text->g2 = BF_ReadByte( msg );
|
||||
text->b2 = BF_ReadByte( msg );
|
||||
text->a2 = BF_ReadByte( msg );
|
||||
text->fadein = (float)(BF_ReadShort( msg ) / 256.0f );
|
||||
text->fadeout = (float)(BF_ReadShort( msg ) / 256.0f );
|
||||
text->holdtime = (float)(BF_ReadShort( msg ) / 256.0f );
|
||||
text->x = (float)(MSG_ReadShort( msg ) / 8192.0f);
|
||||
text->y = (float)(MSG_ReadShort( msg ) / 8192.0f);
|
||||
text->effect = MSG_ReadByte( msg );
|
||||
text->r1 = MSG_ReadByte( msg );
|
||||
text->g1 = MSG_ReadByte( msg );
|
||||
text->b1 = MSG_ReadByte( msg );
|
||||
text->a1 = MSG_ReadByte( msg );
|
||||
text->r2 = MSG_ReadByte( msg );
|
||||
text->g2 = MSG_ReadByte( msg );
|
||||
text->b2 = MSG_ReadByte( msg );
|
||||
text->a2 = MSG_ReadByte( msg );
|
||||
text->fadein = (float)(MSG_ReadShort( msg ) / 256.0f );
|
||||
text->fadeout = (float)(MSG_ReadShort( msg ) / 256.0f );
|
||||
text->holdtime = (float)(MSG_ReadShort( msg ) / 256.0f );
|
||||
|
||||
if( text->effect == 2 )
|
||||
text->fxtime = (float)(BF_ReadShort( msg ) / 256.0f );
|
||||
text->fxtime = (float)(MSG_ReadShort( msg ) / 256.0f );
|
||||
else text->fxtime = 0.0f;
|
||||
|
||||
// to prevent grab too long messages
|
||||
Q_strncpy( (char *)text->pMessage, BF_ReadString( msg ), 512 );
|
||||
Q_strncpy( (char *)text->pMessage, MSG_ReadString( msg ), 512 );
|
||||
|
||||
// NOTE: a "HudText" message contain only 'string' with message name, so we
|
||||
// don't needs to use MSG_ routines here, just directly write msgname into netbuffer
|
||||
|
@ -1433,11 +1435,11 @@ static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount )
|
|||
|
||||
/*
|
||||
=============
|
||||
pfnFillRGBA
|
||||
CL_FillRGBA
|
||||
|
||||
=============
|
||||
*/
|
||||
static void pfnFillRGBA( int x, int y, int width, int height, int r, int g, int b, int a )
|
||||
void CL_FillRGBA( int x, int y, int width, int height, int r, int g, int b, int a )
|
||||
{
|
||||
r = bound( 0, r, 255 );
|
||||
g = bound( 0, g, 255 );
|
||||
|
@ -2611,8 +2613,8 @@ int pfnServerCmdUnreliable( char *szCmdString )
|
|||
if( !szCmdString || !szCmdString[0] )
|
||||
return 0;
|
||||
|
||||
BF_WriteByte( &cls.datagram, clc_stringcmd );
|
||||
BF_WriteString( &cls.datagram, szCmdString );
|
||||
MSG_WriteByte( &cls.datagram, clc_stringcmd );
|
||||
MSG_WriteString( &cls.datagram, szCmdString );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -2861,11 +2863,11 @@ void pfnPlaySoundByNameAtPitch( char *filename, float volume, int pitch )
|
|||
|
||||
/*
|
||||
=============
|
||||
pfnFillRGBABlend
|
||||
CL_FillRGBABlend
|
||||
|
||||
=============
|
||||
*/
|
||||
void pfnFillRGBABlend( 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 )
|
||||
{
|
||||
r = bound( 0, r, 255 );
|
||||
g = bound( 0, g, 255 );
|
||||
|
@ -3765,7 +3767,7 @@ static cl_enginefunc_t gEngfuncs =
|
|||
SPR_EnableScissor,
|
||||
SPR_DisableScissor,
|
||||
pfnSPR_GetList,
|
||||
pfnFillRGBA,
|
||||
CL_FillRGBA,
|
||||
pfnGetScreenInfo,
|
||||
pfnSetCrosshair,
|
||||
pfnCvar_RegisterVariable,
|
||||
|
@ -3884,7 +3886,7 @@ static cl_enginefunc_t gEngfuncs =
|
|||
pfnConstructTutorMessageDecayBuffer,
|
||||
pfnResetTutorMessageDecayData,
|
||||
pfnPlaySoundByNameAtPitch,
|
||||
pfnFillRGBABlend,
|
||||
CL_FillRGBABlend,
|
||||
pfnGetAppID,
|
||||
Cmd_AliasGetList,
|
||||
pfnVguiWrap2_GetMouseDelta,
|
||||
|
|
|
@ -22,9 +22,8 @@ GNU General Public License for more details.
|
|||
#include "../cl_dll/kbutton.h"
|
||||
#include "vgui_draw.h"
|
||||
|
||||
#define MAX_TOTAL_CMDS 16
|
||||
#define MIN_CMD_RATE 10.0
|
||||
#define MAX_CMD_BUFFER 4000
|
||||
#define MAX_TOTAL_CMDS 32
|
||||
#define MAX_CMD_BUFFER 8000
|
||||
#define CONNECTION_PROBLEM_TIME 15.0 // 15 seconds
|
||||
|
||||
convar_t *rcon_client_password;
|
||||
|
@ -45,6 +44,7 @@ convar_t *cl_lightstyle_lerping;
|
|||
convar_t *cl_idealpitchscale;
|
||||
convar_t *cl_solid_players;
|
||||
convar_t *cl_draw_beams;
|
||||
convar_t *cl_updaterate;
|
||||
convar_t *cl_cmdrate;
|
||||
convar_t *cl_interp;
|
||||
convar_t *cl_lw;
|
||||
|
@ -193,7 +193,7 @@ static float CL_LerpPoint( void )
|
|||
{
|
||||
float f, frac;
|
||||
|
||||
f = cl.mtime[0] - cl.mtime[1];
|
||||
f = cl_serverframetime();
|
||||
|
||||
if( !f || SV_Active( ))
|
||||
{
|
||||
|
@ -204,6 +204,7 @@ 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;
|
||||
}
|
||||
|
@ -286,6 +287,85 @@ CLIENT MOVEMENT COMMUNICATION
|
|||
|
||||
=======================================================================
|
||||
*/
|
||||
/*
|
||||
===============
|
||||
CL_ProcessShowTexturesCmds
|
||||
|
||||
navigate around texture atlas
|
||||
===============
|
||||
*/
|
||||
qboolean CL_ProcessShowTexturesCmds( usercmd_t *cmd )
|
||||
{
|
||||
static int oldbuttons;
|
||||
int changed;
|
||||
int pressed, released;
|
||||
|
||||
if( !gl_showtextures->integer || gl_overview->integer )
|
||||
return false;
|
||||
|
||||
changed = (oldbuttons ^ cmd->buttons);
|
||||
pressed = changed & cmd->buttons;
|
||||
released = changed & (~cmd->buttons);
|
||||
|
||||
if( released & ( IN_RIGHT|IN_MOVERIGHT ))
|
||||
Cvar_SetFloat( "r_showtextures", gl_showtextures->integer + 1 );
|
||||
if( released & ( IN_LEFT|IN_MOVELEFT ))
|
||||
Cvar_SetFloat( "r_showtextures", max( 1, gl_showtextures->integer - 1 ));
|
||||
oldbuttons = cmd->buttons;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_ProcessOverviewCmds
|
||||
|
||||
Transform user movement into overview adjust
|
||||
===============
|
||||
*/
|
||||
qboolean CL_ProcessOverviewCmds( usercmd_t *cmd )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
int sign = 1;
|
||||
float step = 100.0f * (cl.time - cl.oldtime);
|
||||
|
||||
if( !gl_overview->integer || gl_showtextures->integer )
|
||||
return false;
|
||||
|
||||
if( ov->flZoom < 0.0f ) sign = -1;
|
||||
|
||||
if( cmd->upmove > 0.0f ) ov->zNear += step;
|
||||
else if( cmd->upmove < 0.0f ) ov->zNear -= step;
|
||||
|
||||
if( cmd->buttons & IN_JUMP ) ov->zFar += step;
|
||||
else if( cmd->buttons & IN_DUCK ) ov->zFar -= step;
|
||||
|
||||
if( cmd->buttons & IN_FORWARD ) ov->origin[ov->rotated] -= sign * step;
|
||||
else if( cmd->buttons & IN_BACK ) ov->origin[ov->rotated] += sign * step;
|
||||
|
||||
if( ov->rotated )
|
||||
{
|
||||
if( cmd->buttons & ( IN_RIGHT|IN_MOVERIGHT ))
|
||||
ov->origin[0] -= sign * step;
|
||||
else if( cmd->buttons & ( IN_LEFT|IN_MOVELEFT ))
|
||||
ov->origin[0] += sign * step;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( cmd->buttons & ( IN_RIGHT|IN_MOVERIGHT ))
|
||||
ov->origin[1] += sign * step;
|
||||
else if( cmd->buttons & ( IN_LEFT|IN_MOVELEFT ))
|
||||
ov->origin[1] -= sign * step;
|
||||
}
|
||||
|
||||
if( cmd->buttons & IN_ATTACK ) ov->flZoom += step;
|
||||
else if( cmd->buttons & IN_ATTACK2 ) ov->flZoom -= step;
|
||||
|
||||
if( ov->flZoom == 0.0f ) ov->flZoom = 0.0001f; // to prevent disivion by zero
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_CreateCmd
|
||||
|
@ -298,6 +378,7 @@ void CL_CreateCmd( void )
|
|||
color24 color;
|
||||
vec3_t angles;
|
||||
qboolean active;
|
||||
int input_override;
|
||||
int i, ms;
|
||||
|
||||
ms = host.frametime * 1000;
|
||||
|
@ -305,6 +386,8 @@ void CL_CreateCmd( void )
|
|||
else if( ms <= 0 ) ms = 1; // keep time an actual
|
||||
|
||||
Q_memset( &cmd, 0, sizeof( cmd ));
|
||||
input_override = 0;
|
||||
|
||||
CL_PushPMStates();
|
||||
CL_SetSolidPlayers( cl.playernum );
|
||||
|
||||
|
@ -338,20 +421,24 @@ void CL_CreateCmd( void )
|
|||
|
||||
// message we are constructing.
|
||||
i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK;
|
||||
|
||||
pcmd = &cl.commands[i];
|
||||
|
||||
pcmd->senttime = cls.demoplayback ? 0.0 : host.realtime;
|
||||
if( !cls.demoplayback )
|
||||
{
|
||||
pcmd->senttime = host.realtime;
|
||||
memset( &pcmd->cmd, 0, sizeof( pcmd->cmd ));
|
||||
pcmd->receivedtime = -1.0;
|
||||
pcmd->processedfuncs = false;
|
||||
pcmd->heldback = false;
|
||||
pcmd->sendsize = 0;
|
||||
}
|
||||
|
||||
active = ( cls.state == ca_active && !cl.refdef.paused && !cls.demoplayback );
|
||||
clgame.dllFuncs.CL_CreateMove( cl.time - cl.oldtime, &pcmd->cmd, active );
|
||||
CL_PopPMStates();
|
||||
|
||||
if( !cls.demoplayback )
|
||||
{
|
||||
R_LightForPoint( cl.frame.client.origin, &color, false, false, 128.0f );
|
||||
pcmd->cmd.lightlevel = (color.r + color.g + color.b) / 3;
|
||||
|
||||
|
@ -360,11 +447,12 @@ void CL_CreateCmd( void )
|
|||
pcmd->cmd.msec = ms;
|
||||
pcmd->cmd.lerp_msec = cl_interp->value * 1000;
|
||||
pcmd->cmd.lerp_msec = bound( 0, cmd.lerp_msec, 250 );
|
||||
}
|
||||
|
||||
V_ProcessOverviewCmds( &pcmd->cmd );
|
||||
V_ProcessShowTexturesCmds( &pcmd->cmd );
|
||||
input_override |= CL_ProcessOverviewCmds( &pcmd->cmd );
|
||||
input_override |= CL_ProcessShowTexturesCmds( &pcmd->cmd );
|
||||
|
||||
if(( cl.background && !cls.demoplayback ) || gl_overview->integer || cls.changelevel )
|
||||
if(( cl.background && !cls.demoplayback ) || input_override || gl_overview->integer || cls.changelevel )
|
||||
{
|
||||
VectorCopy( angles, cl.refdef.cl_viewangles );
|
||||
VectorCopy( angles, pcmd->cmd.viewangles );
|
||||
|
@ -428,32 +516,34 @@ void CL_WritePacket( void )
|
|||
|
||||
CL_ComputePacketLoss ();
|
||||
|
||||
#ifndef _DEBUG
|
||||
if( cl_cmdrate->value < MIN_CMD_RATE )
|
||||
{
|
||||
Cvar_SetFloat( "cl_cmdrate", MIN_CMD_RATE );
|
||||
}
|
||||
#endif
|
||||
Q_memset( data, 0, MAX_CMD_BUFFER );
|
||||
BF_Init( &buf, "ClientData", data, sizeof( data ));
|
||||
MSG_Init( &buf, "ClientData", data, sizeof( data ));
|
||||
|
||||
// Determine number of backup commands to send along
|
||||
numbackup = bound( 0, cl_cmdbackup->integer, MAX_BACKUP_COMMANDS );
|
||||
if( cls.state == ca_connected ) numbackup = 0;
|
||||
|
||||
// clamp cmdrate
|
||||
if( cl_cmdrate->integer < 0 ) Cvar_Set( "cl_cmdrate", "0" );
|
||||
else if( cl_cmdrate->integer > 100 ) Cvar_Set( "cl_cmdrate", "100" );
|
||||
|
||||
// Check to see if we can actually send this command
|
||||
|
||||
// always reply at end of frame during the connection process
|
||||
if( cls.state > ca_disconnected && cls.state < ca_active )
|
||||
send_command = true;
|
||||
|
||||
// In single player, send commands as fast as possible
|
||||
// Otherwise, only send when ready and when not choking bandwidth
|
||||
if(( cl.maxclients == 1 ) || ( NET_IsLocalAddress( cls.netchan.remote_address ) && !host_limitlocal->integer ))
|
||||
send_command = true;
|
||||
else if(( host.realtime >= cls.nextcmdtime ) && Netchan_CanPacket( &cls.netchan ))
|
||||
if( cl.maxclients == 1 || ( NET_IsLocalAddress( cls.netchan.remote_address ) && !host_limitlocal->integer ))
|
||||
send_command = true;
|
||||
|
||||
if( cl.force_send_usercmd )
|
||||
{
|
||||
if(( host.realtime >= cls.nextcmdtime ) && Netchan_CanPacket( &cls.netchan ))
|
||||
send_command = true;
|
||||
|
||||
if( cl.send_reply )
|
||||
{
|
||||
cl.send_reply = false;
|
||||
send_command = true;
|
||||
cl.force_send_usercmd = false;
|
||||
}
|
||||
|
||||
if(( cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged ) >= CL_UPDATE_MASK )
|
||||
|
@ -466,23 +556,21 @@ void CL_WritePacket( void )
|
|||
}
|
||||
|
||||
if( cl_nodelta->integer )
|
||||
{
|
||||
cl.validsequence = 0;
|
||||
}
|
||||
|
||||
// send a userinfo update if needed
|
||||
if( userinfo->modified )
|
||||
{
|
||||
BF_WriteByte( &cls.netchan.message, clc_userinfo );
|
||||
BF_WriteString( &cls.netchan.message, Cvar_Userinfo( ));
|
||||
MSG_WriteByte( &cls.netchan.message, clc_userinfo );
|
||||
MSG_WriteString( &cls.netchan.message, Cvar_Userinfo( ));
|
||||
}
|
||||
|
||||
if( send_command )
|
||||
{
|
||||
int outgoing_sequence;
|
||||
|
||||
if( cl_cmdrate->integer > 0 )
|
||||
cls.nextcmdtime = host.realtime + ( 1.0f / cl_cmdrate->value );
|
||||
if( cl_cmdrate->integer > 0 ) // clamped between 10 and 100 fps
|
||||
cls.nextcmdtime = host.realtime + bound( 0.1f, ( 1.0f / cl_cmdrate->value ), 0.01f );
|
||||
else cls.nextcmdtime = host.realtime; // always able to send right away
|
||||
|
||||
if( cls.lastoutgoingcommand == -1 )
|
||||
|
@ -493,17 +581,17 @@ void CL_WritePacket( void )
|
|||
else outgoing_sequence = cls.lastoutgoingcommand + 1;
|
||||
|
||||
// begin a client move command
|
||||
BF_WriteByte( &buf, clc_move );
|
||||
MSG_WriteByte( &buf, clc_move );
|
||||
|
||||
// save the position for a checksum byte
|
||||
key = BF_GetRealBytesWritten( &buf );
|
||||
BF_WriteByte( &buf, 0 );
|
||||
key = MSG_GetRealBytesWritten( &buf );
|
||||
MSG_WriteByte( &buf, 0 );
|
||||
|
||||
// write packet lossage percentation
|
||||
BF_WriteByte( &buf, cls.packet_loss );
|
||||
MSG_WriteByte( &buf, cls.packet_loss );
|
||||
|
||||
// say how many backups we'll be sending
|
||||
BF_WriteByte( &buf, numbackup );
|
||||
MSG_WriteByte( &buf, numbackup );
|
||||
|
||||
// how many real commands have queued up
|
||||
newcmds = ( cls.netchan.outgoing_sequence - cls.lastoutgoingcommand );
|
||||
|
@ -512,7 +600,7 @@ void CL_WritePacket( void )
|
|||
newcmds = bound( 0, newcmds, MAX_TOTAL_CMDS );
|
||||
if( cls.state == ca_connected ) newcmds = 0;
|
||||
|
||||
BF_WriteByte( &buf, newcmds );
|
||||
MSG_WriteByte( &buf, newcmds );
|
||||
|
||||
numcmds = newcmds + numbackup;
|
||||
from = -1;
|
||||
|
@ -525,12 +613,12 @@ void CL_WritePacket( void )
|
|||
CL_WriteUsercmd( &buf, from, to );
|
||||
from = to;
|
||||
|
||||
if( BF_CheckOverflow( &buf ))
|
||||
Host_Error( "CL_Move, overflowed command buffer (%i bytes)\n", MAX_CMD_BUFFER );
|
||||
if( MSG_CheckOverflow( &buf ))
|
||||
Host_Error( "CL_WritePacket: overflowed command buffer (%i bytes)\n", MAX_CMD_BUFFER );
|
||||
}
|
||||
|
||||
// calculate a checksum over the move commands
|
||||
size = BF_GetRealBytesWritten( &buf ) - key - 1;
|
||||
size = MSG_GetRealBytesWritten( &buf ) - key - 1;
|
||||
buf.pData[key] = CRC32_BlockSequence( buf.pData + key + 1, size, cls.netchan.outgoing_sequence );
|
||||
|
||||
// message we are constructing.
|
||||
|
@ -541,8 +629,8 @@ void CL_WritePacket( void )
|
|||
{
|
||||
cl.delta_sequence = cl.validsequence;
|
||||
|
||||
BF_WriteByte( &buf, clc_delta );
|
||||
BF_WriteByte( &buf, cl.validsequence & 0xFF );
|
||||
MSG_WriteByte( &buf, clc_delta );
|
||||
MSG_WriteByte( &buf, cl.validsequence & 0xFF );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -550,24 +638,22 @@ void CL_WritePacket( void )
|
|||
cl.delta_sequence = -1;
|
||||
}
|
||||
|
||||
if( BF_CheckOverflow( &buf ))
|
||||
{
|
||||
Host_Error( "CL_Move, overflowed command buffer (%i bytes)\n", MAX_CMD_BUFFER );
|
||||
}
|
||||
if( MSG_CheckOverflow( &buf ))
|
||||
Host_Error( "CL_WritePacket: overflowed command buffer (%i bytes)\n", MAX_CMD_BUFFER );
|
||||
|
||||
// remember outgoing command that we are sending
|
||||
cls.lastoutgoingcommand = cls.netchan.outgoing_sequence;
|
||||
|
||||
// update size counter for netgraph
|
||||
cl.commands[cls.netchan.outgoing_sequence & CL_UPDATE_MASK].sendsize = BF_GetNumBytesWritten( &buf );
|
||||
cl.commands[cls.netchan.outgoing_sequence & CL_UPDATE_MASK].sendsize = MSG_GetNumBytesWritten( &buf );
|
||||
|
||||
// composite the rest of the datagram..
|
||||
if( BF_GetNumBitsWritten( &cls.datagram ) <= BF_GetNumBitsLeft( &buf ))
|
||||
BF_WriteBits( &buf, BF_GetData( &cls.datagram ), BF_GetNumBitsWritten( &cls.datagram ));
|
||||
BF_Clear( &cls.datagram );
|
||||
if( MSG_GetNumBitsWritten( &cls.datagram ) <= MSG_GetNumBitsLeft( &buf ))
|
||||
MSG_WriteBits( &buf, MSG_GetData( &cls.datagram ), MSG_GetNumBitsWritten( &cls.datagram ));
|
||||
MSG_Clear( &cls.datagram );
|
||||
|
||||
// deliver the message (or update reliable)
|
||||
Netchan_Transmit( &cls.netchan, BF_GetNumBytesWritten( &buf ), BF_GetData( &buf ));
|
||||
Netchan_Transmit( &cls.netchan, MSG_GetNumBytesWritten( &buf ), MSG_GetData( &buf ));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -653,7 +739,7 @@ void CL_SendConnectPacket( void )
|
|||
return;
|
||||
}
|
||||
|
||||
if( adr.port == 0 ) adr.port = BF_BigShort( PORT_SERVER );
|
||||
if( adr.port == 0 ) adr.port = MSG_BigShort( PORT_SERVER );
|
||||
port = Cvar_VariableValue( "net_qport" );
|
||||
|
||||
userinfo->modified = false;
|
||||
|
@ -695,7 +781,7 @@ void CL_CheckForResend( void )
|
|||
return;
|
||||
}
|
||||
|
||||
if( adr.port == 0 ) adr.port = BF_BigShort( PORT_SERVER );
|
||||
if( adr.port == 0 ) adr.port = MSG_BigShort( PORT_SERVER );
|
||||
cls.connect_time = host.realtime; // for retransmit requests
|
||||
|
||||
MsgDev( D_NOTE, "Connecting to %s...\n", cls.servername );
|
||||
|
@ -789,7 +875,7 @@ void CL_Rcon_f( void )
|
|||
}
|
||||
|
||||
NET_StringToAdr( rcon_address->string, &to );
|
||||
if( to.port == 0 ) to.port = BF_BigShort( PORT_SERVER );
|
||||
if( to.port == 0 ) to.port = MSG_BigShort( PORT_SERVER );
|
||||
}
|
||||
|
||||
NET_SendPacket( NS_CLIENT, Q_strlen( message ) + 1, message, to );
|
||||
|
@ -812,12 +898,13 @@ void CL_ClearState( void )
|
|||
|
||||
// wipe the entire cl structure
|
||||
Q_memset( &cl, 0, sizeof( cl ));
|
||||
BF_Clear( &cls.netchan.message );
|
||||
MSG_Clear( &cls.netchan.message );
|
||||
Q_memset( &clgame.fade, 0, sizeof( clgame.fade ));
|
||||
Q_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
|
||||
cl.mtime[0] = cl.mtime[1] = 1.0f; // because level starts from 1.0f second
|
||||
cl.scr_fov = 90.0f;
|
||||
|
||||
Cvar_SetFloat( "scr_download", 0.0f );
|
||||
|
@ -841,17 +928,17 @@ void CL_SendDisconnectMessage( void )
|
|||
|
||||
if( cls.state == ca_disconnected ) return;
|
||||
|
||||
BF_Init( &buf, "LastMessage", data, sizeof( data ));
|
||||
BF_WriteByte( &buf, clc_stringcmd );
|
||||
BF_WriteString( &buf, "disconnect" );
|
||||
MSG_Init( &buf, "LastMessage", data, sizeof( data ));
|
||||
MSG_WriteByte( &buf, clc_stringcmd );
|
||||
MSG_WriteString( &buf, "disconnect" );
|
||||
|
||||
if( !cls.netchan.remote_address.type )
|
||||
cls.netchan.remote_address.type = NA_LOOPBACK;
|
||||
|
||||
// make sure message will be delivered
|
||||
Netchan_Transmit( &cls.netchan, BF_GetNumBytesWritten( &buf ), BF_GetData( &buf ));
|
||||
Netchan_Transmit( &cls.netchan, BF_GetNumBytesWritten( &buf ), BF_GetData( &buf ));
|
||||
Netchan_Transmit( &cls.netchan, BF_GetNumBytesWritten( &buf ), BF_GetData( &buf ));
|
||||
Netchan_Transmit( &cls.netchan, MSG_GetNumBytesWritten( &buf ), MSG_GetData( &buf ));
|
||||
Netchan_Transmit( &cls.netchan, MSG_GetNumBytesWritten( &buf ), MSG_GetData( &buf ));
|
||||
Netchan_Transmit( &cls.netchan, MSG_GetNumBytesWritten( &buf ), MSG_GetData( &buf ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -933,7 +1020,7 @@ void CL_LocalServers_f( void )
|
|||
|
||||
// send a broadcast packet
|
||||
adr.type = NA_BROADCAST;
|
||||
adr.port = BF_BigShort( PORT_SERVER );
|
||||
adr.port = MSG_BigShort( PORT_SERVER );
|
||||
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "info %i", PROTOCOL_VERSION );
|
||||
}
|
||||
|
@ -988,11 +1075,11 @@ void CL_Packet_f( void )
|
|||
return;
|
||||
}
|
||||
|
||||
if( !adr.port ) adr.port = BF_BigShort( PORT_SERVER );
|
||||
if( adr.port == 0 ) adr.port = MSG_BigShort( PORT_SERVER );
|
||||
|
||||
in = Cmd_Argv( 2 );
|
||||
out = send + 4;
|
||||
send[0] = send[1] = send[2] = send[3] = (char)0xff;
|
||||
send[0] = send[1] = send[2] = send[3] = (char)0xFF;
|
||||
|
||||
l = Q_strlen( in );
|
||||
|
||||
|
@ -1031,10 +1118,10 @@ void CL_Reconnect_f( void )
|
|||
|
||||
// clear channel and stuff
|
||||
Netchan_Clear( &cls.netchan );
|
||||
BF_Clear( &cls.netchan.message );
|
||||
MSG_Clear( &cls.netchan.message );
|
||||
|
||||
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
BF_WriteString( &cls.netchan.message, "new" );
|
||||
MSG_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
MSG_WriteString( &cls.netchan.message, "new" );
|
||||
|
||||
cl.validsequence = 0; // haven't gotten a valid frame update yet
|
||||
cl.delta_sequence = -1; // we'll request a full delta from the baseline
|
||||
|
@ -1070,7 +1157,7 @@ Handle a reply from a info
|
|||
*/
|
||||
void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg )
|
||||
{
|
||||
char *s = BF_ReadString( msg );
|
||||
char *s = MSG_ReadString( msg );
|
||||
|
||||
// more info about servers
|
||||
MsgDev( D_INFO, "Server: %s, Game: %s\n", NET_AdrToString( from ), Info_ValueForKey( s, "gamedir" ));
|
||||
|
@ -1123,6 +1210,31 @@ void CL_ParseNETInfoMessage( netadr_t from, sizebuf_t *msg )
|
|||
}
|
||||
|
||||
//===================================================================
|
||||
/*
|
||||
===============
|
||||
CL_SetupOverviewParams
|
||||
|
||||
Get initial overview values
|
||||
===============
|
||||
*/
|
||||
void CL_SetupOverviewParams( void )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
float mapAspect, screenAspect, aspect;
|
||||
|
||||
ov->rotated = ( world.size[1] <= world.size[0] ) ? true : false;
|
||||
|
||||
// calculate nearest aspect
|
||||
mapAspect = world.size[!ov->rotated] / world.size[ov->rotated];
|
||||
screenAspect = (float)glState.width / (float)glState.height;
|
||||
aspect = Q_max( mapAspect, screenAspect );
|
||||
|
||||
ov->zNear = world.maxs[2];
|
||||
ov->zFar = world.mins[2];
|
||||
ov->flZoom = ( 8192.0f / world.size[ov->rotated] ) / aspect;
|
||||
|
||||
VectorAverage( world.mins, world.maxs, ov->origin );
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
|
@ -1151,25 +1263,6 @@ void CL_PrepSound( void )
|
|||
|
||||
S_EndRegistration();
|
||||
|
||||
if( host.soundList )
|
||||
{
|
||||
// need to reapply all ambient sounds after restarting
|
||||
for( i = 0; i < host.numsounds; i++)
|
||||
{
|
||||
soundlist_t *entry = &host.soundList[i];
|
||||
if( entry->looping && entry->entnum != -1 )
|
||||
{
|
||||
MsgDev( D_NOTE, "Restarting sound %s...\n", entry->name );
|
||||
S_AmbientSound( entry->origin, entry->entnum,
|
||||
S_RegisterSound( entry->name ), entry->volume, entry->attenuation,
|
||||
entry->pitch, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
host.soundList = NULL;
|
||||
host.numsounds = 0;
|
||||
|
||||
cl.audio_prepped = true;
|
||||
}
|
||||
|
||||
|
@ -1226,7 +1319,7 @@ void CL_PrepVideo( void )
|
|||
|
||||
R_NewMap(); // tell the render about new map
|
||||
|
||||
V_SetupOverviewState(); // set overview bounds
|
||||
CL_SetupOverviewParams(); // set overview bounds
|
||||
|
||||
// must be called after lightmap loading!
|
||||
clgame.dllFuncs.pfnVidInit();
|
||||
|
@ -1243,44 +1336,6 @@ void CL_PrepVideo( void )
|
|||
|
||||
Cvar_SetFloat( "scr_loading", 100.0f ); // all done
|
||||
|
||||
if( host.decalList )
|
||||
{
|
||||
// need to reapply all decals after restarting
|
||||
for( i = 0; i < host.numdecals; i++ )
|
||||
{
|
||||
decallist_t *entry = &host.decalList[i];
|
||||
cl_entity_t *pEdict = CL_GetEntityByIndex( entry->entityIndex );
|
||||
int decalIndex = CL_DecalIndex( CL_DecalIndexFromName( entry->name ));
|
||||
int modelIndex = 0;
|
||||
|
||||
if( pEdict ) modelIndex = pEdict->curstate.modelindex;
|
||||
CL_DecalShoot( decalIndex, entry->entityIndex, modelIndex, entry->position, entry->flags );
|
||||
}
|
||||
Z_Free( host.decalList );
|
||||
}
|
||||
|
||||
host.decalList = NULL;
|
||||
host.numdecals = 0;
|
||||
|
||||
if( host.soundList )
|
||||
{
|
||||
// need to reapply all ambient sounds after restarting
|
||||
for( i = 0; i < host.numsounds; i++ )
|
||||
{
|
||||
soundlist_t *entry = &host.soundList[i];
|
||||
if( entry->looping && entry->entnum != -1 )
|
||||
{
|
||||
MsgDev( D_NOTE, "Restarting sound %s...\n", entry->name );
|
||||
S_AmbientSound( entry->origin, entry->entnum,
|
||||
S_RegisterSound( entry->name ), entry->volume, entry->attenuation,
|
||||
entry->pitch, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
host.soundList = NULL;
|
||||
host.numsounds = 0;
|
||||
|
||||
if( host.developer <= 2 )
|
||||
Con_ClearNotify(); // clear any lines of console text
|
||||
|
||||
|
@ -1305,10 +1360,10 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
|||
int dataoffset = 0;
|
||||
netadr_t servadr;
|
||||
|
||||
BF_Clear( msg );
|
||||
BF_ReadLong( msg ); // skip the -1
|
||||
MSG_Clear( msg );
|
||||
MSG_ReadLong( msg ); // skip the -1
|
||||
|
||||
args = BF_ReadStringLine( msg );
|
||||
args = MSG_ReadStringLine( msg );
|
||||
|
||||
Cmd_TokenizeString( args );
|
||||
c = Cmd_Argv( 0 );
|
||||
|
@ -1325,8 +1380,8 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
|||
}
|
||||
|
||||
Netchan_Setup( NS_CLIENT, &cls.netchan, from, Cvar_VariableValue( "net_qport" ));
|
||||
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
BF_WriteString( &cls.netchan.message, "new" );
|
||||
MSG_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
MSG_WriteString( &cls.netchan.message, "new" );
|
||||
cls.state = ca_connected;
|
||||
|
||||
cl.validsequence = 0; // haven't gotten a valid frame update yet
|
||||
|
@ -1360,14 +1415,14 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
|||
|
||||
ShowWindow( host.hWnd, SW_RESTORE );
|
||||
SetForegroundWindow ( host.hWnd );
|
||||
args = BF_ReadString( msg );
|
||||
args = MSG_ReadString( msg );
|
||||
Cbuf_AddText( args );
|
||||
Cbuf_AddText( "\n" );
|
||||
}
|
||||
else if( !Q_strcmp( c, "print" ))
|
||||
{
|
||||
// print command from somewhere
|
||||
Msg( "remote: %s\n", BF_ReadString( msg ));
|
||||
Msg( "remote: %s\n", MSG_ReadString( msg ));
|
||||
}
|
||||
else if( !Q_strcmp( c, "ping" ))
|
||||
{
|
||||
|
@ -1399,9 +1454,9 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
|||
{
|
||||
servadr.type = NA_IP;
|
||||
// 4 bytes for IP
|
||||
BF_ReadBytes( msg, servadr.ip, sizeof( servadr.ip ));
|
||||
MSG_ReadBytes( msg, servadr.ip, sizeof( servadr.ip ));
|
||||
// 2 bytes for Port
|
||||
servadr.port = BF_ReadShort( msg );
|
||||
servadr.port = MSG_ReadShort( msg );
|
||||
|
||||
if( !servadr.port ) break;
|
||||
|
||||
|
@ -1449,10 +1504,10 @@ void CL_ReadNetMessage( void )
|
|||
|
||||
while( CL_GetMessage( net_message_buffer, &curSize ))
|
||||
{
|
||||
BF_Init( &net_message, "ServerData", net_message_buffer, curSize );
|
||||
MSG_Init( &net_message, "ServerData", net_message_buffer, curSize );
|
||||
|
||||
// check for connectionless packet (0xffffffff) first
|
||||
if( BF_GetMaxBytes( &net_message ) >= 4 && *(int *)net_message.pData == -1 )
|
||||
if( MSG_GetMaxBytes( &net_message ) >= 4 && *(int *)net_message.pData == -1 )
|
||||
{
|
||||
CL_ConnectionlessPacket( net_from, &net_message );
|
||||
continue;
|
||||
|
@ -1461,7 +1516,7 @@ void CL_ReadNetMessage( void )
|
|||
// can't be a valid sequenced packet
|
||||
if( cls.state < ca_connected ) continue;
|
||||
|
||||
if( BF_GetMaxBytes( &net_message ) < 8 )
|
||||
if( MSG_GetMaxBytes( &net_message ) < 8 )
|
||||
{
|
||||
MsgDev( D_WARN, "%s: runt packet\n", NET_AdrToString( net_from ));
|
||||
continue;
|
||||
|
@ -1478,13 +1533,14 @@ void CL_ReadNetMessage( void )
|
|||
continue; // wasn't accepted for some reason
|
||||
|
||||
CL_ParseServerMessage( &net_message );
|
||||
cl.send_reply = true;
|
||||
}
|
||||
|
||||
// check for fragmentation/reassembly related packets.
|
||||
if( cls.state != ca_disconnected && Netchan_IncomingReady( &cls.netchan ))
|
||||
{
|
||||
// the header is different lengths for reliable and unreliable messages
|
||||
int headerBytes = BF_GetNumBytesRead( &net_message );
|
||||
int headerBytes = MSG_GetNumBytesRead( &net_message );
|
||||
|
||||
// process the incoming buffer(s)
|
||||
if( Netchan_CopyNormalFragments( &cls.netchan, &net_message ))
|
||||
|
@ -1559,8 +1615,8 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename )
|
|||
{
|
||||
MsgDev( D_INFO, "Download completed, resuming connection\n" );
|
||||
FS_Rescan();
|
||||
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
BF_WriteString( &cls.netchan.message, "continueloading" );
|
||||
MSG_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
MSG_WriteString( &cls.netchan.message, "continueloading" );
|
||||
cls.downloadfileid = 0;
|
||||
cls.downloadcount = 0;
|
||||
return;
|
||||
|
@ -1611,8 +1667,8 @@ void CL_Precache_f( void )
|
|||
CL_PrepSound();
|
||||
CL_PrepVideo();
|
||||
|
||||
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
BF_WriteString( &cls.netchan.message, va( "begin %i\n", spawncount ));
|
||||
MSG_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
MSG_WriteString( &cls.netchan.message, va( "begin %i\n", spawncount ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1677,8 +1733,9 @@ void CL_InitLocal( void )
|
|||
|
||||
Cvar_Get( "hud_scale", "0", CVAR_ARCHIVE|CVAR_LATCH, "scale hud at current resolution" );
|
||||
Cvar_Get( "skin", "", CVAR_USERINFO, "player skin" ); // XDM 3.3 want this cvar
|
||||
Cvar_Get( "cl_updaterate", "60", CVAR_USERINFO|CVAR_ARCHIVE, "refresh rate of server messages" );
|
||||
cl_updaterate = Cvar_Get( "cl_updaterate", "60", CVAR_USERINFO|CVAR_ARCHIVE, "refresh rate of server messages" );
|
||||
Cvar_Get( "cl_background", "0", CVAR_READ_ONLY, "indicate what background map is running" );
|
||||
Cvar_Get( "cl_msglevel", "3", CVAR_USERINFO|CVAR_ARCHIVE, "message filter for server notifications" );
|
||||
|
||||
// these two added to shut up CS 1.5 about 'unknown' commands
|
||||
Cvar_Get( "lightgamma", "1", CVAR_ARCHIVE, "ambient lighting level (legacy, unused)" );
|
||||
|
@ -1759,6 +1816,43 @@ void CL_SendCommand( void )
|
|||
CL_CheckForResend ();
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_PrepareFrame
|
||||
|
||||
setup camera, update visible ents
|
||||
==================
|
||||
*/
|
||||
void CL_PrepareFrame( void )
|
||||
{
|
||||
if( cls.state != ca_active )
|
||||
return; // not in game
|
||||
|
||||
if( !cl.video_prepped || ( UI_IsVisible() && !cl.background ))
|
||||
return; // still loading
|
||||
|
||||
if( cl.frame.valid && ( cl.force_refdef || !cl.refdef.paused ))
|
||||
{
|
||||
cl.force_refdef = false;
|
||||
V_SetupRefDef ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Host_RenderFrame
|
||||
|
||||
==================
|
||||
*/
|
||||
void Host_RenderFrame( void )
|
||||
{
|
||||
// if client is not active, do nothing
|
||||
if( !cls.initialized ) return;
|
||||
|
||||
// update the screen
|
||||
SCR_UpdateScreen ();
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Host_ClientFrame
|
||||
|
@ -1774,6 +1868,10 @@ void Host_ClientFrame( void )
|
|||
cl.oldtime = cl.time;
|
||||
cl.time += host.frametime;
|
||||
|
||||
// demo time
|
||||
if( cls.demorecording && !cls.demowaiting )
|
||||
cls.demotime += host.frametime;
|
||||
|
||||
if( menu.hInstance )
|
||||
{
|
||||
// menu time (not paused, not clamped)
|
||||
|
@ -1802,6 +1900,22 @@ void Host_ClientFrame( void )
|
|||
if( !cl.audio_prepped ) CL_PrepSound();
|
||||
}
|
||||
|
||||
if( FBitSet( host.features, ENGINE_FIXED_FRAMERATE ))
|
||||
{
|
||||
// send a new command message to the server
|
||||
CL_SendCommand();
|
||||
|
||||
// predict all unacknowledged movements
|
||||
CL_PredictMovement();
|
||||
|
||||
// setup view, add visible ents
|
||||
CL_PrepareFrame();
|
||||
|
||||
// update audio
|
||||
S_RenderFrame( &cl.refdef );
|
||||
}
|
||||
else
|
||||
{
|
||||
// update the screen
|
||||
SCR_UpdateScreen ();
|
||||
|
||||
|
@ -1813,14 +1927,13 @@ void Host_ClientFrame( void )
|
|||
|
||||
// predict all unacknowledged movements
|
||||
CL_PredictMovement();
|
||||
}
|
||||
|
||||
// decay dynamic lights
|
||||
CL_DecayLights ();
|
||||
|
||||
SCR_RunCinematic();
|
||||
Con_RunConsole();
|
||||
|
||||
cls.framecount++;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1843,7 +1956,7 @@ void CL_Init( void )
|
|||
S_Init(); // init sound
|
||||
|
||||
// unreliable buffer. unsed for unreliable commands and voice stream
|
||||
BF_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf ));
|
||||
MSG_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf ));
|
||||
|
||||
if( !CL_LoadProgs( va( "%s/client.dll", GI->dll_path )))
|
||||
Host_Error( "can't initialize client.dll\n" );
|
||||
|
|
|
@ -0,0 +1,496 @@
|
|||
/*
|
||||
cl_netgraph.c - Draw Net statistics (borrowed from Xash3D SDL code)
|
||||
Copyright (C) 2016 Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
|
||||
#define NET_TIMINGS 1024
|
||||
#define NET_TIMINGS_MASK (NET_TIMINGS - 1)
|
||||
#define LATENCY_AVG_FRAC 0.5
|
||||
#define PACKETLOSS_AVG_FRAC 0.5
|
||||
#define PACKETCHOKE_AVG_FRAC 0.5
|
||||
#define NETGRAPH_LERP_HEIGHT 24
|
||||
#define NUM_LATENCY_SAMPLES 8
|
||||
|
||||
convar_t *net_graph;
|
||||
convar_t *net_graphpos;
|
||||
convar_t *net_graphwidth;
|
||||
convar_t *net_graphheight;
|
||||
convar_t *net_scale;
|
||||
convar_t *net_graphfillsegments;
|
||||
|
||||
static struct packet_latency_t
|
||||
{
|
||||
int latency;
|
||||
int choked;
|
||||
} netstat_packet_latency[NET_TIMINGS];
|
||||
|
||||
static struct cmdinfo_t
|
||||
{
|
||||
float cmd_lerp;
|
||||
int size;
|
||||
qboolean sent;
|
||||
} netstat_cmdinfo[NET_TIMINGS];
|
||||
|
||||
static byte netcolors[NETGRAPH_LERP_HEIGHT+5][4] =
|
||||
{
|
||||
{ 255, 0, 0, 255 },
|
||||
{ 0, 0, 255, 255 },
|
||||
{ 240, 127, 63, 255 },
|
||||
{ 255, 255, 0, 255 },
|
||||
{ 63, 255, 63, 150 }
|
||||
// other will be generated through NetGraph_InitColors()
|
||||
};
|
||||
|
||||
static netbandwidthgraph_t netstat_graph[NET_TIMINGS];
|
||||
static float packet_loss;
|
||||
static float packet_choke;
|
||||
|
||||
/*
|
||||
==========
|
||||
NetGraph_DrawLine
|
||||
|
||||
CL_FillRGBA shortcut
|
||||
==========
|
||||
*/
|
||||
static void NetGraph_DrawRect( wrect_t *rect, byte colors[3], byte alpha )
|
||||
{
|
||||
CL_FillRGBA( rect->left, rect->top, rect->right, rect->bottom, colors[0], colors[1], colors[2], alpha );
|
||||
}
|
||||
|
||||
/*
|
||||
==========
|
||||
NetGraph_InitColors
|
||||
|
||||
init netgraph colors
|
||||
==========
|
||||
*/
|
||||
void NetGraph_InitColors( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < NETGRAPH_LERP_HEIGHT; i++ )
|
||||
{
|
||||
if( i <= NETGRAPH_LERP_HEIGHT / 3 )
|
||||
{
|
||||
netcolors[i + 5][0] = i * -7.875f + 63;
|
||||
netcolors[i + 5][1] = i * 7.875f;
|
||||
netcolors[i + 5][2] = i * 19.375f + 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
netcolors[i + 5][0] = ( i - 8 ) * -0.3125f + 255;
|
||||
netcolors[i + 5][1] = ( i - 8 ) * -7.9375f + 127;
|
||||
netcolors[i + 5][2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==========
|
||||
NetGraph_GetFrameData
|
||||
|
||||
get frame data info, like chokes, packet losses, also update graph, packet and cmdinfo
|
||||
==========
|
||||
*/
|
||||
void NetGraph_GetFrameData( int *choke_count, int *loss_count, int *biggest_message, float *latency, int *latency_count )
|
||||
{
|
||||
int i;
|
||||
|
||||
*choke_count = *loss_count = *biggest_message = *latency_count = 0;
|
||||
*latency = 0.0f;
|
||||
|
||||
for( i = cls.netchan.incoming_sequence - CL_UPDATE_BACKUP + 1; i <= cls.netchan.incoming_sequence; i++ )
|
||||
{
|
||||
frame_t *f = cl.frames + ( i & CL_UPDATE_MASK );
|
||||
struct packet_latency_t *p = netstat_packet_latency + ( i & NET_TIMINGS_MASK );
|
||||
netbandwidthgraph_t *g = netstat_graph + ( i & NET_TIMINGS_MASK );
|
||||
|
||||
p->choked = f->receivedtime == -2.0f ? true : false;
|
||||
if( p->choked )
|
||||
(*choke_count)++;
|
||||
|
||||
if( !f->valid || f->receivedtime == -2.0f )
|
||||
p->latency = 9998; // broken delta
|
||||
else if( f->receivedtime == -1 )
|
||||
p->latency = 9999; // dropped
|
||||
else
|
||||
{
|
||||
int frame_latency = min( 1.0f, f->latency );
|
||||
p->latency = (( frame_latency + 0.1 ) / 1.1 ) * ( net_graphheight->value - NETGRAPH_LERP_HEIGHT - 2 );
|
||||
|
||||
if( i > cls.netchan.incoming_sequence - NUM_LATENCY_SAMPLES )
|
||||
{
|
||||
*latency += 1000.0f * f->latency;
|
||||
(*latency_count)++;
|
||||
}
|
||||
}
|
||||
|
||||
Q_memcpy( g, &f->graphdata, sizeof( netbandwidthgraph_t ));
|
||||
|
||||
if( *biggest_message < g->msgbytes )
|
||||
*biggest_message = g->msgbytes;
|
||||
}
|
||||
|
||||
for( i = cls.netchan.outgoing_sequence - CL_UPDATE_BACKUP + 1; i <= cls.netchan.outgoing_sequence; i++ )
|
||||
{
|
||||
netstat_cmdinfo[i & NET_TIMINGS_MASK].cmd_lerp = cl.commands[i & CL_UPDATE_MASK].frame_lerp;
|
||||
netstat_cmdinfo[i & NET_TIMINGS_MASK].sent = cl.commands[i & CL_UPDATE_MASK].heldback ? false : true;
|
||||
netstat_cmdinfo[i & NET_TIMINGS_MASK].size = cl.commands[i & CL_UPDATE_MASK].sendsize;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
NetGraph_DrawTimes
|
||||
|
||||
===========
|
||||
*/
|
||||
void NetGraph_DrawTimes( wrect_t rect, struct cmdinfo_t *cmdinfo, int x, int w )
|
||||
{
|
||||
int i, j, extrap_point = NETGRAPH_LERP_HEIGHT / 3, a, h;
|
||||
POINT pt = { max( x + w - 1 - 25, 1 ), max( rect.top + rect.bottom - 4 - NETGRAPH_LERP_HEIGHT + 1, 1 ) };
|
||||
rgba_t colors = { 0.9 * 255, 0.9 * 255, 0.7 * 255, 255 };
|
||||
wrect_t fill;
|
||||
|
||||
Con_DrawString( pt.x, pt.y, va( "%i/s", cl_cmdrate->integer ), colors );
|
||||
|
||||
for( a = 0; a < w; a++ )
|
||||
{
|
||||
i = ( cls.netchan.outgoing_sequence - a ) & NET_TIMINGS_MASK;
|
||||
h = ( cmdinfo[i].cmd_lerp / 3.0f ) * NETGRAPH_LERP_HEIGHT;
|
||||
|
||||
fill.left = x + w - a - 1;
|
||||
fill.right = fill.bottom = 1;
|
||||
fill.top = rect.top + rect.bottom - 4;
|
||||
|
||||
if( h >= extrap_point )
|
||||
{
|
||||
int start = 0;
|
||||
|
||||
h -= extrap_point;
|
||||
fill.top = extrap_point;
|
||||
|
||||
for( j = start; j < h; j++ )
|
||||
{
|
||||
NetGraph_DrawRect( &fill, netcolors[j + extrap_point], 255 );
|
||||
fill.top--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int oldh = h;
|
||||
|
||||
fill.top -= h;
|
||||
h = extrap_point - h;
|
||||
|
||||
for( j = 0; j < h; j++ )
|
||||
{
|
||||
NetGraph_DrawRect( &fill, netcolors[j + oldh], 255 );
|
||||
fill.top--;
|
||||
}
|
||||
}
|
||||
|
||||
fill.top = rect.top + rect.bottom - 4 - extrap_point;
|
||||
|
||||
CL_FillRGBA( fill.left, fill.top, fill.right, fill.bottom, 255, 255, 255, 255 );
|
||||
|
||||
fill.top = rect.top + rect.bottom - 3;
|
||||
|
||||
if( !cmdinfo[i].sent )
|
||||
CL_FillRGBA( fill.left, fill.top, fill.right, fill.bottom, 255, 0, 0, 255 );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
NetGraph_DrawHatches
|
||||
|
||||
===========
|
||||
*/
|
||||
void NetGraph_DrawHatches( int x, int y, int maxmsgbytes )
|
||||
{
|
||||
int ystep = max((int)( 10.0 / net_scale->value ), 1 );
|
||||
wrect_t hatch = { x, 4, y, 1 };
|
||||
int starty;
|
||||
|
||||
for( starty = hatch.top; hatch.top > 0 && ((starty - hatch.top) * net_scale->value < (maxmsgbytes + 50)); hatch.top -= ystep )
|
||||
{
|
||||
CL_FillRGBA( hatch.left, hatch.top, hatch.right, hatch.bottom, 63, 63, 0, 200 );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
NetGraph_DrawTextFields
|
||||
|
||||
===========
|
||||
*/
|
||||
void NetGraph_DrawTextFields( int x, int y, int count, float avg, float *framerate, int packet_loss, int packet_choke )
|
||||
{
|
||||
static int lastout;
|
||||
float latency;
|
||||
rgba_t colors = { 0.9 * 255, 0.9 * 255, 0.7 * 255, 255 };
|
||||
|
||||
|
||||
latency = count > 0 ? max( 0, avg / count - 0.5 * host.frametime - 1000.0 / cl_updaterate->value ) : 0;
|
||||
|
||||
*framerate = 0.5 * host.realframetime + 0.5 * *framerate;
|
||||
|
||||
Con_DrawString( x, y - net_graphheight->integer, va( "%.1ffps" , 0.5 / *framerate ), colors );
|
||||
Con_DrawString( x + 75, y - net_graphheight->integer, va( "%i ms" , (int)latency ), colors );
|
||||
Con_DrawString( x + 150, y - net_graphheight->integer, va( "%i/s" , cl_updaterate->integer ), colors );
|
||||
|
||||
if( netstat_cmdinfo[( cls.netchan.outgoing_sequence - 1 ) & NET_TIMINGS_MASK].size )
|
||||
lastout = netstat_cmdinfo[( cls.netchan.outgoing_sequence - 1 ) & NET_TIMINGS_MASK].size;
|
||||
|
||||
Con_DrawString( x, y - net_graphheight->integer + 15, va( "in : %i %.2f k/s", netstat_graph[cls.netchan.incoming_sequence & NET_TIMINGS_MASK].msgbytes, cls.netchan.flow[FLOW_INCOMING].avgkbytespersec ), colors );
|
||||
|
||||
Con_DrawString( x, y - net_graphheight->integer + 30, va( "out: %i %.2f k/s", lastout, cls.netchan.flow[FLOW_OUTGOING].avgkbytespersec ), colors );
|
||||
|
||||
if( net_graph->integer > 2 )
|
||||
Con_DrawString( x, y - net_graphheight->integer + 45, va( "loss: %i choke: %i", packet_loss, packet_choke ), colors );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
NetGraph_DrawDataSegment
|
||||
|
||||
===========
|
||||
*/
|
||||
int NetGraph_DrawDataSegment( wrect_t *fill, int bytes, byte r, byte g, byte b, byte alpha )
|
||||
{
|
||||
int h = bytes / net_scale->value;
|
||||
byte colors[3] = { r, g, b };
|
||||
fill->top -= h;
|
||||
if( net_graphfillsegments->integer )
|
||||
fill->bottom = h;
|
||||
else
|
||||
fill->bottom = 1;
|
||||
|
||||
if( fill->top > 1 )
|
||||
{
|
||||
NetGraph_DrawRect( fill, colors, alpha );
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
NetGraph_ColorForHeight
|
||||
|
||||
color based on packet latency
|
||||
===========
|
||||
*/
|
||||
void NetGraph_ColorForHeight( struct packet_latency_t *packet, byte color[3], byte *alpha, int *ping )
|
||||
{
|
||||
switch( packet->latency )
|
||||
{
|
||||
case 9999:
|
||||
Q_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
|
||||
*alpha = netcolors[1][3];
|
||||
*ping = 0;
|
||||
break;
|
||||
case 9997:
|
||||
Q_memcpy( color, netcolors[2], sizeof( byte ) * 3 ); // skipped
|
||||
*alpha = netcolors[2][3];
|
||||
*ping = 0;
|
||||
break;
|
||||
default:
|
||||
*ping = 1;
|
||||
if( packet->choked )
|
||||
{
|
||||
Q_memcpy( color, netcolors[3], sizeof( byte ) * 3 );
|
||||
*alpha = netcolors[3][3];
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_memcpy( color, netcolors[4], sizeof( byte ) * 3 );
|
||||
*alpha = netcolors[4][3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
NetGraph_DrawDataUsage
|
||||
|
||||
===========
|
||||
*/
|
||||
void NetGraph_DrawDataUsage( int x, int y, int w, int maxmsgbytes )
|
||||
{
|
||||
int a, i, h, lastvalidh = 0, ping;
|
||||
byte color[3], alpha;
|
||||
wrect_t fill = { 0 };
|
||||
|
||||
for( a = 0; a < w; a++ )
|
||||
{
|
||||
i = (cls.netchan.incoming_sequence - a) & NET_TIMINGS_MASK;
|
||||
h = netstat_packet_latency[i].latency;
|
||||
|
||||
NetGraph_ColorForHeight( &netstat_packet_latency[i], color, &alpha, &ping );
|
||||
|
||||
if( !ping ) h = lastvalidh;
|
||||
else lastvalidh = h;
|
||||
|
||||
if( h > net_graphheight->value - NETGRAPH_LERP_HEIGHT - 2 )
|
||||
h = net_graphheight->value - NETGRAPH_LERP_HEIGHT - 2;
|
||||
|
||||
fill.left = x + w - a - 1;
|
||||
fill.top = y - h;
|
||||
fill.right = 1;
|
||||
fill.bottom = ping ? 1: h;
|
||||
|
||||
NetGraph_DrawRect( &fill, color, alpha );
|
||||
|
||||
fill.top = y;
|
||||
fill.bottom = 1;
|
||||
|
||||
color[0] = 0; color[1] = 255; color[2] = 0;
|
||||
|
||||
NetGraph_DrawRect( &fill, color, 160 );
|
||||
|
||||
if( net_graph->integer < 2 )
|
||||
continue;
|
||||
|
||||
fill.top = y - net_graphheight->value - 1;
|
||||
fill.bottom = 1;
|
||||
color[0] = color[1] = color[2] = 255;
|
||||
|
||||
NetGraph_DrawRect( &fill, color, 255 );
|
||||
|
||||
fill.top -= 1;
|
||||
|
||||
if( netstat_packet_latency[i].latency > 9995 )
|
||||
continue; // skip invalid
|
||||
|
||||
if( !NetGraph_DrawDataSegment( &fill, netstat_graph[i].client, 255, 0, 0, 128 ))
|
||||
continue;
|
||||
|
||||
if( !NetGraph_DrawDataSegment( &fill, netstat_graph[i].players, 255, 255, 0, 128 ))
|
||||
continue;
|
||||
|
||||
if( !NetGraph_DrawDataSegment( &fill, netstat_graph[i].entities, 255, 0, 255, 128 ))
|
||||
continue;
|
||||
|
||||
if( !NetGraph_DrawDataSegment( &fill, netstat_graph[i].tentities, 0, 0, 255, 128 ))
|
||||
continue;
|
||||
|
||||
if( !NetGraph_DrawDataSegment( &fill, netstat_graph[i].sound, 0, 255, 0, 128 ))
|
||||
continue;
|
||||
|
||||
if( !NetGraph_DrawDataSegment( &fill, netstat_graph[i].event, 0, 255, 255, 128 ))
|
||||
continue;
|
||||
|
||||
if( !NetGraph_DrawDataSegment( &fill, netstat_graph[i].usr, 200, 200, 200, 128 ))
|
||||
continue;
|
||||
|
||||
// special case for maximum usage
|
||||
h = netstat_graph[i].msgbytes / net_scale->value;
|
||||
|
||||
color[0] = color[1] = color[2] = 240;
|
||||
|
||||
if( net_graphfillsegments->integer )
|
||||
fill.bottom = h;
|
||||
else fill.bottom = 1;
|
||||
|
||||
fill.top = y - net_graphheight->value - 1 - h;
|
||||
|
||||
if( fill.top < 2 ) continue;
|
||||
|
||||
NetGraph_DrawRect( &fill, color, 255 );
|
||||
}
|
||||
|
||||
if( net_graph->integer >= 2 )
|
||||
NetGraph_DrawHatches( x, y - net_graphheight->value - 1, maxmsgbytes );
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
SCR_DrawNetGraph
|
||||
|
||||
===========
|
||||
*/
|
||||
void SCR_DrawNetGraph( void )
|
||||
{
|
||||
wrect_t rect = { 0, clgame.scrInfo.iWidth, 0, clgame.scrInfo.iHeight };
|
||||
float loss = 0, choke = 0, avg_ping = 0;
|
||||
int loss_count = 0, choke_count = 0, ping_count = 0, maxmsgbytes = 0;
|
||||
int w = min( NET_TIMINGS, net_graphwidth->integer ), x, y;
|
||||
float framerate = 0;
|
||||
|
||||
if( !net_graph->integer )
|
||||
return;
|
||||
|
||||
if( net_scale->value <= 0 )
|
||||
Cvar_SetFloat( "net_scale", 0.1f );
|
||||
|
||||
if( rect.right < w + 10 )
|
||||
w = rect.right - 10;
|
||||
|
||||
NetGraph_GetFrameData( &choke_count, &loss_count, &maxmsgbytes, &avg_ping, &ping_count );
|
||||
|
||||
// packet loss
|
||||
loss = 100.0 * (float)loss_count / CL_UPDATE_BACKUP;
|
||||
packet_loss = PACKETLOSS_AVG_FRAC * packet_loss + ( 1.0 - PACKETLOSS_AVG_FRAC ) * loss;
|
||||
|
||||
// packet choke
|
||||
choke = 100.0 * (float)choke_count / CL_UPDATE_BACKUP;
|
||||
packet_choke = PACKETCHOKE_AVG_FRAC * packet_choke + ( 1.0 - PACKETCHOKE_AVG_FRAC ) * choke;
|
||||
|
||||
// detect x and y position
|
||||
switch( net_graphpos->integer )
|
||||
{
|
||||
case 1: // right sided
|
||||
x = rect.left + rect.right - 5 - w;
|
||||
break;
|
||||
case 2: // center
|
||||
x = rect.left + ( rect.right - 10 - w ) / 2;
|
||||
break;
|
||||
default: // left sided
|
||||
x = rect.left + 5;
|
||||
break;
|
||||
}
|
||||
y = rect.bottom + rect.top - NETGRAPH_LERP_HEIGHT - 5;
|
||||
|
||||
if( net_graph->integer < 3 )
|
||||
{
|
||||
NetGraph_DrawTimes( rect, netstat_cmdinfo, x, w );
|
||||
NetGraph_DrawDataUsage( x, y, w, maxmsgbytes );
|
||||
}
|
||||
|
||||
NetGraph_DrawTextFields( x, y, ping_count, avg_ping, &framerate, packet_loss, packet_choke );
|
||||
}
|
||||
|
||||
void CL_InitNetgraph( void )
|
||||
{
|
||||
net_graph = Cvar_Get( "net_graph", "0", CVAR_ARCHIVE, "draw network usage graph" );
|
||||
net_graphpos = Cvar_Get( "net_graphpos", "1", CVAR_ARCHIVE, "network usage graph position" );
|
||||
net_scale = Cvar_Get( "net_scale", "5", CVAR_ARCHIVE, "network usage graph scale level" );
|
||||
net_graphwidth = Cvar_Get( "net_graphwidth", "192", CVAR_ARCHIVE, "network usage graph width" );
|
||||
net_graphheight = Cvar_Get( "net_graphheight", "64", CVAR_ARCHIVE, "network usage graph height" );
|
||||
net_graphfillsegments = Cvar_Get( "net_graphfillsegments", "1", CVAR_ARCHIVE, "fill segments in network usage graph" );
|
||||
packet_loss = packet_choke = 0.0;
|
||||
|
||||
NetGraph_InitColors();
|
||||
}
|
|
@ -175,7 +175,7 @@ void CL_WriteErrorMessage( int current_count, sizebuf_t *msg )
|
|||
|
||||
FS_Write( fp, &starting_count, sizeof( int ));
|
||||
FS_Write( fp, ¤t_count, sizeof( int ));
|
||||
FS_Write( fp, BF_GetData( msg ), BF_GetMaxBytes( msg ));
|
||||
FS_Write( fp, MSG_GetData( msg ), MSG_GetMaxBytes( msg ));
|
||||
FS_Close( fp );
|
||||
|
||||
MsgDev( D_INFO, "Wrote erroneous message to %s\n", buffer_file );
|
||||
|
@ -217,11 +217,11 @@ void CL_WriteMessageHistory( void )
|
|||
}
|
||||
|
||||
failcommand = &cls_message_debug.oldcmd[thecmd];
|
||||
MsgDev( D_INFO, "BAD: %3i:%s\n", BF_GetNumBytesRead( msg ) - 1, CL_MsgInfo( failcommand->command ));
|
||||
MsgDev( D_INFO, "BAD: %3i:%s\n", MSG_GetNumBytesRead( msg ) - 1, CL_MsgInfo( failcommand->command ));
|
||||
|
||||
if( host.developer >= 3 )
|
||||
{
|
||||
CL_WriteErrorMessage( BF_GetNumBytesRead( msg ) - 1, msg );
|
||||
CL_WriteErrorMessage( MSG_GetNumBytesRead( msg ) - 1, msg );
|
||||
}
|
||||
cls_message_debug.parsing = false;
|
||||
}
|
||||
|
@ -252,29 +252,29 @@ void CL_ParseSoundPacket( sizebuf_t *msg, qboolean is_ambient )
|
|||
int flags, pitch, entnum;
|
||||
sound_t handle = 0;
|
||||
|
||||
flags = BF_ReadWord( msg );
|
||||
flags = MSG_ReadWord( msg );
|
||||
if( flags & SND_LARGE_INDEX )
|
||||
sound = BF_ReadWord( msg );
|
||||
else sound = BF_ReadByte( msg );
|
||||
chan = BF_ReadByte( msg );
|
||||
sound = MSG_ReadWord( msg );
|
||||
else sound = MSG_ReadByte( msg );
|
||||
chan = MSG_ReadByte( msg );
|
||||
|
||||
if( flags & SND_VOLUME )
|
||||
volume = (float)BF_ReadByte( msg ) / 255.0f;
|
||||
volume = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
else volume = VOL_NORM;
|
||||
|
||||
if( flags & SND_ATTENUATION )
|
||||
attn = (float)BF_ReadByte( msg ) / 64.0f;
|
||||
attn = (float)MSG_ReadByte( msg ) / 64.0f;
|
||||
else attn = ATTN_NONE;
|
||||
|
||||
if( flags & SND_PITCH )
|
||||
pitch = BF_ReadByte( msg );
|
||||
pitch = MSG_ReadByte( msg );
|
||||
else pitch = PITCH_NORM;
|
||||
|
||||
// entity reletive
|
||||
entnum = BF_ReadWord( msg );
|
||||
entnum = MSG_ReadWord( msg );
|
||||
|
||||
// positioned in space
|
||||
BF_ReadVec3Coord( msg, pos );
|
||||
MSG_ReadVec3Coord( msg, pos );
|
||||
|
||||
if( flags & SND_SENTENCE )
|
||||
{
|
||||
|
@ -314,22 +314,22 @@ void CL_ParseRestoreSoundPacket( sizebuf_t *msg )
|
|||
int wordIndex;
|
||||
sound_t handle = 0;
|
||||
|
||||
flags = BF_ReadWord( msg );
|
||||
flags = MSG_ReadWord( msg );
|
||||
if( flags & SND_LARGE_INDEX )
|
||||
sound = BF_ReadWord( msg );
|
||||
else sound = BF_ReadByte( msg );
|
||||
chan = BF_ReadByte( msg );
|
||||
sound = MSG_ReadWord( msg );
|
||||
else sound = MSG_ReadByte( msg );
|
||||
chan = MSG_ReadByte( msg );
|
||||
|
||||
if( flags & SND_VOLUME )
|
||||
volume = (float)BF_ReadByte( msg ) / 255.0f;
|
||||
volume = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
else volume = VOL_NORM;
|
||||
|
||||
if( flags & SND_ATTENUATION )
|
||||
attn = (float)BF_ReadByte( msg ) / 64.0f;
|
||||
attn = (float)MSG_ReadByte( msg ) / 64.0f;
|
||||
else attn = ATTN_NONE;
|
||||
|
||||
if( flags & SND_PITCH )
|
||||
pitch = BF_ReadByte( msg );
|
||||
pitch = MSG_ReadByte( msg );
|
||||
else pitch = PITCH_NORM;
|
||||
|
||||
if( flags & SND_SENTENCE )
|
||||
|
@ -342,19 +342,31 @@ void CL_ParseRestoreSoundPacket( sizebuf_t *msg )
|
|||
else handle = cl.sound_index[sound]; // see precached sound
|
||||
|
||||
// entity reletive
|
||||
entnum = BF_ReadWord( msg );
|
||||
entnum = MSG_ReadWord( msg );
|
||||
|
||||
// positioned in space
|
||||
BF_ReadVec3Coord( msg, pos );
|
||||
wordIndex = BF_ReadByte( msg );
|
||||
MSG_ReadVec3Coord( msg, pos );
|
||||
wordIndex = MSG_ReadByte( msg );
|
||||
|
||||
// 16 bytes here
|
||||
BF_ReadBytes( msg, &samplePos, sizeof( samplePos ));
|
||||
BF_ReadBytes( msg, &forcedEnd, sizeof( forcedEnd ));
|
||||
MSG_ReadBytes( msg, &samplePos, sizeof( samplePos ));
|
||||
MSG_ReadBytes( msg, &forcedEnd, sizeof( forcedEnd ));
|
||||
|
||||
S_RestoreSound( pos, entnum, chan, handle, volume, attn, pitch, flags, samplePos, forcedEnd, wordIndex );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_ParseServerTime
|
||||
|
||||
==================
|
||||
*/
|
||||
void CL_ParseServerTime( sizebuf_t *msg )
|
||||
{
|
||||
cl.mtime[1] = cl.mtime[0];
|
||||
cl.mtime[0] = MSG_ReadFloat( msg );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_ParseMovevars
|
||||
|
@ -388,15 +400,15 @@ void CL_ParseParticles( sizebuf_t *msg )
|
|||
int i, count, color;
|
||||
float life;
|
||||
|
||||
BF_ReadVec3Coord( msg, org );
|
||||
MSG_ReadVec3Coord( msg, org );
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
dir[i] = BF_ReadChar( msg ) * (1.0f / 16);
|
||||
dir[i] = MSG_ReadChar( msg ) * (1.0f / 16);
|
||||
|
||||
count = BF_ReadByte( msg );
|
||||
color = BF_ReadByte( msg );
|
||||
count = MSG_ReadByte( msg );
|
||||
color = MSG_ReadByte( msg );
|
||||
if( count == 255 ) count = 1024;
|
||||
life = BF_ReadByte( msg ) * 0.125f;
|
||||
life = MSG_ReadByte( msg ) * 0.125f;
|
||||
|
||||
if( life != 0.0f && count == 1 )
|
||||
{
|
||||
|
@ -430,27 +442,27 @@ void CL_ParseStaticEntity( sizebuf_t *msg )
|
|||
|
||||
Q_memset( &state, 0, sizeof( state ));
|
||||
|
||||
state.modelindex = BF_ReadShort( msg );
|
||||
state.sequence = BF_ReadByte( msg );
|
||||
state.frame = BF_ReadByte( msg );
|
||||
state.colormap = BF_ReadWord( msg );
|
||||
state.skin = BF_ReadByte( msg );
|
||||
state.modelindex = MSG_ReadShort( msg );
|
||||
state.sequence = MSG_ReadByte( msg );
|
||||
state.frame = MSG_ReadByte( msg );
|
||||
state.colormap = MSG_ReadWord( msg );
|
||||
state.skin = MSG_ReadByte( msg );
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
state.origin[i] = BF_ReadCoord( msg );
|
||||
state.angles[i] = BF_ReadBitAngle( msg, 16 );
|
||||
state.origin[i] = MSG_ReadCoord( msg );
|
||||
state.angles[i] = MSG_ReadBitAngle( msg, 16 );
|
||||
}
|
||||
|
||||
state.rendermode = BF_ReadByte( msg );
|
||||
state.rendermode = MSG_ReadByte( msg );
|
||||
|
||||
if( state.rendermode != kRenderNormal )
|
||||
{
|
||||
state.renderamt = BF_ReadByte( msg );
|
||||
state.rendercolor.r = BF_ReadByte( msg );
|
||||
state.rendercolor.g = BF_ReadByte( msg );
|
||||
state.rendercolor.b = BF_ReadByte( msg );
|
||||
state.renderfx = BF_ReadByte( msg );
|
||||
state.renderamt = MSG_ReadByte( msg );
|
||||
state.rendercolor.r = MSG_ReadByte( msg );
|
||||
state.rendercolor.g = MSG_ReadByte( msg );
|
||||
state.rendercolor.b = MSG_ReadByte( msg );
|
||||
state.renderfx = MSG_ReadByte( msg );
|
||||
}
|
||||
|
||||
i = clgame.numStatics;
|
||||
|
@ -502,15 +514,15 @@ void CL_ParseStaticDecal( sizebuf_t *msg )
|
|||
float scale;
|
||||
int flags;
|
||||
|
||||
BF_ReadVec3Coord( msg, origin );
|
||||
decalIndex = BF_ReadWord( msg );
|
||||
entityIndex = BF_ReadShort( msg );
|
||||
MSG_ReadVec3Coord( msg, origin );
|
||||
decalIndex = MSG_ReadWord( msg );
|
||||
entityIndex = MSG_ReadShort( msg );
|
||||
|
||||
if( entityIndex > 0 )
|
||||
modelIndex = BF_ReadWord( msg );
|
||||
modelIndex = MSG_ReadWord( msg );
|
||||
else modelIndex = 0;
|
||||
flags = BF_ReadByte( msg );
|
||||
scale = (float)BF_ReadWord( msg ) / 4096.0f;
|
||||
flags = MSG_ReadByte( msg );
|
||||
scale = (float)MSG_ReadWord( msg ) / 4096.0f;
|
||||
|
||||
CL_FireCustomDecal( CL_DecalIndex( decalIndex ), entityIndex, modelIndex, origin, flags, scale );
|
||||
}
|
||||
|
@ -526,10 +538,10 @@ void CL_ParseSoundFade( sizebuf_t *msg )
|
|||
float fadePercent, fadeOutSeconds;
|
||||
float holdTime, fadeInSeconds;
|
||||
|
||||
fadePercent = (float)BF_ReadByte( msg );
|
||||
holdTime = (float)BF_ReadByte( msg );
|
||||
fadeOutSeconds = (float)BF_ReadByte( msg );
|
||||
fadeInSeconds = (float)BF_ReadByte( msg );
|
||||
fadePercent = (float)MSG_ReadByte( msg );
|
||||
holdTime = (float)MSG_ReadByte( msg );
|
||||
fadeOutSeconds = (float)MSG_ReadByte( msg );
|
||||
fadeInSeconds = (float)MSG_ReadByte( msg );
|
||||
|
||||
S_FadeClientVolume( fadePercent, fadeOutSeconds, holdTime, fadeInSeconds );
|
||||
}
|
||||
|
@ -574,23 +586,23 @@ void CL_ParseServerData( sizebuf_t *msg )
|
|||
cls.state = ca_connected;
|
||||
|
||||
// parse protocol version number
|
||||
i = BF_ReadLong( msg );
|
||||
i = MSG_ReadLong( msg );
|
||||
cls.serverProtocol = i;
|
||||
|
||||
if( i != PROTOCOL_VERSION )
|
||||
Host_Error( "Server use invalid protocol (%i should be %i)\n", i, PROTOCOL_VERSION );
|
||||
|
||||
cl.servercount = BF_ReadLong( msg );
|
||||
cl.checksum = BF_ReadLong( msg );
|
||||
cl.playernum = BF_ReadByte( msg );
|
||||
cl.maxclients = BF_ReadByte( msg );
|
||||
clgame.maxEntities = BF_ReadWord( msg );
|
||||
cl.servercount = MSG_ReadLong( msg );
|
||||
cl.checksum = MSG_ReadLong( msg );
|
||||
cl.playernum = MSG_ReadByte( msg );
|
||||
cl.maxclients = MSG_ReadByte( msg );
|
||||
clgame.maxEntities = MSG_ReadWord( msg );
|
||||
clgame.maxEntities = bound( 600, clgame.maxEntities, 4096 );
|
||||
Q_strncpy( clgame.mapname, BF_ReadString( msg ), MAX_STRING );
|
||||
Q_strncpy( clgame.maptitle, BF_ReadString( msg ), MAX_STRING );
|
||||
background = BF_ReadOneBit( msg );
|
||||
Q_strncpy( gamefolder, BF_ReadString( msg ), MAX_STRING );
|
||||
host.features = (uint)BF_ReadLong( msg );
|
||||
Q_strncpy( clgame.mapname, MSG_ReadString( msg ), MAX_STRING );
|
||||
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), MAX_STRING );
|
||||
background = MSG_ReadOneBit( msg );
|
||||
Q_strncpy( gamefolder, MSG_ReadString( msg ), MAX_STRING );
|
||||
host.features = (uint)MSG_ReadLong( msg );
|
||||
|
||||
if( cl.maxclients > 1 && host.developer < 1 )
|
||||
host.developer++;
|
||||
|
@ -782,9 +794,9 @@ void CL_ParseClientData( sizebuf_t *msg )
|
|||
to_wd = frame->weapondata;
|
||||
|
||||
// clear to old value before delta parsing
|
||||
if( BF_ReadOneBit( msg ))
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
{
|
||||
int delta_sequence = BF_ReadByte( msg );
|
||||
int delta_sequence = MSG_ReadByte( msg );
|
||||
|
||||
from_cd = &cl.frames[delta_sequence & CL_UPDATE_MASK].client;
|
||||
from_wd = cl.frames[delta_sequence & CL_UPDATE_MASK].weapondata;
|
||||
|
@ -802,10 +814,10 @@ void CL_ParseClientData( sizebuf_t *msg )
|
|||
for( i = 0; i < 64; i++ )
|
||||
{
|
||||
// check for end of weapondata (and clientdata_t message)
|
||||
if( !BF_ReadOneBit( msg )) break;
|
||||
if( !MSG_ReadOneBit( msg )) break;
|
||||
|
||||
// read the weapon idx
|
||||
idx = BF_ReadUBitLong( msg, MAX_WEAPON_BITS );
|
||||
idx = MSG_ReadUBitLong( msg, MAX_WEAPON_BITS );
|
||||
|
||||
MSG_ReadWeaponData( msg, &from_wd[idx], &to_wd[idx], cl.mtime[0] );
|
||||
}
|
||||
|
@ -824,7 +836,7 @@ void CL_ParseBaseline( sizebuf_t *msg )
|
|||
|
||||
Delta_InitClient (); // finalize client delta's
|
||||
|
||||
newnum = BF_ReadWord( msg );
|
||||
newnum = MSG_ReadWord( msg );
|
||||
|
||||
if( newnum < 0 ) Host_Error( "CL_SpawnEdict: invalid number %i\n", newnum );
|
||||
if( newnum >= clgame.maxEntities ) Host_Error( "CL_AllocEdict: no free edicts\n" );
|
||||
|
@ -851,9 +863,9 @@ void CL_ParseLightStyle( sizebuf_t *msg )
|
|||
const char *s;
|
||||
float f;
|
||||
|
||||
style = BF_ReadByte( msg );
|
||||
s = BF_ReadString( msg );
|
||||
f = BF_ReadFloat( msg );
|
||||
style = MSG_ReadByte( msg );
|
||||
s = MSG_ReadString( msg );
|
||||
f = MSG_ReadFloat( msg );
|
||||
|
||||
CL_SetLightstyle( style, s, f );
|
||||
}
|
||||
|
@ -867,9 +879,9 @@ set the view angle to this absolute value
|
|||
*/
|
||||
void CL_ParseSetAngle( sizebuf_t *msg )
|
||||
{
|
||||
cl.refdef.cl_viewangles[0] = BF_ReadBitAngle( msg, 16 );
|
||||
cl.refdef.cl_viewangles[1] = BF_ReadBitAngle( msg, 16 );
|
||||
cl.refdef.cl_viewangles[2] = BF_ReadBitAngle( msg, 16 );
|
||||
cl.refdef.cl_viewangles[0] = MSG_ReadBitAngle( msg, 16 );
|
||||
cl.refdef.cl_viewangles[1] = MSG_ReadBitAngle( msg, 16 );
|
||||
cl.refdef.cl_viewangles[2] = MSG_ReadBitAngle( msg, 16 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -883,7 +895,7 @@ void CL_ParseAddAngle( sizebuf_t *msg )
|
|||
{
|
||||
float add_angle;
|
||||
|
||||
add_angle = BF_ReadBitAngle( msg, 16 );
|
||||
add_angle = MSG_ReadBitAngle( msg, 16 );
|
||||
cl.refdef.cl_viewangles[1] += add_angle;
|
||||
}
|
||||
|
||||
|
@ -896,8 +908,8 @@ offset crosshair angles
|
|||
*/
|
||||
void CL_ParseCrosshairAngle( sizebuf_t *msg )
|
||||
{
|
||||
cl.refdef.crosshairangle[0] = BF_ReadChar( msg ) * 0.2f;
|
||||
cl.refdef.crosshairangle[1] = BF_ReadChar( msg ) * 0.2f;
|
||||
cl.refdef.crosshairangle[0] = MSG_ReadChar( msg ) * 0.2f;
|
||||
cl.refdef.crosshairangle[1] = MSG_ReadChar( msg ) * 0.2f;
|
||||
cl.refdef.crosshairangle[2] = 0.0f; // not used for screen space
|
||||
}
|
||||
|
||||
|
@ -913,9 +925,9 @@ void CL_RegisterUserMessage( sizebuf_t *msg )
|
|||
char *pszName;
|
||||
int svc_num, size;
|
||||
|
||||
svc_num = BF_ReadByte( msg );
|
||||
size = BF_ReadByte( msg );
|
||||
pszName = BF_ReadString( msg );
|
||||
svc_num = MSG_ReadByte( msg );
|
||||
size = MSG_ReadByte( msg );
|
||||
pszName = MSG_ReadString( msg );
|
||||
|
||||
// important stuff
|
||||
if( size == 0xFF ) size = -1;
|
||||
|
@ -937,17 +949,17 @@ void CL_UpdateUserinfo( sizebuf_t *msg )
|
|||
qboolean active;
|
||||
player_info_t *player;
|
||||
|
||||
slot = BF_ReadUBitLong( msg, MAX_CLIENT_BITS );
|
||||
slot = MSG_ReadUBitLong( msg, MAX_CLIENT_BITS );
|
||||
|
||||
if( slot >= MAX_CLIENTS )
|
||||
Host_Error( "CL_ParseServerMessage: svc_updateuserinfo > MAX_CLIENTS\n" );
|
||||
|
||||
player = &cl.players[slot];
|
||||
active = BF_ReadOneBit( msg ) ? true : false;
|
||||
active = MSG_ReadOneBit( msg ) ? true : false;
|
||||
|
||||
if( active )
|
||||
{
|
||||
Q_strncpy( player->userinfo, BF_ReadString( msg ), sizeof( player->userinfo ));
|
||||
Q_strncpy( player->userinfo, MSG_ReadString( msg ), sizeof( player->userinfo ));
|
||||
Q_strncpy( player->name, Info_ValueForKey( player->userinfo, "name" ), sizeof( player->name ));
|
||||
Q_strncpy( player->model, Info_ValueForKey( player->userinfo, "model" ), sizeof( player->model ));
|
||||
player->topcolor = Q_atoi( Info_ValueForKey( player->userinfo, "topcolor" ));
|
||||
|
@ -969,12 +981,12 @@ void CL_PrecacheModel( sizebuf_t *msg )
|
|||
{
|
||||
int modelIndex;
|
||||
|
||||
modelIndex = BF_ReadUBitLong( msg, MAX_MODEL_BITS );
|
||||
modelIndex = MSG_ReadUBitLong( msg, MAX_MODEL_BITS );
|
||||
|
||||
if( modelIndex < 0 || modelIndex >= MAX_MODELS )
|
||||
Host_Error( "CL_PrecacheModel: bad modelindex %i\n", modelIndex );
|
||||
|
||||
Q_strncpy( cl.model_precache[modelIndex], BF_ReadString( msg ), sizeof( cl.model_precache[0] ));
|
||||
Q_strncpy( cl.model_precache[modelIndex], MSG_ReadString( msg ), sizeof( cl.model_precache[0] ));
|
||||
|
||||
// when we loading map all resources is precached sequentially
|
||||
if( !cl.video_prepped ) return;
|
||||
|
@ -993,12 +1005,12 @@ void CL_PrecacheSound( sizebuf_t *msg )
|
|||
{
|
||||
int soundIndex;
|
||||
|
||||
soundIndex = BF_ReadUBitLong( msg, MAX_SOUND_BITS );
|
||||
soundIndex = MSG_ReadUBitLong( msg, MAX_SOUND_BITS );
|
||||
|
||||
if( soundIndex < 0 || soundIndex >= MAX_SOUNDS )
|
||||
Host_Error( "CL_PrecacheSound: bad soundindex %i\n", soundIndex );
|
||||
|
||||
Q_strncpy( cl.sound_precache[soundIndex], BF_ReadString( msg ), sizeof( cl.sound_precache[0] ));
|
||||
Q_strncpy( cl.sound_precache[soundIndex], MSG_ReadString( msg ), sizeof( cl.sound_precache[0] ));
|
||||
|
||||
// when we loading map all resources is precached sequentially
|
||||
if( !cl.audio_prepped ) return;
|
||||
|
@ -1017,12 +1029,12 @@ void CL_PrecacheEvent( sizebuf_t *msg )
|
|||
{
|
||||
int eventIndex;
|
||||
|
||||
eventIndex = BF_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
eventIndex = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
|
||||
if( eventIndex < 0 || eventIndex >= MAX_EVENTS )
|
||||
Host_Error( "CL_PrecacheEvent: bad eventindex %i\n", eventIndex );
|
||||
|
||||
Q_strncpy( cl.event_precache[eventIndex], BF_ReadString( msg ), sizeof( cl.event_precache[0] ));
|
||||
Q_strncpy( cl.event_precache[eventIndex], MSG_ReadString( msg ), sizeof( cl.event_precache[0] ));
|
||||
|
||||
// can be set now
|
||||
CL_SetEventIndex( cl.event_precache[eventIndex], eventIndex );
|
||||
|
@ -1042,16 +1054,16 @@ void CL_UpdateUserPings( sizebuf_t *msg )
|
|||
|
||||
for( i = 0; i < MAX_CLIENTS; i++ )
|
||||
{
|
||||
if( !BF_ReadOneBit( msg )) break; // end of message
|
||||
if( !MSG_ReadOneBit( msg )) break; // end of message
|
||||
|
||||
slot = BF_ReadUBitLong( msg, MAX_CLIENT_BITS );
|
||||
slot = MSG_ReadUBitLong( msg, MAX_CLIENT_BITS );
|
||||
|
||||
if( slot >= MAX_CLIENTS )
|
||||
Host_Error( "CL_ParseServerMessage: svc_updatepings > MAX_CLIENTS\n" );
|
||||
|
||||
player = &cl.players[slot];
|
||||
player->ping = BF_ReadUBitLong( msg, 12 );
|
||||
player->packet_loss = BF_ReadUBitLong( msg, 7 );
|
||||
player->ping = MSG_ReadUBitLong( msg, 12 );
|
||||
player->packet_loss = MSG_ReadUBitLong( msg, 7 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1066,8 +1078,8 @@ void CL_ServerInfo( sizebuf_t *msg )
|
|||
{
|
||||
string key, value;
|
||||
|
||||
Q_strncpy( key, BF_ReadString( msg ), sizeof( key ));
|
||||
Q_strncpy( value, BF_ReadString( msg ), sizeof( value ));
|
||||
Q_strncpy( key, MSG_ReadString( msg ), sizeof( key ));
|
||||
Q_strncpy( value, MSG_ReadString( msg ), sizeof( value ));
|
||||
Info_SetValueForKey( cl.serverinfo, key, value );
|
||||
}
|
||||
|
||||
|
@ -1091,15 +1103,15 @@ void CL_CheckingResFile( char *pResFileName )
|
|||
|
||||
if( cls.state == ca_disconnected ) return;
|
||||
|
||||
BF_Init( &buf, "ClientPacket", data, sizeof( data ));
|
||||
BF_WriteByte( &buf, clc_resourcelist );
|
||||
BF_WriteString( &buf, pResFileName );
|
||||
MSG_Init( &buf, "ClientPacket", data, sizeof( data ));
|
||||
MSG_WriteByte( &buf, clc_resourcelist );
|
||||
MSG_WriteString( &buf, pResFileName );
|
||||
|
||||
if( !cls.netchan.remote_address.type ) // download in singleplayer ???
|
||||
cls.netchan.remote_address.type = NA_LOOPBACK;
|
||||
|
||||
// make sure message will be delivered
|
||||
Netchan_Transmit( &cls.netchan, BF_GetNumBytesWritten( &buf ), BF_GetData( &buf ));
|
||||
Netchan_Transmit( &cls.netchan, MSG_GetNumBytesWritten( &buf ), MSG_GetData( &buf ));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1129,12 +1141,12 @@ void CL_ParseResourceList( sizebuf_t *msg )
|
|||
|
||||
Q_memset( &reslist, 0, sizeof( resourcelist_t ));
|
||||
|
||||
reslist.rescount = BF_ReadWord( msg ) - 1;
|
||||
reslist.rescount = MSG_ReadWord( msg ) - 1;
|
||||
|
||||
for( i = 0; i < reslist.rescount; i++ )
|
||||
{
|
||||
reslist.restype[i] = BF_ReadWord( msg );
|
||||
Q_strncpy( reslist.resnames[i], BF_ReadString( msg ), CS_SIZE );
|
||||
reslist.restype[i] = MSG_ReadWord( msg );
|
||||
Q_strncpy( reslist.resnames[i], MSG_ReadString( msg ), CS_SIZE );
|
||||
}
|
||||
|
||||
cls.downloadcount = 0;
|
||||
|
@ -1148,8 +1160,8 @@ void CL_ParseResourceList( sizebuf_t *msg )
|
|||
|
||||
if( !cls.downloadcount )
|
||||
{
|
||||
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
BF_WriteString( &cls.netchan.message, "continueloading" );
|
||||
MSG_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
MSG_WriteString( &cls.netchan.message, "continueloading" );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1163,10 +1175,10 @@ spectator message (hltv)
|
|||
void CL_ParseDirector( sizebuf_t *msg )
|
||||
{
|
||||
byte pbuf[256];
|
||||
int iSize = BF_ReadByte( msg );
|
||||
int iSize = MSG_ReadByte( msg );
|
||||
|
||||
// parse user message into buffer
|
||||
BF_ReadBytes( msg, pbuf, iSize );
|
||||
MSG_ReadBytes( msg, pbuf, iSize );
|
||||
clgame.dllFuncs.pfnDirectorMessage( iSize, pbuf );
|
||||
}
|
||||
|
||||
|
@ -1186,23 +1198,23 @@ void CL_ParseStudioDecal( sizebuf_t *msg )
|
|||
int modelIndex = 0;
|
||||
int flags;
|
||||
|
||||
BF_ReadVec3Coord( msg, pos );
|
||||
BF_ReadVec3Coord( msg, start );
|
||||
decalIndex = BF_ReadWord( msg );
|
||||
entityIndex = BF_ReadWord( msg );
|
||||
flags = BF_ReadByte( msg );
|
||||
MSG_ReadVec3Coord( msg, pos );
|
||||
MSG_ReadVec3Coord( msg, start );
|
||||
decalIndex = MSG_ReadWord( msg );
|
||||
entityIndex = MSG_ReadWord( msg );
|
||||
flags = MSG_ReadByte( msg );
|
||||
|
||||
state.sequence = BF_ReadShort( msg );
|
||||
state.frame = BF_ReadShort( msg );
|
||||
state.blending[0] = BF_ReadByte( msg );
|
||||
state.blending[1] = BF_ReadByte( msg );
|
||||
state.controller[0] = BF_ReadByte( msg );
|
||||
state.controller[1] = BF_ReadByte( msg );
|
||||
state.controller[2] = BF_ReadByte( msg );
|
||||
state.controller[3] = BF_ReadByte( msg );
|
||||
modelIndex = BF_ReadWord( msg );
|
||||
state.body = BF_ReadByte( msg );
|
||||
state.skin = BF_ReadByte( msg );
|
||||
state.sequence = MSG_ReadShort( msg );
|
||||
state.frame = MSG_ReadShort( msg );
|
||||
state.blending[0] = MSG_ReadByte( msg );
|
||||
state.blending[1] = MSG_ReadByte( msg );
|
||||
state.controller[0] = MSG_ReadByte( msg );
|
||||
state.controller[1] = MSG_ReadByte( msg );
|
||||
state.controller[2] = MSG_ReadByte( msg );
|
||||
state.controller[3] = MSG_ReadByte( msg );
|
||||
modelIndex = MSG_ReadWord( msg );
|
||||
state.body = MSG_ReadByte( msg );
|
||||
state.skin = MSG_ReadByte( msg );
|
||||
|
||||
if( clgame.drawFuncs.R_StudioDecalShoot != NULL )
|
||||
{
|
||||
|
@ -1225,9 +1237,9 @@ Set screen shake
|
|||
*/
|
||||
void CL_ParseScreenShake( sizebuf_t *msg )
|
||||
{
|
||||
clgame.shake.amplitude = (float)(word)BF_ReadShort( msg ) * (1.0f / (float)(1<<12));
|
||||
clgame.shake.duration = (float)(word)BF_ReadShort( msg ) * (1.0f / (float)(1<<12));
|
||||
clgame.shake.frequency = (float)(word)BF_ReadShort( msg ) * (1.0f / (float)(1<<8));
|
||||
clgame.shake.amplitude = (float)(word)MSG_ReadShort( msg ) * (1.0f / (float)(1<<12));
|
||||
clgame.shake.duration = (float)(word)MSG_ReadShort( msg ) * (1.0f / (float)(1<<12));
|
||||
clgame.shake.frequency = (float)(word)MSG_ReadShort( msg ) * (1.0f / (float)(1<<8));
|
||||
clgame.shake.time = cl.time + max( clgame.shake.duration, 0.01f );
|
||||
clgame.shake.next_shake = 0.0f; // apply immediately
|
||||
}
|
||||
|
@ -1244,14 +1256,14 @@ void CL_ParseScreenFade( sizebuf_t *msg )
|
|||
float duration, holdTime;
|
||||
screenfade_t *sf = &clgame.fade;
|
||||
|
||||
duration = (float)(word)BF_ReadShort( msg ) * (1.0f / (float)(1<<12));
|
||||
holdTime = (float)(word)BF_ReadShort( msg ) * (1.0f / (float)(1<<12));
|
||||
sf->fadeFlags = BF_ReadShort( msg );
|
||||
duration = (float)(word)MSG_ReadShort( msg ) * (1.0f / (float)(1<<12));
|
||||
holdTime = (float)(word)MSG_ReadShort( msg ) * (1.0f / (float)(1<<12));
|
||||
sf->fadeFlags = MSG_ReadShort( msg );
|
||||
|
||||
sf->fader = BF_ReadByte( msg );
|
||||
sf->fadeg = BF_ReadByte( msg );
|
||||
sf->fadeb = BF_ReadByte( msg );
|
||||
sf->fadealpha = BF_ReadByte( msg );
|
||||
sf->fader = MSG_ReadByte( msg );
|
||||
sf->fadeg = MSG_ReadByte( msg );
|
||||
sf->fadeb = MSG_ReadByte( msg );
|
||||
sf->fadealpha = MSG_ReadByte( msg );
|
||||
sf->fadeSpeed = 0.0f;
|
||||
sf->fadeEnd = duration;
|
||||
sf->fadeReset = holdTime;
|
||||
|
@ -1292,12 +1304,12 @@ and sent it back to the server
|
|||
*/
|
||||
void CL_ParseCvarValue( sizebuf_t *msg )
|
||||
{
|
||||
const char *cvarName = BF_ReadString( msg );
|
||||
const char *cvarName = MSG_ReadString( msg );
|
||||
convar_t *cvar = Cvar_FindVar( cvarName );
|
||||
|
||||
// build the answer
|
||||
BF_WriteByte( &cls.netchan.message, clc_requestcvarvalue );
|
||||
BF_WriteString( &cls.netchan.message, cvar ? cvar->string : "Not Found" );
|
||||
MSG_WriteByte( &cls.netchan.message, clc_requestcvarvalue );
|
||||
MSG_WriteString( &cls.netchan.message, cvar ? cvar->string : "Not Found" );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1310,15 +1322,15 @@ and sent it back to the server
|
|||
*/
|
||||
void CL_ParseCvarValue2( sizebuf_t *msg )
|
||||
{
|
||||
int requestID = BF_ReadLong( msg );
|
||||
const char *cvarName = BF_ReadString( msg );
|
||||
int requestID = MSG_ReadLong( msg );
|
||||
const char *cvarName = MSG_ReadString( msg );
|
||||
convar_t *cvar = Cvar_FindVar( cvarName );
|
||||
|
||||
// build the answer
|
||||
BF_WriteByte( &cls.netchan.message, clc_requestcvarvalue2 );
|
||||
BF_WriteLong( &cls.netchan.message, requestID );
|
||||
BF_WriteString( &cls.netchan.message, cvarName );
|
||||
BF_WriteString( &cls.netchan.message, cvar ? cvar->string : "Not Found" );
|
||||
MSG_WriteByte( &cls.netchan.message, clc_requestcvarvalue2 );
|
||||
MSG_WriteLong( &cls.netchan.message, requestID );
|
||||
MSG_WriteString( &cls.netchan.message, cvarName );
|
||||
MSG_WriteString( &cls.netchan.message, cvar ? cvar->string : "Not Found" );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1405,10 +1417,10 @@ void CL_ParseUserMessage( sizebuf_t *msg, int svc_num )
|
|||
iSize = clgame.msg[i].size;
|
||||
|
||||
// message with variable sizes receive an actual size as first byte
|
||||
if( iSize == -1 ) iSize = BF_ReadByte( msg );
|
||||
if( iSize == -1 ) iSize = MSG_ReadByte( msg );
|
||||
|
||||
// parse user message into buffer
|
||||
BF_ReadBytes( msg, pbuf, iSize );
|
||||
MSG_ReadBytes( msg, pbuf, iSize );
|
||||
|
||||
if( clgame.msg[i].func )
|
||||
{
|
||||
|
@ -1447,28 +1459,28 @@ void CL_ParseServerMessage( sizebuf_t *msg )
|
|||
char *s;
|
||||
int i, j, cmd;
|
||||
int param1, param2;
|
||||
int bufStart;
|
||||
int bufStart, playerbytes;
|
||||
|
||||
cls_message_debug.parsing = true; // begin parsing
|
||||
starting_count = BF_GetNumBytesRead( msg ); // updates each frame
|
||||
starting_count = MSG_GetNumBytesRead( msg ); // updates each frame
|
||||
|
||||
// parse the message
|
||||
while( 1 )
|
||||
{
|
||||
if( BF_CheckOverflow( msg ))
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
{
|
||||
Host_Error( "CL_ParseServerMessage: overflow!\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// mark start position
|
||||
bufStart = BF_GetNumBytesRead( msg );
|
||||
bufStart = MSG_GetNumBytesRead( msg );
|
||||
|
||||
// end of message
|
||||
if( BF_GetNumBitsLeft( msg ) < 8 )
|
||||
if( MSG_GetNumBitsLeft( msg ) < 8 )
|
||||
break;
|
||||
|
||||
cmd = BF_ReadByte( msg );
|
||||
cmd = MSG_ReadByte( msg );
|
||||
|
||||
// record command for debugging spew on parse problem
|
||||
CL_Parse_RecordCommand( cmd, bufStart );
|
||||
|
@ -1487,7 +1499,7 @@ void CL_ParseServerMessage( sizebuf_t *msg )
|
|||
Host_AbortCurrentFrame ();
|
||||
break;
|
||||
case svc_changing:
|
||||
if( BF_ReadOneBit( msg ))
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
{
|
||||
cls.changelevel = true;
|
||||
S_StopAllSounds();
|
||||
|
@ -1512,23 +1524,24 @@ void CL_ParseServerMessage( sizebuf_t *msg )
|
|||
cls.connect_time = MAX_HEARTBEAT; // CL_CheckForResend() will fire immediately
|
||||
break;
|
||||
case svc_setview:
|
||||
cl.refdef.viewentity = BF_ReadWord( msg );
|
||||
cl.refdef.viewentity = MSG_ReadWord( msg );
|
||||
break;
|
||||
case svc_sound:
|
||||
CL_ParseSoundPacket( msg, false );
|
||||
cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_time:
|
||||
// shuffle timestamps
|
||||
cl.mtime[1] = cl.mtime[0];
|
||||
cl.mtime[0] = BF_ReadFloat( msg );
|
||||
cl.mtime[0] = MSG_ReadFloat( msg );
|
||||
break;
|
||||
case svc_print:
|
||||
i = BF_ReadByte( msg );
|
||||
MsgDev( D_INFO, "^6%s", BF_ReadString( msg ));
|
||||
i = MSG_ReadByte( msg );
|
||||
MsgDev( D_INFO, "^6%s", MSG_ReadString( msg ));
|
||||
if( i == PRINT_CHAT ) S_StartLocalSound( "common/menu2.wav", VOL_NORM, false );
|
||||
break;
|
||||
case svc_stufftext:
|
||||
s = BF_ReadString( msg );
|
||||
s = MSG_ReadString( msg );
|
||||
Cbuf_AddText( s );
|
||||
break;
|
||||
case svc_lightstyle:
|
||||
|
@ -1546,12 +1559,17 @@ void CL_ParseServerMessage( sizebuf_t *msg )
|
|||
break;
|
||||
case svc_clientdata:
|
||||
CL_ParseClientData( msg );
|
||||
cl.frames[cl.parsecountmod].graphdata.client += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_packetentities:
|
||||
CL_ParsePacketEntities( msg, false );
|
||||
playerbytes = CL_ParsePacketEntities( msg, false );
|
||||
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
||||
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
||||
break;
|
||||
case svc_deltapacketentities:
|
||||
CL_ParsePacketEntities( msg, true );
|
||||
playerbytes = CL_ParsePacketEntities( msg, true );
|
||||
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
||||
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
||||
break;
|
||||
case svc_updatepings:
|
||||
CL_UpdateUserPings( msg );
|
||||
|
@ -1579,9 +1597,10 @@ void CL_ParseServerMessage( sizebuf_t *msg )
|
|||
break;
|
||||
case svc_temp_entity:
|
||||
CL_ParseTempEntity( msg );
|
||||
cl.frames[cl.parsecountmod].graphdata.tentities += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_setpause:
|
||||
cl.refdef.paused = ( BF_ReadOneBit( msg ) != 0 );
|
||||
cl.refdef.paused = ( MSG_ReadOneBit( msg ) != 0 );
|
||||
break;
|
||||
case svc_deltamovevars:
|
||||
CL_ParseMovevars( msg );
|
||||
|
@ -1590,13 +1609,15 @@ void CL_ParseServerMessage( sizebuf_t *msg )
|
|||
CL_ParseCustomization( msg );
|
||||
break;
|
||||
case svc_centerprint:
|
||||
CL_CenterPrint( BF_ReadString( msg ), 0.25f );
|
||||
CL_CenterPrint( MSG_ReadString( msg ), 0.25f );
|
||||
break;
|
||||
case svc_event:
|
||||
CL_ParseEvent( msg );
|
||||
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_event_reliable:
|
||||
CL_ParseReliableEvent( msg );
|
||||
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_updateuserinfo:
|
||||
CL_UpdateUserinfo( msg );
|
||||
|
@ -1614,9 +1635,9 @@ void CL_ParseServerMessage( sizebuf_t *msg )
|
|||
CL_ParseSoundFade( msg );
|
||||
break;
|
||||
case svc_cdtrack:
|
||||
param1 = BF_ReadByte( msg );
|
||||
param1 = MSG_ReadByte( msg );
|
||||
param1 = bound( 1, param1, MAX_CDTRACKS ); // tracknum
|
||||
param2 = BF_ReadByte( msg );
|
||||
param2 = MSG_ReadByte( msg );
|
||||
param2 = bound( 1, param2, MAX_CDTRACKS ); // loopnum
|
||||
S_StartBackgroundTrack( clgame.cdtracks[param1-1], clgame.cdtracks[param2-1], 0 );
|
||||
break;
|
||||
|
@ -1630,19 +1651,19 @@ void CL_ParseServerMessage( sizebuf_t *msg )
|
|||
Delta_ParseTableField( msg );
|
||||
break;
|
||||
case svc_weaponanim:
|
||||
param1 = BF_ReadByte( msg ); // iAnim
|
||||
param2 = BF_ReadByte( msg ); // body
|
||||
param1 = MSG_ReadByte( msg ); // iAnim
|
||||
param2 = MSG_ReadByte( msg ); // body
|
||||
CL_WeaponAnim( param1, param2 );
|
||||
break;
|
||||
case svc_bspdecal:
|
||||
CL_ParseStaticDecal( msg );
|
||||
break;
|
||||
case svc_roomtype:
|
||||
param1 = BF_ReadShort( msg );
|
||||
param1 = MSG_ReadShort( msg );
|
||||
Cvar_SetFloat( "room_type", param1 );
|
||||
break;
|
||||
case svc_chokecount:
|
||||
i = BF_ReadByte( msg );
|
||||
i = MSG_ReadByte( msg );
|
||||
j = cls.netchan.incoming_acknowledged - 1;
|
||||
for( ; i > 0 && j > cls.netchan.outgoing_sequence - CL_UPDATE_BACKUP; j-- )
|
||||
{
|
||||
|
@ -1670,6 +1691,7 @@ void CL_ParseServerMessage( sizebuf_t *msg )
|
|||
break;
|
||||
default:
|
||||
CL_ParseUserMessage( msg, cmd );
|
||||
cl.frames[cl.parsecountmod].graphdata.usr += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1105,10 +1105,7 @@ void CL_PredictMovement( void )
|
|||
if( cls.state != ca_active ) return;
|
||||
|
||||
if( cls.demoplayback && cl.refdef.cmd != NULL )
|
||||
{
|
||||
// restore viewangles from cmd.angles
|
||||
VectorCopy( cl.refdef.cmd->viewangles, cl.refdef.cl_viewangles );
|
||||
}
|
||||
CL_DemoInterpolateAngles();
|
||||
|
||||
if( !CL_IsInGame( )) return;
|
||||
|
||||
|
|
|
@ -116,42 +116,26 @@ void SCR_NetSpeeds( void )
|
|||
int x, y, height;
|
||||
char *p, *start, *end;
|
||||
float time = cl.mtime[0];
|
||||
static int min_svfps = 100;
|
||||
static int max_svfps = 0;
|
||||
int cur_svfps = 0;
|
||||
rgba_t color;
|
||||
|
||||
if( !net_speeds->integer ) return;
|
||||
if( cls.state != ca_active ) return;
|
||||
if( !net_speeds->integer || cls.demoplayback || cls.state != ca_active )
|
||||
return;
|
||||
|
||||
switch( net_speeds->integer )
|
||||
if( cl_serverframetime() != 0 )
|
||||
{
|
||||
case 1:
|
||||
if( cls.netchan.compress )
|
||||
{
|
||||
Q_snprintf( msg, sizeof( msg ), "Game Time: %02d:%02d\nTotal received from server:\n Huffman %s\nUncompressed %s\n",
|
||||
(int)(time / 60.0f ), (int)fmod( time, 60.0f ), Q_memprint( cls.netchan.total_received ), Q_memprint( cls.netchan.total_received_uncompressed ));
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_snprintf( msg, sizeof( msg ), "Game Time: %02d:%02d\nTotal received from server:\nUncompressed %s\n",
|
||||
(int)(time / 60.0f ), (int)fmod( time, 60.0f ), Q_memprint( cls.netchan.total_received_uncompressed ));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if( cls.netchan.compress )
|
||||
{
|
||||
Q_snprintf( msg, sizeof( msg ), "Game Time: %02d:%02d\nTotal sended to server:\nHuffman %s\nUncompressed %s\n",
|
||||
(int)(time / 60.0f ), (int)fmod( time, 60.0f ), Q_memprint( cls.netchan.total_sended ), Q_memprint( cls.netchan.total_sended_uncompressed ));
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_snprintf( msg, sizeof( msg ), "Game Time: %02d:%02d\nTotal sended to server:\nUncompressed %s\n",
|
||||
(int)(time / 60.0f ), (int)fmod( time, 60.0f ), Q_memprint( cls.netchan.total_sended_uncompressed ));
|
||||
}
|
||||
break;
|
||||
default: return;
|
||||
cur_svfps = Q_rint( 1.0f / cl_serverframetime( ));
|
||||
if( cur_svfps < min_svfps ) min_svfps = cur_svfps;
|
||||
if( cur_svfps > max_svfps ) max_svfps = cur_svfps;
|
||||
}
|
||||
|
||||
Q_snprintf( msg, sizeof( msg ), "sv fps: ^1%4i min, ^3%4i cur, ^2%4i max\nGame Time: %02d:%02d\nTotal sended to server: %s\nTotal received from server: %s\n",
|
||||
min_svfps, cur_svfps, max_svfps, (int)(time / 60.0f ), (int)fmod( time, 60.0f ), Q_memprint( cls.netchan.total_sended ), Q_memprint( cls.netchan.total_received ));
|
||||
|
||||
x = scr_width->integer - 320;
|
||||
y = 256;
|
||||
y = 384;
|
||||
|
||||
Con_DrawStringLen( NULL, NULL, &height );
|
||||
MakeRGBA( color, 255, 255, 255, 255 );
|
||||
|
@ -258,7 +242,7 @@ void SCR_MakeScreenShot( void )
|
|||
{
|
||||
// snapshots don't writes message about image
|
||||
if( cls.scrshot_action != scrshot_snapshot )
|
||||
MsgDev( D_AICONSOLE, "Write %s\n", cls.shotname );
|
||||
MsgDev( D_REPORT, "Write %s\n", cls.shotname );
|
||||
}
|
||||
else MsgDev( D_ERROR, "Unable to write %s\n", cls.shotname );
|
||||
|
||||
|
@ -629,6 +613,7 @@ void SCR_Init( void )
|
|||
SCR_InstallParticlePalette ();
|
||||
SCR_RegisterTextures ();
|
||||
SCR_InitCinematic();
|
||||
CL_InitNetgraph();
|
||||
SCR_VidInit();
|
||||
|
||||
if( host.state != HOST_RESTART )
|
||||
|
|
|
@ -1809,7 +1809,7 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
{
|
||||
sizebuf_t buf;
|
||||
byte pbuf[256];
|
||||
int iSize = BF_ReadByte( msg );
|
||||
int iSize = MSG_ReadByte( msg );
|
||||
int type, color, count, flags;
|
||||
int decalIndex, modelIndex, entityIndex;
|
||||
float scale, life, frameRate, vel, random;
|
||||
|
@ -1823,12 +1823,12 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
decalIndex = modelIndex = entityIndex = 0;
|
||||
|
||||
// parse user message into buffer
|
||||
BF_ReadBytes( msg, pbuf, iSize );
|
||||
MSG_ReadBytes( msg, pbuf, iSize );
|
||||
|
||||
// init a safe tempbuffer
|
||||
BF_Init( &buf, "TempEntity", pbuf, iSize );
|
||||
MSG_Init( &buf, "TempEntity", pbuf, iSize );
|
||||
|
||||
type = BF_ReadByte( &buf );
|
||||
type = MSG_ReadByte( &buf );
|
||||
|
||||
switch( type )
|
||||
{
|
||||
|
@ -1848,113 +1848,113 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
CL_ParseViewBeam( &buf, type );
|
||||
break;
|
||||
case TE_GUNSHOT:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
CL_RicochetSound( pos );
|
||||
CL_RunParticleEffect( pos, vec3_origin, 0, 20 );
|
||||
break;
|
||||
case TE_EXPLOSION:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
scale = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
frameRate = BF_ReadByte( &buf );
|
||||
flags = BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
scale = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
frameRate = MSG_ReadByte( &buf );
|
||||
flags = MSG_ReadByte( &buf );
|
||||
CL_Explosion( pos, modelIndex, scale, frameRate, flags );
|
||||
break;
|
||||
case TE_TAREXPLOSION:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
CL_BlobExplosion( pos );
|
||||
break;
|
||||
case TE_SMOKE:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
scale = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
frameRate = BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
scale = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
frameRate = MSG_ReadByte( &buf );
|
||||
pTemp = CL_DefaultSprite( pos, modelIndex, frameRate );
|
||||
CL_Sprite_Smoke( pTemp, scale );
|
||||
break;
|
||||
case TE_TRACER:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
CL_TracerEffect( pos, pos2 );
|
||||
break;
|
||||
case TE_SPARKS:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
CL_SparkShower( pos );
|
||||
break;
|
||||
case TE_LAVASPLASH:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
CL_LavaSplash( pos );
|
||||
break;
|
||||
case TE_TELEPORT:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
CL_TeleportSplash( pos );
|
||||
break;
|
||||
case TE_EXPLOSION2:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
color = BF_ReadByte( &buf );
|
||||
count = BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
color = MSG_ReadByte( &buf );
|
||||
count = MSG_ReadByte( &buf );
|
||||
CL_ParticleExplosion2( pos, color, count );
|
||||
break;
|
||||
case TE_BSPDECAL:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
decalIndex = BF_ReadShort( &buf );
|
||||
entityIndex = BF_ReadShort( &buf );
|
||||
if( entityIndex ) modelIndex = BF_ReadShort( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
decalIndex = MSG_ReadShort( &buf );
|
||||
entityIndex = MSG_ReadShort( &buf );
|
||||
if( entityIndex ) modelIndex = MSG_ReadShort( &buf );
|
||||
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, modelIndex, pos, FDECAL_PERMANENT );
|
||||
break;
|
||||
case TE_IMPLOSION:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
scale = BF_ReadByte( &buf );
|
||||
count = BF_ReadByte( &buf );
|
||||
life = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
scale = MSG_ReadByte( &buf );
|
||||
count = MSG_ReadByte( &buf );
|
||||
life = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
CL_Implosion( pos, scale, count, life );
|
||||
break;
|
||||
case TE_SPRITETRAIL:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
count = BF_ReadByte( &buf );
|
||||
life = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
scale = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
vel = (float)BF_ReadByte( &buf );
|
||||
random = (float)BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
count = MSG_ReadByte( &buf );
|
||||
life = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
scale = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
vel = (float)MSG_ReadByte( &buf );
|
||||
random = (float)MSG_ReadByte( &buf );
|
||||
CL_Sprite_Trail( type, pos, pos2, modelIndex, count, life, scale, random, 255, vel );
|
||||
break;
|
||||
case TE_SPRITE:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
scale = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
brightness = (float)BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
scale = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
brightness = (float)MSG_ReadByte( &buf );
|
||||
|
||||
if(( pTemp = CL_DefaultSprite( pos, modelIndex, 0 )) != NULL )
|
||||
{
|
||||
|
@ -1965,13 +1965,13 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
}
|
||||
break;
|
||||
case TE_GLOWSPRITE:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
life = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
scale = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
brightness = (float)BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
life = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
scale = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
brightness = (float)MSG_ReadByte( &buf );
|
||||
|
||||
if(( pTemp = CL_DefaultSprite( pos, modelIndex, 0 )) != NULL )
|
||||
{
|
||||
|
@ -1985,101 +1985,101 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
}
|
||||
break;
|
||||
case TE_STREAK_SPLASH:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
color = BF_ReadByte( &buf );
|
||||
count = BF_ReadShort( &buf );
|
||||
vel = (float)BF_ReadShort( &buf );
|
||||
random = (float)BF_ReadShort( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
color = MSG_ReadByte( &buf );
|
||||
count = MSG_ReadShort( &buf );
|
||||
vel = (float)MSG_ReadShort( &buf );
|
||||
random = (float)MSG_ReadShort( &buf );
|
||||
CL_StreakSplash( pos, pos2, color, count, vel, -random, random );
|
||||
break;
|
||||
case TE_DLIGHT:
|
||||
dl = CL_AllocDlight( 0 );
|
||||
dl->origin[0] = BF_ReadCoord( &buf );
|
||||
dl->origin[1] = BF_ReadCoord( &buf );
|
||||
dl->origin[2] = BF_ReadCoord( &buf );
|
||||
dl->radius = (float)(BF_ReadByte( &buf ) * 10.0f);
|
||||
dl->color.r = BF_ReadByte( &buf );
|
||||
dl->color.g = BF_ReadByte( &buf );
|
||||
dl->color.b = BF_ReadByte( &buf );
|
||||
dl->die = cl.time + (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
dl->decay = (float)(BF_ReadByte( &buf ) * 10.0f);
|
||||
dl->origin[0] = MSG_ReadCoord( &buf );
|
||||
dl->origin[1] = MSG_ReadCoord( &buf );
|
||||
dl->origin[2] = MSG_ReadCoord( &buf );
|
||||
dl->radius = (float)(MSG_ReadByte( &buf ) * 10.0f);
|
||||
dl->color.r = MSG_ReadByte( &buf );
|
||||
dl->color.g = MSG_ReadByte( &buf );
|
||||
dl->color.b = MSG_ReadByte( &buf );
|
||||
dl->die = cl.time + (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
dl->decay = (float)(MSG_ReadByte( &buf ) * 10.0f);
|
||||
break;
|
||||
case TE_ELIGHT:
|
||||
dl = CL_AllocElight( 0 );
|
||||
entityIndex = BF_ReadShort( &buf );
|
||||
dl->origin[0] = BF_ReadCoord( &buf );
|
||||
dl->origin[1] = BF_ReadCoord( &buf );
|
||||
dl->origin[2] = BF_ReadCoord( &buf );
|
||||
dl->radius = BF_ReadCoord( &buf );
|
||||
dl->color.r = BF_ReadByte( &buf );
|
||||
dl->color.g = BF_ReadByte( &buf );
|
||||
dl->color.b = BF_ReadByte( &buf );
|
||||
dl->die = cl.time + (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
dl->decay = BF_ReadCoord( &buf );
|
||||
entityIndex = MSG_ReadShort( &buf );
|
||||
dl->origin[0] = MSG_ReadCoord( &buf );
|
||||
dl->origin[1] = MSG_ReadCoord( &buf );
|
||||
dl->origin[2] = MSG_ReadCoord( &buf );
|
||||
dl->radius = MSG_ReadCoord( &buf );
|
||||
dl->color.r = MSG_ReadByte( &buf );
|
||||
dl->color.g = MSG_ReadByte( &buf );
|
||||
dl->color.b = MSG_ReadByte( &buf );
|
||||
dl->die = cl.time + (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
dl->decay = MSG_ReadCoord( &buf );
|
||||
break;
|
||||
case TE_TEXTMESSAGE:
|
||||
CL_ParseTextMessage( &buf );
|
||||
break;
|
||||
case TE_LINE:
|
||||
case TE_BOX:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
life = (float)(BF_ReadShort( &buf ) * 0.1f);
|
||||
r = BF_ReadByte( &buf );
|
||||
g = BF_ReadByte( &buf );
|
||||
b = BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
life = (float)(MSG_ReadShort( &buf ) * 0.1f);
|
||||
r = MSG_ReadByte( &buf );
|
||||
g = MSG_ReadByte( &buf );
|
||||
b = MSG_ReadByte( &buf );
|
||||
if( type == TE_LINE ) CL_ParticleLine( pos, pos2, r, g, b, life );
|
||||
else CL_ParticleBox( pos, pos2, r, g, b, life );
|
||||
break;
|
||||
case TE_LARGEFUNNEL:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
flags = BF_ReadShort( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
flags = MSG_ReadShort( &buf );
|
||||
CL_FunnelSprite( pos, modelIndex, flags );
|
||||
break;
|
||||
case TE_BLOODSTREAM:
|
||||
case TE_BLOOD:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
color = BF_ReadByte( &buf );
|
||||
vel = (float)BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
color = MSG_ReadByte( &buf );
|
||||
vel = (float)MSG_ReadByte( &buf );
|
||||
if( type == TE_BLOOD ) CL_Blood( pos, pos2, color, vel );
|
||||
else CL_BloodStream( pos, pos2, color, vel );
|
||||
break;
|
||||
case TE_SHOWLINE:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
CL_ShowLine( pos, pos2 );
|
||||
break;
|
||||
case TE_DECAL:
|
||||
case TE_DECALHIGH:
|
||||
case TE_WORLDDECAL:
|
||||
case TE_WORLDDECALHIGH:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
decalIndex = BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
decalIndex = MSG_ReadByte( &buf );
|
||||
if( type == TE_DECAL || type == TE_DECALHIGH )
|
||||
entityIndex = BF_ReadShort( &buf );
|
||||
entityIndex = MSG_ReadShort( &buf );
|
||||
else entityIndex = 0;
|
||||
if( type == TE_DECALHIGH || type == TE_WORLDDECALHIGH )
|
||||
decalIndex += 256;
|
||||
|
@ -2088,58 +2088,58 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, modelIndex, pos, 0 );
|
||||
break;
|
||||
case TE_FIZZ:
|
||||
entityIndex = BF_ReadShort( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
scale = BF_ReadByte( &buf ); // same as density
|
||||
entityIndex = MSG_ReadShort( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
scale = MSG_ReadByte( &buf ); // same as density
|
||||
pEnt = CL_GetEntityByIndex( entityIndex );
|
||||
CL_FizzEffect( pEnt, modelIndex, scale );
|
||||
break;
|
||||
case TE_MODEL:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
VectorSet( ang, 0.0f, BF_ReadAngle( &buf ), 0.0f ); // yaw angle
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
flags = BF_ReadByte( &buf ); // sound flags
|
||||
life = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
VectorSet( ang, 0.0f, MSG_ReadAngle( &buf ), 0.0f ); // yaw angle
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
flags = MSG_ReadByte( &buf ); // sound flags
|
||||
life = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
CL_TempModel( pos, pos2, ang, life, modelIndex, flags );
|
||||
break;
|
||||
case TE_EXPLODEMODEL:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
vel = BF_ReadCoord( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
count = BF_ReadShort( &buf );
|
||||
life = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
vel = MSG_ReadCoord( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
count = MSG_ReadShort( &buf );
|
||||
life = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
CL_TempSphereModel( pos, vel, life, count, modelIndex );
|
||||
break;
|
||||
case TE_BREAKMODEL:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
ang[0] = BF_ReadCoord( &buf );
|
||||
ang[1] = BF_ReadCoord( &buf );
|
||||
ang[2] = BF_ReadCoord( &buf );
|
||||
random = (float)BF_ReadByte( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
count = BF_ReadByte( &buf );
|
||||
life = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
flags = BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
ang[0] = MSG_ReadCoord( &buf );
|
||||
ang[1] = MSG_ReadCoord( &buf );
|
||||
ang[2] = MSG_ReadCoord( &buf );
|
||||
random = (float)MSG_ReadByte( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
count = MSG_ReadByte( &buf );
|
||||
life = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
flags = MSG_ReadByte( &buf );
|
||||
CL_BreakModel( pos, pos2, ang, random, life, count, modelIndex, (char)flags );
|
||||
break;
|
||||
case TE_GUNSHOTDECAL:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
entityIndex = BF_ReadShort( &buf );
|
||||
decalIndex = BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
entityIndex = MSG_ReadShort( &buf );
|
||||
decalIndex = MSG_ReadByte( &buf );
|
||||
pEnt = CL_GetEntityByIndex( entityIndex );
|
||||
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 );
|
||||
CL_BulletImpactParticles( pos );
|
||||
|
@ -2147,140 +2147,140 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
break;
|
||||
case TE_SPRAY:
|
||||
case TE_SPRITE_SPRAY:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
count = BF_ReadByte( &buf );
|
||||
vel = (float)BF_ReadByte( &buf );
|
||||
random = (float)BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
count = MSG_ReadByte( &buf );
|
||||
vel = (float)MSG_ReadByte( &buf );
|
||||
random = (float)MSG_ReadByte( &buf );
|
||||
if( type == TE_SPRAY )
|
||||
{
|
||||
flags = BF_ReadByte( &buf ); // rendermode
|
||||
flags = MSG_ReadByte( &buf ); // rendermode
|
||||
CL_Spray( pos, pos2, modelIndex, count, vel, random, flags );
|
||||
}
|
||||
else CL_Sprite_Spray( pos, pos2, modelIndex, count, vel, random );
|
||||
break;
|
||||
case TE_ARMOR_RICOCHET:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
scale = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
scale = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
modelIndex = CL_FindModelIndex( "sprites/richo1.spr" );
|
||||
CL_RicochetSprite( pos, Mod_Handle( modelIndex ), 0.0f, scale );
|
||||
CL_RicochetSound( pos );
|
||||
break;
|
||||
case TE_PLAYERDECAL:
|
||||
color = BF_ReadByte( &buf ); // playernum
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
entityIndex = BF_ReadShort( &buf );
|
||||
decalIndex = BF_ReadByte( &buf );
|
||||
color = MSG_ReadByte( &buf ); // playernum
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
entityIndex = MSG_ReadShort( &buf );
|
||||
decalIndex = MSG_ReadByte( &buf );
|
||||
CL_PlayerDecal( CL_DecalIndex( decalIndex ), entityIndex, pos );
|
||||
break;
|
||||
case TE_BUBBLES:
|
||||
case TE_BUBBLETRAIL:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
scale = BF_ReadCoord( &buf ); // water height
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
count = BF_ReadByte( &buf );
|
||||
vel = BF_ReadCoord( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
scale = MSG_ReadCoord( &buf ); // water height
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
count = MSG_ReadByte( &buf );
|
||||
vel = MSG_ReadCoord( &buf );
|
||||
if( type == TE_BUBBLES ) CL_Bubbles( pos, pos2, scale, modelIndex, count, vel );
|
||||
else CL_BubbleTrail( pos, pos2, scale, modelIndex, count, vel );
|
||||
break;
|
||||
case TE_BLOODSPRITE:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
modelIndex = BF_ReadShort( &buf ); // sprite #1
|
||||
decalIndex = BF_ReadShort( &buf ); // sprite #2
|
||||
color = BF_ReadByte( &buf );
|
||||
scale = (float)BF_ReadByte( &buf );
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf ); // sprite #1
|
||||
decalIndex = MSG_ReadShort( &buf ); // sprite #2
|
||||
color = MSG_ReadByte( &buf );
|
||||
scale = (float)MSG_ReadByte( &buf );
|
||||
CL_BloodSprite( pos, color, modelIndex, decalIndex, scale );
|
||||
break;
|
||||
case TE_PROJECTILE:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
life = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
color = BF_ReadByte( &buf ); // playernum
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
life = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
color = MSG_ReadByte( &buf ); // playernum
|
||||
CL_Projectile( pos, pos2, modelIndex, life, color, NULL );
|
||||
break;
|
||||
case TE_PLAYERSPRITES:
|
||||
color = BF_ReadShort( &buf ); // entitynum
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
count = BF_ReadByte( &buf );
|
||||
random = (float)BF_ReadByte( &buf );
|
||||
color = MSG_ReadShort( &buf ); // entitynum
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
count = MSG_ReadByte( &buf );
|
||||
random = (float)MSG_ReadByte( &buf );
|
||||
CL_PlayerSprites( color, modelIndex, count, random );
|
||||
break;
|
||||
case TE_PARTICLEBURST:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
scale = (float)BF_ReadShort( &buf );
|
||||
color = BF_ReadByte( &buf );
|
||||
life = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
scale = (float)MSG_ReadShort( &buf );
|
||||
color = MSG_ReadByte( &buf );
|
||||
life = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
CL_ParticleBurst( pos, scale, color, life );
|
||||
break;
|
||||
case TE_FIREFIELD:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
scale = (float)BF_ReadShort( &buf );
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
count = BF_ReadByte( &buf );
|
||||
flags = BF_ReadByte( &buf );
|
||||
life = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
scale = (float)MSG_ReadShort( &buf );
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
count = MSG_ReadByte( &buf );
|
||||
flags = MSG_ReadByte( &buf );
|
||||
life = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
CL_FireField( pos, scale, modelIndex, count, flags, life );
|
||||
break;
|
||||
case TE_PLAYERATTACHMENT:
|
||||
color = BF_ReadByte( &buf ); // playernum
|
||||
scale = BF_ReadCoord( &buf ); // height
|
||||
modelIndex = BF_ReadShort( &buf );
|
||||
life = (float)(BF_ReadShort( &buf ) * 0.1f);
|
||||
color = MSG_ReadByte( &buf ); // playernum
|
||||
scale = MSG_ReadCoord( &buf ); // height
|
||||
modelIndex = MSG_ReadShort( &buf );
|
||||
life = (float)(MSG_ReadShort( &buf ) * 0.1f);
|
||||
CL_AttachTentToPlayer( color, modelIndex, scale, life );
|
||||
break;
|
||||
case TE_KILLPLAYERATTACHMENTS:
|
||||
color = BF_ReadByte( &buf ); // playernum
|
||||
color = MSG_ReadByte( &buf ); // playernum
|
||||
CL_KillAttachedTents( color );
|
||||
break;
|
||||
case TE_MULTIGUNSHOT:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
ang[0] = BF_ReadCoord( &buf ) * 0.01f;
|
||||
ang[1] = BF_ReadCoord( &buf ) * 0.01f;
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
ang[0] = MSG_ReadCoord( &buf ) * 0.01f;
|
||||
ang[1] = MSG_ReadCoord( &buf ) * 0.01f;
|
||||
ang[2] = 0.0f;
|
||||
count = BF_ReadByte( &buf );
|
||||
decalIndices[0] = BF_ReadByte( &buf );
|
||||
count = MSG_ReadByte( &buf );
|
||||
decalIndices[0] = MSG_ReadByte( &buf );
|
||||
CL_MultiGunshot( pos, pos2, ang, count, 1, decalIndices );
|
||||
break;
|
||||
case TE_USERTRACER:
|
||||
pos[0] = BF_ReadCoord( &buf );
|
||||
pos[1] = BF_ReadCoord( &buf );
|
||||
pos[2] = BF_ReadCoord( &buf );
|
||||
pos2[0] = BF_ReadCoord( &buf );
|
||||
pos2[1] = BF_ReadCoord( &buf );
|
||||
pos2[2] = BF_ReadCoord( &buf );
|
||||
life = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
color = BF_ReadByte( &buf );
|
||||
scale = (float)(BF_ReadByte( &buf ) * 0.1f);
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
pos[1] = MSG_ReadCoord( &buf );
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
pos2[0] = MSG_ReadCoord( &buf );
|
||||
pos2[1] = MSG_ReadCoord( &buf );
|
||||
pos2[2] = MSG_ReadCoord( &buf );
|
||||
life = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
color = MSG_ReadByte( &buf );
|
||||
scale = (float)(MSG_ReadByte( &buf ) * 0.1f);
|
||||
CL_UserTracerParticle( pos, pos2, life, color, scale, 0, NULL );
|
||||
break;
|
||||
default:
|
||||
|
@ -2289,7 +2289,7 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
}
|
||||
|
||||
// throw warning
|
||||
if( BF_CheckOverflow( &buf )) MsgDev( D_WARN, "ParseTempEntity: overflow TE message\n" );
|
||||
if( MSG_CheckOverflow( &buf )) MsgDev( D_WARN, "ParseTempEntity: overflow TE message\n" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2346,7 +2346,7 @@ void CL_SetLightstyle( int style, const char *s, float f )
|
|||
break;
|
||||
}
|
||||
}
|
||||
MsgDev( D_AICONSOLE, "Lightstyle %i (%s), interp %s\n", style, ls->pattern, ls->interp ? "Yes" : "No" );
|
||||
MsgDev( D_REPORT, "Lightstyle %i (%s), interp %s\n", style, ls->pattern, ls->interp ? "Yes" : "No" );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -59,14 +59,17 @@ qboolean SCR_NextMovie( void )
|
|||
{
|
||||
string str;
|
||||
|
||||
if( cls.movienum == -1 )
|
||||
{
|
||||
S_StopAllSounds();
|
||||
SCR_StopCinematic();
|
||||
|
||||
if( cls.movienum == -1 )
|
||||
return false; // don't play movies
|
||||
}
|
||||
|
||||
if( !cls.movies[cls.movienum][0] || cls.movienum == MAX_MOVIES )
|
||||
{
|
||||
S_StopAllSounds();
|
||||
SCR_StopCinematic();
|
||||
cls.movienum = -1;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -20,198 +20,6 @@ GNU General Public License for more details.
|
|||
#include "gl_local.h"
|
||||
#include "vgui_draw.h"
|
||||
|
||||
/*
|
||||
===============
|
||||
V_SetupRefDef
|
||||
|
||||
update refdef values each frame
|
||||
===============
|
||||
*/
|
||||
void V_SetupRefDef( void )
|
||||
{
|
||||
cl_entity_t *clent;
|
||||
int size;
|
||||
int sb_lines;
|
||||
|
||||
clent = CL_GetLocalPlayer ();
|
||||
|
||||
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
||||
if( cl_lw->value ) clgame.viewent.curstate.modelindex = cl.predicted.viewmodel;
|
||||
else clgame.viewent.curstate.modelindex = cl.frame.client.viewmodel;
|
||||
clgame.viewent.model = Mod_Handle( clgame.viewent.curstate.modelindex );
|
||||
clgame.viewent.curstate.number = cl.playernum + 1;
|
||||
clgame.viewent.curstate.entityType = ET_NORMAL;
|
||||
clgame.viewent.index = cl.playernum + 1;
|
||||
|
||||
cl.refdef.movevars = &clgame.movevars;
|
||||
cl.refdef.health = cl.frame.client.health;
|
||||
cl.refdef.playernum = cl.playernum;
|
||||
cl.refdef.max_entities = clgame.maxEntities;
|
||||
cl.refdef.maxclients = cl.maxclients;
|
||||
cl.refdef.time = cl.time;
|
||||
cl.refdef.frametime = cl.time - cl.oldtime;
|
||||
cl.refdef.demoplayback = cls.demoplayback;
|
||||
cl.refdef.viewsize = scr_viewsize->integer;
|
||||
cl.refdef.onlyClientDraw = 0; // reset clientdraw
|
||||
cl.refdef.hardware = true; // always true
|
||||
cl.refdef.spectator = (clent->curstate.spectator != 0);
|
||||
cl.refdef.smoothing = false; // old stuff to smooth multiplayer view
|
||||
cl.refdef.nextView = 0;
|
||||
|
||||
SCR_AddDirtyPoint( 0, 0 );
|
||||
SCR_AddDirtyPoint( scr_width->integer - 1, scr_height->integer - 1 );
|
||||
|
||||
if( cl.refdef.viewsize >= 120 )
|
||||
sb_lines = 0; // no status bar at all
|
||||
else if( cl.refdef.viewsize >= 110 )
|
||||
sb_lines = 24; // no inventory
|
||||
else sb_lines = 48;
|
||||
|
||||
size = min( scr_viewsize->integer, 100 );
|
||||
|
||||
cl.refdef.viewport[2] = scr_width->integer * size / 100;
|
||||
cl.refdef.viewport[3] = scr_height->integer * size / 100;
|
||||
|
||||
if( cl.refdef.viewport[3] > scr_height->integer - sb_lines )
|
||||
cl.refdef.viewport[3] = scr_height->integer - sb_lines;
|
||||
if( cl.refdef.viewport[3] > scr_height->integer )
|
||||
cl.refdef.viewport[3] = scr_height->integer;
|
||||
|
||||
cl.refdef.viewport[0] = (scr_width->integer - cl.refdef.viewport[2]) / 2;
|
||||
cl.refdef.viewport[1] = (scr_height->integer - sb_lines - cl.refdef.viewport[3]) / 2;
|
||||
|
||||
cl.scr_fov = bound( 1.0f, cl.scr_fov, 179.0f );
|
||||
|
||||
// calc FOV
|
||||
cl.refdef.fov_x = cl.scr_fov; // this is a final fov value
|
||||
cl.refdef.fov_y = V_CalcFov( &cl.refdef.fov_x, cl.refdef.viewport[2], cl.refdef.viewport[3] );
|
||||
|
||||
// adjust FOV for widescreen
|
||||
if( glState.wideScreen && r_adjust_fov->integer )
|
||||
V_AdjustFov( &cl.refdef.fov_x, &cl.refdef.fov_y, cl.refdef.viewport[2], cl.refdef.viewport[3], false );
|
||||
|
||||
if( CL_IsPredicted( ) && !cl.refdef.demoplayback )
|
||||
{
|
||||
VectorCopy( cl.predicted.origin, cl.refdef.simorg );
|
||||
VectorCopy( cl.predicted.velocity, cl.refdef.simvel );
|
||||
VectorCopy( cl.predicted.viewofs, cl.refdef.viewheight );
|
||||
VectorCopy( cl.predicted.punchangle, cl.refdef.punchangle );
|
||||
cl.refdef.onground = ( cl.predicted.onground == -1 ) ? false : true;
|
||||
cl.refdef.waterlevel = cl.predicted.waterlevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorCopy( cl.frame.client.origin, cl.refdef.simorg );
|
||||
VectorCopy( cl.frame.client.view_ofs, cl.refdef.viewheight );
|
||||
VectorCopy( cl.frame.client.velocity, cl.refdef.simvel );
|
||||
VectorCopy( cl.frame.client.punchangle, cl.refdef.punchangle );
|
||||
cl.refdef.onground = (cl.frame.client.flags & FL_ONGROUND) ? 1 : 0;
|
||||
cl.refdef.waterlevel = cl.frame.client.waterlevel;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
V_SetupOverviewState
|
||||
|
||||
Get initial overview values
|
||||
===============
|
||||
*/
|
||||
void V_SetupOverviewState( void )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
float mapAspect, screenAspect, aspect;
|
||||
|
||||
ov->rotated = ( world.size[1] <= world.size[0] ) ? true : false;
|
||||
|
||||
// calculate nearest aspect
|
||||
mapAspect = world.size[!ov->rotated] / world.size[ov->rotated];
|
||||
screenAspect = (float)glState.width / (float)glState.height;
|
||||
aspect = max( mapAspect, screenAspect );
|
||||
|
||||
ov->zNear = world.maxs[2];
|
||||
ov->zFar = world.mins[2];
|
||||
ov->flZoom = ( 8192.0f / world.size[ov->rotated] ) / aspect;
|
||||
|
||||
VectorAverage( world.mins, world.maxs, ov->origin );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
V_WriteOverviewScript
|
||||
|
||||
Create overview scrip file
|
||||
===============
|
||||
*/
|
||||
void V_WriteOverviewScript( void )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
string filename;
|
||||
file_t *f;
|
||||
|
||||
Q_snprintf( filename, sizeof( filename ), "overviews/%s.txt", clgame.mapname );
|
||||
|
||||
f = FS_Open( filename, "w", false );
|
||||
if( !f ) return;
|
||||
|
||||
FS_Printf( f, "// overview description file for %s.bsp\n\n", clgame.mapname );
|
||||
FS_Print( f, "global\n{\n" );
|
||||
FS_Printf( f, "\tZOOM\t%.2f\n", ov->flZoom );
|
||||
FS_Printf( f, "\tORIGIN\t%.f\t%.f\t%.f\n", ov->origin[0], ov->origin[1], ov->zFar + 1 );
|
||||
FS_Printf( f, "\tROTATED\t%i\n", ov->rotated ? 1 : 0 );
|
||||
FS_Print( f, "}\n\nlayer\n{\n" );
|
||||
FS_Printf( f, "\tIMAGE\t\"overviews/%s.bmp\"\n", clgame.mapname );
|
||||
FS_Printf( f, "\tHEIGHT\t%.f\n", ov->zFar + 1 ); // ???
|
||||
FS_Print( f, "}\n" );
|
||||
|
||||
FS_Close( f );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
V_ProcessOverviewCmds
|
||||
|
||||
Transform user movement into overview adjust
|
||||
===============
|
||||
*/
|
||||
void V_ProcessOverviewCmds( usercmd_t *cmd )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
int sign = 1;
|
||||
|
||||
if( !gl_overview->integer ) return;
|
||||
|
||||
if( ov->flZoom < 0.0f ) sign = -1;
|
||||
|
||||
if( cmd->upmove > 0.0f ) ov->zNear += 1.0f;
|
||||
else if( cmd->upmove < 0.0f ) ov->zNear -= 1.0f;
|
||||
|
||||
if( cmd->buttons & IN_JUMP ) ov->zFar += 1.0f;
|
||||
else if( cmd->buttons & IN_DUCK ) ov->zFar -= 1.0f;
|
||||
|
||||
if( cmd->buttons & IN_FORWARD ) ov->origin[ov->rotated] -= sign * 1.0f;
|
||||
else if( cmd->buttons & IN_BACK ) ov->origin[ov->rotated] += sign * 1.0f;
|
||||
|
||||
if( ov->rotated )
|
||||
{
|
||||
if( cmd->buttons & ( IN_RIGHT|IN_MOVERIGHT ))
|
||||
ov->origin[0] -= sign * 1.0f;
|
||||
else if( cmd->buttons & ( IN_LEFT|IN_MOVELEFT ))
|
||||
ov->origin[0] += sign * 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( cmd->buttons & ( IN_RIGHT|IN_MOVERIGHT ))
|
||||
ov->origin[1] += sign * 1.0f;
|
||||
else if( cmd->buttons & ( IN_LEFT|IN_MOVELEFT ))
|
||||
ov->origin[1] -= sign * 1.0f;
|
||||
}
|
||||
|
||||
if( cmd->buttons & IN_ATTACK ) ov->flZoom += 0.01f;
|
||||
else if( cmd->buttons & IN_ATTACK2 ) ov->flZoom -= 0.01f;
|
||||
|
||||
if( ov->flZoom == 0.0f ) ov->flZoom = 0.0001f; // to prevent disivion by zero
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
|
@ -220,7 +28,7 @@ V_MergeOverviewRefdef
|
|||
merge refdef with overview settings
|
||||
===============
|
||||
*/
|
||||
void V_MergeOverviewRefdef( ref_params_t *fd )
|
||||
void V_MergeOverviewRefdef( void )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
float aspect;
|
||||
|
@ -247,99 +55,134 @@ void V_MergeOverviewRefdef( ref_params_t *fd )
|
|||
ov->flZoom, ov->origin[0], ov->origin[1], ov->origin[2], ov->zNear, ov->zFar, ov->rotated );
|
||||
}
|
||||
|
||||
VectorCopy( ov->origin, fd->vieworg );
|
||||
fd->vieworg[2] = ov->zFar + ov->zNear;
|
||||
Vector2Copy( fd->vieworg, mins );
|
||||
Vector2Copy( fd->vieworg, maxs );
|
||||
VectorCopy( ov->origin, cl.refdef.vieworg );
|
||||
cl.refdef.vieworg[2] = ov->zFar + ov->zNear;
|
||||
Vector2Copy( cl.refdef.vieworg, mins );
|
||||
Vector2Copy( cl.refdef.vieworg, maxs );
|
||||
|
||||
mins[!ov->rotated] += ov->xLeft;
|
||||
maxs[!ov->rotated] += ov->xRight;
|
||||
mins[ov->rotated] += ov->xTop;
|
||||
maxs[ov->rotated] += ov->xBottom;
|
||||
|
||||
fd->viewangles[0] = 90.0f;
|
||||
fd->viewangles[1] = 90.0f;
|
||||
fd->viewangles[2] = (ov->rotated) ? (ov->flZoom < 0.0f) ? 180.0f : 0.0f : (ov->flZoom < 0.0f) ? -90.0f : 90.0f;
|
||||
cl.refdef.viewangles[0] = 90.0f;
|
||||
cl.refdef.viewangles[1] = 90.0f;
|
||||
cl.refdef.viewangles[2] = (ov->rotated) ? (ov->flZoom < 0.0f) ? 180.0f : 0.0f : (ov->flZoom < 0.0f) ? -90.0f : 90.0f;
|
||||
|
||||
Mod_SetOrthoBounds( mins, maxs );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
V_ProcessShowTexturesCmds
|
||||
V_CalcViewRect
|
||||
|
||||
navigate around texture atlas
|
||||
calc frame rectangle (Quake1 style)
|
||||
===============
|
||||
*/
|
||||
void V_ProcessShowTexturesCmds( usercmd_t *cmd )
|
||||
void V_CalcViewRect( void )
|
||||
{
|
||||
static int oldbuttons;
|
||||
int changed;
|
||||
int pressed, released;
|
||||
int size, sb_lines;
|
||||
|
||||
if( !gl_showtextures->integer ) return;
|
||||
if( scr_viewsize->integer >= 120 )
|
||||
sb_lines = 0; // no status bar at all
|
||||
else if( scr_viewsize->integer >= 110 )
|
||||
sb_lines = 24; // no inventory
|
||||
else sb_lines = 48;
|
||||
|
||||
changed = (oldbuttons ^ cmd->buttons);
|
||||
pressed = changed & cmd->buttons;
|
||||
released = changed & (~cmd->buttons);
|
||||
size = Q_min( scr_viewsize->integer, 100 );
|
||||
|
||||
cl.refdef.viewport[2] = scr_width->integer * size / 100;
|
||||
cl.refdef.viewport[3] = scr_height->integer * size / 100;
|
||||
|
||||
if( cl.refdef.viewport[3] > scr_height->integer - sb_lines )
|
||||
cl.refdef.viewport[3] = scr_height->integer - sb_lines;
|
||||
if( cl.refdef.viewport[3] > scr_height->integer )
|
||||
cl.refdef.viewport[3] = scr_height->integer;
|
||||
|
||||
cl.refdef.viewport[0] = ( scr_width->integer - cl.refdef.viewport[2] ) / 2;
|
||||
cl.refdef.viewport[1] = ( scr_height->integer - sb_lines - cl.refdef.viewport[3] ) / 2;
|
||||
|
||||
if( released & ( IN_RIGHT|IN_MOVERIGHT ))
|
||||
Cvar_SetFloat( "r_showtextures", gl_showtextures->integer + 1 );
|
||||
if( released & ( IN_LEFT|IN_MOVELEFT ))
|
||||
Cvar_SetFloat( "r_showtextures", max( 1, gl_showtextures->integer - 1 ));
|
||||
oldbuttons = cmd->buttons;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
V_CalcRefDef
|
||||
V_SetupRefDef
|
||||
|
||||
sets cl.refdef view values
|
||||
update refdef values each frame
|
||||
===============
|
||||
*/
|
||||
void V_CalcRefDef( void )
|
||||
void V_SetupRefDef( void )
|
||||
{
|
||||
R_Set2DMode( false );
|
||||
tr.framecount++; // g-cont. keep actual frame for all viewpasses
|
||||
cl_entity_t *clent;
|
||||
|
||||
do
|
||||
// compute viewport rectangle
|
||||
V_CalcViewRect();
|
||||
|
||||
clent = CL_GetLocalPlayer ();
|
||||
|
||||
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
||||
|
||||
cl.refdef.movevars = &clgame.movevars;
|
||||
cl.refdef.health = cl.frame.client.health;
|
||||
cl.refdef.playernum = cl.playernum;
|
||||
cl.refdef.max_entities = clgame.maxEntities;
|
||||
cl.refdef.maxclients = cl.maxclients;
|
||||
cl.refdef.time = cl.time;
|
||||
cl.refdef.frametime = cl.time - cl.oldtime;
|
||||
cl.refdef.demoplayback = cls.demoplayback;
|
||||
cl.refdef.viewsize = scr_viewsize->integer;
|
||||
cl.refdef.onlyClientDraw = 0; // reset clientdraw
|
||||
cl.refdef.hardware = true; // always true
|
||||
cl.refdef.spectator = (clent->curstate.spectator != 0);
|
||||
cl.refdef.smoothing = cl.first_frame; // NOTE: currently this used to prevent ugly un-duck effect while level is changed
|
||||
cl.scr_fov = bound( 1.0f, cl.scr_fov, 179.0f );
|
||||
cl.refdef.nextView = 0;
|
||||
|
||||
// calc FOV
|
||||
cl.refdef.fov_x = cl.scr_fov; // this is a final fov value
|
||||
cl.refdef.fov_y = V_CalcFov( &cl.refdef.fov_x, cl.refdef.viewport[2], cl.refdef.viewport[3] );
|
||||
|
||||
// adjust FOV for widescreen
|
||||
if( glState.wideScreen && r_adjust_fov->integer )
|
||||
V_AdjustFov( &cl.refdef.fov_x, &cl.refdef.fov_y, cl.refdef.viewport[2], cl.refdef.viewport[3], false );
|
||||
|
||||
if( CL_IsPredicted( ) && !cl.first_frame )
|
||||
{
|
||||
VectorCopy( cl.predicted.origin, cl.refdef.simorg );
|
||||
VectorCopy( cl.predicted.velocity, cl.refdef.simvel );
|
||||
VectorCopy( cl.predicted.viewofs, cl.refdef.viewheight );
|
||||
VectorCopy( cl.predicted.punchangle, cl.refdef.punchangle );
|
||||
cl.refdef.onground = ( cl.predicted.onground == -1 ) ? false : true;
|
||||
cl.refdef.waterlevel = cl.predicted.waterlevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorCopy( cl.frame.client.origin, cl.refdef.simorg );
|
||||
VectorCopy( cl.frame.client.view_ofs, cl.refdef.viewheight );
|
||||
VectorCopy( cl.frame.client.velocity, cl.refdef.simvel );
|
||||
VectorCopy( cl.frame.client.punchangle, cl.refdef.punchangle );
|
||||
cl.refdef.onground = (cl.frame.client.flags & FL_ONGROUND) ? 1 : 0;
|
||||
cl.refdef.waterlevel = cl.frame.client.waterlevel;
|
||||
}
|
||||
|
||||
// setup the viewent variables
|
||||
if( cl_lw->value ) clgame.viewent.curstate.modelindex = cl.predicted.viewmodel;
|
||||
else clgame.viewent.curstate.modelindex = cl.frame.client.viewmodel;
|
||||
clgame.viewent.model = Mod_Handle( clgame.viewent.curstate.modelindex );
|
||||
clgame.viewent.curstate.number = cl.playernum + 1;
|
||||
clgame.viewent.curstate.entityType = ET_NORMAL;
|
||||
clgame.viewent.index = cl.playernum + 1;
|
||||
|
||||
// calc refdef first so viewent can get an actual
|
||||
// player position, angles etc
|
||||
if( FBitSet( host.features, ENGINE_FIXED_FRAMERATE ))
|
||||
{
|
||||
clgame.dllFuncs.pfnCalcRefdef( &cl.refdef );
|
||||
V_MergeOverviewRefdef( &cl.refdef );
|
||||
R_RenderFrame( &cl.refdef, true );
|
||||
cl.refdef.onlyClientDraw = false;
|
||||
} while( cl.refdef.nextView );
|
||||
|
||||
// Xash3D extension. draw debug triangles on a server
|
||||
SV_DrawDebugTriangles ();
|
||||
|
||||
SCR_AddDirtyPoint( cl.refdef.viewport[0], cl.refdef.viewport[1] );
|
||||
SCR_AddDirtyPoint( cl.refdef.viewport[0] + cl.refdef.viewport[2] - 1, cl.refdef.viewport[1] + cl.refdef.viewport[3] - 1 );
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
/*
|
||||
==================
|
||||
V_RenderView
|
||||
|
||||
==================
|
||||
*/
|
||||
void V_RenderView( void )
|
||||
{
|
||||
if( !cl.video_prepped || ( UI_IsVisible() && !cl.background ))
|
||||
return; // still loading
|
||||
|
||||
if( cl.frame.valid && ( cl.force_refdef || !cl.refdef.paused ))
|
||||
{
|
||||
cl.force_refdef = false;
|
||||
V_MergeOverviewRefdef();
|
||||
|
||||
R_ClearScene ();
|
||||
CL_AddEntities ();
|
||||
V_SetupRefDef ();
|
||||
}
|
||||
|
||||
V_CalcRefDef ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -365,7 +208,7 @@ qboolean V_PreRender( void )
|
|||
{
|
||||
if(( host.realtime - cls.disable_screen ) > cl_timeout->value )
|
||||
{
|
||||
MsgDev( D_NOTE, "V_PreRender: loading plaque timed out.\n" );
|
||||
MsgDev( D_ERROR, "V_PreRender: loading plaque timed out\n" );
|
||||
cls.disable_screen = 0.0f;
|
||||
}
|
||||
return false;
|
||||
|
@ -376,6 +219,53 @@ qboolean V_PreRender( void )
|
|||
return true;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
/*
|
||||
==================
|
||||
V_RenderView
|
||||
|
||||
==================
|
||||
*/
|
||||
void V_RenderView( void )
|
||||
{
|
||||
if( !cl.video_prepped || ( UI_IsVisible() && !cl.background ))
|
||||
return; // still loading
|
||||
|
||||
if( !FBitSet( host.features, ENGINE_FIXED_FRAMERATE ))
|
||||
{
|
||||
if( cl.frame.valid && ( cl.force_refdef || !cl.refdef.paused ))
|
||||
{
|
||||
cl.force_refdef = false;
|
||||
|
||||
R_ClearScene ();
|
||||
CL_AddEntities ();
|
||||
V_SetupRefDef ();
|
||||
}
|
||||
}
|
||||
|
||||
R_Set2DMode( false );
|
||||
SCR_AddDirtyPoint( 0, 0 );
|
||||
SCR_AddDirtyPoint( scr_width->integer - 1, scr_height->integer - 1 );
|
||||
|
||||
tr.framecount++; // g-cont. keep actual frame for all viewpasses
|
||||
|
||||
if( !FBitSet( host.features, ENGINE_FIXED_FRAMERATE ))
|
||||
{
|
||||
do
|
||||
{
|
||||
clgame.dllFuncs.pfnCalcRefdef( &cl.refdef );
|
||||
V_MergeOverviewRefdef();
|
||||
R_RenderFrame( &cl.refdef, true );
|
||||
cl.refdef.onlyClientDraw = false;
|
||||
} while( cl.refdef.nextView );
|
||||
}
|
||||
else R_RenderFrame( &cl.refdef, true );
|
||||
|
||||
// draw debug triangles on a server
|
||||
SV_DrawDebugTriangles ();
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
V_PostRender
|
||||
|
@ -384,11 +274,12 @@ V_PostRender
|
|||
*/
|
||||
void V_PostRender( void )
|
||||
{
|
||||
static double oldtime;
|
||||
qboolean draw_2d = false;
|
||||
|
||||
R_Set2DMode( true );
|
||||
|
||||
if( cls.state == ca_active )
|
||||
if( cls.state == ca_active && cls.scrshot_action != scrshot_mapshot )
|
||||
{
|
||||
SCR_TileClear();
|
||||
CL_DrawHUD( CL_ACTIVE );
|
||||
|
@ -409,17 +300,30 @@ void V_PostRender( void )
|
|||
SCR_RSpeeds();
|
||||
SCR_NetSpeeds();
|
||||
SCR_DrawFPS();
|
||||
SCR_DrawNetGraph();
|
||||
SV_DrawOrthoTriangles();
|
||||
CL_DrawDemoRecording();
|
||||
R_ShowTextures();
|
||||
CL_DrawHUD( CL_CHANGELEVEL );
|
||||
R_ShowTextures();
|
||||
Con_DrawConsole();
|
||||
UI_UpdateMenu( host.realtime );
|
||||
Con_DrawVersion();
|
||||
Con_DrawDebug(); // must be last
|
||||
|
||||
if( !FBitSet( host.features, ENGINE_FIXED_FRAMERATE ))
|
||||
S_ExtraUpdate();
|
||||
}
|
||||
|
||||
if( FBitSet( host.features, ENGINE_FIXED_FRAMERATE ))
|
||||
{
|
||||
// don't update sound too fast
|
||||
if(( host.realtime - oldtime ) >= HOST_FRAMETIME )
|
||||
{
|
||||
oldtime = host.realtime;
|
||||
CL_ExtraUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
SCR_MakeScreenShot();
|
||||
R_EndFrame();
|
||||
}
|
|
@ -49,6 +49,19 @@ GNU General Public License for more details.
|
|||
typedef int sound_t;
|
||||
|
||||
//=============================================================================
|
||||
typedef struct netbandwithgraph_s
|
||||
{
|
||||
word client;
|
||||
word players;
|
||||
word entities; // entities bytes, except for players
|
||||
word tentities;// temp entities
|
||||
word sound;
|
||||
word event;
|
||||
word usr;
|
||||
word msgbytes;
|
||||
word voicebytes;
|
||||
} netbandwidthgraph_t;
|
||||
|
||||
typedef struct frame_s
|
||||
{
|
||||
// received from server
|
||||
|
@ -59,6 +72,7 @@ typedef struct frame_s
|
|||
clientdata_t client; // local client private data
|
||||
entity_state_t playerstate[MAX_CLIENTS];
|
||||
weapon_data_t weapondata[64];
|
||||
netbandwidthgraph_t graphdata;
|
||||
|
||||
int num_entities;
|
||||
int first_entity; // into the circular cl_packet_entities[]
|
||||
|
@ -79,6 +93,9 @@ typedef struct runcmd_s
|
|||
int sendsize;
|
||||
} runcmd_t;
|
||||
|
||||
#define ANGLE_BACKUP 16
|
||||
#define ANGLE_MASK (ANGLE_BACKUP - 1)
|
||||
|
||||
#define CMD_BACKUP MULTIPLAYER_BACKUP // allow a lot of command backups for very fast systems
|
||||
#define CMD_MASK (CMD_BACKUP - 1)
|
||||
|
||||
|
@ -87,6 +104,8 @@ extern int CL_UPDATE_BACKUP;
|
|||
|
||||
#define INVALID_HANDLE 0xFFFF // for XashXT cache system
|
||||
|
||||
#define cl_serverframetime() (cl.mtime[0] - cl.mtime[1])
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3_t origin; // generated by CL_PredictMovement
|
||||
|
@ -129,9 +148,10 @@ typedef struct
|
|||
int last_command_ack;
|
||||
int last_incoming_sequence;
|
||||
|
||||
qboolean force_send_usercmd;
|
||||
qboolean send_reply;
|
||||
qboolean thirdperson;
|
||||
qboolean background; // not real game, just a background
|
||||
qboolean first_frame; // first rendering frame
|
||||
|
||||
uint checksum; // for catching cheater maps
|
||||
|
||||
|
@ -442,7 +462,6 @@ typedef struct
|
|||
|
||||
byte *mempool; // client premamnent pool: edicts etc
|
||||
|
||||
int framecount;
|
||||
int quakePort; // a 16 bit value that allows quake servers
|
||||
// to work around address translating routers
|
||||
// g-cont. this port allow many copies of engine in multiplayer game
|
||||
|
@ -541,6 +560,8 @@ extern convar_t *cl_nosmooth;
|
|||
extern convar_t *cl_smoothtime;
|
||||
extern convar_t *cl_crosshair;
|
||||
extern convar_t *cl_testlights;
|
||||
extern convar_t *cl_cmdrate;
|
||||
extern convar_t *cl_updaterate;
|
||||
extern convar_t *cl_solid_players;
|
||||
extern convar_t *cl_idealpitchscale;
|
||||
extern convar_t *cl_allow_levelshots;
|
||||
|
@ -548,6 +569,7 @@ extern convar_t *cl_lightstyle_lerping;
|
|||
extern convar_t *cl_draw_particles;
|
||||
extern convar_t *cl_levelshot_name;
|
||||
extern convar_t *cl_draw_beams;
|
||||
extern convar_t *gl_showtextures;
|
||||
extern convar_t *cl_bmodelinterp;
|
||||
extern convar_t *cl_lw; // local weapons
|
||||
extern convar_t *scr_centertime;
|
||||
|
@ -608,6 +630,7 @@ void CL_WriteDemoUserCmd( int cmdnumber );
|
|||
void CL_WriteDemoMessage( qboolean startup, int start, sizebuf_t *msg );
|
||||
void CL_WriteDemoUserMessage( const byte *buffer, size_t size );
|
||||
qboolean CL_DemoReadMessage( byte *buffer, size_t *length );
|
||||
void CL_DemoInterpolateAngles( void );
|
||||
void CL_WriteDemoJumpTime( void );
|
||||
void CL_CloseDemoHeader( void );
|
||||
void CL_StopPlayback( void );
|
||||
|
@ -659,6 +682,8 @@ 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 );
|
||||
void CL_PlayerTrace( float *start, float *end, int traceFlags, int ignore_pe, pmtrace_t *tr );
|
||||
void CL_PlayerTraceExt( float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe ), pmtrace_t *tr );
|
||||
void CL_SetTraceHull( int hull );
|
||||
|
@ -696,6 +721,12 @@ void SCR_NetSpeeds( void );
|
|||
void SCR_RSpeeds( void );
|
||||
void SCR_DrawFPS( void );
|
||||
|
||||
//
|
||||
// cl_netgraph.c
|
||||
//
|
||||
void CL_InitNetgraph( void );
|
||||
void SCR_DrawNetGraph( void );
|
||||
|
||||
//
|
||||
// cl_view.c
|
||||
//
|
||||
|
@ -705,11 +736,7 @@ void V_Shutdown( void );
|
|||
qboolean V_PreRender( void );
|
||||
void V_PostRender( void );
|
||||
void V_RenderView( void );
|
||||
void V_SetupOverviewState( void );
|
||||
void V_ProcessOverviewCmds( usercmd_t *cmd );
|
||||
void V_MergeOverviewRefdef( ref_params_t *fd );
|
||||
void V_ProcessShowTexturesCmds( usercmd_t *cmd );
|
||||
void V_WriteOverviewScript( void );
|
||||
void V_SetupRefDef( void );
|
||||
|
||||
//
|
||||
// cl_pmove.c
|
||||
|
@ -739,7 +766,7 @@ void CL_InitStudioAPI( void );
|
|||
//
|
||||
// cl_frame.c
|
||||
//
|
||||
void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta );
|
||||
int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta );
|
||||
qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType );
|
||||
void CL_UpdateStudioVars( cl_entity_t *ent, entity_state_t *newstate, qboolean noInterp );
|
||||
qboolean CL_GetEntitySpatialization( int entnum, vec3_t origin, float *pradius );
|
||||
|
|
|
@ -182,10 +182,6 @@ void GL_SelectTexture( GLint tmu )
|
|||
if( tmu < glConfig.max_texture_coords )
|
||||
pglClientActiveTextureARB( tmu + GL_TEXTURE0_ARB );
|
||||
}
|
||||
else if( pglSelectTextureSGIS )
|
||||
{
|
||||
pglSelectTextureSGIS( tmu + GL_TEXTURE0_SGIS );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -227,6 +223,18 @@ void GL_CleanUpTextureUnits( int last )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
GL_CleanupAllTextureUnits
|
||||
==============
|
||||
*/
|
||||
void GL_CleanupAllTextureUnits( void )
|
||||
{
|
||||
// force to cleanup all the units
|
||||
GL_SelectTexture( GL_MaxTextureUnits() - 1 );
|
||||
GL_CleanUpTextureUnits( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
GL_MultiTexCoord2f
|
||||
|
@ -234,14 +242,13 @@ GL_MultiTexCoord2f
|
|||
*/
|
||||
void GL_MultiTexCoord2f( GLenum texture, GLfloat s, GLfloat t )
|
||||
{
|
||||
if( !GL_Support( GL_ARB_MULTITEXTURE ))
|
||||
return;
|
||||
|
||||
if( pglMultiTexCoord2f )
|
||||
{
|
||||
pglMultiTexCoord2f( texture + GL_TEXTURE0_ARB, s, t );
|
||||
}
|
||||
else if( pglMTexCoord2fSGIS )
|
||||
{
|
||||
pglMTexCoord2fSGIS( texture + GL_TEXTURE0_SGIS, s, t );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -470,6 +477,37 @@ void VID_ImageAdjustGamma( byte *in, uint width, uint height )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
VID_WriteOverviewScript
|
||||
|
||||
Create overview script file
|
||||
===============
|
||||
*/
|
||||
void VID_WriteOverviewScript( void )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
string filename;
|
||||
file_t *f;
|
||||
|
||||
Q_snprintf( filename, sizeof( filename ), "overviews/%s.txt", clgame.mapname );
|
||||
|
||||
f = FS_Open( filename, "w", false );
|
||||
if( !f ) return;
|
||||
|
||||
FS_Printf( f, "// overview description file for %s.bsp\n\n", clgame.mapname );
|
||||
FS_Print( f, "global\n{\n" );
|
||||
FS_Printf( f, "\tZOOM\t%.2f\n", ov->flZoom );
|
||||
FS_Printf( f, "\tORIGIN\t%.2f\t%.2f\t%.2f\n", ov->origin[0], ov->origin[1], ov->origin[2] );
|
||||
FS_Printf( f, "\tROTATED\t%i\n", ov->rotated ? 1 : 0 );
|
||||
FS_Print( f, "}\n\nlayer\n{\n" );
|
||||
FS_Printf( f, "\tIMAGE\t\"overviews/%s.bmp\"\n", clgame.mapname );
|
||||
FS_Printf( f, "\tHEIGHT\t%.2f\n", ov->zFar ); // ???
|
||||
FS_Print( f, "}\n" );
|
||||
|
||||
FS_Close( f );
|
||||
}
|
||||
|
||||
qboolean VID_ScreenShot( const char *filename, int shot_type )
|
||||
{
|
||||
rgbdata_t *r_shot;
|
||||
|
@ -519,7 +557,7 @@ qboolean VID_ScreenShot( const char *filename, int shot_type )
|
|||
width = 320;
|
||||
break;
|
||||
case VID_MAPSHOT:
|
||||
V_WriteOverviewScript(); // store overview script too
|
||||
VID_WriteOverviewScript(); // store overview script too
|
||||
flags |= IMAGE_RESAMPLE|IMAGE_QUANTIZE; // GoldSrc request overviews in 8-bit format
|
||||
height = 768;
|
||||
width = 1024;
|
||||
|
@ -637,8 +675,8 @@ void R_ShowTextures( void )
|
|||
{
|
||||
gltexture_t *image;
|
||||
float x, y, w, h;
|
||||
int i, j, k, base_w, base_h;
|
||||
int total, start, end;
|
||||
int i, j, k, base_w, base_h;
|
||||
rgba_t color = { 192, 192, 192, 255 };
|
||||
int charHeight, numTries = 0;
|
||||
static qboolean showHelp = true;
|
||||
|
@ -649,15 +687,16 @@ void R_ShowTextures( void )
|
|||
|
||||
if( showHelp )
|
||||
{
|
||||
CL_CenterPrint( "use '<-' and '->' keys to view all the textures", 0.25f );
|
||||
CL_CenterPrint( "use '<-' and '->' keys to change atlas page, ESC to quit", 0.25f );
|
||||
showHelp = false;
|
||||
}
|
||||
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
pglClear( GL_COLOR_BUFFER_BIT );
|
||||
pglFinish();
|
||||
|
||||
base_w = 8;
|
||||
base_h = 6;
|
||||
base_w = 8; // textures view by horizontal
|
||||
base_h = 6; // textures view by vertical
|
||||
|
||||
rebuild_page:
|
||||
total = base_w * base_h;
|
||||
|
@ -698,27 +737,27 @@ rebuild_page:
|
|||
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
GL_Bind( GL_TEXTURE0, i ); // NOTE: don't use image->texnum here, because skybox has a 'wrong' indexes
|
||||
|
||||
if(( image->flags & TF_DEPTHMAP ) && !( image->flags & TF_NOCOMPARE ))
|
||||
if( FBitSet( image->flags, TF_DEPTHMAP ) && !FBitSet( image->flags, TF_NOCOMPARE ))
|
||||
pglTexParameteri( image->target, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE );
|
||||
|
||||
pglBegin( GL_QUADS );
|
||||
pglTexCoord2f( 0, 0 );
|
||||
pglVertex2f( x, y );
|
||||
if( image->flags & TF_TEXTURE_RECTANGLE )
|
||||
if( image->target == GL_TEXTURE_RECTANGLE_EXT )
|
||||
pglTexCoord2f( image->width, 0 );
|
||||
else pglTexCoord2f( 1, 0 );
|
||||
pglVertex2f( x + w, y );
|
||||
if( image->flags & TF_TEXTURE_RECTANGLE )
|
||||
if( image->target == GL_TEXTURE_RECTANGLE_EXT )
|
||||
pglTexCoord2f( image->width, image->height );
|
||||
else pglTexCoord2f( 1, 1 );
|
||||
pglVertex2f( x + w, y + h );
|
||||
if( image->flags & TF_TEXTURE_RECTANGLE )
|
||||
if( image->target == GL_TEXTURE_RECTANGLE_EXT )
|
||||
pglTexCoord2f( 0, image->height );
|
||||
else pglTexCoord2f( 0, 1 );
|
||||
pglVertex2f( x, y + h );
|
||||
pglEnd();
|
||||
|
||||
if(( image->flags & TF_DEPTHMAP ) && !( image->flags & TF_NOCOMPARE ))
|
||||
if( FBitSet( image->flags, TF_DEPTHMAP ) && !FBitSet( image->flags, TF_NOCOMPARE ))
|
||||
pglTexParameteri( image->target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB );
|
||||
|
||||
FS_FileBase( image->name, shortname );
|
||||
|
@ -736,5 +775,3 @@ rebuild_page:
|
|||
CL_DrawCenterPrint ();
|
||||
pglFinish();
|
||||
}
|
||||
|
||||
//=======================================================
|
|
@ -1970,72 +1970,72 @@ void CL_ParseViewBeam( sizebuf_t *msg, int beamType )
|
|||
switch( beamType )
|
||||
{
|
||||
case TE_BEAMPOINTS:
|
||||
start[0] = BF_ReadCoord( msg );
|
||||
start[1] = BF_ReadCoord( msg );
|
||||
start[2] = BF_ReadCoord( msg );
|
||||
end[0] = BF_ReadCoord( msg );
|
||||
end[1] = BF_ReadCoord( msg );
|
||||
end[2] = BF_ReadCoord( msg );
|
||||
modelIndex = BF_ReadShort( msg );
|
||||
startFrame = BF_ReadByte( msg );
|
||||
frameRate = (float)BF_ReadByte( msg );
|
||||
life = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
r = (float)BF_ReadByte( msg );
|
||||
g = (float)BF_ReadByte( msg );
|
||||
b = (float)BF_ReadByte( msg );
|
||||
brightness = (float)BF_ReadByte( msg );
|
||||
speed = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
start[0] = MSG_ReadCoord( msg );
|
||||
start[1] = MSG_ReadCoord( msg );
|
||||
start[2] = MSG_ReadCoord( msg );
|
||||
end[0] = MSG_ReadCoord( msg );
|
||||
end[1] = MSG_ReadCoord( msg );
|
||||
end[2] = MSG_ReadCoord( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
startFrame = MSG_ReadByte( msg );
|
||||
frameRate = (float)MSG_ReadByte( msg );
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
r = (float)MSG_ReadByte( msg );
|
||||
g = (float)MSG_ReadByte( msg );
|
||||
b = (float)MSG_ReadByte( msg );
|
||||
brightness = (float)MSG_ReadByte( msg );
|
||||
speed = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
CL_BeamPoints( start, end, modelIndex, life, width, noise, brightness, speed, startFrame,
|
||||
frameRate, r, g, b );
|
||||
break;
|
||||
case TE_BEAMENTPOINT:
|
||||
startEnt = BF_ReadShort( msg );
|
||||
end[0] = BF_ReadCoord( msg );
|
||||
end[1] = BF_ReadCoord( msg );
|
||||
end[2] = BF_ReadCoord( msg );
|
||||
modelIndex = BF_ReadShort( msg );
|
||||
startFrame = BF_ReadByte( msg );
|
||||
frameRate = (float)BF_ReadByte( msg );
|
||||
life = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(BF_ReadByte( msg ) * 0.01f);
|
||||
r = (float)BF_ReadByte( msg );
|
||||
g = (float)BF_ReadByte( msg );
|
||||
b = (float)BF_ReadByte( msg );
|
||||
brightness = (float)BF_ReadByte( msg );
|
||||
speed = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
startEnt = MSG_ReadShort( msg );
|
||||
end[0] = MSG_ReadCoord( msg );
|
||||
end[1] = MSG_ReadCoord( msg );
|
||||
end[2] = MSG_ReadCoord( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
startFrame = MSG_ReadByte( msg );
|
||||
frameRate = (float)MSG_ReadByte( msg );
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.01f);
|
||||
r = (float)MSG_ReadByte( msg );
|
||||
g = (float)MSG_ReadByte( msg );
|
||||
b = (float)MSG_ReadByte( msg );
|
||||
brightness = (float)MSG_ReadByte( msg );
|
||||
speed = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
CL_BeamEntPoint( startEnt, end, modelIndex, life, width, noise, brightness, speed, startFrame,
|
||||
frameRate, r, g, b );
|
||||
break;
|
||||
case TE_LIGHTNING:
|
||||
start[0] = BF_ReadCoord( msg );
|
||||
start[1] = BF_ReadCoord( msg );
|
||||
start[2] = BF_ReadCoord( msg );
|
||||
end[0] = BF_ReadCoord( msg );
|
||||
end[1] = BF_ReadCoord( msg );
|
||||
end[2] = BF_ReadCoord( msg );
|
||||
life = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
modelIndex = BF_ReadShort( msg );
|
||||
start[0] = MSG_ReadCoord( msg );
|
||||
start[1] = MSG_ReadCoord( msg );
|
||||
start[2] = MSG_ReadCoord( msg );
|
||||
end[0] = MSG_ReadCoord( msg );
|
||||
end[1] = MSG_ReadCoord( msg );
|
||||
end[2] = MSG_ReadCoord( msg );
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
CL_BeamLightning( start, end, modelIndex, life, width, noise, 255.0f, 1.0f );
|
||||
break;
|
||||
case TE_BEAMENTS:
|
||||
startEnt = BF_ReadShort( msg );
|
||||
endEnt = BF_ReadShort( msg );
|
||||
modelIndex = BF_ReadShort( msg );
|
||||
startFrame = BF_ReadByte( msg );
|
||||
frameRate = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
life = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(BF_ReadByte( msg ) * 0.01f);
|
||||
r = (float)BF_ReadByte( msg );
|
||||
g = (float)BF_ReadByte( msg );
|
||||
b = (float)BF_ReadByte( msg );
|
||||
brightness = (float)BF_ReadByte( msg );
|
||||
speed = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
startEnt = MSG_ReadShort( msg );
|
||||
endEnt = MSG_ReadShort( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
startFrame = MSG_ReadByte( msg );
|
||||
frameRate = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.01f);
|
||||
r = (float)MSG_ReadByte( msg );
|
||||
g = (float)MSG_ReadByte( msg );
|
||||
b = (float)MSG_ReadByte( msg );
|
||||
brightness = (float)MSG_ReadByte( msg );
|
||||
speed = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
CL_BeamEnts( startEnt, endEnt, modelIndex, life, width, noise, brightness, speed, startFrame,
|
||||
frameRate, r, g, b );
|
||||
break;
|
||||
|
@ -2043,64 +2043,64 @@ void CL_ParseViewBeam( sizebuf_t *msg, int beamType )
|
|||
MsgDev( D_ERROR, "TE_BEAM is obsolete\n" );
|
||||
break;
|
||||
case TE_BEAMSPRITE:
|
||||
start[0] = BF_ReadCoord( msg );
|
||||
start[1] = BF_ReadCoord( msg );
|
||||
start[2] = BF_ReadCoord( msg );
|
||||
end[0] = BF_ReadCoord( msg );
|
||||
end[1] = BF_ReadCoord( msg );
|
||||
end[2] = BF_ReadCoord( msg );
|
||||
modelIndex = BF_ReadShort( msg ); // beam model
|
||||
startFrame = BF_ReadShort( msg ); // sprite model
|
||||
start[0] = MSG_ReadCoord( msg );
|
||||
start[1] = MSG_ReadCoord( msg );
|
||||
start[2] = MSG_ReadCoord( msg );
|
||||
end[0] = MSG_ReadCoord( msg );
|
||||
end[1] = MSG_ReadCoord( msg );
|
||||
end[2] = MSG_ReadCoord( msg );
|
||||
modelIndex = MSG_ReadShort( msg ); // beam model
|
||||
startFrame = MSG_ReadShort( msg ); // sprite model
|
||||
CL_BeamSprite( start, end, modelIndex, startFrame );
|
||||
break;
|
||||
case TE_BEAMTORUS:
|
||||
case TE_BEAMDISK:
|
||||
case TE_BEAMCYLINDER:
|
||||
start[0] = BF_ReadCoord( msg );
|
||||
start[1] = BF_ReadCoord( msg );
|
||||
start[2] = BF_ReadCoord( msg );
|
||||
end[0] = BF_ReadCoord( msg );
|
||||
end[1] = BF_ReadCoord( msg );
|
||||
end[2] = BF_ReadCoord( msg );
|
||||
modelIndex = BF_ReadShort( msg );
|
||||
startFrame = BF_ReadByte( msg );
|
||||
frameRate = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
life = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
width = (float)BF_ReadByte( msg );
|
||||
noise = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
r = (float)BF_ReadByte( msg );
|
||||
g = (float)BF_ReadByte( msg );
|
||||
b = (float)BF_ReadByte( msg );
|
||||
brightness = (float)BF_ReadByte( msg );
|
||||
speed = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
start[0] = MSG_ReadCoord( msg );
|
||||
start[1] = MSG_ReadCoord( msg );
|
||||
start[2] = MSG_ReadCoord( msg );
|
||||
end[0] = MSG_ReadCoord( msg );
|
||||
end[1] = MSG_ReadCoord( msg );
|
||||
end[2] = MSG_ReadCoord( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
startFrame = MSG_ReadByte( msg );
|
||||
frameRate = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)MSG_ReadByte( msg );
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
r = (float)MSG_ReadByte( msg );
|
||||
g = (float)MSG_ReadByte( msg );
|
||||
b = (float)MSG_ReadByte( msg );
|
||||
brightness = (float)MSG_ReadByte( msg );
|
||||
speed = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
CL_BeamCirclePoints( beamType, start, end, modelIndex, life, width, noise, brightness, speed,
|
||||
startFrame, frameRate, r, g, b );
|
||||
break;
|
||||
case TE_BEAMFOLLOW:
|
||||
startEnt = BF_ReadShort( msg );
|
||||
modelIndex = BF_ReadShort( msg );
|
||||
life = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
width = (float)BF_ReadByte( msg );
|
||||
r = (float)BF_ReadByte( msg );
|
||||
g = (float)BF_ReadByte( msg );
|
||||
b = (float)BF_ReadByte( msg );
|
||||
brightness = (float)BF_ReadByte( msg );
|
||||
startEnt = MSG_ReadShort( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)MSG_ReadByte( msg );
|
||||
r = (float)MSG_ReadByte( msg );
|
||||
g = (float)MSG_ReadByte( msg );
|
||||
b = (float)MSG_ReadByte( msg );
|
||||
brightness = (float)MSG_ReadByte( msg );
|
||||
CL_BeamFollow( startEnt, modelIndex, life, width, r, g, b, brightness );
|
||||
break;
|
||||
case TE_BEAMRING:
|
||||
startEnt = BF_ReadShort( msg );
|
||||
endEnt = BF_ReadShort( msg );
|
||||
modelIndex = BF_ReadShort( msg );
|
||||
startFrame = BF_ReadByte( msg );
|
||||
frameRate = (float)BF_ReadByte( msg );
|
||||
life = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
r = (float)BF_ReadByte( msg );
|
||||
g = (float)BF_ReadByte( msg );
|
||||
b = (float)BF_ReadByte( msg );
|
||||
brightness = (float)BF_ReadByte( msg );
|
||||
speed = (float)(BF_ReadByte( msg ) * 0.1f);
|
||||
startEnt = MSG_ReadShort( msg );
|
||||
endEnt = MSG_ReadShort( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
startFrame = MSG_ReadByte( msg );
|
||||
frameRate = (float)MSG_ReadByte( msg );
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
r = (float)MSG_ReadByte( msg );
|
||||
g = (float)MSG_ReadByte( msg );
|
||||
b = (float)MSG_ReadByte( msg );
|
||||
brightness = (float)MSG_ReadByte( msg );
|
||||
speed = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
CL_BeamRing( startEnt, endEnt, modelIndex, life, width, noise, brightness, speed, startFrame,
|
||||
frameRate, r, g, b );
|
||||
break;
|
||||
|
@ -2108,7 +2108,7 @@ void CL_ParseViewBeam( sizebuf_t *msg, int beamType )
|
|||
MsgDev( D_ERROR, "TE_BEAMHOSE is obsolete\n" );
|
||||
break;
|
||||
case TE_KILLBEAM:
|
||||
startEnt = BF_ReadShort( msg );
|
||||
startEnt = MSG_ReadShort( msg );
|
||||
CL_BeamKill( startEnt );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ void R_UploadStretchRaw( int texture, int cols, int rows, int width, int height,
|
|||
tex->height = rows;
|
||||
|
||||
pglTexImage2D( GL_TEXTURE_2D, 0, tex->format, cols, rows, 0, GL_BGRA, GL_UNSIGNED_BYTE, raw );
|
||||
GL_TexFilter( tex, false );
|
||||
GL_ApplyTextureParams( tex );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -456,7 +456,7 @@ typedef float GLmatrix[16];
|
|||
#define GL_TEXTURE_WRAP_R 0x8072
|
||||
#define GL_MAX_3D_TEXTURE_SIZE 0x8073
|
||||
#define GL_TEXTURE_BINDING_3D 0x806A
|
||||
|
||||
#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
|
||||
#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910
|
||||
#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911
|
||||
#define GL_STENCIL_BACK_FUNC 0x8800
|
||||
|
@ -464,6 +464,24 @@ typedef float GLmatrix[16];
|
|||
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
|
||||
#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
|
||||
|
||||
#define GL_MAX_DRAW_BUFFERS_ARB 0x8824
|
||||
#define GL_DRAW_BUFFER0_ARB 0x8825
|
||||
#define GL_DRAW_BUFFER1_ARB 0x8826
|
||||
#define GL_DRAW_BUFFER2_ARB 0x8827
|
||||
#define GL_DRAW_BUFFER3_ARB 0x8828
|
||||
#define GL_DRAW_BUFFER4_ARB 0x8829
|
||||
#define GL_DRAW_BUFFER5_ARB 0x882A
|
||||
#define GL_DRAW_BUFFER6_ARB 0x882B
|
||||
#define GL_DRAW_BUFFER7_ARB 0x882C
|
||||
#define GL_DRAW_BUFFER8_ARB 0x882D
|
||||
#define GL_DRAW_BUFFER9_ARB 0x882E
|
||||
#define GL_DRAW_BUFFER10_ARB 0x882F
|
||||
#define GL_DRAW_BUFFER11_ARB 0x8830
|
||||
#define GL_DRAW_BUFFER12_ARB 0x8831
|
||||
#define GL_DRAW_BUFFER13_ARB 0x8832
|
||||
#define GL_DRAW_BUFFER14_ARB 0x8833
|
||||
#define GL_DRAW_BUFFER15_ARB 0x8834
|
||||
|
||||
#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
|
||||
#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C
|
||||
#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D
|
||||
|
@ -751,6 +769,29 @@ typedef float GLmatrix[16];
|
|||
#define GL_MAX_TEXTURE_COORDS_ARB 0x8871
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
|
||||
|
||||
#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
|
||||
#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
|
||||
#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
|
||||
#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145
|
||||
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
|
||||
#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244
|
||||
#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245
|
||||
#define GL_DEBUG_SOURCE_API_ARB 0x8246
|
||||
#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
|
||||
#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
|
||||
#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249
|
||||
#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A
|
||||
#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B
|
||||
#define GL_DEBUG_TYPE_ERROR_ARB 0x824C
|
||||
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
|
||||
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
|
||||
#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F
|
||||
#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
|
||||
#define GL_DEBUG_TYPE_OTHER_ARB 0x8251
|
||||
#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
|
||||
#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
|
||||
#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
|
||||
|
||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
|
||||
|
@ -1185,6 +1226,10 @@ void ( APIENTRY *pglDisableVertexAttribArrayARB)(GLuint index);
|
|||
void ( APIENTRY *pglBindAttribLocationARB)(GLhandleARB programObj, GLuint index, const GLcharARB *name);
|
||||
void ( APIENTRY *pglGetActiveAttribARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
GLint ( APIENTRY *pglGetAttribLocationARB)(GLhandleARB programObj, const GLcharARB *name);
|
||||
void ( APIENTRY *pglBindFragDataLocation)(GLuint programObj, GLuint index, const GLcharARB *name);
|
||||
void ( APIENTRY *pglVertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y );
|
||||
void ( APIENTRY *pglVertexAttrib2fvARB)( GLuint index, const GLfloat *v );
|
||||
void ( APIENTRY *pglVertexAttrib3fvARB)( GLuint index, const GLfloat *v );
|
||||
void ( APIENTRY *pglBindBufferARB) (GLenum target, GLuint buffer);
|
||||
void ( APIENTRY *pglDeleteBuffersARB) (GLsizei n, const GLuint *buffers);
|
||||
void ( APIENTRY *pglGenBuffersARB) (GLsizei n, GLuint *buffers);
|
||||
|
@ -1201,8 +1246,36 @@ void ( APIENTRY *pglEndQueryARB) (GLenum target);
|
|||
void ( APIENTRY *pglGetQueryivARB) (GLenum target, GLenum pname, GLint *params);
|
||||
void ( APIENTRY *pglGetQueryObjectivARB) (GLuint id, GLenum pname, GLint *params);
|
||||
void ( APIENTRY *pglGetQueryObjectuivARB) (GLuint id, GLenum pname, GLuint *params);
|
||||
void ( APIENTRY * pglSelectTextureSGIS) ( GLenum );
|
||||
void ( APIENTRY * pglMTexCoord2fSGIS) ( GLenum, GLfloat, GLfloat );
|
||||
typedef void ( APIENTRY *pglDebugProcARB)( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLcharARB* message, GLvoid* userParam );
|
||||
void ( APIENTRY *pglDebugMessageControlARB)( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled );
|
||||
void ( APIENTRY *pglDebugMessageInsertARB)( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* buf );
|
||||
void ( APIENTRY *pglDebugMessageCallbackARB)( pglDebugProcARB callback, void* userParam );
|
||||
GLuint ( APIENTRY *pglGetDebugMessageLogARB)( GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLuint* severities, GLsizei* lengths, char* messageLog );
|
||||
GLboolean ( APIENTRY *pglIsRenderbuffer )(GLuint renderbuffer);
|
||||
void ( APIENTRY *pglBindRenderbuffer )(GLenum target, GLuint renderbuffer);
|
||||
void ( APIENTRY *pglDeleteRenderbuffers )(GLsizei n, const GLuint *renderbuffers);
|
||||
void ( APIENTRY *pglGenRenderbuffers )(GLsizei n, GLuint *renderbuffers);
|
||||
void ( APIENTRY *pglRenderbufferStorage )(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
void ( APIENTRY *pglRenderbufferStorageMultisample )(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
void ( APIENTRY *pglGetRenderbufferParameteriv )(GLenum target, GLenum pname, GLint *params);
|
||||
GLboolean (APIENTRY *pglIsFramebuffer )(GLuint framebuffer);
|
||||
void ( APIENTRY *pglBindFramebuffer )(GLenum target, GLuint framebuffer);
|
||||
void ( APIENTRY *pglDeleteFramebuffers )(GLsizei n, const GLuint *framebuffers);
|
||||
void ( APIENTRY *pglGenFramebuffers )(GLsizei n, GLuint *framebuffers);
|
||||
GLenum ( APIENTRY *pglCheckFramebufferStatus )(GLenum target);
|
||||
void ( APIENTRY *pglFramebufferTexture1D )(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
void ( APIENTRY *pglFramebufferTexture2D )(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
void ( APIENTRY *pglFramebufferTexture3D )(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer);
|
||||
void ( APIENTRY *pglFramebufferTextureLayer )(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
|
||||
void ( APIENTRY *pglFramebufferRenderbuffer )(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
void ( APIENTRY *pglGetFramebufferAttachmentParameteriv )(GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
void ( APIENTRY *pglBlitFramebuffer )(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
void ( APIENTRY *pglDrawBuffersARB)( GLsizei n, const GLenum *bufs );
|
||||
void ( APIENTRY *pglGenerateMipmap )( GLenum target );
|
||||
void ( APIENTRY *pglBindVertexArray )( GLuint array );
|
||||
void ( APIENTRY *pglDeleteVertexArrays )( GLsizei n, const GLuint *arrays );
|
||||
void ( APIENTRY *pglGenVertexArrays )( GLsizei n, const GLuint *arrays );
|
||||
GLboolean ( APIENTRY *pglIsVertexArray )( GLuint array );
|
||||
void ( APIENTRY * pglSwapInterval) ( int interval );
|
||||
extern void *pglGetProcAddress( const GLubyte * );
|
||||
BOOL ( WINAPI * pwglSwapBuffers)(HDC);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -265,6 +265,7 @@ void GL_LoadTexMatrixExt( const float *glmatrix );
|
|||
void GL_LoadMatrix( const matrix4x4 source );
|
||||
void GL_TexGen( GLenum coord, GLenum mode );
|
||||
void GL_SelectTexture( GLint texture );
|
||||
void GL_CleanupAllTextureUnits( void );
|
||||
void GL_LoadIdentityTexMatrix( void );
|
||||
void GL_DisableAllTexGens( void );
|
||||
void GL_SetRenderMode( int mode );
|
||||
|
@ -309,7 +310,7 @@ byte *GL_ResampleTexture( const byte *source, int in_w, int in_h, int out_w, int
|
|||
int GL_CreateTexture( const char *name, int width, int height, const void *buffer, texFlags_t flags );
|
||||
int GL_CreateTextureArray( const char *name, int width, int height, int depth, const void *buffer, texFlags_t flags );
|
||||
void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor );
|
||||
void GL_TexFilter( gltexture_t *tex, qboolean update );
|
||||
void GL_ApplyTextureParams( gltexture_t *tex );
|
||||
void R_FreeImage( gltexture_t *image );
|
||||
int GL_FindTexture( const char *name );
|
||||
void GL_FreeTexture( GLenum texnum );
|
||||
|
@ -494,41 +495,33 @@ enum
|
|||
GL_WGL_EXTENSIONS,
|
||||
GL_WGL_SWAPCONTROL,
|
||||
GL_WGL_PROCADDRESS,
|
||||
GL_HARDWARE_GAMMA_CONTROL,
|
||||
GL_ARB_VERTEX_BUFFER_OBJECT_EXT,
|
||||
GL_ENV_COMBINE_EXT,
|
||||
GL_ARB_VERTEX_ARRAY_OBJECT_EXT,
|
||||
GL_ARB_MULTITEXTURE,
|
||||
GL_TEXTURECUBEMAP_EXT,
|
||||
GL_DOT3_ARB_EXT,
|
||||
GL_TEXTURE_CUBEMAP_EXT,
|
||||
GL_ANISOTROPY_EXT,
|
||||
GL_TEXTURE_LODBIAS,
|
||||
GL_TEXTURE_LOD_BIAS,
|
||||
GL_OCCLUSION_QUERIES_EXT,
|
||||
GL_TEXTURE_COMPRESSION_EXT,
|
||||
GL_SHADER_GLSL100_EXT,
|
||||
GL_GPU_SHADER4_EXT,
|
||||
GL_SGIS_MIPMAPS_EXT,
|
||||
GL_DRAW_RANGEELEMENTS_EXT,
|
||||
GL_LOCKARRAYS_EXT,
|
||||
GL_TEXTURE_2D_RECT_EXT,
|
||||
GL_TEXTURE_ARRAY_EXT,
|
||||
GL_TEXTURE_3D_EXT,
|
||||
GL_CLAMPTOEDGE_EXT,
|
||||
GL_BLEND_MINMAX_EXT,
|
||||
GL_STENCILTWOSIDE_EXT,
|
||||
GL_BLEND_SUBTRACT_EXT,
|
||||
GL_SHADER_OBJECTS_EXT,
|
||||
GL_VERTEX_SHADER_EXT, // glsl vertex program
|
||||
GL_FRAGMENT_SHADER_EXT, // glsl fragment program
|
||||
GL_EXT_POINTPARAMETERS,
|
||||
GL_SEPARATESTENCIL_EXT,
|
||||
GL_ARB_TEXTURE_NPOT_EXT,
|
||||
GL_CUSTOM_VERTEX_ARRAY_EXT,
|
||||
GL_TEXTURE_ENV_ADD_EXT,
|
||||
GL_CLAMP_TEXBORDER_EXT,
|
||||
GL_ARB_TEXTURE_FLOAT_EXT,
|
||||
GL_ARB_HALF_FLOAT_EXT,
|
||||
GL_ARB_DEPTH_FLOAT_EXT,
|
||||
GL_ARB_SEAMLESS_CUBEMAP,
|
||||
GL_FRAMEBUFFER_OBJECT,
|
||||
GL_DRAW_BUFFERS_EXT,
|
||||
GL_EXT_GPU_SHADER4, // shaders only
|
||||
GL_ARB_TEXTURE_RG,
|
||||
GL_DEPTH_TEXTURE,
|
||||
GL_DEBUG_OUTPUT,
|
||||
GL_SHADOW_EXT,
|
||||
GL_EXTCOUNT, // must be last
|
||||
};
|
||||
|
@ -543,12 +536,21 @@ enum
|
|||
MAX_TEXTURE_UNITS = 32 // can't acess to all over units without GLSL or cg
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GLHW_GENERIC, // where everthing works the way it should
|
||||
GLHW_RADEON, // where you don't have proper GLSL support
|
||||
GLHW_NVIDIA // Geforce 8/9 class DX10 hardware
|
||||
} glHWType_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *renderer_string; // ptrs to OpenGL32.dll, use with caution
|
||||
const char *vendor_string;
|
||||
const char *version_string;
|
||||
|
||||
glHWType_t hardware_type;
|
||||
|
||||
// list of supported extensions
|
||||
const char *extensions_string;
|
||||
const char *wgl_extensions_string;
|
||||
|
@ -562,10 +564,10 @@ typedef struct
|
|||
GLint max_2d_texture_layers;
|
||||
GLint max_3d_texture_size;
|
||||
GLint max_cubemap_size;
|
||||
GLint texRectangle;
|
||||
GLint max_draw_buffers;
|
||||
|
||||
GLfloat max_texture_anisotropy;
|
||||
GLfloat max_texture_lodbias;
|
||||
GLfloat max_texture_lod_bias;
|
||||
|
||||
GLint max_vertex_uniforms;
|
||||
GLint max_vertex_attribs;
|
||||
|
@ -613,8 +615,8 @@ typedef struct
|
|||
int desktopWidth;
|
||||
int desktopHeight;
|
||||
|
||||
qboolean software; // OpenGL software emulation
|
||||
qboolean initialized; // OpenGL subsystem started
|
||||
qboolean extended; // extended context allows to GL_Debug
|
||||
} glwstate_t;
|
||||
|
||||
extern glconfig_t glConfig;
|
||||
|
@ -624,7 +626,6 @@ extern glwstate_t glw_state;
|
|||
//
|
||||
// renderer cvars
|
||||
//
|
||||
extern convar_t *gl_allow_software;
|
||||
extern convar_t *gl_texture_anisotropy;
|
||||
extern convar_t *gl_extensions;
|
||||
extern convar_t *gl_stencilbits;
|
||||
|
@ -632,11 +633,9 @@ extern convar_t *gl_ignorehwgamma;
|
|||
extern convar_t *gl_swapInterval;
|
||||
extern convar_t *gl_check_errors;
|
||||
extern convar_t *gl_round_down;
|
||||
extern convar_t *gl_texturemode;
|
||||
extern convar_t *gl_texture_lodbias;
|
||||
extern convar_t *gl_showtextures;
|
||||
extern convar_t *gl_texture_nearest;
|
||||
extern convar_t *gl_compress_textures;
|
||||
extern convar_t *gl_luminance_textures;
|
||||
extern convar_t *gl_compensate_gamma_screenshots;
|
||||
extern convar_t *gl_keeptjunctions;
|
||||
extern convar_t *gl_detailscale;
|
||||
|
|
|
@ -1262,9 +1262,8 @@ void R_BeginFrame( qboolean clearScene )
|
|||
// draw buffer stuff
|
||||
pglDrawBuffer( GL_BACK );
|
||||
|
||||
// texturemode stuff
|
||||
// update texture parameters
|
||||
if( gl_texturemode->modified || gl_texture_anisotropy->modified || gl_texture_lodbias->modified )
|
||||
if( gl_texture_nearest->modified || gl_texture_anisotropy->modified || gl_texture_lodbias->modified )
|
||||
R_SetTextureParameters();
|
||||
|
||||
// swapinterval stuff
|
||||
|
@ -1731,7 +1730,7 @@ qboolean R_InitRenderAPI( void )
|
|||
{
|
||||
if( clgame.dllFuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &clgame.drawFuncs ))
|
||||
{
|
||||
MsgDev( D_AICONSOLE, "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION );
|
||||
MsgDev( D_REPORT, "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -198,10 +198,10 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
|
|||
psprite->radius = pin->boundingradius;
|
||||
psprite->synctype = pin->synctype;
|
||||
|
||||
mod->mins[0] = mod->mins[1] = -pin->bounds[0] / 2;
|
||||
mod->maxs[0] = mod->maxs[1] = pin->bounds[0] / 2;
|
||||
mod->mins[2] = -pin->bounds[1] / 2;
|
||||
mod->maxs[2] = pin->bounds[1] / 2;
|
||||
mod->mins[0] = mod->mins[1] = -pin->bounds[0] * 0.5f;
|
||||
mod->maxs[0] = mod->maxs[1] = pin->bounds[0] * 0.5f;
|
||||
mod->mins[2] = -pin->bounds[1] * 0.5f;
|
||||
mod->maxs[2] = pin->bounds[1] * 0.5f;
|
||||
numi = (short *)(pin + 1);
|
||||
|
||||
if( host.type == HOST_DEDICATED )
|
||||
|
@ -334,7 +334,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean
|
|||
psprite->type = SPR_FWD_PARALLEL_ORIENTED;
|
||||
psprite->texFormat = SPR_ALPHTEST;
|
||||
psprite->numframes = mod->numframes = numframes;
|
||||
psprite->radius = sqrt((( w >> 1) * (w >> 1)) + ((h >> 1) * (h >> 1)));
|
||||
psprite->radius = sqrt(((w >> 1) * (w >> 1)) + ((h >> 1) * (h >> 1)));
|
||||
|
||||
mod->mins[0] = mod->mins[1] = -w / 2;
|
||||
mod->maxs[0] = mod->maxs[1] = w / 2;
|
||||
|
@ -459,13 +459,16 @@ mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw )
|
|||
mspritegroup_t *pspritegroup;
|
||||
mspriteframe_t *pspriteframe = NULL;
|
||||
float *pintervals, fullinterval;
|
||||
float targettime, time;
|
||||
int i, numframes;
|
||||
float targettime;
|
||||
|
||||
ASSERT( pModel );
|
||||
psprite = pModel->cache.data;
|
||||
|
||||
if( frame < 0 ) frame = 0;
|
||||
if( frame < 0 )
|
||||
{
|
||||
frame = 0;
|
||||
}
|
||||
else if( frame >= psprite->numframes )
|
||||
{
|
||||
MsgDev( D_WARN, "R_GetSpriteFrame: no such frame %d (%s)\n", frame, pModel->name );
|
||||
|
@ -482,11 +485,10 @@ mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw )
|
|||
pintervals = pspritegroup->intervals;
|
||||
numframes = pspritegroup->numframes;
|
||||
fullinterval = pintervals[numframes-1];
|
||||
time = cl.time;
|
||||
|
||||
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
||||
// are positive, so we don't have to worry about division by zero
|
||||
targettime = time - ((int)(time / fullinterval)) * fullinterval;
|
||||
targettime = cl.time - ((int)( cl.time / fullinterval )) * fullinterval;
|
||||
|
||||
for( i = 0; i < (numframes - 1); i++ )
|
||||
{
|
||||
|
@ -518,97 +520,87 @@ between frames where are we lerping
|
|||
float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe, mspriteframe_t **curframe )
|
||||
{
|
||||
msprite_t *psprite;
|
||||
mspritegroup_t *pspritegroup;
|
||||
int i, j, numframes, frame;
|
||||
float lerpFrac, time, jtime, jinterval;
|
||||
float *pintervals, fullinterval, targettime;
|
||||
int m_fDoInterp;
|
||||
float lerpFrac = 0.0f, frame;
|
||||
float frametime = (1.0f / 10.0f);
|
||||
int m_fDoInterp, oldf, newf;
|
||||
int i, j, iframe;
|
||||
|
||||
psprite = ent->model->cache.data;
|
||||
frame = (int)ent->curstate.frame;
|
||||
lerpFrac = 1.0f;
|
||||
frame = Q_max( 0.0f, ent->curstate.frame );
|
||||
iframe = (int)ent->curstate.frame;
|
||||
|
||||
if( ent->curstate.framerate > 0.0f )
|
||||
frametime = (1.0f / ent->curstate.framerate);
|
||||
|
||||
// misc info
|
||||
if( r_sprite_lerping->integer )
|
||||
if( r_sprite_lerping->integer && psprite->numframes > 1 )
|
||||
m_fDoInterp = (ent->curstate.effects & EF_NOINTERP) ? false : true;
|
||||
else m_fDoInterp = false;
|
||||
|
||||
if( frame < 0 )
|
||||
if( m_fDoInterp == false )
|
||||
{
|
||||
frame = 0;
|
||||
// interpolation disabled for some reasons
|
||||
*oldframe = *curframe = R_GetSpriteFrame( ent->model, ent->curstate.frame, ent->angles[YAW] );
|
||||
return lerpFrac;
|
||||
}
|
||||
else if( frame >= psprite->numframes )
|
||||
|
||||
if( iframe < 0 )
|
||||
{
|
||||
iframe = 0;
|
||||
}
|
||||
else if( iframe >= psprite->numframes )
|
||||
{
|
||||
MsgDev( D_WARN, "R_GetSpriteFrameInterpolant: no such frame %d (%s)\n", frame, ent->model->name );
|
||||
frame = psprite->numframes - 1;
|
||||
iframe = psprite->numframes - 1;
|
||||
}
|
||||
|
||||
if( psprite->frames[frame].type == FRAME_SINGLE )
|
||||
// calc interpolant range
|
||||
oldf = (int)Q_floor( frame );
|
||||
newf = (int)Q_ceil( frame );
|
||||
|
||||
// allow interp between first and last frame
|
||||
oldf = oldf % ( psprite->numframes - 1 );
|
||||
newf = newf % ( psprite->numframes - 1 );
|
||||
|
||||
// NOTE: we allow interpolation between single and angled frames e.g. for Doom monsters
|
||||
if( psprite->frames[iframe].type == FRAME_SINGLE || psprite->frames[iframe].type == FRAME_ANGLED )
|
||||
{
|
||||
if( m_fDoInterp )
|
||||
// frame was changed
|
||||
if( newf != ent->latched.prevframe )
|
||||
{
|
||||
if( ent->latched.prevblending[0] >= psprite->numframes || psprite->frames[ent->latched.prevblending[0]].type != FRAME_SINGLE )
|
||||
{
|
||||
// this can be happens when rendering switched between single and angled frames
|
||||
// or change model on replace delta-entity
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.prevanimtime = RI.refdef.time;
|
||||
lerpFrac = 1.0f;
|
||||
ent->latched.prevanimtime = cl.time + frametime;
|
||||
ent->latched.prevframe = newf;
|
||||
lerpFrac = 1.0f; // reset lerp
|
||||
}
|
||||
|
||||
if( ent->latched.prevanimtime < RI.refdef.time )
|
||||
{
|
||||
if( frame != ent->latched.prevblending[1] )
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1];
|
||||
ent->latched.prevblending[1] = frame;
|
||||
ent->latched.prevanimtime = RI.refdef.time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
else lerpFrac = (RI.refdef.time - ent->latched.prevanimtime) * 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.prevanimtime = RI.refdef.time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
lerpFrac = 1.0f;
|
||||
}
|
||||
if( ent->latched.prevanimtime != 0.0f && ent->latched.prevanimtime >= cl.time )
|
||||
lerpFrac = (ent->latched.prevanimtime - cl.time) * ent->curstate.framerate;
|
||||
|
||||
if( ent->latched.prevblending[0] >= psprite->numframes )
|
||||
{
|
||||
// reset interpolation on change model
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.prevanimtime = RI.refdef.time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
// compute lerp factor
|
||||
lerpFrac = (int)(10000 * lerpFrac) / 10000.0f;
|
||||
lerpFrac = bound( 0.0f, 1.0f - lerpFrac, 1.0f );
|
||||
|
||||
// get the interpolated frames
|
||||
if( oldframe ) *oldframe = psprite->frames[ent->latched.prevblending[0]].frameptr;
|
||||
if( curframe ) *curframe = psprite->frames[frame].frameptr;
|
||||
if( oldframe ) *oldframe = R_GetSpriteFrame( ent->model, oldf, ent->angles[YAW] );
|
||||
if( curframe ) *curframe = R_GetSpriteFrame( ent->model, newf, ent->angles[YAW] );
|
||||
}
|
||||
else if( psprite->frames[frame].type == FRAME_GROUP )
|
||||
else if( psprite->frames[iframe].type == FRAME_GROUP )
|
||||
{
|
||||
pspritegroup = (mspritegroup_t *)psprite->frames[frame].frameptr;
|
||||
pintervals = pspritegroup->intervals;
|
||||
numframes = pspritegroup->numframes;
|
||||
fullinterval = pintervals[numframes-1];
|
||||
mspritegroup_t *pspritegroup = (mspritegroup_t *)psprite->frames[iframe].frameptr;
|
||||
float *pintervals = pspritegroup->intervals;
|
||||
float fullinterval, targettime, jinterval;
|
||||
float jtime = 0.0f;
|
||||
|
||||
fullinterval = pintervals[pspritegroup->numframes-1];
|
||||
jinterval = pintervals[1] - pintervals[0];
|
||||
time = RI.refdef.time;
|
||||
jtime = 0.0f;
|
||||
|
||||
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
||||
// are positive, so we don't have to worry about division by zero
|
||||
targettime = time - ((int)(time / fullinterval)) * fullinterval;
|
||||
targettime = cl.time - ((int)( cl.time / fullinterval )) * fullinterval;
|
||||
|
||||
// LordHavoc: since I can't measure the time properly when it loops from numframes - 1 to 0,
|
||||
// i instead measure the time of the first frame, hoping it is consistent
|
||||
for( i = 0, j = numframes - 1; i < (numframes - 1); i++ )
|
||||
for( i = 0, j = (pspritegroup->numframes - 1); i < (pspritegroup->numframes - 1); i++ )
|
||||
{
|
||||
if( pintervals[i] > targettime )
|
||||
break;
|
||||
|
@ -617,61 +609,12 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
|||
jtime = pintervals[i];
|
||||
}
|
||||
|
||||
if( m_fDoInterp )
|
||||
lerpFrac = (targettime - jtime) / jinterval;
|
||||
else j = i; // no lerping
|
||||
|
||||
// get the interpolated frames
|
||||
if( oldframe ) *oldframe = pspritegroup->frames[j];
|
||||
if( curframe ) *curframe = pspritegroup->frames[i];
|
||||
}
|
||||
else if( psprite->frames[frame].type == FRAME_ANGLED )
|
||||
{
|
||||
// e.g. doom-style sprite monsters
|
||||
float yaw = ent->angles[YAW];
|
||||
int angleframe = (int)(Q_rint(( RI.refdef.viewangles[1] - yaw + 45.0f ) / 360 * 8) - 4) & 7;
|
||||
|
||||
if( m_fDoInterp )
|
||||
{
|
||||
if( ent->latched.prevblending[0] >= psprite->numframes || psprite->frames[ent->latched.prevblending[0]].type != FRAME_ANGLED )
|
||||
{
|
||||
// this can be happens when rendering switched between single and angled frames
|
||||
// or change model on replace delta-entity
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.prevanimtime = RI.refdef.time;
|
||||
lerpFrac = 1.0f;
|
||||
}
|
||||
|
||||
if( ent->latched.prevanimtime < RI.refdef.time )
|
||||
{
|
||||
if( frame != ent->latched.prevblending[1] )
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1];
|
||||
ent->latched.prevblending[1] = frame;
|
||||
ent->latched.prevanimtime = RI.refdef.time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
else lerpFrac = (RI.refdef.time - ent->latched.prevanimtime) * ent->curstate.framerate;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.prevanimtime = RI.refdef.time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
lerpFrac = 1.0f;
|
||||
}
|
||||
|
||||
pspritegroup = (mspritegroup_t *)psprite->frames[ent->latched.prevblending[0]].frameptr;
|
||||
if( oldframe ) *oldframe = pspritegroup->frames[angleframe];
|
||||
|
||||
pspritegroup = (mspritegroup_t *)psprite->frames[frame].frameptr;
|
||||
if( curframe ) *curframe = pspritegroup->frames[angleframe];
|
||||
}
|
||||
|
||||
return lerpFrac;
|
||||
}
|
||||
|
|
|
@ -876,13 +876,13 @@ void R_StudioCalcBoneQuaterion( int frame, float s, mstudiobone_t *pbone, mstudi
|
|||
|
||||
if( !VectorCompare( angle1, angle2 ))
|
||||
{
|
||||
AngleQuaternion( angle1, q1 );
|
||||
AngleQuaternion( angle2, q2 );
|
||||
AngleQuaternion( angle1, q1, true );
|
||||
AngleQuaternion( angle2, q2, true );
|
||||
QuaternionSlerp( q1, q2, s, q );
|
||||
}
|
||||
else
|
||||
{
|
||||
AngleQuaternion( angle1, q );
|
||||
AngleQuaternion( angle1, q, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3442,7 +3442,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
|
|||
filter = R_FindTexFilter( va( "%s.mdl/%s", mdlname, name )); // grab texture filter
|
||||
|
||||
// NOTE: colormaps must have the palette for properly work. Ignore it.
|
||||
if( Mod_AllowMaterials( ) && !( ptexture->flags & STUDIO_NF_COLORMAP ))
|
||||
if( Mod_AllowMaterials( ) && !FBitSet( ptexture->flags, STUDIO_NF_COLORMAP ))
|
||||
{
|
||||
int gl_texturenum = 0;
|
||||
|
||||
|
@ -3464,7 +3464,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
|
|||
ptexture->index = (int)((byte *)phdr) + ptexture->index;
|
||||
size = sizeof( mstudiotexture_t ) + ptexture->width * ptexture->height + 768;
|
||||
|
||||
if( host.features & ENGINE_DISABLE_HDTEXTURES && ptexture->flags & STUDIO_NF_TRANSPARENT )
|
||||
if( FBitSet( host.features, ENGINE_DISABLE_HDTEXTURES ) && FBitSet( ptexture->flags, STUDIO_NF_TRANSPARENT ))
|
||||
flags |= TF_KEEP_8BIT; // Paranoia2 alpha-tracing
|
||||
|
||||
// build the texname
|
||||
|
|
|
@ -22,30 +22,28 @@ GNU General Public License for more details.
|
|||
#define VID_AUTOMODE "-1"
|
||||
#define VID_DEFAULTMODE 2.0f
|
||||
#define DISP_CHANGE_BADDUALVIEW -6 // MSVC 6.0 doesn't
|
||||
#define num_vidmodes ( sizeof( vidmode ) / sizeof( vidmode[0] ))
|
||||
#define num_vidmodes ARRAYSIZE( vidmode )
|
||||
#define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_SYSMENU|WS_CAPTION|WS_VISIBLE)
|
||||
#define WINDOW_EX_STYLE (0)
|
||||
#define WINDOW_NAME "Xash Window" // Half-Life
|
||||
#define WINDOW_NAME "Xash3D Window" // Half-Life
|
||||
|
||||
convar_t *renderinfo;
|
||||
convar_t *gl_allow_software;
|
||||
convar_t *gl_extensions;
|
||||
convar_t *gl_alphabits;
|
||||
convar_t *gl_stencilbits;
|
||||
convar_t *gl_ignorehwgamma;
|
||||
convar_t *gl_texture_anisotropy;
|
||||
convar_t *gl_texture_lodbias;
|
||||
convar_t *gl_texture_nearest;
|
||||
convar_t *gl_compress_textures;
|
||||
convar_t *gl_luminance_textures;
|
||||
convar_t *gl_compensate_gamma_screenshots;
|
||||
convar_t *gl_keeptjunctions;
|
||||
convar_t *gl_texture_lodbias;
|
||||
convar_t *gl_showtextures;
|
||||
convar_t *gl_detailscale;
|
||||
convar_t *gl_swapInterval;
|
||||
convar_t *gl_check_errors;
|
||||
convar_t *gl_allow_static;
|
||||
convar_t *gl_allow_mirrors;
|
||||
convar_t *gl_texturemode;
|
||||
convar_t *gl_wireframe;
|
||||
convar_t *gl_round_down;
|
||||
convar_t *gl_overview;
|
||||
|
@ -148,6 +146,7 @@ static dllfunc_t opengl_110funcs[] =
|
|||
{ "glCullFace" , (void **)&pglCullFace },
|
||||
{ "glDrawBuffer" , (void **)&pglDrawBuffer },
|
||||
{ "glReadBuffer" , (void **)&pglReadBuffer },
|
||||
{ "glAccum" , (void **)&pglAccum },
|
||||
{ "glEnable" , (void **)&pglEnable },
|
||||
{ "glDisable" , (void **)&pglDisable },
|
||||
{ "glEnableClientState" , (void **)&pglEnableClientState },
|
||||
|
@ -166,6 +165,7 @@ static dllfunc_t opengl_110funcs[] =
|
|||
{ "glDepthRange" , (void **)&pglDepthRange },
|
||||
{ "glFrontFace" , (void **)&pglFrontFace },
|
||||
{ "glDrawElements" , (void **)&pglDrawElements },
|
||||
{ "glDrawArrays" , (void **)&pglDrawArrays },
|
||||
{ "glColorMask" , (void **)&pglColorMask },
|
||||
{ "glIndexPointer" , (void **)&pglIndexPointer },
|
||||
{ "glVertexPointer" , (void **)&pglVertexPointer },
|
||||
|
@ -184,6 +184,10 @@ static dllfunc_t opengl_110funcs[] =
|
|||
{ "glTexCoord2f" , (void **)&pglTexCoord2f },
|
||||
{ "glTexCoord3f" , (void **)&pglTexCoord3f },
|
||||
{ "glTexCoord4f" , (void **)&pglTexCoord4f },
|
||||
{ "glTexCoord1fv" , (void **)&pglTexCoord1fv },
|
||||
{ "glTexCoord2fv" , (void **)&pglTexCoord2fv },
|
||||
{ "glTexCoord3fv" , (void **)&pglTexCoord3fv },
|
||||
{ "glTexCoord4fv" , (void **)&pglTexCoord4fv },
|
||||
{ "glTexGenf" , (void **)&pglTexGenf },
|
||||
{ "glTexGenfv" , (void **)&pglTexGenfv },
|
||||
{ "glTexGeni" , (void **)&pglTexGeni },
|
||||
|
@ -198,7 +202,7 @@ static dllfunc_t opengl_110funcs[] =
|
|||
{ "glPointSize" , (void**)&pglPointSize },
|
||||
{ "glMatrixMode" , (void **)&pglMatrixMode },
|
||||
{ "glOrtho" , (void **)&pglOrtho },
|
||||
{ "glRasterPos2f" , (void **)&pglRasterPos2f },
|
||||
{ "glRasterPos2f" , (void **) &pglRasterPos2f },
|
||||
{ "glFrustum" , (void **)&pglFrustum },
|
||||
{ "glViewport" , (void **)&pglViewport },
|
||||
{ "glPushMatrix" , (void **)&pglPushMatrix },
|
||||
|
@ -246,6 +250,7 @@ static dllfunc_t opengl_110funcs[] =
|
|||
{ "glCopyTexSubImage1D" , (void **)&pglCopyTexSubImage1D },
|
||||
{ "glCopyTexSubImage2D" , (void **)&pglCopyTexSubImage2D },
|
||||
{ "glScissor" , (void **)&pglScissor },
|
||||
{ "glGetTexImage" , (void **)&pglGetTexImage },
|
||||
{ "glGetTexEnviv" , (void **)&pglGetTexEnviv },
|
||||
{ "glPolygonOffset" , (void **)&pglPolygonOffset },
|
||||
{ "glPolygonMode" , (void **)&pglPolygonMode },
|
||||
|
@ -253,36 +258,33 @@ static dllfunc_t opengl_110funcs[] =
|
|||
{ "glClipPlane" , (void **)&pglClipPlane },
|
||||
{ "glGetClipPlane" , (void **)&pglGetClipPlane },
|
||||
{ "glShadeModel" , (void **)&pglShadeModel },
|
||||
{ "glGetTexLevelParameteriv" , (void **)&pglGetTexLevelParameteriv },
|
||||
{ "glGetTexLevelParameterfv" , (void **)&pglGetTexLevelParameterfv },
|
||||
{ "glFogfv" , (void **)&pglFogfv },
|
||||
{ "glFogf" , (void **)&pglFogf },
|
||||
{ "glFogi" , (void **)&pglFogi },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t pointparametersfunc[] =
|
||||
{
|
||||
{ "glPointParameterfEXT" , (void **)&pglPointParameterfEXT },
|
||||
{ "glPointParameterfvEXT" , (void **)&pglPointParameterfvEXT },
|
||||
{ NULL, NULL }
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t drawrangeelementsfuncs[] =
|
||||
{
|
||||
{ "glDrawRangeElements" , (void **)&pglDrawRangeElements },
|
||||
{ NULL, NULL }
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t drawrangeelementsextfuncs[] =
|
||||
{
|
||||
{ "glDrawRangeElementsEXT" , (void **)&pglDrawRangeElementsEXT },
|
||||
{ NULL, NULL }
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t sgis_multitexturefuncs[] =
|
||||
static dllfunc_t debugoutputfuncs[] =
|
||||
{
|
||||
{ "glSelectTextureSGIS" , (void **)&pglSelectTextureSGIS },
|
||||
{ "glMTexCoord2fSGIS" , (void **)&pglMTexCoord2fSGIS },
|
||||
{ NULL, NULL }
|
||||
{ "glDebugMessageControlARB" , (void **)&pglDebugMessageControlARB },
|
||||
{ "glDebugMessageInsertARB" , (void **)&pglDebugMessageInsertARB },
|
||||
{ "glDebugMessageCallbackARB" , (void **)&pglDebugMessageCallbackARB },
|
||||
{ "glGetDebugMessageLogARB" , (void **)&pglGetDebugMessageLogARB },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t multitexturefuncs[] =
|
||||
|
@ -291,18 +293,11 @@ static dllfunc_t multitexturefuncs[] =
|
|||
{ "glMultiTexCoord2fARB" , (void **)&pglMultiTexCoord2f },
|
||||
{ "glMultiTexCoord3fARB" , (void **)&pglMultiTexCoord3f },
|
||||
{ "glMultiTexCoord4fARB" , (void **)&pglMultiTexCoord4f },
|
||||
{ "glActiveTextureARB" , (void **)&pglActiveTexture },
|
||||
{ "glActiveTextureARB" , (void **)&pglActiveTextureARB },
|
||||
{ "glClientActiveTextureARB" , (void **)&pglClientActiveTexture },
|
||||
{ "glClientActiveTextureARB" , (void **)&pglClientActiveTextureARB },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t compiledvertexarrayfuncs[] =
|
||||
{
|
||||
{ "glLockArraysEXT" , (void **)&pglLockArraysEXT },
|
||||
{ "glUnlockArraysEXT" , (void **)&pglUnlockArraysEXT },
|
||||
{ "glDrawArrays" , (void **)&pglDrawArrays },
|
||||
{ NULL, NULL }
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t texture3dextfuncs[] =
|
||||
|
@ -310,33 +305,7 @@ static dllfunc_t texture3dextfuncs[] =
|
|||
{ "glTexImage3DEXT" , (void **)&pglTexImage3D },
|
||||
{ "glTexSubImage3DEXT" , (void **)&pglTexSubImage3D },
|
||||
{ "glCopyTexSubImage3DEXT" , (void **)&pglCopyTexSubImage3D },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t atiseparatestencilfuncs[] =
|
||||
{
|
||||
{ "glStencilOpSeparateATI" , (void **)&pglStencilOpSeparate },
|
||||
{ "glStencilFuncSeparateATI" , (void **)&pglStencilFuncSeparate },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t gl2separatestencilfuncs[] =
|
||||
{
|
||||
{ "glStencilOpSeparate" , (void **)&pglStencilOpSeparate },
|
||||
{ "glStencilFuncSeparate" , (void **)&pglStencilFuncSeparate },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t stenciltwosidefuncs[] =
|
||||
{
|
||||
{ "glActiveStencilFaceEXT" , (void **)&pglActiveStencilFaceEXT },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t blendequationfuncs[] =
|
||||
{
|
||||
{ "glBlendEquationEXT" , (void **)&pglBlendEquationEXT },
|
||||
{ NULL, NULL }
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t shaderobjectsfuncs[] =
|
||||
|
@ -386,18 +355,10 @@ static dllfunc_t shaderobjectsfuncs[] =
|
|||
{ "glBindAttribLocationARB" , (void **)&pglBindAttribLocationARB },
|
||||
{ "glGetActiveAttribARB" , (void **)&pglGetActiveAttribARB },
|
||||
{ "glGetAttribLocationARB" , (void **)&pglGetAttribLocationARB },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t vertexshaderfuncs[] =
|
||||
{
|
||||
{ "glVertexAttribPointerARB" , (void **)&pglVertexAttribPointerARB },
|
||||
{ "glEnableVertexAttribArrayARB" , (void **)&pglEnableVertexAttribArrayARB },
|
||||
{ "glDisableVertexAttribArrayARB" , (void **)&pglDisableVertexAttribArrayARB },
|
||||
{ "glBindAttribLocationARB" , (void **)&pglBindAttribLocationARB },
|
||||
{ "glGetActiveAttribARB" , (void **)&pglGetActiveAttribARB },
|
||||
{ "glGetAttribLocationARB" , (void **)&pglGetAttribLocationARB },
|
||||
{ NULL, NULL }
|
||||
{ "glVertexAttrib2f" , (void **)&pglVertexAttrib2fARB },
|
||||
{ "glVertexAttrib2fv" , (void **)&pglVertexAttrib2fvARB },
|
||||
{ "glVertexAttrib3fv" , (void **)&pglVertexAttrib3fvARB },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t vbofuncs[] =
|
||||
|
@ -410,6 +371,62 @@ static dllfunc_t vbofuncs[] =
|
|||
{ "glUnmapBufferARB" , (void **)&pglUnmapBufferARB },
|
||||
{ "glBufferDataARB" , (void **)&pglBufferDataARB },
|
||||
{ "glBufferSubDataARB" , (void **)&pglBufferSubDataARB },
|
||||
{ NULL , NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t vaofuncs[] =
|
||||
{
|
||||
{ "glBindVertexArray" , (void **)&pglBindVertexArray },
|
||||
{ "glDeleteVertexArrays" , (void **)&pglDeleteVertexArrays },
|
||||
{ "glGenVertexArrays" , (void **)&pglGenVertexArrays },
|
||||
{ "glIsVertexArray" , (void **)&pglIsVertexArray },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t arbfbofuncs[] =
|
||||
{
|
||||
{ "glIsRenderbuffer" , (void **)&pglIsRenderbuffer },
|
||||
{ "glBindRenderbuffer" , (void **)&pglBindRenderbuffer },
|
||||
{ "glDeleteRenderbuffers" , (void **)&pglDeleteRenderbuffers },
|
||||
{ "glGenRenderbuffers" , (void **)&pglGenRenderbuffers },
|
||||
{ "glRenderbufferStorage" , (void **)&pglRenderbufferStorage },
|
||||
{ "glRenderbufferStorageMultisample" , (void **)&pglRenderbufferStorageMultisample }, // not in GL_EXT_framebuffer_object
|
||||
{ "glGetRenderbufferParameteriv" , (void **)&pglGetRenderbufferParameteriv },
|
||||
{ "glIsFramebuffer" , (void **)&pglIsFramebuffer },
|
||||
{ "glBindFramebuffer" , (void **)&pglBindFramebuffer },
|
||||
{ "glDeleteFramebuffers" , (void **)&pglDeleteFramebuffers },
|
||||
{ "glGenFramebuffers" , (void **)&pglGenFramebuffers },
|
||||
{ "glCheckFramebufferStatus" , (void **)&pglCheckFramebufferStatus },
|
||||
{ "glFramebufferTexture1D" , (void **)&pglFramebufferTexture1D },
|
||||
{ "glFramebufferTexture2D" , (void **)&pglFramebufferTexture2D },
|
||||
{ "glFramebufferTexture3D" , (void **)&pglFramebufferTexture3D },
|
||||
{ "glFramebufferTextureLayer" , (void **)&pglFramebufferTextureLayer }, // not in GL_EXT_framebuffer_object
|
||||
{ "glFramebufferRenderbuffer" , (void **)&pglFramebufferRenderbuffer },
|
||||
{ "glGetFramebufferAttachmentParameteriv" , (void **)&pglGetFramebufferAttachmentParameteriv },
|
||||
{ "glBlitFramebuffer" , (void **)&pglBlitFramebuffer }, // not in GL_EXT_framebuffer_object
|
||||
{ "glGenerateMipmap" , (void **)&pglGenerateMipmap },
|
||||
{ NULL , NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t extfbofuncs[] =
|
||||
{
|
||||
{ "glIsRenderbufferEXT" , (void **)&pglIsRenderbuffer },
|
||||
{ "glBindRenderbufferEXT" , (void **)&pglBindRenderbuffer },
|
||||
{ "glDeleteRenderbuffersEXT" , (void **)&pglDeleteRenderbuffers },
|
||||
{ "glGenRenderbuffersEXT" , (void **)&pglGenRenderbuffers },
|
||||
{ "glRenderbufferStorageEXT" , (void **)&pglRenderbufferStorage },
|
||||
{ "glGetRenderbufferParameterivEXT" , (void **)&pglGetRenderbufferParameteriv },
|
||||
{ "glIsFramebufferEXT" , (void **)&pglIsFramebuffer },
|
||||
{ "glBindFramebufferEXT" , (void **)&pglBindFramebuffer },
|
||||
{ "glDeleteFramebuffersEXT" , (void **)&pglDeleteFramebuffers },
|
||||
{ "glGenFramebuffersEXT" , (void **)&pglGenFramebuffers },
|
||||
{ "glCheckFramebufferStatusEXT" , (void **)&pglCheckFramebufferStatus },
|
||||
{ "glFramebufferTexture1DEXT" , (void **)&pglFramebufferTexture1D },
|
||||
{ "glFramebufferTexture2DEXT" , (void **)&pglFramebufferTexture2D },
|
||||
{ "glFramebufferTexture3DEXT" , (void **)&pglFramebufferTexture3D },
|
||||
{ "glFramebufferRenderbufferEXT" , (void **)&pglFramebufferRenderbuffer },
|
||||
{ "glGetFramebufferAttachmentParameterivEXT" , (void **)&pglGetFramebufferAttachmentParameteriv },
|
||||
{ "glGenerateMipmapEXT" , (void **)&pglGenerateMipmap },
|
||||
{ NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -423,7 +440,7 @@ static dllfunc_t occlusionfunc[] =
|
|||
{ "glGetQueryivARB" , (void **)&pglGetQueryivARB },
|
||||
{ "glGetQueryObjectivARB" , (void **)&pglGetQueryObjectivARB },
|
||||
{ "glGetQueryObjectuivARB" , (void **)&pglGetQueryObjectuivARB },
|
||||
{ NULL, NULL }
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t texturecompressionfuncs[] =
|
||||
|
@ -435,7 +452,13 @@ static dllfunc_t texturecompressionfuncs[] =
|
|||
{ "glCompressedTexSubImage2DARB" , (void **)&pglCompressedTexSubImage2DARB },
|
||||
{ "glCompressedTexSubImage1DARB" , (void **)&pglCompressedTexSubImage1DARB },
|
||||
{ "glGetCompressedTexImageARB" , (void **)&pglGetCompressedTexImage },
|
||||
{ NULL, NULL }
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t drawbuffersfuncs[] =
|
||||
{
|
||||
{ "glDrawBuffersARB" , (void **)&pglDrawBuffersARB },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t wgl_funcs[] =
|
||||
|
@ -445,7 +468,7 @@ static dllfunc_t wgl_funcs[] =
|
|||
{ "wglDeleteContext" , (void **)&pwglDeleteContext },
|
||||
{ "wglMakeCurrent" , (void **)&pwglMakeCurrent },
|
||||
{ "wglGetCurrentContext" , (void **)&pwglGetCurrentContext },
|
||||
{ NULL, NULL }
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static dllfunc_t wglproc_funcs[] =
|
||||
|
@ -468,6 +491,50 @@ static dllfunc_t wglgetextensionsstring[] =
|
|||
|
||||
dll_info_t opengl_dll = { "opengl32.dll", wgl_funcs, true };
|
||||
|
||||
/*
|
||||
========================
|
||||
DebugCallback
|
||||
|
||||
For ARB_debug_output
|
||||
========================
|
||||
*/
|
||||
static void CALLBACK GL_DebugOutput( GLuint source, GLuint type, GLuint id, GLuint severity, GLint length, const GLcharARB *message, GLvoid *userParam )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
case GL_DEBUG_TYPE_ERROR_ARB:
|
||||
if( host.developer < D_ERROR ) // "-dev 2"
|
||||
return;
|
||||
Con_Printf( "^1OpenGL Error:^7 %s\n", message );
|
||||
break;
|
||||
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB:
|
||||
if( host.developer < D_WARN ) // "-dev 3"
|
||||
return;
|
||||
Con_Printf( "^3OpenGL Warning:^7 %s\n", message );
|
||||
break;
|
||||
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB:
|
||||
if( host.developer < D_WARN ) // "-dev 3"
|
||||
return;
|
||||
Con_Printf( "^3OpenGL Warning:^7 %s\n", message );
|
||||
break;
|
||||
case GL_DEBUG_TYPE_PORTABILITY_ARB:
|
||||
if( host.developer < D_REPORT ) // "-dev 4"
|
||||
return;
|
||||
Con_Printf( "^3OpenGL Warning:^7 %s\n", message );
|
||||
break;
|
||||
case GL_DEBUG_TYPE_PERFORMANCE_ARB:
|
||||
if( host.developer < D_REPORT ) // "-dev 4"
|
||||
return;
|
||||
Con_Printf( "OpenGL Notify: %s\n", message );
|
||||
break;
|
||||
case GL_DEBUG_TYPE_OTHER_ARB:
|
||||
default: if( host.developer < D_NOTE ) // "-dev 5"
|
||||
return;
|
||||
Con_Printf( "OpenGL: %s\n", message );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
GL_SetExtension
|
||||
|
@ -502,7 +569,7 @@ GL_MaxTextureUnits
|
|||
int GL_MaxTextureUnits( void )
|
||||
{
|
||||
if( GL_Support( GL_SHADER_GLSL100_EXT ))
|
||||
return min( max( glConfig.max_texture_coords, glConfig.max_teximage_units ), MAX_TEXTURE_UNITS );
|
||||
return Q_min( Q_max( glConfig.max_texture_coords, glConfig.max_teximage_units ), MAX_TEXTURE_UNITS );
|
||||
return glConfig.max_texture_units;
|
||||
}
|
||||
|
||||
|
@ -585,8 +652,9 @@ GL_BuildGammaTable
|
|||
*/
|
||||
void GL_BuildGammaTable( void )
|
||||
{
|
||||
double invGamma;
|
||||
double div;
|
||||
int i, v;
|
||||
double invGamma, div;
|
||||
|
||||
invGamma = 1.0 / bound( 0.5, vid_gamma->value, 2.3 );
|
||||
div = (double) 1.0 / 255.5;
|
||||
|
@ -705,13 +773,15 @@ qboolean GL_CreateContext( void )
|
|||
{
|
||||
HGLRC hBaseRC;
|
||||
|
||||
glw_state.extended = false;
|
||||
|
||||
if(!( glw_state.hGLRC = pwglCreateContext( glw_state.hDC )))
|
||||
return GL_DeleteContext();
|
||||
|
||||
if(!( pwglMakeCurrent( glw_state.hDC, glw_state.hGLRC )))
|
||||
return GL_DeleteContext();
|
||||
|
||||
if( !Sys_CheckParm( "-gldebug" ) || host.developer < 1 ) // debug bit the kills perfomance
|
||||
if( !Sys_CheckParm( "-gldebug" ) || host.developer < D_INFO ) // debug bit the kills perfomance
|
||||
return true;
|
||||
|
||||
pwglCreateContextAttribsARB = GL_GetProcAddress( "wglCreateContextAttribsARB" );
|
||||
|
@ -747,6 +817,7 @@ qboolean GL_CreateContext( void )
|
|||
|
||||
MsgDev( D_NOTE, "GL_CreateContext: using extended context\n" );
|
||||
pwglDeleteContext( hBaseRC ); // release first context
|
||||
glw_state.extended = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -768,6 +839,8 @@ qboolean GL_UpdateContext( void )
|
|||
/*
|
||||
=================
|
||||
GL_DeleteContext
|
||||
|
||||
always return false
|
||||
=================
|
||||
*/
|
||||
qboolean GL_DeleteContext( void )
|
||||
|
@ -848,6 +921,13 @@ static int VID_ChoosePFD( PIXELFORMATDESCRIPTOR *pfd, int colorBits, int alphaBi
|
|||
return pixelFormat;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
pfnEnumWnd
|
||||
|
||||
callback to enumerate active windows
|
||||
=================
|
||||
*/
|
||||
BOOL CALLBACK pfnEnumWnd( HWND hwnd, LPARAM lParam )
|
||||
{
|
||||
string wndname;
|
||||
|
@ -860,6 +940,11 @@ BOOL CALLBACK pfnEnumWnd( HWND hwnd, LPARAM lParam )
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
VID_EnumerateInstances
|
||||
=================
|
||||
*/
|
||||
uint VID_EnumerateInstances( void )
|
||||
{
|
||||
num_instances = 0;
|
||||
|
@ -869,6 +954,11 @@ uint VID_EnumerateInstances( void )
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
VID_StartupGamma
|
||||
=================
|
||||
*/
|
||||
void VID_StartupGamma( void )
|
||||
{
|
||||
size_t gamma_size;
|
||||
|
@ -893,9 +983,6 @@ void VID_StartupGamma( void )
|
|||
return;
|
||||
}
|
||||
|
||||
// share this extension so engine can grab them
|
||||
GL_SetExtension( GL_HARDWARE_GAMMA_CONTROL, glConfig.deviceSupportsGamma );
|
||||
|
||||
savedGamma = FS_LoadFile( "gamma.dat", &gamma_size, false );
|
||||
|
||||
if( !savedGamma || gamma_size != sizeof( glState.stateRamp ))
|
||||
|
@ -962,6 +1049,11 @@ void VID_StartupGamma( void )
|
|||
vid_gamma->modified = true;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
VID_RestoreGamma
|
||||
=================
|
||||
*/
|
||||
void VID_RestoreGamma( void )
|
||||
{
|
||||
if( !glw_state.hDC || !glConfig.deviceSupportsGamma )
|
||||
|
@ -1027,12 +1119,6 @@ qboolean GL_SetPixelformat( void )
|
|||
if( PFD.dwFlags & PFD_GENERIC_ACCELERATED )
|
||||
{
|
||||
MsgDev( D_NOTE, "VID_ChoosePFD: using Generic MCD acceleration\n" );
|
||||
glw_state.software = false;
|
||||
}
|
||||
else if( gl_allow_software->integer )
|
||||
{
|
||||
MsgDev( D_NOTE, "VID_ChoosePFD: using software emulation\n" );
|
||||
glw_state.software = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1043,7 +1129,6 @@ qboolean GL_SetPixelformat( void )
|
|||
else
|
||||
{
|
||||
MsgDev( D_NOTE, "VID_ChoosePFD: using hardware acceleration\n");
|
||||
glw_state.software = false;
|
||||
}
|
||||
|
||||
glConfig.color_bits = PFD.cColorBits;
|
||||
|
@ -1061,6 +1146,11 @@ qboolean GL_SetPixelformat( void )
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_SaveVideoMode
|
||||
=================
|
||||
*/
|
||||
void R_SaveVideoMode( int vid_mode )
|
||||
{
|
||||
int mode = bound( 0, vid_mode, num_vidmodes ); // check range
|
||||
|
@ -1076,6 +1166,11 @@ void R_SaveVideoMode( int vid_mode )
|
|||
MsgDev( D_NOTE, "Set: %s [%dx%d]\n", vidmode[mode].desc, vidmode[mode].width, vidmode[mode].height );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_DescribeVIDMode
|
||||
=================
|
||||
*/
|
||||
qboolean R_DescribeVIDMode( int width, int height )
|
||||
{
|
||||
int i;
|
||||
|
@ -1093,15 +1188,20 @@ qboolean R_DescribeVIDMode( int width, int height )
|
|||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
VID_CreateWindow
|
||||
=================
|
||||
*/
|
||||
qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
|
||||
{
|
||||
WNDCLASS wc;
|
||||
RECT rect;
|
||||
int x = 0, y = 0, w, h;
|
||||
int stylebits = WINDOW_STYLE;
|
||||
int exstyle = WINDOW_EX_STYLE;
|
||||
static string wndname;
|
||||
HWND window;
|
||||
RECT rect;
|
||||
WNDCLASS wc;
|
||||
|
||||
Q_strncpy( wndname, GI->title, sizeof( wndname ));
|
||||
|
||||
|
@ -1115,22 +1215,22 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
|
|||
wc.hbrBackground = (void *)COLOR_3DSHADOW;
|
||||
wc.lpszClassName = WINDOW_NAME;
|
||||
wc.lpszMenuName = 0;
|
||||
wc.hIcon = 0;
|
||||
|
||||
// find the icon file in the filesystem
|
||||
if( FS_FileExists( GI->iconpath, true ))
|
||||
{
|
||||
char localPath[MAX_PATH];
|
||||
|
||||
if( FS_GetDiskPath( GI->iconpath, true ))
|
||||
{
|
||||
string localPath;
|
||||
Q_snprintf( localPath, sizeof( localPath ), "%s/%s", GI->gamedir, GI->iconpath );
|
||||
wc.hIcon = LoadImage( NULL, localPath, IMAGE_ICON, 0, 0, LR_LOADFROMFILE|LR_DEFAULTSIZE );
|
||||
}
|
||||
else MsgDev( D_INFO, "Extract %s from pak if you want to see it.\n", GI->iconpath );
|
||||
}
|
||||
|
||||
if( !wc.hIcon )
|
||||
{
|
||||
MsgDev( D_INFO, "Extract %s from pak if you want to see it.\n", GI->iconpath );
|
||||
wc.hIcon = LoadIcon( host.hInst, MAKEINTRESOURCE( 101 ));
|
||||
}
|
||||
}
|
||||
else wc.hIcon = LoadIcon( host.hInst, MAKEINTRESOURCE( 101 ));
|
||||
// couldn't loaded for some reasons? use default
|
||||
if( !wc.hIcon ) wc.hIcon = LoadIcon( host.hInst, MAKEINTRESOURCE( 101 ));
|
||||
|
||||
if( !RegisterClass( &wc ))
|
||||
{
|
||||
|
@ -1178,13 +1278,13 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
|
|||
|
||||
if( host.hWnd != window )
|
||||
{
|
||||
// probably never happens
|
||||
// make sure what CreateWindowEx call the IN_WndProc
|
||||
MsgDev( D_WARN, "VID_CreateWindow: bad hWnd for '%s'\n", wndname );
|
||||
}
|
||||
|
||||
// host.hWnd must be filled in IN_WndProc
|
||||
if( !host.hWnd )
|
||||
{
|
||||
// host.hWnd must be filled in IN_WndProc
|
||||
MsgDev( D_ERROR, "VID_CreateWindow: couldn't create '%s'\n", wndname );
|
||||
return false;
|
||||
}
|
||||
|
@ -1224,6 +1324,11 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
VID_DestroyWindow
|
||||
=================
|
||||
*/
|
||||
void VID_DestroyWindow( void )
|
||||
{
|
||||
if( pwglMakeCurrent )
|
||||
|
@ -1250,6 +1355,11 @@ void VID_DestroyWindow( void )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_ChangeDisplaySettings
|
||||
=================
|
||||
*/
|
||||
rserr_t R_ChangeDisplaySettings( int vid_mode, qboolean fullscreen )
|
||||
{
|
||||
int width, height;
|
||||
|
@ -1352,7 +1462,7 @@ rserr_t R_ChangeDisplaySettings( int vid_mode, qboolean fullscreen )
|
|||
return rserr_invalid_mode;
|
||||
|
||||
if( freq_specified )
|
||||
MsgDev( D_ERROR, "VID_SetMode: display frequency %i Hz not supported by your display\n", freq_specified );
|
||||
MsgDev( D_ERROR, "VID_SetMode: display frequency %i Hz is not supported\n", freq_specified );
|
||||
glState.fullScreen = true;
|
||||
return rserr_ok;
|
||||
}
|
||||
|
@ -1381,8 +1491,6 @@ qboolean VID_SetMode( void )
|
|||
qboolean fullscreen;
|
||||
rserr_t err;
|
||||
|
||||
gl_swapInterval->modified = true;
|
||||
|
||||
if( vid_mode->integer == -1 ) // trying to get resolution automatically by default
|
||||
{
|
||||
HDC hDCScreen = GetDC( NULL );
|
||||
|
@ -1404,6 +1512,7 @@ qboolean VID_SetMode( void )
|
|||
}
|
||||
|
||||
fullscreen = vid_fullscreen->integer;
|
||||
gl_swapInterval->modified = true;
|
||||
|
||||
if(( err = R_ChangeDisplaySettings( vid_mode->integer, fullscreen )) == rserr_ok )
|
||||
{
|
||||
|
@ -1455,8 +1564,8 @@ void VID_CheckChanges( void )
|
|||
{
|
||||
if( !VID_SetMode())
|
||||
{
|
||||
// can't initialize video subsystem
|
||||
Host_NewInstance( va("#%s", GI->gamefolder ), "fallback to dedicated mode\n" );
|
||||
Msg( "Error: can't initialize video subsystem\n" );
|
||||
Host_NewInstance( va("#%s", GI->gamefolder ), "stopped" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1500,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[0] ) * GL_EXTCOUNT );
|
||||
Q_memset( glConfig.extension, 0, sizeof( glConfig.extension ));
|
||||
glw_state.initialized = false;
|
||||
}
|
||||
|
||||
|
@ -1559,16 +1668,8 @@ static void GL_SetDefaults( void )
|
|||
pglPointSize( 1.2f );
|
||||
pglLineWidth( 1.2f );
|
||||
|
||||
GL_Cull( 0 );
|
||||
GL_Cull( GL_NONE );
|
||||
GL_FrontFace( 0 );
|
||||
|
||||
R_SetTextureParameters();
|
||||
|
||||
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
|
||||
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
||||
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
|
||||
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1584,7 +1685,7 @@ void R_RenderInfo_f( void )
|
|||
Msg( "GL_VERSION: %s\n", glConfig.version_string );
|
||||
|
||||
// don't spam about extensions
|
||||
if( host.developer >= 4 )
|
||||
if( host.developer >= D_REPORT )
|
||||
{
|
||||
Msg( "GL_EXTENSIONS: %s\n", glConfig.extensions_string );
|
||||
|
||||
|
@ -1596,12 +1697,12 @@ void R_RenderInfo_f( void )
|
|||
|
||||
if( GL_Support( GL_ARB_MULTITEXTURE ))
|
||||
Msg( "GL_MAX_TEXTURE_UNITS_ARB: %i\n", glConfig.max_texture_units );
|
||||
if( GL_Support( GL_TEXTURECUBEMAP_EXT ))
|
||||
if( GL_Support( GL_TEXTURE_CUBEMAP_EXT ))
|
||||
Msg( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: %i\n", glConfig.max_cubemap_size );
|
||||
if( GL_Support( GL_ANISOTROPY_EXT ))
|
||||
Msg( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: %.1f\n", glConfig.max_texture_anisotropy );
|
||||
if( glConfig.texRectangle )
|
||||
Msg( "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: %i\n", glConfig.max_2d_rectangle_size );
|
||||
if( GL_Support( GL_TEXTURE_2D_RECT_EXT ))
|
||||
Msg( "GL_MAX_RECTANGLE_TEXTURE_SIZE: %i\n", glConfig.max_2d_rectangle_size );
|
||||
if( GL_Support( GL_TEXTURE_ARRAY_EXT ))
|
||||
Msg( "GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: %i\n", glConfig.max_2d_texture_layers );
|
||||
if( GL_Support( GL_SHADER_GLSL100_EXT ))
|
||||
|
@ -1618,7 +1719,6 @@ void R_RenderInfo_f( void )
|
|||
Msg( "\n" );
|
||||
Msg( "PICMIP: %i\n", gl_picmip->integer );
|
||||
Msg( "SKYMIP: %i\n", gl_skymip->integer );
|
||||
Msg( "TEXTUREMODE: %s\n", gl_texturemode->string );
|
||||
Msg( "VERTICAL SYNC: %s\n", gl_swapInterval->integer ? "enabled" : "disabled" );
|
||||
Msg( "Color %d bits, Alpha %d bits, Depth %d bits, Stencil %d bits\n", glConfig.color_bits,
|
||||
glConfig.alpha_bits, glConfig.depth_bits, glConfig.stencil_bits );
|
||||
|
@ -1626,9 +1726,13 @@ void R_RenderInfo_f( void )
|
|||
|
||||
//=======================================================================
|
||||
|
||||
/*
|
||||
=================
|
||||
GL_InitCommands
|
||||
=================
|
||||
*/
|
||||
void GL_InitCommands( void )
|
||||
{
|
||||
Cbuf_AddText( "vidlatch\n" );
|
||||
Cbuf_Execute();
|
||||
|
||||
// system screen width and height (don't suppose for change from console at all)
|
||||
|
@ -1645,7 +1749,7 @@ void GL_InitCommands( void )
|
|||
r_novis = Cvar_Get( "r_novis", "0", 0, "ignore vis information (perfomance test)" );
|
||||
r_nocull = Cvar_Get( "r_nocull", "0", 0, "ignore frustrum culling (perfomance test)" );
|
||||
r_faceplanecull = Cvar_Get( "r_faceplanecull", "1", 0, "ignore face plane culling (perfomance test)" );
|
||||
r_detailtextures = Cvar_Get( "r_detailtextures", "1", CVAR_ARCHIVE, "enable detail textures support, use \"2\" for auto-generate mapname_detail.txt" );
|
||||
r_detailtextures = Cvar_Get( "r_detailtextures", "1", CVAR_ARCHIVE, "enable detail textures support, use '2' for autogenerate detail.txt" );
|
||||
r_lockpvs = Cvar_Get( "r_lockpvs", "0", CVAR_CHEAT, "lockpvs area at current point (pvs test)" );
|
||||
r_lockcull = Cvar_Get( "r_lockcull", "0", CVAR_CHEAT, "lock frustrum area at current point (cull test)" );
|
||||
r_dynamic = Cvar_Get( "r_dynamic", "1", CVAR_ARCHIVE, "allow dynamic lighting (dlights, lightstyles)" );
|
||||
|
@ -1661,9 +1765,8 @@ void GL_InitCommands( void )
|
|||
gl_picmip = Cvar_Get( "gl_picmip", "0", CVAR_GLCONFIG, "reduces resolution of textures by powers of 2" );
|
||||
gl_skymip = Cvar_Get( "gl_skymip", "0", CVAR_GLCONFIG, "reduces resolution of skybox textures by powers of 2" );
|
||||
gl_ignorehwgamma = Cvar_Get( "gl_ignorehwgamma", "0", CVAR_GLCONFIG, "ignore hardware gamma" );
|
||||
gl_allow_software = Cvar_Get( "gl_allow_software", "0", CVAR_ARCHIVE, "allow OpenGL software emulation" );
|
||||
gl_alphabits = Cvar_Get( "gl_alphabits", "8", CVAR_GLCONFIG, "pixelformat alpha bits (0 - auto)" );
|
||||
gl_texturemode = Cvar_Get( "gl_texturemode", "GL_LINEAR_MIPMAP_LINEAR", CVAR_ARCHIVE, "texture filter" );
|
||||
gl_texture_nearest = Cvar_Get( "gl_texture_nearest", "0", CVAR_ARCHIVE, "disable texture filter" );
|
||||
gl_round_down = Cvar_Get( "gl_round_down", "0", CVAR_GLCONFIG, "down size non-power of two textures" );
|
||||
gl_max_size = Cvar_Get( "gl_max_size", "512", CVAR_ARCHIVE, "no effect in Xash3D just a legacy" );
|
||||
gl_stencilbits = Cvar_Get( "gl_stencilbits", "8", CVAR_GLCONFIG, "pixelformat stencil bits (0 - auto)" );
|
||||
|
@ -1672,19 +1775,18 @@ void GL_InitCommands( void )
|
|||
gl_extensions = Cvar_Get( "gl_extensions", "1", CVAR_GLCONFIG, "allow gl_extensions" );
|
||||
gl_detailscale = Cvar_Get( "gl_detailscale", "4.0", CVAR_ARCHIVE, "default scale applies while auto-generate list of detail textures" );
|
||||
gl_texture_anisotropy = Cvar_Get( "gl_anisotropy", "2.0", CVAR_ARCHIVE, "textures anisotropic filter" );
|
||||
gl_texture_lodbias = Cvar_Get( "gl_texture_lodbias", "0.0", CVAR_ARCHIVE, "LOD bias for mipmapped textures" );
|
||||
gl_texture_lodbias = Cvar_Get( "gl_texture_lodbias", "0.0", CVAR_ARCHIVE, "LOD bias for mipmapped textures (prefomance|quality)" );
|
||||
gl_compress_textures = Cvar_Get( "gl_compress_textures", "0", CVAR_GLCONFIG, "compress textures to safe video memory" );
|
||||
gl_luminance_textures = Cvar_Get( "gl_luminance_textures", "0", CVAR_GLCONFIG, "force all textures to luminance" );
|
||||
gl_compensate_gamma_screenshots = Cvar_Get( "gl_compensate_gamma_screenshots", "0", CVAR_ARCHIVE, "allow to apply gamma value for screenshots and snapshots" );
|
||||
gl_keeptjunctions = Cvar_Get( "gl_keeptjunctions", "1", CVAR_ARCHIVE, "disable to reduce vertexes count but removing tjuncs causes blinking pixels" );
|
||||
gl_compensate_gamma_screenshots = Cvar_Get( "gl_compensate_gamma_screenshots", "0", CVAR_ARCHIVE, "allow to apply gamma for screenshots" );
|
||||
gl_keeptjunctions = Cvar_Get( "gl_keeptjunctions", "1", CVAR_ARCHIVE, "but removing tjuncs causes blinking pixels" );
|
||||
gl_allow_static = Cvar_Get( "gl_allow_static", "0", CVAR_ARCHIVE, "force to drawing non-moveable brushes as part of world (save FPS)" );
|
||||
gl_allow_mirrors = Cvar_Get( "gl_allow_mirrors", "1", CVAR_ARCHIVE, "allow to draw mirror surfaces" );
|
||||
gl_showtextures = Cvar_Get( "r_showtextures", "0", CVAR_CHEAT, "show all uploaded textures (type values from 1 to 13)" );
|
||||
gl_showtextures = Cvar_Get( "r_showtextures", "0", CVAR_CHEAT, "show all uploaded textures" );
|
||||
gl_finish = Cvar_Get( "gl_finish", "0", CVAR_ARCHIVE, "use glFinish instead of glFlush" );
|
||||
gl_nosort = Cvar_Get( "gl_nosort", "0", CVAR_ARCHIVE, "disable sorting of translucent surfaces" );
|
||||
gl_clear = Cvar_Get( "gl_clear", "0", CVAR_ARCHIVE, "clearing screen after each frame" );
|
||||
gl_test = Cvar_Get( "gl_test", "0", 0, "engine developer cvar for quick testing new features" );
|
||||
gl_wireframe = Cvar_Get( "gl_wireframe", "0", 0, "show wireframe overlay" );
|
||||
gl_wireframe = Cvar_Get( "gl_wireframe", "0", CVAR_ARCHIVE, "show wireframe overlay" );
|
||||
gl_overview = Cvar_Get( "dev_overview", "0", 0, "show level overview" );
|
||||
|
||||
// these cvar not used by engine but some mods requires this
|
||||
|
@ -1699,15 +1801,23 @@ void GL_InitCommands( void )
|
|||
vid_displayfrequency = Cvar_Get ( "vid_displayfrequency", "0", CVAR_RENDERINFO, "fullscreen refresh rate" );
|
||||
|
||||
Cmd_AddCommand( "r_info", R_RenderInfo_f, "display renderer info" );
|
||||
Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
GL_RemoveCommands
|
||||
=================
|
||||
*/
|
||||
void GL_RemoveCommands( void )
|
||||
{
|
||||
Cmd_RemoveCommand( "r_info");
|
||||
Cmd_RemoveCommand( "texturelist" );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
GL_InitExtensions
|
||||
=================
|
||||
*/
|
||||
void GL_InitExtensions( void )
|
||||
{
|
||||
// initialize gl extensions
|
||||
|
@ -1720,8 +1830,22 @@ void GL_InitExtensions( void )
|
|||
glConfig.extensions_string = pglGetString( GL_EXTENSIONS );
|
||||
MsgDev( D_INFO, "Video: %s\n", glConfig.renderer_string );
|
||||
|
||||
if( Q_stristr( glConfig.renderer_string, "geforce" ))
|
||||
glConfig.hardware_type = GLHW_NVIDIA;
|
||||
else if( Q_stristr( glConfig.renderer_string, "quadro fx" ))
|
||||
glConfig.hardware_type = GLHW_NVIDIA;
|
||||
else if( Q_stristr(glConfig.renderer_string, "rv770" ))
|
||||
glConfig.hardware_type = GLHW_RADEON;
|
||||
else if( Q_stristr(glConfig.renderer_string, "radeon hd" ))
|
||||
glConfig.hardware_type = GLHW_RADEON;
|
||||
else if( Q_stristr( glConfig.renderer_string, "eah4850" ) || Q_stristr( glConfig.renderer_string, "eah4870" ))
|
||||
glConfig.hardware_type = GLHW_RADEON;
|
||||
else if( Q_stristr( glConfig.renderer_string, "radeon" ))
|
||||
glConfig.hardware_type = GLHW_RADEON;
|
||||
else glConfig.hardware_type = GLHW_GENERIC;
|
||||
|
||||
// initalize until base opengl functions loaded (old-context)
|
||||
if( !Sys_CheckParm( "-gldebug" ) || host.developer < 1 )
|
||||
if( !Sys_CheckParm( "-gldebug" ) || host.developer < D_INFO )
|
||||
GL_CheckExtension( "OpenGL Internal ProcAddress", wglproc_funcs, NULL, GL_WGL_PROCADDRESS );
|
||||
|
||||
// windows-specific extensions
|
||||
|
@ -1739,26 +1863,15 @@ void GL_InitExtensions( void )
|
|||
if( !GL_Support( GL_DRAW_RANGEELEMENTS_EXT ))
|
||||
GL_CheckExtension( "GL_EXT_draw_range_elements", drawrangeelementsextfuncs, "gl_drawrangeelments", GL_DRAW_RANGEELEMENTS_EXT );
|
||||
|
||||
// we don't care if it's an extension or not, they are identical functions, so keep it simple in the rendering code
|
||||
if( pglDrawRangeElementsEXT == NULL ) pglDrawRangeElementsEXT = pglDrawRangeElements;
|
||||
|
||||
// multitexture
|
||||
glConfig.max_texture_units = glConfig.max_texture_coords = glConfig.max_teximage_units = 1;
|
||||
GL_CheckExtension( "GL_ARB_multitexture", multitexturefuncs, "gl_arb_multitexture", GL_ARB_MULTITEXTURE );
|
||||
|
||||
if( GL_Support( GL_ARB_MULTITEXTURE ))
|
||||
{
|
||||
pglGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, &glConfig.max_texture_units );
|
||||
GL_CheckExtension( "GL_ARB_texture_env_combine", NULL, "gl_texture_env_combine", GL_ENV_COMBINE_EXT );
|
||||
|
||||
if( !GL_Support( GL_ENV_COMBINE_EXT ))
|
||||
GL_CheckExtension( "GL_EXT_texture_env_combine", NULL, "gl_texture_env_combine", GL_ENV_COMBINE_EXT );
|
||||
|
||||
if( GL_Support( GL_ENV_COMBINE_EXT ))
|
||||
GL_CheckExtension( "GL_ARB_texture_env_dot3", NULL, "gl_texture_env_dot3", GL_DOT3_ARB_EXT );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_CheckExtension( "GL_SGIS_multitexture", sgis_multitexturefuncs, "gl_sgis_multitexture", GL_ARB_MULTITEXTURE );
|
||||
if( GL_Support( GL_ARB_MULTITEXTURE )) glConfig.max_texture_units = 2;
|
||||
}
|
||||
|
||||
if( glConfig.max_texture_units == 1 )
|
||||
GL_SetExtension( GL_ARB_MULTITEXTURE, false );
|
||||
|
@ -1783,12 +1896,12 @@ void GL_InitExtensions( void )
|
|||
if( GL_Support( GL_TEXTURE_ARRAY_EXT ))
|
||||
pglGetIntegerv( GL_MAX_ARRAY_TEXTURE_LAYERS_EXT, &glConfig.max_2d_texture_layers );
|
||||
|
||||
GL_CheckExtension( "GL_SGIS_generate_mipmap", NULL, "gl_sgis_generate_mipmaps", GL_SGIS_MIPMAPS_EXT );
|
||||
|
||||
// hardware cubemaps
|
||||
GL_CheckExtension( "GL_ARB_texture_cube_map", NULL, "gl_texture_cubemap", GL_TEXTURECUBEMAP_EXT );
|
||||
GL_CheckExtension( "GL_ARB_texture_cube_map", NULL, "gl_texture_cubemap", GL_TEXTURE_CUBEMAP_EXT );
|
||||
|
||||
if( GL_Support( GL_TEXTURECUBEMAP_EXT ))
|
||||
GL_CheckExtension( "GL_ARB_draw_buffers", drawbuffersfuncs, "gl_draw_buffers", GL_DRAW_BUFFERS_EXT );
|
||||
|
||||
if( GL_Support( GL_TEXTURE_CUBEMAP_EXT ))
|
||||
{
|
||||
pglGetIntegerv( GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, &glConfig.max_cubemap_size );
|
||||
|
||||
|
@ -1796,15 +1909,8 @@ void GL_InitExtensions( void )
|
|||
GL_CheckExtension( "GL_ARB_seamless_cube_map", NULL, "gl_seamless_cubemap", GL_ARB_SEAMLESS_CUBEMAP );
|
||||
}
|
||||
|
||||
// point particles extension
|
||||
GL_CheckExtension( "GL_EXT_point_parameters", pointparametersfunc, NULL, GL_EXT_POINTPARAMETERS );
|
||||
|
||||
GL_CheckExtension( "GL_ARB_texture_non_power_of_two", NULL, "gl_texture_npot", GL_ARB_TEXTURE_NPOT_EXT );
|
||||
GL_CheckExtension( "GL_ARB_texture_compression", texturecompressionfuncs, "gl_dds_hardware_support", GL_TEXTURE_COMPRESSION_EXT );
|
||||
GL_CheckExtension( "GL_EXT_compiled_vertex_array", compiledvertexarrayfuncs, "gl_cva_support", GL_CUSTOM_VERTEX_ARRAY_EXT );
|
||||
|
||||
if( !GL_Support( GL_CUSTOM_VERTEX_ARRAY_EXT ))
|
||||
GL_CheckExtension( "GL_SGI_compiled_vertex_array", compiledvertexarrayfuncs, "gl_cva_support", GL_CUSTOM_VERTEX_ARRAY_EXT );
|
||||
|
||||
GL_CheckExtension( "GL_EXT_texture_edge_clamp", NULL, "gl_clamp_to_edge", GL_CLAMPTOEDGE_EXT );
|
||||
|
||||
|
@ -1817,39 +1923,38 @@ void GL_InitExtensions( void )
|
|||
if( GL_Support( GL_ANISOTROPY_EXT ))
|
||||
pglGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.max_texture_anisotropy );
|
||||
|
||||
GL_CheckExtension( "GL_EXT_texture_lod_bias", NULL, "gl_ext_texture_lodbias", GL_TEXTURE_LODBIAS );
|
||||
if( GL_Support( GL_TEXTURE_LODBIAS ))
|
||||
pglGetFloatv( GL_MAX_TEXTURE_LOD_BIAS_EXT, &glConfig.max_texture_lodbias );
|
||||
GL_CheckExtension( "GL_EXT_texture_lod_bias", NULL, "gl_ext_texture_lod_bias", GL_TEXTURE_LOD_BIAS );
|
||||
|
||||
if( GL_Support( GL_TEXTURE_LOD_BIAS ))
|
||||
pglGetFloatv( GL_MAX_TEXTURE_LOD_BIAS_EXT, &glConfig.max_texture_lod_bias );
|
||||
|
||||
GL_CheckExtension( "GL_ARB_texture_border_clamp", NULL, "gl_ext_texborder_clamp", GL_CLAMP_TEXBORDER_EXT );
|
||||
|
||||
GL_CheckExtension( "GL_EXT_blend_minmax", blendequationfuncs, "gl_ext_customblend", GL_BLEND_MINMAX_EXT );
|
||||
GL_CheckExtension( "GL_EXT_blend_subtract", blendequationfuncs, "gl_ext_customblend", GL_BLEND_SUBTRACT_EXT );
|
||||
|
||||
GL_CheckExtension( "glStencilOpSeparate", gl2separatestencilfuncs, "gl_separate_stencil", GL_SEPARATESTENCIL_EXT );
|
||||
|
||||
if( !GL_Support( GL_SEPARATESTENCIL_EXT ))
|
||||
GL_CheckExtension("GL_ATI_separate_stencil", atiseparatestencilfuncs, "gl_separate_stencil", GL_SEPARATESTENCIL_EXT );
|
||||
|
||||
GL_CheckExtension( "GL_EXT_stencil_two_side", stenciltwosidefuncs, "gl_stenciltwoside", GL_STENCILTWOSIDE_EXT );
|
||||
GL_CheckExtension( "GL_ARB_vertex_buffer_object", vbofuncs, "gl_vertex_buffer_object", GL_ARB_VERTEX_BUFFER_OBJECT_EXT );
|
||||
|
||||
// we don't care if it's an extension or not, they are identical functions, so keep it simple in the rendering code
|
||||
if( pglDrawRangeElementsEXT == NULL ) pglDrawRangeElementsEXT = pglDrawRangeElements;
|
||||
|
||||
GL_CheckExtension( "GL_ARB_texture_env_add", NULL, "gl_texture_env_add", GL_TEXTURE_ENV_ADD_EXT );
|
||||
GL_CheckExtension( "GL_ARB_vertex_array_object", vaofuncs, "gl_vertex_array_object", GL_ARB_VERTEX_ARRAY_OBJECT_EXT );
|
||||
GL_CheckExtension( "GL_ARB_half_float_pixel", NULL, "gl_half_float", GL_ARB_HALF_FLOAT_EXT );
|
||||
|
||||
// vp and fp shaders
|
||||
GL_CheckExtension( "GL_ARB_shader_objects", shaderobjectsfuncs, "gl_shaderobjects", GL_SHADER_OBJECTS_EXT );
|
||||
GL_CheckExtension( "GL_ARB_shading_language_100", NULL, "gl_glslprogram", GL_SHADER_GLSL100_EXT );
|
||||
GL_CheckExtension( "GL_ARB_vertex_shader", vertexshaderfuncs, "gl_vertexshader", GL_VERTEX_SHADER_EXT );
|
||||
GL_CheckExtension( "GL_ARB_fragment_shader", NULL, "gl_pixelshader", GL_FRAGMENT_SHADER_EXT );
|
||||
GL_CheckExtension( "GL_ARB_shading_language_100", NULL, "gl_shading_language", GL_SHADER_GLSL100_EXT );
|
||||
|
||||
GL_CheckExtension( "GL_ARB_depth_texture", NULL, "gl_depthtexture", GL_DEPTH_TEXTURE );
|
||||
GL_CheckExtension( "GL_ARB_shadow", NULL, "gl_arb_shadow", GL_SHADOW_EXT );
|
||||
|
||||
GL_CheckExtension( "GL_ARB_texture_float", NULL, "gl_arb_texture_float", GL_ARB_TEXTURE_FLOAT_EXT );
|
||||
GL_CheckExtension( "GL_ARB_depth_buffer_float", NULL, "gl_arb_depth_float", GL_ARB_DEPTH_FLOAT_EXT );
|
||||
GL_CheckExtension( "GL_ARB_texture_rg", NULL, "gl_arb_texture_rg", GL_ARB_TEXTURE_RG );
|
||||
GL_CheckExtension( "GL_EXT_gpu_shader4", NULL, "gl_ext_gpu_shader4", GL_EXT_GPU_SHADER4 );
|
||||
|
||||
// this won't work without extended context
|
||||
if( glw_state.extended )
|
||||
GL_CheckExtension( "GL_ARB_debug_output", debugoutputfuncs, "gl_debug_output", GL_DEBUG_OUTPUT );
|
||||
|
||||
// FBO support
|
||||
GL_CheckExtension( "GL_ARB_framebuffer_object", arbfbofuncs, "gl_framebuffer_object", GL_FRAMEBUFFER_OBJECT );
|
||||
|
||||
if( !GL_Support( GL_FRAMEBUFFER_OBJECT ))
|
||||
GL_CheckExtension( "GL_EXT_framebuffer_object", extfbofuncs, "gl_framebuffer_object", GL_FRAMEBUFFER_OBJECT );
|
||||
|
||||
// occlusion queries
|
||||
GL_CheckExtension( "GL_ARB_occlusion_query", occlusionfunc, "gl_occlusion_queries", GL_OCCLUSION_QUERIES_EXT );
|
||||
|
@ -1857,13 +1962,17 @@ void GL_InitExtensions( void )
|
|||
// rectangle textures support
|
||||
GL_CheckExtension( "GL_ARB_texture_rectangle", NULL, "gl_texture_rectangle", GL_TEXTURE_2D_RECT_EXT );
|
||||
|
||||
// shadow cubeMaps required this
|
||||
GL_CheckExtension( "GL_EXT_gpu_shader4", NULL, "gl_ext_gpu_shader4", GL_GPU_SHADER4_EXT );
|
||||
|
||||
if( GL_Support( GL_SHADER_GLSL100_EXT ))
|
||||
{
|
||||
pglGetIntegerv( GL_MAX_TEXTURE_COORDS_ARB, &glConfig.max_texture_coords );
|
||||
pglGetIntegerv( GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &glConfig.max_teximage_units );
|
||||
|
||||
// check for hardware skinning
|
||||
pglGetIntegerv( GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &glConfig.max_vertex_uniforms );
|
||||
pglGetIntegerv( GL_MAX_VERTEX_ATTRIBS_ARB, &glConfig.max_vertex_attribs );
|
||||
|
||||
if( glConfig.hardware_type == GLHW_RADEON )
|
||||
glConfig.max_vertex_uniforms /= 4; // radeon returns not correct info
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1871,42 +1980,41 @@ void GL_InitExtensions( void )
|
|||
glConfig.max_texture_coords = glConfig.max_teximage_units = glConfig.max_texture_units;
|
||||
}
|
||||
|
||||
// rectangle textures support
|
||||
if( Q_strstr( glConfig.extensions_string, "GL_NV_texture_rectangle" ))
|
||||
{
|
||||
glConfig.texRectangle = GL_TEXTURE_RECTANGLE_NV;
|
||||
pglGetIntegerv( GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, &glConfig.max_2d_rectangle_size );
|
||||
}
|
||||
else if( Q_strstr( glConfig.extensions_string, "GL_EXT_texture_rectangle" ))
|
||||
{
|
||||
glConfig.texRectangle = GL_TEXTURE_RECTANGLE_EXT;
|
||||
pglGetIntegerv( GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT, &glConfig.max_2d_rectangle_size );
|
||||
}
|
||||
else glConfig.texRectangle = glConfig.max_2d_rectangle_size = 0; // no rectangle
|
||||
|
||||
glConfig.max_2d_texture_size = 0;
|
||||
pglGetIntegerv( GL_MAX_TEXTURE_SIZE, &glConfig.max_2d_texture_size );
|
||||
if( glConfig.max_2d_texture_size <= 0 ) glConfig.max_2d_texture_size = 256;
|
||||
|
||||
pglGetIntegerv( GL_MAX_DRAW_BUFFERS_ARB, &glConfig.max_draw_buffers );
|
||||
|
||||
if( GL_Support( GL_TEXTURE_2D_RECT_EXT ))
|
||||
pglGetIntegerv( GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT, &glConfig.max_2d_rectangle_size );
|
||||
|
||||
Cvar_Get( "gl_max_texture_size", "0", CVAR_INIT, "opengl texture max dims" );
|
||||
Cvar_Set( "gl_max_texture_size", va( "%i", glConfig.max_2d_texture_size ));
|
||||
|
||||
pglGetIntegerv( GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &glConfig.max_vertex_uniforms );
|
||||
pglGetIntegerv( GL_MAX_VERTEX_ATTRIBS_ARB, &glConfig.max_vertex_attribs );
|
||||
|
||||
// MCD has buffering issues
|
||||
if(Q_strstr( glConfig.renderer_string, "gdi" ))
|
||||
if( Q_stristr( glConfig.renderer_string, "gdi" ))
|
||||
Cvar_SetFloat( "gl_finish", 1 );
|
||||
|
||||
Cvar_Set( "gl_anisotropy", va( "%f", bound( 0, gl_texture_anisotropy->value, glConfig.max_texture_anisotropy )));
|
||||
|
||||
// software mipmap generator does wrong result with NPOT textures ...
|
||||
if( !GL_Support( GL_SGIS_MIPMAPS_EXT ))
|
||||
GL_SetExtension( GL_ARB_TEXTURE_NPOT_EXT, false );
|
||||
|
||||
if( GL_Support( GL_TEXTURE_COMPRESSION_EXT ))
|
||||
Image_AddCmdFlags( IL_DDS_HARDWARE );
|
||||
|
||||
// enable gldebug if allowed
|
||||
if( GL_Support( GL_DEBUG_OUTPUT ))
|
||||
{
|
||||
if( host.developer >= D_ERROR )
|
||||
pglDebugMessageCallbackARB( GL_DebugOutput, NULL );
|
||||
|
||||
// force everything to happen in the main thread instead of in a separate driver thread
|
||||
if( host.developer >= D_WARN )
|
||||
pglEnable( GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB );
|
||||
|
||||
// enable all the low priority messages
|
||||
if( host.developer >= D_REPORT )
|
||||
pglDebugMessageControlARB( GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, true );
|
||||
}
|
||||
|
||||
glw_state.initialized = true;
|
||||
|
||||
tr.framecount = tr.visframecount = 1;
|
||||
|
@ -1934,8 +2042,8 @@ qboolean R_Init( void )
|
|||
GL_RemoveCommands();
|
||||
R_Free_OpenGL();
|
||||
|
||||
// can't initialize video subsystem
|
||||
Host_NewInstance( va("#%s", GI->gamefolder ), "fallback to dedicated mode\n" );
|
||||
Msg( "^1Error:^7 can't initialize video subsystem\n" );
|
||||
Host_NewInstance( va( "#%s", GI->gamefolder ), "stopped" );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2026,5 +2134,5 @@ void GL_CheckForErrors_( const char *filename, const int fileline )
|
|||
break;
|
||||
}
|
||||
|
||||
Host_Error( "GL_CheckForErrors: %s (called at %s:%i)\n", str, filename, fileline );
|
||||
MsgDev( D_ERROR, "OpenGL: %s (called at %s:%i)\n", str, filename, fileline );
|
||||
}
|
|
@ -381,19 +381,19 @@ void VOX_LoadWord( channel_t *pchan )
|
|||
void VOX_FreeWord( channel_t *pchan )
|
||||
{
|
||||
pchan->currentWord = NULL; // sentence is finished
|
||||
Q_memset( &pchan->pMixer, 0, sizeof( pchan->pMixer ));
|
||||
memset( &pchan->pMixer, 0, sizeof( pchan->pMixer ));
|
||||
|
||||
#if 0 // release unused sounds ?
|
||||
// release unused sounds
|
||||
if( pchan->words[pchan->wordIndex].sfx )
|
||||
{
|
||||
// If this wave wasn't precached by the game code
|
||||
if( !pchan->words[pchan->wordIndex].fKeepCached )
|
||||
{
|
||||
S_FreeSound( pchan->words[pchan->wordIndex].sfx );
|
||||
FS_FreeSound( pchan->words[pchan->wordIndex].sfx->cache );
|
||||
pchan->words[pchan->wordIndex].sfx->cache = NULL;
|
||||
pchan->words[pchan->wordIndex].sfx = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void VOX_LoadFirstWord( channel_t *pchan, voxword_t *pwords )
|
||||
|
|
|
@ -382,7 +382,7 @@ qboolean AVI_SeekPosition( movie_state_t *Avi, dword offset )
|
|||
}
|
||||
|
||||
// get a chunk of audio from the stream (in bytes)
|
||||
fs_offset_t AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long length )
|
||||
long AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long length )
|
||||
{
|
||||
int i;
|
||||
long result = 0;
|
||||
|
|
|
@ -776,7 +776,7 @@ void Cmd_ForwardToServer( void )
|
|||
return; // not connected
|
||||
}
|
||||
|
||||
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
MSG_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
|
||||
str[0] = 0;
|
||||
if( Q_stricmp( Cmd_Argv( 0 ), "cmd" ))
|
||||
|
@ -789,7 +789,7 @@ void Cmd_ForwardToServer( void )
|
|||
Q_strcat( str, Cmd_Args( ));
|
||||
else Q_strcat( str, "\n" );
|
||||
|
||||
BF_WriteString( &cls.netchan.message, str );
|
||||
MSG_WriteString( &cls.netchan.message, str );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -41,6 +41,9 @@ extern "C" {
|
|||
#define BIT( n ) (1<<( n ))
|
||||
#define GAMMA ( 2.2 ) // Valve Software gamma
|
||||
#define INVGAMMA ( 1.0 / 2.2 ) // back to 1.0
|
||||
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
||||
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
||||
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
||||
|
||||
#ifndef __cplusplus
|
||||
#define NULL ((void *)0)
|
||||
|
@ -55,7 +58,6 @@ extern "C" {
|
|||
typedef unsigned long dword;
|
||||
typedef unsigned int uint;
|
||||
typedef char string[MAX_STRING];
|
||||
typedef long fs_offset_t;
|
||||
typedef struct file_s file_t; // normal file
|
||||
typedef struct wfile_s wfile_t; // wad file
|
||||
typedef struct stream_s stream_t; // sound stream for background music playing
|
||||
|
@ -72,7 +74,7 @@ enum
|
|||
D_INFO = 1, // "-dev 1", shows various system messages
|
||||
D_WARN, // "-dev 2", shows not critical system warnings
|
||||
D_ERROR, // "-dev 3", shows critical warnings
|
||||
D_AICONSOLE, // "-dev 4", special case for game aiconsole
|
||||
D_REPORT, // "-dev 4", special case for game reports
|
||||
D_NOTE // "-dev 5", show system notifications for engine developers
|
||||
};
|
||||
|
||||
|
@ -90,12 +92,18 @@ typedef enum
|
|||
#define XASH_VERSION 0.98f // engine current version
|
||||
|
||||
// PERFORMANCE INFO
|
||||
#define MIN_FPS 15.0 // host minimum fps value for maxfps.
|
||||
#define MIN_FPS 20.0 // host minimum fps value for maxfps.
|
||||
#define MAX_FPS 500.0 // upper limit for maxfps.
|
||||
|
||||
#define MAX_FRAMETIME 0.1
|
||||
#define MIN_FRAMETIME 0.000001
|
||||
|
||||
// HOST_FIXED_FRAMERATE stuff
|
||||
#define HOST_MINFPS 20.0
|
||||
#define HOST_MAXFPS 72.0
|
||||
#define HOST_FPS 60.0 // client and the server clamped at 60.0 fps max. Render clamped at fps_max cvar
|
||||
#define HOST_FRAMETIME ( 1.0 / HOST_FPS )
|
||||
|
||||
#define MAX_CMD_TOKENS 80 // cmd tokens
|
||||
#define MAX_ENTNUMBER 99999 // for server and client parsing
|
||||
#define MAX_HEARTBEAT -99999 // connection time
|
||||
|
@ -340,9 +348,6 @@ typedef struct host_parm_s
|
|||
|
||||
struct decallist_s *decalList; // used for keep decals, when renderer is restarted or changed
|
||||
int numdecals;
|
||||
|
||||
soundlist_t *soundList; // used for keep ambient sounds, when renderer or sound is restarted
|
||||
int numsounds;
|
||||
} host_parm_t;
|
||||
|
||||
extern host_parm_t host;
|
||||
|
@ -369,23 +374,23 @@ const char *FS_FileWithoutPath( const char *in );
|
|||
wfile_t *W_Open( const char *filename, const char *mode );
|
||||
byte *W_LoadLump( wfile_t *wad, const char *lumpname, size_t *lumpsizeptr, const char type );
|
||||
void W_Close( wfile_t *wad );
|
||||
file_t *FS_OpenFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
|
||||
byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
|
||||
qboolean FS_WriteFile( const char *filename, const void *data, fs_offset_t len );
|
||||
file_t *FS_OpenFile( const char *path, long *filesizeptr, qboolean gamedironly );
|
||||
byte *FS_LoadFile( const char *path, long *filesizeptr, qboolean gamedironly );
|
||||
qboolean FS_WriteFile( const char *filename, const void *data, long len );
|
||||
int COM_FileSize( const char *filename );
|
||||
void COM_FixSlashes( char *pname );
|
||||
void COM_FreeFile( void *buffer );
|
||||
int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare );
|
||||
search_t *FS_Search( const char *pattern, int caseinsensitive, int gamedironly );
|
||||
file_t *FS_Open( const char *filepath, const char *mode, qboolean gamedironly );
|
||||
fs_offset_t FS_Write( file_t *file, const void *data, size_t datasize );
|
||||
fs_offset_t FS_Read( file_t *file, void *buffer, size_t buffersize );
|
||||
long FS_Write( file_t *file, const void *data, size_t datasize );
|
||||
long FS_Read( file_t *file, void *buffer, size_t buffersize );
|
||||
int FS_VPrintf( file_t *file, const char *format, va_list ap );
|
||||
int FS_Seek( file_t *file, fs_offset_t offset, int whence );
|
||||
int FS_Seek( file_t *file, long offset, int whence );
|
||||
int FS_Gets( file_t *file, byte *string, size_t bufsize );
|
||||
int FS_Printf( file_t *file, const char *format, ... );
|
||||
fs_offset_t FS_FileSize( const char *filename, qboolean gamedironly );
|
||||
fs_offset_t FS_FileTime( const char *filename, qboolean gamedironly );
|
||||
long FS_FileSize( const char *filename, qboolean gamedironly );
|
||||
long FS_FileTime( const char *filename, qboolean gamedironly );
|
||||
int FS_Print( file_t *file, const char *msg );
|
||||
qboolean FS_Rename( const char *oldname, const char *newname );
|
||||
qboolean FS_FileExists( const char *filename, qboolean gamedironly );
|
||||
|
@ -393,13 +398,13 @@ void FS_FileCopy( file_t *pOutput, file_t *pInput, int fileSize );
|
|||
qboolean FS_Delete( const char *path );
|
||||
int FS_UnGetc( file_t *file, byte c );
|
||||
void FS_StripExtension( char *path );
|
||||
fs_offset_t FS_Tell( file_t *file );
|
||||
long FS_Tell( file_t *file );
|
||||
qboolean FS_Eof( file_t *file );
|
||||
void FS_Purge( file_t *file );
|
||||
int FS_Close( file_t *file );
|
||||
int FS_Getc( file_t *file );
|
||||
qboolean FS_Eof( file_t *file );
|
||||
fs_offset_t FS_FileLength( file_t *f );
|
||||
long FS_FileLength( file_t *f );
|
||||
|
||||
//
|
||||
// network.c
|
||||
|
@ -777,7 +782,7 @@ long AVI_GetVideoFrameNumber( movie_state_t *Avi, float time );
|
|||
byte *AVI_GetVideoFrame( movie_state_t *Avi, long frame );
|
||||
qboolean AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *duration );
|
||||
qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info );
|
||||
fs_offset_t AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long length );
|
||||
long AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long length );
|
||||
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, qboolean ignore_hwgamma, int quiet );
|
||||
movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio, qboolean ignore_hwgamma );
|
||||
movie_state_t *AVI_LoadVideoNoSound( const char *filename, qboolean ignore_hwgamma );
|
||||
|
@ -807,7 +812,7 @@ void COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appNam
|
|||
int COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize );
|
||||
struct pmtrace_s *PM_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
|
||||
void SV_StartMusic( const char *curtrack, const char *looptrack, fs_offset_t position );
|
||||
void SV_StartMusic( const char *curtrack, const char *looptrack, long position );
|
||||
void SV_CreateDecal( struct sizebuf_s *msg, const float *origin, int decalIndex, int entityIndex, int modelIndex, int flags, float scale );
|
||||
void SV_CreateStudioDecal( struct sizebuf_s *msg, const float *origin, const float *start, int decalIndex, int entityIndex, int modelIndex,
|
||||
int flags, struct modelstate_s *state );
|
||||
|
|
|
@ -561,61 +561,6 @@ qboolean Cmd_GetCustomList( const char *s, char *completedname, int length )
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================================
|
||||
Cmd_GetTexturemodes
|
||||
|
||||
Prints or complete sound filename
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetTextureModes( const char *s, char *completedname, int length )
|
||||
{
|
||||
int i, numtexturemodes;
|
||||
string texturemodes[6]; // keep an actual ( sizeof( gl_texturemode) / sizeof( gl_texturemode[0] ))
|
||||
string matchbuf;
|
||||
|
||||
const char *gl_texturemode[] =
|
||||
{
|
||||
"GL_LINEAR",
|
||||
"GL_LINEAR_MIPMAP_LINEAR",
|
||||
"GL_LINEAR_MIPMAP_NEAREST",
|
||||
"GL_NEAREST",
|
||||
"GL_NEAREST_MIPMAP_LINEAR",
|
||||
"GL_NEAREST_MIPMAP_NEAREST",
|
||||
};
|
||||
|
||||
// compare texture filtering mode list with current keyword
|
||||
for( i = 0, numtexturemodes = 0; i < 6; i++ )
|
||||
{
|
||||
if(( *s == '*' ) || !Q_strnicmp( gl_texturemode[i], s, Q_strlen( s )))
|
||||
Q_strcpy( texturemodes[numtexturemodes++], gl_texturemode[i] );
|
||||
}
|
||||
|
||||
if( !numtexturemodes ) return false;
|
||||
Q_strncpy( matchbuf, texturemodes[0], MAX_STRING );
|
||||
if( completedname && length ) Q_strncpy( completedname, matchbuf, length );
|
||||
if( numtexturemodes == 1 ) return true;
|
||||
|
||||
for( i = 0; i < numtexturemodes; i++ )
|
||||
{
|
||||
Q_strncpy( matchbuf, texturemodes[i], MAX_STRING );
|
||||
Msg( "%16s\n", matchbuf );
|
||||
}
|
||||
|
||||
Msg( "\n^3 %i filters found.\n", numtexturemodes );
|
||||
|
||||
// cut shortestMatch to the amount common with s
|
||||
if( completedname && length )
|
||||
{
|
||||
for( i = 0; matchbuf[i]; i++ )
|
||||
{
|
||||
if( Q_tolower( completedname[i] ) != Q_tolower( matchbuf[i] ))
|
||||
completedname[i] = 0;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================================
|
||||
Cmd_GetGameList
|
||||
|
@ -872,7 +817,6 @@ qboolean Cmd_CheckMapsList( qboolean fRefresh )
|
|||
|
||||
autocomplete_list_t cmd_list[] =
|
||||
{
|
||||
{ "gl_texturemode", Cmd_GetTextureModes },
|
||||
{ "map_background", Cmd_GetMapList },
|
||||
{ "changelevel", Cmd_GetMapList },
|
||||
{ "playdemo", Cmd_GetDemoList, },
|
||||
|
|
|
@ -63,25 +63,25 @@ typedef struct convar_s
|
|||
// cvar flags
|
||||
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_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.
|
||||
CVAR_PRINTABLEONLY = BIT(7), // this cvar's string cannot contain unprintable characters ( player name )
|
||||
CVAR_UNLOGGED = BIT(8), // if this is a FCVAR_SERVER, don't log changes to the log file / console
|
||||
CVAR_SERVERINFO = BIT(9), // added to serverinfo when changed
|
||||
CVAR_PHYSICINFO = BIT(10),// added to physinfo when changed
|
||||
CVAR_RENDERINFO = BIT(11),// save to a seperate config called opengl.cfg
|
||||
CVAR_CHEAT = BIT(12),// can not be changed if cheats are disabled
|
||||
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
|
||||
CVAR_LATCH_VIDEO = BIT(16),// save changes until render restart
|
||||
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_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_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.
|
||||
CVAR_PRINTABLEONLY = BIT( 7 ), // this cvar's string cannot contain unprintable characters ( player name )
|
||||
CVAR_UNLOGGED = BIT( 8 ), // if this is a FCVAR_SERVER, don't log changes to the log file / console
|
||||
CVAR_SERVERINFO = BIT( 9 ), // added to serverinfo when changed
|
||||
CVAR_PHYSICINFO = BIT( 10 ), // added to physinfo when changed
|
||||
CVAR_RENDERINFO = BIT( 11 ), // save to a seperate config called opengl.cfg
|
||||
CVAR_CHEAT = BIT( 12 ), // can not be changed if cheats are disabled
|
||||
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_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;
|
||||
|
||||
#include "cvardef.h"
|
||||
|
|
|
@ -400,7 +400,7 @@ convar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force )
|
|||
return var;
|
||||
}
|
||||
|
||||
if( var->flags & ( CVAR_LATCH|CVAR_LATCH_VIDEO ))
|
||||
if( var->flags & CVAR_LATCH )
|
||||
{
|
||||
if( var->latched_string )
|
||||
{
|
||||
|
@ -419,11 +419,6 @@ convar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force )
|
|||
MsgDev( D_INFO, "%s will be changed upon restarting.\n", var->name );
|
||||
var->latched_string = copystring( value );
|
||||
}
|
||||
else if( var->flags & CVAR_LATCH_VIDEO )
|
||||
{
|
||||
MsgDev( D_INFO, "%s will be changed upon restarting video.\n", var->name );
|
||||
var->latched_string = copystring( value );
|
||||
}
|
||||
else
|
||||
{
|
||||
Mem_Free( var->string ); // free the old value string
|
||||
|
@ -626,7 +621,7 @@ void Cvar_DirectSet( cvar_t *var, const char *value )
|
|||
|
||||
if( !value ) value = "0";
|
||||
|
||||
if( var->flags & ( CVAR_READ_ONLY|CVAR_GLCONFIG|CVAR_INIT|CVAR_RENDERINFO|CVAR_LATCH|CVAR_LATCH_VIDEO ))
|
||||
if( var->flags & ( CVAR_READ_ONLY|CVAR_GLCONFIG|CVAR_INIT|CVAR_RENDERINFO|CVAR_LATCH ))
|
||||
{
|
||||
// Cvar_DirectSet cannot change these cvars at all
|
||||
return;
|
||||
|
@ -1034,9 +1029,6 @@ void Cvar_List_f( void )
|
|||
if( var->flags & CVAR_LATCH ) Msg( "LATCH " );
|
||||
else Msg( " " );
|
||||
|
||||
if( var->flags & CVAR_LATCH_VIDEO ) Msg( "VIDEO " );
|
||||
else Msg( " " );
|
||||
|
||||
if( var->flags & CVAR_GLCONFIG ) Msg( "OPENGL" );
|
||||
else Msg( " " );
|
||||
|
||||
|
@ -1134,41 +1126,6 @@ void Cvar_Latched_f( void )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_LatchedVideo_f
|
||||
|
||||
Now all latched video strings is valid
|
||||
============
|
||||
*/
|
||||
void Cvar_LatchedVideo_f( void )
|
||||
{
|
||||
convar_t *var;
|
||||
convar_t **prev;
|
||||
|
||||
prev = &cvar_vars;
|
||||
|
||||
while ( 1 )
|
||||
{
|
||||
var = *prev;
|
||||
if( !var ) break;
|
||||
|
||||
if( var->flags & CVAR_EXTDLL )
|
||||
{
|
||||
prev = &var->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( var->flags & CVAR_LATCH_VIDEO && 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
|
||||
|
@ -1279,7 +1236,6 @@ void Cvar_Init( void )
|
|||
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 ("vidlatch", Cvar_LatchedVideo_f, "apply latched values for video subsystem" );
|
||||
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" );
|
||||
|
|
|
@ -50,13 +50,13 @@ typedef struct wadtype_s
|
|||
typedef struct file_s
|
||||
{
|
||||
int handle; // file descriptor
|
||||
fs_offset_t real_length; // uncompressed file size (for files opened in "read" mode)
|
||||
fs_offset_t position; // current position in the file
|
||||
fs_offset_t offset; // offset into the package (0 if external file)
|
||||
long real_length; // uncompressed file size (for files opened in "read" mode)
|
||||
long position; // current position in the file
|
||||
long offset; // offset into the package (0 if external file)
|
||||
int ungetc; // single stored character from ungetc, cleared to EOF when read
|
||||
time_t filetime; // pak, wad or real filetime
|
||||
// Contents buffer
|
||||
fs_offset_t buff_ind, buff_len; // buffer current index and length
|
||||
long buff_ind, buff_len; // buffer current index and length
|
||||
byte buff[FILE_BUFF_SIZE]; // intermediate buffer
|
||||
};
|
||||
|
||||
|
@ -75,8 +75,8 @@ typedef struct wfile_s
|
|||
typedef struct packfile_s
|
||||
{
|
||||
char name[56];
|
||||
fs_offset_t offset;
|
||||
fs_offset_t realsize; // real file size (uncompressed)
|
||||
long offset;
|
||||
long realsize; // real file size (uncompressed)
|
||||
} packfile_t;
|
||||
|
||||
typedef struct pack_s
|
||||
|
@ -111,8 +111,8 @@ static void FS_InitMemory( void );
|
|||
const char *FS_FileExtension( const char *in );
|
||||
static searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedironly );
|
||||
static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const char matchtype );
|
||||
static packfile_t* FS_AddFileToPack( const char* name, pack_t *pack, fs_offset_t offset, fs_offset_t size );
|
||||
static byte *W_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
|
||||
static packfile_t* FS_AddFileToPack( const char* name, pack_t *pack, long offset, long size );
|
||||
static byte *W_LoadFile( const char *path, long *filesizeptr, qboolean gamedironly );
|
||||
static qboolean FS_SysFileExists( const char *path );
|
||||
static qboolean FS_SysFolderExists( const char *path );
|
||||
static long FS_SysFileTime( const char *filename );
|
||||
|
@ -285,7 +285,7 @@ FS_AddFileToPack
|
|||
Add a file to the list of files contained into a package
|
||||
====================
|
||||
*/
|
||||
static packfile_t* FS_AddFileToPack( const char* name, pack_t* pack, fs_offset_t offset, fs_offset_t size )
|
||||
static packfile_t* FS_AddFileToPack( const char* name, pack_t* pack, long offset, long size )
|
||||
{
|
||||
int left, right, middle;
|
||||
packfile_t *pfile;
|
||||
|
@ -2024,9 +2024,9 @@ FS_Write
|
|||
Write "datasize" bytes into a file
|
||||
====================
|
||||
*/
|
||||
fs_offset_t FS_Write( file_t *file, const void *data, size_t datasize )
|
||||
long FS_Write( file_t *file, const void *data, size_t datasize )
|
||||
{
|
||||
fs_offset_t result;
|
||||
long result;
|
||||
|
||||
if( !file ) return 0;
|
||||
|
||||
|
@ -2038,7 +2038,7 @@ fs_offset_t FS_Write( file_t *file, const void *data, size_t datasize )
|
|||
FS_Purge( file );
|
||||
|
||||
// write the buffer and update the position
|
||||
result = write( file->handle, data, (fs_offset_t)datasize );
|
||||
result = write( file->handle, data, (long)datasize );
|
||||
file->position = lseek( file->handle, 0, SEEK_CUR );
|
||||
if( file->real_length < file->position )
|
||||
file->real_length = file->position;
|
||||
|
@ -2055,10 +2055,10 @@ FS_Read
|
|||
Read up to "buffersize" bytes from a file
|
||||
====================
|
||||
*/
|
||||
fs_offset_t FS_Read( file_t *file, void *buffer, size_t buffersize )
|
||||
long FS_Read( file_t *file, void *buffer, size_t buffersize )
|
||||
{
|
||||
fs_offset_t count, done;
|
||||
fs_offset_t nb;
|
||||
long count, done;
|
||||
long nb;
|
||||
|
||||
// nothing to copy
|
||||
if( buffersize == 0 ) return 1;
|
||||
|
@ -2078,7 +2078,7 @@ fs_offset_t FS_Read( file_t *file, void *buffer, size_t buffersize )
|
|||
{
|
||||
count = file->buff_len - file->buff_ind;
|
||||
|
||||
done += ((fs_offset_t)buffersize > count ) ? count : (fs_offset_t)buffersize;
|
||||
done += ((long)buffersize > count ) ? count : (long)buffersize;
|
||||
Q_memcpy( buffer, &file->buff[file->buff_ind], done );
|
||||
file->buff_ind += done;
|
||||
|
||||
|
@ -2095,8 +2095,8 @@ fs_offset_t FS_Read( file_t *file, void *buffer, size_t buffersize )
|
|||
// if we have a lot of data to get, put them directly into "buffer"
|
||||
if( buffersize > sizeof( file->buff ) / 2 )
|
||||
{
|
||||
if( count > (fs_offset_t)buffersize )
|
||||
count = (fs_offset_t)buffersize;
|
||||
if( count > (long)buffersize )
|
||||
count = (long)buffersize;
|
||||
lseek( file->handle, file->offset + file->position, SEEK_SET );
|
||||
nb = read (file->handle, &((byte *)buffer)[done], count );
|
||||
|
||||
|
@ -2110,8 +2110,8 @@ fs_offset_t FS_Read( file_t *file, void *buffer, size_t buffersize )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( count > (fs_offset_t)sizeof( file->buff ))
|
||||
count = (fs_offset_t)sizeof( file->buff );
|
||||
if( count > (long)sizeof( file->buff ))
|
||||
count = (long)sizeof( file->buff );
|
||||
lseek( file->handle, file->offset + file->position, SEEK_SET );
|
||||
nb = read( file->handle, file->buff, count );
|
||||
|
||||
|
@ -2121,7 +2121,7 @@ fs_offset_t FS_Read( file_t *file, void *buffer, size_t buffersize )
|
|||
file->position += nb;
|
||||
|
||||
// copy the requested data in "buffer" (as much as we can)
|
||||
count = (fs_offset_t)buffersize > file->buff_len ? file->buff_len : (fs_offset_t)buffersize;
|
||||
count = (long)buffersize > file->buff_len ? file->buff_len : (long)buffersize;
|
||||
Q_memcpy( &((byte *)buffer)[done], file->buff, count );
|
||||
file->buff_ind = count;
|
||||
done += count;
|
||||
|
@ -2172,7 +2172,7 @@ Print a string into a file
|
|||
int FS_VPrintf( file_t *file, const char* format, va_list ap )
|
||||
{
|
||||
int len;
|
||||
fs_offset_t buff_size = MAX_SYSPATH;
|
||||
long buff_size = MAX_SYSPATH;
|
||||
char *tempbuff;
|
||||
|
||||
if( !file ) return 0;
|
||||
|
@ -2264,7 +2264,7 @@ FS_Seek
|
|||
Move the position index in a file
|
||||
====================
|
||||
*/
|
||||
int FS_Seek( file_t *file, fs_offset_t offset, int whence )
|
||||
int FS_Seek( file_t *file, long offset, int whence )
|
||||
{
|
||||
// compute the file offset
|
||||
switch( whence )
|
||||
|
@ -2308,7 +2308,7 @@ FS_Tell
|
|||
Give the current position in a file
|
||||
====================
|
||||
*/
|
||||
fs_offset_t FS_Tell( file_t* file )
|
||||
long FS_Tell( file_t* file )
|
||||
{
|
||||
if( !file ) return 0;
|
||||
return file->position - file->buff_len + file->buff_ind;
|
||||
|
@ -2349,11 +2349,11 @@ Filename are relative to the xash directory.
|
|||
Always appends a 0 byte.
|
||||
============
|
||||
*/
|
||||
byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly )
|
||||
byte *FS_LoadFile( const char *path, long *filesizeptr, qboolean gamedironly )
|
||||
{
|
||||
file_t *file;
|
||||
byte *buf = NULL;
|
||||
fs_offset_t filesize = 0;
|
||||
long filesize = 0;
|
||||
|
||||
file = FS_Open( path, "rb", gamedironly );
|
||||
|
||||
|
@ -2383,7 +2383,7 @@ FS_OpenFile
|
|||
Simply version of FS_Open
|
||||
============
|
||||
*/
|
||||
file_t *FS_OpenFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly )
|
||||
file_t *FS_OpenFile( const char *path, long *filesizeptr, qboolean gamedironly )
|
||||
{
|
||||
file_t *file = FS_Open( path, "rb", gamedironly );
|
||||
|
||||
|
@ -2402,7 +2402,7 @@ FS_WriteFile
|
|||
The filename will be prefixed by the current game directory
|
||||
============
|
||||
*/
|
||||
qboolean FS_WriteFile( const char *filename, const void *data, fs_offset_t len )
|
||||
qboolean FS_WriteFile( const char *filename, const void *data, long len )
|
||||
{
|
||||
file_t *file;
|
||||
|
||||
|
@ -2611,7 +2611,7 @@ FS_FileSize
|
|||
return size of file in bytes
|
||||
==================
|
||||
*/
|
||||
fs_offset_t FS_FileSize( const char *filename, qboolean gamedironly )
|
||||
long FS_FileSize( const char *filename, qboolean gamedironly )
|
||||
{
|
||||
file_t *fp;
|
||||
int length = 0;
|
||||
|
@ -2635,7 +2635,7 @@ FS_FileLength
|
|||
return size of file in bytes
|
||||
==================
|
||||
*/
|
||||
fs_offset_t FS_FileLength( file_t *f )
|
||||
long FS_FileLength( file_t *f )
|
||||
{
|
||||
if( !f ) return 0;
|
||||
return f->real_length;
|
||||
|
@ -2648,7 +2648,7 @@ FS_FileTime
|
|||
return time of creation file in seconds
|
||||
==================
|
||||
*/
|
||||
fs_offset_t FS_FileTime( const char *filename, qboolean gamedironly )
|
||||
long FS_FileTime( const char *filename, qboolean gamedironly )
|
||||
{
|
||||
searchpath_t *search;
|
||||
int pack_ind;
|
||||
|
@ -3399,7 +3399,7 @@ wfile_t *W_Open( const char *filename, const char *mode )
|
|||
|
||||
void W_Close( wfile_t *wad )
|
||||
{
|
||||
fs_offset_t ofs;
|
||||
long ofs;
|
||||
|
||||
if( !wad ) return;
|
||||
|
||||
|
@ -3432,7 +3432,7 @@ FILESYSTEM IMPLEMENTATION
|
|||
|
||||
=============================================================================
|
||||
*/
|
||||
static byte *W_LoadFile( const char *path, fs_offset_t *lumpsizeptr, qboolean gamedironly )
|
||||
static byte *W_LoadFile( const char *path, long *lumpsizeptr, qboolean gamedironly )
|
||||
{
|
||||
searchpath_t *search;
|
||||
int index;
|
||||
|
|
|
@ -39,8 +39,6 @@ convar_t *host_framerate;
|
|||
convar_t *con_gamemaps;
|
||||
convar_t *build, *ver;
|
||||
|
||||
static int num_decals;
|
||||
|
||||
// these cvars will be duplicated on each client across network
|
||||
int Host_ServerState( void )
|
||||
{
|
||||
|
@ -74,23 +72,26 @@ Host_PrintEngineFeatures
|
|||
*/
|
||||
void Host_PrintEngineFeatures( void )
|
||||
{
|
||||
if( host.features & ENGINE_WRITE_LARGE_COORD )
|
||||
MsgDev( D_AICONSOLE, "^3EXT:^7 big world support enabled\n" );
|
||||
if( FBitSet( host.features, ENGINE_WRITE_LARGE_COORD ))
|
||||
MsgDev( D_REPORT, "^3EXT:^7 big world support enabled\n" );
|
||||
|
||||
if( host.features & ENGINE_BUILD_SURFMESHES )
|
||||
MsgDev( D_AICONSOLE, "^3EXT:^7 surfmeshes enabled\n" );
|
||||
if( FBitSet( host.features, ENGINE_BUILD_SURFMESHES ))
|
||||
MsgDev( D_REPORT, "^3EXT:^7 surfmeshes enabled\n" );
|
||||
|
||||
if( host.features & ENGINE_LOAD_DELUXEDATA )
|
||||
MsgDev( D_AICONSOLE, "^3EXT:^7 deluxemap support enabled\n" );
|
||||
if( FBitSet( host.features, ENGINE_LOAD_DELUXEDATA ))
|
||||
MsgDev( D_REPORT, "^3EXT:^7 deluxemap support enabled\n" );
|
||||
|
||||
if( host.features & ENGINE_TRANSFORM_TRACE_AABB )
|
||||
MsgDev( D_AICONSOLE, "^3EXT:^7 Transform trace AABB enabled\n" );
|
||||
if( FBitSet( host.features, ENGINE_TRANSFORM_TRACE_AABB ))
|
||||
MsgDev( D_REPORT, "^3EXT:^7 Transform trace AABB enabled\n" );
|
||||
|
||||
if( host.features & ENGINE_LARGE_LIGHTMAPS )
|
||||
MsgDev( D_AICONSOLE, "^3EXT:^7 Large lightmaps enabled\n" );
|
||||
if( FBitSet( host.features, ENGINE_LARGE_LIGHTMAPS ))
|
||||
MsgDev( D_REPORT, "^3EXT:^7 Large lightmaps enabled\n" );
|
||||
|
||||
if( host.features & ENGINE_COMPENSATE_QUAKE_BUG )
|
||||
MsgDev( D_AICONSOLE, "^3EXT:^7 Compensate quake bug enabled\n" );
|
||||
if( FBitSet( host.features, ENGINE_COMPENSATE_QUAKE_BUG ))
|
||||
MsgDev( D_REPORT, "^3EXT:^7 Compensate quake bug enabled\n" );
|
||||
|
||||
if( FBitSet( host.features, ENGINE_FIXED_FRAMERATE ))
|
||||
MsgDev( D_REPORT, "^3EXT:^7 fixed main cycle\n" );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -118,7 +119,7 @@ void Host_EndGame( const char *message, ... )
|
|||
static char string[MAX_SYSPATH];
|
||||
|
||||
va_start( argptr, message );
|
||||
Q_vsprintf( string, message, argptr );
|
||||
Q_vsnprintf( string, sizeof( string ), message, argptr );
|
||||
va_end( argptr );
|
||||
|
||||
MsgDev( D_INFO, "Host_EndGame: %s\n", string );
|
||||
|
@ -309,12 +310,12 @@ qboolean Host_IsLocalClient( void )
|
|||
Host_RegisterDecal
|
||||
=================
|
||||
*/
|
||||
qboolean Host_RegisterDecal( const char *name )
|
||||
qboolean Host_RegisterDecal( const char *name, int *count )
|
||||
{
|
||||
char shortname[CS_SIZE];
|
||||
int i;
|
||||
|
||||
if( !name || !name[0] )
|
||||
if( !name || !*name )
|
||||
return 0;
|
||||
|
||||
FS_FileBase( name, shortname );
|
||||
|
@ -333,7 +334,7 @@ qboolean Host_RegisterDecal( const char *name )
|
|||
|
||||
// register new decal
|
||||
Q_strncpy( host.draw_decals[i], shortname, sizeof( host.draw_decals[i] ));
|
||||
num_decals++;
|
||||
*count += 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -346,17 +347,16 @@ Host_InitDecals
|
|||
void Host_InitDecals( void )
|
||||
{
|
||||
search_t *t;
|
||||
int i;
|
||||
int i, num_decals = 0;
|
||||
|
||||
Q_memset( host.draw_decals, 0, sizeof( host.draw_decals ));
|
||||
num_decals = 0;
|
||||
|
||||
// lookup all decals in decals.wad
|
||||
t = FS_Search( "decals.wad/*.*", true, false );
|
||||
|
||||
for( i = 0; t && i < t->numfilenames; i++ )
|
||||
{
|
||||
if( !Host_RegisterDecal( t->filenames[i] ))
|
||||
if( !Host_RegisterDecal( t->filenames[i], &num_decals ))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -373,27 +373,25 @@ Write ambient sounds into demo
|
|||
*/
|
||||
void Host_RestartAmbientSounds( void )
|
||||
{
|
||||
soundlist_t soundInfo[64];
|
||||
soundlist_t soundInfo[128];
|
||||
string curtrack, looptrack;
|
||||
int i, nSounds;
|
||||
fs_offset_t position;
|
||||
long position;
|
||||
|
||||
if( !SV_Active( ))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( !SV_Active( )) return;
|
||||
|
||||
nSounds = S_GetCurrentStaticSounds( soundInfo, 64 );
|
||||
nSounds = S_GetCurrentStaticSounds( soundInfo, 128 );
|
||||
|
||||
for( i = 0; i < nSounds; i++ )
|
||||
{
|
||||
if( !soundInfo[i].looping || soundInfo[i].entnum == -1 )
|
||||
soundlist_t *si = &soundInfo[i];
|
||||
|
||||
if( !si->looping || si->entnum == -1 )
|
||||
continue;
|
||||
|
||||
MsgDev( D_NOTE, "Restarting sound %s...\n", soundInfo[i].name );
|
||||
S_StopSound( soundInfo[i].entnum, soundInfo[i].channel, soundInfo[i].name );
|
||||
SV_StartSound( pfnPEntityOfEntIndex( soundInfo[i].entnum ), CHAN_STATIC, soundInfo[i].name,
|
||||
soundInfo[i].volume, soundInfo[i].attenuation, 0, soundInfo[i].pitch );
|
||||
S_StopSound( si->entnum, si->channel, si->name );
|
||||
SV_StartSound( pfnPEntityOfEntIndex( si->entnum ), CHAN_STATIC, si->name, si->volume, si->attenuation, 0, si->pitch );
|
||||
}
|
||||
|
||||
// restart soundtrack
|
||||
|
@ -418,10 +416,7 @@ void Host_RestartDecals( void )
|
|||
sizebuf_t *msg;
|
||||
int i;
|
||||
|
||||
if( !SV_Active( ))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( !SV_Active( )) return;
|
||||
|
||||
// g-cont. add space for studiodecals if present
|
||||
host.decalList = (decallist_t *)Z_Malloc( sizeof( decallist_t ) * MAX_RENDER_DECALS * 2 );
|
||||
|
@ -465,20 +460,103 @@ void Host_RestartDecals( void )
|
|||
|
||||
/*
|
||||
===================
|
||||
Host_GetConsoleCommands
|
||||
Host_GetCommands
|
||||
|
||||
Add them exactly as if they had been typed at the console
|
||||
===================
|
||||
*/
|
||||
void Host_GetConsoleCommands( void )
|
||||
void Host_GetCommands( void )
|
||||
{
|
||||
char *cmd;
|
||||
|
||||
if( host.type == HOST_DEDICATED )
|
||||
{
|
||||
if( host.type != HOST_DEDICATED )
|
||||
return;
|
||||
|
||||
cmd = Con_Input();
|
||||
if( cmd ) Cbuf_AddText( cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Host_FrameTime
|
||||
|
||||
Returns false if the time is too short to run a frame
|
||||
===================
|
||||
*/
|
||||
qboolean Host_FrameTime( float time )
|
||||
{
|
||||
static double oldtime;
|
||||
double minframetime;
|
||||
double fps;
|
||||
|
||||
host.realtime += time;
|
||||
|
||||
// limit fps to withing tolerable range
|
||||
fps = bound( HOST_MINFPS, HOST_FPS, HOST_MAXFPS );
|
||||
minframetime = ( 1.0 / fps );
|
||||
|
||||
if(( host.realtime - oldtime ) < minframetime )
|
||||
{
|
||||
// framerate is too high
|
||||
return false;
|
||||
}
|
||||
|
||||
host.frametime = host.realtime - oldtime;
|
||||
host.realframetime = bound( MIN_FRAMETIME, host.frametime, MAX_FRAMETIME );
|
||||
oldtime = host.realtime;
|
||||
|
||||
if( host_framerate->value > 0 && ( Host_IsLocalGame( )))
|
||||
{
|
||||
float fps = host_framerate->value;
|
||||
if( fps > 1 ) fps = 1.0f / fps;
|
||||
host.frametime = fps;
|
||||
}
|
||||
else
|
||||
{ // don't allow really long or short frames
|
||||
host.frametime = bound( MIN_FRAMETIME, host.frametime, MAX_FRAMETIME );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Host_RenderTime
|
||||
|
||||
Returns false if the time is too short to render a frame
|
||||
===================
|
||||
*/
|
||||
qboolean Host_RenderTime( float time )
|
||||
{
|
||||
static double oldtime;
|
||||
static double newtime;
|
||||
double fps;
|
||||
|
||||
newtime += time;
|
||||
|
||||
// dedicated's tic_rate regulates server frame rate. Don't apply fps filter here.
|
||||
fps = host_maxfps->value;
|
||||
|
||||
// clamp the fps in multiplayer games
|
||||
if( fps != 0 )
|
||||
{
|
||||
double minframetime;
|
||||
|
||||
// limit fps to withing tolerable range
|
||||
fps = bound( MIN_FPS, fps, MAX_FPS );
|
||||
|
||||
minframetime = 1.0 / fps;
|
||||
|
||||
if(( newtime - oldtime ) < minframetime )
|
||||
{
|
||||
// framerate is too high
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
oldtime = newtime;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -498,6 +576,7 @@ qboolean Host_FilterTime( float time )
|
|||
// dedicated's tic_rate regulates server frame rate. Don't apply fps filter here.
|
||||
fps = host_maxfps->value;
|
||||
|
||||
// clamp the fps in multiplayer games
|
||||
if( fps != 0 )
|
||||
{
|
||||
float minframetime;
|
||||
|
@ -542,18 +621,39 @@ void Host_Frame( float time )
|
|||
if( setjmp( host.abortframe ))
|
||||
return;
|
||||
|
||||
// new-style game loop
|
||||
if( FBitSet( host.features, ENGINE_FIXED_FRAMERATE ))
|
||||
{
|
||||
// decide the simulation time
|
||||
if( Host_FrameTime( time ))
|
||||
{
|
||||
Host_InputFrame (); // input frame
|
||||
Host_GetCommands(); // dedicated
|
||||
Host_ServerFrame(); // server frame
|
||||
Host_ClientFrame(); // client frame
|
||||
host.framecount++;
|
||||
}
|
||||
|
||||
// clamp the renderer time
|
||||
if( !Host_RenderTime( time ))
|
||||
return;
|
||||
|
||||
Host_RenderFrame (); // render frame
|
||||
}
|
||||
else // classic game loop
|
||||
{
|
||||
Host_InputFrame (); // input frame
|
||||
|
||||
// decide the simulation time
|
||||
if( !Host_FilterTime( time ))
|
||||
return;
|
||||
|
||||
Host_GetConsoleCommands ();
|
||||
|
||||
Host_GetCommands ();
|
||||
Host_ServerFrame (); // server frame
|
||||
Host_ClientFrame (); // client frame
|
||||
|
||||
host.framecount++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -106,7 +106,7 @@ Key_IsDown
|
|||
*/
|
||||
qboolean Key_IsDown( int keynum )
|
||||
{
|
||||
if ( keynum == -1 )
|
||||
if( keynum == -1 )
|
||||
return false;
|
||||
return keys[keynum].down;
|
||||
}
|
||||
|
@ -179,6 +179,7 @@ int Key_StringToKeynum( const char *str )
|
|||
if( !Q_stricmp( str, kn->name ))
|
||||
return kn->keynum;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -275,6 +276,7 @@ int Key_GetKey( const char *binding )
|
|||
if( keys[i].binding && !Q_stricmp( binding, keys[i].binding ))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -294,11 +296,13 @@ void Key_Unbind_f( void )
|
|||
}
|
||||
|
||||
b = Key_StringToKeynum( Cmd_Argv( 1 ));
|
||||
|
||||
if( b == -1 )
|
||||
{
|
||||
Msg( "\"%s\" isn't a valid key\n", Cmd_Argv( 1 ));
|
||||
return;
|
||||
}
|
||||
|
||||
Key_SetBinding( b, "" );
|
||||
}
|
||||
|
||||
|
@ -325,8 +329,8 @@ Key_Reset_f
|
|||
*/
|
||||
void Key_Reset_f( void )
|
||||
{
|
||||
int i;
|
||||
keyname_t *kn;
|
||||
int i;
|
||||
|
||||
// clear all keys first
|
||||
for( i = 0; i < 256; i++ )
|
||||
|
@ -347,8 +351,8 @@ Key_Bind_f
|
|||
*/
|
||||
void Key_Bind_f( void )
|
||||
{
|
||||
int i, c, b;
|
||||
char cmd[1024];
|
||||
int i, c, b;
|
||||
|
||||
c = Cmd_Argc();
|
||||
|
||||
|
@ -398,12 +402,13 @@ void Key_WriteBindings( file_t *f )
|
|||
int i;
|
||||
|
||||
if( !f ) return;
|
||||
|
||||
FS_Printf( f, "unbindall\n" );
|
||||
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
if( keys[i].binding && keys[i].binding[0] )
|
||||
FS_Printf( f, "bind %s \"%s\"\n", Key_KeynumToString(i), keys[i].binding );
|
||||
FS_Printf( f, "bind %s \"%s\"\n", Key_KeynumToString( i ), keys[i].binding );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -556,6 +561,12 @@ void Key_Event( int key, qboolean down )
|
|||
switch( cls.key_dest )
|
||||
{
|
||||
case key_game:
|
||||
if( gl_showtextures->integer )
|
||||
{
|
||||
// close texture atlas
|
||||
Cvar_SetFloat( "r_showtextures", 0.0f );
|
||||
return;
|
||||
}
|
||||
if( host.mouse_visible && cls.state != ca_cinematic )
|
||||
{
|
||||
clgame.dllFuncs.pfnKey_Event( down, key, keys[key].binding );
|
||||
|
|
|
@ -430,17 +430,22 @@ AngleQuaternion
|
|||
|
||||
====================
|
||||
*/
|
||||
void AngleQuaternion( const vec3_t angles, vec4_t q )
|
||||
void AngleQuaternion( const vec3_t angles, vec4_t q, qboolean studio )
|
||||
{
|
||||
float angle;
|
||||
float sr, sp, sy, cr, cp, cy;
|
||||
|
||||
angle = angles[2] * 0.5f;
|
||||
SinCos( angle, &sy, &cy );
|
||||
angle = angles[1] * 0.5f;
|
||||
SinCos( angle, &sp, &cp );
|
||||
angle = angles[0] * 0.5f;
|
||||
SinCos( angle, &sr, &cr );
|
||||
if( studio )
|
||||
{
|
||||
SinCos( angles[ROLL] * 0.5f, &sy, &cy );
|
||||
SinCos( angles[YAW] * 0.5f, &sp, &cp );
|
||||
SinCos( angles[PITCH] * 0.5f, &sr, &cr );
|
||||
}
|
||||
else
|
||||
{
|
||||
SinCos( DEG2RAD( angles[YAW] ) * 0.5f, &sy, &cy );
|
||||
SinCos( DEG2RAD( angles[PITCH] ) * 0.5f, &sp, &cp );
|
||||
SinCos( DEG2RAD( angles[ROLL] ) * 0.5f, &sr, &cr );
|
||||
}
|
||||
|
||||
q[0] = sr * cp * cy - cr * sp * sy; // X
|
||||
q[1] = cr * sp * cy + sr * cp * sy; // Y
|
||||
|
@ -448,6 +453,19 @@ void AngleQuaternion( const vec3_t angles, vec4_t q )
|
|||
q[3] = cr * cp * cy + sr * sp * sy; // W
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
QuaternionAngle
|
||||
|
||||
====================
|
||||
*/
|
||||
void QuaternionAngle( const vec4_t q, vec3_t angles )
|
||||
{
|
||||
matrix3x4 mat;
|
||||
Matrix3x4_FromOriginQuat( mat, q, vec3_origin );
|
||||
Matrix3x4_AnglesFromMatrix( mat, angles );
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
QuaternionSlerp
|
||||
|
|
|
@ -55,14 +55,19 @@ GNU General Public License for more details.
|
|||
|
||||
#define RAD_TO_STUDIO (32768.0 / M_PI)
|
||||
#define STUDIO_TO_RAD (M_PI / 32768.0)
|
||||
#define nanmask (255<<23)
|
||||
|
||||
#define INV127F ( 1.0f / 127.0f )
|
||||
#define INV255F ( 1.0f / 255.0f )
|
||||
#define MAKE_SIGNED( x ) ((( x ) * INV127F ) - 1.0f )
|
||||
|
||||
#define Q_min( a, b ) (((a) < (b)) ? (a) : (b))
|
||||
#define Q_max( a, b ) (((a) > (b)) ? (a) : (b))
|
||||
#define Q_recip( a ) ((float)(1.0f / (float)(a)))
|
||||
#define Q_floor( a ) ((float)(long)(a))
|
||||
#define Q_ceil( a ) ((float)(long)((a) + 1))
|
||||
|
||||
#define Q_rint(x) ((x) < 0 ? ((int)((x)-0.5f)) : ((int)((x)+0.5f)))
|
||||
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
|
||||
#define IS_NAN(x) (((*(int *)&x) & (255<<23)) == (255<<23))
|
||||
|
||||
#define ALIGN( x, a ) ((( x ) + (( size_t )( a ) - 1 )) & ~(( size_t )( a ) - 1 ))
|
||||
|
||||
|
@ -129,7 +134,8 @@ qboolean BoundsIntersect( const vec3_t mins1, const vec3_t maxs1, const vec3_t m
|
|||
qboolean BoundsAndSphereIntersect( const vec3_t mins, const vec3_t maxs, const vec3_t origin, float radius );
|
||||
float RadiusFromBounds( const vec3_t mins, const vec3_t maxs );
|
||||
|
||||
void AngleQuaternion( const vec3_t angles, vec4_t q );
|
||||
void AngleQuaternion( const vec3_t angles, vec4_t q, qboolean studio );
|
||||
void QuaternionAngle( const vec4_t q, vec3_t angles );
|
||||
void QuaternionSlerp( const vec4_t p, vec4_t q, float t, vec4_t qt );
|
||||
float RemapVal( float val, float A, float B, float C, float D );
|
||||
float ApproachVal( float target, float value, float speed );
|
||||
|
@ -151,6 +157,7 @@ void Matrix3x4_TransformPositivePlane( const matrix3x4 in, const vec3_t normal,
|
|||
void Matrix3x4_SetOrigin( matrix3x4 out, float x, float y, float z );
|
||||
void Matrix3x4_Invert_Simple( matrix3x4 out, const matrix3x4 in1 );
|
||||
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 ))
|
||||
|
|
|
@ -94,6 +94,26 @@ void Matrix3x4_OriginFromMatrix( const matrix3x4 in, float *out )
|
|||
out[2] = in[2][3];
|
||||
}
|
||||
|
||||
void Matrix3x4_AnglesFromMatrix( const matrix3x4 in, vec3_t out )
|
||||
{
|
||||
float xyDist = sqrt( in[0][0] * in[0][0] + in[1][0] * in[1][0] );
|
||||
|
||||
if( xyDist > 0.001f )
|
||||
{
|
||||
// enough here to get angles?
|
||||
out[0] = RAD2DEG( atan2( -in[2][0], xyDist ));
|
||||
out[1] = RAD2DEG( atan2( in[1][0], in[0][0] ));
|
||||
out[2] = RAD2DEG( atan2( in[2][1], in[2][2] ));
|
||||
}
|
||||
else
|
||||
{
|
||||
// forward is mostly Z, gimbal lock
|
||||
out[0] = RAD2DEG( atan2( -in[2][0], xyDist ));
|
||||
out[1] = RAD2DEG( atan2( -in[0][1], in[1][1] ));
|
||||
out[2] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix3x4_FromOriginQuat( matrix3x4 out, const vec4_t quaternion, const vec3_t origin )
|
||||
{
|
||||
out[0][0] = 1.0f - 2.0f * quaternion[1] * quaternion[1] - 2.0f * quaternion[2] * quaternion[2];
|
||||
|
|
|
@ -406,13 +406,13 @@ static void Mod_StudioCalcBoneQuaterion( int frame, float s, mstudiobone_t *pbon
|
|||
|
||||
if( !VectorCompare( angle1, angle2 ))
|
||||
{
|
||||
AngleQuaternion( angle1, q1 );
|
||||
AngleQuaternion( angle2, q2 );
|
||||
AngleQuaternion( angle1, q1, true );
|
||||
AngleQuaternion( angle2, q2, true );
|
||||
QuaternionSlerp( q1, q2, s, q );
|
||||
}
|
||||
else
|
||||
{
|
||||
AngleQuaternion( angle1, q );
|
||||
AngleQuaternion( angle1, q, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -987,7 +987,7 @@ void Mod_InitStudioAPI( void )
|
|||
pBlendIface = (STUDIOAPI)Com_GetProcAddress( svgame.hInstance, "Server_GetBlendingInterface" );
|
||||
if( pBlendIface && pBlendIface( SV_BLENDING_INTERFACE_VERSION, &pBlendAPI, &gStudioAPI, &studio_transform, &studio_bones ))
|
||||
{
|
||||
MsgDev( D_AICONSOLE, "SV_LoadProgs: ^2initailized Server Blending interface ^7ver. %i\n", SV_BLENDING_INTERFACE_VERSION );
|
||||
MsgDev( D_REPORT, "SV_LoadProgs: ^2initailized Server Blending interface ^7ver. %i\n", SV_BLENDING_INTERFACE_VERSION );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ GNU General Public License for more details.
|
|||
static dword BitWriteMasks[32][33];
|
||||
static dword ExtraMasks[32];
|
||||
|
||||
short BF_BigShort( short swap )
|
||||
short MSG_BigShort( short swap )
|
||||
{
|
||||
short *s = &swap;
|
||||
|
||||
|
@ -37,7 +37,7 @@ short BF_BigShort( short swap )
|
|||
return *s;
|
||||
}
|
||||
|
||||
void BF_InitMasks( void )
|
||||
void MSG_InitMasks( void )
|
||||
{
|
||||
uint startbit, endbit;
|
||||
uint maskBit, nBitsLeft;
|
||||
|
@ -57,14 +57,14 @@ void BF_InitMasks( void )
|
|||
ExtraMasks[maskBit] = (uint)BIT( maskBit ) - 1;
|
||||
}
|
||||
|
||||
void BF_InitExt( sizebuf_t *bf, const char *pDebugName, void *pData, int nBytes, int nMaxBits )
|
||||
void MSG_InitExt( sizebuf_t *bf, const char *pDebugName, void *pData, int nBytes, int nMaxBits )
|
||||
{
|
||||
bf->pDebugName = pDebugName;
|
||||
|
||||
BF_StartWriting( bf, pData, nBytes, 0, nMaxBits );
|
||||
MSG_StartWriting( bf, pData, nBytes, 0, nMaxBits );
|
||||
}
|
||||
|
||||
void BF_StartWriting( sizebuf_t *bf, void *pData, int nBytes, int iStartBit, int nBits )
|
||||
void MSG_StartWriting( sizebuf_t *bf, void *pData, int nBytes, int iStartBit, int nBits )
|
||||
{
|
||||
// make sure it's dword aligned and padded.
|
||||
Assert(((dword)pData & 3 ) == 0 );
|
||||
|
@ -92,39 +92,39 @@ MSG_Clear
|
|||
for clearing overflowed buffer
|
||||
=======================
|
||||
*/
|
||||
void BF_Clear( sizebuf_t *bf )
|
||||
void MSG_Clear( sizebuf_t *bf )
|
||||
{
|
||||
bf->iCurBit = 0;
|
||||
bf->bOverflow = false;
|
||||
}
|
||||
|
||||
static qboolean BF_Overflow( sizebuf_t *bf, int nBits )
|
||||
static qboolean MSG_Overflow( sizebuf_t *bf, int nBits )
|
||||
{
|
||||
if( bf->iCurBit + nBits > bf->nDataBits )
|
||||
bf->bOverflow = true;
|
||||
return bf->bOverflow;
|
||||
}
|
||||
|
||||
qboolean BF_CheckOverflow( sizebuf_t *bf )
|
||||
qboolean MSG_CheckOverflow( sizebuf_t *bf )
|
||||
{
|
||||
ASSERT( bf );
|
||||
|
||||
return BF_Overflow( bf, 0 );
|
||||
return MSG_Overflow( bf, 0 );
|
||||
}
|
||||
|
||||
void BF_SeekToBit( sizebuf_t *bf, int bitPos )
|
||||
void MSG_SeekToBit( sizebuf_t *bf, int bitPos )
|
||||
{
|
||||
bf->iCurBit = bitPos;
|
||||
}
|
||||
|
||||
void BF_SeekToByte( sizebuf_t *bf, int bytePos )
|
||||
void MSG_SeekToByte( sizebuf_t *bf, int bytePos )
|
||||
{
|
||||
bf->iCurBit = bytePos << 3;
|
||||
}
|
||||
|
||||
void BF_WriteOneBit( sizebuf_t *bf, int nValue )
|
||||
void MSG_WriteOneBit( sizebuf_t *bf, int nValue )
|
||||
{
|
||||
if( !BF_Overflow( bf, 1 ))
|
||||
if( !MSG_Overflow( bf, 1 ))
|
||||
{
|
||||
if( nValue ) bf->pData[bf->iCurBit>>3] |= BIT( bf->iCurBit & 7 );
|
||||
else bf->pData[bf->iCurBit>>3] &= ~BIT( bf->iCurBit & 7 );
|
||||
|
@ -133,7 +133,7 @@ void BF_WriteOneBit( sizebuf_t *bf, int nValue )
|
|||
}
|
||||
}
|
||||
|
||||
void BF_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, qboolean bCheckRange )
|
||||
void MSG_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, qboolean bCheckRange )
|
||||
{
|
||||
Assert( numbits >= 0 && numbits <= 32 );
|
||||
|
||||
|
@ -151,7 +151,7 @@ void BF_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, qboolean bCh
|
|||
dword iCurBitMasked;
|
||||
int nBitsWritten;
|
||||
|
||||
Assert(( iDWord * 4 + sizeof( long )) <= (uint)BF_GetMaxBytes( bf ));
|
||||
Assert(( iDWord * 4 + sizeof( long )) <= (uint)MSG_GetMaxBytes( bf ));
|
||||
|
||||
iCurBitMasked = iCurBit & 31;
|
||||
((dword *)bf->pData)[iDWord] &= BitWriteMasks[iCurBitMasked][nBitsLeft];
|
||||
|
@ -176,12 +176,12 @@ void BF_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, qboolean bCh
|
|||
|
||||
/*
|
||||
=======================
|
||||
BF_WriteSBitLong
|
||||
MSG_WriteSBitLong
|
||||
|
||||
sign bit comes first
|
||||
=======================
|
||||
*/
|
||||
void BF_WriteSBitLong( sizebuf_t *bf, int data, int numbits )
|
||||
void MSG_WriteSBitLong( sizebuf_t *bf, int data, int numbits )
|
||||
{
|
||||
// do we have a valid # of bits to encode with?
|
||||
Assert( numbits >= 1 );
|
||||
|
@ -190,24 +190,24 @@ void BF_WriteSBitLong( sizebuf_t *bf, int data, int numbits )
|
|||
// (Some old code writes direct integers right into the buffer).
|
||||
if( data < 0 )
|
||||
{
|
||||
BF_WriteUBitLongExt( bf, (uint)( 0x80000000 + data ), numbits - 1, false );
|
||||
BF_WriteOneBit( bf, 1 );
|
||||
MSG_WriteUBitLongExt( bf, (uint)( 0x80000000 + data ), numbits - 1, false );
|
||||
MSG_WriteOneBit( bf, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
BF_WriteUBitLong( bf, (uint)data, numbits - 1 );
|
||||
BF_WriteOneBit( bf, 0 );
|
||||
MSG_WriteUBitLong( bf, (uint)data, numbits - 1 );
|
||||
MSG_WriteOneBit( bf, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
void BF_WriteBitLong( sizebuf_t *bf, uint data, int numbits, qboolean bSigned )
|
||||
void MSG_WriteBitLong( sizebuf_t *bf, uint data, int numbits, qboolean bSigned )
|
||||
{
|
||||
if( bSigned )
|
||||
BF_WriteSBitLong( bf, (int)data, numbits );
|
||||
else BF_WriteUBitLong( bf, data, numbits );
|
||||
MSG_WriteSBitLong( bf, (int)data, numbits );
|
||||
else MSG_WriteUBitLong( bf, data, numbits );
|
||||
}
|
||||
|
||||
qboolean BF_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
|
||||
qboolean MSG_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
|
||||
{
|
||||
byte *pOut = (byte *)pData;
|
||||
int nBitsLeft = nBits;
|
||||
|
@ -215,7 +215,7 @@ qboolean BF_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
|
|||
// get output dword-aligned.
|
||||
while((( dword )pOut & 3 ) != 0 && nBitsLeft >= 8 )
|
||||
{
|
||||
BF_WriteUBitLongExt( bf, *pOut, 8, false );
|
||||
MSG_WriteUBitLongExt( bf, *pOut, 8, false );
|
||||
|
||||
nBitsLeft -= 8;
|
||||
++pOut;
|
||||
|
@ -224,7 +224,7 @@ qboolean BF_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
|
|||
// read dwords.
|
||||
while( nBitsLeft >= 32 )
|
||||
{
|
||||
BF_WriteUBitLongExt( bf, *(( dword *)pOut ), 32, false );
|
||||
MSG_WriteUBitLongExt( bf, *(( dword *)pOut ), 32, false );
|
||||
|
||||
pOut += sizeof( dword );
|
||||
nBitsLeft -= 32;
|
||||
|
@ -233,7 +233,7 @@ qboolean BF_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
|
|||
// read the remaining bytes.
|
||||
while( nBitsLeft >= 8 )
|
||||
{
|
||||
BF_WriteUBitLongExt( bf, *pOut, 8, false );
|
||||
MSG_WriteUBitLongExt( bf, *pOut, 8, false );
|
||||
|
||||
nBitsLeft -= 8;
|
||||
++pOut;
|
||||
|
@ -242,13 +242,13 @@ qboolean BF_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
|
|||
// Read the remaining bits.
|
||||
if( nBitsLeft )
|
||||
{
|
||||
BF_WriteUBitLongExt( bf, *pOut, nBitsLeft, false );
|
||||
MSG_WriteUBitLongExt( bf, *pOut, nBitsLeft, false );
|
||||
}
|
||||
|
||||
return !bf->bOverflow;
|
||||
}
|
||||
|
||||
void BF_WriteBitAngle( sizebuf_t *bf, float fAngle, int numbits )
|
||||
void MSG_WriteBitAngle( sizebuf_t *bf, float fAngle, int numbits )
|
||||
{
|
||||
uint mask, shift;
|
||||
int d;
|
||||
|
@ -263,25 +263,25 @@ void BF_WriteBitAngle( sizebuf_t *bf, float fAngle, int numbits )
|
|||
d = (int)(( fAngle * shift ) / 360.0f );
|
||||
d &= mask;
|
||||
|
||||
BF_WriteUBitLong( bf, (uint)d, numbits );
|
||||
MSG_WriteUBitLong( bf, (uint)d, numbits );
|
||||
}
|
||||
|
||||
void BF_WriteCoord( sizebuf_t *bf, float val )
|
||||
void MSG_WriteCoord( sizebuf_t *bf, float val )
|
||||
{
|
||||
// g-cont. we loose precision here but keep old size of coord variable!
|
||||
if( host.features & ENGINE_WRITE_LARGE_COORD )
|
||||
BF_WriteShort( bf, (int)( val * 2.0f ));
|
||||
else BF_WriteShort( bf, (int)( val * 8.0f ));
|
||||
MSG_WriteShort( bf, (int)( val * 2.0f ));
|
||||
else MSG_WriteShort( bf, (int)( val * 8.0f ));
|
||||
}
|
||||
|
||||
void BF_WriteVec3Coord( sizebuf_t *bf, const float *fa )
|
||||
void MSG_WriteVec3Coord( sizebuf_t *bf, const float *fa )
|
||||
{
|
||||
BF_WriteCoord( bf, fa[0] );
|
||||
BF_WriteCoord( bf, fa[1] );
|
||||
BF_WriteCoord( bf, fa[2] );
|
||||
MSG_WriteCoord( bf, fa[0] );
|
||||
MSG_WriteCoord( bf, fa[1] );
|
||||
MSG_WriteCoord( bf, fa[2] );
|
||||
}
|
||||
|
||||
void BF_WriteBitFloat( sizebuf_t *bf, float val )
|
||||
void MSG_WriteBitFloat( sizebuf_t *bf, float val )
|
||||
{
|
||||
long intVal;
|
||||
|
||||
|
@ -289,62 +289,62 @@ void BF_WriteBitFloat( sizebuf_t *bf, float val )
|
|||
ASSERT( sizeof( float ) == 4 );
|
||||
|
||||
intVal = *((long *)&val );
|
||||
BF_WriteUBitLong( bf, intVal, 32 );
|
||||
MSG_WriteUBitLong( bf, intVal, 32 );
|
||||
}
|
||||
|
||||
void BF_WriteChar( sizebuf_t *bf, int val )
|
||||
void MSG_WriteChar( sizebuf_t *bf, int val )
|
||||
{
|
||||
BF_WriteSBitLong( bf, val, sizeof( char ) << 3 );
|
||||
MSG_WriteSBitLong( bf, val, sizeof( char ) << 3 );
|
||||
}
|
||||
|
||||
void BF_WriteByte( sizebuf_t *bf, int val )
|
||||
void MSG_WriteByte( sizebuf_t *bf, int val )
|
||||
{
|
||||
BF_WriteUBitLong( bf, val, sizeof( byte ) << 3 );
|
||||
MSG_WriteUBitLong( bf, val, sizeof( byte ) << 3 );
|
||||
}
|
||||
|
||||
void BF_WriteShort( sizebuf_t *bf, int val )
|
||||
void MSG_WriteShort( sizebuf_t *bf, int val )
|
||||
{
|
||||
BF_WriteSBitLong( bf, val, sizeof(short ) << 3 );
|
||||
MSG_WriteSBitLong( bf, val, sizeof(short ) << 3 );
|
||||
}
|
||||
|
||||
void BF_WriteWord( sizebuf_t *bf, int val )
|
||||
void MSG_WriteWord( sizebuf_t *bf, int val )
|
||||
{
|
||||
BF_WriteUBitLong( bf, val, sizeof( word ) << 3 );
|
||||
MSG_WriteUBitLong( bf, val, sizeof( word ) << 3 );
|
||||
}
|
||||
|
||||
void BF_WriteLong( sizebuf_t *bf, long val )
|
||||
void MSG_WriteLong( sizebuf_t *bf, long val )
|
||||
{
|
||||
BF_WriteSBitLong( bf, val, sizeof( long ) << 3 );
|
||||
MSG_WriteSBitLong( bf, val, sizeof( long ) << 3 );
|
||||
}
|
||||
|
||||
void BF_WriteFloat( sizebuf_t *bf, float val )
|
||||
void MSG_WriteFloat( sizebuf_t *bf, float val )
|
||||
{
|
||||
BF_WriteBits( bf, &val, sizeof( val ) << 3 );
|
||||
MSG_WriteBits( bf, &val, sizeof( val ) << 3 );
|
||||
}
|
||||
|
||||
qboolean BF_WriteBytes( sizebuf_t *bf, const void *pBuf, int nBytes )
|
||||
qboolean MSG_WriteBytes( sizebuf_t *bf, const void *pBuf, int nBytes )
|
||||
{
|
||||
return BF_WriteBits( bf, pBuf, nBytes << 3 );
|
||||
return MSG_WriteBits( bf, pBuf, nBytes << 3 );
|
||||
}
|
||||
|
||||
qboolean BF_WriteString( sizebuf_t *bf, const char *pStr )
|
||||
qboolean MSG_WriteString( sizebuf_t *bf, const char *pStr )
|
||||
{
|
||||
if( pStr )
|
||||
{
|
||||
do
|
||||
{
|
||||
BF_WriteChar( bf, *pStr );
|
||||
MSG_WriteChar( bf, *pStr );
|
||||
pStr++;
|
||||
} while( *( pStr - 1 ));
|
||||
}
|
||||
else BF_WriteChar( bf, 0 );
|
||||
else MSG_WriteChar( bf, 0 );
|
||||
|
||||
return !bf->bOverflow;
|
||||
}
|
||||
|
||||
int BF_ReadOneBit( sizebuf_t *bf )
|
||||
int MSG_ReadOneBit( sizebuf_t *bf )
|
||||
{
|
||||
if( !BF_Overflow( bf, 1 ))
|
||||
if( !MSG_Overflow( bf, 1 ))
|
||||
{
|
||||
int value = bf->pData[bf->iCurBit >> 3] & (1 << ( bf->iCurBit & 7 ));
|
||||
bf->iCurBit++;
|
||||
|
@ -353,14 +353,14 @@ int BF_ReadOneBit( sizebuf_t *bf )
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint BF_ReadUBitLong( sizebuf_t *bf, int numbits )
|
||||
uint MSG_ReadUBitLong( sizebuf_t *bf, int numbits )
|
||||
{
|
||||
int idword1;
|
||||
uint dword1, ret;
|
||||
|
||||
if( numbits == 8 )
|
||||
{
|
||||
int leftBits = BF_GetNumBitsLeft( bf );
|
||||
int leftBits = MSG_GetNumBitsLeft( bf );
|
||||
|
||||
if( leftBits >= 0 && leftBits < 8 )
|
||||
return 0; // end of message
|
||||
|
@ -401,7 +401,7 @@ uint BF_ReadUBitLong( sizebuf_t *bf, int numbits )
|
|||
return ret;
|
||||
}
|
||||
|
||||
float BF_ReadBitFloat( sizebuf_t *bf )
|
||||
float MSG_ReadBitFloat( sizebuf_t *bf )
|
||||
{
|
||||
long val;
|
||||
int bit, byte;
|
||||
|
@ -409,7 +409,7 @@ float BF_ReadBitFloat( sizebuf_t *bf )
|
|||
ASSERT( sizeof( float ) == sizeof( long ));
|
||||
ASSERT( sizeof( float ) == 4 );
|
||||
|
||||
if( BF_Overflow( bf, 32 ))
|
||||
if( MSG_Overflow( bf, 32 ))
|
||||
return 0.0f;
|
||||
|
||||
bit = bf->iCurBit & 0x7;
|
||||
|
@ -427,7 +427,7 @@ float BF_ReadBitFloat( sizebuf_t *bf )
|
|||
return *((float *)&val);
|
||||
}
|
||||
|
||||
qboolean BF_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
|
||||
qboolean MSG_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
|
||||
{
|
||||
byte *pOut = (byte *)pOutData;
|
||||
int nBitsLeft = nBits;
|
||||
|
@ -435,7 +435,7 @@ qboolean BF_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
|
|||
// get output dword-aligned.
|
||||
while((( dword )pOut & 3) != 0 && nBitsLeft >= 8 )
|
||||
{
|
||||
*pOut = (byte)BF_ReadUBitLong( bf, 8 );
|
||||
*pOut = (byte)MSG_ReadUBitLong( bf, 8 );
|
||||
++pOut;
|
||||
nBitsLeft -= 8;
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ qboolean BF_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
|
|||
// read dwords.
|
||||
while( nBitsLeft >= 32 )
|
||||
{
|
||||
*((dword *)pOut) = BF_ReadUBitLong( bf, 32 );
|
||||
*((dword *)pOut) = MSG_ReadUBitLong( bf, 32 );
|
||||
pOut += sizeof( dword );
|
||||
nBitsLeft -= 32;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ qboolean BF_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
|
|||
// read the remaining bytes.
|
||||
while( nBitsLeft >= 8 )
|
||||
{
|
||||
*pOut = BF_ReadUBitLong( bf, 8 );
|
||||
*pOut = MSG_ReadUBitLong( bf, 8 );
|
||||
++pOut;
|
||||
nBitsLeft -= 8;
|
||||
}
|
||||
|
@ -459,20 +459,20 @@ qboolean BF_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
|
|||
// read the remaining bits.
|
||||
if( nBitsLeft )
|
||||
{
|
||||
*pOut = BF_ReadUBitLong( bf, nBitsLeft );
|
||||
*pOut = MSG_ReadUBitLong( bf, nBitsLeft );
|
||||
}
|
||||
|
||||
return !bf->bOverflow;
|
||||
}
|
||||
|
||||
float BF_ReadBitAngle( sizebuf_t *bf, int numbits )
|
||||
float MSG_ReadBitAngle( sizebuf_t *bf, int numbits )
|
||||
{
|
||||
float fReturn, shift;
|
||||
int i;
|
||||
|
||||
shift = (float)( 1 << numbits );
|
||||
|
||||
i = BF_ReadUBitLong( bf, numbits );
|
||||
i = MSG_ReadUBitLong( bf, numbits );
|
||||
fReturn = (float)i * ( 360.0f / shift );
|
||||
|
||||
// clamp the finale angle
|
||||
|
@ -483,91 +483,91 @@ float BF_ReadBitAngle( sizebuf_t *bf, int numbits )
|
|||
}
|
||||
|
||||
// Append numbits least significant bits from data to the current bit stream
|
||||
int BF_ReadSBitLong( sizebuf_t *bf, int numbits )
|
||||
int MSG_ReadSBitLong( sizebuf_t *bf, int numbits )
|
||||
{
|
||||
int r, sign;
|
||||
|
||||
r = BF_ReadUBitLong( bf, numbits - 1 );
|
||||
r = MSG_ReadUBitLong( bf, 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 = BF_ReadOneBit( bf );
|
||||
sign = MSG_ReadOneBit( bf );
|
||||
if( sign ) r = -( BIT( numbits - 1 ) - r );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
uint BF_ReadBitLong( sizebuf_t *bf, int numbits, qboolean bSigned )
|
||||
uint MSG_ReadBitLong( sizebuf_t *bf, int numbits, qboolean bSigned )
|
||||
{
|
||||
if( bSigned )
|
||||
return (uint)BF_ReadSBitLong( bf, numbits );
|
||||
return BF_ReadUBitLong( bf, numbits );
|
||||
return (uint)MSG_ReadSBitLong( bf, numbits );
|
||||
return MSG_ReadUBitLong( bf, numbits );
|
||||
}
|
||||
|
||||
int BF_ReadChar( sizebuf_t *bf )
|
||||
int MSG_ReadChar( sizebuf_t *bf )
|
||||
{
|
||||
return BF_ReadSBitLong( bf, sizeof( char ) << 3 );
|
||||
return MSG_ReadSBitLong( bf, sizeof( char ) << 3 );
|
||||
}
|
||||
|
||||
int BF_ReadByte( sizebuf_t *bf )
|
||||
int MSG_ReadByte( sizebuf_t *bf )
|
||||
{
|
||||
return BF_ReadUBitLong( bf, sizeof( byte ) << 3 );
|
||||
return MSG_ReadUBitLong( bf, sizeof( byte ) << 3 );
|
||||
}
|
||||
|
||||
int BF_ReadShort( sizebuf_t *bf )
|
||||
int MSG_ReadShort( sizebuf_t *bf )
|
||||
{
|
||||
return BF_ReadSBitLong( bf, sizeof( short ) << 3 );
|
||||
return MSG_ReadSBitLong( bf, sizeof( short ) << 3 );
|
||||
}
|
||||
|
||||
int BF_ReadWord( sizebuf_t *bf )
|
||||
int MSG_ReadWord( sizebuf_t *bf )
|
||||
{
|
||||
return BF_ReadUBitLong( bf, sizeof( word ) << 3 );
|
||||
return MSG_ReadUBitLong( bf, sizeof( word ) << 3 );
|
||||
}
|
||||
|
||||
float BF_ReadCoord( sizebuf_t *bf )
|
||||
float MSG_ReadCoord( sizebuf_t *bf )
|
||||
{
|
||||
// g-cont. we loose precision here but keep old size of coord variable!
|
||||
if( host.features & ENGINE_WRITE_LARGE_COORD )
|
||||
return (float)(BF_ReadShort( bf ) * ( 1.0f / 2.0f ));
|
||||
return (float)(BF_ReadShort( bf ) * ( 1.0f / 8.0f ));
|
||||
return (float)(MSG_ReadShort( bf ) * ( 1.0f / 2.0f ));
|
||||
return (float)(MSG_ReadShort( bf ) * ( 1.0f / 8.0f ));
|
||||
}
|
||||
|
||||
void BF_ReadVec3Coord( sizebuf_t *bf, vec3_t fa )
|
||||
void MSG_ReadVec3Coord( sizebuf_t *bf, vec3_t fa )
|
||||
{
|
||||
fa[0] = BF_ReadCoord( bf );
|
||||
fa[1] = BF_ReadCoord( bf );
|
||||
fa[2] = BF_ReadCoord( bf );
|
||||
fa[0] = MSG_ReadCoord( bf );
|
||||
fa[1] = MSG_ReadCoord( bf );
|
||||
fa[2] = MSG_ReadCoord( bf );
|
||||
}
|
||||
|
||||
long BF_ReadLong( sizebuf_t *bf )
|
||||
long MSG_ReadLong( sizebuf_t *bf )
|
||||
{
|
||||
return BF_ReadSBitLong( bf, sizeof( long ) << 3 );
|
||||
return MSG_ReadSBitLong( bf, sizeof( long ) << 3 );
|
||||
}
|
||||
|
||||
float BF_ReadFloat( sizebuf_t *bf )
|
||||
float MSG_ReadFloat( sizebuf_t *bf )
|
||||
{
|
||||
float ret;
|
||||
ASSERT( sizeof( ret ) == 4 );
|
||||
|
||||
BF_ReadBits( bf, &ret, 32 );
|
||||
MSG_ReadBits( bf, &ret, 32 );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
qboolean BF_ReadBytes( sizebuf_t *bf, void *pOut, int nBytes )
|
||||
qboolean MSG_ReadBytes( sizebuf_t *bf, void *pOut, int nBytes )
|
||||
{
|
||||
return BF_ReadBits( bf, pOut, nBytes << 3 );
|
||||
return MSG_ReadBits( bf, pOut, nBytes << 3 );
|
||||
}
|
||||
|
||||
char *BF_ReadStringExt( sizebuf_t *bf, qboolean bLine )
|
||||
char *MSG_ReadStringExt( sizebuf_t *bf, qboolean bLine )
|
||||
{
|
||||
static char string[MAX_SYSPATH];
|
||||
int l = 0, c;
|
||||
|
||||
do
|
||||
{
|
||||
// use BF_ReadByte so -1 is out of bounds
|
||||
c = BF_ReadByte( bf );
|
||||
// use MSG_ReadByte so -1 is out of bounds
|
||||
c = MSG_ReadByte( bf );
|
||||
|
||||
if( c == 0 ) break;
|
||||
else if( bLine && c == '\n' )
|
||||
|
@ -585,20 +585,20 @@ char *BF_ReadStringExt( sizebuf_t *bf, qboolean bLine )
|
|||
return string;
|
||||
}
|
||||
|
||||
void BF_ExciseBits( sizebuf_t *bf, int startbit, int bitstoremove )
|
||||
void MSG_ExciseBits( sizebuf_t *bf, int startbit, int bitstoremove )
|
||||
{
|
||||
int i, endbit = startbit + bitstoremove;
|
||||
int remaining_to_end = bf->nDataBits - endbit;
|
||||
sizebuf_t temp;
|
||||
|
||||
BF_StartWriting( &temp, bf->pData, bf->nDataBits << 3, startbit, -1 );
|
||||
BF_SeekToBit( bf, endbit );
|
||||
MSG_StartWriting( &temp, bf->pData, bf->nDataBits << 3, startbit, -1 );
|
||||
MSG_SeekToBit( bf, endbit );
|
||||
|
||||
for( i = 0; i < remaining_to_end; i++ )
|
||||
{
|
||||
BF_WriteOneBit( &temp, BF_ReadOneBit( bf ));
|
||||
MSG_WriteOneBit( &temp, MSG_ReadOneBit( bf ));
|
||||
}
|
||||
|
||||
BF_SeekToBit( bf, startbit );
|
||||
MSG_SeekToBit( bf, startbit );
|
||||
bf->nDataBits -= bitstoremove;
|
||||
}
|
|
@ -45,80 +45,80 @@ typedef struct sizebuf_s
|
|||
int nDataBits;
|
||||
} sizebuf_t;
|
||||
|
||||
#define BF_WriteUBitLong( bf, data, bits ) BF_WriteUBitLongExt( bf, data, bits, true );
|
||||
#define BF_StartReading BF_StartWriting
|
||||
#define BF_GetNumBytesRead BF_GetNumBytesWritten
|
||||
#define BF_GetRealBytesRead BF_GetRealBytesWritten
|
||||
#define BF_GetNumBitsRead BF_GetNumBitsWritten
|
||||
#define BF_ReadBitAngles BF_ReadBitVec3Coord
|
||||
#define BF_ReadString( bf ) BF_ReadStringExt( bf, false )
|
||||
#define BF_ReadStringLine( bf ) BF_ReadStringExt( bf, true )
|
||||
#define BF_ReadAngle( bf ) (float)(BF_ReadChar( bf ) * ( 360.0f / 256.0f ))
|
||||
#define BF_Init( bf, name, data, bytes ) BF_InitExt( bf, name, data, bytes, -1 )
|
||||
#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
|
||||
#define MSG_GetNumBitsRead MSG_GetNumBitsWritten
|
||||
#define MSG_ReadBitAngles MSG_ReadBitVec3Coord
|
||||
#define MSG_ReadString( bf ) MSG_ReadStringExt( bf, false )
|
||||
#define MSG_ReadStringLine( bf ) MSG_ReadStringExt( bf, true )
|
||||
#define MSG_ReadAngle( bf ) (float)(MSG_ReadChar( bf ) * ( 360.0f / 256.0f ))
|
||||
#define MSG_Init( bf, name, data, bytes ) MSG_InitExt( bf, name, data, bytes, -1 )
|
||||
|
||||
// common functions
|
||||
void BF_InitExt( sizebuf_t *bf, const char *pDebugName, void *pData, int nBytes, int nMaxBits );
|
||||
void BF_InitMasks( void ); // called once at startup engine
|
||||
void BF_SeekToBit( sizebuf_t *bf, int bitPos );
|
||||
void BF_SeekToByte( sizebuf_t *bf, int bytePos );
|
||||
void BF_ExciseBits( sizebuf_t *bf, int startbit, int bitstoremove );
|
||||
qboolean BF_CheckOverflow( sizebuf_t *bf );
|
||||
short BF_BigShort( short swap );
|
||||
void MSG_InitExt( sizebuf_t *bf, const char *pDebugName, void *pData, int nBytes, int nMaxBits );
|
||||
void MSG_InitMasks( void ); // called once at startup engine
|
||||
void MSG_SeekToBit( sizebuf_t *bf, int bitPos );
|
||||
void MSG_SeekToByte( sizebuf_t *bf, int bytePos );
|
||||
void MSG_ExciseBits( sizebuf_t *bf, int startbit, int bitstoremove );
|
||||
qboolean MSG_CheckOverflow( sizebuf_t *bf );
|
||||
short MSG_BigShort( short swap );
|
||||
|
||||
// init writing
|
||||
void BF_StartWriting( sizebuf_t *bf, void *pData, int nBytes, int iStartBit, int nBits );
|
||||
void BF_Clear( sizebuf_t *bf );
|
||||
void MSG_StartWriting( sizebuf_t *bf, void *pData, int nBytes, int iStartBit, int nBits );
|
||||
void MSG_Clear( sizebuf_t *bf );
|
||||
|
||||
// Bit-write functions
|
||||
void BF_WriteOneBit( sizebuf_t *bf, int nValue );
|
||||
void BF_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, qboolean bCheckRange );
|
||||
void BF_WriteSBitLong( sizebuf_t *bf, int data, int numbits );
|
||||
void BF_WriteBitLong( sizebuf_t *bf, uint data, int numbits, qboolean bSigned );
|
||||
qboolean BF_WriteBits( sizebuf_t *bf, const void *pData, int nBits );
|
||||
void BF_WriteBitAngle( sizebuf_t *bf, float fAngle, int numbits );
|
||||
void BF_WriteBitFloat( sizebuf_t *bf, float val );
|
||||
void MSG_WriteOneBit( sizebuf_t *bf, int nValue );
|
||||
void MSG_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, qboolean bCheckRange );
|
||||
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 );
|
||||
void MSG_WriteBitAngle( sizebuf_t *bf, float fAngle, int numbits );
|
||||
void MSG_WriteBitFloat( sizebuf_t *bf, float val );
|
||||
|
||||
// Byte-write functions
|
||||
void BF_WriteChar( sizebuf_t *bf, int val );
|
||||
void BF_WriteByte( sizebuf_t *bf, int val );
|
||||
void BF_WriteShort( sizebuf_t *bf, int val );
|
||||
void BF_WriteWord( sizebuf_t *bf, int val );
|
||||
void BF_WriteLong( sizebuf_t *bf, long val );
|
||||
void BF_WriteCoord( sizebuf_t *bf, float val );
|
||||
void BF_WriteFloat( sizebuf_t *bf, float val );
|
||||
void BF_WriteVec3Coord( sizebuf_t *bf, const float *fa );
|
||||
qboolean BF_WriteBytes( sizebuf_t *bf, const void *pBuf, int nBytes ); // same as MSG_WriteData
|
||||
qboolean BF_WriteString( sizebuf_t *bf, const char *pStr ); // returns false if it overflows the buffer.
|
||||
void MSG_WriteChar( sizebuf_t *bf, int val );
|
||||
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_WriteCoord( sizebuf_t *bf, float val );
|
||||
void MSG_WriteFloat( sizebuf_t *bf, float val );
|
||||
void MSG_WriteVec3Coord( sizebuf_t *bf, const float *fa );
|
||||
qboolean MSG_WriteBytes( sizebuf_t *bf, const void *pBuf, int nBytes ); // same as MSG_WriteData
|
||||
qboolean MSG_WriteString( sizebuf_t *bf, const char *pStr ); // returns false if it overflows the buffer.
|
||||
|
||||
// helper functions
|
||||
_inline int BF_GetNumBytesWritten( sizebuf_t *bf ) { return BitByte( bf->iCurBit ); }
|
||||
_inline int BF_GetRealBytesWritten( sizebuf_t *bf ) { return bf->iCurBit >> 3; } // unpadded
|
||||
_inline int BF_GetNumBitsWritten( sizebuf_t *bf ) { return bf->iCurBit; }
|
||||
_inline int BF_GetMaxBits( sizebuf_t *bf ) { return bf->nDataBits; }
|
||||
_inline int BF_GetMaxBytes( sizebuf_t *bf ) { return bf->nDataBits >> 3; }
|
||||
_inline int BF_GetNumBitsLeft( sizebuf_t *bf ) { return bf->nDataBits - bf->iCurBit; }
|
||||
_inline int BF_GetNumBytesLeft( sizebuf_t *bf ) { return BF_GetNumBitsLeft( bf ) >> 3; }
|
||||
_inline byte *BF_GetData( sizebuf_t *bf ) { return bf->pData; }
|
||||
_inline int MSG_GetNumBytesWritten( sizebuf_t *bf ) { return BitByte( bf->iCurBit ); }
|
||||
_inline int MSG_GetRealBytesWritten( sizebuf_t *bf ) { return bf->iCurBit >> 3; } // unpadded
|
||||
_inline int MSG_GetNumBitsWritten( sizebuf_t *bf ) { return bf->iCurBit; }
|
||||
_inline int MSG_GetMaxBits( sizebuf_t *bf ) { return bf->nDataBits; }
|
||||
_inline int MSG_GetMaxBytes( sizebuf_t *bf ) { return bf->nDataBits >> 3; }
|
||||
_inline int MSG_GetNumBitsLeft( sizebuf_t *bf ) { return bf->nDataBits - bf->iCurBit; }
|
||||
_inline int MSG_GetNumBytesLeft( sizebuf_t *bf ) { return MSG_GetNumBitsLeft( bf ) >> 3; }
|
||||
_inline byte *MSG_GetData( sizebuf_t *bf ) { return bf->pData; }
|
||||
|
||||
// Bit-read functions
|
||||
int BF_ReadOneBit( sizebuf_t *bf );
|
||||
float BF_ReadBitFloat( sizebuf_t *bf );
|
||||
qboolean BF_ReadBits( sizebuf_t *bf, void *pOutData, int nBits );
|
||||
float BF_ReadBitAngle( sizebuf_t *bf, int numbits );
|
||||
int BF_ReadSBitLong( sizebuf_t *bf, int numbits );
|
||||
uint BF_ReadUBitLong( sizebuf_t *bf, int numbits );
|
||||
uint BF_ReadBitLong( sizebuf_t *bf, int numbits, qboolean bSigned );
|
||||
int MSG_ReadOneBit( sizebuf_t *bf );
|
||||
float MSG_ReadBitFloat( sizebuf_t *bf );
|
||||
qboolean MSG_ReadBits( sizebuf_t *bf, void *pOutData, int nBits );
|
||||
float MSG_ReadBitAngle( sizebuf_t *bf, int numbits );
|
||||
int MSG_ReadSBitLong( sizebuf_t *bf, int numbits );
|
||||
uint MSG_ReadUBitLong( sizebuf_t *bf, int numbits );
|
||||
uint MSG_ReadBitLong( sizebuf_t *bf, int numbits, qboolean bSigned );
|
||||
|
||||
// Byte-read functions
|
||||
int BF_ReadChar( sizebuf_t *bf );
|
||||
int BF_ReadByte( sizebuf_t *bf );
|
||||
int BF_ReadShort( sizebuf_t *bf );
|
||||
int BF_ReadWord( sizebuf_t *bf );
|
||||
long BF_ReadLong( sizebuf_t *bf );
|
||||
float BF_ReadCoord( sizebuf_t *bf );
|
||||
float BF_ReadFloat( sizebuf_t *bf );
|
||||
void BF_ReadVec3Coord( sizebuf_t *bf, vec3_t fa );
|
||||
qboolean BF_ReadBytes( sizebuf_t *bf, void *pOut, int nBytes );
|
||||
char *BF_ReadStringExt( sizebuf_t *bf, qboolean bLine );
|
||||
int MSG_ReadChar( sizebuf_t *bf );
|
||||
int MSG_ReadByte( sizebuf_t *bf );
|
||||
int MSG_ReadShort( sizebuf_t *bf );
|
||||
int MSG_ReadWord( sizebuf_t *bf );
|
||||
long MSG_ReadLong( sizebuf_t *bf );
|
||||
float MSG_ReadCoord( sizebuf_t *bf );
|
||||
float MSG_ReadFloat( sizebuf_t *bf );
|
||||
void MSG_ReadVec3Coord( sizebuf_t *bf, vec3_t fa );
|
||||
qboolean MSG_ReadBytes( sizebuf_t *bf, void *pOut, int nBytes );
|
||||
char *MSG_ReadStringExt( sizebuf_t *bf, qboolean bLine );
|
||||
|
||||
#endif//NET_BUFFER_H
|
|
@ -54,7 +54,7 @@ the retransmit has been acknowledged and the reliable still failed to get there.
|
|||
if the sequence number is -1, the packet should be handled without a netcon
|
||||
|
||||
The reliable message can be added to at any time by doing
|
||||
BF_Write* (&netchan->message, <data>).
|
||||
MSG_Write* (&netchan->message, <data>).
|
||||
|
||||
If the message buffer is overflowed, either by a single message, or by
|
||||
multiple frames worth piling up while the last reliable transmit goes
|
||||
|
@ -122,7 +122,7 @@ void Netchan_Init( void )
|
|||
net_mempool = Mem_AllocPool( "Network Pool" );
|
||||
|
||||
Huff_Init (); // initialize huffman compression
|
||||
BF_InitMasks (); // initialize bit-masks
|
||||
MSG_InitMasks (); // initialize bit-masks
|
||||
}
|
||||
|
||||
void Netchan_Shutdown( void )
|
||||
|
@ -166,7 +166,7 @@ void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport )
|
|||
chan->compress = false; // work but low efficiency
|
||||
chan->qport = qport;
|
||||
|
||||
BF_Init( &chan->message, "NetData", chan->message_buf, sizeof( chan->message_buf ));
|
||||
MSG_Init( &chan->message, "NetData", chan->message_buf, sizeof( chan->message_buf ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -348,15 +348,15 @@ void Netchan_OutOfBand( int net_socket, netadr_t adr, int length, byte *data )
|
|||
byte send_buf[NET_MAX_PAYLOAD];
|
||||
|
||||
// write the packet header
|
||||
BF_Init( &send, "SequencePacket", send_buf, sizeof( send_buf ));
|
||||
MSG_Init( &send, "SequencePacket", send_buf, sizeof( send_buf ));
|
||||
|
||||
BF_WriteLong( &send, -1 ); // -1 sequence means out of band
|
||||
BF_WriteBytes( &send, data, length );
|
||||
MSG_WriteLong( &send, -1 ); // -1 sequence means out of band
|
||||
MSG_WriteBytes( &send, data, length );
|
||||
|
||||
if( !CL_IsPlaybackDemo( ))
|
||||
{
|
||||
// send the datagram
|
||||
NET_SendPacket( net_socket, BF_GetNumBytesWritten( &send ), BF_GetData( &send ), adr );
|
||||
NET_SendPacket( net_socket, MSG_GetNumBytesWritten( &send ), MSG_GetData( &send ), adr );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ fragbuf_t *Netchan_AllocFragbuf( void )
|
|||
fragbuf_t *buf;
|
||||
|
||||
buf = (fragbuf_t *)Mem_Alloc( net_mempool, sizeof( fragbuf_t ));
|
||||
BF_Init( &buf->frag_message, "Frag Message", buf->frag_message_buf, sizeof( buf->frag_message_buf ));
|
||||
MSG_Init( &buf->frag_message, "Frag Message", buf->frag_message_buf, sizeof( buf->frag_message_buf ));
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -579,14 +579,14 @@ void Netchan_CreateFragments_( qboolean server, netchan_t *chan, sizebuf_t *msg
|
|||
int bufferid = 1;
|
||||
fragbufwaiting_t *wait, *p;
|
||||
|
||||
if( BF_GetNumBytesWritten( msg ) == 0 )
|
||||
if( MSG_GetNumBytesWritten( msg ) == 0 )
|
||||
return;
|
||||
|
||||
chunksize = bound( 16, net_blocksize->integer, 1400 );
|
||||
|
||||
wait = (fragbufwaiting_t *)Mem_Alloc( net_mempool, sizeof( fragbufwaiting_t ));
|
||||
|
||||
remaining = BF_GetNumBytesWritten( msg );
|
||||
remaining = MSG_GetNumBytesWritten( msg );
|
||||
pos = 0;
|
||||
|
||||
while( remaining > 0 )
|
||||
|
@ -598,8 +598,8 @@ void Netchan_CreateFragments_( qboolean server, netchan_t *chan, sizebuf_t *msg
|
|||
buf->bufferid = bufferid++;
|
||||
|
||||
// Copy in data
|
||||
BF_Clear( &buf->frag_message );
|
||||
BF_WriteBits( &buf->frag_message, msg->pData + pos, send << 3 );
|
||||
MSG_Clear( &buf->frag_message );
|
||||
MSG_WriteBits( &buf->frag_message, msg->pData + pos, send << 3 );
|
||||
pos += send;
|
||||
|
||||
Netchan_AddFragbufToTail( wait, buf );
|
||||
|
@ -632,10 +632,10 @@ Netchan_CreateFragments
|
|||
void Netchan_CreateFragments( qboolean server, netchan_t *chan, sizebuf_t *msg )
|
||||
{
|
||||
// always queue any pending reliable data ahead of the fragmentation buffer
|
||||
if( BF_GetNumBytesWritten( &chan->message ) > 0 )
|
||||
if( MSG_GetNumBytesWritten( &chan->message ) > 0 )
|
||||
{
|
||||
Netchan_CreateFragments_( server, chan, &chan->message );
|
||||
BF_Clear( &chan->message );
|
||||
MSG_Clear( &chan->message );
|
||||
}
|
||||
|
||||
Netchan_CreateFragments_( server, chan, msg );
|
||||
|
@ -691,7 +691,7 @@ void Netchan_CheckForCompletion( netchan_t *chan, int stream, int intotalbuffers
|
|||
|
||||
while( p )
|
||||
{
|
||||
size += BF_GetNumBytesWritten( &p->frag_message );
|
||||
size += MSG_GetNumBytesWritten( &p->frag_message );
|
||||
c++;
|
||||
|
||||
id = FRAG_GETID( p->bufferid );
|
||||
|
@ -745,17 +745,17 @@ void Netchan_CreateFileFragmentsFromBuffer( qboolean server, netchan_t *chan, ch
|
|||
buf->bufferid = bufferid++;
|
||||
|
||||
// copy in data
|
||||
BF_Clear( &buf->frag_message );
|
||||
MSG_Clear( &buf->frag_message );
|
||||
|
||||
if( firstfragment )
|
||||
{
|
||||
firstfragment = false;
|
||||
|
||||
// write filename
|
||||
BF_WriteString( &buf->frag_message, filename );
|
||||
MSG_WriteString( &buf->frag_message, filename );
|
||||
|
||||
// send a bit less on first package
|
||||
send -= BF_GetNumBytesWritten( &buf->frag_message );
|
||||
send -= MSG_GetNumBytesWritten( &buf->frag_message );
|
||||
}
|
||||
|
||||
buf->isbuffer = true;
|
||||
|
@ -763,7 +763,7 @@ void Netchan_CreateFileFragmentsFromBuffer( qboolean server, netchan_t *chan, ch
|
|||
buf->size = send;
|
||||
buf->foffset = pos;
|
||||
|
||||
BF_WriteBits( &buf->frag_message, pbuf + pos, send << 3 );
|
||||
MSG_WriteBits( &buf->frag_message, pbuf + pos, send << 3 );
|
||||
|
||||
pos += send;
|
||||
remaining -= send;
|
||||
|
@ -826,17 +826,17 @@ int Netchan_CreateFileFragments( qboolean server, netchan_t *chan, const char *f
|
|||
buf->bufferid = bufferid++;
|
||||
|
||||
// copy in data
|
||||
BF_Clear( &buf->frag_message );
|
||||
MSG_Clear( &buf->frag_message );
|
||||
|
||||
if( firstfragment )
|
||||
{
|
||||
firstfragment = false;
|
||||
|
||||
// Write filename
|
||||
BF_WriteString( &buf->frag_message, filename );
|
||||
MSG_WriteString( &buf->frag_message, filename );
|
||||
|
||||
// Send a bit less on first package
|
||||
send -= BF_GetNumBytesWritten( &buf->frag_message );
|
||||
send -= MSG_GetNumBytesWritten( &buf->frag_message );
|
||||
}
|
||||
|
||||
buf->isfile = true;
|
||||
|
@ -879,7 +879,7 @@ void Netchan_FlushIncoming( netchan_t *chan, int stream )
|
|||
{
|
||||
fragbuf_t *p, *n;
|
||||
|
||||
BF_Clear( &net_message );
|
||||
MSG_Clear( &net_message );
|
||||
|
||||
p = chan->incomingbufs[ stream ];
|
||||
while( p )
|
||||
|
@ -914,14 +914,14 @@ qboolean Netchan_CopyNormalFragments( netchan_t *chan, sizebuf_t *msg )
|
|||
|
||||
p = chan->incomingbufs[FRAG_NORMAL_STREAM];
|
||||
|
||||
BF_Init( msg, "NetMessage", net_message_buffer, sizeof( net_message_buffer ));
|
||||
MSG_Init( msg, "NetMessage", net_message_buffer, sizeof( net_message_buffer ));
|
||||
|
||||
while( p )
|
||||
{
|
||||
n = p->next;
|
||||
|
||||
// copy it in
|
||||
BF_WriteBits( msg, BF_GetData( &p->frag_message ), BF_GetNumBitsWritten( &p->frag_message ));
|
||||
MSG_WriteBits( msg, MSG_GetData( &p->frag_message ), MSG_GetNumBitsWritten( &p->frag_message ));
|
||||
|
||||
Mem_Free( p );
|
||||
p = n;
|
||||
|
@ -961,13 +961,13 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
|
|||
|
||||
p = chan->incomingbufs[FRAG_FILE_STREAM];
|
||||
|
||||
BF_Init( msg, "NetMessage", net_message_buffer, sizeof( net_message_buffer ));
|
||||
MSG_Init( msg, "NetMessage", net_message_buffer, sizeof( net_message_buffer ));
|
||||
|
||||
// copy in first chunk so we can get filename out
|
||||
BF_WriteBits( msg, BF_GetData( &p->frag_message ), BF_GetNumBitsWritten( &p->frag_message ));
|
||||
BF_SeekToBit( msg, 0 ); // rewind buffer
|
||||
MSG_WriteBits( msg, MSG_GetData( &p->frag_message ), MSG_GetNumBitsWritten( &p->frag_message ));
|
||||
MSG_SeekToBit( msg, 0 ); // rewind buffer
|
||||
|
||||
Q_strncpy( filename, BF_ReadString( msg ), sizeof( filename ));
|
||||
Q_strncpy( filename, MSG_ReadString( msg ), sizeof( filename ));
|
||||
|
||||
if( Q_strlen( filename ) <= 0 )
|
||||
{
|
||||
|
@ -1001,10 +1001,10 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
|
|||
nsize = 0;
|
||||
while ( p )
|
||||
{
|
||||
nsize += BF_GetNumBytesWritten( &p->frag_message ); // Size will include a bit of slop, oh well
|
||||
nsize += MSG_GetNumBytesWritten( &p->frag_message ); // Size will include a bit of slop, oh well
|
||||
if( p == chan->incomingbufs[FRAG_FILE_STREAM] )
|
||||
{
|
||||
nsize -= BF_GetNumBytesRead( msg );
|
||||
nsize -= MSG_GetNumBytesRead( msg );
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
|
@ -1019,15 +1019,15 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
|
|||
|
||||
n = p->next;
|
||||
|
||||
cursize = BF_GetNumBytesWritten( &p->frag_message );
|
||||
cursize = MSG_GetNumBytesWritten( &p->frag_message );
|
||||
|
||||
// first message has the file name, don't write that into the data stream,
|
||||
// just write the rest of the actual data
|
||||
if( p == chan->incomingbufs[FRAG_FILE_STREAM] )
|
||||
{
|
||||
// copy it in
|
||||
cursize -= BF_GetNumBytesRead( msg );
|
||||
Q_memcpy( &buffer[pos], &p->frag_message.pData[BF_GetNumBytesRead( msg )], cursize );
|
||||
cursize -= MSG_GetNumBytesRead( msg );
|
||||
Q_memcpy( &buffer[pos], &p->frag_message.pData[MSG_GetNumBytesRead( msg )], cursize );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1044,7 +1044,7 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
|
|||
Mem_Free( buffer );
|
||||
|
||||
// clear remnants
|
||||
BF_Clear( msg );
|
||||
MSG_Clear( msg );
|
||||
|
||||
chan->incomingbufs[FRAG_FILE_STREAM] = NULL;
|
||||
|
||||
|
@ -1116,7 +1116,7 @@ void Netchan_UpdateProgress( netchan_t *chan )
|
|||
char *in, *out;
|
||||
int len = 0;
|
||||
|
||||
in = (char *)BF_GetData( &p->frag_message );
|
||||
in = (char *)MSG_GetData( &p->frag_message );
|
||||
out = sz;
|
||||
|
||||
while( *in )
|
||||
|
@ -1173,7 +1173,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
|
||||
// check for message overflow
|
||||
// check for message overflow
|
||||
if( BF_CheckOverflow( &chan->message ))
|
||||
if( MSG_CheckOverflow( &chan->message ))
|
||||
{
|
||||
MsgDev( D_ERROR, "%s:outgoing message overflow\n", NET_AdrToString( chan->remote_address ));
|
||||
return;
|
||||
|
@ -1208,7 +1208,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
Netchan_FragSend( chan );
|
||||
|
||||
// sending regular payload
|
||||
send_from_regular = BF_GetNumBytesWritten( &chan->message ) ? 1 : 0;
|
||||
send_from_regular = MSG_GetNumBytesWritten( &chan->message ) ? 1 : 0;
|
||||
|
||||
// check to see if we are sending a frag payload
|
||||
for( i = 0; i < MAX_STREAMS; i++ )
|
||||
|
@ -1225,10 +1225,10 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
send_from_regular = false;
|
||||
|
||||
// if the reliable buffer has gotten too big, queue it at the end of everything and clear out buffer
|
||||
if( BF_GetNumBytesWritten( &chan->message ) > MAX_RELIABLE_PAYLOAD )
|
||||
if( MSG_GetNumBytesWritten( &chan->message ) > MAX_RELIABLE_PAYLOAD )
|
||||
{
|
||||
Netchan_CreateFragments(( chan->sock == NS_SERVER ), chan, &chan->message );
|
||||
BF_Clear( &chan->message );
|
||||
MSG_Clear( &chan->message );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1256,9 +1256,9 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
|
||||
if( send_from_regular )
|
||||
{
|
||||
Q_memcpy( chan->reliable_buf, chan->message_buf, BF_GetNumBytesWritten( &chan->message ));
|
||||
chan->reliable_length = BF_GetNumBitsWritten( &chan->message );
|
||||
BF_Clear( &chan->message );
|
||||
Q_memcpy( chan->reliable_buf, chan->message_buf, MSG_GetNumBytesWritten( &chan->message ));
|
||||
chan->reliable_length = MSG_GetNumBitsWritten( &chan->message );
|
||||
MSG_Clear( &chan->message );
|
||||
|
||||
// if we send fragments, this is where they'll start
|
||||
for( i = 0; i < MAX_STREAMS; i++ )
|
||||
|
@ -1278,7 +1278,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
|
||||
if( pbuf )
|
||||
{
|
||||
fragment_size = BF_GetNumBytesWritten( &pbuf->frag_message );
|
||||
fragment_size = MSG_GetNumBytesWritten( &pbuf->frag_message );
|
||||
|
||||
// files set size a bit differently.
|
||||
if( pbuf->isfile && !pbuf->isbuffer )
|
||||
|
@ -1307,17 +1307,17 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
FS_Seek( hfile, pbuf->foffset, SEEK_SET );
|
||||
FS_Read( hfile, filebuffer, pbuf->size );
|
||||
|
||||
BF_WriteBits( &pbuf->frag_message, filebuffer, pbuf->size << 3 );
|
||||
MSG_WriteBits( &pbuf->frag_message, filebuffer, pbuf->size << 3 );
|
||||
FS_Close( hfile );
|
||||
}
|
||||
|
||||
// copy frag stuff on top of current buffer
|
||||
BF_StartWriting( &temp, chan->reliable_buf, sizeof( chan->reliable_buf ), chan->reliable_length, -1 );
|
||||
MSG_StartWriting( &temp, chan->reliable_buf, sizeof( chan->reliable_buf ), chan->reliable_length, -1 );
|
||||
|
||||
BF_WriteBits( &temp, BF_GetData( &pbuf->frag_message ), BF_GetNumBitsWritten( &pbuf->frag_message ));
|
||||
MSG_WriteBits( &temp, MSG_GetData( &pbuf->frag_message ), MSG_GetNumBitsWritten( &pbuf->frag_message ));
|
||||
|
||||
chan->reliable_length += BF_GetNumBitsWritten( &pbuf->frag_message );
|
||||
chan->frag_length[i] = BF_GetNumBitsWritten( &pbuf->frag_message );
|
||||
chan->reliable_length += MSG_GetNumBitsWritten( &pbuf->frag_message );
|
||||
chan->frag_length[i] = MSG_GetNumBitsWritten( &pbuf->frag_message );
|
||||
|
||||
// unlink pbuf
|
||||
Netchan_UnlinkFragment( pbuf, &chan->fragbufs[i] );
|
||||
|
@ -1333,7 +1333,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
}
|
||||
}
|
||||
|
||||
BF_Init( &send, "NetSend", send_buf, sizeof( send_buf ));
|
||||
MSG_Init( &send, "NetSend", send_buf, sizeof( send_buf ));
|
||||
|
||||
// prepare the packet header
|
||||
w1 = chan->outgoing_sequence | (send_reliable << 31);
|
||||
|
@ -1358,13 +1358,13 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
chan->outgoing_sequence++;
|
||||
chan->last_sent = host.realtime;
|
||||
|
||||
BF_WriteLong( &send, w1 );
|
||||
BF_WriteLong( &send, w2 );
|
||||
MSG_WriteLong( &send, w1 );
|
||||
MSG_WriteLong( &send, w2 );
|
||||
|
||||
// send the qport if we are a client
|
||||
if( chan->sock == NS_CLIENT )
|
||||
{
|
||||
BF_WriteWord( &send, Cvar_VariableValue( "net_qport" ));
|
||||
MSG_WriteWord( &send, Cvar_VariableValue( "net_qport" ));
|
||||
}
|
||||
|
||||
if( send_reliable && send_reliable_fragment )
|
||||
|
@ -1373,31 +1373,31 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
{
|
||||
if( chan->reliable_fragment[i] )
|
||||
{
|
||||
BF_WriteByte( &send, 1 );
|
||||
BF_WriteLong( &send, chan->reliable_fragid[i] );
|
||||
BF_WriteLong( &send, chan->frag_startpos[i] );
|
||||
BF_WriteLong( &send, chan->frag_length[i] );
|
||||
MSG_WriteByte( &send, 1 );
|
||||
MSG_WriteLong( &send, chan->reliable_fragid[i] );
|
||||
MSG_WriteLong( &send, chan->frag_startpos[i] );
|
||||
MSG_WriteLong( &send, chan->frag_length[i] );
|
||||
}
|
||||
else
|
||||
{
|
||||
BF_WriteByte( &send, 0 );
|
||||
MSG_WriteByte( &send, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hdr_size = BF_GetNumBytesWritten( &send );
|
||||
hdr_size = MSG_GetNumBytesWritten( &send );
|
||||
|
||||
// copy the reliable message to the packet first
|
||||
if( send_reliable )
|
||||
{
|
||||
BF_WriteBits( &send, chan->reliable_buf, chan->reliable_length );
|
||||
MSG_WriteBits( &send, chan->reliable_buf, chan->reliable_length );
|
||||
chan->last_reliable_sequence = chan->outgoing_sequence - 1;
|
||||
}
|
||||
|
||||
// is there room for the unreliable payload?
|
||||
if( BF_GetNumBitsLeft( &send ) >= length )
|
||||
if( MSG_GetNumBitsLeft( &send ) >= length )
|
||||
{
|
||||
BF_WriteBits( &send, data, length );
|
||||
MSG_WriteBits( &send, data, length );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1405,28 +1405,28 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
}
|
||||
|
||||
// deal with packets that are too small for some networks
|
||||
if( BF_GetNumBytesWritten( &send ) < 16 ) // packet too small for some networks
|
||||
if( MSG_GetNumBytesWritten( &send ) < 16 ) // packet too small for some networks
|
||||
{
|
||||
int i;
|
||||
|
||||
// go ahead and pad a full 16 extra bytes -- this only happens during authentication / signon
|
||||
for( i = BF_GetNumBytesWritten( &send ); i < 16; i++ )
|
||||
for( i = MSG_GetNumBytesWritten( &send ); i < 16; i++ )
|
||||
{
|
||||
// NOTE: that the server can parse svc_nop, too.
|
||||
BF_WriteByte( &send, 1 );
|
||||
MSG_WriteByte( &send, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
chan->flow[FLOW_OUTGOING].stats[chan->flow[FLOW_OUTGOING].current & ( MAX_LATENT-1 )].size = BF_GetNumBytesWritten( &send ) + UDP_HEADER_SIZE;
|
||||
chan->flow[FLOW_OUTGOING].stats[chan->flow[FLOW_OUTGOING].current & ( MAX_LATENT-1 )].size = MSG_GetNumBytesWritten( &send ) + UDP_HEADER_SIZE;
|
||||
chan->flow[FLOW_OUTGOING].stats[chan->flow[FLOW_OUTGOING].current & ( MAX_LATENT-1 )].time = host.realtime;
|
||||
chan->flow[FLOW_OUTGOING].totalbytes += ( BF_GetNumBytesWritten( &send ) + UDP_HEADER_SIZE );
|
||||
chan->flow[FLOW_OUTGOING].totalbytes += ( MSG_GetNumBytesWritten( &send ) + UDP_HEADER_SIZE );
|
||||
chan->flow[FLOW_OUTGOING].current++;
|
||||
|
||||
Netchan_UpdateFlow( chan );
|
||||
|
||||
size1 = BF_GetNumBytesWritten( &send );
|
||||
size1 = MSG_GetNumBytesWritten( &send );
|
||||
if( chan->compress ) Huff_CompressPacket( &send, hdr_size );
|
||||
size2 = BF_GetNumBytesWritten( &send );
|
||||
size2 = MSG_GetNumBytesWritten( &send );
|
||||
|
||||
chan->total_sended += size2;
|
||||
chan->total_sended_uncompressed += size1;
|
||||
|
@ -1434,7 +1434,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
// send the datagram
|
||||
if( !CL_IsPlaybackDemo( ))
|
||||
{
|
||||
NET_SendPacket( chan->sock, BF_GetNumBytesWritten( &send ), BF_GetData( &send ), chan->remote_address );
|
||||
NET_SendPacket( chan->sock, MSG_GetNumBytesWritten( &send ), MSG_GetData( &send ), chan->remote_address );
|
||||
}
|
||||
|
||||
fRate = 1.0f / chan->rate;
|
||||
|
@ -1444,7 +1444,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
chan->cleartime = host.realtime;
|
||||
}
|
||||
|
||||
chan->cleartime += ( BF_GetNumBytesWritten( &send ) + UDP_HEADER_SIZE ) * fRate;
|
||||
chan->cleartime += ( MSG_GetNumBytesWritten( &send ) + UDP_HEADER_SIZE ) * fRate;
|
||||
|
||||
if( net_showpackets->integer == 1 )
|
||||
{
|
||||
|
@ -1455,7 +1455,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
|||
|
||||
Msg( " %c --> sz=%i seq=%i ack=%i rel=%i tm=%f\n"
|
||||
, c
|
||||
, BF_GetNumBytesWritten( &send )
|
||||
, MSG_GetNumBytesWritten( &send )
|
||||
, ( chan->outgoing_sequence - 1 ) & mask
|
||||
, chan->incoming_sequence & mask
|
||||
, send_reliable ? 1 : 0
|
||||
|
@ -1504,14 +1504,14 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
|
|||
}
|
||||
|
||||
// get sequence numbers
|
||||
BF_Clear( msg );
|
||||
sequence = BF_ReadLong( msg );
|
||||
sequence_ack = BF_ReadLong( msg );
|
||||
MSG_Clear( msg );
|
||||
sequence = MSG_ReadLong( msg );
|
||||
sequence_ack = MSG_ReadLong( msg );
|
||||
|
||||
// read the qport if we are a server
|
||||
if( chan->sock == NS_SERVER )
|
||||
{
|
||||
qport = BF_ReadShort( msg );
|
||||
qport = MSG_ReadShort( msg );
|
||||
}
|
||||
|
||||
reliable_message = sequence >> 31;
|
||||
|
@ -1523,12 +1523,12 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
|
|||
{
|
||||
for( i = 0; i < MAX_STREAMS; i++ )
|
||||
{
|
||||
if( BF_ReadByte( msg ))
|
||||
if( MSG_ReadByte( msg ))
|
||||
{
|
||||
frag_message[i] = true;
|
||||
fragid[i] = BF_ReadLong( msg );
|
||||
frag_offset[i] = (int)BF_ReadLong( msg );
|
||||
frag_length[i] = (int)BF_ReadLong( msg );
|
||||
fragid[i] = MSG_ReadLong( msg );
|
||||
frag_offset[i] = (int)MSG_ReadLong( msg );
|
||||
frag_length[i] = (int)MSG_ReadLong( msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1545,7 +1545,7 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
|
|||
|
||||
Msg( " %c <-- sz=%i seq=%i ack=%i rel=%i tm=%f\n"
|
||||
, c
|
||||
, BF_GetMaxBytes( msg )
|
||||
, MSG_GetMaxBytes( msg )
|
||||
, sequence & 63
|
||||
, sequence_ack & 63
|
||||
, reliable_message
|
||||
|
@ -1613,17 +1613,17 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
|
|||
chan->last_received = host.realtime;
|
||||
|
||||
// Update data flow stats
|
||||
chan->flow[FLOW_INCOMING].stats[chan->flow[FLOW_INCOMING].current & ( MAX_LATENT-1 )].size = BF_GetMaxBytes( msg ) + UDP_HEADER_SIZE;
|
||||
chan->flow[FLOW_INCOMING].stats[chan->flow[FLOW_INCOMING].current & ( MAX_LATENT-1 )].size = MSG_GetMaxBytes( msg ) + UDP_HEADER_SIZE;
|
||||
chan->flow[FLOW_INCOMING].stats[chan->flow[FLOW_INCOMING].current & ( MAX_LATENT-1 )].time = host.realtime;
|
||||
chan->flow[FLOW_INCOMING].totalbytes += ( BF_GetMaxBytes( msg ) + UDP_HEADER_SIZE );
|
||||
chan->flow[FLOW_INCOMING].totalbytes += ( MSG_GetMaxBytes( msg ) + UDP_HEADER_SIZE );
|
||||
chan->flow[FLOW_INCOMING].current++;
|
||||
|
||||
Netchan_UpdateFlow( chan );
|
||||
hdr_size = BF_GetNumBytesRead( msg );
|
||||
hdr_size = MSG_GetNumBytesRead( msg );
|
||||
|
||||
size1 = BF_GetMaxBytes( msg );
|
||||
size1 = MSG_GetMaxBytes( msg );
|
||||
if( chan->compress ) Huff_DecompressPacket( msg, hdr_size );
|
||||
size2 = BF_GetMaxBytes( msg );
|
||||
size2 = MSG_GetMaxBytes( msg );
|
||||
|
||||
chan->total_received += size1;
|
||||
chan->total_received_uncompressed += size2;
|
||||
|
@ -1658,11 +1658,11 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
|
|||
bits = frag_length[i];
|
||||
|
||||
// copy in data
|
||||
BF_Clear( &pbuf->frag_message );
|
||||
MSG_Clear( &pbuf->frag_message );
|
||||
|
||||
BF_StartReading( &temp, msg->pData, BF_GetMaxBytes( msg ), BF_GetNumBitsRead( msg ) + frag_offset[i], -1 );
|
||||
BF_ReadBits( msg, buffer, bits );
|
||||
BF_WriteBits( &pbuf->frag_message, buffer, bits );
|
||||
MSG_StartReading( &temp, msg->pData, MSG_GetMaxBytes( msg ), MSG_GetNumBitsRead( msg ) + frag_offset[i], -1 );
|
||||
MSG_ReadBits( msg, buffer, bits );
|
||||
MSG_WriteBits( &pbuf->frag_message, buffer, bits );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1674,12 +1674,12 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
|
|||
}
|
||||
|
||||
// rearrange incoming data to not have the frag stuff in the middle of it
|
||||
oldpos = BF_GetNumBitsRead( msg );
|
||||
curbit = BF_GetNumBitsRead( msg ) + frag_offset[i];
|
||||
oldpos = MSG_GetNumBitsRead( msg );
|
||||
curbit = MSG_GetNumBitsRead( msg ) + frag_offset[i];
|
||||
numbitstoremove = frag_length[i];
|
||||
|
||||
BF_ExciseBits( msg, curbit, numbitstoremove );
|
||||
BF_SeekToBit( msg, oldpos );
|
||||
MSG_ExciseBits( msg, curbit, numbitstoremove );
|
||||
MSG_SeekToBit( msg, oldpos );
|
||||
|
||||
for( j = i + 1; j < MAX_STREAMS; j++ )
|
||||
{
|
||||
|
@ -1688,7 +1688,7 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
|
|||
}
|
||||
|
||||
// is there anything left to process?
|
||||
if( BF_GetNumBitsLeft( msg ) <= 0 )
|
||||
if( MSG_GetNumBitsLeft( msg ) <= 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -483,26 +483,26 @@ void Delta_WriteTableField( sizebuf_t *msg, int tableIndex, const delta_t *pFiel
|
|||
nameIndex = Delta_IndexForFieldInfo( dt->pInfo, pField->name );
|
||||
ASSERT( nameIndex >= 0 && nameIndex < dt->maxFields );
|
||||
|
||||
BF_WriteByte( msg, svc_deltatable );
|
||||
BF_WriteUBitLong( msg, tableIndex, 4 ); // assume we support 16 network tables
|
||||
BF_WriteUBitLong( msg, nameIndex, 8 ); // 255 fields by struct should be enough
|
||||
BF_WriteUBitLong( msg, pField->flags, 10 ); // flags are indicated various input types
|
||||
BF_WriteUBitLong( msg, pField->bits - 1, 5 ); // max received value is 32 (32 bit)
|
||||
MSG_WriteByte( msg, svc_deltatable );
|
||||
MSG_WriteUBitLong( msg, tableIndex, 4 ); // assume we support 16 network tables
|
||||
MSG_WriteUBitLong( msg, nameIndex, 8 ); // 255 fields by struct should be enough
|
||||
MSG_WriteUBitLong( msg, pField->flags, 10 ); // flags are indicated various input types
|
||||
MSG_WriteUBitLong( msg, pField->bits - 1, 5 ); // max received value is 32 (32 bit)
|
||||
|
||||
// multipliers is null-compressed
|
||||
if( pField->multiplier != 1.0f )
|
||||
{
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteFloat( msg, pField->multiplier );
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteFloat( msg, pField->multiplier );
|
||||
}
|
||||
else BF_WriteOneBit( msg, 0 );
|
||||
else MSG_WriteOneBit( msg, 0 );
|
||||
|
||||
if( pField->post_multiplier != 1.0f )
|
||||
{
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteFloat( msg, pField->post_multiplier );
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteFloat( msg, pField->post_multiplier );
|
||||
}
|
||||
else BF_WriteOneBit( msg, 0 );
|
||||
else MSG_WriteOneBit( msg, 0 );
|
||||
}
|
||||
|
||||
void Delta_ParseTableField( sizebuf_t *msg )
|
||||
|
@ -513,23 +513,23 @@ void Delta_ParseTableField( sizebuf_t *msg )
|
|||
const char *pName;
|
||||
delta_info_t *dt;
|
||||
|
||||
tableIndex = BF_ReadUBitLong( msg, 4 );
|
||||
tableIndex = MSG_ReadUBitLong( msg, 4 );
|
||||
dt = Delta_FindStructByIndex( tableIndex );
|
||||
|
||||
ASSERT( dt != NULL );
|
||||
|
||||
nameIndex = BF_ReadUBitLong( msg, 8 ); // read field name index
|
||||
nameIndex = MSG_ReadUBitLong( msg, 8 ); // read field name index
|
||||
ASSERT( nameIndex >= 0 && nameIndex < dt->maxFields );
|
||||
pName = dt->pInfo[nameIndex].name;
|
||||
flags = BF_ReadUBitLong( msg, 10 );
|
||||
bits = BF_ReadUBitLong( msg, 5 ) + 1;
|
||||
flags = MSG_ReadUBitLong( msg, 10 );
|
||||
bits = MSG_ReadUBitLong( msg, 5 ) + 1;
|
||||
|
||||
// read the multipliers
|
||||
if( BF_ReadOneBit( msg ))
|
||||
mul = BF_ReadFloat( msg );
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
mul = MSG_ReadFloat( msg );
|
||||
|
||||
if( BF_ReadOneBit( msg ))
|
||||
post_mul = BF_ReadFloat( msg );
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
post_mul = MSG_ReadFloat( msg );
|
||||
|
||||
// delta encoders it's already initialized on this machine (local game)
|
||||
if( delta_init ) return;
|
||||
|
@ -1097,38 +1097,38 @@ qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, void *to
|
|||
|
||||
if( Delta_CompareField( pField, from, to, timebase ))
|
||||
{
|
||||
BF_WriteOneBit( msg, 0 ); // unchanged
|
||||
MSG_WriteOneBit( msg, 0 ); // unchanged
|
||||
return false;
|
||||
}
|
||||
|
||||
BF_WriteOneBit( msg, 1 ); // changed
|
||||
MSG_WriteOneBit( msg, 1 ); // changed
|
||||
|
||||
if( pField->flags & DT_BYTE )
|
||||
{
|
||||
iValue = *(byte *)((byte *)to + pField->offset );
|
||||
iValue = Delta_ClampIntegerField( iValue, bSigned, pField->bits );
|
||||
if( pField->multiplier != 1.0f ) iValue *= pField->multiplier;
|
||||
BF_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
MSG_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
}
|
||||
else if( pField->flags & DT_SHORT )
|
||||
{
|
||||
iValue = *(word *)((byte *)to + pField->offset );
|
||||
iValue = Delta_ClampIntegerField( iValue, bSigned, pField->bits );
|
||||
if( pField->multiplier != 1.0f ) iValue *= pField->multiplier;
|
||||
BF_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
MSG_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
}
|
||||
else if( pField->flags & DT_INTEGER )
|
||||
{
|
||||
iValue = *(uint *)((byte *)to + pField->offset );
|
||||
iValue = Delta_ClampIntegerField( iValue, bSigned, pField->bits );
|
||||
if( pField->multiplier != 1.0f ) iValue *= pField->multiplier;
|
||||
BF_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
MSG_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
}
|
||||
else if( pField->flags & DT_FLOAT )
|
||||
{
|
||||
flValue = *(float *)((byte *)to + pField->offset );
|
||||
iValue = (int)(flValue * pField->multiplier);
|
||||
BF_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
MSG_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
}
|
||||
else if( pField->flags & DT_ANGLE )
|
||||
{
|
||||
|
@ -1136,7 +1136,7 @@ qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, void *to
|
|||
|
||||
// NOTE: never applies multipliers to angle because
|
||||
// result may be wrong on client-side
|
||||
BF_WriteBitAngle( msg, flAngle, pField->bits );
|
||||
MSG_WriteBitAngle( msg, flAngle, pField->bits );
|
||||
}
|
||||
else if( pField->flags & DT_TIMEWINDOW_8 )
|
||||
{
|
||||
|
@ -1144,7 +1144,7 @@ qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, void *to
|
|||
flTime = Q_rint( timebase * 100.0f ) - Q_rint(flValue * 100.0f);
|
||||
iValue = (uint)abs( flTime );
|
||||
|
||||
BF_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
MSG_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
}
|
||||
else if( pField->flags & DT_TIMEWINDOW_BIG )
|
||||
{
|
||||
|
@ -1152,12 +1152,12 @@ qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, void *to
|
|||
flTime = (timebase * pField->multiplier) - (flValue * pField->multiplier);
|
||||
iValue = (uint)abs( flTime );
|
||||
|
||||
BF_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
MSG_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
}
|
||||
else if( pField->flags & DT_STRING )
|
||||
{
|
||||
pStr = (char *)((byte *)to + pField->offset );
|
||||
BF_WriteString( msg, pStr );
|
||||
MSG_WriteString( msg, pStr );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1179,7 +1179,7 @@ qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to,
|
|||
const char *pStr;
|
||||
char *pOut;
|
||||
|
||||
bChanged = BF_ReadOneBit( msg );
|
||||
bChanged = MSG_ReadOneBit( msg );
|
||||
|
||||
ASSERT( pField->multiplier != 0.0f );
|
||||
|
||||
|
@ -1187,7 +1187,7 @@ qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to,
|
|||
{
|
||||
if( bChanged )
|
||||
{
|
||||
iValue = BF_ReadBitLong( msg, pField->bits, bSigned );
|
||||
iValue = MSG_ReadBitLong( msg, pField->bits, bSigned );
|
||||
if( pField->multiplier != 1.0f ) iValue /= pField->multiplier;
|
||||
}
|
||||
else
|
||||
|
@ -1200,7 +1200,7 @@ qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to,
|
|||
{
|
||||
if( bChanged )
|
||||
{
|
||||
iValue = BF_ReadBitLong( msg, pField->bits, bSigned );
|
||||
iValue = MSG_ReadBitLong( msg, pField->bits, bSigned );
|
||||
if( pField->multiplier != 1.0f ) iValue /= pField->multiplier;
|
||||
}
|
||||
else
|
||||
|
@ -1213,7 +1213,7 @@ qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to,
|
|||
{
|
||||
if( bChanged )
|
||||
{
|
||||
iValue = BF_ReadBitLong( msg, pField->bits, bSigned );
|
||||
iValue = MSG_ReadBitLong( msg, pField->bits, bSigned );
|
||||
if( pField->multiplier != 1.0f ) iValue /= pField->multiplier;
|
||||
}
|
||||
else
|
||||
|
@ -1226,7 +1226,7 @@ qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to,
|
|||
{
|
||||
if( bChanged )
|
||||
{
|
||||
iValue = BF_ReadBitLong( msg, pField->bits, bSigned );
|
||||
iValue = MSG_ReadBitLong( msg, pField->bits, bSigned );
|
||||
flValue = (int)iValue * ( 1.0f / pField->multiplier );
|
||||
flValue = flValue * pField->post_multiplier;
|
||||
}
|
||||
|
@ -1240,7 +1240,7 @@ qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to,
|
|||
{
|
||||
if( bChanged )
|
||||
{
|
||||
flAngle = BF_ReadBitAngle( msg, pField->bits );
|
||||
flAngle = MSG_ReadBitAngle( msg, pField->bits );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1252,7 +1252,7 @@ qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to,
|
|||
{
|
||||
if( bChanged )
|
||||
{
|
||||
iValue = BF_ReadBitLong( msg, pField->bits, bSigned );
|
||||
iValue = MSG_ReadBitLong( msg, pField->bits, bSigned );
|
||||
flValue = (float)((int)(iValue * 0.01f ));
|
||||
flTime = timebase + flValue;
|
||||
}
|
||||
|
@ -1266,7 +1266,7 @@ qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to,
|
|||
{
|
||||
if( bChanged )
|
||||
{
|
||||
iValue = BF_ReadBitLong( msg, pField->bits, bSigned );
|
||||
iValue = MSG_ReadBitLong( msg, pField->bits, bSigned );
|
||||
flValue = (float)((int)iValue) * ( 1.0f / pField->multiplier );
|
||||
flTime = timebase + flValue;
|
||||
}
|
||||
|
@ -1280,7 +1280,7 @@ qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to,
|
|||
{
|
||||
if( bChanged )
|
||||
{
|
||||
pStr = BF_ReadString( msg );
|
||||
pStr = MSG_ReadString( msg );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1438,7 +1438,7 @@ qboolean MSG_WriteDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *t
|
|||
// activate fields and call custom encode func
|
||||
Delta_CustomEncode( dt, from, to );
|
||||
|
||||
BF_WriteByte( msg, svc_deltamovevars );
|
||||
MSG_WriteByte( msg, svc_deltamovevars );
|
||||
|
||||
// process fields
|
||||
for( i = 0; i < dt->numFields; i++, pField++ )
|
||||
|
@ -1450,7 +1450,7 @@ qboolean MSG_WriteDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *t
|
|||
// if we have no changes - kill the message
|
||||
if( !numChanges )
|
||||
{
|
||||
BF_SeekToBit( msg, startBit );
|
||||
MSG_SeekToBit( msg, startBit );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -1575,8 +1575,8 @@ void MSG_WriteWeaponData( sizebuf_t *msg, weapon_data_t *from, weapon_data_t *to
|
|||
|
||||
startBit = msg->iCurBit;
|
||||
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteUBitLong( msg, index, MAX_WEAPON_BITS );
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteUBitLong( msg, index, MAX_WEAPON_BITS );
|
||||
|
||||
// process fields
|
||||
for( i = 0; i < dt->numFields; i++, pField++ )
|
||||
|
@ -1586,7 +1586,7 @@ void MSG_WriteWeaponData( sizebuf_t *msg, weapon_data_t *from, weapon_data_t *to
|
|||
}
|
||||
|
||||
// if we have no changes - kill the message
|
||||
if( !numChanges ) BF_SeekToBit( msg, startBit );
|
||||
if( !numChanges ) MSG_SeekToBit( msg, startBit );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1649,7 +1649,7 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *
|
|||
if( from == NULL ) return;
|
||||
|
||||
// a NULL to is a delta remove message
|
||||
BF_WriteWord( msg, from->number );
|
||||
MSG_WriteWord( msg, from->number );
|
||||
|
||||
// fRemoveType:
|
||||
// 0 - keep alive, has delta-update
|
||||
|
@ -1658,7 +1658,7 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *
|
|||
if( force ) fRemoveType = 2;
|
||||
else fRemoveType = 1;
|
||||
|
||||
BF_WriteUBitLong( msg, fRemoveType, 2 );
|
||||
MSG_WriteUBitLong( msg, fRemoveType, 2 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1667,15 +1667,15 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *
|
|||
if( to->number < 0 || to->number >= GI->max_edicts )
|
||||
Host_Error( "MSG_WriteDeltaEntity: Bad entity number: %i\n", to->number );
|
||||
|
||||
BF_WriteWord( msg, to->number );
|
||||
BF_WriteUBitLong( msg, 0, 2 ); // alive
|
||||
MSG_WriteWord( msg, to->number );
|
||||
MSG_WriteUBitLong( msg, 0, 2 ); // alive
|
||||
|
||||
if( to->entityType != from->entityType )
|
||||
{
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteUBitLong( msg, to->entityType, 2 );
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteUBitLong( msg, to->entityType, 2 );
|
||||
}
|
||||
else BF_WriteOneBit( msg, 0 );
|
||||
else MSG_WriteOneBit( msg, 0 );
|
||||
|
||||
if( to->entityType == ENTITY_NORMAL )
|
||||
{
|
||||
|
@ -1709,7 +1709,7 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *
|
|||
}
|
||||
|
||||
// if we have no changes - kill the message
|
||||
if( !numChanges && !force ) BF_SeekToBit( msg, startBit );
|
||||
if( !numChanges && !force ) MSG_SeekToBit( msg, startBit );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1734,7 +1734,7 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state
|
|||
|
||||
*to = *from;
|
||||
to->number = number;
|
||||
fRemoveType = BF_ReadUBitLong( msg, 2 );
|
||||
fRemoveType = MSG_ReadUBitLong( msg, 2 );
|
||||
|
||||
if( fRemoveType )
|
||||
{
|
||||
|
@ -1757,8 +1757,8 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state
|
|||
Host_Error( "MSG_ReadDeltaEntity: unknown update type %i\n", fRemoveType );
|
||||
}
|
||||
|
||||
if( BF_ReadOneBit( msg ))
|
||||
to->entityType = BF_ReadUBitLong( msg, 2 );
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
to->entityType = MSG_ReadUBitLong( msg, 2 );
|
||||
|
||||
if( to->entityType == ENTITY_NORMAL )
|
||||
{
|
||||
|
|
|
@ -513,8 +513,8 @@ void Huff_CompressPacket( sizebuf_t *msg, int offset )
|
|||
int outLen;
|
||||
int i, inLen;
|
||||
|
||||
data = BF_GetData( msg ) + offset;
|
||||
inLen = BF_GetNumBytesWritten( msg ) - offset;
|
||||
data = MSG_GetData( msg ) + offset;
|
||||
inLen = MSG_GetNumBytesWritten( msg ) - offset;
|
||||
if( inLen <= 0 || inLen >= NET_MAX_PAYLOAD )
|
||||
return;
|
||||
|
||||
|
@ -552,8 +552,8 @@ void Huff_DecompressPacket( sizebuf_t *msg, int offset )
|
|||
int inLen;
|
||||
int ch, i, j;
|
||||
|
||||
data = BF_GetData( msg ) + offset;
|
||||
inLen = BF_GetMaxBytes( msg ) - offset;
|
||||
data = MSG_GetData( msg ) + offset;
|
||||
inLen = MSG_GetMaxBytes( msg ) - offset;
|
||||
if( inLen <= 0 ) return;
|
||||
|
||||
Huff_PrepareTree( tree );
|
||||
|
|
|
@ -641,7 +641,7 @@ void MsgDev( int level, const char *pMsg, ... )
|
|||
break;
|
||||
case D_INFO:
|
||||
case D_NOTE:
|
||||
case D_AICONSOLE:
|
||||
case D_REPORT:
|
||||
Sys_Print( text );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -164,6 +164,10 @@ SOURCE=.\client\cl_menu.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_netgraph.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_parse.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -226,7 +226,7 @@ gotnewcl:
|
|||
|
||||
// initailize netchan here because SV_DropClient will clear network buffer
|
||||
Netchan_Setup( NS_SERVER, &newcl->netchan, from, qport );
|
||||
BF_Init( &newcl->datagram, "Datagram", newcl->datagram_buf, sizeof( newcl->datagram_buf )); // datagram buf
|
||||
MSG_Init( &newcl->datagram, "Datagram", newcl->datagram_buf, sizeof( newcl->datagram_buf )); // datagram buf
|
||||
|
||||
// get the game a chance to reject this connection or modify the userinfo
|
||||
if( !( SV_ClientConnect( ent, userinfo )))
|
||||
|
@ -427,7 +427,7 @@ void SV_DropClient( sv_client_t *drop )
|
|||
// add the disconnect
|
||||
if( !drop->fakeclient )
|
||||
{
|
||||
BF_WriteByte( &drop->netchan.message, svc_disconnect );
|
||||
MSG_WriteByte( &drop->netchan.message, svc_disconnect );
|
||||
}
|
||||
|
||||
// let the game known about client state
|
||||
|
@ -502,9 +502,9 @@ void SV_FlushRedirect( netadr_t adr, int dest, char *buf )
|
|||
break;
|
||||
case RD_CLIENT:
|
||||
if( !svs.currentPlayer ) return; // client not set
|
||||
BF_WriteByte( &svs.currentPlayer->netchan.message, svc_print );
|
||||
BF_WriteByte( &svs.currentPlayer->netchan.message, PRINT_HIGH );
|
||||
BF_WriteString( &svs.currentPlayer->netchan.message, buf );
|
||||
MSG_WriteByte( &svs.currentPlayer->netchan.message, svc_print );
|
||||
MSG_WriteByte( &svs.currentPlayer->netchan.message, PRINT_HIGH );
|
||||
MSG_WriteString( &svs.currentPlayer->netchan.message, buf );
|
||||
break;
|
||||
case RD_NONE:
|
||||
MsgDev( D_ERROR, "SV_FlushRedirect: %s: invalid destination\n", NET_AdrToString( adr ));
|
||||
|
@ -785,7 +785,7 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
|
|||
static char outputbuf[2048];
|
||||
int i;
|
||||
|
||||
MsgDev( D_INFO, "Rcon from %s:\n%s\n", NET_AdrToString( from ), BF_GetData( msg ) + 4 );
|
||||
MsgDev( D_INFO, "Rcon from %s:\n%s\n", NET_AdrToString( from ), MSG_GetData( msg ) + 4 );
|
||||
SV_BeginRedirect( from, RD_PACKET, outputbuf, sizeof( outputbuf ) - 16, SV_FlushRedirect );
|
||||
|
||||
if( Rcon_Validate( ))
|
||||
|
@ -947,20 +947,20 @@ void SV_FullClientUpdate( sv_client_t *cl, sizebuf_t *msg )
|
|||
|
||||
i = cl - svs.clients;
|
||||
|
||||
BF_WriteByte( msg, svc_updateuserinfo );
|
||||
BF_WriteUBitLong( msg, i, MAX_CLIENT_BITS );
|
||||
MSG_WriteByte( msg, svc_updateuserinfo );
|
||||
MSG_WriteUBitLong( msg, i, MAX_CLIENT_BITS );
|
||||
|
||||
if( cl->name[0] )
|
||||
{
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
|
||||
Q_strncpy( info, cl->userinfo, sizeof( info ));
|
||||
|
||||
// remove server passwords, etc.
|
||||
Info_RemovePrefixedKeys( info, '_' );
|
||||
BF_WriteString( msg, info );
|
||||
MSG_WriteString( msg, info );
|
||||
}
|
||||
else BF_WriteOneBit( msg, 0 );
|
||||
else MSG_WriteOneBit( msg, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1096,8 +1096,8 @@ void SV_PutClientInServer( edict_t *ent )
|
|||
|
||||
if( svgame.globals->cdAudioTrack )
|
||||
{
|
||||
BF_WriteByte( &client->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &client->netchan.message, va( "cd loop %3d\n", svgame.globals->cdAudioTrack ));
|
||||
MSG_WriteByte( &client->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &client->netchan.message, va( "cd loop %3d\n", svgame.globals->cdAudioTrack ));
|
||||
svgame.globals->cdAudioTrack = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1110,18 +1110,18 @@ void SV_PutClientInServer( edict_t *ent )
|
|||
// NOTE: we needs to setup angles on restore here
|
||||
if( ent->v.fixangle == 1 )
|
||||
{
|
||||
BF_WriteByte( &client->netchan.message, svc_setangle );
|
||||
BF_WriteBitAngle( &client->netchan.message, ent->v.angles[0], 16 );
|
||||
BF_WriteBitAngle( &client->netchan.message, ent->v.angles[1], 16 );
|
||||
BF_WriteBitAngle( &client->netchan.message, ent->v.angles[2], 16 );
|
||||
MSG_WriteByte( &client->netchan.message, svc_setangle );
|
||||
MSG_WriteBitAngle( &client->netchan.message, ent->v.angles[0], 16 );
|
||||
MSG_WriteBitAngle( &client->netchan.message, ent->v.angles[1], 16 );
|
||||
MSG_WriteBitAngle( &client->netchan.message, ent->v.angles[2], 16 );
|
||||
ent->v.fixangle = 0;
|
||||
}
|
||||
ent->v.effects |= EF_NOINTERP;
|
||||
|
||||
// reset weaponanim
|
||||
BF_WriteByte( &client->netchan.message, svc_weaponanim );
|
||||
BF_WriteByte( &client->netchan.message, 0 );
|
||||
BF_WriteByte( &client->netchan.message, 0 );
|
||||
MSG_WriteByte( &client->netchan.message, svc_weaponanim );
|
||||
MSG_WriteByte( &client->netchan.message, 0 );
|
||||
MSG_WriteByte( &client->netchan.message, 0 );
|
||||
|
||||
// trigger_camera restored here
|
||||
if( sv.viewentity > 0 && sv.viewentity < GI->max_edicts )
|
||||
|
@ -1139,14 +1139,14 @@ void SV_PutClientInServer( edict_t *ent )
|
|||
int viewEnt;
|
||||
|
||||
// resend the signon
|
||||
BF_WriteBits( &client->netchan.message, BF_GetData( &sv.signon ), BF_GetNumBitsWritten( &sv.signon ));
|
||||
MSG_WriteBits( &client->netchan.message, MSG_GetData( &sv.signon ), MSG_GetNumBitsWritten( &sv.signon ));
|
||||
|
||||
if( client->pViewEntity )
|
||||
viewEnt = NUM_FOR_EDICT( client->pViewEntity );
|
||||
else viewEnt = NUM_FOR_EDICT( client->edict );
|
||||
|
||||
BF_WriteByte( &client->netchan.message, svc_setview );
|
||||
BF_WriteWord( &client->netchan.message, viewEnt );
|
||||
MSG_WriteByte( &client->netchan.message, svc_setview );
|
||||
MSG_WriteWord( &client->netchan.message, viewEnt );
|
||||
}
|
||||
|
||||
// clear any temp states
|
||||
|
@ -1172,8 +1172,8 @@ void SV_TogglePause( const char *msg )
|
|||
if( msg ) SV_BroadcastPrintf( PRINT_HIGH, "%s", msg );
|
||||
|
||||
// send notification to all clients
|
||||
BF_WriteByte( &sv.reliable_datagram, svc_setpause );
|
||||
BF_WriteOneBit( &sv.reliable_datagram, sv.paused );
|
||||
MSG_WriteByte( &sv.reliable_datagram, svc_setpause );
|
||||
MSG_WriteOneBit( &sv.reliable_datagram, sv.paused );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1205,18 +1205,18 @@ void SV_New_f( sv_client_t *cl )
|
|||
playernum = cl - svs.clients;
|
||||
|
||||
// send the serverdata
|
||||
BF_WriteByte( &cl->netchan.message, svc_serverdata );
|
||||
BF_WriteLong( &cl->netchan.message, PROTOCOL_VERSION );
|
||||
BF_WriteLong( &cl->netchan.message, svs.spawncount );
|
||||
BF_WriteLong( &cl->netchan.message, sv.checksum );
|
||||
BF_WriteByte( &cl->netchan.message, playernum );
|
||||
BF_WriteByte( &cl->netchan.message, svgame.globals->maxClients );
|
||||
BF_WriteWord( &cl->netchan.message, svgame.globals->maxEntities );
|
||||
BF_WriteString( &cl->netchan.message, sv.name );
|
||||
BF_WriteString( &cl->netchan.message, STRING( EDICT_NUM( 0 )->v.message )); // Map Message
|
||||
BF_WriteOneBit( &cl->netchan.message, sv.background ); // tell client about background map
|
||||
BF_WriteString( &cl->netchan.message, GI->gamefolder );
|
||||
BF_WriteLong( &cl->netchan.message, host.features );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_serverdata );
|
||||
MSG_WriteLong( &cl->netchan.message, PROTOCOL_VERSION );
|
||||
MSG_WriteLong( &cl->netchan.message, svs.spawncount );
|
||||
MSG_WriteLong( &cl->netchan.message, sv.checksum );
|
||||
MSG_WriteByte( &cl->netchan.message, playernum );
|
||||
MSG_WriteByte( &cl->netchan.message, svgame.globals->maxClients );
|
||||
MSG_WriteWord( &cl->netchan.message, svgame.globals->maxEntities );
|
||||
MSG_WriteString( &cl->netchan.message, sv.name );
|
||||
MSG_WriteString( &cl->netchan.message, STRING( EDICT_NUM( 0 )->v.message )); // Map Message
|
||||
MSG_WriteOneBit( &cl->netchan.message, sv.background ); // tell client about background map
|
||||
MSG_WriteString( &cl->netchan.message, GI->gamefolder );
|
||||
MSG_WriteLong( &cl->netchan.message, host.features );
|
||||
|
||||
// refresh userinfo on spawn
|
||||
SV_RefreshUserinfo();
|
||||
|
@ -1234,14 +1234,14 @@ void SV_New_f( sv_client_t *cl )
|
|||
Q_memset( &cl->lastcmd, 0, sizeof( cl->lastcmd ));
|
||||
|
||||
// begin fetching modellist
|
||||
BF_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &cl->netchan.message, va( "cmd modellist %i %i\n", svs.spawncount, 0 ));
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &cl->netchan.message, va( "cmd modellist %i %i\n", svs.spawncount, 0 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
// request resource list
|
||||
BF_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &cl->netchan.message, va( "cmd getresourelist\n" ));
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &cl->netchan.message, va( "cmd getresourelist\n" ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1262,8 +1262,8 @@ void SV_ContinueLoading_f( sv_client_t *cl )
|
|||
Q_memset( &cl->lastcmd, 0, sizeof( cl->lastcmd ));
|
||||
|
||||
// begin fetching modellist
|
||||
BF_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &cl->netchan.message, va( "cmd modellist %i %i\n", svs.spawncount, 0 ));
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &cl->netchan.message, va( "cmd modellist %i %i\n", svs.spawncount, 0 ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1318,19 +1318,19 @@ void SV_SendResourceList_f( sv_client_t *cl )
|
|||
rescount++;
|
||||
}
|
||||
|
||||
msg_size = BF_GetRealBytesWritten( &cl->netchan.message ); // start
|
||||
msg_size = MSG_GetRealBytesWritten( &cl->netchan.message ); // start
|
||||
|
||||
BF_WriteByte( &cl->netchan.message, svc_resourcelist );
|
||||
BF_WriteWord( &cl->netchan.message, rescount );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_resourcelist );
|
||||
MSG_WriteWord( &cl->netchan.message, rescount );
|
||||
|
||||
for( index = 1; index < rescount; index++ )
|
||||
{
|
||||
BF_WriteWord( &cl->netchan.message, reslist.restype[index] );
|
||||
BF_WriteString( &cl->netchan.message, reslist.resnames[index] );
|
||||
MSG_WriteWord( &cl->netchan.message, reslist.restype[index] );
|
||||
MSG_WriteString( &cl->netchan.message, reslist.resnames[index] );
|
||||
}
|
||||
|
||||
Msg( "Count res: %d\n", rescount );
|
||||
Msg( "ResList size: %s\n", Q_memprint( BF_GetRealBytesWritten( &cl->netchan.message ) - msg_size ));
|
||||
Msg( "ResList size: %s\n", Q_memprint( MSG_GetRealBytesWritten( &cl->netchan.message ) - msg_size ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1360,13 +1360,13 @@ void SV_WriteModels_f( sv_client_t *cl )
|
|||
start = Q_atoi( Cmd_Argv( 2 ));
|
||||
|
||||
// write a packet full of data
|
||||
while( BF_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < MAX_MODELS )
|
||||
while( MSG_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < MAX_MODELS )
|
||||
{
|
||||
if( sv.model_precache[start][0] )
|
||||
{
|
||||
BF_WriteByte( &cl->netchan.message, svc_modelindex );
|
||||
BF_WriteUBitLong( &cl->netchan.message, start, MAX_MODEL_BITS );
|
||||
BF_WriteString( &cl->netchan.message, sv.model_precache[start] );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_modelindex );
|
||||
MSG_WriteUBitLong( &cl->netchan.message, start, MAX_MODEL_BITS );
|
||||
MSG_WriteString( &cl->netchan.message, sv.model_precache[start] );
|
||||
}
|
||||
start++;
|
||||
}
|
||||
|
@ -1375,8 +1375,8 @@ void SV_WriteModels_f( sv_client_t *cl )
|
|||
else Q_snprintf( cmd, MAX_STRING, "cmd modellist %i %i\n", svs.spawncount, start );
|
||||
|
||||
// send next command
|
||||
BF_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &cl->netchan.message, cmd );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &cl->netchan.message, cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1406,13 +1406,13 @@ void SV_WriteSounds_f( sv_client_t *cl )
|
|||
start = Q_atoi( Cmd_Argv( 2 ));
|
||||
|
||||
// write a packet full of data
|
||||
while( BF_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < MAX_SOUNDS )
|
||||
while( MSG_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < MAX_SOUNDS )
|
||||
{
|
||||
if( sv.sound_precache[start][0] )
|
||||
{
|
||||
BF_WriteByte( &cl->netchan.message, svc_soundindex );
|
||||
BF_WriteUBitLong( &cl->netchan.message, start, MAX_SOUND_BITS );
|
||||
BF_WriteString( &cl->netchan.message, sv.sound_precache[start] );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_soundindex );
|
||||
MSG_WriteUBitLong( &cl->netchan.message, start, MAX_SOUND_BITS );
|
||||
MSG_WriteString( &cl->netchan.message, sv.sound_precache[start] );
|
||||
}
|
||||
start++;
|
||||
}
|
||||
|
@ -1421,8 +1421,8 @@ void SV_WriteSounds_f( sv_client_t *cl )
|
|||
else Q_snprintf( cmd, MAX_STRING, "cmd soundlist %i %i\n", svs.spawncount, start );
|
||||
|
||||
// send next command
|
||||
BF_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &cl->netchan.message, cmd );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &cl->netchan.message, cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1452,13 +1452,13 @@ void SV_WriteEvents_f( sv_client_t *cl )
|
|||
start = Q_atoi( Cmd_Argv( 2 ));
|
||||
|
||||
// write a packet full of data
|
||||
while( BF_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < MAX_EVENTS )
|
||||
while( MSG_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < MAX_EVENTS )
|
||||
{
|
||||
if( sv.event_precache[start][0] )
|
||||
{
|
||||
BF_WriteByte( &cl->netchan.message, svc_eventindex );
|
||||
BF_WriteUBitLong( &cl->netchan.message, start, MAX_EVENT_BITS );
|
||||
BF_WriteString( &cl->netchan.message, sv.event_precache[start] );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_eventindex );
|
||||
MSG_WriteUBitLong( &cl->netchan.message, start, MAX_EVENT_BITS );
|
||||
MSG_WriteString( &cl->netchan.message, sv.event_precache[start] );
|
||||
}
|
||||
start++;
|
||||
}
|
||||
|
@ -1467,8 +1467,8 @@ void SV_WriteEvents_f( sv_client_t *cl )
|
|||
else Q_snprintf( cmd, MAX_STRING, "cmd eventlist %i %i\n", svs.spawncount, start );
|
||||
|
||||
// send next command
|
||||
BF_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &cl->netchan.message, cmd );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &cl->netchan.message, cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1498,14 +1498,14 @@ void SV_WriteLightstyles_f( sv_client_t *cl )
|
|||
start = Q_atoi( Cmd_Argv( 2 ));
|
||||
|
||||
// write a packet full of data
|
||||
while( BF_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < MAX_LIGHTSTYLES )
|
||||
while( MSG_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < MAX_LIGHTSTYLES )
|
||||
{
|
||||
if( sv.lightstyles[start].pattern[0] )
|
||||
{
|
||||
BF_WriteByte( &cl->netchan.message, svc_lightstyle );
|
||||
BF_WriteByte( &cl->netchan.message, start );
|
||||
BF_WriteString( &cl->netchan.message, sv.lightstyles[start].pattern );
|
||||
BF_WriteFloat( &cl->netchan.message, sv.lightstyles[start].time );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_lightstyle );
|
||||
MSG_WriteByte( &cl->netchan.message, start );
|
||||
MSG_WriteString( &cl->netchan.message, sv.lightstyles[start].pattern );
|
||||
MSG_WriteFloat( &cl->netchan.message, sv.lightstyles[start].time );
|
||||
}
|
||||
start++;
|
||||
}
|
||||
|
@ -1514,8 +1514,8 @@ void SV_WriteLightstyles_f( sv_client_t *cl )
|
|||
else Q_snprintf( cmd, MAX_STRING, "cmd lightstyles %i %i\n", svs.spawncount, start );
|
||||
|
||||
// send next command
|
||||
BF_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &cl->netchan.message, cmd );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &cl->netchan.message, cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1546,15 +1546,15 @@ void SV_UserMessages_f( sv_client_t *cl )
|
|||
start = Q_atoi( Cmd_Argv( 2 ));
|
||||
|
||||
// write a packet full of data
|
||||
while( BF_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < MAX_USER_MESSAGES )
|
||||
while( MSG_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < MAX_USER_MESSAGES )
|
||||
{
|
||||
message = &svgame.msg[start];
|
||||
if( message->name[0] )
|
||||
{
|
||||
BF_WriteByte( &cl->netchan.message, svc_usermessage );
|
||||
BF_WriteByte( &cl->netchan.message, message->number );
|
||||
BF_WriteByte( &cl->netchan.message, (byte)message->size );
|
||||
BF_WriteString( &cl->netchan.message, message->name );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_usermessage );
|
||||
MSG_WriteByte( &cl->netchan.message, message->number );
|
||||
MSG_WriteByte( &cl->netchan.message, (byte)message->size );
|
||||
MSG_WriteString( &cl->netchan.message, message->name );
|
||||
}
|
||||
start++;
|
||||
}
|
||||
|
@ -1563,8 +1563,8 @@ void SV_UserMessages_f( sv_client_t *cl )
|
|||
else Q_snprintf( cmd, MAX_STRING, "cmd usermsgs %i %i\n", svs.spawncount, start );
|
||||
|
||||
// send next command
|
||||
BF_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &cl->netchan.message, cmd );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &cl->netchan.message, cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1597,7 +1597,7 @@ void SV_DeltaInfo_f( sv_client_t *cl )
|
|||
fieldIndex = Q_atoi( Cmd_Argv( 3 ));
|
||||
|
||||
// write a packet full of data
|
||||
while( BF_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && tableIndex < Delta_NumTables( ))
|
||||
while( MSG_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && tableIndex < Delta_NumTables( ))
|
||||
{
|
||||
dt = Delta_FindStructByIndex( tableIndex );
|
||||
|
||||
|
@ -1606,7 +1606,7 @@ void SV_DeltaInfo_f( sv_client_t *cl )
|
|||
Delta_WriteTableField( &cl->netchan.message, tableIndex, &dt->pFields[fieldIndex] );
|
||||
|
||||
// it's time to send another portion
|
||||
if( BF_GetNumBytesWritten( &cl->netchan.message ) >= ( NET_MAX_PAYLOAD / 2 ))
|
||||
if( MSG_GetNumBytesWritten( &cl->netchan.message ) >= ( NET_MAX_PAYLOAD / 2 ))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1627,8 +1627,8 @@ void SV_DeltaInfo_f( sv_client_t *cl )
|
|||
else Q_snprintf( cmd, MAX_STRING, "cmd deltainfo %i %i %i\n", svs.spawncount, tableIndex, fieldIndex );
|
||||
|
||||
// send next command
|
||||
BF_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &cl->netchan.message, cmd );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &cl->netchan.message, cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1661,12 +1661,12 @@ void SV_Baselines_f( sv_client_t *cl )
|
|||
Q_memset( &nullstate, 0, sizeof( nullstate ));
|
||||
|
||||
// write a packet full of data
|
||||
while( BF_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < svgame.numEntities )
|
||||
while( MSG_GetNumBytesWritten( &cl->netchan.message ) < ( NET_MAX_PAYLOAD / 2 ) && start < svgame.numEntities )
|
||||
{
|
||||
base = &svs.baselines[start];
|
||||
if( base->number && ( base->modelindex || base->effects != EF_NODRAW ))
|
||||
if(( !start || base->number ) && ( base->modelindex || base->effects != EF_NODRAW ))
|
||||
{
|
||||
BF_WriteByte( &cl->netchan.message, svc_spawnbaseline );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_spawnbaseline );
|
||||
MSG_WriteDeltaEntity( &nullstate, base, &cl->netchan.message, true, SV_IsPlayerIndex( base->number ), sv.time );
|
||||
}
|
||||
start++;
|
||||
|
@ -1676,8 +1676,8 @@ void SV_Baselines_f( sv_client_t *cl )
|
|||
else Q_snprintf( cmd, MAX_STRING, "cmd baselines %i %i\n", svs.spawncount, start );
|
||||
|
||||
// send next command
|
||||
BF_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &cl->netchan.message, cmd );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &cl->netchan.message, cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1707,8 +1707,8 @@ void SV_Begin_f( sv_client_t *cl )
|
|||
// if we are paused, tell the client
|
||||
if( sv.paused )
|
||||
{
|
||||
BF_WriteByte( &sv.reliable_datagram, svc_setpause );
|
||||
BF_WriteByte( &sv.reliable_datagram, sv.paused );
|
||||
MSG_WriteByte( &sv.reliable_datagram, svc_setpause );
|
||||
MSG_WriteByte( &sv.reliable_datagram, sv.paused );
|
||||
SV_ClientPrintf( cl, PRINT_HIGH, "Server is paused.\n" );
|
||||
}
|
||||
}
|
||||
|
@ -1845,7 +1845,7 @@ void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo )
|
|||
else cl->netchan.rate = DEFAULT_RATE;
|
||||
|
||||
// msg command
|
||||
val = Info_ValueForKey( cl->userinfo, "msg" );
|
||||
val = Info_ValueForKey( cl->userinfo, "cl_msglevel" );
|
||||
if( Q_strlen( val )) cl->messagelevel = Q_atoi( val );
|
||||
|
||||
cl->local_weapons = Q_atoi( Info_ValueForKey( cl->userinfo, "cl_lw" )) ? true : false;
|
||||
|
@ -1974,7 +1974,7 @@ void SV_SendRes_f( sv_client_t *cl )
|
|||
return;
|
||||
}
|
||||
|
||||
BF_Init( &msg, "SendResources", buffer, sizeof( buffer ));
|
||||
MSG_Init( &msg, "SendResources", buffer, sizeof( buffer ));
|
||||
|
||||
SV_SendResources( &msg );
|
||||
Netchan_CreateFragments( 1, &cl->netchan, &msg );
|
||||
|
@ -2071,43 +2071,43 @@ void SV_TSourceEngineQuery( netadr_t from )
|
|||
}
|
||||
}
|
||||
|
||||
BF_Init( &buf, "TSourceEngineQuery", answer, sizeof( answer ));
|
||||
MSG_Init( &buf, "TSourceEngineQuery", answer, sizeof( answer ));
|
||||
|
||||
BF_WriteByte( &buf, 'm' );
|
||||
BF_WriteString( &buf, NET_AdrToString( net_local ) );
|
||||
BF_WriteString( &buf, hostname->string );
|
||||
BF_WriteString( &buf, sv.name );
|
||||
BF_WriteString( &buf, GI->gamefolder );
|
||||
BF_WriteString( &buf, GI->title );
|
||||
BF_WriteByte( &buf, count );
|
||||
BF_WriteByte( &buf, sv_maxclients->integer );
|
||||
BF_WriteByte( &buf, PROTOCOL_VERSION );
|
||||
BF_WriteByte( &buf, host.type == HOST_DEDICATED ? 'D' : 'L');
|
||||
BF_WriteByte( &buf, 'W' );
|
||||
MSG_WriteByte( &buf, 'm' );
|
||||
MSG_WriteString( &buf, NET_AdrToString( net_local ) );
|
||||
MSG_WriteString( &buf, hostname->string );
|
||||
MSG_WriteString( &buf, sv.name );
|
||||
MSG_WriteString( &buf, GI->gamefolder );
|
||||
MSG_WriteString( &buf, GI->title );
|
||||
MSG_WriteByte( &buf, count );
|
||||
MSG_WriteByte( &buf, sv_maxclients->integer );
|
||||
MSG_WriteByte( &buf, PROTOCOL_VERSION );
|
||||
MSG_WriteByte( &buf, host.type == HOST_DEDICATED ? 'D' : 'L');
|
||||
MSG_WriteByte( &buf, 'W' );
|
||||
|
||||
if( Q_stricmp( GI->gamedir, "valve" ))
|
||||
{
|
||||
BF_WriteByte( &buf, 1 ); // mod
|
||||
BF_WriteString( &buf, GI->game_url );
|
||||
BF_WriteString( &buf, GI->update_url );
|
||||
BF_WriteByte( &buf, 0 );
|
||||
BF_WriteLong( &buf, (long)GI->version );
|
||||
BF_WriteLong( &buf, GI->size );
|
||||
MSG_WriteByte( &buf, 1 ); // mod
|
||||
MSG_WriteString( &buf, GI->game_url );
|
||||
MSG_WriteString( &buf, GI->update_url );
|
||||
MSG_WriteByte( &buf, 0 );
|
||||
MSG_WriteLong( &buf, (long)GI->version );
|
||||
MSG_WriteLong( &buf, GI->size );
|
||||
|
||||
if( GI->gamemode == 2 )
|
||||
BF_WriteByte( &buf, 1 ); // multiplayer_only
|
||||
else BF_WriteByte( &buf, 0 );
|
||||
MSG_WriteByte( &buf, 1 ); // multiplayer_only
|
||||
else MSG_WriteByte( &buf, 0 );
|
||||
|
||||
if( Q_strstr( GI->game_dll, "hl." ))
|
||||
BF_WriteByte( &buf, 0 ); // Half-Life DLL
|
||||
else BF_WriteByte( &buf, 1 ); // Own DLL
|
||||
MSG_WriteByte( &buf, 0 ); // Half-Life DLL
|
||||
else MSG_WriteByte( &buf, 1 ); // Own DLL
|
||||
}
|
||||
else BF_WriteByte( &buf, 0 ); // Half-Life
|
||||
else MSG_WriteByte( &buf, 0 ); // Half-Life
|
||||
|
||||
BF_WriteByte( &buf, GI->secure ); // unsecure
|
||||
BF_WriteByte( &buf, bots );
|
||||
MSG_WriteByte( &buf, GI->secure ); // unsecure
|
||||
MSG_WriteByte( &buf, bots );
|
||||
|
||||
NET_SendPacket( NS_SERVER, BF_GetNumBytesWritten( &buf ), BF_GetData( &buf ), from );
|
||||
NET_SendPacket( NS_SERVER, MSG_GetNumBytesWritten( &buf ), MSG_GetData( &buf ), from );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2126,10 +2126,10 @@ void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
|||
char *c, buf[MAX_SYSPATH];
|
||||
int len = sizeof( buf );
|
||||
|
||||
BF_Clear( msg );
|
||||
BF_ReadLong( msg );// skip the -1 marker
|
||||
MSG_Clear( msg );
|
||||
MSG_ReadLong( msg );// skip the -1 marker
|
||||
|
||||
args = BF_ReadStringLine( msg );
|
||||
args = MSG_ReadStringLine( msg );
|
||||
Cmd_TokenizeString( args );
|
||||
|
||||
c = Cmd_Argv( 0 );
|
||||
|
@ -2181,12 +2181,12 @@ static void SV_ParseClientMove( sv_client_t *cl, sizebuf_t *msg )
|
|||
Q_memset( &nullcmd, 0, sizeof( usercmd_t ));
|
||||
Q_memset( cmds, 0, sizeof( cmds ));
|
||||
|
||||
key = BF_GetRealBytesRead( msg );
|
||||
checksum1 = BF_ReadByte( msg );
|
||||
cl->packet_loss = BF_ReadByte( msg );
|
||||
key = MSG_GetRealBytesRead( msg );
|
||||
checksum1 = MSG_ReadByte( msg );
|
||||
cl->packet_loss = MSG_ReadByte( msg );
|
||||
|
||||
numbackup = BF_ReadByte( msg );
|
||||
newcmds = BF_ReadByte( msg );
|
||||
numbackup = MSG_ReadByte( msg );
|
||||
newcmds = MSG_ReadByte( msg );
|
||||
|
||||
numcmds = numbackup + newcmds;
|
||||
net_drop = net_drop + 1 - newcmds;
|
||||
|
@ -2214,7 +2214,7 @@ static void SV_ParseClientMove( sv_client_t *cl, sizebuf_t *msg )
|
|||
}
|
||||
|
||||
// if the checksum fails, ignore the rest of the packet
|
||||
size = BF_GetRealBytesRead( msg ) - key - 1;
|
||||
size = MSG_GetRealBytesRead( msg ) - key - 1;
|
||||
checksum2 = CRC32_BlockSequence( msg->pData + key + 1, size, cl->netchan.incoming_sequence );
|
||||
|
||||
if( checksum2 != checksum1 )
|
||||
|
@ -2281,8 +2281,8 @@ static void SV_ParseClientMove( sv_client_t *cl, sizebuf_t *msg )
|
|||
frame->latency -= cl->lastcmd.msec * 0.5f / 1000.0f;
|
||||
frame->latency = max( 0.0f, frame->latency );
|
||||
|
||||
if( player->v.animtime > sv.time + host.frametime )
|
||||
player->v.animtime = sv.time + host.frametime;
|
||||
if( player->v.animtime > svgame.globals->time + host.frametime )
|
||||
player->v.animtime = svgame.globals->time + host.frametime;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2294,7 +2294,7 @@ Parse resource list
|
|||
*/
|
||||
void SV_ParseResourceList( sv_client_t *cl, sizebuf_t *msg )
|
||||
{
|
||||
Netchan_CreateFileFragments( true, &cl->netchan, BF_ReadString( msg ));
|
||||
Netchan_CreateFileFragments( true, &cl->netchan, MSG_ReadString( msg ));
|
||||
Netchan_FragSend( &cl->netchan );
|
||||
}
|
||||
|
||||
|
@ -2307,11 +2307,11 @@ Parse a requested value from client cvar
|
|||
*/
|
||||
void SV_ParseCvarValue( sv_client_t *cl, sizebuf_t *msg )
|
||||
{
|
||||
const char *value = BF_ReadString( msg );
|
||||
const char *value = MSG_ReadString( msg );
|
||||
|
||||
if( svgame.dllFuncs2.pfnCvarValue != NULL )
|
||||
svgame.dllFuncs2.pfnCvarValue( cl->edict, value );
|
||||
MsgDev( D_AICONSOLE, "Cvar query response: name:%s, value:%s\n", cl->name, value );
|
||||
MsgDev( D_REPORT, "Cvar query response: name:%s, value:%s\n", cl->name, value );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2324,13 +2324,13 @@ Parse a requested value from client cvar
|
|||
void SV_ParseCvarValue2( sv_client_t *cl, sizebuf_t *msg )
|
||||
{
|
||||
string name, value;
|
||||
int requestID = BF_ReadLong( msg );
|
||||
Q_strcpy( name, BF_ReadString( msg ));
|
||||
Q_strcpy( value, BF_ReadString( msg ));
|
||||
int requestID = MSG_ReadLong( msg );
|
||||
Q_strcpy( name, MSG_ReadString( msg ));
|
||||
Q_strcpy( value, MSG_ReadString( msg ));
|
||||
|
||||
if( svgame.dllFuncs2.pfnCvarValue2 != NULL )
|
||||
svgame.dllFuncs2.pfnCvarValue2( cl->edict, requestID, name, value );
|
||||
MsgDev( D_AICONSOLE, "Cvar query response: name:%s, request ID %d, cvar:%s, value:%s\n", cl->name, requestID, name, value );
|
||||
MsgDev( D_REPORT, "Cvar query response: name:%s, request ID %d, cvar:%s, value:%s\n", cl->name, requestID, name, value );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2377,7 +2377,7 @@ void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
// read optional clientCommand strings
|
||||
while( cl->state != cs_zombie )
|
||||
{
|
||||
if( BF_CheckOverflow( msg ))
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
{
|
||||
MsgDev( D_ERROR, "SV_ReadClientMessage: clc_bad\n" );
|
||||
SV_DropClient( cl );
|
||||
|
@ -2385,20 +2385,20 @@ void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
}
|
||||
|
||||
// end of message
|
||||
if( BF_GetNumBitsLeft( msg ) < 8 )
|
||||
if( MSG_GetNumBitsLeft( msg ) < 8 )
|
||||
break;
|
||||
|
||||
c = BF_ReadByte( msg );
|
||||
c = MSG_ReadByte( msg );
|
||||
|
||||
switch( c )
|
||||
{
|
||||
case clc_nop:
|
||||
break;
|
||||
case clc_userinfo:
|
||||
SV_UserinfoChanged( cl, BF_ReadString( msg ));
|
||||
SV_UserinfoChanged( cl, MSG_ReadString( msg ));
|
||||
break;
|
||||
case clc_delta:
|
||||
cl->delta_sequence = BF_ReadByte( msg );
|
||||
cl->delta_sequence = MSG_ReadByte( msg );
|
||||
break;
|
||||
case clc_move:
|
||||
if( move_issued ) return; // someone is trying to cheat...
|
||||
|
@ -2406,7 +2406,7 @@ void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
SV_ParseClientMove( cl, msg );
|
||||
break;
|
||||
case clc_stringcmd:
|
||||
s = BF_ReadString( msg );
|
||||
s = MSG_ReadString( msg );
|
||||
// malicious users may try using too many string commands
|
||||
if( ++stringCmdCount < 8 ) SV_ExecuteClientCommand( cl, s );
|
||||
if( cl->state == cs_zombie ) return; // disconnect command
|
||||
|
|
|
@ -35,9 +35,9 @@ void SV_ClientPrintf( sv_client_t *cl, int level, char *fmt, ... )
|
|||
Q_vsprintf( string, fmt, argptr );
|
||||
va_end( argptr );
|
||||
|
||||
BF_WriteByte( &cl->netchan.message, svc_print );
|
||||
BF_WriteByte( &cl->netchan.message, level );
|
||||
BF_WriteString( &cl->netchan.message, string );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_print );
|
||||
MSG_WriteByte( &cl->netchan.message, level );
|
||||
MSG_WriteString( &cl->netchan.message, string );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -69,9 +69,9 @@ void SV_BroadcastPrintf( int level, char *fmt, ... )
|
|||
if( cl->state != cs_spawned ) continue;
|
||||
if( cl->fakeclient ) continue;
|
||||
|
||||
BF_WriteByte( &cl->netchan.message, svc_print );
|
||||
BF_WriteByte( &cl->netchan.message, level );
|
||||
BF_WriteString( &cl->netchan.message, string );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_print );
|
||||
MSG_WriteByte( &cl->netchan.message, level );
|
||||
MSG_WriteString( &cl->netchan.message, string );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,8 +92,8 @@ void SV_BroadcastCommand( char *fmt, ... )
|
|||
Q_vsprintf( string, fmt, argptr );
|
||||
va_end( argptr );
|
||||
|
||||
BF_WriteByte( &sv.reliable_datagram, svc_stufftext );
|
||||
BF_WriteString( &sv.reliable_datagram, string );
|
||||
MSG_WriteByte( &sv.reliable_datagram, svc_stufftext );
|
||||
MSG_WriteString( &sv.reliable_datagram, string );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -305,7 +305,7 @@ void SV_SendConsistencyList( sizebuf_t *msg )
|
|||
if( mp_consistency->integer && ( sv.num_consistency_resources > 0 ) && !svs.currentPlayer->hltv_proxy )
|
||||
{
|
||||
lastIndex = 0;
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
|
||||
for( i = 0; i < sv.num_resources; i++ )
|
||||
{
|
||||
|
@ -315,14 +315,14 @@ void SV_SendConsistencyList( sizebuf_t *msg )
|
|||
continue;
|
||||
|
||||
resIndex = (i - lastIndex);
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteSBitLong( msg, resIndex, MAX_MODEL_BITS );
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteSBitLong( msg, resIndex, MAX_MODEL_BITS );
|
||||
lastIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
// write end of the list
|
||||
BF_WriteOneBit( msg, 0 );
|
||||
MSG_WriteOneBit( msg, 0 );
|
||||
}
|
||||
|
||||
void SV_SendResources( sizebuf_t *msg )
|
||||
|
@ -332,34 +332,34 @@ void SV_SendResources( sizebuf_t *msg )
|
|||
|
||||
Q_memset( nullrguc, 0, sizeof( nullrguc ));
|
||||
|
||||
BF_WriteByte( msg, svc_customization );
|
||||
BF_WriteLong( msg, svs.spawncount );
|
||||
MSG_WriteByte( msg, svc_customization );
|
||||
MSG_WriteLong( msg, svs.spawncount );
|
||||
|
||||
// g-cont. This is more than HL limit but unmatched with GoldSrc protocol
|
||||
BF_WriteSBitLong( msg, sv.num_resources, MAX_MODEL_BITS );
|
||||
MSG_WriteSBitLong( msg, sv.num_resources, MAX_MODEL_BITS );
|
||||
|
||||
for( i = 0; i < sv.num_resources; i++ )
|
||||
{
|
||||
BF_WriteSBitLong( msg, sv.resources[i].type, 4 );
|
||||
BF_WriteString( msg, sv.resources[i].szFileName );
|
||||
BF_WriteSBitLong( msg, sv.resources[i].nIndex, MAX_MODEL_BITS );
|
||||
BF_WriteSBitLong( msg, sv.resources[i].nDownloadSize, 24 ); // prevent to download a very big files?
|
||||
BF_WriteSBitLong( msg, sv.resources[i].ucFlags, 3 ); // g-cont. why only first three flags?
|
||||
MSG_WriteSBitLong( msg, sv.resources[i].type, 4 );
|
||||
MSG_WriteString( msg, sv.resources[i].szFileName );
|
||||
MSG_WriteSBitLong( msg, sv.resources[i].nIndex, MAX_MODEL_BITS );
|
||||
MSG_WriteSBitLong( msg, sv.resources[i].nDownloadSize, 24 ); // prevent to download a very big files?
|
||||
MSG_WriteSBitLong( msg, sv.resources[i].ucFlags, 3 ); // g-cont. why only first three flags?
|
||||
|
||||
if( sv.resources[i].ucFlags & RES_CUSTOM )
|
||||
{
|
||||
BF_WriteBits( msg, sv.resources[i].rgucMD5_hash, sizeof( sv.resources[i].rgucMD5_hash ));
|
||||
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 )))
|
||||
{
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteBits( msg, sv.resources[i].rguc_reserved, sizeof( sv.resources[i].rguc_reserved ));
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteBits( msg, sv.resources[i].rguc_reserved, sizeof( sv.resources[i].rguc_reserved ));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
BF_WriteOneBit( msg, 0 );
|
||||
MSG_WriteOneBit( msg, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -191,14 +191,14 @@ void SV_EmitPacketEntities( sv_client_t *cl, client_frame_t *to, sizebuf_t *msg
|
|||
from = NULL;
|
||||
from_num_entities = 0;
|
||||
|
||||
BF_WriteByte( msg, svc_packetentities );
|
||||
BF_WriteWord( msg, to->num_entities );
|
||||
MSG_WriteByte( msg, svc_packetentities );
|
||||
MSG_WriteWord( msg, to->num_entities );
|
||||
}
|
||||
else
|
||||
{
|
||||
BF_WriteByte( msg, svc_deltapacketentities );
|
||||
BF_WriteWord( msg, to->num_entities );
|
||||
BF_WriteByte( msg, cl->delta_sequence );
|
||||
MSG_WriteByte( msg, svc_deltapacketentities );
|
||||
MSG_WriteWord( msg, to->num_entities );
|
||||
MSG_WriteByte( msg, cl->delta_sequence );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -206,8 +206,8 @@ void SV_EmitPacketEntities( sv_client_t *cl, client_frame_t *to, sizebuf_t *msg
|
|||
from = NULL;
|
||||
from_num_entities = 0;
|
||||
|
||||
BF_WriteByte( msg, svc_packetentities );
|
||||
BF_WriteWord( msg, to->num_entities );
|
||||
MSG_WriteByte( msg, svc_packetentities );
|
||||
MSG_WriteWord( msg, to->num_entities );
|
||||
}
|
||||
|
||||
newent = NULL;
|
||||
|
@ -271,7 +271,7 @@ void SV_EmitPacketEntities( sv_client_t *cl, client_frame_t *to, sizebuf_t *msg
|
|||
}
|
||||
}
|
||||
|
||||
BF_WriteWord( msg, 0 ); // end of packetentities
|
||||
MSG_WriteWord( msg, 0 ); // end of packetentities
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -341,8 +341,8 @@ static void SV_EmitEvents( sv_client_t *cl, client_frame_t *to, sizebuf_t *msg )
|
|||
}
|
||||
}
|
||||
|
||||
BF_WriteByte( msg, svc_event ); // create message
|
||||
BF_WriteUBitLong( msg, ev_count, 5 ); // up to MAX_EVENT_QUEUE events
|
||||
MSG_WriteByte( msg, svc_event ); // create message
|
||||
MSG_WriteUBitLong( msg, ev_count, 5 ); // up to MAX_EVENT_QUEUE events
|
||||
|
||||
for( count = i = 0; i < MAX_EVENT_QUEUE; i++ )
|
||||
{
|
||||
|
@ -358,34 +358,34 @@ static void SV_EmitEvents( sv_client_t *cl, client_frame_t *to, sizebuf_t *msg )
|
|||
// only send if there's room
|
||||
if( count < ev_count )
|
||||
{
|
||||
BF_WriteUBitLong( msg, info->index, MAX_EVENT_BITS ); // 1024 events
|
||||
MSG_WriteUBitLong( msg, info->index, MAX_EVENT_BITS ); // 1024 events
|
||||
|
||||
if( info->packet_index == -1 )
|
||||
{
|
||||
BF_WriteOneBit( msg, 0 );
|
||||
MSG_WriteOneBit( msg, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteUBitLong( msg, info->packet_index, MAX_ENTITY_BITS );
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteUBitLong( msg, info->packet_index, MAX_ENTITY_BITS );
|
||||
|
||||
if( !Q_memcmp( &nullargs, &info->args, sizeof( event_args_t )))
|
||||
{
|
||||
BF_WriteOneBit( msg, 0 );
|
||||
MSG_WriteOneBit( msg, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteDeltaEvent( msg, &nullargs, &info->args );
|
||||
}
|
||||
}
|
||||
|
||||
if( info->fire_time )
|
||||
{
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteWord( msg, Q_rint( info->fire_time * 100.0f ));
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteWord( msg, Q_rint( info->fire_time * 100.0f ));
|
||||
}
|
||||
else BF_WriteOneBit( msg, 0 );
|
||||
else MSG_WriteOneBit( msg, 0 );
|
||||
}
|
||||
|
||||
info->index = 0;
|
||||
|
@ -407,7 +407,7 @@ void SV_EmitPings( sizebuf_t *msg )
|
|||
int packet_loss;
|
||||
int i, ping;
|
||||
|
||||
BF_WriteByte( msg, svc_updatepings );
|
||||
MSG_WriteByte( msg, svc_updatepings );
|
||||
|
||||
for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ )
|
||||
{
|
||||
|
@ -417,14 +417,14 @@ void SV_EmitPings( sizebuf_t *msg )
|
|||
SV_GetPlayerStats( cl, &ping, &packet_loss );
|
||||
|
||||
// there are 25 bits for each client
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteUBitLong( msg, i, MAX_CLIENT_BITS );
|
||||
BF_WriteUBitLong( msg, ping, 12 );
|
||||
BF_WriteUBitLong( msg, packet_loss, 7 );
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteUBitLong( msg, i, MAX_CLIENT_BITS );
|
||||
MSG_WriteUBitLong( msg, ping, 12 );
|
||||
MSG_WriteUBitLong( msg, packet_loss, 7 );
|
||||
}
|
||||
|
||||
// end marker
|
||||
BF_WriteOneBit( msg, 0 );
|
||||
MSG_WriteOneBit( msg, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -454,8 +454,8 @@ void SV_WriteClientdataToMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
|
||||
if( cl->chokecount != 0 )
|
||||
{
|
||||
BF_WriteByte( msg, svc_chokecount );
|
||||
BF_WriteByte( msg, cl->chokecount );
|
||||
MSG_WriteByte( msg, svc_chokecount );
|
||||
MSG_WriteByte( msg, cl->chokecount );
|
||||
cl->chokecount = 0;
|
||||
}
|
||||
|
||||
|
@ -463,15 +463,15 @@ void SV_WriteClientdataToMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
switch( clent->v.fixangle )
|
||||
{
|
||||
case 1:
|
||||
BF_WriteByte( msg, svc_setangle );
|
||||
BF_WriteBitAngle( msg, clent->v.angles[0], 16 );
|
||||
BF_WriteBitAngle( msg, clent->v.angles[1], 16 );
|
||||
BF_WriteBitAngle( msg, clent->v.angles[2], 16 );
|
||||
MSG_WriteByte( msg, svc_setangle );
|
||||
MSG_WriteBitAngle( msg, clent->v.angles[0], 16 );
|
||||
MSG_WriteBitAngle( msg, clent->v.angles[1], 16 );
|
||||
MSG_WriteBitAngle( msg, clent->v.angles[2], 16 );
|
||||
clent->v.effects |= EF_NOINTERP;
|
||||
break;
|
||||
case 2:
|
||||
BF_WriteByte( msg, svc_addangle );
|
||||
BF_WriteBitAngle( msg, clent->v.avelocity[1], 16 );
|
||||
MSG_WriteByte( msg, svc_addangle );
|
||||
MSG_WriteBitAngle( msg, clent->v.avelocity[1], 16 );
|
||||
clent->v.avelocity[1] = 0.0f;
|
||||
break;
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ void SV_WriteClientdataToMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
// update clientdata_t
|
||||
svgame.dllFuncs.pfnUpdateClientData( clent, cl->local_weapons, &frame->clientdata );
|
||||
|
||||
BF_WriteByte( msg, svc_clientdata );
|
||||
MSG_WriteByte( msg, svc_clientdata );
|
||||
if( cl->hltv_proxy ) return; // don't send more nothing
|
||||
|
||||
if( cl->delta_sequence == -1 ) from_cd = &nullcd;
|
||||
|
@ -492,12 +492,12 @@ void SV_WriteClientdataToMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
|
||||
if( cl->delta_sequence == -1 )
|
||||
{
|
||||
BF_WriteOneBit( msg, 0 ); // no delta-compression
|
||||
MSG_WriteOneBit( msg, 0 ); // no delta-compression
|
||||
}
|
||||
else
|
||||
{
|
||||
BF_WriteOneBit( msg, 1 ); // we are delta-ing from
|
||||
BF_WriteByte( msg, cl->delta_sequence );
|
||||
MSG_WriteOneBit( msg, 1 ); // we are delta-ing from
|
||||
MSG_WriteByte( msg, cl->delta_sequence );
|
||||
}
|
||||
|
||||
// write clientdata_t
|
||||
|
@ -518,7 +518,7 @@ void SV_WriteClientdataToMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
}
|
||||
|
||||
// end marker
|
||||
BF_WriteOneBit( msg, 0 );
|
||||
MSG_WriteOneBit( msg, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -608,30 +608,30 @@ void SV_SendClientDatagram( sv_client_t *cl )
|
|||
svs.currentPlayerNum = (cl - svs.clients);
|
||||
|
||||
Q_memset( msg_buf, 0, NET_MAX_PAYLOAD );
|
||||
BF_Init( &msg, "Datagram", msg_buf, sizeof( msg_buf ));
|
||||
MSG_Init( &msg, "Datagram", msg_buf, sizeof( msg_buf ));
|
||||
|
||||
// always send servertime at new frame
|
||||
BF_WriteByte( &msg, svc_time );
|
||||
BF_WriteFloat( &msg, sv.time );
|
||||
MSG_WriteByte( &msg, svc_time );
|
||||
MSG_WriteFloat( &msg, sv.time );
|
||||
|
||||
SV_WriteClientdataToMessage( cl, &msg );
|
||||
SV_WriteEntitiesToClient( cl, &msg );
|
||||
|
||||
// copy the accumulated multicast datagram
|
||||
// for this client out to the message
|
||||
if( BF_CheckOverflow( &cl->datagram )) MsgDev( D_WARN, "datagram overflowed for %s\n", cl->name );
|
||||
else BF_WriteBits( &msg, BF_GetData( &cl->datagram ), BF_GetNumBitsWritten( &cl->datagram ));
|
||||
BF_Clear( &cl->datagram );
|
||||
if( MSG_CheckOverflow( &cl->datagram )) MsgDev( D_WARN, "datagram overflowed for %s\n", cl->name );
|
||||
else MSG_WriteBits( &msg, MSG_GetData( &cl->datagram ), MSG_GetNumBitsWritten( &cl->datagram ));
|
||||
MSG_Clear( &cl->datagram );
|
||||
|
||||
if( BF_CheckOverflow( &msg ))
|
||||
if( MSG_CheckOverflow( &msg ))
|
||||
{
|
||||
// must have room left for the packet header
|
||||
MsgDev( D_WARN, "msg overflowed for %s\n", cl->name );
|
||||
BF_Clear( &msg );
|
||||
MSG_Clear( &msg );
|
||||
}
|
||||
|
||||
// send the datagram
|
||||
Netchan_TransmitBits( &cl->netchan, BF_GetNumBitsWritten( &msg ), BF_GetData( &msg ));
|
||||
Netchan_TransmitBits( &cl->netchan, MSG_GetNumBitsWritten( &msg ), MSG_GetData( &msg ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -669,24 +669,24 @@ void SV_UpdateToReliableMessages( void )
|
|||
if( sv.write_bad_message && Com_RandomLong( 0, 512 ) == 404 )
|
||||
{
|
||||
// just for network debugging (send only for local client)
|
||||
BF_WriteByte( &sv.datagram, svc_bad );
|
||||
BF_WriteLong( &sv.datagram, rand( )); // send some random data
|
||||
BF_WriteString( &sv.datagram, host.finalmsg ); // send final message
|
||||
MSG_WriteByte( &sv.datagram, svc_bad );
|
||||
MSG_WriteLong( &sv.datagram, rand( )); // send some random data
|
||||
MSG_WriteString( &sv.datagram, host.finalmsg ); // send final message
|
||||
sv.write_bad_message = false;
|
||||
}
|
||||
|
||||
// clear the server datagram if it overflowed.
|
||||
if( BF_CheckOverflow( &sv.datagram ))
|
||||
if( MSG_CheckOverflow( &sv.datagram ))
|
||||
{
|
||||
MsgDev( D_ERROR, "sv.datagram overflowed!\n" );
|
||||
BF_Clear( &sv.datagram );
|
||||
MSG_Clear( &sv.datagram );
|
||||
}
|
||||
|
||||
// clear the server datagram if it overflowed.
|
||||
if( BF_CheckOverflow( &sv.spectator_datagram ))
|
||||
if( MSG_CheckOverflow( &sv.spectator_datagram ))
|
||||
{
|
||||
MsgDev( D_ERROR, "sv.spectator_datagram overflowed!\n" );
|
||||
BF_Clear( &sv.spectator_datagram );
|
||||
MSG_Clear( &sv.spectator_datagram );
|
||||
}
|
||||
|
||||
// now send the reliable and server datagrams to all clients.
|
||||
|
@ -695,19 +695,19 @@ void SV_UpdateToReliableMessages( void )
|
|||
if( cl->state < cs_connected || cl->fakeclient )
|
||||
continue; // reliables go to all connected or spawned
|
||||
|
||||
BF_WriteBits( &cl->netchan.message, BF_GetData( &sv.reliable_datagram ), BF_GetNumBitsWritten( &sv.reliable_datagram ));
|
||||
BF_WriteBits( &cl->datagram, BF_GetData( &sv.datagram ), BF_GetNumBitsWritten( &sv.datagram ));
|
||||
MSG_WriteBits( &cl->netchan.message, MSG_GetData( &sv.reliable_datagram ), MSG_GetNumBitsWritten( &sv.reliable_datagram ));
|
||||
MSG_WriteBits( &cl->datagram, MSG_GetData( &sv.datagram ), MSG_GetNumBitsWritten( &sv.datagram ));
|
||||
|
||||
if( cl->hltv_proxy )
|
||||
{
|
||||
BF_WriteBits( &cl->datagram, BF_GetData( &sv.spectator_datagram ), BF_GetNumBitsWritten( &sv.spectator_datagram ));
|
||||
MSG_WriteBits( &cl->datagram, MSG_GetData( &sv.spectator_datagram ), MSG_GetNumBitsWritten( &sv.spectator_datagram ));
|
||||
}
|
||||
}
|
||||
|
||||
// now clear the reliable and datagram buffers.
|
||||
BF_Clear( &sv.spectator_datagram );
|
||||
BF_Clear( &sv.reliable_datagram );
|
||||
BF_Clear( &sv.datagram );
|
||||
MSG_Clear( &sv.spectator_datagram );
|
||||
MSG_Clear( &sv.reliable_datagram );
|
||||
MSG_Clear( &sv.datagram );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -760,10 +760,10 @@ void SV_SendClientMessages( void )
|
|||
}
|
||||
|
||||
// if the reliable message overflowed, drop the client
|
||||
if( BF_CheckOverflow( &cl->netchan.message ))
|
||||
if( MSG_CheckOverflow( &cl->netchan.message ))
|
||||
{
|
||||
BF_Clear( &cl->netchan.message );
|
||||
BF_Clear( &cl->datagram );
|
||||
MSG_Clear( &cl->netchan.message );
|
||||
MSG_Clear( &cl->datagram );
|
||||
SV_BroadcastPrintf( PRINT_HIGH, "%s overflowed\n", cl->name );
|
||||
MsgDev( D_WARN, "reliable overflow for %s\n", cl->name );
|
||||
SV_DropClient( cl );
|
||||
|
@ -885,6 +885,6 @@ void SV_InactivateClients( void )
|
|||
svs.clients[i].state = cs_connected;
|
||||
|
||||
// clear netchan message (but keep other buffers)
|
||||
BF_Clear( &cl->netchan.message );
|
||||
MSG_Clear( &cl->netchan.message );
|
||||
}
|
||||
}
|
|
@ -282,8 +282,8 @@ qboolean SV_Send( int dest, const vec3_t origin, const edict_t *ent, qboolean us
|
|||
if( sv.state == ss_loading )
|
||||
{
|
||||
// copy to signon buffer
|
||||
BF_WriteBits( &sv.signon, BF_GetData( &sv.multicast ), BF_GetNumBitsWritten( &sv.multicast ));
|
||||
BF_Clear( &sv.multicast );
|
||||
MSG_WriteBits( &sv.signon, MSG_GetData( &sv.multicast ), MSG_GetNumBitsWritten( &sv.multicast ));
|
||||
MSG_Clear( &sv.multicast );
|
||||
return true;
|
||||
}
|
||||
// intentional fallthrough (in-game MSG_INIT it's a MSG_ALL reliable)
|
||||
|
@ -351,13 +351,13 @@ qboolean SV_Send( int dest, const vec3_t origin, const edict_t *ent, qboolean us
|
|||
if( !SV_CheckClientVisiblity( cl, mask ))
|
||||
continue;
|
||||
|
||||
if( specproxy ) BF_WriteBits( &sv.spectator_datagram, BF_GetData( &sv.multicast ), BF_GetNumBitsWritten( &sv.multicast ));
|
||||
else if( reliable ) BF_WriteBits( &cl->netchan.message, BF_GetData( &sv.multicast ), BF_GetNumBitsWritten( &sv.multicast ));
|
||||
else BF_WriteBits( &cl->datagram, BF_GetData( &sv.multicast ), BF_GetNumBitsWritten( &sv.multicast ));
|
||||
if( specproxy ) MSG_WriteBits( &sv.spectator_datagram, MSG_GetData( &sv.multicast ), MSG_GetNumBitsWritten( &sv.multicast ));
|
||||
else if( reliable ) MSG_WriteBits( &cl->netchan.message, MSG_GetData( &sv.multicast ), MSG_GetNumBitsWritten( &sv.multicast ));
|
||||
else MSG_WriteBits( &cl->datagram, MSG_GetData( &sv.multicast ), MSG_GetNumBitsWritten( &sv.multicast ));
|
||||
numsends++;
|
||||
}
|
||||
|
||||
BF_Clear( &sv.multicast );
|
||||
MSG_Clear( &sv.multicast );
|
||||
|
||||
return numsends; // debug
|
||||
}
|
||||
|
@ -400,18 +400,18 @@ void SV_CreateDecal( sizebuf_t *msg, const float *origin, int decalIndex, int en
|
|||
return;
|
||||
|
||||
// this can happens if serialized map contain 4096 static decals...
|
||||
if(( BF_GetNumBytesWritten( msg ) + 20 ) >= BF_GetMaxBytes( msg ))
|
||||
if(( MSG_GetNumBytesWritten( msg ) + 20 ) >= MSG_GetMaxBytes( msg ))
|
||||
return;
|
||||
|
||||
// static decals are posters, it's always reliable
|
||||
BF_WriteByte( msg, svc_bspdecal );
|
||||
BF_WriteVec3Coord( msg, origin );
|
||||
BF_WriteWord( msg, decalIndex );
|
||||
BF_WriteShort( msg, entityIndex );
|
||||
MSG_WriteByte( msg, svc_bspdecal );
|
||||
MSG_WriteVec3Coord( msg, origin );
|
||||
MSG_WriteWord( msg, decalIndex );
|
||||
MSG_WriteShort( msg, entityIndex );
|
||||
if( entityIndex > 0 )
|
||||
BF_WriteWord( msg, modelIndex );
|
||||
BF_WriteByte( msg, flags );
|
||||
BF_WriteWord( msg, scale * 4096 );
|
||||
MSG_WriteWord( msg, modelIndex );
|
||||
MSG_WriteByte( msg, flags );
|
||||
MSG_WriteWord( msg, scale * 4096 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -434,29 +434,29 @@ void SV_CreateStudioDecal( sizebuf_t *msg, const float *origin, const float *sta
|
|||
ASSERT( start );
|
||||
|
||||
// this can happens if serialized map contain 4096 static decals...
|
||||
if(( BF_GetNumBytesWritten( msg ) + 30 ) >= BF_GetMaxBytes( msg ))
|
||||
if(( MSG_GetNumBytesWritten( msg ) + 30 ) >= MSG_GetMaxBytes( msg ))
|
||||
return;
|
||||
|
||||
// static decals are posters, it's always reliable
|
||||
BF_WriteByte( msg, svc_studiodecal );
|
||||
BF_WriteVec3Coord( msg, origin );
|
||||
BF_WriteVec3Coord( msg, start );
|
||||
BF_WriteWord( msg, decalIndex );
|
||||
BF_WriteWord( msg, entityIndex );
|
||||
BF_WriteByte( msg, flags );
|
||||
MSG_WriteByte( msg, svc_studiodecal );
|
||||
MSG_WriteVec3Coord( msg, origin );
|
||||
MSG_WriteVec3Coord( msg, start );
|
||||
MSG_WriteWord( msg, decalIndex );
|
||||
MSG_WriteWord( msg, entityIndex );
|
||||
MSG_WriteByte( msg, flags );
|
||||
|
||||
// write model state
|
||||
BF_WriteShort( msg, state->sequence );
|
||||
BF_WriteShort( msg, state->frame );
|
||||
BF_WriteByte( msg, state->blending[0] );
|
||||
BF_WriteByte( msg, state->blending[1] );
|
||||
BF_WriteByte( msg, state->controller[0] );
|
||||
BF_WriteByte( msg, state->controller[1] );
|
||||
BF_WriteByte( msg, state->controller[2] );
|
||||
BF_WriteByte( msg, state->controller[3] );
|
||||
BF_WriteWord( msg, modelIndex );
|
||||
BF_WriteByte( msg, state->body );
|
||||
BF_WriteByte( msg, state->skin );
|
||||
MSG_WriteShort( msg, state->sequence );
|
||||
MSG_WriteShort( msg, state->frame );
|
||||
MSG_WriteByte( msg, state->blending[0] );
|
||||
MSG_WriteByte( msg, state->blending[1] );
|
||||
MSG_WriteByte( msg, state->controller[0] );
|
||||
MSG_WriteByte( msg, state->controller[1] );
|
||||
MSG_WriteByte( msg, state->controller[2] );
|
||||
MSG_WriteByte( msg, state->controller[3] );
|
||||
MSG_WriteWord( msg, modelIndex );
|
||||
MSG_WriteByte( msg, state->body );
|
||||
MSG_WriteByte( msg, state->skin );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -471,33 +471,33 @@ void SV_CreateStaticEntity( sizebuf_t *msg, sv_static_entity_t *ent )
|
|||
int index, i;
|
||||
|
||||
// this can happens if serialized map contain too many static entities...
|
||||
if(( BF_GetNumBytesWritten( msg ) + 64 ) >= BF_GetMaxBytes( msg ))
|
||||
if(( MSG_GetNumBytesWritten( msg ) + 64 ) >= MSG_GetMaxBytes( msg ))
|
||||
return;
|
||||
|
||||
index = SV_ModelIndex( ent->model );
|
||||
|
||||
BF_WriteByte( msg, svc_spawnstatic );
|
||||
BF_WriteShort(msg, index );
|
||||
BF_WriteByte( msg, ent->sequence );
|
||||
BF_WriteByte( msg, ent->frame );
|
||||
BF_WriteWord( msg, ent->colormap );
|
||||
BF_WriteByte( msg, ent->skin );
|
||||
MSG_WriteByte( msg, svc_spawnstatic );
|
||||
MSG_WriteShort(msg, index );
|
||||
MSG_WriteByte( msg, ent->sequence );
|
||||
MSG_WriteByte( msg, ent->frame );
|
||||
MSG_WriteWord( msg, ent->colormap );
|
||||
MSG_WriteByte( msg, ent->skin );
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
BF_WriteCoord( msg, ent->origin[i] );
|
||||
BF_WriteBitAngle( msg, ent->angles[i], 16 );
|
||||
MSG_WriteCoord( msg, ent->origin[i] );
|
||||
MSG_WriteBitAngle( msg, ent->angles[i], 16 );
|
||||
}
|
||||
|
||||
BF_WriteByte( msg, ent->rendermode );
|
||||
MSG_WriteByte( msg, ent->rendermode );
|
||||
|
||||
if( ent->rendermode != kRenderNormal )
|
||||
{
|
||||
BF_WriteByte( msg, ent->renderamt );
|
||||
BF_WriteByte( msg, ent->rendercolor.r );
|
||||
BF_WriteByte( msg, ent->rendercolor.g );
|
||||
BF_WriteByte( msg, ent->rendercolor.b );
|
||||
BF_WriteByte( msg, ent->renderfx );
|
||||
MSG_WriteByte( msg, ent->renderamt );
|
||||
MSG_WriteByte( msg, ent->rendercolor.r );
|
||||
MSG_WriteByte( msg, ent->rendercolor.g );
|
||||
MSG_WriteByte( msg, ent->rendercolor.b );
|
||||
MSG_WriteByte( msg, ent->renderfx );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -963,18 +963,18 @@ void SV_PlaybackReliableEvent( sizebuf_t *msg, word eventindex, float delay, eve
|
|||
|
||||
Q_memset( &nullargs, 0, sizeof( nullargs ));
|
||||
|
||||
BF_WriteByte( msg, svc_event_reliable );
|
||||
MSG_WriteByte( msg, svc_event_reliable );
|
||||
|
||||
// send event index
|
||||
BF_WriteUBitLong( msg, eventindex, MAX_EVENT_BITS );
|
||||
MSG_WriteUBitLong( msg, eventindex, MAX_EVENT_BITS );
|
||||
|
||||
if( delay )
|
||||
{
|
||||
// send event delay
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteWord( msg, Q_rint( delay * 100.0f ));
|
||||
MSG_WriteOneBit( msg, 1 );
|
||||
MSG_WriteWord( msg, Q_rint( delay * 100.0f ));
|
||||
}
|
||||
else BF_WriteOneBit( msg, 0 );
|
||||
else MSG_WriteOneBit( msg, 0 );
|
||||
|
||||
// reliable events not use delta-compression just null-compression
|
||||
MSG_WriteDeltaEvent( msg, &nullargs, args );
|
||||
|
@ -1893,19 +1893,19 @@ int SV_BuildSoundMsg( edict_t *ent, int chan, const char *samp, int vol, float a
|
|||
// not sending (because this is out of range)
|
||||
flags &= ~SND_SPAWNING;
|
||||
|
||||
BF_WriteByte( &sv.multicast, svc_sound );
|
||||
BF_WriteWord( &sv.multicast, flags );
|
||||
MSG_WriteByte( &sv.multicast, svc_sound );
|
||||
MSG_WriteWord( &sv.multicast, flags );
|
||||
if( flags & SND_LARGE_INDEX )
|
||||
BF_WriteWord( &sv.multicast, sound_idx );
|
||||
else BF_WriteByte( &sv.multicast, sound_idx );
|
||||
BF_WriteByte( &sv.multicast, chan );
|
||||
MSG_WriteWord( &sv.multicast, sound_idx );
|
||||
else MSG_WriteByte( &sv.multicast, sound_idx );
|
||||
MSG_WriteByte( &sv.multicast, chan );
|
||||
|
||||
if( flags & SND_VOLUME ) BF_WriteByte( &sv.multicast, vol );
|
||||
if( flags & SND_ATTENUATION ) BF_WriteByte( &sv.multicast, attn * 64 );
|
||||
if( flags & SND_PITCH ) BF_WriteByte( &sv.multicast, pitch );
|
||||
if( flags & SND_VOLUME ) MSG_WriteByte( &sv.multicast, vol );
|
||||
if( flags & SND_ATTENUATION ) MSG_WriteByte( &sv.multicast, attn * 64 );
|
||||
if( flags & SND_PITCH ) MSG_WriteByte( &sv.multicast, pitch );
|
||||
|
||||
BF_WriteWord( &sv.multicast, entityIndex );
|
||||
BF_WriteVec3Coord( &sv.multicast, pos );
|
||||
MSG_WriteWord( &sv.multicast, entityIndex );
|
||||
MSG_WriteVec3Coord( &sv.multicast, pos );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1985,19 +1985,19 @@ void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float
|
|||
// not sending (because this is out of range)
|
||||
flags &= ~SND_SPAWNING;
|
||||
|
||||
BF_WriteByte( &sv.multicast, svc_sound );
|
||||
BF_WriteWord( &sv.multicast, flags );
|
||||
MSG_WriteByte( &sv.multicast, svc_sound );
|
||||
MSG_WriteWord( &sv.multicast, flags );
|
||||
if( flags & SND_LARGE_INDEX )
|
||||
BF_WriteWord( &sv.multicast, sound_idx );
|
||||
else BF_WriteByte( &sv.multicast, sound_idx );
|
||||
BF_WriteByte( &sv.multicast, chan );
|
||||
MSG_WriteWord( &sv.multicast, sound_idx );
|
||||
else MSG_WriteByte( &sv.multicast, sound_idx );
|
||||
MSG_WriteByte( &sv.multicast, chan );
|
||||
|
||||
if( flags & SND_VOLUME ) BF_WriteByte( &sv.multicast, vol * 255 );
|
||||
if( flags & SND_ATTENUATION ) BF_WriteByte( &sv.multicast, attn * 64 );
|
||||
if( flags & SND_PITCH ) BF_WriteByte( &sv.multicast, pitch );
|
||||
if( flags & SND_VOLUME ) MSG_WriteByte( &sv.multicast, vol * 255 );
|
||||
if( flags & SND_ATTENUATION ) MSG_WriteByte( &sv.multicast, attn * 64 );
|
||||
if( flags & SND_PITCH ) MSG_WriteByte( &sv.multicast, pitch );
|
||||
|
||||
BF_WriteWord( &sv.multicast, entityIndex );
|
||||
BF_WriteVec3Coord( &sv.multicast, origin );
|
||||
MSG_WriteWord( &sv.multicast, entityIndex );
|
||||
MSG_WriteVec3Coord( &sv.multicast, origin );
|
||||
|
||||
SV_Send( msg_dest, origin, NULL, false );
|
||||
}
|
||||
|
@ -2064,20 +2064,20 @@ void pfnEmitAmbientSound( edict_t *ent, float *pos, const char *sample, float vo
|
|||
// not sending (because this is out of range)
|
||||
flags &= ~SND_SPAWNING;
|
||||
|
||||
BF_WriteByte( &sv.multicast, svc_ambientsound );
|
||||
BF_WriteWord( &sv.multicast, flags );
|
||||
MSG_WriteByte( &sv.multicast, svc_ambientsound );
|
||||
MSG_WriteWord( &sv.multicast, flags );
|
||||
if( flags & SND_LARGE_INDEX )
|
||||
BF_WriteWord( &sv.multicast, sound_idx );
|
||||
else BF_WriteByte( &sv.multicast, sound_idx );
|
||||
BF_WriteByte( &sv.multicast, CHAN_STATIC );
|
||||
MSG_WriteWord( &sv.multicast, sound_idx );
|
||||
else MSG_WriteByte( &sv.multicast, sound_idx );
|
||||
MSG_WriteByte( &sv.multicast, CHAN_STATIC );
|
||||
|
||||
if( flags & SND_VOLUME ) BF_WriteByte( &sv.multicast, vol * 255 );
|
||||
if( flags & SND_ATTENUATION ) BF_WriteByte( &sv.multicast, attn * 64 );
|
||||
if( flags & SND_PITCH ) BF_WriteByte( &sv.multicast, pitch );
|
||||
if( flags & SND_VOLUME ) MSG_WriteByte( &sv.multicast, vol * 255 );
|
||||
if( flags & SND_ATTENUATION ) MSG_WriteByte( &sv.multicast, attn * 64 );
|
||||
if( flags & SND_PITCH ) MSG_WriteByte( &sv.multicast, pitch );
|
||||
|
||||
// plays from fixed position
|
||||
BF_WriteWord( &sv.multicast, number );
|
||||
BF_WriteVec3Coord( &sv.multicast, pos );
|
||||
MSG_WriteWord( &sv.multicast, number );
|
||||
MSG_WriteVec3Coord( &sv.multicast, pos );
|
||||
|
||||
SV_Send( msg_dest, pos, NULL, false );
|
||||
}
|
||||
|
@ -2088,10 +2088,10 @@ SV_StartMusic
|
|||
|
||||
=================
|
||||
*/
|
||||
void SV_StartMusic( const char *curtrack, const char *looptrack, fs_offset_t position )
|
||||
void SV_StartMusic( const char *curtrack, const char *looptrack, long position )
|
||||
{
|
||||
BF_WriteByte( &sv.multicast, svc_stufftext );
|
||||
BF_WriteString( &sv.multicast, va( "music \"%s\" \"%s\" %i\n", curtrack, looptrack, position ));
|
||||
MSG_WriteByte( &sv.multicast, svc_stufftext );
|
||||
MSG_WriteString( &sv.multicast, va( "music \"%s\" \"%s\" %i\n", curtrack, looptrack, position ));
|
||||
SV_Send( MSG_ALL, NULL, NULL, false );
|
||||
}
|
||||
|
||||
|
@ -2366,8 +2366,8 @@ void pfnClientCommand( edict_t* pEdict, char* szFmt, ... )
|
|||
|
||||
if( SV_IsValidCmd( buffer ))
|
||||
{
|
||||
BF_WriteByte( &client->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &client->netchan.message, buffer );
|
||||
MSG_WriteByte( &client->netchan.message, svc_stufftext );
|
||||
MSG_WriteString( &client->netchan.message, buffer );
|
||||
}
|
||||
else MsgDev( D_ERROR, "Tried to stuff bad command %s\n", buffer );
|
||||
}
|
||||
|
@ -2390,18 +2390,18 @@ void pfnParticleEffect( const float *org, const float *dir, float color, float c
|
|||
return;
|
||||
}
|
||||
|
||||
BF_WriteByte( &sv.datagram, svc_particle );
|
||||
BF_WriteVec3Coord( &sv.datagram, org );
|
||||
MSG_WriteByte( &sv.datagram, svc_particle );
|
||||
MSG_WriteVec3Coord( &sv.datagram, org );
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
v = bound( -128, dir[i] * 16.0f, 127 );
|
||||
BF_WriteChar( &sv.datagram, v );
|
||||
MSG_WriteChar( &sv.datagram, v );
|
||||
}
|
||||
|
||||
BF_WriteByte( &sv.datagram, count );
|
||||
BF_WriteByte( &sv.datagram, color );
|
||||
BF_WriteByte( &sv.datagram, 0 );
|
||||
MSG_WriteByte( &sv.datagram, count );
|
||||
MSG_WriteByte( &sv.datagram, color );
|
||||
MSG_WriteByte( &sv.datagram, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2503,7 +2503,7 @@ void pfnMessageBegin( int msg_dest, int msg_num, const float *pOrigin, edict_t *
|
|||
svgame.msg_index = i;
|
||||
}
|
||||
|
||||
BF_WriteByte( &sv.multicast, msg_num );
|
||||
MSG_WriteByte( &sv.multicast, msg_num );
|
||||
|
||||
// save message destination
|
||||
if( pOrigin ) VectorCopy( pOrigin, svgame.msg_org );
|
||||
|
@ -2512,8 +2512,8 @@ void pfnMessageBegin( int msg_dest, int msg_num, const float *pOrigin, edict_t *
|
|||
if( iSize == -1 )
|
||||
{
|
||||
// variable sized messages sent size as first byte
|
||||
svgame.msg_size_index = BF_GetNumBytesWritten( &sv.multicast );
|
||||
BF_WriteByte( &sv.multicast, 0 ); // reserve space for now
|
||||
svgame.msg_size_index = MSG_GetNumBytesWritten( &sv.multicast );
|
||||
MSG_WriteByte( &sv.multicast, 0 ); // reserve space for now
|
||||
}
|
||||
else svgame.msg_size_index = -1; // message has constant size
|
||||
|
||||
|
@ -2540,7 +2540,7 @@ void pfnMessageEnd( void )
|
|||
// HACKHACK: clearing HudText in background mode
|
||||
if( sv.background && svgame.msg_index >= 0 && svgame.msg[svgame.msg_index].number == svgame.gmsgHudText )
|
||||
{
|
||||
BF_Clear( &sv.multicast );
|
||||
MSG_Clear( &sv.multicast );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2553,13 +2553,13 @@ void pfnMessageEnd( void )
|
|||
if( svgame.msg_realsize > 255 )
|
||||
{
|
||||
MsgDev( D_ERROR, "SV_Message: %s too long (more than 255 bytes)\n", name );
|
||||
BF_Clear( &sv.multicast );
|
||||
MSG_Clear( &sv.multicast );
|
||||
return;
|
||||
}
|
||||
else if( svgame.msg_realsize < 0 )
|
||||
{
|
||||
MsgDev( D_ERROR, "SV_Message: %s writes NULL message\n", name );
|
||||
BF_Clear( &sv.multicast );
|
||||
MSG_Clear( &sv.multicast );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2575,7 +2575,7 @@ void pfnMessageEnd( void )
|
|||
if( expsize != realsize )
|
||||
{
|
||||
MsgDev( D_ERROR, "SV_Message: %s expected %i bytes, it written %i. Ignored.\n", name, expsize, realsize );
|
||||
BF_Clear( &sv.multicast );
|
||||
MSG_Clear( &sv.multicast );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2585,13 +2585,13 @@ void pfnMessageEnd( void )
|
|||
if( svgame.msg_realsize > 255 )
|
||||
{
|
||||
MsgDev( D_ERROR, "SV_Message: %s too long (more than 255 bytes)\n", name );
|
||||
BF_Clear( &sv.multicast );
|
||||
MSG_Clear( &sv.multicast );
|
||||
return;
|
||||
}
|
||||
else if( svgame.msg_realsize < 0 )
|
||||
{
|
||||
MsgDev( D_ERROR, "SV_Message: %s writes NULL message\n", name );
|
||||
BF_Clear( &sv.multicast );
|
||||
MSG_Clear( &sv.multicast );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2601,7 +2601,7 @@ void pfnMessageEnd( void )
|
|||
{
|
||||
// this should never happen
|
||||
MsgDev( D_ERROR, "SV_Message: %s have encountered error\n", name );
|
||||
BF_Clear( &sv.multicast );
|
||||
MSG_Clear( &sv.multicast );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2609,9 +2609,9 @@ void pfnMessageEnd( void )
|
|||
{
|
||||
// oldstyle message for svc_studiodecal has missed four additional bytes:
|
||||
// modelIndex, skin and body. Write it here for backward compatibility
|
||||
BF_WriteWord( &sv.multicast, 0 );
|
||||
BF_WriteByte( &sv.multicast, 0 );
|
||||
BF_WriteByte( &sv.multicast, 0 );
|
||||
MSG_WriteWord( &sv.multicast, 0 );
|
||||
MSG_WriteByte( &sv.multicast, 0 );
|
||||
MSG_WriteByte( &sv.multicast, 0 );
|
||||
}
|
||||
|
||||
if( !VectorIsNull( svgame.msg_org )) org = svgame.msg_org;
|
||||
|
@ -2629,7 +2629,7 @@ pfnWriteByte
|
|||
void pfnWriteByte( int iValue )
|
||||
{
|
||||
if( iValue == -1 ) iValue = 0xFF; // convert char to byte
|
||||
BF_WriteByte( &sv.multicast, (byte)iValue );
|
||||
MSG_WriteByte( &sv.multicast, (byte)iValue );
|
||||
svgame.msg_realsize++;
|
||||
}
|
||||
|
||||
|
@ -2641,7 +2641,7 @@ pfnWriteChar
|
|||
*/
|
||||
void pfnWriteChar( int iValue )
|
||||
{
|
||||
BF_WriteChar( &sv.multicast, (char)iValue );
|
||||
MSG_WriteChar( &sv.multicast, (char)iValue );
|
||||
svgame.msg_realsize++;
|
||||
}
|
||||
|
||||
|
@ -2653,7 +2653,7 @@ pfnWriteShort
|
|||
*/
|
||||
void pfnWriteShort( int iValue )
|
||||
{
|
||||
BF_WriteShort( &sv.multicast, (short)iValue );
|
||||
MSG_WriteShort( &sv.multicast, (short)iValue );
|
||||
svgame.msg_realsize += 2;
|
||||
}
|
||||
|
||||
|
@ -2665,7 +2665,7 @@ pfnWriteLong
|
|||
*/
|
||||
void pfnWriteLong( int iValue )
|
||||
{
|
||||
BF_WriteLong( &sv.multicast, iValue );
|
||||
MSG_WriteLong( &sv.multicast, iValue );
|
||||
svgame.msg_realsize += 4;
|
||||
}
|
||||
|
||||
|
@ -2680,7 +2680,7 @@ void pfnWriteAngle( float flValue )
|
|||
{
|
||||
int iAngle = ((int)(( flValue ) * 256 / 360) & 255);
|
||||
|
||||
BF_WriteChar( &sv.multicast, iAngle );
|
||||
MSG_WriteChar( &sv.multicast, iAngle );
|
||||
svgame.msg_realsize += 1;
|
||||
}
|
||||
|
||||
|
@ -2692,7 +2692,7 @@ pfnWriteCoord
|
|||
*/
|
||||
void pfnWriteCoord( float flValue )
|
||||
{
|
||||
BF_WriteCoord( &sv.multicast, flValue );
|
||||
MSG_WriteCoord( &sv.multicast, flValue );
|
||||
svgame.msg_realsize += 2;
|
||||
}
|
||||
|
||||
|
@ -2711,7 +2711,7 @@ void pfnWriteString( const char *src )
|
|||
if( len >= rem )
|
||||
{
|
||||
MsgDev( D_ERROR, "pfnWriteString: exceeds %i symbols\n", rem );
|
||||
BF_WriteChar( &sv.multicast, 0 );
|
||||
MSG_WriteChar( &sv.multicast, 0 );
|
||||
svgame.msg_realsize += 1;
|
||||
return;
|
||||
}
|
||||
|
@ -2745,7 +2745,7 @@ void pfnWriteString( const char *src )
|
|||
}
|
||||
|
||||
*dst = '\0'; // string end (not included in count)
|
||||
BF_WriteString( &sv.multicast, string );
|
||||
MSG_WriteString( &sv.multicast, string );
|
||||
|
||||
// NOTE: some messages with constant string length can be marked as known sized
|
||||
svgame.msg_realsize += len;
|
||||
|
@ -2760,8 +2760,8 @@ pfnWriteEntity
|
|||
void pfnWriteEntity( int iValue )
|
||||
{
|
||||
if( iValue < 0 || iValue >= svgame.numEntities )
|
||||
Host_Error( "BF_WriteEntity: invalid entnumber %i\n", iValue );
|
||||
BF_WriteShort( &sv.multicast, (short)iValue );
|
||||
Host_Error( "MSG_WriteEntity: invalid entnumber %i\n", iValue );
|
||||
MSG_WriteShort( &sv.multicast, (short)iValue );
|
||||
svgame.msg_realsize += 2;
|
||||
}
|
||||
|
||||
|
@ -2786,7 +2786,7 @@ static void pfnAlertMessage( ALERT_TYPE level, char *szFmt, ... )
|
|||
return;
|
||||
break;
|
||||
case at_aiconsole:
|
||||
if( host.developer < D_AICONSOLE )
|
||||
if( host.developer < D_REPORT )
|
||||
return;
|
||||
break;
|
||||
case at_warning:
|
||||
|
@ -3111,10 +3111,10 @@ int pfnRegUserMsg( const char *pszName, int iSize )
|
|||
if( sv.state == ss_active )
|
||||
{
|
||||
// tell the client about new user message
|
||||
BF_WriteByte( &sv.multicast, svc_usermessage );
|
||||
BF_WriteByte( &sv.multicast, svgame.msg[i].number );
|
||||
BF_WriteByte( &sv.multicast, (byte)iSize );
|
||||
BF_WriteString( &sv.multicast, svgame.msg[i].name );
|
||||
MSG_WriteByte( &sv.multicast, svc_usermessage );
|
||||
MSG_WriteByte( &sv.multicast, svgame.msg[i].number );
|
||||
MSG_WriteByte( &sv.multicast, (byte)iSize );
|
||||
MSG_WriteString( &sv.multicast, svgame.msg[i].name );
|
||||
SV_Send( MSG_ALL, NULL, NULL, false );
|
||||
}
|
||||
|
||||
|
@ -3207,8 +3207,8 @@ void pfnClientPrintf( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg )
|
|||
break;
|
||||
case print_center:
|
||||
if( client->fakeclient ) return;
|
||||
BF_WriteByte( &client->netchan.message, svc_centerprint );
|
||||
BF_WriteString( &client->netchan.message, szMsg );
|
||||
MSG_WriteByte( &client->netchan.message, svc_centerprint );
|
||||
MSG_WriteString( &client->netchan.message, szMsg );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3280,9 +3280,9 @@ void pfnCrosshairAngle( const edict_t *pClient, float pitch, float yaw )
|
|||
if( yaw > 180.0f ) yaw -= 360;
|
||||
if( yaw < -180.0f ) yaw += 360;
|
||||
|
||||
BF_WriteByte( &client->netchan.message, svc_crosshairangle );
|
||||
BF_WriteChar( &client->netchan.message, pitch * 5 );
|
||||
BF_WriteChar( &client->netchan.message, yaw * 5 );
|
||||
MSG_WriteByte( &client->netchan.message, svc_crosshairangle );
|
||||
MSG_WriteChar( &client->netchan.message, pitch * 5 );
|
||||
MSG_WriteChar( &client->netchan.message, yaw * 5 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3319,8 +3319,8 @@ void pfnSetView( const edict_t *pClient, const edict_t *pViewent )
|
|||
// fakeclients ignore to send client message (but can see into the trigger_camera through the PVS)
|
||||
if( client->fakeclient ) return;
|
||||
|
||||
BF_WriteByte( &client->netchan.message, svc_setview );
|
||||
BF_WriteWord( &client->netchan.message, NUM_FOR_EDICT( pViewent ));
|
||||
MSG_WriteByte( &client->netchan.message, svc_setview );
|
||||
MSG_WriteWord( &client->netchan.message, NUM_FOR_EDICT( pViewent ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3430,11 +3430,11 @@ void pfnFadeClientVolume( const edict_t *pEdict, int fadePercent, int fadeOutSec
|
|||
|
||||
if( cl->fakeclient ) return;
|
||||
|
||||
BF_WriteByte( &cl->netchan.message, svc_soundfade );
|
||||
BF_WriteByte( &cl->netchan.message, fadePercent );
|
||||
BF_WriteByte( &cl->netchan.message, holdTime );
|
||||
BF_WriteByte( &cl->netchan.message, fadeOutSeconds );
|
||||
BF_WriteByte( &cl->netchan.message, fadeInSeconds );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_soundfade );
|
||||
MSG_WriteByte( &cl->netchan.message, fadePercent );
|
||||
MSG_WriteByte( &cl->netchan.message, holdTime );
|
||||
MSG_WriteByte( &cl->netchan.message, fadeOutSeconds );
|
||||
MSG_WriteByte( &cl->netchan.message, fadeInSeconds );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -4312,8 +4312,8 @@ void pfnQueryClientCvarValue( const edict_t *player, const char *cvarName )
|
|||
|
||||
if(( cl = SV_ClientFromEdict( player, true )) != NULL )
|
||||
{
|
||||
BF_WriteByte( &cl->netchan.message, svc_querycvarvalue );
|
||||
BF_WriteString( &cl->netchan.message, cvarName );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_querycvarvalue );
|
||||
MSG_WriteString( &cl->netchan.message, cvarName );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4342,9 +4342,9 @@ void pfnQueryClientCvarValue2( const edict_t *player, const char *cvarName, int
|
|||
|
||||
if(( cl = SV_ClientFromEdict( player, true )) != NULL )
|
||||
{
|
||||
BF_WriteByte( &cl->netchan.message, svc_querycvarvalue2 );
|
||||
BF_WriteLong( &cl->netchan.message, requestID );
|
||||
BF_WriteString( &cl->netchan.message, cvarName );
|
||||
MSG_WriteByte( &cl->netchan.message, svc_querycvarvalue2 );
|
||||
MSG_WriteLong( &cl->netchan.message, requestID );
|
||||
MSG_WriteString( &cl->netchan.message, cvarName );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4877,7 +4877,7 @@ qboolean SV_LoadProgs( const char *name )
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else MsgDev( D_AICONSOLE, "SV_LoadProgs: ^2initailized extended EntityAPI ^7ver. %i\n", version );
|
||||
else MsgDev( D_REPORT, "SV_LoadProgs: ^2initailized extended EntityAPI ^7ver. %i\n", version );
|
||||
}
|
||||
else if( !GetEntityAPI( &svgame.dllFuncs, version ))
|
||||
{
|
||||
|
|
|
@ -52,9 +52,9 @@ int SV_ModelIndex( const char *filename )
|
|||
if( sv.state != ss_loading )
|
||||
{
|
||||
// send the update to everyone
|
||||
BF_WriteByte( &sv.reliable_datagram, svc_modelindex );
|
||||
BF_WriteUBitLong( &sv.reliable_datagram, i, MAX_MODEL_BITS );
|
||||
BF_WriteString( &sv.reliable_datagram, name );
|
||||
MSG_WriteByte( &sv.reliable_datagram, svc_modelindex );
|
||||
MSG_WriteUBitLong( &sv.reliable_datagram, i, MAX_MODEL_BITS );
|
||||
MSG_WriteString( &sv.reliable_datagram, name );
|
||||
}
|
||||
|
||||
return i;
|
||||
|
@ -90,9 +90,9 @@ int SV_SoundIndex( const char *filename )
|
|||
if( sv.state != ss_loading )
|
||||
{
|
||||
// send the update to everyone
|
||||
BF_WriteByte( &sv.reliable_datagram, svc_soundindex );
|
||||
BF_WriteUBitLong( &sv.reliable_datagram, i, MAX_SOUND_BITS );
|
||||
BF_WriteString( &sv.reliable_datagram, name );
|
||||
MSG_WriteByte( &sv.reliable_datagram, svc_soundindex );
|
||||
MSG_WriteUBitLong( &sv.reliable_datagram, i, MAX_SOUND_BITS );
|
||||
MSG_WriteString( &sv.reliable_datagram, name );
|
||||
}
|
||||
|
||||
return i;
|
||||
|
@ -127,9 +127,9 @@ int SV_EventIndex( const char *filename )
|
|||
if( sv.state != ss_loading )
|
||||
{
|
||||
// send the update to everyone
|
||||
BF_WriteByte( &sv.reliable_datagram, svc_eventindex );
|
||||
BF_WriteUBitLong( &sv.reliable_datagram, i, MAX_EVENT_BITS );
|
||||
BF_WriteString( &sv.reliable_datagram, name );
|
||||
MSG_WriteByte( &sv.reliable_datagram, svc_eventindex );
|
||||
MSG_WriteUBitLong( &sv.reliable_datagram, i, MAX_EVENT_BITS );
|
||||
MSG_WriteString( &sv.reliable_datagram, name );
|
||||
}
|
||||
|
||||
return i;
|
||||
|
@ -529,11 +529,11 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot )
|
|||
svgame.globals->time = sv.time;
|
||||
|
||||
// initialize buffers
|
||||
BF_Init( &sv.datagram, "Datagram", sv.datagram_buf, sizeof( sv.datagram_buf ));
|
||||
BF_Init( &sv.reliable_datagram, "Datagram R", sv.reliable_datagram_buf, sizeof( sv.reliable_datagram_buf ));
|
||||
BF_Init( &sv.multicast, "Multicast", sv.multicast_buf, sizeof( sv.multicast_buf ));
|
||||
BF_Init( &sv.signon, "Signon", sv.signon_buf, sizeof( sv.signon_buf ));
|
||||
BF_Init( &sv.spectator_datagram, "Spectator Datagram", sv.spectator_buf, sizeof( sv.spectator_buf ));
|
||||
MSG_Init( &sv.datagram, "Datagram", sv.datagram_buf, sizeof( sv.datagram_buf ));
|
||||
MSG_Init( &sv.reliable_datagram, "Datagram R", sv.reliable_datagram_buf, sizeof( sv.reliable_datagram_buf ));
|
||||
MSG_Init( &sv.multicast, "Multicast", sv.multicast_buf, sizeof( sv.multicast_buf ));
|
||||
MSG_Init( &sv.signon, "Signon", sv.signon_buf, sizeof( sv.signon_buf ));
|
||||
MSG_Init( &sv.spectator_datagram, "Spectator Datagram", sv.spectator_buf, sizeof( sv.spectator_buf ));
|
||||
|
||||
// leave slots at start for clients only
|
||||
for( i = 0; i < sv_maxclients->integer; i++ )
|
||||
|
|
|
@ -267,9 +267,9 @@ void pfnUpdateServerInfo( const char *szKey, const char *szValue, const char *un
|
|||
|
||||
if( !cv || !cv->modified ) return; // this cvar not changed
|
||||
|
||||
BF_WriteByte( &sv.reliable_datagram, svc_serverinfo );
|
||||
BF_WriteString( &sv.reliable_datagram, szKey );
|
||||
BF_WriteString( &sv.reliable_datagram, szValue );
|
||||
MSG_WriteByte( &sv.reliable_datagram, svc_serverinfo );
|
||||
MSG_WriteString( &sv.reliable_datagram, szKey );
|
||||
MSG_WriteString( &sv.reliable_datagram, szValue );
|
||||
cv->modified = false; // reset state
|
||||
}
|
||||
|
||||
|
@ -336,19 +336,19 @@ void SV_ReadPackets( void )
|
|||
|
||||
while( NET_GetPacket( NS_SERVER, &net_from, net_message_buffer, &curSize ))
|
||||
{
|
||||
BF_Init( &net_message, "ClientPacket", net_message_buffer, curSize );
|
||||
MSG_Init( &net_message, "ClientPacket", net_message_buffer, curSize );
|
||||
|
||||
// check for connectionless packet (0xffffffff) first
|
||||
if( BF_GetMaxBytes( &net_message ) >= 4 && *(int *)net_message.pData == -1 )
|
||||
if( MSG_GetMaxBytes( &net_message ) >= 4 && *(int *)net_message.pData == -1 )
|
||||
{
|
||||
if( !svs.initialized )
|
||||
{
|
||||
char *args, *c;
|
||||
|
||||
BF_Clear( &net_message );
|
||||
BF_ReadLong( &net_message );// skip the -1 marker
|
||||
MSG_Clear( &net_message );
|
||||
MSG_ReadLong( &net_message );// skip the -1 marker
|
||||
|
||||
args = BF_ReadStringLine( &net_message );
|
||||
args = MSG_ReadStringLine( &net_message );
|
||||
Cmd_TokenizeString( args );
|
||||
c = Cmd_Argv( 0 );
|
||||
|
||||
|
@ -362,10 +362,10 @@ void SV_ReadPackets( void )
|
|||
|
||||
// read the qport out of the message so we can fix up
|
||||
// stupid address translating routers
|
||||
BF_Clear( &net_message );
|
||||
BF_ReadLong( &net_message ); // sequence number
|
||||
BF_ReadLong( &net_message ); // sequence number
|
||||
qport = (int)BF_ReadShort( &net_message ) & 0xffff;
|
||||
MSG_Clear( &net_message );
|
||||
MSG_ReadLong( &net_message ); // sequence number
|
||||
MSG_ReadLong( &net_message ); // sequence number
|
||||
qport = (int)MSG_ReadShort( &net_message ) & 0xffff;
|
||||
|
||||
// check for packets from connected clients
|
||||
for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ )
|
||||
|
@ -405,7 +405,7 @@ void SV_ReadPackets( void )
|
|||
{
|
||||
if( Netchan_CopyNormalFragments( &cl->netchan, &net_message ))
|
||||
{
|
||||
BF_Clear( &net_message );
|
||||
MSG_Clear( &net_message );
|
||||
SV_ExecuteClientMessage( cl, &net_message );
|
||||
}
|
||||
|
||||
|
@ -685,7 +685,7 @@ void SV_AddToMaster( netadr_t from, sizebuf_t *msg )
|
|||
}
|
||||
}
|
||||
|
||||
challenge = BF_ReadUBitLong( msg, sizeof( uint ) << 3 );
|
||||
challenge = MSG_ReadUBitLong( msg, sizeof( uint ) << 3 );
|
||||
|
||||
Info_SetValueForKey( s, "protocol", va( "%d", PROTOCOL_VERSION ) ); // protocol version
|
||||
Info_SetValueForKey( s, "challenge", va( "%u", challenge ) ); // challenge number
|
||||
|
@ -807,7 +807,7 @@ void SV_Init( void )
|
|||
sv_novis = Cvar_Get( "sv_novis", "0", 0, "force to ignore server visibility" );
|
||||
|
||||
SV_ClearSaveDir (); // delete all temporary *.hl files
|
||||
BF_Init( &net_message, "NetMessage", net_message_buffer, sizeof( net_message_buffer ));
|
||||
MSG_Init( &net_message, "NetMessage", net_message_buffer, sizeof( net_message_buffer ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -827,33 +827,33 @@ void SV_FinalMessage( char *message, qboolean reconnect )
|
|||
sizebuf_t msg;
|
||||
int i;
|
||||
|
||||
BF_Init( &msg, "FinalMessage", msg_buf, sizeof( msg_buf ));
|
||||
BF_WriteByte( &msg, svc_print );
|
||||
BF_WriteByte( &msg, PRINT_HIGH );
|
||||
BF_WriteString( &msg, va( "%s\n", message ));
|
||||
MSG_Init( &msg, "FinalMessage", msg_buf, sizeof( msg_buf ));
|
||||
MSG_WriteByte( &msg, svc_print );
|
||||
MSG_WriteByte( &msg, PRINT_HIGH );
|
||||
MSG_WriteString( &msg, va( "%s\n", message ));
|
||||
|
||||
if( reconnect )
|
||||
{
|
||||
BF_WriteByte( &msg, svc_changing );
|
||||
MSG_WriteByte( &msg, svc_changing );
|
||||
|
||||
if( sv.loadgame || sv_maxclients->integer > 1 || sv.changelevel )
|
||||
BF_WriteOneBit( &msg, 1 ); // changelevel
|
||||
else BF_WriteOneBit( &msg, 0 );
|
||||
MSG_WriteOneBit( &msg, 1 ); // changelevel
|
||||
else MSG_WriteOneBit( &msg, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
BF_WriteByte( &msg, svc_disconnect );
|
||||
MSG_WriteByte( &msg, svc_disconnect );
|
||||
}
|
||||
|
||||
// send it twice
|
||||
// stagger the packets to crutch operating system limited buffers
|
||||
for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ )
|
||||
if( cl->state >= cs_connected && !cl->fakeclient )
|
||||
Netchan_Transmit( &cl->netchan, BF_GetNumBytesWritten( &msg ), BF_GetData( &msg ));
|
||||
Netchan_Transmit( &cl->netchan, MSG_GetNumBytesWritten( &msg ), MSG_GetData( &msg ));
|
||||
|
||||
for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ )
|
||||
if( cl->state >= cs_connected && !cl->fakeclient )
|
||||
Netchan_Transmit( &cl->netchan, BF_GetNumBytesWritten( &msg ), BF_GetData( &msg ));
|
||||
Netchan_Transmit( &cl->netchan, MSG_GetNumBytesWritten( &msg ), MSG_GetData( &msg ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1969,7 +1969,7 @@ qboolean SV_InitPhysicsAPI( void )
|
|||
{
|
||||
if( pPhysIface( SV_PHYSICS_INTERFACE_VERSION, &gPhysicsAPI, &svgame.physFuncs ))
|
||||
{
|
||||
MsgDev( D_AICONSOLE, "SV_LoadProgs: ^2initailized extended PhysicAPI ^7ver. %i\n", SV_PHYSICS_INTERFACE_VERSION );
|
||||
MsgDev( D_REPORT, "SV_LoadProgs: ^2initailized extended PhysicAPI ^7ver. %i\n", SV_PHYSICS_INTERFACE_VERSION );
|
||||
|
||||
if( svgame.physFuncs.SV_CheckFeatures != NULL )
|
||||
{
|
||||
|
|
|
@ -321,15 +321,15 @@ static void pfnParticle( float *origin, int color, float life, int zpos, int zve
|
|||
return;
|
||||
}
|
||||
|
||||
BF_WriteByte( &sv.reliable_datagram, svc_particle );
|
||||
BF_WriteVec3Coord( &sv.reliable_datagram, origin );
|
||||
BF_WriteChar( &sv.reliable_datagram, 0 ); // no x-vel
|
||||
BF_WriteChar( &sv.reliable_datagram, 0 ); // no y-vel
|
||||
MSG_WriteByte( &sv.reliable_datagram, svc_particle );
|
||||
MSG_WriteVec3Coord( &sv.reliable_datagram, origin );
|
||||
MSG_WriteChar( &sv.reliable_datagram, 0 ); // no x-vel
|
||||
MSG_WriteChar( &sv.reliable_datagram, 0 ); // no y-vel
|
||||
v = bound( -128, (zpos * zvel) * 16.0f, 127 );
|
||||
BF_WriteChar( &sv.reliable_datagram, v ); // write z-vel
|
||||
BF_WriteByte( &sv.reliable_datagram, 1 );
|
||||
BF_WriteByte( &sv.reliable_datagram, color );
|
||||
BF_WriteByte( &sv.reliable_datagram, bound( 0, life * 8, 255 ));
|
||||
MSG_WriteChar( &sv.reliable_datagram, v ); // write z-vel
|
||||
MSG_WriteByte( &sv.reliable_datagram, 1 );
|
||||
MSG_WriteByte( &sv.reliable_datagram, color );
|
||||
MSG_WriteByte( &sv.reliable_datagram, bound( 0, life * 8, 255 ));
|
||||
}
|
||||
|
||||
static int pfnTestPlayerPosition( float *pos, pmtrace_t *ptrace )
|
||||
|
|
|
@ -505,7 +505,7 @@ void RestoreSound( soundlist_t *entry )
|
|||
edict_t *ent;
|
||||
|
||||
// this can happens if serialized map contain 4096 static decals...
|
||||
if(( BF_GetNumBytesWritten( &sv.signon ) + 20 ) >= BF_GetMaxBytes( &sv.signon ))
|
||||
if(( MSG_GetNumBytesWritten( &sv.signon ) + 20 ) >= MSG_GetMaxBytes( &sv.signon ))
|
||||
return;
|
||||
|
||||
if( entry->name[0] == '!' && Q_isdigit( entry->name + 1 ))
|
||||
|
@ -552,24 +552,24 @@ void RestoreSound( soundlist_t *entry )
|
|||
|
||||
if( soundIndex > 255 ) flags |= SND_LARGE_INDEX;
|
||||
|
||||
BF_WriteByte( &sv.signon, svc_restoresound );
|
||||
BF_WriteWord( &sv.signon, flags );
|
||||
MSG_WriteByte( &sv.signon, svc_restoresound );
|
||||
MSG_WriteWord( &sv.signon, flags );
|
||||
if( flags & SND_LARGE_INDEX )
|
||||
BF_WriteWord( &sv.signon, soundIndex );
|
||||
else BF_WriteByte( &sv.signon, soundIndex );
|
||||
BF_WriteByte( &sv.signon, entry->channel );
|
||||
MSG_WriteWord( &sv.signon, soundIndex );
|
||||
else MSG_WriteByte( &sv.signon, soundIndex );
|
||||
MSG_WriteByte( &sv.signon, entry->channel );
|
||||
|
||||
if( flags & SND_VOLUME ) BF_WriteByte( &sv.signon, entry->volume * 255 );
|
||||
if( flags & SND_ATTENUATION ) BF_WriteByte( &sv.signon, entry->attenuation * 64 );
|
||||
if( flags & SND_PITCH ) BF_WriteByte( &sv.signon, entry->pitch );
|
||||
if( flags & SND_VOLUME ) MSG_WriteByte( &sv.signon, entry->volume * 255 );
|
||||
if( flags & SND_ATTENUATION ) MSG_WriteByte( &sv.signon, entry->attenuation * 64 );
|
||||
if( flags & SND_PITCH ) MSG_WriteByte( &sv.signon, entry->pitch );
|
||||
|
||||
BF_WriteWord( &sv.signon, entry->entnum );
|
||||
BF_WriteVec3Coord( &sv.signon, entry->origin );
|
||||
BF_WriteByte( &sv.signon, entry->wordIndex );
|
||||
MSG_WriteWord( &sv.signon, entry->entnum );
|
||||
MSG_WriteVec3Coord( &sv.signon, entry->origin );
|
||||
MSG_WriteByte( &sv.signon, entry->wordIndex );
|
||||
|
||||
// send two doubles as raw-data
|
||||
BF_WriteBytes( &sv.signon, &entry->samplePos, sizeof( entry->samplePos ));
|
||||
BF_WriteBytes( &sv.signon, &entry->forcedEnd, sizeof( entry->forcedEnd ));
|
||||
MSG_WriteBytes( &sv.signon, &entry->samplePos, sizeof( entry->samplePos ));
|
||||
MSG_WriteBytes( &sv.signon, &entry->forcedEnd, sizeof( entry->forcedEnd ));
|
||||
}
|
||||
|
||||
void SV_ClearSaveDir( void )
|
||||
|
@ -1066,7 +1066,7 @@ void SV_SaveClientState( SAVERESTOREDATA *pSaveData, const char *level )
|
|||
ClientSections_t sections;
|
||||
int i, decalCount;
|
||||
int id, version;
|
||||
fs_offset_t header_offset, position;
|
||||
long header_offset, position;
|
||||
soundlist_t soundInfo[MAX_CHANNELS];
|
||||
string curtrack, looptrack;
|
||||
int soundCount = 0;
|
||||
|
@ -1411,8 +1411,8 @@ void SV_LoadClientState( SAVERESTOREDATA *pSaveData, const char *level, qboolean
|
|||
// read current track position
|
||||
FS_Read( pFile, &position, sizeof( position ));
|
||||
|
||||
BF_WriteByte( &sv.signon, svc_stufftext );
|
||||
BF_WriteString( &sv.signon, va( "music \"%s\" \"%s\" %i\n", curtrack, looptrack, position ));
|
||||
MSG_WriteByte( &sv.signon, svc_stufftext );
|
||||
MSG_WriteString( &sv.signon, va( "music \"%s\" \"%s\" %i\n", curtrack, looptrack, position ));
|
||||
}
|
||||
|
||||
FS_Close( pFile );
|
||||
|
@ -2241,9 +2241,9 @@ void SV_SaveGame( const char *pName )
|
|||
|
||||
if(( cl = SV_ClientFromEdict( EDICT_NUM( 1 ), true )) != NULL )
|
||||
{
|
||||
BF_WriteByte( &cl->netchan.message, svgame.gmsgHudText );
|
||||
BF_WriteByte( &cl->netchan.message, Q_strlen( pMsg ) + 1 );
|
||||
BF_WriteString( &cl->netchan.message, pMsg );
|
||||
MSG_WriteByte( &cl->netchan.message, svgame.gmsgHudText );
|
||||
MSG_WriteByte( &cl->netchan.message, Q_strlen( pMsg ) + 1 );
|
||||
MSG_WriteString( &cl->netchan.message, pMsg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1592,10 +1592,10 @@ void SV_SetLightStyle( int style, const char* s, float f )
|
|||
if( sv.state != ss_active ) return;
|
||||
|
||||
// tell the clients about changed lightstyle
|
||||
BF_WriteByte( &sv.reliable_datagram, svc_lightstyle );
|
||||
BF_WriteByte( &sv.reliable_datagram, style );
|
||||
BF_WriteString( &sv.reliable_datagram, sv.lightstyles[style].pattern );
|
||||
BF_WriteFloat( &sv.reliable_datagram, sv.lightstyles[style].time );
|
||||
MSG_WriteByte( &sv.reliable_datagram, svc_lightstyle );
|
||||
MSG_WriteByte( &sv.reliable_datagram, style );
|
||||
MSG_WriteString( &sv.reliable_datagram, sv.lightstyles[style].pattern );
|
||||
MSG_WriteFloat( &sv.reliable_datagram, sv.lightstyles[style].time );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Reference in New Issue