Merge 4281 update

This commit is contained in:
Alibek Omarov 2018-10-28 00:39:29 +03:00
commit a03aa3ddb3
78 changed files with 1010 additions and 847 deletions

View File

@ -17,6 +17,7 @@ GNU General Public License for more details.
#define GAMEINFO_H
#define GFL_NOMODELS (1<<0)
#define GFL_NOSKILLS (1<<1)
/*
========================================================================

View File

@ -79,7 +79,7 @@ typedef enum
TF_KEEP_SOURCE = (1<<1), // some images keep source
TF_NOFLIP_TGA = (1<<2), // Steam background completely ignore tga attribute 0x20
TF_EXPAND_SOURCE = (1<<3), // Don't keep source as 8-bit expand to RGBA
// reserved
TF_ALLOW_EMBOSS = (1<<4), // Allow emboss-mapping for this image
TF_RECTANGLE = (1<<5), // this is GL_TEXTURE_RECTANGLE
TF_CUBEMAP = (1<<6), // it's cubemap texture
TF_DEPTHMAP = (1<<7), // custom texture filter used
@ -186,16 +186,16 @@ typedef struct render_api_s
void (*R_EntityRemoveDecals)( struct model_s *mod ); // remove all the decals from specified entity (BSP only)
// AVIkit support
void *(*AVI_LoadVideo)( const char *filename );
void *(*AVI_LoadVideo)( const char *filename, qboolean load_audio );
int (*AVI_GetVideoInfo)( void *Avi, long *xres, long *yres, float *duration );
long (*AVI_GetVideoFrameNumber)( void *Avi, float time );
byte *(*AVI_GetVideoFrame)( void *Avi, long frame );
void (*AVI_UploadRawFrame)( int texture, int cols, int rows, int width, int height, const byte *data );
void (*AVI_FreeVideo)( void *Avi );
int (*AVI_IsActive)( void *Avi );
void (*AVI_StreamSound)( void *Avi, int entnum, float fvol, float attn, float synctime );
void (*AVI_Reserved0)( void ); // for potential interface expansion without broken compatibility
void (*AVI_Reserved1)( void );
void (*AVI_Reserved2)( void );
// glState related calls (must use this instead of normal gl-calls to prevent de-synchornize local states between engine and the client)
void (*GL_Bind)( int tmu, unsigned int texnum );

View File

@ -18,7 +18,7 @@ GNU General Public License for more details.
//
// avikit.c
//
typedef struct movie_state_s movie_state_t;
typedef struct movie_state_s movie_state_t;
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 );
@ -26,7 +26,8 @@ qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info );
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, int quiet );
movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio );
movie_state_t *AVI_LoadVideoNoSound( const char *filename );
long AVI_TimeToSoundPosition( movie_state_t *Avi, long time );
long AVI_GetVideoFrameCount( movie_state_t *Avi );
void AVI_CloseVideo( movie_state_t *Avi );
qboolean AVI_IsActive( movie_state_t *Avi );
void AVI_FreeVideo( movie_state_t *Avi );

View File

@ -51,9 +51,14 @@ movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio )
return NULL;
}
movie_state_t *AVI_LoadVideoNoSound( const char *filename )
long AVI_TimeToSoundPosition( movie_state_t *Avi, long time )
{
return NULL;
return 0;
}
long AVI_GetVideoFrameCount( movie_state_t *Avi )
{
return 0;
}
void AVI_CloseVideo( movie_state_t *Avi )

View File

@ -59,6 +59,7 @@ dll_info_t msacm_dll = { "msacm32.dll", msacm_funcs, false };
static int (_stdcall *pAVIStreamInfo)( PAVISTREAM pavi, AVISTREAMINFO *psi, LONG lSize );
static int (_stdcall *pAVIStreamRead)( PAVISTREAM pavi, LONG lStart, LONG lSamples, void *lpBuffer, LONG cbBuffer, LONG *plBytes, LONG *plSamples );
static PGETFRAME (_stdcall *pAVIStreamGetFrameOpen)( PAVISTREAM pavi, LPBITMAPINFOHEADER lpbiWanted );
static long (_stdcall *pAVIStreamTimeToSample)( PAVISTREAM pavi, LONG lTime );
static void* (_stdcall *pAVIStreamGetFrame)( PGETFRAME pg, LONG lPos );
static int (_stdcall *pAVIStreamGetFrameClose)( PGETFRAME pg );
static dword (_stdcall *pAVIStreamRelease)( PAVISTREAM pavi );
@ -85,6 +86,7 @@ static dllfunc_t avifile_funcs[] =
{ "AVIStreamReadFormat", (void **) &pAVIStreamReadFormat },
{ "AVIStreamRelease", (void **) &pAVIStreamRelease },
{ "AVIStreamStart", (void **) &pAVIStreamStart },
{ "AVIStreamTimeToSample", (void **) &pAVIStreamTimeToSample },
{ NULL, NULL }
};
@ -276,6 +278,23 @@ long AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
return (time * Avi->video_fps);
}
long AVI_GetVideoFrameCount( movie_state_t *Avi )
{
if( !Avi->active )
return 0;
return Avi->video_frames;
}
long AVI_TimeToSoundPosition( movie_state_t *Avi, long time )
{
if( !Avi->active || !Avi->audio_stream )
return 0;
// UNDONE: what about compressed audio?
return pAVIStreamTimeToSample( Avi->audio_stream, time ) * Avi->audio_bytes_per_sample;
}
// gets the raw frame data
byte *AVI_GetVideoFrame( movie_state_t *Avi, long frame )
{
@ -657,11 +676,6 @@ movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio )
return Avi;
}
movie_state_t *AVI_LoadVideoNoSound( const char *filename )
{
return AVI_LoadVideo( filename, false );
}
void AVI_FreeVideo( movie_state_t *state )
{
if( !state ) return;

View File

@ -725,7 +725,7 @@ void CL_DemoCompleted( void )
CL_StopPlayback();
if( !CL_NextDemo() && host_developer.value <= DEV_NONE )
if( !CL_NextDemo() && !cls.changedemo )
UI_SetActiveMenu( true );
Cvar_SetValue( "v_dark", 0.0f );
@ -795,6 +795,8 @@ qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
}
}
cls.netchan.last_received = host.realtime;
cls.netchan.total_received += msglen;
*length = msglen;
if( cls.state != ca_active )
@ -812,6 +814,7 @@ reads demo data and write it to client
*/
qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
{
vec3_t viewangles;
int msglen = 0;
demoangle_t *a;
@ -841,10 +844,12 @@ qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
// get the next message
FS_Read( cls.demofile, &msglen, sizeof( int ));
FS_Read( cls.demofile, &cl.viewangles[0], sizeof( float ));
FS_Read( cls.demofile, &cl.viewangles[1], sizeof( float ));
FS_Read( cls.demofile, &cl.viewangles[2], sizeof( float ));
FS_Read( cls.demofile, &viewangles[0], sizeof( float ));
FS_Read( cls.demofile, &viewangles[1], sizeof( float ));
FS_Read( cls.demofile, &viewangles[2], sizeof( float ));
cls.netchan.incoming_sequence++;
demo.timestamp = cl.mtime[0];
cl.skip_interp = false;
// make sure what interp info contain angles from different frames
// or lerping will stop working
@ -856,7 +861,7 @@ qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
// record update
a->starttime = demo.timestamp;
VectorCopy( cl.viewangles, a->viewangles );
VectorCopy( viewangles, a->viewangles );
demo.lasttime = demo.timestamp;
}
@ -884,6 +889,8 @@ qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
}
}
cls.netchan.last_received = host.realtime;
cls.netchan.total_received += msglen;
*length = msglen;
if( cls.state != ca_active )
@ -1073,14 +1080,26 @@ 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;
float curtime;
if( curtime > demo.timestamp )
curtime = demo.timestamp; // don't run too far
if( cls.demoplayback == DEMO_QUAKE1 )
{
// manually select next & prev states
next = &demo.cmds[(demo.angle_position - 0) & ANGLE_MASK];
prev = &demo.cmds[(demo.angle_position - 1) & ANGLE_MASK];
if( cl.skip_interp ) *prev = *next; // camera was teleported
frac = cl.lerpFrac;
}
else
{
curtime = (CL_GetDemoPlaybackClock() - demo.starttime) - host.frametime;
if( curtime > demo.timestamp )
curtime = demo.timestamp; // don't run too far
CL_DemoFindInterpolatedViewAngles( curtime, &frac, &prev, &next );
CL_DemoFindInterpolatedViewAngles( curtime, &frac, &prev, &next );
}
if( prev && next )
{
@ -1091,7 +1110,7 @@ void CL_DemoInterpolateAngles( void )
QuaternionSlerp( q2, q1, frac, q );
QuaternionAngle( q, cl.viewangles );
}
else if( cls.demoplayback != DEMO_QUAKE1 )
else if( cl.cmd != NULL )
VectorCopy( cl.cmd->viewangles, cl.viewangles );
}
@ -1295,6 +1314,7 @@ void CL_CheckStartupDemos( void )
// run demos loop in background mode
Cvar_SetValue( "v_dark", 1.0f );
cls.demos_pending = false;
cls.demonum = 0;
CL_NextDemo ();
}
@ -1304,11 +1324,10 @@ void CL_CheckStartupDemos( void )
CL_DemoGetName
==================
*/
void CL_DemoGetName( int lastnum, char *filename )
static void CL_DemoGetName( int lastnum, char *filename )
{
int a, b, c, d;
if( !filename ) return;
if( lastnum < 0 || lastnum > 9999 )
{
// bound
@ -1584,17 +1603,15 @@ void CL_Demos_f( void )
return;
}
// demos loop are not running
if( cls.olddemonum == -1 )
return;
cls.demonum = cls.olddemonum;
if( cls.demonum == -1 )
cls.demonum = 0;
// run demos loop in background mode
if( !SV_Active() && !cls.demoplayback )
{
// run demos loop in background mode
cls.changedemo = true;
CL_NextDemo ();
}
}

View File

@ -96,7 +96,7 @@ we don't want interpolate this
*/
qboolean CL_EntityTeleported( cl_entity_t *ent )
{
int len, maxlen;
float len, maxlen;
vec3_t delta;
VectorSubtract( ent->curstate.origin, ent->prevstate.origin, delta );
@ -407,7 +407,21 @@ int CL_InterpolateModel( cl_entity_t *e )
VectorCopy( e->curstate.origin, e->origin );
VectorCopy( e->curstate.angles, e->angles );
if( cls.timedemo || !e->model || cl.maxclients <= 1 )
if( cls.timedemo || !e->model )
return 1;
if( cls.demoplayback == DEMO_QUAKE1 )
{
// quake lerping is easy
VectorLerp( e->prevstate.origin, cl.lerpFrac, e->curstate.origin, e->origin );
AngleQuaternion( e->prevstate.angles, q1, false );
AngleQuaternion( e->curstate.angles, q2, false );
QuaternionSlerp( q1, q2, cl.lerpFrac, q );
QuaternionAngle( q, e->angles );
return 1;
}
if( cl.maxclients <= 1 )
return 1;
if( e->model->type == mod_brush && !cl_bmodelinterp->value )
@ -474,12 +488,24 @@ interpolate non-local clients
void CL_ComputePlayerOrigin( cl_entity_t *ent )
{
float targettime;
vec4_t q, q1, q2;
vec3_t origin;
vec3_t angles;
if( !ent->player || ent->index == ( cl.playernum + 1 ))
return;
if( cls.demoplayback == DEMO_QUAKE1 )
{
// quake lerping is easy
VectorLerp( ent->prevstate.origin, cl.lerpFrac, ent->curstate.origin, ent->origin );
AngleQuaternion( ent->prevstate.angles, q1, false );
AngleQuaternion( ent->curstate.angles, q2, false );
QuaternionSlerp( q1, q2, cl.lerpFrac, q );
QuaternionAngle( q, ent->angles );
return;
}
targettime = cl.time - cl_interp->value;
CL_PureOrigin( ent, targettime, origin, angles );
@ -985,9 +1011,12 @@ void CL_LinkPlayers( frame_t *frame )
if( i == cl.playernum )
{
VectorCopy( state->origin, ent->origin );
VectorCopy( state->origin, ent->prevstate.origin );
VectorCopy( state->origin, ent->curstate.origin );
if( cls.demoplayback != DEMO_QUAKE1 )
{
VectorCopy( state->origin, ent->origin );
VectorCopy( state->origin, ent->prevstate.origin );
VectorCopy( state->origin, ent->curstate.origin );
}
VectorCopy( ent->curstate.angles, ent->angles );
}
@ -1003,6 +1032,8 @@ void CL_LinkPlayers( frame_t *frame )
if ( i == cl.playernum )
{
if( cls.demoplayback == DEMO_QUAKE1 )
VectorLerp( ent->prevstate.origin, cl.lerpFrac, ent->curstate.origin, cl.simorg );
VectorCopy( cl.simorg, ent->origin );
}
else
@ -1321,8 +1352,25 @@ qboolean CL_GetEntitySpatialization( channel_t *ch )
qboolean CL_GetMovieSpatialization( rawchan_t *ch )
{
// UNDONE
return false;
cl_entity_t *ent;
qboolean valid_origin;
valid_origin = VectorIsNull( ch->origin ) ? false : true;
ent = CL_GetEntityByIndex( ch->entnum );
// entity is not present on the client but has valid origin
if( !ent || !ent->index || ent->curstate.messagenum == 0 )
return valid_origin;
// setup origin
VectorAverage( ent->curstate.mins, ent->curstate.maxs, ch->origin );
VectorAdd( ch->origin, ent->curstate.origin, ch->origin );
// setup radius
if( ent->model != NULL && ent->model->radius ) ch->radius = ent->model->radius;
else ch->radius = RadiusFromBounds( ent->curstate.mins, ent->curstate.maxs );
return true;
}
void CL_ExtraUpdate( void )

View File

@ -262,6 +262,8 @@ static void UI_ConvertGameInfo( GAMEINFO *out, gameinfo_t *in )
if( in->nomodels )
out->flags |= GFL_NOMODELS;
if( in->noskills )
out->flags |= GFL_NOSKILLS;
}
static qboolean PIC_Scissor( float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 )
@ -388,7 +390,7 @@ static HIMAGE pfnPIC_Load( const char *szPicName, const byte *image_buf, long im
SetBits( flags, TF_IMAGE );
Image_SetForceFlags( IL_LOAD_DECAL ); // allow decal images for menu
tx = GL_LoadTexture( szPicName, image_buf, image_size, flags, NULL );
tx = GL_LoadTexture( szPicName, image_buf, image_size, flags );
Image_ClearForceFlags();
return tx;
@ -899,7 +901,7 @@ int pfnCheckGameDll( void )
COM_FreeLibrary( hInst ); // don't increase linker's reference counter
return true;
}
MsgDev( D_WARN, "Could not load server library:\n%s", COM_GetLibraryError() );
Con_Reportf( S_WARN "Could not load server library:\n%s", COM_GetLibraryError() );
return false;
}
@ -1117,7 +1119,7 @@ qboolean UI_LoadProgs( void )
if( ( GiveTextApi = (UITEXTAPI)COM_GetProcAddress( gameui.hInstance, "GiveTextAPI" ) ) )
{
MsgDev( D_NOTE, "UI_LoadProgs: extended Text API initialized\n" );
Con_Reportf( "UI_LoadProgs: extended Text API initialized\n" );
// make local copy of engfuncs to prevent overwrite it with user dll
memcpy( &gpTextfuncs, &gTextfuncs, sizeof( gpTextfuncs ));
if( GiveTextApi( &gpTextfuncs ) )
@ -1127,7 +1129,7 @@ qboolean UI_LoadProgs( void )
pfnAddTouchButtonToList = (ADDTOUCHBUTTONTOLIST)COM_GetProcAddress( gameui.hInstance, "AddTouchButtonToList" );
if( pfnAddTouchButtonToList )
{
MsgDev( D_NOTE, "UI_LoadProgs: AddTouchButtonToList call found\n" );
Con_Reportf( "UI_LoadProgs: AddTouchButtonToList call found\n" );
}
Cvar_FullSet( "host_gameuiloaded", "1", FCVAR_READ_ONLY );

View File

@ -907,16 +907,10 @@ void CL_BeginUpload_f( void )
name = Cmd_Argv( 1 );
if( !COM_CheckString( name ))
{
MsgDev( D_ERROR, "upload without filename\n" );
return;
}
if( !cl_allow_upload.value )
{
MsgDev( D_WARN, "ingoring decal upload ( cl_allow_upload is 0 )\n" );
return;
}
if( Q_strlen( name ) != 36 || Q_strnicmp( name, "!MD5", 4 ))
{
@ -931,7 +925,7 @@ void CL_BeginUpload_f( void )
{
if( memcmp( md5, custResource.rgucMD5_hash, 16 ))
{
MsgDev( D_REPORT, "Bogus data retrieved from %s, attempting to delete entry\n", CUSTOM_RES_PATH );
Con_Reportf( "Bogus data retrieved from %s, attempting to delete entry\n", CUSTOM_RES_PATH );
HPAK_RemoveLump( CUSTOM_RES_PATH, &custResource );
return;
}
@ -948,26 +942,22 @@ void CL_BeginUpload_f( void )
if( memcmp( custResource.rgucMD5_hash, md5, 16 ))
{
MsgDev( D_REPORT, "HPAK_AddLump called with bogus lump, md5 mismatch\n" );
MsgDev( D_REPORT, "Purported: %s\n", MD5_Print( custResource.rgucMD5_hash ) );
MsgDev( D_REPORT, "Actual : %s\n", MD5_Print( md5 ) );
MsgDev( D_REPORT, "Removing conflicting lump\n" );
Con_Reportf( "HPAK_AddLump called with bogus lump, md5 mismatch\n" );
Con_Reportf( "Purported: %s\n", MD5_Print( custResource.rgucMD5_hash ) );
Con_Reportf( "Actual : %s\n", MD5_Print( md5 ) );
Con_Reportf( "Removing conflicting lump\n" );
HPAK_RemoveLump( CUSTOM_RES_PATH, &custResource );
return;
}
}
}
if( buf && size )
if( buf && size > 0 )
{
Netchan_CreateFileFragmentsFromBuffer( &cls.netchan, name, buf, size );
Netchan_FragSend( &cls.netchan );
Mem_Free( buf );
}
else
{
MsgDev( D_REPORT, "ingoring customization upload, couldn't find decal locally\n" );
}
}
/*
@ -1071,7 +1061,6 @@ void CL_CheckForResend( void )
if( !res )
{
MsgDev( D_ERROR, "CL_CheckForResend: bad server address\n" );
CL_Disconnect();
return;
}
@ -1085,7 +1074,7 @@ void CL_CheckForResend( void )
// only retry so many times before failure.
if( cls.connect_retry >= CL_CONNECTION_RETRIES )
{
MsgDev( D_ERROR, "CL_CheckForResend: couldn't connected\n" );
Con_DPrintf( S_ERROR "CL_CheckForResend: couldn't connected\n" );
CL_Disconnect();
return;
}
@ -1468,14 +1457,13 @@ void CL_InternetServers_f( void )
char *info = fullquery + sizeof( MS_SCAN_REQUEST ) - 1;
const size_t remaining = sizeof( fullquery ) - sizeof( MS_SCAN_REQUEST );
// Info_SetValueForKey( info, "nat", cl_nat->string, remaining );
Info_SetValueForKey( info, "gamedir", GI->gamefolder, remaining );
// let master know about client version
Info_SetValueForKey( info, "clver", XASH_VERSION, remaining );
NET_Config( true ); // allow remote
Con_Printf( "Scanning for servers on the internet area...\n" );
Info_SetValueForKey( info, "gamedir", GI->gamefolder, remaining );
Info_SetValueForKey( info, "clver", XASH_VERSION, remaining ); // let master know about client version
// Info_SetValueForKey( info, "nat", cl_nat->string, remaining );
cls.internetservers_wait = NET_SendToMasters( NS_CLIENT, sizeof( MS_SCAN_REQUEST ) + Q_strlen( info ), fullquery );
cls.internetservers_pending = true;
@ -1767,7 +1755,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
{
if( cls.state == ca_connected )
{
MsgDev( D_ERROR, "dup connect received. ignored\n");
Con_DPrintf( S_ERROR "dup connect received. ignored\n");
return;
}
@ -1961,7 +1949,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
// user out of band message (must be handled in CL_ConnectionlessPacket)
if( len > 0 ) Netchan_OutOfBand( NS_SERVER, from, len, buf );
}
else MsgDev( D_ERROR, "bad connectionless packet from %s:\n%s\n", NET_AdrToString( from ), args );
else Con_DPrintf( S_ERROR "bad connectionless packet from %s:\n%s\n", NET_AdrToString( from ), args );
}
/*
@ -2010,14 +1998,14 @@ void CL_ReadNetMessage( void )
if( !cls.demoplayback && MSG_GetMaxBytes( &net_message ) < 8 )
{
MsgDev( D_WARN, "%s: runt packet\n", NET_AdrToString( net_from ));
Con_Printf( S_WARN "CL_ReadPackets: %s:runt packet\n", NET_AdrToString( net_from ));
continue;
}
// packet from server
if( !cls.demoplayback && !NET_CompareAdr( net_from, cls.netchan.remote_address ))
{
MsgDev( D_ERROR, "CL_ReadPackets: %s:sequenced packet without connection\n", NET_AdrToString( net_from ));
Con_DPrintf( S_ERROR "CL_ReadPackets: %s:sequenced packet without connection\n", NET_AdrToString( net_from ));
continue;
}
@ -2505,7 +2493,6 @@ qboolean CL_PrecacheResources( void )
CL_SetEventIndex( cl.event_precache[pRes->nIndex], pRes->nIndex );
break;
default:
MsgDev( D_REPORT, "unknown resource type\n" );
break;
}

View File

@ -35,11 +35,11 @@ static void pfnVibrate( float life, char flags )
if( life < 0.0f )
{
MsgDev( D_WARN, "Negative vibrate time: %f\n", life );
Con_Reportf( S_WARN "Negative vibrate time: %f\n", life );
return;
}
//MsgDev( D_NOTE, "Vibrate: %f %d\n", life, flags );
//Con_Reportf( "Vibrate: %f %d\n", life, flags );
// here goes platform-specific backends
Platform_Vibrate( life * vibration_length->value, flags );

View File

@ -1239,7 +1239,7 @@ void CL_PredictMovement( qboolean repredicting )
if( cls.state != ca_active || cls.spectator )
return;
if( cls.demoplayback && cl.cmd != NULL && !repredicting )
if( cls.demoplayback && !repredicting )
CL_DemoInterpolateAngles();
CL_SetUpPlayerPrediction( false, false );

View File

@ -40,6 +40,7 @@ GNU General Public License for more details.
#define STAT_MONSTERS 14 // bumped by svc_killedmonster
#define MAX_STATS 32
static char cmd_buf[8192];
static char msg_buf[8192];
static sizebuf_t msg_demo;
@ -69,6 +70,28 @@ static void CL_ParseQuakeStats( sizebuf_t *msg )
CL_DispatchQuakeMessage( "Stats" );
}
/*
==================
CL_EntityTeleported
check for instant movement in case
we don't want interpolate this
==================
*/
static qboolean CL_QuakeEntityTeleported( cl_entity_t *ent, entity_state_t *newstate )
{
float len, maxlen;
vec3_t delta;
VectorSubtract( newstate->origin, ent->prevstate.origin, delta );
// compute potential max movement in units per frame and compare with entity movement
maxlen = ( clgame.movevars.maxvelocity * ( 1.0 / GAME_FPS ));
len = VectorLength( delta );
return (len > maxlen);
}
/*
==================
CL_ParseQuakeStats
@ -304,6 +327,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
clgame.movevars.waveHeight = 0.0f;
clgame.movevars.zmax = 14172.0f; // 8192 * 1.74
clgame.movevars.gravity = 800.0f; // quake doesn't write gravity in demos
clgame.movevars.maxvelocity = 2000.0f;
memcpy( &clgame.oldmovevars, &clgame.movevars, sizeof( movevars_t ));
}
@ -501,7 +525,16 @@ void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
}
if( FBitSet( bits, U_NOLERP ))
state->movetype = MOVETYPE_STEP;
else state->movetype = MOVETYPE_NOCLIP;
if( CL_QuakeEntityTeleported( ent, state ))
{
// remove smooth stepping
if( cl.viewentity == ent->index )
cl.skip_interp = true;
forcelink = true;
}
if( FBitSet( state->effects, 16 ))
SetBits( state->effects, EF_NODRAW );
@ -511,6 +544,10 @@ void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
if( forcelink )
{
VectorCopy( state->origin, ent->baseline.vuser1 );
SetBits( state->effects, EF_NOINTERP );
// interpolation must be reset
SETVISBIT( frame->flags, pack );
@ -697,6 +734,9 @@ static void CL_ParseQuakeTempEntity( sizebuf_t *msg )
MSG_WriteByte( &msg_demo, type );
if( type == 17 )
MSG_WriteString( &msg_demo, MSG_ReadString( msg ));
// TE_LIGHTNING1, TE_LIGHTNING2, TE_LIGHTNING3, TE_BEAM, TE_LIGHTNING4
if( type == 5 || type == 6 || type == 9 || type == 13 || type == 17 )
MSG_WriteWord( &msg_demo, MSG_ReadWord( msg ));
@ -722,9 +762,6 @@ static void CL_ParseQuakeTempEntity( sizebuf_t *msg )
MSG_WriteByte( &msg_demo, MSG_ReadByte( msg ));
}
if( type == 17 )
MSG_WriteString( &msg_demo, MSG_ReadString( msg ));
// TE_SMOKE (nehahra)
if( type == 18 )
MSG_WriteByte( &msg_demo, MSG_ReadByte( msg ));
@ -744,7 +781,7 @@ static void CL_ParseQuakeSignon( sizebuf_t *msg )
int i = MSG_ReadByte( msg );
if( i == 3 ) cls.signon = SIGNONS - 1;
Con_Printf( "CL_Signon: %d\n", i );
Con_Reportf( "CL_Signon: %d\n", i );
}
/*
@ -776,6 +813,75 @@ static void CL_ParseNehahraHideLMP( sizebuf_t *msg )
CL_DispatchQuakeMessage( "Stats" );
}
/*
==================
CL_QuakeStuffText
==================
*/
void CL_QuakeStuffText( const char *text )
{
Q_strncat( cmd_buf, text, sizeof( cmd_buf ));
Cbuf_AddText( text );
}
/*
==================
CL_QuakeExecStuff
==================
*/
void CL_QuakeExecStuff( void )
{
char *text = cmd_buf;
char token[256];
int argc = 0;
// check if no commands this frame
if( !COM_CheckString( text ))
return;
while( 1 )
{
// skip whitespace up to a /n
while( *text && ((byte)*text) <= ' ' && *text != '\r' && *text != '\n' )
text++;
if( *text == '\n' || *text == '\r' )
{
// a newline seperates commands in the buffer
if( *text == '\r' && text[1] == '\n' )
text++;
argc = 0;
text++;
}
if( !*text ) break;
host.com_ignorebracket = true;
text = COM_ParseFile( text, token );
host.com_ignorebracket = false;
if( !text ) break;
if( argc == 0 )
{
// debug: find all missed commands and cvars to add them into QWrap
if( !Cvar_Exists( token ) && !Cmd_Exists( token ))
Con_Printf( S_WARN "'%s' is not exist\n", token );
// else Msg( "cmd: %s\n", token );
// process some special commands
if( !Q_stricmp( token, "playdemo" ))
cls.changedemo = true;
argc++;
}
}
// reset the buffer
cmd_buf[0] = '\0';
}
/*
==================
CL_ParseQuakeMessage
@ -861,16 +967,15 @@ void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message )
cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart;
break;
case svc_time:
Cbuf_AddText( "\n" ); // new frame was started
CL_ParseServerTime( msg );
break;
case svc_print:
Con_Printf( "%s", MSG_ReadString( msg ));
str = MSG_ReadString( msg );
Con_Printf( "%s%s", str, *str == 2 ? "\n" : "" );
break;
case svc_stufftext:
// FIXME: do revision for all Quake and Nehahra console commands
str = MSG_ReadString( msg );
Msg( "%s\n", str );
Cbuf_AddText( str );
CL_QuakeStuffText( MSG_ReadString( msg ));
break;
case svc_setangle:
cl.viewangles[0] = MSG_ReadAngle( msg );
@ -909,8 +1014,8 @@ void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message )
case svc_updatecolors:
param1 = MSG_ReadByte( msg );
param2 = MSG_ReadByte( msg );
cl.players[param1].topcolor = param2 & 0xF0;
cl.players[param1].bottomcolor = (param2 & 15) << 4;
cl.players[param1].topcolor = param2 & 0xF;
cl.players[param1].bottomcolor = (param2 & 0xF0) >> 4;
break;
case svc_particle:
CL_ParseQuakeParticle( msg );
@ -1018,4 +1123,7 @@ void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message )
// add new entities into physic lists
CL_SetSolidEntities();
// check deferred cmds
CL_QuakeExecStuff();
}

View File

@ -126,7 +126,7 @@ void CL_DuplicateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomco
memcpy( paletteBackup, pal, 768 );
raw = CL_CreateRawTextureFromPixels( tx, &size, topcolor, bottomcolor );
ptexture->index = GL_LoadTexture( texname, raw, size, TF_FORCE_COLOR, NULL ); // do copy
ptexture->index = GL_LoadTexture( texname, raw, size, TF_FORCE_COLOR ); // do copy
// restore original palette
memcpy( pal, paletteBackup, 768 );
@ -213,7 +213,7 @@ void CL_UpdateAliasTexture( unsigned short *texture, int skinnum, int topcolor,
if( *texture == 0 )
{
Q_snprintf( texname, sizeof( texname ), "%s:remap%i", RI.currentmodel->name, skinnum );
Q_snprintf( texname, sizeof( texname ), "%s:remap%i_%i", RI.currentmodel->name, skinnum, RI.currententity->index );
skin.width = tx->width;
skin.height = tx->height;
skin.depth = skin.numMips = 1;

View File

@ -296,7 +296,7 @@ void SCR_DrawPlaque( void )
{
if(( cl_allow_levelshots->value && !cls.changelevel ) || cl.background )
{
int levelshot = GL_LoadTexture( cl_levelshot_name->string, NULL, 0, TF_IMAGE, NULL );
int levelshot = GL_LoadTexture( cl_levelshot_name->string, NULL, 0, TF_IMAGE );
GL_SetRenderMode( kRenderNormal );
R_DrawStretchPic( 0, 0, glState.width, glState.height, 0, 0, 1, 1, levelshot );
if( !cl.background ) CL_DrawHUD( CL_LOADING );
@ -496,7 +496,7 @@ qboolean SCR_LoadFixedWidthFont( const char *fontname )
if( !FS_FileExists( fontname, false ))
return false;
cls.creditsFont.hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_IMAGE|TF_KEEP_SOURCE, NULL );
cls.creditsFont.hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_IMAGE|TF_KEEP_SOURCE );
R_GetTextureParms( &fontWidth, NULL, cls.creditsFont.hFontTexture );
cls.creditsFont.charHeight = clgame.scrInfo.iCharHeight = fontWidth / 16;
cls.creditsFont.type = FONT_FIXED;
@ -528,7 +528,7 @@ qboolean SCR_LoadVariableWidthFont( const char *fontname )
if( !FS_FileExists( fontname, false ))
return false;
cls.creditsFont.hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_IMAGE, NULL );
cls.creditsFont.hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_IMAGE );
R_GetTextureParms( &fontWidth, NULL, cls.creditsFont.hFontTexture );
// half-life font with variable chars witdh
@ -637,24 +637,24 @@ void SCR_RegisterTextures( void )
// register gfx.wad images
if( FS_FileExists( "gfx/paused.lmp", false ))
cls.pauseIcon = GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE, NULL );
cls.pauseIcon = GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE );
else if( FS_FileExists( "gfx/pause.lmp", false ))
cls.pauseIcon = GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE, NULL );
cls.pauseIcon = GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE );
if( FS_FileExists( "gfx/lambda.lmp", false ))
{
if( cl_allow_levelshots->value )
cls.loadingBar = GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE, NULL );
else cls.loadingBar = GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE, NULL );
cls.loadingBar = GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
else cls.loadingBar = GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE );
}
else if( FS_FileExists( "gfx/loading.lmp", false ))
{
if( cl_allow_levelshots->value )
cls.loadingBar = GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE, NULL );
else cls.loadingBar = GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE, NULL );
cls.loadingBar = GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
else cls.loadingBar = GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE );
}
cls.tileImage = GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP, NULL );
cls.tileImage = GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
}
/*

View File

@ -2838,7 +2838,7 @@ void CL_AddEntityEffects( cl_entity_t *ent )
}
// studio models are handle muzzleflashes difference
if( FBitSet( ent->curstate.effects, EF_MUZZLEFLASH ) && ent->model->type == mod_alias )
if( FBitSet( ent->curstate.effects, EF_MUZZLEFLASH ) && Mod_AliasExtradata( ent->model ))
{
dlight_t *dl = CL_AllocDlight( ent->index );
vec3_t fv;
@ -2864,6 +2864,7 @@ these effects will be enable by flag in model header
*/
void CL_AddModelEffects( cl_entity_t *ent )
{
vec3_t neworigin;
vec3_t oldorigin;
if( !ent->model ) return;
@ -2876,23 +2877,33 @@ void CL_AddModelEffects( cl_entity_t *ent )
default: return;
}
VectorCopy( ent->prevstate.origin, oldorigin );
if( cls.demoplayback == DEMO_QUAKE1 )
{
VectorCopy( ent->baseline.vuser1, oldorigin );
VectorCopy( ent->origin, ent->baseline.vuser1 );
VectorCopy( ent->origin, neworigin );
}
else
{
VectorCopy( ent->prevstate.origin, oldorigin );
VectorCopy( ent->curstate.origin, neworigin );
}
// NOTE: this completely over control about angles and don't broke interpolation
if( FBitSet( ent->model->flags, STUDIO_ROTATE ))
ent->angles[1] = anglemod( 100.0f * cl.time );
if( FBitSet( ent->model->flags, STUDIO_GIB ))
R_RocketTrail( oldorigin, ent->curstate.origin, 2 );
R_RocketTrail( oldorigin, neworigin, 2 );
if( FBitSet( ent->model->flags, STUDIO_ZOMGIB ))
R_RocketTrail( oldorigin, ent->curstate.origin, 4 );
R_RocketTrail( oldorigin, neworigin, 4 );
if( FBitSet( ent->model->flags, STUDIO_TRACER ))
R_RocketTrail( oldorigin, ent->curstate.origin, 3 );
R_RocketTrail( oldorigin, neworigin, 3 );
if( FBitSet( ent->model->flags, STUDIO_TRACER2 ))
R_RocketTrail( oldorigin, ent->curstate.origin, 5 );
R_RocketTrail( oldorigin, neworigin, 5 );
if( FBitSet( ent->model->flags, STUDIO_ROCKET ))
{
@ -2908,14 +2919,14 @@ void CL_AddModelEffects( cl_entity_t *ent )
dl->die = cl.time + 0.01f;
R_RocketTrail( oldorigin, ent->curstate.origin, 0 );
R_RocketTrail( oldorigin, neworigin, 0 );
}
if( FBitSet( ent->model->flags, STUDIO_GRENADE ))
R_RocketTrail( oldorigin, ent->curstate.origin, 1 );
R_RocketTrail( oldorigin, neworigin, 1 );
if( FBitSet( ent->model->flags, STUDIO_TRACER3 ))
R_RocketTrail( oldorigin, ent->curstate.origin, 6 );
R_RocketTrail( oldorigin, neworigin, 6 );
}
/*
@ -3053,7 +3064,7 @@ int CL_DecalIndex( int id )
if( cl.decal_index[id] == 0 )
{
Image_SetForceFlags( IL_LOAD_DECAL );
cl.decal_index[id] = GL_LoadTexture( host.draw_decals[id], NULL, 0, TF_DECAL, NULL );
cl.decal_index[id] = GL_LoadTexture( host.draw_decals[id], NULL, 0, TF_DECAL );
Image_ClearForceFlags();
}

View File

@ -19,6 +19,7 @@ GNU General Public License for more details.
#include "entity_types.h"
#include "gl_local.h"
#include "vgui_draw.h"
#include "sound.h"
/*
===============
@ -143,7 +144,7 @@ void V_SetRefParams( ref_params_t *fd )
fd->demoplayback = cls.demoplayback;
fd->hardware = 1; // OpenGL
if( cl.first_frame )
if( cl.first_frame || cl.skip_interp )
{
cl.first_frame = false; // now can be unlocked
fd->smoothing = true; // NOTE: currently this used to prevent ugly un-duck effect while level is changed
@ -334,6 +335,7 @@ void V_RenderView( void )
}
R_RenderFrame( &rvp );
S_UpdateFrame( &rvp );
viewnum++;
} while( rp.nextView );

View File

@ -221,6 +221,7 @@ typedef struct
qboolean background; // not real game, just a background
qboolean first_frame; // first rendering frame
qboolean proxy_redirect; // spectator stuff
qboolean skip_interp; // skip interpolation this frame
uint checksum; // for catching cheater maps
@ -1057,6 +1058,7 @@ void Con_LoadHistory( void );
// s_main.c
//
void S_StreamRawSamples( int samples, int rate, int width, int channels, const byte *data );
void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float synctime );
void S_StartBackgroundTrack( const char *intro, const char *loop, long position, qboolean fullpath );
void S_StopBackgroundTrack( void );
void S_StreamSetPause( int pause );

View File

@ -532,7 +532,7 @@ static qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font )
return false;
// keep source to print directly into conback image
font->hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_FONT|TF_KEEP_SOURCE, NULL );
font->hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_FONT|TF_KEEP_SOURCE );
R_GetTextureParms( &fontWidth, NULL, font->hFontTexture );
if( font->hFontTexture && fontWidth != 0 )
@ -568,7 +568,7 @@ static qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font
if( !FS_FileExists( fontname, false ))
return false;
font->hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_FONT|TF_NEAREST, NULL );
font->hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_FONT|TF_NEAREST );
R_GetTextureParms( &fontWidth, NULL, font->hFontTexture );
// setup consolefont
@ -2308,28 +2308,28 @@ void Con_VidInit( void )
{
// trying to load truecolor image first
if( FS_FileExists( "gfx/shell/conback.bmp", false ) || FS_FileExists( "gfx/shell/conback.tga", false ))
con.background = GL_LoadTexture( "gfx/shell/conback", NULL, 0, TF_IMAGE, NULL );
con.background = GL_LoadTexture( "gfx/shell/conback", NULL, 0, TF_IMAGE );
if( !con.background )
{
if( FS_FileExists( "cached/conback640", false ))
con.background = GL_LoadTexture( "cached/conback640", NULL, 0, TF_IMAGE, NULL );
con.background = GL_LoadTexture( "cached/conback640", NULL, 0, TF_IMAGE );
else if( FS_FileExists( "cached/conback", false ))
con.background = GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE, NULL );
con.background = GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE );
}
}
else
{
// trying to load truecolor image first
if( FS_FileExists( "gfx/shell/loading.bmp", false ) || FS_FileExists( "gfx/shell/loading.tga", false ))
con.background = GL_LoadTexture( "gfx/shell/loading", NULL, 0, TF_IMAGE, NULL );
con.background = GL_LoadTexture( "gfx/shell/loading", NULL, 0, TF_IMAGE );
if( !con.background )
{
if( FS_FileExists( "cached/loading640", false ))
con.background = GL_LoadTexture( "cached/loading640", NULL, 0, TF_IMAGE, NULL );
con.background = GL_LoadTexture( "cached/loading640", NULL, 0, TF_IMAGE );
else if( FS_FileExists( "cached/loading", false ))
con.background = GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE, NULL );
con.background = GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE );
}
}
@ -2364,13 +2364,13 @@ void Con_VidInit( void )
y = Q_strlen( ver );
for( x = 0; x < y; x++ )
Con_DrawCharToConback( ver[x], chars->original->buffer, dest + (x << 3));
con.background = GL_LoadTexture( "#gfx/conback.lmp", (byte *)cb, length, TF_IMAGE, NULL );
con.background = GL_LoadTexture( "#gfx/conback.lmp", (byte *)cb, length, TF_IMAGE );
}
if( cb ) Mem_Free( cb );
}
if( !con.background ) // trying the load unmodified conback
con.background = GL_LoadTexture( "gfx/conback.lmp", NULL, 0, TF_IMAGE, NULL );
con.background = GL_LoadTexture( "gfx/conback.lmp", NULL, 0, TF_IMAGE );
}
// missed console image will be replaced as gray background like X-Ray or Crysis

View File

@ -618,10 +618,9 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
daliashdr_t *pinmodel;
stvert_t *pinstverts;
dtriangle_t *pintriangles;
int numframes, size;
daliasframetype_t *pframetype;
daliasskintype_t *pskintype;
int i, j;
int i, j, size;
if( loaded ) *loaded = false;
pinmodel = (daliashdr_t *)buffer;
@ -629,10 +628,13 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
if( i != ALIAS_VERSION )
{
MsgDev( D_ERROR, "%s has wrong version number (%i should be %i)\n", mod->name, i, ALIAS_VERSION );
Con_DPrintf( S_ERROR "%s has wrong version number (%i should be %i)\n", mod->name, i, ALIAS_VERSION );
return;
}
if( pinmodel->numverts <= 0 || pinmodel->numtris <= 0 || pinmodel->numframes <= 0 )
return; // how to possible is make that?
mod->mempool = Mem_AllocPool( va( "^2%s^7", mod->name ));
// allocate space for a working header, plus all the data except the frames,
@ -648,33 +650,12 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
m_pAliasHeader->skinwidth = pinmodel->skinwidth;
m_pAliasHeader->skinheight = pinmodel->skinheight;
m_pAliasHeader->numverts = pinmodel->numverts;
if( m_pAliasHeader->numverts <= 0 )
{
MsgDev( D_ERROR, "model %s has no vertices\n", mod->name );
return;
}
m_pAliasHeader->numtris = pinmodel->numtris;
m_pAliasHeader->numframes = pinmodel->numframes;
if( m_pAliasHeader->numverts > MAXALIASVERTS )
{
MsgDev( D_ERROR, "model %s has too many vertices\n", mod->name );
return;
}
m_pAliasHeader->numtris = pinmodel->numtris;
if( m_pAliasHeader->numtris <= 0 )
{
MsgDev( D_ERROR, "model %s has no triangles\n", mod->name );
return;
}
m_pAliasHeader->numframes = pinmodel->numframes;
numframes = m_pAliasHeader->numframes;
if( numframes < 1 )
{
MsgDev( D_ERROR, "Mod_LoadAliasModel: Invalid # of frames: %d\n", numframes );
Con_DPrintf( S_ERROR "model %s has too many vertices\n", mod->name );
return;
}
@ -718,7 +699,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
pframetype = (daliasframetype_t *)&pintriangles[m_pAliasHeader->numtris];
g_posenum = 0;
for( i = 0; i < numframes; i++ )
for( i = 0; i < m_pAliasHeader->numframes; i++ )
{
aliasframetype_t frametype = pframetype->type;
@ -1193,15 +1174,18 @@ void R_AliasLerpMovement( cl_entity_t *e )
if( g_alias.interpolate && ( g_alias.time < e->curstate.animtime + 1.0f ) && ( e->curstate.animtime != e->latched.prevanimtime ))
f = ( g_alias.time - e->curstate.animtime ) / ( e->curstate.animtime - e->latched.prevanimtime );
if( cls.demoplayback == DEMO_QUAKE1 )
f = f + 1.0f;
g_alias.lerpfrac = bound( 0.0f, f, 1.0f );
if( e->player || e->curstate.movetype != MOVETYPE_STEP )
return; // monsters only
// Con_Printf( "%4.2f %.2f %.2f\n", f, e->curstate.animtime, g_studio.time );
// Con_Printf( "%4.2f %.2f %.2f\n", f, e->curstate.animtime, g_alias.time );
VectorLerp( e->latched.prevorigin, f, e->curstate.origin, e->origin );
if( !VectorCompare( e->curstate.angles, e->latched.prevangles ))
if( !VectorCompareEpsilon( e->curstate.angles, e->latched.prevangles, ON_EPSILON ))
{
vec4_t q, q1, q2;
@ -1240,7 +1224,7 @@ void R_SetupAliasFrame( cl_entity_t *e, aliashdr_t *paliashdr )
else if( newframe >= paliashdr->numframes )
{
if( newframe > paliashdr->numframes )
MsgDev( D_WARN, "R_GetAliasFrame: no such frame %d (%s)\n", newframe, e->model->name );
Con_Reportf( S_WARN "R_GetAliasFrame: no such frame %d (%s)\n", newframe, e->model->name );
newframe = paliashdr->numframes - 1;
}

View File

@ -536,7 +536,7 @@ qboolean VID_ScreenShot( const char *filename, int shot_type )
break;
}
Image_Process( &r_shot, width, height, flags, NULL );
Image_Process( &r_shot, width, height, flags, 0.0f );
// write image
result = FS_SaveImage( filename, r_shot );
@ -605,7 +605,7 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
r_side->size = r_side->width * r_side->height * 3;
r_side->buffer = temp;
if( flags ) Image_Process( &r_side, 0, 0, flags, NULL );
if( flags ) Image_Process( &r_side, 0, 0, flags, 0.0f );
memcpy( buffer + (size * size * 3 * i), r_side->buffer, size * size * 3 );
}

View File

@ -684,8 +684,8 @@ static void GL_SetTextureFormat( gl_texture_t *tex, pixformat_t format, int chan
else if( haveAlpha )
{
if( FBitSet( tex->flags, TF_ARB_16BIT ) || glw_state.desktopBitsPixel == 16 )
tex->format = GL_LUMINANCE_ALPHA16F_ARB;
else tex->format = GL_LUMINANCE_ALPHA32F_ARB;
tex->format = GL_RG16F;
else tex->format = GL_RG32F;
}
else
{
@ -1208,7 +1208,7 @@ GL_ProcessImage
do specified actions on pixels
===============
*/
static void GL_ProcessImage( gl_texture_t *tex, rgbdata_t *pic, imgfilter_t *filter )
static void GL_ProcessImage( gl_texture_t *tex, rgbdata_t *pic )
{
uint img_flags = 0;
@ -1242,6 +1242,12 @@ static void GL_ProcessImage( gl_texture_t *tex, rgbdata_t *pic, imgfilter_t *fil
tex->flags &= ~TF_MAKELUMA;
}
if( tex->flags & TF_ALLOW_EMBOSS )
{
img_flags |= IMAGE_EMBOSS;
tex->flags &= ~TF_ALLOW_EMBOSS;
}
if( !FBitSet( tex->flags, TF_IMG_UPLOADED ) && FBitSet( tex->flags, TF_KEEP_SOURCE ))
tex->original = FS_CopyImage( pic ); // because current pic will be expanded to rgba
@ -1250,7 +1256,7 @@ static void GL_ProcessImage( gl_texture_t *tex, rgbdata_t *pic, imgfilter_t *fil
img_flags |= IMAGE_FORCE_RGBA;
// processing image before uploading (force to rgba, make luma etc)
if( pic->buffer ) Image_Process( &pic, 0, 0, img_flags, filter );
if( pic->buffer ) Image_Process( &pic, 0, 0, img_flags, gl_emboss_scale->value );
if( FBitSet( tex->flags, TF_LUMINANCE ))
ClearBits( pic->flags, IMAGE_HAS_COLOR );
@ -1421,7 +1427,7 @@ void GL_UpdateTexSize( int texnum, int width, int height, int depth )
GL_LoadTexture
================
*/
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags, imgfilter_t *filter )
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags )
{
gl_texture_t *tex;
rgbdata_t *pic;
@ -1448,7 +1454,7 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags, i
// allocate the new one
tex = GL_AllocTexture( name, flags );
GL_ProcessImage( tex, pic, filter );
GL_ProcessImage( tex, pic );
if( !GL_UploadTexture( tex, pic ))
{
@ -1469,7 +1475,7 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags, i
GL_LoadTextureArray
================
*/
int GL_LoadTextureArray( const char **names, int flags, imgfilter_t *filter )
int GL_LoadTextureArray( const char **names, int flags )
{
rgbdata_t *pic, *src;
char basename[256];
@ -1538,7 +1544,7 @@ int GL_LoadTextureArray( const char **names, int flags, imgfilter_t *filter )
// but allow to rescale raw images
if( ImageRAW( pic->type ) && ImageRAW( src->type ) && ( pic->width != src->width || pic->height != src->height ))
Image_Process( &src, pic->width, pic->height, IMAGE_RESAMPLE, NULL );
Image_Process( &src, pic->width, pic->height, IMAGE_RESAMPLE, 0.0f );
if( pic->size != src->size )
{
@ -1589,7 +1595,7 @@ int GL_LoadTextureArray( const char **names, int flags, imgfilter_t *filter )
// allocate the new one
tex = GL_AllocTexture( name, flags );
GL_ProcessImage( tex, pic, filter );
GL_ProcessImage( tex, pic );
if( !GL_UploadTexture( tex, pic ))
{
@ -1636,7 +1642,7 @@ int GL_LoadTextureFromBuffer( const char *name, rgbdata_t *pic, texFlags_t flags
tex = GL_AllocTexture( name, flags );
}
GL_ProcessImage( tex, pic, NULL );
GL_ProcessImage( tex, pic );
if( !GL_UploadTexture( tex, pic ))
{
memset( tex, 0, sizeof( gl_texture_t ));
@ -1828,7 +1834,7 @@ void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor )
// all the operations makes over the image copy not an original
pic = FS_CopyImage( image->original );
Image_Process( &pic, topColor, bottomColor, flags, NULL );
Image_Process( &pic, topColor, bottomColor, flags, 0.0f );
GL_UploadTexture( image, pic );
GL_ApplyTextureParams( image ); // update texture filter, wrap etc
@ -2077,6 +2083,12 @@ void R_TextureList_f( void )
case GL_LUMINANCE_ALPHA32F_ARB:
Con_Printf( "LA32F " );
break;
case GL_RG16F:
Con_Printf( "RG16F " );
break;
case GL_RG32F:
Con_Printf( "RG32F " );
break;
case GL_RGB16F_ARB:
Con_Printf( "RGB16F" );
break;
@ -2185,7 +2197,6 @@ void R_InitImages( void )
R_SetTextureParameters();
GL_CreateInternalTextures();
R_ParseTexFilters( "scripts/texfilter.txt" );
Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" );
}
@ -2209,4 +2220,4 @@ void R_ShutdownImages( void )
memset( gl_texturesHashTable, 0, sizeof( gl_texturesHashTable ));
memset( gl_textures, 0, sizeof( gl_textures ));
gl_numTextures = 0;
}
}

View File

@ -307,8 +307,8 @@ void R_SetTextureParameters( void );
gl_texture_t *R_GetTexture( GLenum texnum );
#define GL_LoadTextureInternal( name, pic, flags ) GL_LoadTextureFromBuffer( name, pic, flags, false )
#define GL_UpdateTextureInternal( name, pic, flags ) GL_LoadTextureFromBuffer( name, pic, flags, true )
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags, imgfilter_t *filter );
int GL_LoadTextureArray( const char **names, int flags, imgfilter_t *filter );
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
int GL_LoadTextureArray( const char **names, int flags );
int GL_LoadTextureFromBuffer( const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update );
byte *GL_ResampleTexture( const byte *source, int in_w, int in_h, int out_w, int out_h, qboolean isNormalMap );
int GL_CreateTexture( const char *name, int width, int height, const void *buffer, texFlags_t flags );
@ -384,8 +384,7 @@ void Matrix4x4_CreateModelview( matrix4x4 out );
//
// gl_rmisc.
//
void R_ParseTexFilters( const char *filename );
imgfilter_t *R_FindTexFilter( const char *texname );
void R_ClearStaticEntities( void );
//
// gl_rsurf.c
@ -453,7 +452,7 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse );
qboolean R_Init( void );
void R_Shutdown( void );
void VID_CheckChanges( void );
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags, imgfilter_t *filter );
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
void GL_FreeImage( const char *name );
qboolean VID_ScreenShot( const char *filename, int shot_type );
qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qboolean skyshot );
@ -640,6 +639,7 @@ extern convar_t *gl_texture_nearest;
extern convar_t *gl_wgl_msaa_samples;
extern convar_t *gl_lightmap_nearest;
extern convar_t *gl_keeptjunctions;
extern convar_t *gl_emboss_scale;
extern convar_t *gl_round_down;
extern convar_t *gl_detailscale;
extern convar_t *gl_wireframe;

View File

@ -1385,16 +1385,6 @@ const byte *GL_TextureData( unsigned int texnum )
return NULL;
}
static int GL_LoadTextureNoFilter( const char *name, const byte *buf, size_t size, int flags )
{
return GL_LoadTexture( name, buf, size, flags, NULL );
}
static int GL_LoadTextureArrayNoFilter( const char **names, int flags )
{
return GL_LoadTextureArray( names, flags, NULL );
}
static const ref_overview_t *GL_GetOverviewParms( void )
{
return &clgame.overView;
@ -1477,22 +1467,22 @@ static render_api_t gRenderAPI =
GL_FindTexture,
GL_TextureName,
GL_TextureData,
GL_LoadTextureNoFilter,
GL_LoadTexture,
GL_CreateTexture,
GL_LoadTextureArrayNoFilter,
GL_LoadTextureArray,
GL_CreateTextureArray,
GL_FreeTexture,
DrawSingleDecal,
R_DecalSetupVerts,
R_EntityRemoveDecals,
(void*)AVI_LoadVideoNoSound,
(void*)AVI_LoadVideo,
(void*)AVI_GetVideoInfo,
(void*)AVI_GetVideoFrameNumber,
(void*)AVI_GetVideoFrame,
R_UploadStretchRaw,
(void*)AVI_FreeVideo,
(void*)AVI_IsActive,
NULL,
S_StreamAviSamples,
NULL,
NULL,
GL_Bind,

View File

@ -19,16 +19,7 @@ GNU General Public License for more details.
#include "mod_local.h"
#include "shake.h"
typedef struct
{
char texname[64]; // shortname
imgfilter_t filter;
} dfilter_t;
dfilter_t *tex_filters[MAX_TEXTURES];
int num_texfilters;
void R_ParseDetailTextures( const char *filename )
static void R_ParseDetailTextures( const char *filename )
{
char *afile, *pfile;
string token, texname;
@ -95,7 +86,7 @@ void R_ParseDetailTextures( const char *filename )
if( Q_stricmp( tex->name, texname ))
continue;
tex->dt_texturenum = GL_LoadTexture( detail_path, NULL, 0, TF_FORCE_COLOR, NULL );
tex->dt_texturenum = GL_LoadTexture( detail_path, NULL, 0, TF_FORCE_COLOR );
// texture is loaded
if( tex->dt_texturenum )
@ -113,110 +104,6 @@ void R_ParseDetailTextures( const char *filename )
Mem_Free( afile );
}
void R_ParseTexFilters( const char *filename )
{
char *afile, *pfile;
string token, texname;
dfilter_t *tf;
int i;
afile = FS_LoadFile( filename, NULL, false );
if( !afile ) return;
pfile = afile;
// format: 'texturename' 'filtername' 'factor' 'bias' 'blendmode' 'grayscale'
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
{
imgfilter_t filter;
memset( &filter, 0, sizeof( filter ));
Q_strncpy( texname, token, sizeof( texname ));
// parse filter
pfile = COM_ParseFile( pfile, token );
if( !Q_stricmp( token, "blur" ))
filter.filter = BLUR_FILTER;
else if( !Q_stricmp( token, "blur2" ))
filter.filter = BLUR_FILTER2;
else if( !Q_stricmp( token, "edge" ))
filter.filter = EDGE_FILTER;
else if( !Q_stricmp( token, "emboss" ))
filter.filter = EMBOSS_FILTER;
// reading factor
pfile = COM_ParseFile( pfile, token );
filter.factor = Q_atof( token );
// reading bias
pfile = COM_ParseFile( pfile, token );
filter.bias = Q_atof( token );
// reading blendFunc
pfile = COM_ParseFile( pfile, token );
if( !Q_stricmp( token, "modulate" ) || !Q_stricmp( token, "GL_MODULATE" ))
filter.blendFunc = GL_MODULATE;
else if( !Q_stricmp( token, "replace" ) || !Q_stricmp( token, "GL_REPLACE" ))
filter.blendFunc = GL_REPLACE;
else if( !Q_stricmp( token, "add" ) || !Q_stricmp( token, "GL_ADD" ))
filter.blendFunc = GL_ADD;
else if( !Q_stricmp( token, "decal" ) || !Q_stricmp( token, "GL_DECAL" ))
filter.blendFunc = GL_DECAL;
else if( !Q_stricmp( token, "blend" ) || !Q_stricmp( token, "GL_BLEND" ))
filter.blendFunc = GL_BLEND;
else if( !Q_stricmp( token, "add_signed" ) || !Q_stricmp( token, "GL_ADD_SIGNED" ))
filter.blendFunc = GL_ADD_SIGNED;
else filter.blendFunc = GL_REPLACE; // defaulting to replace
// reading flags
pfile = COM_ParseFile( pfile, token );
filter.flags = Q_atoi( token );
// make sure what factor is not zeroed
if( filter.factor == 0.0f )
continue;
// check if already existed
for( i = 0; i < num_texfilters; i++ )
{
tf = tex_filters[i];
if( !Q_stricmp( tf->texname, texname ))
break;
}
if( i != num_texfilters )
continue; // already specified
// allocate new texfilter
tf = Z_Malloc( sizeof( dfilter_t ));
tex_filters[num_texfilters++] = tf;
Q_strncpy( tf->texname, texname, sizeof( tf->texname ));
tf->filter = filter;
}
Con_Reportf( "%i texture filters parsed\n", num_texfilters );
Mem_Free( afile );
}
imgfilter_t *R_FindTexFilter( const char *texname )
{
dfilter_t *tf;
int i;
for( i = 0; i < num_texfilters; i++ )
{
tf = tex_filters[i];
if( !Q_stricmp( tf->texname, texname ))
return &tf->filter;
}
return NULL;
}
/*
=======================
R_ClearStaticEntities

View File

@ -69,12 +69,12 @@ static dframetype_t *R_SpriteLoadFrame( model_t *mod, void *pin, mspriteframe_t
if( FBitSet( mod->flags, MODEL_CLIENT )) // it's a HUD sprite
{
Q_snprintf( texname, sizeof( texname ), "#HUD/%s(%s:%i%i).spr", sprite_name, group_suffix, num / 10, num % 10 );
gl_texturenum = GL_LoadTexture( texname, pin, pinframe->width * pinframe->height * bytes, r_texFlags, NULL );
gl_texturenum = GL_LoadTexture( texname, pin, pinframe->width * pinframe->height * bytes, r_texFlags );
}
else
{
Q_snprintf( texname, sizeof( texname ), "#%s(%s:%i%i).spr", sprite_name, group_suffix, num / 10, num % 10 );
gl_texturenum = GL_LoadTexture( texname, pin, pinframe->width * pinframe->height * bytes, r_texFlags, NULL );
gl_texturenum = GL_LoadTexture( texname, pin, pinframe->width * pinframe->height * bytes, r_texFlags );
}
// setup frame description
@ -162,13 +162,13 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
if( pin->ident != IDSPRITEHEADER )
{
MsgDev( D_ERROR, "%s has wrong id (%x should be %x)\n", mod->name, pin->ident, IDSPRITEHEADER );
Con_DPrintf( S_ERROR "%s has wrong id (%x should be %x)\n", mod->name, pin->ident, IDSPRITEHEADER );
return;
}
if( i != SPRITE_VERSION_Q1 && i != SPRITE_VERSION_HL && i != SPRITE_VERSION_32 )
{
MsgDev( D_ERROR, "%s has wrong version number (%i should be %i or %i)\n", mod->name, i, SPRITE_VERSION_Q1, SPRITE_VERSION_HL );
Con_DPrintf( S_ERROR "%s has wrong version number (%i should be %i or %i)\n", mod->name, i, SPRITE_VERSION_Q1, SPRITE_VERSION_HL );
return;
}
@ -259,15 +259,12 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
}
else
{
MsgDev( D_ERROR, "%s has wrong number of palette colors %i (should be 256)\n", mod->name, *numi );
Con_DPrintf( S_ERROR "%s has wrong number of palette colors %i (should be 256)\n", mod->name, *numi );
return;
}
if( mod->numframes < 1 )
{
MsgDev( D_ERROR, "%s has invalid # of frames: %d\n", mod->name, mod->numframes );
return;
}
for( i = 0; i < mod->numframes; i++ )
{
@ -336,7 +333,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean
if( h < MAPSPRITE_SIZE ) h = MAPSPRITE_SIZE;
// resample image if needed
Image_Process( &pix, w, h, IMAGE_FORCE_RGBA|IMAGE_RESAMPLE, NULL );
Image_Process( &pix, w, h, IMAGE_FORCE_RGBA|IMAGE_RESAMPLE, 0.0f );
w = h = MAPSPRITE_SIZE;

View File

@ -1440,7 +1440,7 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
}
}
if(( light.r + light.g + light.b ) == 0 )
if(( light.r + light.g + light.b ) < 16 ) // TESTTEST
{
colorVec gcolor;
float grad[4];
@ -3500,7 +3500,6 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
size_t size;
int flags = 0;
char texname[128], name[128], mdlname[128];
imgfilter_t *filter = NULL;
texture_t *tx = NULL;
if( ptexture->flags & STUDIO_NF_NORMALMAP )
@ -3557,10 +3556,6 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
COM_FileBase( ptexture->name, name );
COM_StripExtension( mdlname );
// loading texture filter for studiomodel
if( !FBitSet( ptexture->flags, STUDIO_NF_COLORMAP ))
filter = R_FindTexFilter( va( "%s.mdl/%s", mdlname, name )); // grab texture filter
if( FBitSet( ptexture->flags, STUDIO_NF_NOMIPS ))
SetBits( flags, TF_NOMIPMAP );
@ -3573,7 +3568,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
// build the texname
Q_snprintf( texname, sizeof( texname ), "#%s/%s.mdl", mdlname, name );
ptexture->index = GL_LoadTexture( texname, (byte *)ptexture, size, flags, filter );
ptexture->index = GL_LoadTexture( texname, (byte *)ptexture, size, flags );
if( !ptexture->index )
{

View File

@ -441,7 +441,7 @@ void R_SetupSky( const char *skyboxname )
Q_snprintf( sidename, sizeof( sidename ), "%s%s", loadname, r_skyBoxSuffix[i] );
else Q_snprintf( sidename, sizeof( sidename ), "%s_%s", loadname, r_skyBoxSuffix[i] );
tr.skyboxTextures[i] = GL_LoadTexture( sidename, NULL, 0, TF_CLAMP|TF_SKY, NULL );
tr.skyboxTextures[i] = GL_LoadTexture( sidename, NULL, 0, TF_CLAMP|TF_SKY );
if( !tr.skyboxTextures[i] ) break;
Con_DPrintf( "%s%s%s", skyboxname, r_skyBoxSuffix[i], i != 5 ? ", " : ". " );
}

View File

@ -172,7 +172,7 @@ void Evdev_OpenDevice ( const char *path )
ret = open( path, O_RDONLY | O_NONBLOCK );
if( ret < 0 )
{
MsgDev( D_ERROR, "Could not open input device %s: %s\n", path, strerror( errno ) );
Con_Reportf( S_ERROR "Could not open input device %s: %s\n", path, strerror( errno ) );
return;
}
Msg( "Input device #%d: %s opened sucessfully\n", evdev.devices, path );

View File

@ -148,7 +148,7 @@ void Joy_ProcessTrigger( const engineAxis_t engineAxis, short value )
trigThreshold = joy_lt_threshold->value;
break;
default:
MsgDev( D_ERROR, "Joy_ProcessTrigger: invalid axis = %i", engineAxis );
Con_Reportf( S_ERROR "Joy_ProcessTrigger: invalid axis = %i", engineAxis );
break;
}
@ -219,7 +219,7 @@ void Joy_ProcessStick( const engineAxis_t engineAxis, short value )
case JOY_AXIS_PITCH: deadzone = joy_pitch_deadzone->value; break;
case JOY_AXIS_YAW: deadzone = joy_yaw_deadzone->value; break;
default:
MsgDev( D_ERROR, "Joy_ProcessStick: invalid axis = %i", engineAxis );
Con_Reportf( S_ERROR "Joy_ProcessStick: invalid axis = %i", engineAxis );
break;
}

View File

@ -173,7 +173,7 @@ void IN_TouchWriteConfig( void )
if( Sys_CheckParm( "-nowriteconfig" ) || !touch.configchanged )
return;
MsgDev( D_NOTE, "IN_TouchWriteConfig(): %s\n", touch_config_file->string );
Con_Reportf( "IN_TouchWriteConfig(): %s\n", touch_config_file->string );
Q_snprintf( newconfigfile, 64, "%s.new", touch_config_file->string );
Q_snprintf( oldconfigfile, 64, "%s.bak", touch_config_file->string );
@ -240,7 +240,7 @@ void IN_TouchWriteConfig( void )
FS_Delete( touch_config_file->string );
FS_Rename( newconfigfile, touch_config_file->string );
}
else MsgDev( D_ERROR, "Couldn't write %s.\n", touch_config_file->string );
else Con_Reportf( S_ERROR "Couldn't write %s.\n", touch_config_file->string );
}
void IN_TouchExportConfig_f( void )
@ -258,7 +258,7 @@ void IN_TouchExportConfig_f( void )
name = Cmd_Argv( 1 );
MsgDev( D_NOTE, "Exporting config to %s\n", name );
Con_Reportf( "Exporting config to %s\n", name );
f = FS_Open( name, "w", true );
if( f )
{
@ -330,7 +330,7 @@ void IN_TouchExportConfig_f( void )
FS_Printf( f, "touch_roundall\n" );
FS_Close( f );
}
else MsgDev( D_ERROR, "Couldn't write %s.\n", name );
else Con_Reportf( S_ERROR "Couldn't write %s.\n", name );
}
void IN_TouchGenetateCode_f( void )
@ -822,7 +822,7 @@ void IN_TouchInit( void )
return;
touch.mempool = Mem_AllocPool( "Touch" );
//touch.first = touch.last = NULL;
MsgDev( D_NOTE, "IN_TouchInit()\n");
Con_Reportf( "IN_TouchInit()\n");
touch.move_finger = touch.resize_finger = touch.look_finger = -1;
touch.state = state_none;
touch.showbuttons = true;
@ -920,11 +920,11 @@ void IN_TouchInitConfig( void )
if( FS_FileExists( touch_config_file->string, true ) )
Cbuf_AddText( va( "exec \"%s\"\n", touch_config_file->string ) );
else IN_TouchLoadDefaults_f( );
touch.closetexture = GL_LoadTexture( "touch_default/edit_close.tga", NULL, 0, TF_NOMIPMAP, NULL );
touch.hidetexture = GL_LoadTexture( "touch_default/edit_hide.tga", NULL, 0, TF_NOMIPMAP, NULL );
touch.showtexture = GL_LoadTexture( "touch_default/edit_show.tga", NULL, 0, TF_NOMIPMAP, NULL );
touch.resettexture = GL_LoadTexture( "touch_default/edit_reset.tga", NULL, 0, TF_NOMIPMAP, NULL );
touch.joytexture = GL_LoadTexture( touch_joy_texture->string, NULL, 0, TF_NOMIPMAP, NULL );
touch.closetexture = GL_LoadTexture( "touch_default/edit_close.tga", NULL, 0, TF_NOMIPMAP );
touch.hidetexture = GL_LoadTexture( "touch_default/edit_hide.tga", NULL, 0, TF_NOMIPMAP );
touch.showtexture = GL_LoadTexture( "touch_default/edit_show.tga", NULL, 0, TF_NOMIPMAP );
touch.resettexture = GL_LoadTexture( "touch_default/edit_reset.tga", NULL, 0, TF_NOMIPMAP );
touch.joytexture = GL_LoadTexture( touch_joy_texture->string, NULL, 0, TF_NOMIPMAP );
touch.configchanged = false;
}
qboolean IN_TouchIsVisible( touchbutton2_t *button )
@ -1112,7 +1112,7 @@ void Touch_DrawButtons( touchbuttonlist_t *list )
{
if( button->texture == -1 )
{
button->texture = GL_LoadTexture( button->texturefile, NULL, 0, TF_NOMIPMAP, NULL );
button->texture = GL_LoadTexture( button->texturefile, NULL, 0, TF_NOMIPMAP );
}
if( B(flags) & TOUCH_FL_DRAW_ADDITIVE )
@ -1257,7 +1257,7 @@ void IN_TouchDraw( void )
if( FBitSet( touch_joy_texture->flags, FCVAR_CHANGED ) )
{
ClearBits( touch_joy_texture->flags, FCVAR_CHANGED );
touch.joytexture = GL_LoadTexture( touch_joy_texture->string, NULL, 0, TF_NOMIPMAP, NULL );
touch.joytexture = GL_LoadTexture( touch_joy_texture->string, NULL, 0, TF_NOMIPMAP );
}
if( touch.move->type == touch_move )
{
@ -1448,7 +1448,7 @@ static qboolean Touch_ButtonPress( touchbuttonlist_t *list, touchEventType type,
//touch.move_finger = button->finger = -1;
for( newbutton = list->first; newbutton; newbutton = newbutton->next )
if( ( newbutton->type == touch_move ) || ( newbutton->type == touch_look ) ) newbutton->finger = -1;
MsgDev( D_NOTE, "Touch: touch_move on look finger %d!\n", fingerID );
Con_Reportf( "Touch: touch_move on look finger %d!\n", fingerID );
continue;
}
touch.move_finger = fingerID;
@ -1487,7 +1487,7 @@ static qboolean Touch_ButtonPress( touchbuttonlist_t *list, touchEventType type,
touch.move_finger = touch.look_finger = -1;
for( newbutton = list->first; newbutton; newbutton = newbutton->next )
if( ( newbutton->type == touch_move ) || ( newbutton->type == touch_look ) ) newbutton->finger = -1;
MsgDev( D_NOTE, "Touch: touch_look on move finger %d!\n", fingerID );
Con_Reportf( "Touch: touch_look on move finger %d!\n", fingerID );
continue;
}
touch.look_finger = fingerID;
@ -1666,7 +1666,7 @@ int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx
Cbuf_AddText( "escape\n" );
}
UI_MouseMove( TO_SCRN_X(x), TO_SCRN_Y(y) );
//MsgDev( D_NOTE, "touch %d %d\n", TO_SCRN_X(x), TO_SCRN_Y(y) );
//Con_Reportf( "touch %d %d\n", TO_SCRN_X(x), TO_SCRN_Y(y) );
if( type == event_down )
Key_Event( K_MOUSE1, true );
if( type == event_up )

View File

@ -51,6 +51,7 @@ keyname_t keynames[] =
{"CTRL", K_CTRL, "+attack" },
{"SHIFT", K_SHIFT, "+speed" },
{"CAPSLOCK", K_CAPSLOCK, "" },
{"SCROLLOCK", K_SCROLLOCK, "" },
{"F1", K_F1, "cmd help" },
{"F2", K_F2, "menu_savegame" },
{"F3", K_F3, "menu_loadgame" },
@ -204,7 +205,7 @@ const char *Key_KeynumToString( int keynum )
if ( keynum < 0 || keynum > 255 ) return "<OUT OF RANGE>";
// check for printable ascii (don't use quote)
if( keynum > 32 && keynum < 127 && keynum != '"' && keynum != ';' )
if( keynum > 32 && keynum < 127 && keynum != '"' && keynum != ';' && keynum != K_SCROLLOCK )
{
tinystr[0] = keynum;
tinystr[1] = 0;
@ -421,8 +422,10 @@ void Key_WriteBindings( file_t *f )
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 );
if( !COM_CheckString( keys[i].binding ))
continue;
FS_Printf( f, "bind %s \"%s\"\n", Key_KeynumToString( i ), keys[i].binding );
}
}
@ -438,8 +441,10 @@ void Key_Bindlist_f( void )
for( i = 0; i < 256; i++ )
{
if( keys[i].binding && keys[i].binding[0] )
Con_Printf( "%s \"%s\"\n", Key_KeynumToString( i ), keys[i].binding );
if( !COM_CheckString( keys[i].binding ))
continue;
Con_Printf( "%s \"%s\"\n", Key_KeynumToString( i ), keys[i].binding );
}
}

View File

@ -135,15 +135,17 @@ wavdata_t *S_LoadSound( sfx_t *sfx )
return sfx->cache;
if( !COM_CheckString( sfx->name ))
{
// debug
Con_Printf( "S_LoadSound: sfx %d has NULL name\n", sfx - s_knownSfx );
return NULL;
}
// load it from disk
if( Q_stricmp( sfx->name, "*default" ))
sc = FS_LoadSound( sfx->name, NULL, 0 );
{
// load it from disk
if( sfx->name[0] == '*' )
sc = FS_LoadSound( sfx->name + 1, NULL, 0 );
else sc = FS_LoadSound( sfx->name, NULL, 0 );
}
if( !sc ) sc = S_CreateDefaultSound();
if( sc->rate < SOUND_11k ) // some bad sounds
@ -301,7 +303,7 @@ void S_EndRegistration( void )
// free any sounds not from this registration sequence
for( i = 0, sfx = s_knownSfx; i < s_numSfx; i++, sfx++ )
{
if( !sfx->name[0] || sfx->name[0] == '*' )
if( !sfx->name[0] || !Q_stricmp( sfx->name, "*default" ))
continue; // don't release default sound
if( sfx->servercount != s_registration_sequence )

View File

@ -1597,19 +1597,79 @@ void S_RawSamples( uint samples, uint rate, word width, word channels, const byt
S_PositionedRawSamples
===================
*/
static void S_PositionedRawSamples( int entnum, float fvol, float attn, uint samples, uint rate, word width, word channels, const byte *data )
void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float synctime )
{
rawchan_t *ch;
int bufferSamples;
int fileSamples;
byte raw[MAX_RAW_SAMPLES];
float duration = 0.0f;
int r, fileBytes;
rawchan_t *ch = NULL;
if( !dma.initialized || s_listener.paused || !CL_IsInGame( ))
return;
if( entnum < 0 || entnum >= GI->max_edicts )
return;
if( !( ch = S_FindRawChannel( entnum, true )))
return;
if( ch->sound_info.rate == 0 )
{
if( !AVI_GetAudioInfo( Avi, &ch->sound_info ))
return; // no audiotrack
}
ch->master_vol = bound( 0, fvol * 255, 255 );
ch->dist_mult = (attn / SND_CLIP_DISTANCE);
ch->s_rawend = S_RawSamplesStereo( ch->rawsamples, ch->s_rawend, ch->max_samples, samples, rate, width, channels, data );
// see how many samples should be copied into the raw buffer
if( ch->s_rawend < soundtime )
ch->s_rawend = soundtime;
// position is changed, synchronization is lost etc
if( fabs( ch->oldtime - synctime ) > s_mixahead->value )
ch->sound_info.loopStart = AVI_TimeToSoundPosition( Avi, synctime * 1000 );
ch->oldtime = synctime; // keep actual time
while( ch->s_rawend < soundtime + ch->max_samples )
{
wavdata_t *info = &ch->sound_info;
bufferSamples = ch->max_samples - (ch->s_rawend - soundtime);
// decide how much data needs to be read from the file
fileSamples = bufferSamples * ((float)info->rate / SOUND_DMA_SPEED );
if( fileSamples <= 1 ) return; // no more samples need
// our max buffer size
fileBytes = fileSamples * ( info->width * info->channels );
if( fileBytes > sizeof( raw ))
{
fileBytes = sizeof( raw );
fileSamples = fileBytes / ( info->width * info->channels );
}
// read audio stream
r = AVI_GetAudioChunk( Avi, raw, info->loopStart, fileBytes );
info->loopStart += r; // advance play position
if( r < fileBytes )
{
fileBytes = r;
fileSamples = r / ( info->width * info->channels );
}
if( r > 0 )
{
// add to raw buffer
ch->s_rawend = S_RawSamplesStereo( ch->rawsamples, ch->s_rawend, ch->max_samples,
fileSamples, info->rate, info->width, info->channels, raw );
}
else break; // no more samples for this frame
}
}
/*
@ -1685,6 +1745,7 @@ static void S_ClearRawChannels( void )
if( !ch ) continue;
ch->s_rawend = 0;
ch->oldtime = -1;
}
}
@ -1888,6 +1949,23 @@ void S_ExtraUpdate( void )
S_UpdateChannels ();
}
/*
============
S_UpdateFrame
update listener position
============
*/
void S_UpdateFrame( struct ref_viewpass_s *rvp )
{
if( !FBitSet( rvp->flags, RF_DRAW_WORLD ) || FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW ))
return;
VectorCopy( rvp->vieworigin, s_listener.origin );
AngleVectors( rvp->viewangles, s_listener.forward, s_listener.right, s_listener.up );
s_listener.entnum = rvp->viewentity; // can be camera entity too
}
/*
============
SND_UpdateSound
@ -1912,17 +1990,13 @@ void SND_UpdateSound( void )
// release raw-channels that no longer used more than 10 secs
S_FreeIdleRawChannels();
s_listener.entnum = cl.viewentity; // can be camera entity too
VectorCopy( cl.simvel, s_listener.velocity );
s_listener.frametime = (cl.time - cl.oldtime);
s_listener.waterlevel = cl.local.waterlevel;
s_listener.active = CL_IsInGame();
s_listener.inmenu = CL_IsInMenu();
s_listener.paused = cl.paused;
VectorCopy( RI.vieworg, s_listener.origin );
VectorCopy( cl.simvel, s_listener.velocity );
AngleVectors( RI.viewangles, s_listener.forward, s_listener.right, s_listener.up );
if( cl.worldmodel != NULL )
Mod_FatPVS( s_listener.origin, FATPHS_RADIUS, s_listener.pasbytes, world.visbytes, false, !s_phs->value );
@ -2045,7 +2119,7 @@ void S_Play2_f( void )
if( Cmd_Argc() == 1 )
{
Con_Printf( S_USAGE "play <soundfile>\n" );
Con_Printf( S_USAGE "play2 <soundfile>\n" );
return;
}

View File

@ -81,6 +81,8 @@ extern byte *sndpool;
#define S_RAW_SOUND_SOUNDTRACK -1
#define S_RAW_SAMPLES_PRECISION_BITS 14
#define CIN_FRAMETIME (1.0f / 30.0f)
typedef struct
{
int left;
@ -164,6 +166,8 @@ typedef struct rawchan_s
vec3_t origin; // only use if fixed_origin is set
float radius; // radius of this sound effect
volatile uint s_rawend;
wavdata_t sound_info; // advance play position
float oldtime; // catch time jumps
size_t max_samples; // buffer length
portable_samplepair_t rawsamples[1]; // variable sized
} rawchan_t;
@ -318,6 +322,7 @@ void S_Activate( qboolean active );
void S_SoundList_f( void );
void S_SoundInfo_f( void );
struct ref_viewpass_s;
channel_t *SND_PickDynamicChannel( int entnum, int channel, sfx_t *sfx, qboolean *ignore );
channel_t *SND_PickStaticChannel( const vec3_t pos, sfx_t *sfx );
int S_GetCurrentStaticSounds( soundlist_t *pout, int size );
@ -326,6 +331,7 @@ sfx_t *S_GetSfxByHandle( sound_t handle );
rawchan_t *S_FindRawChannel( int entnum, qboolean create );
void S_RawSamples( uint samples, uint rate, word width, word channels, const byte *data, int entnum );
void S_StopSound( int entnum, int channel, const char *soundname );
void S_UpdateFrame( struct ref_viewpass_s *rvp );
uint S_GetRawSamplesLength( int entnum );
void S_ClearRawChannel( int entnum );
void S_StopAllSounds( qboolean ambient );

View File

@ -261,7 +261,7 @@ void VGui_Startup( int width, int height )
Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, 256 );
if( !COM_LoadLibrary( vguilib, false, false ) )
MsgDev( D_WARN, "VGUI preloading failed. Default library will be used! Reason: %s\n", COM_GetLibraryError());
Con_Reportf( S_WARN "VGUI preloading failed. Default library will be used! Reason: %s\n", COM_GetLibraryError());
}
if( Q_strstr( GI->client_lib, ".dll" ) )
@ -280,7 +280,7 @@ void VGui_Startup( int width, int height )
if( !s_pVGuiSupport )
{
if( FS_FileExists( vguiloader, false ) )
MsgDev( D_ERROR, "Failed to load vgui_support library: %s", COM_GetLibraryError() );
Con_Reportf( S_ERROR "Failed to load vgui_support library: %s", COM_GetLibraryError() );
else
MsgDev( D_INFO, "vgui_support: not found\n" );
}
@ -294,7 +294,7 @@ void VGui_Startup( int width, int height )
VGUI_InitCursors();
}
else
MsgDev( D_ERROR, "Failed to find vgui_support library entry point!\n" );
Con_Reportf( S_ERROR "Failed to find vgui_support library entry point!\n" );
}
}
@ -615,7 +615,7 @@ void GAME_EXPORT VGUI_CreateTexture( int id, int width, int height )
if( id <= 0 || id >= VGUI_MAX_TEXTURES )
{
MsgDev( D_ERROR, "VGUI_CreateTexture: bad texture %i. Ignored\n", id );
Con_Reportf( S_ERROR "VGUI_CreateTexture: bad texture %i. Ignored\n", id );
return;
}
@ -637,7 +637,7 @@ void GAME_EXPORT VGUI_UploadTextureBlock( int id, int drawX, int drawY, const by
{
if( id <= 0 || id >= VGUI_MAX_TEXTURES || g_textures[id] == 0 || g_textures[id] == tr.whiteTexture )
{
MsgDev( D_ERROR, "VGUI_UploadTextureBlock: bad texture %i. Ignored\n", id );
Con_Reportf( S_ERROR "VGUI_UploadTextureBlock: bad texture %i. Ignored\n", id );
return;
}

View File

@ -30,6 +30,7 @@ convar_t *gl_texture_nearest;
convar_t *gl_wgl_msaa_samples;
convar_t *gl_lightmap_nearest;
convar_t *gl_keeptjunctions;
convar_t *gl_emboss_scale;
convar_t *gl_showtextures;
convar_t *gl_detailscale;
convar_t *gl_check_errors;
@ -126,7 +127,7 @@ void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cv
convar_t *parm = NULL;
const char *extensions_string;
MsgDev( D_NOTE, "GL_CheckExtension: %s ", name );
Con_Reportf( "GL_CheckExtension: %s ", name );
GL_SetExtension( r_ext, true );
if( cvarname )
@ -137,7 +138,7 @@ void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cv
if(( parm && !CVAR_TO_BOOL( parm )) || ( !CVAR_TO_BOOL( gl_extensions ) && r_ext != GL_OPENGL_110 ))
{
MsgDev( D_NOTE, "- disabled\n" );
Con_Reportf( "- disabled\n" );
GL_SetExtension( r_ext, false );
return; // nothing to process at
}
@ -147,7 +148,7 @@ void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cv
if(( name[2] == '_' || name[3] == '_' ) && !Q_strstr( extensions_string, name ))
{
GL_SetExtension( r_ext, false ); // update render info
MsgDev( D_NOTE, "- ^1failed\n" );
Con_Reportf( "- ^1failed\n" );
return;
}
@ -163,8 +164,8 @@ void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cv
}
if( GL_Support( r_ext ))
MsgDev( D_NOTE, "- ^2enabled\n" );
else MsgDev( D_NOTE, "- ^1failed\n" );
Con_Reportf( "- ^2enabled\n" );
else Con_Reportf( "- ^1failed\n" );
}
/*
@ -210,7 +211,7 @@ VID_StartupGamma
void VID_StartupGamma( void )
{
BuildGammaTable( vid_gamma->value, vid_brightness->value );
MsgDev( D_NOTE, "VID_StartupGamma: gamma %g brightness %g\n", vid_gamma->value, vid_brightness->value );
Con_Reportf( "VID_StartupGamma: gamma %g brightness %g\n", vid_gamma->value, vid_brightness->value );
ClearBits( vid_brightness->flags, FCVAR_CHANGED );
ClearBits( vid_gamma->flags, FCVAR_CHANGED );
}
@ -463,6 +464,7 @@ void GL_InitCommands( void )
gl_texture_anisotropy = Cvar_Get( "gl_anisotropy", "8", FCVAR_ARCHIVE, "textures anisotropic filter" );
gl_texture_lodbias = Cvar_Get( "gl_texture_lodbias", "0.0", FCVAR_ARCHIVE, "LOD bias for mipmapped textures (perfomance|quality)" );
gl_keeptjunctions = Cvar_Get( "gl_keeptjunctions", "1", FCVAR_ARCHIVE, "removing tjuncs causes blinking pixels" );
gl_emboss_scale = Cvar_Get( "gl_emboss_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "fake bumpmapping scale" );
gl_showtextures = Cvar_Get( "r_showtextures", "0", FCVAR_CHEAT, "show all uploaded textures" );
gl_finish = Cvar_Get( "gl_finish", "0", FCVAR_ARCHIVE, "use glFinish instead of glFlush" );
gl_nosort = Cvar_Get( "gl_nosort", "0", FCVAR_ARCHIVE, "disable sorting of translucent surfaces" );

View File

@ -140,7 +140,7 @@ qboolean BaseCmd_Replace( base_command_type_e type, base_command_t *basecmd, con
if( !i )
{
MsgDev( D_ERROR, "BaseCmd_Replace: couldn't find %s\n", name);
Con_Reportf( S_ERROR "BaseCmd_Replace: couldn't find %s\n", name);
return false;
}
@ -168,7 +168,7 @@ void BaseCmd_Remove( base_command_type_e type, const char *name )
if( !i )
{
MsgDev( D_ERROR, "Couldn't find %s in buckets\n", name );
Con_Reportf( S_ERROR "Couldn't find %s in buckets\n", name );
return;
}

View File

@ -48,7 +48,7 @@ int Q_buildnum( void )
return b;
#else
return 4140;
return 4260;
#endif
}

View File

@ -63,7 +63,7 @@ qboolean CSCR_ExpectString( parserstate_t *ps, const char *pExpect, qboolean ski
}
if( skip ) ps->buf = tmp;
if( error ) MsgDev( D_ERROR, "Syntax error in %s: got \"%s\" instead of \"%s\"\n", ps->filename, ps->token, pExpect );
if( error ) Con_DPrintf( S_ERROR "Syntax error in %s: got \"%s\" instead of \"%s\"\n", ps->filename, ps->token, pExpect );
return false;
}
@ -85,7 +85,7 @@ cvartype_t CSCR_ParseType( parserstate_t *ps )
return i;
}
MsgDev( D_ERROR, "Cannot parse %s: Bad type %s\n", ps->filename, ps->token );
Con_DPrintf( S_ERROR "Cannot parse %s: Bad type %s\n", ps->filename, ps->token );
return T_NONE;
}
@ -181,7 +181,7 @@ qboolean CSCR_ParseHeader( parserstate_t *ps )
if( Q_atof( ps->token ) != 1 )
{
MsgDev( D_ERROR, "File %s has wrong version %s!\n", ps->filename, ps->token );
Con_DPrintf( S_ERROR "File %s has wrong version %s!\n", ps->filename, ps->token );
return false;
}
@ -192,7 +192,7 @@ qboolean CSCR_ParseHeader( parserstate_t *ps )
if( Q_stricmp( ps->token, "INFO_OPTIONS") && Q_stricmp( ps->token, "SERVER_OPTIONS" ))
{
MsgDev( D_ERROR, "DESCRIPTION must be INFO_OPTIONS or SERVER_OPTIONS\n");
Con_DPrintf( S_ERROR "DESCRIPTION must be INFO_OPTIONS or SERVER_OPTIONS\n");
return false;
}
@ -223,13 +223,10 @@ int CSCR_WriteGameCVars( file_t *cfg, const char *scriptfilename )
if( !state.buf || !length )
return 0;
MsgDev( D_INFO, "Reading config script file %s\n", scriptfilename );
Con_DPrintf( "Reading config script file %s\n", scriptfilename );
if( !CSCR_ParseHeader( &state ))
{
MsgDev( D_ERROR, "Failed to parse header!\n" );
goto finish;
}
while( !CSCR_ExpectString( &state, "}", false, false ))
{
@ -258,7 +255,7 @@ int CSCR_WriteGameCVars( file_t *cfg, const char *scriptfilename )
}
if( COM_ParseFile( state.buf, state.token ))
MsgDev( D_ERROR, "Got extra tokens!\n" );
Con_DPrintf( S_ERROR "Got extra tokens!\n" );
else success = true;
finish:
if( !success )
@ -266,8 +263,8 @@ finish:
state.token[sizeof( state.token ) - 1] = 0;
if( start && state.buf )
MsgDev( D_ERROR, "Parse error in %s, byte %d, token %s\n", scriptfilename, (int)( state.buf - start ), state.token );
else MsgDev( D_ERROR, "Parse error in %s, token %s\n", scriptfilename, state.token );
Con_DPrintf( S_ERROR "Parse error in %s, byte %d, token %s\n", scriptfilename, (int)( state.buf - start ), state.token );
else Con_DPrintf( S_ERROR "Parse error in %s, token %s\n", scriptfilename, state.token );
}
if( start ) Mem_Free( start );
@ -296,13 +293,10 @@ int CSCR_LoadDefaultCVars( const char *scriptfilename )
if( !state.buf || !length )
return 0;
MsgDev( D_INFO, "Reading config script file %s\n", scriptfilename );
Con_DPrintf( "Reading config script file %s\n", scriptfilename );
if( !CSCR_ParseHeader( &state ))
{
MsgDev( D_ERROR, "Failed to parse header!\n" );
goto finish;
}
while( !CSCR_ExpectString( &state, "}", false, false ))
{
@ -322,15 +316,15 @@ int CSCR_LoadDefaultCVars( const char *scriptfilename )
}
if( COM_ParseFile( state.buf, state.token ))
MsgDev( D_ERROR, "Got extra tokens!\n" );
Con_DPrintf( S_ERROR "Got extra tokens!\n" );
else success = true;
finish:
if( !success )
{
state.token[sizeof( state.token ) - 1] = 0;
if( start && state.buf )
MsgDev( D_ERROR, "Parse error in %s, byte %d, token %s\n", scriptfilename, (int)( state.buf - start ), state.token );
else MsgDev( D_ERROR, "Parse error in %s, token %s\n", scriptfilename, state.token );
Con_DPrintf( S_ERROR "Parse error in %s, byte %d, token %s\n", scriptfilename, (int)( state.buf - start ), state.token );
else Con_DPrintf( S_ERROR "Parse error in %s, token %s\n", scriptfilename, state.token );
}
if( start ) Mem_Free( start );

View File

@ -591,11 +591,11 @@ void Cmd_TokenizeString( char *text )
if( !*text )
return;
if( cmd_argc == 1 )
cmd_args = text;
host.com_ignorebracket = true;
host.com_ignorebracket = true;
text = COM_ParseFile( text, cmd_token );
host.com_ignorebracket = false;
@ -621,7 +621,7 @@ static int Cmd_AddCommandEx( const char *funcname, const char *cmd_name, xcomman
if( !COM_CheckString( cmd_name ))
{
MsgDev( D_ERROR, "Cmd_AddCommand: NULL name\n" );
Con_Reportf( S_ERROR "Cmd_AddCommand: NULL name\n" );
return 0;
}
@ -986,19 +986,21 @@ void Cmd_ExecuteString( char *text )
if( host.apply_game_config )
return; // don't send nothing to server: we is a server!
#ifndef XASH_DEDICATED
// forward the command line to the server, so the entity DLL can parse it
if( host.type == HOST_NORMAL )
{
#ifndef XASH_DEDICATED
if( cls.state >= ca_connected )
{
Cmd_ForwardToServer();
}
else
#endif
if( text[0] != '@' && host.type == HOST_NORMAL )
{
// commands with leading '@' are hidden system commands
Con_Printf( S_WARN "Unknown command \"%s\"\n", text );
}
else
#endif // XASH_DEDICATED
if( text[0] != '@' && Cvar_VariableInteger( "host_gameloaded" ))
{
// commands with leading '@' are hidden system commands
Con_Printf( S_WARN "Unknown command \"%s\"\n", text );
}
}
}

View File

@ -89,7 +89,7 @@ XASH SPECIFIC - sort of hack that works only in Xash3D not in GoldSrc
#define MAX_SERVERINFO_STRING 512 // server handles too many settings. expand to 1024?
#define MAX_LOCALINFO_STRING 32768 // localinfo used on server and not sended to the clients
#define MAX_SYSPATH 1024 // system filepath
#define MAX_PRINT_MSG 8192 // how many symbols can handle single call of Msg or MsgDev
#define MAX_PRINT_MSG 8192 // how many symbols can handle single call of Con_Printf or Con_DPrintf
#define MAX_TOKEN 2048 // parse token length
#define MAX_MODS 512 // environment games that engine can keep visible
#define MAX_USERMSG_LENGTH 2048 // don't modify it's relies on a client-side definitions
@ -276,9 +276,11 @@ typedef struct gameinfo_s
int gamemode;
qboolean secure; // prevent to console acess
qboolean nomodels; // don't let player to choose model (use player.mdl always)
qboolean noskills; // disable skill menu selection
char sp_entity[32]; // e.g. info_player_start
char mp_entity[32]; // e.g. info_player_deathmatch
char mp_filter[32]; // filtering multiplayer-maps
char ambientsound[NUM_AMBIENTS][MAX_QPATH]; // quake ambient sounds
@ -655,7 +657,7 @@ typedef enum
IMAGE_ROT_90 = BIT(18), // flip from upper left corner to down right corner
IMAGE_ROT180 = IMAGE_FLIP_X|IMAGE_FLIP_Y,
IMAGE_ROT270 = IMAGE_FLIP_X|IMAGE_FLIP_Y|IMAGE_ROT_90,
// reserved
IMAGE_EMBOSS = BIT(19), // apply emboss mapping
IMAGE_RESAMPLE = BIT(20), // resample image to specified dims
// reserved
// reserved
@ -666,16 +668,6 @@ typedef enum
IMAGE_REMAP = BIT(27), // interpret width and height as top and bottom color
} imgFlags_t;
// ordering is important!
typedef enum
{
BLUR_FILTER = 0,
BLUR_FILTER2,
EDGE_FILTER,
EMBOSS_FILTER,
NUM_FILTERS,
} pixfilter_t;
typedef struct rgbdata_s
{
word width; // image width
@ -691,21 +683,6 @@ typedef struct rgbdata_s
size_t size; // for bounds checking
} rgbdata_t;
// imgfilter processing flags
typedef enum
{
FILTER_GRAYSCALE = BIT(0),
} flFlags_t;
typedef struct imgfilter_s
{
int filter; // pixfilter_t
float factor; // filter factor value
float bias; // filter bias value
flFlags_t flags; // filter additional flags
uint blendFunc; // blending mode
} imgfilter_t;
//
// imagelib
//
@ -717,7 +694,7 @@ qboolean FS_SaveImage( const char *filename, rgbdata_t *pix );
rgbdata_t *FS_CopyImage( rgbdata_t *in );
void FS_FreeImage( rgbdata_t *pack );
extern const bpc_desc_t PFDesc[]; // image get pixelformat
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgfilter_t *filter );
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, float bumpscale );
void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end, int pal_size );
void Image_PaletteTranslate( byte *palSrc, int top, int bottom, int pal_size );
void Image_SetForceFlags( uint flags ); // set image force flags on loading
@ -1026,6 +1003,7 @@ void SV_DrawDebugTriangles( void );
void SV_DrawOrthoTriangles( void );
double CL_GetDemoFramerate( void );
qboolean UI_CreditsActive( void );
void CL_StopPlayback( void );
void CL_ExtraUpdate( void );
int CL_GetMaxClients( void );
int SV_GetMaxClients( void );

View File

@ -685,7 +685,9 @@ qboolean Cmd_GetCDList( const char *s, char *completedname, int length )
qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
{
qboolean use_filter = false;
byte buf[MAX_SYSPATH];
string mpfilter;
char *buffer;
string result;
int i, size;
@ -695,6 +697,8 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
if( FS_FileSize( "maps.lst", onlyingamedir ) > 0 && !fRefresh )
return true; // exist
// setup mpfilter
Q_snprintf( mpfilter, sizeof( mpfilter ), "maps/%s", GI->mp_filter );
t = FS_Search( "maps/*.bsp", false, onlyingamedir );
if( !t )
@ -708,6 +712,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
}
buffer = Mem_Calloc( host.mempool, t->numfilenames * 2 * sizeof( result ));
use_filter = Q_strlen( GI->mp_filter ) ? true : false;
for( i = 0; i < t->numfilenames; i++ )
{
@ -718,6 +723,9 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
if( Q_stricmp( COM_FileExtension( t->filenames[i] ), "bsp" ))
continue;
if( use_filter && !Q_strnicmp( t->filenames[i], mpfilter, Q_strlen( mpfilter )))
continue;
f = FS_Open( t->filenames[i], "rb", onlyingamedir );
COM_FileBase( t->filenames[i], mapname );
@ -775,7 +783,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
else if( !Q_strcmp( token, "classname" ))
{
pfile = COM_ParseFile( pfile, token );
if( !Q_strcmp( token, GI->mp_entity ))
if( !Q_strcmp( token, GI->mp_entity ) || use_filter )
num_spawnpoints++;
}
if( num_spawnpoints ) break; // valid map
@ -823,6 +831,7 @@ int Cmd_CheckMapsList( int fRefresh )
autocomplete_list_t cmd_list[] =
{
{ "map_background", Cmd_GetMapList },
{ "changelevel2", Cmd_GetMapList },
{ "changelevel", Cmd_GetMapList },
{ "playdemo", Cmd_GetDemoList, },
{ "timedemo", Cmd_GetDemoList, },
@ -1196,7 +1205,7 @@ void Cmd_WriteOpenGLVariables( file_t *f )
else\
{\
FS_Close( f );\
MsgDev( D_ERROR, "could not update " x "\n" );\
Con_Reportf( S_ERROR "could not update " x "\n" );\
}
/*

View File

@ -575,7 +575,6 @@ int Q_vsnprintf( char *buffer, size_t buffersize, const char *format, va_list ar
__except( EXCEPTION_EXECUTE_HANDLER )
{
Q_strncpy( buffer, "^1sprintf throw exception^7\n", buffersize );
// memset( buffer, 0, buffersize );
result = buffersize;
}
#endif

View File

@ -672,6 +672,18 @@ const char *Cvar_VariableString( const char *var_name )
return var->string;
}
/*
============
Cvar_Exists
============
*/
qboolean Cvar_Exists( const char *var_name )
{
if( Cvar_FindVar( var_name ))
return true;
return false;
}
/*
============
Cvar_SetCheatState

View File

@ -64,6 +64,7 @@ float Cvar_VariableValue( const char *var_name );
int Cvar_VariableInteger( const char *var_name );
const char *Cvar_VariableString( const char *var_name );
void Cvar_WriteVariables( file_t *f, int group );
qboolean Cvar_Exists( const char *var_name );
void Cvar_Reset( const char *var_name );
void Cvar_SetCheatState( void );
qboolean Cvar_Command( convar_t *v );

View File

@ -335,13 +335,13 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
if( pin->ident != IDSPRITEHEADER )
{
MsgDev( D_ERROR, "%s has wrong id (%x should be %x)\n", mod->name, pin->ident, IDSPRITEHEADER );
Con_Reportf( S_ERROR "%s has wrong id (%x should be %x)\n", mod->name, pin->ident, IDSPRITEHEADER );
return;
}
if( i != SPRITE_VERSION_Q1 && i != SPRITE_VERSION_HL && i != SPRITE_VERSION_32 )
{
MsgDev( D_ERROR, "%s has wrong version number (%i should be %i or %i)\n", mod->name, i, SPRITE_VERSION_Q1, SPRITE_VERSION_HL );
Con_Reportf( S_ERROR "%s has wrong version number (%i should be %i or %i)\n", mod->name, i, SPRITE_VERSION_Q1, SPRITE_VERSION_HL );
return;
}
@ -428,13 +428,13 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
}
else
{
MsgDev( D_ERROR, "%s has wrong number of palette colors %i (should be 256)\n", mod->name, *numi );
Con_Reportf( S_ERROR "%s has wrong number of palette colors %i (should be 256)\n", mod->name, *numi );
return;
}
if( mod->numframes < 1 )
{
MsgDev( D_ERROR, "%s has invalid # of frames: %d\n", mod->name, mod->numframes );
Con_Reportf( S_ERROR "%s has invalid # of frames: %d\n", mod->name, mod->numframes );
return;
}

View File

@ -363,7 +363,7 @@ static const char *FS_FixFileCase( const char *path )
}
}
//MsgDev( D_NOTE, "FS_FixFileCase: %s\n", path );
//Con_Reportf( "FS_FixFileCase: %s\n", path );
if( !( dir = opendir( path2 ) ) )
return path;
@ -374,7 +374,7 @@ static const char *FS_FixFileCase( const char *path )
continue;
path = va( "%s/%s", path2, entry->d_name );
//MsgDev( D_NOTE, "FS_FixFileCase: %s %s %s\n", path2, fname, entry->d_name );
//Con_Reportf( "FS_FixFileCase: %s %s %s\n", path2, fname, entry->d_name );
break;
}
closedir( dir );
@ -406,7 +406,7 @@ static dpackfile_t *FS_AddFileToPack( const char *name, pack_t *pack, long offse
diff = Q_stricmp( pack->files[middle].name, name );
// If we found the file, there's a problem
if( !diff ) MsgDev( D_WARN, "package %s contains the file %s several times\n", pack->filename, name );
if( !diff ) Con_Reportf( S_WARN "package %s contains the file %s several times\n", pack->filename, name );
// If we're too far in the list
if( diff > 0 ) right = middle - 1;
@ -521,7 +521,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( packhandle < 0 )
{
MsgDev( D_NOTE, "%s couldn't open\n", packfile );
Con_Reportf( "%s couldn't open\n", packfile );
if( error ) *error = PAK_LOAD_COULDNT_OPEN;
return NULL;
}
@ -530,7 +530,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( header.ident != IDPACKV1HEADER )
{
MsgDev( D_NOTE, "%s is not a packfile. Ignored.\n", packfile );
Con_Reportf( "%s is not a packfile. Ignored.\n", packfile );
if( error ) *error = PAK_LOAD_BAD_HEADER;
close( packhandle );
return NULL;
@ -538,7 +538,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( header.dirlen % sizeof( dpackfile_t ))
{
MsgDev( D_ERROR, "%s has an invalid directory size. Ignored.\n", packfile );
Con_Reportf( S_ERROR "%s has an invalid directory size. Ignored.\n", packfile );
if( error ) *error = PAK_LOAD_BAD_FOLDERS;
close( packhandle );
return NULL;
@ -548,7 +548,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( numpackfiles > MAX_FILES_IN_PACK )
{
MsgDev( D_ERROR, "%s has too many files ( %i ). Ignored.\n", packfile, numpackfiles );
Con_Reportf( S_ERROR "%s has too many files ( %i ). Ignored.\n", packfile, numpackfiles );
if( error ) *error = PAK_LOAD_TOO_MANY_FILES;
close( packhandle );
return NULL;
@ -556,7 +556,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( numpackfiles <= 0 )
{
MsgDev( D_NOTE, "%s has no files. Ignored.\n", packfile );
Con_Reportf( "%s has no files. Ignored.\n", packfile );
if( error ) *error = PAK_LOAD_NO_FILES;
close( packhandle );
return NULL;
@ -567,7 +567,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( header.dirlen != read( packhandle, (void *)info, header.dirlen ))
{
MsgDev( D_NOTE, "%s is an incomplete PAK, not loading\n", packfile );
Con_Reportf( "%s is an incomplete PAK, not loading\n", packfile );
if( error ) *error = PAK_LOAD_CORRUPTED;
close( packhandle );
Mem_Free( info );
@ -612,9 +612,11 @@ static qboolean FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loade
}
}
if( already_loaded ) *already_loaded = false;
if( !Q_stricmp( ext, "wad" )) wad = W_Open( wadfile, &errorcode );
else MsgDev( D_ERROR, "\"%s\" doesn't have a wad extension\n", wadfile );
if( already_loaded )
*already_loaded = false;
if( !Q_stricmp( ext, "wad" ))
wad = W_Open( wadfile, &errorcode );
if( wad )
{
@ -630,7 +632,7 @@ static qboolean FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loade
else
{
if( errorcode != WAD_LOAD_NO_FILES )
MsgDev( D_ERROR, "FS_AddWad_Fullpath: unable to load wad \"%s\"\n", wadfile );
Con_Reportf( S_ERROR "FS_AddWad_Fullpath: unable to load wad \"%s\"\n", wadfile );
return false;
}
}
@ -665,10 +667,11 @@ static qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loade
}
}
if( already_loaded ) *already_loaded = false;
if( already_loaded )
*already_loaded = false;
if( !Q_stricmp( ext, "pak" )) pak = FS_LoadPackPAK( pakfile, &errorcode );
else MsgDev( D_ERROR, "\"%s\" does not have a pack extension\n", pakfile );
if( !Q_stricmp( ext, "pak" ))
pak = FS_LoadPackPAK( pakfile, &errorcode );
if( pak )
{
@ -697,7 +700,7 @@ static qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loade
else
{
if( errorcode != PAK_LOAD_NO_FILES )
MsgDev( D_ERROR, "FS_AddPak_Fullpath: unable to load pak \"%s\"\n", pakfile );
Con_Reportf( S_ERROR "FS_AddPak_Fullpath: unable to load pak \"%s\"\n", pakfile );
return false;
}
}
@ -781,7 +784,7 @@ void FS_AddGameHierarchy( const char *dir, uint flags )
{
if( !Q_strnicmp( SI.games[i]->gamefolder, dir, 64 ))
{
MsgDev( D_NOTE, "FS_AddGameHierarchy: %d %s %s\n", i, SI.games[i]->gamefolder, SI.games[i]->basedir );
Con_Reportf( "FS_AddGameHierarchy: %d %s %s\n", i, SI.games[i]->gamefolder, SI.games[i]->basedir );
if( !SI.games[i]->added && Q_stricmp( SI.games[i]->gamefolder, SI.games[i]->basedir ) )
{
SI.games[i]->added = true;
@ -898,7 +901,7 @@ FS_Rescan
*/
void FS_Rescan( void )
{
MsgDev( D_NOTE, "FS_Rescan( %s )\n", GI->title );
Con_Reportf( "FS_Rescan( %s )\n", GI->title );
FS_ClearSearchPath();
@ -952,6 +955,8 @@ assume GameInfo is valid
static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
{
file_t *f = FS_Open( filepath, "w", false ); // we in binary-mode
int i, write_ambients = false;
if( !f ) Sys_Error( "FS_WriteGameInfo: can't write %s\n", filepath ); // may be disk-space is out?
FS_Printf( f, "// generated by %s %s-%s (%s-%s)\n\n\n", XASH_ENGINE_NAME, XASH_VERSION, Q_buildcommit(), Q_buildos(), Q_buildarch() );
@ -1020,6 +1025,8 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
FS_Printf( f, "sp_entity\t\t\"%s\"\n", GameInfo->sp_entity );
if( Q_strlen( GameInfo->mp_entity ))
FS_Printf( f, "mp_entity\t\t\"%s\"\n", GameInfo->mp_entity );
if( Q_strlen( GameInfo->mp_filter ))
FS_Printf( f, "mp_filter\t\t\"%s\"\n", GameInfo->mp_filter );
if( GameInfo->secure )
FS_Printf( f, "secure\t\t\"%i\"\n", GameInfo->secure );
@ -1036,6 +1043,19 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
if( GameInfo->max_particles > 0 )
FS_Printf( f, "max_particles\t%i\n", GameInfo->max_particles );
for( i = 0; i < NUM_AMBIENTS; i++ )
{
if( *GameInfo->ambientsound[i] )
{
if( !write_ambients )
{
FS_Print( f, "\n" );
write_ambients = true;
}
FS_Printf( f, "ambient%i\t\t%s\n", i, GameInfo->ambientsound[i] );
}
}
FS_Print( f, "\n\n\n" );
FS_Close( f ); // all done
}
@ -1188,6 +1208,10 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
{
pfile = COM_ParseFile( pfile, GameInfo->mp_entity );
}
else if( !Q_stricmp( token, isGameInfo ? "mp_filter" : "mpfilter" ))
{
pfile = COM_ParseFile( pfile, GameInfo->mp_filter );
}
// valid for both
else if( !Q_stricmp( token, "secure" ))
{
@ -1263,13 +1287,13 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
int ambientNum = Q_atoi( token + 7 );
if( ambientNum < 0 || ambientNum > ( NUM_AMBIENTS - 1 ))
{
MsgDev( D_ERROR, "FS_ParseGameInfo: Invalid ambient number %i. Ignored.\n", ambientNum );
}
else
{
pfile = COM_ParseFile( pfile, GameInfo->ambientsound[ambientNum] );
}
ambientNum = 0;
pfile = COM_ParseFile( pfile, GameInfo->ambientsound[ambientNum] );
}
else if( !Q_stricmp( token, "noskills" ))
{
pfile = COM_ParseFile( pfile, token );
GameInfo->noskills = Q_atoi( token );
}
}
}
@ -1490,7 +1514,7 @@ void FS_LoadGameInfo( const char *rootfolder )
fs_ext_path = false;
if( rootfolder ) Q_strcpy( fs_gamedir, rootfolder );
MsgDev( D_NOTE, "FS_LoadGameInfo( %s )\n", fs_gamedir );
Con_Reportf( "FS_LoadGameInfo( %s )\n", fs_gamedir );
// clear any old pathes
FS_ClearSearchPath();
@ -1724,7 +1748,6 @@ static file_t *FS_SysOpen( const char *filepath, const char *mode )
opt = O_CREAT;
break;
default:
MsgDev( D_ERROR, "FS_SysOpen(%s, %s): invalid mode\n", filepath, mode );
return NULL;
}
@ -1739,7 +1762,6 @@ static file_t *FS_SysOpen( const char *filepath, const char *mode )
opt |= O_BINARY;
break;
default:
MsgDev( D_ERROR, "FS_SysOpen: %s: unknown char (%c) in mode (%s)\n", filepath, mode[ind], mode );
break;
}
}
@ -1872,7 +1894,7 @@ qboolean FS_SysFolderExists( const char *path )
}
else
{
MsgDev( D_ERROR, "FS_SysFolderExists: problem while opening dir: %s\n", strerror( errno ) );
Con_Reportf( S_ERROR "FS_SysFolderExists: problem while opening dir: %s\n", strerror( errno ) );
return false;
}
#endif
@ -2542,7 +2564,7 @@ qboolean FS_WriteFile( const char *filename, const void *data, long len )
if( !file )
{
MsgDev( D_ERROR, "FS_WriteFile: failed on %s\n", filename);
Con_Reportf( S_ERROR "FS_WriteFile: failed on %s\n", filename);
return false;
}
@ -2832,7 +2854,7 @@ qboolean FS_FileCopy( file_t *pOutput, file_t *pInput, int fileSize )
if(( readSize = FS_Read( pInput, buf, size )) < size )
{
MsgDev( D_ERROR, "FS_FileCopy: unexpected end of input file (%d < %d)\n", readSize, size );
Con_Reportf( S_ERROR "FS_FileCopy: unexpected end of input file (%d < %d)\n", readSize, size );
fileSize = 0;
done = false;
break;
@ -3205,7 +3227,7 @@ static dlumpinfo_t *W_AddFileToWad( const char *name, wfile_t *wad, dlumpinfo_t
diff = 1;
else if( wad->lumps[middle].type > newlump->type )
diff = -1;
else MsgDev( D_WARN, "Wad %s contains the file %s several times\n", wad->filename, name );
else Con_Reportf( S_WARN "Wad %s contains the file %s several times\n", wad->filename, name );
}
// If we're too far in the list
@ -3246,7 +3268,7 @@ byte *W_ReadLump( wfile_t *wad, dlumpinfo_t *lump, long *lumpsizeptr )
if( FS_Seek( wad->handle, lump->filepos, SEEK_SET ) == -1 )
{
MsgDev( D_ERROR, "W_ReadLump: %s is corrupted\n", lump->name );
Con_Reportf( S_ERROR "W_ReadLump: %s is corrupted\n", lump->name );
FS_Seek( wad->handle, oldpos, SEEK_SET );
return NULL;
}
@ -3256,7 +3278,7 @@ byte *W_ReadLump( wfile_t *wad, dlumpinfo_t *lump, long *lumpsizeptr )
if( size < lump->disksize )
{
MsgDev( D_WARN, "W_ReadLump: %s is probably corrupted\n", lump->name );
Con_Reportf( S_WARN "W_ReadLump: %s is probably corrupted\n", lump->name );
FS_Seek( wad->handle, oldpos, SEEK_SET );
Mem_Free( buf );
return NULL;
@ -3303,7 +3325,7 @@ wfile_t *W_Open( const char *filename, int *error )
if( wad->handle == NULL )
{
MsgDev( D_ERROR, "W_Open: couldn't open %s\n", filename );
Con_Reportf( S_ERROR "W_Open: couldn't open %s\n", filename );
if( error ) *error = WAD_LOAD_COULDNT_OPEN;
W_Close( wad );
return NULL;
@ -3316,7 +3338,7 @@ wfile_t *W_Open( const char *filename, int *error )
if( FS_Read( wad->handle, &header, sizeof( dwadinfo_t )) != sizeof( dwadinfo_t ))
{
MsgDev( D_ERROR, "W_Open: %s can't read header\n", filename );
Con_Reportf( S_ERROR "W_Open: %s can't read header\n", filename );
if( error ) *error = WAD_LOAD_BAD_HEADER;
W_Close( wad );
return NULL;
@ -3324,7 +3346,7 @@ wfile_t *W_Open( const char *filename, int *error )
if( header.ident != IDWAD2HEADER && header.ident != IDWAD3HEADER )
{
MsgDev( D_ERROR, "W_Open: %s is not a WAD2 or WAD3 file\n", filename );
Con_Reportf( S_ERROR "W_Open: %s is not a WAD2 or WAD3 file\n", filename );
if( error ) *error = WAD_LOAD_BAD_HEADER;
W_Close( wad );
return NULL;
@ -3334,12 +3356,12 @@ wfile_t *W_Open( const char *filename, int *error )
if( lumpcount >= MAX_FILES_IN_WAD )
{
MsgDev( D_WARN, "W_Open: %s is full (%i lumps)\n", filename, lumpcount );
Con_Reportf( S_WARN "W_Open: %s is full (%i lumps)\n", filename, lumpcount );
if( error ) *error = WAD_LOAD_TOO_MANY_FILES;
}
else if( lumpcount <= 0 )
{
MsgDev( D_ERROR, "W_Open: %s has no lumps\n", filename );
Con_Reportf( S_ERROR "W_Open: %s has no lumps\n", filename );
if( error ) *error = WAD_LOAD_NO_FILES;
W_Close( wad );
return NULL;
@ -3350,7 +3372,7 @@ wfile_t *W_Open( const char *filename, int *error )
if( FS_Seek( wad->handle, wad->infotableofs, SEEK_SET ) == -1 )
{
MsgDev( D_ERROR, "W_Open: %s can't find lump allocation table\n", filename );
Con_Reportf( S_ERROR "W_Open: %s can't find lump allocation table\n", filename );
if( error ) *error = WAD_LOAD_BAD_FOLDERS;
W_Close( wad );
return NULL;
@ -3363,7 +3385,7 @@ wfile_t *W_Open( const char *filename, int *error )
if( FS_Read( wad->handle, srclumps, lat_size ) != lat_size )
{
MsgDev( D_ERROR, "W_ReadLumpTable: %s has corrupted lump allocation table\n", wad->filename );
Con_Reportf( S_ERROR "W_ReadLumpTable: %s has corrupted lump allocation table\n", wad->filename );
if( error ) *error = WAD_LOAD_CORRUPTED;
Mem_Free( srclumps );
W_Close( wad );

View File

@ -464,7 +464,7 @@ double Host_CalcFPS( void )
if( host.type != HOST_DEDICATED && Host_IsLocalGame( ) && !CL_IsTimeDemo( ))
{
// ajdust fps for vertical synchronization
if( gl_vsync != NULL && gl_vsync->value )
if( CVAR_TO_BOOL( gl_vsync ))
{
if( vid_displayfrequency->value != 0.0f )
fps = vid_displayfrequency->value;
@ -772,7 +772,8 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
host.mempool = Mem_AllocPool( "Zone Engine" );
// HACKHACK: Quake console is always allowed
if( Sys_CheckParm( "-console" ) || !Q_stricmp( progname, "id1" ))
// TODO: determine if we are running QWrap more reliable
if( Sys_CheckParm( "-console" ) || !Q_stricmp( SI.exeName, "quake" ))
host.allow_console = true;
if( Sys_CheckParm( "-dev" ))

View File

@ -95,20 +95,17 @@ void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, f
return;
if(( fin != NULL && pData != NULL ) || ( fin == NULL && pData == NULL ))
{
MsgDev( D_ERROR, "HPAK_CreatePak, must specify one of pData or fpSource\n" );
return;
}
Q_strncpy( pakname, filename, sizeof( pakname ));
COM_ReplaceExtension( pakname, ".hpk" );
MsgDev( D_INFO, "creating HPAK %s.\n", pakname );
Con_Printf( "creating HPAK %s.\n", pakname );
fout = FS_Open( pakname, "wb", false );
if( !fout )
{
MsgDev( D_ERROR, "HPAK_CreatePak: can't write %s.\n", pakname );
Con_DPrintf( S_ERROR "HPAK_CreatePak: can't write %s.\n", pakname );
return;
}
@ -135,7 +132,7 @@ void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, f
if( memcmp( md5, pResource->rgucMD5_hash, 16 ))
{
MsgDev( D_ERROR, "HPAK_CreatePak: bad checksum for %s. Ignored\n", pakname );
Con_DPrintf( S_ERROR "HPAK_CreatePak: bad checksum for %s. Ignored\n", pakname );
return;
}
@ -204,10 +201,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
MD5Context_t ctx;
if( pData == NULL && pFile == NULL )
{
MsgDev( D_ERROR, "HPAK_AddLump: no data\n" );
return;
}
if( pResource->nDownloadSize < HPAK_MIN_SIZE || pResource->nDownloadSize > HPAK_MAX_SIZE )
{
@ -238,7 +232,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
if( memcmp( md5, pResource->rgucMD5_hash, 16 ))
{
MsgDev( D_ERROR, "HPAK_AddLump: bad checksum for %s. Ignored\n", pResource->szFileName );
Con_DPrintf( S_ERROR "HPAK_AddLump: bad checksum for %s. Ignored\n", pResource->szFileName );
return;
}
@ -267,7 +261,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
if( !file_dst )
{
MsgDev( D_ERROR, "HPAK_AddLump: couldn't open %s.\n", srcname );
Con_DPrintf( S_ERROR "HPAK_AddLump: couldn't open %s.\n", srcname );
FS_Close( file_src );
return;
}
@ -278,7 +272,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
if( hash_pack_header.version != IDHPAK_VERSION )
{
// we don't check the HPAK bit for some reason.
MsgDev( D_ERROR, "HPAK_AddLump: %s does not have a valid header.\n", srcname );
Con_DPrintf( S_ERROR "HPAK_AddLump: %s does not have a valid header.\n", srcname );
FS_Close( file_src );
FS_Close( file_dst );
}
@ -292,7 +286,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
if( srcpak.count < 1 || srcpak.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "HPAK_AddLump: %s contain too many lumps.\n", srcname );
Con_DPrintf( S_ERROR "HPAK_AddLump: %s contain too many lumps.\n", srcname );
FS_Close( file_src );
FS_Close( file_dst );
return;
@ -386,16 +380,16 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
f = FS_Open( pakname, "rb", false );
if( !f )
{
MsgDev( D_INFO, "Couldn't find %s.\n", pakname );
Con_DPrintf( S_ERROR "Couldn't find %s.\n", pakname );
return true;
}
if( !quiet ) MsgDev( D_INFO, "Validating %s\n", pakname );
if( !quiet ) Con_Printf( "Validating %s\n", pakname );
FS_Read( f, &hdr, sizeof( hdr ));
if( hdr.ident != IDHPAKHEADER || hdr.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "HPAK_ValidatePak: %s does not have a valid HPAK header.\n", pakname );
Con_DPrintf( S_ERROR "HPAK_ValidatePak: %s does not have a valid HPAK header.\n", pakname );
FS_Close( f );
return false;
}
@ -405,24 +399,24 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
if( num_lumps < 1 || num_lumps > MAX_FILES_IN_WAD )
{
MsgDev( D_ERROR, "HPAK_ValidatePak: %s has too many lumps %u.\n", pakname, num_lumps );
Con_DPrintf( S_ERROR "HPAK_ValidatePak: %s has too many lumps %u.\n", pakname, num_lumps );
FS_Close( f );
return false;
}
if( !quiet ) MsgDev( D_INFO, "# of Entries: %i\n", num_lumps );
if( !quiet ) Con_Printf( "# of Entries: %i\n", num_lumps );
dataDir = Z_Malloc( sizeof( hpak_lump_t ) * num_lumps );
FS_Read( f, dataDir, sizeof( hpak_lump_t ) * num_lumps );
if( !quiet ) MsgDev( D_INFO, "# Type Size FileName : MD5 Hash\n" );
if( !quiet ) Con_Printf( "# Type Size FileName : MD5 Hash\n" );
for( i = 0; i < num_lumps; i++ )
{
if( dataDir[i].disksize < 1 || dataDir[i].disksize > 131071 )
{
// odd max size
MsgDev( D_ERROR, "HPAK_ValidatePak: lump %i has invalid size %s\n", i, Q_pretifymem( dataDir[i].disksize, 2 ));
Con_DPrintf( S_ERROR "HPAK_ValidatePak: lump %i has invalid size %s\n", i, Q_pretifymem( dataDir[i].disksize, 2 ));
Mem_Free( dataDir );
FS_Close(f);
return false;
@ -439,24 +433,24 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
pRes = &dataDir[i].resource;
MsgDev( D_INFO, "%i: %s %s %s: ", i, HPAK_TypeFromIndex( pRes->type ),
Con_Printf( "%i: %s %s %s: ", i, HPAK_TypeFromIndex( pRes->type ),
Q_pretifymem( pRes->nDownloadSize, 2 ), pRes->szFileName );
if( memcmp( md5, pRes->rgucMD5_hash, 0x10 ))
{
if( quiet )
{
MsgDev( D_ERROR, "HPAK_ValidatePak: %s has invalid checksum.\n", pakname );
Con_DPrintf( S_ERROR "HPAK_ValidatePak: %s has invalid checksum.\n", pakname );
Mem_Free( dataPak );
Mem_Free( dataDir );
FS_Close( f );
return false;
}
else MsgDev( D_INFO, "failed\n" );
else Con_DPrintf( S_ERROR "failed\n" );
}
else
{
if( !quiet ) MsgDev( D_INFO, "OK\n" );
if( !quiet ) Con_Printf( "OK\n" );
}
// at this point, it's passed our checks.
@ -584,21 +578,21 @@ static qboolean HPAK_ResourceForIndex( const char *filename, int index, resource
f = FS_Open( pakname, "rb", false );
if( !f )
{
MsgDev( D_ERROR, "couldn't open %s.\n", pakname );
Con_DPrintf( S_ERROR "couldn't open %s.\n", pakname );
return false;
}
FS_Read( f, &header, sizeof( header ));
if( header.ident != IDHPAKHEADER )
{
MsgDev( D_ERROR, "%s is not an HPAK file\n", pakname );
Con_DPrintf( S_ERROR "%s is not an HPAK file\n", pakname );
FS_Close( f );
return false;
}
if( header.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
Con_DPrintf( S_ERROR "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
FS_Close( f );
return false;
}
@ -608,14 +602,14 @@ static qboolean HPAK_ResourceForIndex( const char *filename, int index, resource
if( directory.count < 1 || directory.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "%s has too many lumps %u.\n", pakname, directory.count );
Con_DPrintf( S_ERROR "%s has too many lumps %u.\n", pakname, directory.count );
FS_Close( f );
return false;
}
if( index < 1 || index > directory.count )
{
MsgDev( D_ERROR, "%s, lump with index %i doesn't exist.\n", pakname, index );
Con_DPrintf( S_ERROR "%s, lump with index %i doesn't exist.\n", pakname, index );
FS_Close( f );
return false;
}
@ -674,14 +668,14 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte
if( header.ident != IDHPAKHEADER )
{
MsgDev( D_ERROR, "%s it's not a HPK file.\n", pakname );
Con_DPrintf( S_ERROR "%s it's not a HPK file.\n", pakname );
FS_Close( f );
return false;
}
if( header.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
Con_DPrintf( S_ERROR "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
FS_Close( f );
return false;
}
@ -691,7 +685,7 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte
if( directory.count < 1 || directory.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "HPAK_GetDataPointer: %s has too many lumps %u.\n", filename, directory.count );
Con_DPrintf( S_ERROR "HPAK_GetDataPointer: %s has too many lumps %u.\n", filename, directory.count );
FS_Close( f );
return false;
}
@ -751,7 +745,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
file_src = FS_Open( read_path, "rb", false );
if( !file_src )
{
MsgDev( D_ERROR, "%s couldn't open.\n", read_path );
Con_DPrintf( S_ERROR "%s couldn't open.\n", read_path );
return;
}
@ -761,7 +755,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( !file_dst )
{
MsgDev( D_ERROR, "%s couldn't open.\n", save_path );
Con_DPrintf( S_ERROR "%s couldn't open.\n", save_path );
FS_Close( file_src );
return;
}
@ -775,7 +769,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( hash_pack_header.ident != IDHPAKHEADER || hash_pack_header.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "%s has invalid header.\n", read_path );
Con_DPrintf( S_ERROR "%s has invalid header.\n", read_path );
FS_Close( file_src );
FS_Close( file_dst );
FS_Delete( save_path ); // delete temp file
@ -787,7 +781,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( hpak_read.count < 1 || hpak_read.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "%s has invalid number of lumps.\n", read_path );
Con_DPrintf( S_ERROR "%s has invalid number of lumps.\n", read_path );
FS_Close( file_src );
FS_Close( file_dst );
FS_Delete( save_path ); // delete temp file
@ -796,7 +790,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( hpak_read.count == 1 )
{
MsgDev( D_WARN, "%s only has one element, so HPAK will be removed\n", read_path );
Con_DPrintf( S_WARN "%s only has one element, so HPAK will be removed\n", read_path );
FS_Close( file_src );
FS_Close( file_dst );
FS_Delete( read_path );
@ -812,7 +806,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( !HPAK_FindResource( &hpak_read, pResource->rgucMD5_hash, NULL ))
{
MsgDev( D_ERROR, "HPAK %s doesn't contain specified lump: %s\n", read_path, pResource->szFileName );
Con_DPrintf( S_ERROR "HPAK doesn't contain specified lump: %s\n", pResource->szFileName, read_path );
Mem_Free( hpak_read.entries );
Mem_Free( hpak_save.entries );
FS_Close( file_src );
@ -821,7 +815,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
return;
}
MsgDev( D_INFO, "Removing %s from HPAK %s.\n", pResource->szFileName, read_path );
Con_Printf( "Removing %s from HPAK %s.\n", pResource->szFileName, read_path );
// If there's a collision, we've just corrupted this hpak.
for( i = 0, j = 0; i < hpak_read.count; i++ )
@ -881,7 +875,7 @@ void HPAK_List_f( void )
f = FS_Open( pakname, "rb", false );
if( !f )
{
MsgDev( D_ERROR, "couldn't open %s.\n", pakname );
Con_DPrintf( S_ERROR "couldn't open %s.\n", pakname );
return;
}
@ -889,14 +883,14 @@ void HPAK_List_f( void )
if( header.ident != IDHPAKHEADER )
{
MsgDev( D_ERROR, "%s is not an HPAK file\n", pakname );
Con_DPrintf( S_ERROR "%s is not an HPAK file\n", pakname );
FS_Close( f );
return;
}
if( header.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
Con_DPrintf( S_ERROR "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
FS_Close( f );
return;
}
@ -906,7 +900,7 @@ void HPAK_List_f( void )
if( directory.count < 1 || directory.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "%s has too many lumps %u.\n", pakname, directory.count );
Con_DPrintf( S_ERROR "%s has too many lumps %u.\n", pakname, directory.count );
FS_Close( f );
return;
}
@ -972,7 +966,7 @@ void HPAK_Extract_f( void )
f = FS_Open( pakname, "rb", false );
if( !f )
{
MsgDev( D_ERROR, "couldn't open %s.\n", pakname );
Con_DPrintf( S_ERROR "couldn't open %s.\n", pakname );
return;
}
@ -980,14 +974,14 @@ void HPAK_Extract_f( void )
if( header.ident != IDHPAKHEADER )
{
MsgDev( D_ERROR, "%s is not an HPAK file\n", pakname );
Con_DPrintf( S_ERROR "%s is not an HPAK file\n", pakname );
FS_Close( f );
return;
}
if( header.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
Con_DPrintf( S_ERROR "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
FS_Close( f );
return;
}
@ -997,7 +991,7 @@ void HPAK_Extract_f( void )
if( directory.count < 1 || directory.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "%s has too many lumps %u.\n", pakname, directory.count );
Con_DPrintf( S_ERROR "%s has too many lumps %u.\n", pakname, directory.count );
FS_Close( f );
return;
}
@ -1023,7 +1017,7 @@ void HPAK_Extract_f( void )
if( entry->disksize <= 0 || entry->disksize >= HPAK_MAX_SIZE )
{
MsgDev( D_WARN, "Unable to extract data, size invalid: %s\n", Q_memprint( entry->disksize ));
Con_DPrintf( S_WARN "Unable to extract data, size invalid: %s\n", Q_memprint( entry->disksize ));
continue;
}
@ -1061,7 +1055,7 @@ void HPAK_Remove_f( void )
}
else
{
MsgDev( D_ERROR, "Could not locate resource %i in %s\n", Q_atoi( Cmd_Argv( 2 )), Cmd_Argv( 1 ));
Con_DPrintf( S_ERROR "Could not locate resource %i in %s\n", Q_atoi( Cmd_Argv( 2 )), Cmd_Argv( 1 ));
}
}

View File

@ -69,13 +69,13 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
if( memcmp( bhdr.id, "BM", 2 ))
{
MsgDev( D_ERROR, "Image_LoadBMP: only Windows-style BMP files supported (%s)\n", name );
Con_DPrintf( S_ERROR "Image_LoadBMP: only Windows-style BMP files supported (%s)\n", name );
return false;
}
if( bhdr.bitmapHeaderSize != 0x28 )
{
MsgDev( D_ERROR, "Image_LoadBMP: invalid header size %i\n", bhdr.bitmapHeaderSize );
Con_DPrintf( S_ERROR "Image_LoadBMP: invalid header size %i\n", bhdr.bitmapHeaderSize );
return false;
}
@ -83,13 +83,13 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
if( bhdr.fileSize != filesize )
{
// Sweet Half-Life issues. splash.bmp have bogus filesize
MsgDev( D_REPORT, "Image_LoadBMP: %s have incorrect file size %i should be %i\n", name, filesize, bhdr.fileSize );
Con_Reportf( S_WARN "Image_LoadBMP: %s have incorrect file size %i should be %i\n", name, filesize, bhdr.fileSize );
}
// bogus compression? Only non-compressed supported.
if( bhdr.compression != BI_RGB )
{
MsgDev( D_ERROR, "Image_LoadBMP: only uncompressed BMP files supported (%s)\n", name );
Con_DPrintf( S_ERROR "Image_LoadBMP: only uncompressed BMP files supported (%s)\n", name );
return false;
}
@ -296,7 +296,6 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
if( alpha != 255 ) image.flags |= IMAGE_HAS_ALPHA;
break;
default:
MsgDev( D_ERROR, "Image_LoadBMP: illegal pixel_size (%s)\n", name );
Mem_Free( image.palette );
Mem_Free( image.rgba );
return false;
@ -354,7 +353,6 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix )
pixel_size = 4;
break;
default:
MsgDev( D_ERROR, "Image_SaveBMP: unsupported image type %s\n", PFDesc[pix->type].name );
return false;
}

View File

@ -217,7 +217,7 @@ uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
if( filesize != buffsize ) // main check
{
MsgDev( D_WARN, "Image_LoadDDS: (%s) probably corrupted(%i should be %i)\n", name, buffsize, filesize );
Con_DPrintf( S_WARN "Image_LoadDDS: (%s) probably corrupted (%i should be %i)\n", name, buffsize, filesize );
if( buffsize > filesize )
return false;
}
@ -245,10 +245,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
byte *fin;
if( filesize < sizeof( dds_t ))
{
MsgDev( D_ERROR, "Image_LoadDDS: file (%s) have invalid size\n", name );
return false;
}
memcpy( &header, buffer, sizeof( dds_t ));
@ -257,13 +254,13 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
if( header.dwSize != sizeof( dds_t ) - sizeof( uint )) // size of the structure (minus MagicNum)
{
MsgDev( D_ERROR, "Image_LoadDDS: (%s) have corrupted header\n", name );
Con_DPrintf( S_ERROR "Image_LoadDDS: (%s) have corrupted header\n", name );
return false;
}
if( header.dsPixelFormat.dwSize != sizeof( dds_pixf_t )) // size of the structure
{
MsgDev( D_ERROR, "Image_LoadDDS: (%s) have corrupt pixelformat header\n", name );
Con_DPrintf( S_ERROR "Image_LoadDDS: (%s) have corrupt pixelformat header\n", name );
return false;
}
@ -284,7 +281,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
if( image.type == PF_UNKNOWN )
{
MsgDev( D_WARN, "Image_LoadDDS: (%s) has unrecognized type\n", name );
Con_DPrintf( S_ERROR "Image_LoadDDS: (%s) has unrecognized type\n", name );
return false;
}

View File

@ -60,17 +60,17 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
// uncompressed colormapped image
if( targa_header.pixel_size != 8 )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 8 bit images supported for type 1 and 9\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 8 bit images supported for type 1 and 9\n", name );
return false;
}
if( targa_header.colormap_length != 256 )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 8 bit colormaps are supported for type 1 and 9\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 8 bit colormaps are supported for type 1 and 9\n", name );
return false;
}
if( targa_header.colormap_index )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) colormap_index is not supported for type 1 and 9\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) colormap_index is not supported for type 1 and 9\n", name );
return false;
}
if( targa_header.colormap_size == 24 )
@ -95,7 +95,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
}
else
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) only 24 and 32 bit colormaps are supported for type 1 and 9\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) only 24 and 32 bit colormaps are supported for type 1 and 9\n", name );
return false;
}
}
@ -104,7 +104,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
// uncompressed or RLE compressed RGB
if( targa_header.pixel_size != 32 && targa_header.pixel_size != 24 )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 32 or 24 bit images supported for type 2 and 10\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 32 or 24 bit images supported for type 2 and 10\n", name );
return false;
}
}
@ -113,7 +113,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
// uncompressed greyscale
if( targa_header.pixel_size != 8 )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 8 bit images supported for type 3 and 11\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 8 bit images supported for type 3 and 11\n", name );
return false;
}
}
@ -257,7 +257,6 @@ qboolean Image_SaveTGA( const char *name, rgbdata_t *pix )
case PF_RGBA_32:
case PF_BGRA_32: pixel_size = 4; break;
default:
MsgDev( D_ERROR, "Image_SaveTGA: unsupported image type %s\n", PFDesc[pix->type].name );
Mem_Free( buffer );
return false;
}

View File

@ -81,36 +81,13 @@ static byte palette_hl[768] =
147,255,247,199,255,255,255,159,91,83
};
static float FILTER[NUM_FILTERS][FILTER_SIZE][FILTER_SIZE] =
{
{ // regular blur
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f, 1.0f, 1.0f, 0.0f },
{ 0.0f, 1.0f, 1.0f, 1.0f, 0.0f },
{ 0.0f, 1.0f, 1.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
},
{ // light blur
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f, 1.0f, 1.0f, 0.0f },
{ 0.0f, 1.0f, 4.0f, 1.0f, 0.0f },
{ 0.0f, 1.0f, 1.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
},
{ // find edges
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, -1.0f, -1.0f, -1.0f, 0.0f },
{ 0.0f, -1.0f, 8.0f, -1.0f, 0.0f },
{ 0.0f, -1.0f, -1.0f, -1.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
},
{ // emboss
static float img_emboss[FILTER_SIZE][FILTER_SIZE] =
{
{-0.7f, -0.7f, -0.7f, -0.7f, 0.0f },
{-0.7f, -0.7f, -0.7f, 0.0f, 0.7f },
{-0.7f, -0.7f, 0.0f, 0.7f, 0.7f },
{-0.7f, 0.0f, 0.7f, 0.7f, 0.7f },
{ 0.0f, 0.7f, 0.7f, 0.7f, 0.7f },
}
};
/*
@ -1361,7 +1338,7 @@ Filtering algorithm from http://www.student.kuleuven.ac.be/~m0216922/CG/filterin
All credit due
==================
*/
qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias, flFlags_t flags, GLenum blendFunc )
static void Image_ApplyFilter( rgbdata_t *pic, float factor )
{
int i, x, y;
uint *fin, *fout;
@ -1369,7 +1346,7 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
// first expand the image into 32-bit buffer
pic = Image_DecompressInternal( pic );
factor = bound( 0.0f, factor, 1.0f );
size = image.width * image.height * 4;
image.tempbuffer = Mem_Realloc( host.imagepool, image.tempbuffer, size );
fout = (uint *)image.tempbuffer;
@ -1381,6 +1358,7 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
{
vec3_t vout = { 0.0f, 0.0f, 0.0f };
int pos_x, pos_y;
float avg;
for( pos_x = 0; pos_x < FILTER_SIZE; pos_x++ )
{
@ -1391,9 +1369,9 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
// casting's a unary operation anyway, so the othermost set of brackets in the left part
// of the rvalue should not be necessary... but i'm paranoid when it comes to C...
vout[0] += ((float)((byte *)&fin[img_y * image.width + img_x])[0]) * FILTER[filter][pos_x][pos_y];
vout[1] += ((float)((byte *)&fin[img_y * image.width + img_x])[1]) * FILTER[filter][pos_x][pos_y];
vout[2] += ((float)((byte *)&fin[img_y * image.width + img_x])[2]) * FILTER[filter][pos_x][pos_y];
vout[0] += ((float)((byte *)&fin[img_y * image.width + img_x])[0]) * img_emboss[pos_x][pos_y];
vout[1] += ((float)((byte *)&fin[img_y * image.width + img_x])[1]) * img_emboss[pos_x][pos_y];
vout[2] += ((float)((byte *)&fin[img_y * image.width + img_x])[2]) * img_emboss[pos_x][pos_y];
}
}
@ -1401,20 +1379,17 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
for( i = 0; i < 3; i++ )
{
vout[i] *= factor;
vout[i] += bias;
vout[i] += 128.0f; // base
vout[i] = bound( 0.0f, vout[i], 255.0f );
}
if( flags & FILTER_GRAYSCALE )
{
// NTSC greyscale conversion standard
float avg = (vout[0] * 30.0f + vout[1] * 59.0f + vout[2] * 11.0f) / 100.0f;
// NTSC greyscale conversion standard
avg = (vout[0] * 30.0f + vout[1] * 59.0f + vout[2] * 11.0f) / 100.0f;
// divide by 255 so GL operations work as expected
vout[0] = avg / 255.0f;
vout[1] = avg / 255.0f;
vout[2] = avg / 255.0f;
}
// divide by 255 so GL operations work as expected
vout[0] = avg / 255.0f;
vout[1] = avg / 255.0f;
vout[2] = avg / 255.0f;
// write to temp - first, write data in (to get the alpha channel quickly and
// easily, which will be left well alone by this particular operation...!)
@ -1429,29 +1404,9 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
float src = ((float)((byte *)&fin[y * image.width + x])[i]) / 255.0f;
float tmp;
switch( blendFunc )
{
case GL_ADD:
tmp = vout[i] + src;
break;
case GL_BLEND:
// default is FUNC_ADD here
// CsS + CdD works out as Src * Dst * 2
tmp = vout[i] * src * 2.0f;
break;
case GL_DECAL:
// same as GL_REPLACE unless there's alpha, which we ignore for this
case GL_REPLACE:
tmp = vout[i];
break;
case GL_ADD_SIGNED:
tmp = (vout[i] + src) - 0.5f;
break;
case GL_MODULATE:
default: // same as default
tmp = vout[i] * src;
break;
}
// default is GL_BLEND here
// CsS + CdD works out as Src * Dst * 2
tmp = vout[i] * src * 2.0f;
// multiply back by 255 to get the proper byte scale
tmp *= 255.0f;
@ -1466,11 +1421,9 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
// copy result back
memcpy( fin, fout, size );
return true;
}
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgfilter_t *filter )
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, float bumpscale )
{
rgbdata_t *pic = *pix;
qboolean result = true;
@ -1483,7 +1436,7 @@ qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgf
return false;
}
if( !flags && !filter )
if( !flags )
{
// clear any force flags
image.force_flags = 0;
@ -1497,7 +1450,7 @@ qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgf
ClearBits( pic->flags, IMAGE_HAS_LUMA );
}
if( flags & IMAGE_REMAP )
if( FBitSet( flags, IMAGE_REMAP ))
{
// NOTE: user should keep copy of indexed image manually for new changes
if( Image_RemapInternal( pic, width, height ))
@ -1505,10 +1458,14 @@ qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgf
}
// update format to RGBA if any
if( flags & IMAGE_FORCE_RGBA ) pic = Image_DecompressInternal( pic );
if( flags & IMAGE_LIGHTGAMMA ) pic = Image_LightGamma( pic );
if( FBitSet( flags, IMAGE_FORCE_RGBA ))
pic = Image_DecompressInternal( pic );
if( filter ) Image_ApplyFilter( pic, filter->filter, filter->factor, filter->bias, filter->flags, filter->blendFunc );
if( FBitSet( flags, IMAGE_LIGHTGAMMA ))
pic = Image_LightGamma( pic );
if( FBitSet( flags, IMAGE_EMBOSS ))
Image_ApplyFilter( pic, bumpscale );
out = Image_FlipInternal( pic->buffer, &pic->width, &pic->height, pic->type, flags );
if( pic->buffer != out ) memcpy( pic->buffer, image.tempbuffer, pic->size );

View File

@ -31,7 +31,7 @@ qboolean Image_LoadPAL( const char *name, const byte *buffer, size_t filesize )
if( filesize != 768 )
{
MsgDev( D_ERROR, "Image_LoadPAL: (%s) have invalid size (%d should be %d)\n", name, filesize, 768 );
Con_DPrintf( S_ERROR "Image_LoadPAL: (%s) have invalid size (%d should be %d)\n", name, filesize, 768 );
return false;
}
@ -82,7 +82,7 @@ qboolean Image_LoadFNT( const char *name, const byte *buffer, size_t filesize )
int numcolors;
if( image.hint == IL_HINT_Q1 )
return false; // Quake1 doesn't have qfonts
return false; // Quake1 doesn't have qfonts
if( filesize < sizeof( font ))
return false;
@ -120,8 +120,6 @@ qboolean Image_LoadFNT( const char *name, const byte *buffer, size_t filesize )
}
else
{
if( image.hint == IL_HINT_NO )
MsgDev( D_ERROR, "Image_LoadFNT: (%s) have invalid palette size %d\n", name, numcolors );
return false;
}
@ -151,7 +149,8 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize )
pixels = image.width * image.height;
fin = (byte *)pin->index; // setup buffer
if( !Image_ValidSize( name )) return false;
if( !Image_ValidSize( name ))
return false;
if( image.hint == IL_HINT_HL )
{
@ -169,8 +168,6 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize )
}
else
{
if( image.hint == IL_HINT_NO )
MsgDev( D_ERROR, "Image_LoadMDL: lump (%s) is corrupted\n", name );
return false; // unknown or unsupported mode rejected
}
@ -193,10 +190,7 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, size_t filesize )
if( image.hint == IL_HINT_HL )
{
if( !image.d_currentpal )
{
MsgDev( D_ERROR, "Image_LoadSPR: (%s) palette not installed\n", name );
return false;
}
}
else if( image.hint == IL_HINT_Q1 )
{
@ -213,10 +207,7 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, size_t filesize )
image.height = pin->height;
if( filesize < image.width * image.height )
{
MsgDev( D_ERROR, "Image_LoadSPR: file (%s) have invalid size\n", name );
return false;
}
if( filesize == ( image.width * image.height * 4 ))
truecolor = true;
@ -263,10 +254,7 @@ qboolean Image_LoadLMP( const char *name, const byte *buffer, size_t filesize )
int i, pixels;
if( filesize < sizeof( lmp ))
{
MsgDev( D_ERROR, "Image_LoadLMP: file (%s) have invalid size\n", name );
return false;
}
// valve software trick (particle palette)
if( Q_stristr( name, "palette.lmp" ))
@ -296,10 +284,7 @@ qboolean Image_LoadLMP( const char *name, const byte *buffer, size_t filesize )
pixels = image.width * image.height;
if( filesize < sizeof( lmp ) + pixels )
{
MsgDev( D_ERROR, "Image_LoadLMP: file (%s) have invalid size %d\n", name, filesize );
return false;
}
if( !Image_ValidSize( name ))
return false;
@ -352,10 +337,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
int reflectivity[3] = { 0, 0, 0 };
if( filesize < sizeof( mip ))
{
MsgDev( D_ERROR, "Image_LoadMIP: file (%s) have invalid size\n", name );
return false;
}
memcpy( &mip, buffer, sizeof( mip ));
image.width = mip.width;
@ -466,8 +448,6 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
}
else
{
if( image.hint == IL_HINT_NO )
MsgDev( D_ERROR, "Image_LoadMIP: lump (%s) is corrupted\n", name );
return false; // unknown or unsupported mode rejected
}

View File

@ -49,6 +49,6 @@ const char *COM_OffsetNameForFunction( void *function )
{
static string sname;
Q_snprintf( sname, MAX_STRING, "ofs:%d", (size_t)((byte*)function - (byte*)svgame.dllFuncs.pfnGameInit) );
MsgDev( D_NOTE, "COM_OffsetNameForFunction %s\n", sname );
Con_Reportf( "COM_OffsetNameForFunction %s\n", sname );
return sname;
}

View File

@ -215,7 +215,7 @@ void NET_SaveMasters( void )
if( !ml.modified )
{
MsgDev( D_NOTE, "Master server list not changed\n" );
Con_Reportf( "Master server list not changed\n" );
return;
}
@ -223,7 +223,7 @@ void NET_SaveMasters( void )
if( !f )
{
MsgDev( D_ERROR, "Couldn't write xashcomm.lst\n" );
Con_Reportf( S_ERROR "Couldn't write xashcomm.lst\n" );
return;
}

View File

@ -1771,7 +1771,6 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
int num, max, altmax;
qboolean custom_palette;
char texname[64];
imgfilter_t *filter;
mip_t *mt;
int i, j;
@ -1823,7 +1822,6 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
// convert to lowercase
Q_strncpy( tx->name, mt->name, sizeof( tx->name ));
Q_strnlwr( tx->name, tx->name, sizeof( tx->name ));
filter = R_FindTexFilter( tx->name ); // grab texture filter
custom_palette = false;
tx->width = mt->width;
@ -1877,7 +1875,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( FS_FileExists( texpath, false ))
{
tx->gl_texturenum = GL_LoadTexture( texpath, NULL, 0, 0, filter );
tx->gl_texturenum = GL_LoadTexture( texpath, NULL, 0, TF_ALLOW_EMBOSS );
bmod->wadlist.wadusage[j]++; // this wad are really used
break;
}
@ -1893,7 +1891,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( custom_palette ) size += sizeof( short ) + 768;
Q_snprintf( texname, sizeof( texname ), "#%s:%s.mip", loadstat.name, mt->name );
tx->gl_texturenum = GL_LoadTexture( texname, (byte *)mt, size, 0, filter );
tx->gl_texturenum = GL_LoadTexture( texname, (byte *)mt, size, TF_ALLOW_EMBOSS );
}
// if texture is completely missed
@ -1916,7 +1914,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
int size = (int)sizeof( mip_t ) + ((mt->width * mt->height * 85)>>6);
if( custom_palette ) size += sizeof( short ) + 768;
tx->fb_texturenum = GL_LoadTexture( texname, (byte *)mt, size, TF_MAKELUMA, NULL );
tx->fb_texturenum = GL_LoadTexture( texname, (byte *)mt, size, TF_MAKELUMA );
}
else
{
@ -1941,7 +1939,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
}
// okay, loading it from wad or hi-res version
tx->fb_texturenum = GL_LoadTexture( texname, src, srcSize, TF_MAKELUMA, NULL );
tx->fb_texturenum = GL_LoadTexture( texname, src, srcSize, TF_MAKELUMA );
if( src ) Mem_Free( src );
}
}

View File

@ -207,6 +207,7 @@ void Mod_Shutdown( void )
==================
Mod_FindName
never return NULL
==================
*/
model_t *Mod_FindName( const char *filename, qboolean trackCRC )
@ -214,9 +215,6 @@ model_t *Mod_FindName( const char *filename, qboolean trackCRC )
char modname[MAX_QPATH];
model_t *mod;
int i;
if( !COM_CheckString( filename ))
return NULL;
Q_strncpy( modname, filename, sizeof( modname ));
@ -399,7 +397,12 @@ Loads in a model for the given name
*/
model_t *Mod_ForName( const char *name, qboolean crash, qboolean trackCRC )
{
model_t *mod = Mod_FindName( name, trackCRC );
model_t *mod;
if( !COM_CheckString( name ))
return NULL;
mod = Mod_FindName( name, trackCRC );
return Mod_LoadModel( mod, crash );
}
@ -624,7 +627,7 @@ model_t *GAME_EXPORT Mod_Handle( int handle )
{
if( handle < 0 || handle >= MAX_MODELS )
{
MsgDev( D_NOTE, "Mod_Handle: bad handle #%i\n", handle );
Con_Reportf( "Mod_Handle: bad handle #%i\n", handle );
return NULL;
}
return &mod_known[handle];

View File

@ -618,7 +618,7 @@ static int NET_StringToSockaddr( const char *s, struct sockaddr *sadr, qboolean
}
else // failed to create thread
{
MsgDev( D_ERROR, "NET_StringToSockaddr: failed to create thread!\n");
Con_Reportf( S_ERROR "NET_StringToSockaddr: failed to create thread!\n");
nsthread.busy = false;
}
}
@ -765,7 +765,7 @@ qboolean NET_CompareAdr( const netadr_t a, const netadr_t b )
return false;
}
MsgDev( D_ERROR, "NET_CompareAdr: bad address type\n" );
Con_DPrintf( S_ERROR "NET_CompareAdr: bad address type\n" );
return false;
}
@ -1230,7 +1230,7 @@ qboolean NET_QueuePacket( netsrc_t sock, netadr_t *from, byte *data, size_t *len
}
else
{
MsgDev( D_REPORT, "NET_QueuePacket: oversize packet from %s\n", NET_AdrToString( *from ));
Con_Reportf( "NET_QueuePacket: oversize packet from %s\n", NET_AdrToString( *from ));
}
}
else
@ -1245,7 +1245,7 @@ qboolean NET_QueuePacket( netsrc_t sock, netadr_t *from, byte *data, size_t *len
case WSAEMSGSIZE:
break;
default: // let's continue even after errors
MsgDev( D_ERROR, "NET_QueuePacket: %s from %s\n", NET_ErrorString(), NET_AdrToString( *from ));
Con_DPrintf( S_ERROR "NET_QueuePacket: %s from %s\n", NET_ErrorString(), NET_AdrToString( *from ));
break;
}
}
@ -1395,11 +1395,11 @@ void NET_SendPacket( netsrc_t sock, size_t length, const void *data, netadr_t to
if( Host_IsDedicated() )
{
MsgDev( D_ERROR, "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to ));
Con_DPrintf( S_ERROR "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to ));
}
else if( err == WSAEADDRNOTAVAIL || err == WSAENOBUFS )
{
MsgDev( D_ERROR, "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to ));
Con_DPrintf( S_ERROR "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to ));
}
else
{
@ -1487,13 +1487,13 @@ static int NET_IPSocket( const char *net_interface, int port, qboolean multicast
{
err = pWSAGetLastError();
if( err != WSAEAFNOSUPPORT )
MsgDev( D_WARN, "NET_UDPSocket: socket = %s\n", NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port: %d socket: %s\n", port, NET_ErrorString( ));
return INVALID_SOCKET;
}
if( NET_IsSocketError( pIoctlSocket( net_socket, FIONBIO, &_true ) ) )
{
MsgDev( D_WARN, "NET_UDPSocket: ioctlsocket FIONBIO = %s\n", NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port: %d ioctl FIONBIO: %s\n", port, NET_ErrorString( ));
pCloseSocket( net_socket );
return INVALID_SOCKET;
}
@ -1501,7 +1501,7 @@ static int NET_IPSocket( const char *net_interface, int port, qboolean multicast
// make it broadcast capable
if( NET_IsSocketError( pSetSockopt( net_socket, SOL_SOCKET, SO_BROADCAST, (char *)&_true, sizeof( _true ) ) ) )
{
MsgDev( D_WARN, "NET_UDPSocket: setsockopt SO_BROADCAST = %s\n", NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port: %d setsockopt SO_BROADCAST: %s\n", port, NET_ErrorString( ));
pCloseSocket( net_socket );
return INVALID_SOCKET;
}
@ -1510,7 +1510,7 @@ static int NET_IPSocket( const char *net_interface, int port, qboolean multicast
{
if( NET_IsSocketError( pSetSockopt( net_socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&optval, sizeof( optval )) ) )
{
MsgDev( D_WARN, "NET_UDPSocket: port: %d setsockopt SO_REUSEADDR: %s\n", port, NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port: %d setsockopt SO_REUSEADDR: %s\n", port, NET_ErrorString( ));
pCloseSocket( net_socket );
return INVALID_SOCKET;
}
@ -1542,7 +1542,7 @@ static int NET_IPSocket( const char *net_interface, int port, qboolean multicast
if( NET_IsSocketError( pBind( net_socket, (void *)&addr, sizeof( addr )) ) )
{
MsgDev( D_WARN, "NET_UDPSocket: port: %d bind: %s\n", port, NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port: %d bind: %s\n", port, NET_ErrorString( ));
pCloseSocket( net_socket );
return INVALID_SOCKET;
}
@ -1551,7 +1551,7 @@ static int NET_IPSocket( const char *net_interface, int port, qboolean multicast
{
optval = 1;
if( NET_IsSocketError( pSetSockopt( net_socket, IPPROTO_IP, IP_MULTICAST_LOOP, (const char *)&optval, sizeof( optval )) ) )
MsgDev( D_WARN, "NET_UDPSocket: port %d setsockopt IP_MULTICAST_LOOP: %s\n", port, NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port %d setsockopt IP_MULTICAST_LOOP: %s\n", port, NET_ErrorString( ));
}
return net_socket;
@ -1632,7 +1632,7 @@ void NET_GetLocalAddress( void )
if( NET_IsSocketError( pGetSockName( net.ip_sockets[NS_SERVER], (struct sockaddr *)&address, &namelen ) ) )
{
// this may happens if multiple clients running on single machine
MsgDev( D_ERROR, "Could not get TCP/IP address. Reason: %s\n", NET_ErrorString( ));
Con_DPrintf( S_ERROR "Could not get TCP/IP address. Reason: %s\n", NET_ErrorString( ));
// net.allow_ip = false;
}
else
@ -1644,7 +1644,7 @@ void NET_GetLocalAddress( void )
}
else
{
MsgDev( D_ERROR, "Could not get TCP/IP address, Invalid hostname: '%s'\n", buff );
Con_DPrintf( S_ERROR "Could not get TCP/IP address, Invalid hostname: '%s'\n", buff );
}
}
else
@ -1802,13 +1802,13 @@ void NET_Init( void )
#ifdef _WIN32
if( !NET_OpenWinSock( )) // loading wsock32.dll
{
MsgDev( D_ERROR, "network failed to load wsock32.dll.\n" );
Con_DPrintf( S_ERROR "network failed to load wsock32.dll.\n" );
return;
}
if( pWSAStartup( MAKEWORD( 1, 1 ), &net.winsockdata ))
{
MsgDev( D_ERROR, "network initialization failed.\n" );
Con_DPrintf( S_ERROR "network initialization failed.\n" );
NET_FreeWinSock();
return;
}
@ -1831,7 +1831,7 @@ void NET_Init( void )
net.sequence_number = 1;
net.initialized = true;
MsgDev( D_REPORT, "Base networking initialized.\n" );
Con_Reportf( "Base networking initialized.\n" );
}

View File

@ -134,10 +134,10 @@ Sequence_WriteDefaults
void Sequence_WriteDefaults( sequenceCommandLine_s *source, sequenceCommandLine_s *destination )
{
if( !destination )
MsgDev( D_ERROR, "Attempt to bake defaults into a non-existant command." );
Con_Reportf( S_ERROR "Attempt to bake defaults into a non-existant command." );
if( !source )
MsgDev( D_ERROR, "Attempt to bake defaults from a non-existant command." );
Con_Reportf( S_ERROR "Attempt to bake defaults from a non-existant command." );
if( source->modifierBitField & SEQUENCE_MODIFIER_EFFECT_BIT )
{
@ -215,10 +215,10 @@ void Sequence_BakeDefaults( sequenceCommandLine_s *destination, sequenceCommandL
char *saveName, *saveMessage;
if( !destination )
MsgDev( D_ERROR, "Attempt to bake defaults into a non-existant command." );
Con_Reportf( S_ERROR "Attempt to bake defaults into a non-existant command." );
if( !source )
MsgDev( D_ERROR, "Attempt to bake defaults from a non-existant command." );
Con_Reportf( S_ERROR "Attempt to bake defaults from a non-existant command." );
saveName= destination->clientMessage.pName;
saveMessage = destination->clientMessage.pMessage;
@ -325,9 +325,9 @@ size_t Sequence_GetNameValueString( char *token, size_t len )
if( !Sequence_IsNameValueChar( *g_scan ) )
{
if( *g_scan == '#' || *g_scan == '$' )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: cannot have more than one '%c' per line; '%c' must be at the beginning of the line ONLY\n", g_lineNum, g_sequenceParseFileName, *g_scan, *g_scan );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: cannot have more than one '%c' per line; '%c' must be at the beginning of the line ONLY\n", g_lineNum, g_sequenceParseFileName, *g_scan, *g_scan );
else
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: expected name/value, found illegal character '%c'\n", g_lineNum, g_sequenceParseFileName, *g_scan );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: expected name/value, found illegal character '%c'\n", g_lineNum, g_sequenceParseFileName, *g_scan );
}
for( p = token; Sequence_IsNameValueChar( *g_scan ) && len; p++, g_scan++, len-- )
@ -373,7 +373,7 @@ void Sequence_ValidateNameValueString( char *token )
for( scan = token; *scan; scan++ )
{
if( !Sequence_IsNameValueChar( *scan ) )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: name/value string \"%s\" had illegal character '%c'\n", g_lineNum, g_sequenceParseFileName, token, *scan );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: name/value string \"%s\" had illegal character '%c'\n", g_lineNum, g_sequenceParseFileName, token, *scan );
}
}
@ -393,7 +393,7 @@ size_t Sequence_GetToken( char *token, size_t size )
}
if( !Sequence_IsSymbol( *g_scan ) )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: expected token, found '%c' instead\n", g_lineNum, g_sequenceParseFileName, *g_scan );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: expected token, found '%c' instead\n", g_lineNum, g_sequenceParseFileName, *g_scan );
token[0] = *g_scan++;
token[1] = 0;
@ -419,12 +419,12 @@ size_t Sequence_GetLine( char *line, int lineMaxLen )
read = Q_strchr( g_scan, '\n' );
if( !read )
MsgDev( D_ERROR, "Syntax Error on line %d of %s.seq: expected sentence definition or '}', found End-Of-File!\n", g_lineNum, g_sequenceParseFileName );
Con_Reportf( S_ERROR "Syntax Error on line %d of %s.seq: expected sentence definition or '}', found End-Of-File!\n", g_lineNum, g_sequenceParseFileName );
lineLen = read - g_scan;
if( lineLen >= lineMaxLen )
MsgDev( D_ERROR, "Syntax Error on line %d of %s.seq: line was too long (was %d chars; max is %d chars)\n", g_lineNum, g_sequenceParseFileName, lineLen, lineMaxLen - 1 );
Con_Reportf( S_ERROR "Syntax Error on line %d of %s.seq: line was too long (was %d chars; max is %d chars)\n", g_lineNum, g_sequenceParseFileName, lineLen, lineMaxLen - 1 );
Q_strncpy( write, g_scan, lineLen );
write[lineLen] = 0;
@ -560,7 +560,7 @@ void Sequence_ReadQuotedString( char **dest, char *str, size_t len )
ch = Sequence_GetSymbol( );
if( ch != '\"' )
MsgDev( D_ERROR, "Parsing error on or before line %d of %s.seq: expected quote (\"), found '%c' instead\n", g_lineNum, g_sequenceParseFileName, ch );
Con_Reportf( S_ERROR "Parsing error on or before line %d of %s.seq: expected quote (\"), found '%c' instead\n", g_lineNum, g_sequenceParseFileName, ch );
for( write = str; *g_scan && len; write++, g_scan++, len-- )
{
@ -609,7 +609,7 @@ qboolean Sequence_IsCommandAModifier( sequenceCommandEnum_e commandEnum )
return ( g_sequenceCommandMappingTable[i].commandType == SEQUENCE_TYPE_MODIFIER );
}
MsgDev( D_ERROR, "Internal error caused by line %d of %s.seq: unknown command enum = %d\n", g_lineNum, g_sequenceParseFileName, commandEnum );
Con_Reportf( S_ERROR "Internal error caused by line %d of %s.seq: unknown command enum = %d\n", g_lineNum, g_sequenceParseFileName, commandEnum );
return false;
}
@ -712,7 +712,7 @@ void Sequence_ReadCommandData( sequenceCommandEnum_e commandEnum, sequenceComman
break;
default:
MsgDev( D_ERROR, "Internal error caused by line %d of %s.seq: unknown command enum = %d\n", g_lineNum, g_sequenceParseFileName, commandEnum );
Con_Reportf( S_ERROR "Internal error caused by line %d of %s.seq: unknown command enum = %d\n", g_lineNum, g_sequenceParseFileName, commandEnum );
}
}
@ -732,20 +732,20 @@ char Sequence_ParseModifier( sequenceCommandLine_s *defaults )
modifierEnum = Sequence_GetCommandEnumForName( modifierName, SEQUENCE_TYPE_MODIFIER );
if( modifierEnum == SEQUENCE_COMMAND_ERROR )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: unknown modifier \"%s\"\n", g_lineNum, g_sequenceParseFileName, modifierName );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: unknown modifier \"%s\"\n", g_lineNum, g_sequenceParseFileName, modifierName );
if( !Sequence_IsCommandAModifier( modifierEnum ) )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: \"%s\" is a #command, not a $modifier\n", g_lineNum, g_sequenceParseFileName, modifierName );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: \"%s\" is a #command, not a $modifier\n", g_lineNum, g_sequenceParseFileName, modifierName );
delimiter = Sequence_GetSymbol( );
if( delimiter != '=' )
MsgDev( D_ERROR, "Parsing error on or after line %d of %s.seq: after modifier \"%s\", expected '=', found '%c'\n", g_lineNum, g_sequenceParseFileName, modifierName, delimiter );
Con_Reportf( S_ERROR "Parsing error on or after line %d of %s.seq: after modifier \"%s\", expected '=', found '%c'\n", g_lineNum, g_sequenceParseFileName, modifierName, delimiter );
Sequence_ReadCommandData( modifierEnum, defaults );
if( !Sequence_ConfirmCarriageReturnOrSymbol( ',' ) )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: after value(s) for modifier \"%s\", expected ',' or End-Of-Line; found '%c'\n", g_lineNum, g_sequenceParseFileName, modifierName, *g_scan );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: after value(s) for modifier \"%s\", expected ',' or End-Of-Line; found '%c'\n", g_lineNum, g_sequenceParseFileName, modifierName, *g_scan );
return Sequence_GetSymbol( );
}
@ -818,7 +818,7 @@ char Sequence_ParseCommand( sequenceCommandLine_s *newCommandLine )
commandEnum = Sequence_GetCommandEnumForName( commandName, SEQUENCE_TYPE_COMMAND );
if( commandEnum == SEQUENCE_COMMAND_ERROR )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: unknown command \"%s\"\n", g_lineNum, g_sequenceParseFileName, commandName );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: unknown command \"%s\"\n", g_lineNum, g_sequenceParseFileName, commandName );
if( Sequence_IsCommandAModifier( commandEnum ) )
{
@ -834,7 +834,7 @@ char Sequence_ParseCommand( sequenceCommandLine_s *newCommandLine )
ch = Sequence_GetSymbol( );
if( ch != '=' )
MsgDev( D_ERROR, "Parsing error on or before line %d of %s.seq: after command \"%s\", expected '=', found '%c'\n",
Con_Reportf( S_ERROR "Parsing error on or before line %d of %s.seq: after command \"%s\", expected '=', found '%c'\n",
g_lineNum, g_sequenceParseFileName, commandName, ch );
Sequence_ReadCommandData( commandEnum, newCommandLine );
@ -921,7 +921,7 @@ char Sequence_ParseLine( char start, sequenceEntry_s *entry )
break;
default:
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: line must begin with either '#' (command) or '$' (modifier); found '%c'\n", g_lineNum, g_sequenceParseFileName, start );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: line must begin with either '#' (command) or '$' (modifier); found '%c'\n", g_lineNum, g_sequenceParseFileName, start );
}
return end;
@ -1036,7 +1036,7 @@ char Sequence_ParseEntry( void )
symbol = Sequence_GetSymbol( );
if( symbol != '{' )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: expected '{' to start a\n new entry block; found '%c' instead!", g_lineNum, g_sequenceParseFileName, symbol );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: expected '{' to start a\n new entry block; found '%c' instead!", g_lineNum, g_sequenceParseFileName, symbol );
entry = Z_Malloc( sizeof( sequenceEntry_s ) );
Sequence_ResetDefaults( &g_blockScopeDefaults, &g_fileScopeDefaults );
@ -1054,7 +1054,7 @@ char Sequence_ParseEntry( void )
}
if( !Sequence_IsEntrySafe( entry ) )
MsgDev( D_ERROR, "Logic error in file %s.seq before line %d: execution of entry \"%%%s\" would cause an infinite loop!", g_sequenceParseFileName, g_lineNum, entry->entryName );
Con_Reportf( S_ERROR "Logic error in file %s.seq before line %d: execution of entry \"%%%s\" would cause an infinite loop!", g_sequenceParseFileName, g_lineNum, entry->entryName );
entry->nextEntry = g_sequenceList;
g_sequenceList = entry;
@ -1193,7 +1193,7 @@ void Sequence_AddSentenceToGroup( char *groupName, char *data )
group = Sequence_AddSentenceGroup( groupName );
if( !group )
MsgDev( D_ERROR, "Unable to allocate sentence group %s at line %d in file %s.seq", groupName, g_lineNum, g_sequenceParseFileName );
Con_Reportf( S_ERROR "Unable to allocate sentence group %s at line %d in file %s.seq", groupName, g_lineNum, g_sequenceParseFileName );
}
entry = Z_Malloc( sizeof( sentenceEntry_s ) );
@ -1270,7 +1270,7 @@ char Sequence_ParseSentenceBlock( void )
qboolean end = false;
char ch = Sequence_GetSymbol( );
if( ch != '{' )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: expected '{' to start a\n new sentence block; found '%c' instead!", g_lineNum, g_sequenceParseFileName, ch );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: expected '{' to start a\n new sentence block; found '%c' instead!", g_lineNum, g_sequenceParseFileName, ch );
while( !end )
{
@ -1293,7 +1293,7 @@ char Sequence_ParseGlobalDataBlock( void )
Sequence_GetNameValueString( token, MAX_STRING );
if( Q_stricmp( token, "Sentences" ) )
MsgDev( D_ERROR, "Syntax error in file %s.seq on line %d: found global data block symbol '!' with unknown data type \"%s\"", g_sequenceParseFileName, g_lineNum, token );
Con_Reportf( S_ERROR "Syntax error in file %s.seq on line %d: found global data block symbol '!' with unknown data type \"%s\"", g_sequenceParseFileName, g_lineNum, token );
return Sequence_ParseSentenceBlock( );
}
@ -1401,12 +1401,12 @@ qboolean Sequence_ExpandGosubsForEntry( sequenceEntry_s *entry )
continue;
if( !Q_stricmp( cmd->clientMessage.pName, entry->entryName ) )
MsgDev( D_ERROR, "Error in %s.seq: entry \"%s\" gosubs itself!\n", entry->fileName, entry->entryName );
Con_Reportf( S_ERROR "Error in %s.seq: entry \"%s\" gosubs itself!\n", entry->fileName, entry->entryName );
gosubEntry = Sequence_GetEntryForName( cmd->clientMessage.pName );
if( !gosubEntry )
MsgDev( D_ERROR, "Error in %s.seq: Gosub in entry \"%s\" specified unknown entry \"%s\"\n", entry->fileName, entry->entryName, cmd->clientMessage.pName );
Con_Reportf( S_ERROR "Error in %s.seq: Gosub in entry \"%s\" specified unknown entry \"%s\"\n", entry->fileName, entry->entryName, cmd->clientMessage.pName );
foundGosubs = true;
copyList = Sequence_CopyCommandList( gosubEntry->firstCommand );
@ -1537,7 +1537,7 @@ void Sequence_ParseBuffer( byte *buffer, int bufferSize )
break;
default:
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: At file scope, lines must begin with '$' (modifier) or '%%' (entry block) or '!' (sentence / global data block); found '%c'\n", g_lineNum, g_sequenceParseFileName, symbol );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: At file scope, lines must begin with '$' (modifier) or '%%' (entry block) or '!' (sentence / global data block); found '%c'\n", g_lineNum, g_sequenceParseFileName, symbol );
}
}

View File

@ -118,7 +118,7 @@ load_internal:
}
if( filename[0] != '#' )
Con_Reportf( S_WARN "FS_LoadSound: couldn't load \"%s\"\n", loadname );
Con_DPrintf( S_WARN "FS_LoadSound: couldn't load \"%s\"\n", loadname );
return NULL;
}

View File

@ -71,16 +71,16 @@ qboolean Sound_LoadMPG( const char *name, const byte *buffer, size_t filesize )
return false;
#ifdef _DEBUG
if( ret ) MsgDev( D_ERROR, "%s\n", get_error( mpeg ));
if( ret ) Con_DPrintf( S_ERROR "%s\n", get_error( mpeg ));
#endif
// trying to read header
if( !feed_mpeg_header( mpeg, buffer, FRAME_SIZE, filesize, &sc ))
{
#ifdef _DEBUG
MsgDev( D_ERROR, "Sound_LoadMPG: failed to load (%s): %s\n", name, get_error( mpeg ));
Con_DPrintf( S_ERROR "Sound_LoadMPG: failed to load (%s): %s\n", name, get_error( mpeg ));
#else
MsgDev( D_ERROR, "Sound_LoadMPG: (%s) is probably corrupted\n", name );
Con_DPrintf( S_ERROR "Sound_LoadMPG: (%s) is probably corrupted\n", name );
#endif
close_decoder( mpeg );
return false;
@ -97,7 +97,7 @@ qboolean Sound_LoadMPG( const char *name, const byte *buffer, size_t filesize )
if( !sound.size )
{
// bad mpeg file ?
MsgDev( D_ERROR, "Sound_LoadMPG: (%s) is probably corrupted\n", name );
Con_DPrintf( S_ERROR "Sound_LoadMPG: (%s) is probably corrupted\n", name );
close_decoder( mpeg );
return false;
}
@ -164,22 +164,22 @@ stream_t *Stream_OpenMPG( const char *filename )
// couldn't create decoder
if(( mpeg = create_decoder( &ret )) == NULL )
{
MsgDev( D_ERROR, "Stream_OpenMPG: couldn't create decoder\n" );
Con_DPrintf( S_ERROR "Stream_OpenMPG: couldn't create decoder\n" );
Mem_Free( stream );
FS_Close( file );
return NULL;
}
#ifdef _DEBUG
if( ret ) MsgDev( D_ERROR, "%s\n", get_error( mpeg ));
if( ret ) Con_DPrintf( S_ERROR "%s\n", get_error( mpeg ));
#endif
// trying to open stream and read header
if( !open_mpeg_stream( mpeg, file, FS_Read, FS_Seek, &sc ))
{
#ifdef _DEBUG
MsgDev( D_ERROR, "Stream_OpenMPG: failed to load (%s): %s\n", filename, get_error( mpeg ));
Con_DPrintf( S_ERROR "Stream_OpenMPG: failed to load (%s): %s\n", filename, get_error( mpeg ));
#else
MsgDev( D_ERROR, "Stream_OpenMPG: (%s) is probably corrupted\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenMPG: (%s) is probably corrupted\n", filename );
#endif
close_decoder( mpeg );
Mem_Free( stream );

View File

@ -155,7 +155,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
if( !( iff_dataPtr && !Q_strncmp( iff_dataPtr + 8, "WAVE", 4 )))
{
MsgDev( D_ERROR, "Sound_LoadWAV: %s missing 'RIFF/WAVE' chunks\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: %s missing 'RIFF/WAVE' chunks\n", name );
return false;
}
@ -165,7 +165,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
if( !iff_dataPtr )
{
MsgDev( D_ERROR, "Sound_LoadWAV: %s missing 'fmt ' chunk\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: %s missing 'fmt ' chunk\n", name );
return false;
}
@ -176,7 +176,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
{
if( fmt != 85 )
{
MsgDev( D_ERROR, "Sound_LoadWAV: %s not a microsoft PCM format\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: %s not a microsoft PCM format\n", name );
return false;
}
else
@ -189,7 +189,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
sound.channels = GetLittleShort();
if( sound.channels != 1 && sound.channels != 2 )
{
MsgDev( D_ERROR, "Sound_LoadWAV: only mono and stereo WAV files supported (%s)\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: only mono and stereo WAV files supported (%s)\n", name );
return false;
}
@ -201,7 +201,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
if( sound.width != 1 && sound.width != 2 )
{
MsgDev( D_WARN, "Sound_LoadWAV: only 8 and 16 bit WAV files supported (%s)\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: only 8 and 16 bit WAV files supported (%s)\n", name );
return false;
}
@ -235,7 +235,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
if( !iff_dataPtr )
{
MsgDev( D_WARN, "Sound_LoadWAV: %s missing 'data' chunk\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: %s missing 'data' chunk\n", name );
return false;
}
@ -246,7 +246,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
{
if( samples < sound.samples )
{
MsgDev( D_ERROR, "Sound_LoadWAV: %s has a bad loop length\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: %s has a bad loop length\n", name );
return false;
}
}
@ -254,7 +254,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
if( sound.samples <= 0 )
{
MsgDev( D_ERROR, "Sound_LoadWAV: file with %i samples (%s)\n", sound.samples, name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: file with %i samples (%s)\n", sound.samples, name );
return false;
}
@ -326,7 +326,7 @@ stream_t *Stream_OpenWAV( const char *filename )
// find "RIFF" chunk
if( !StreamFindNextChunk( file, "RIFF", &last_chunk ))
{
MsgDev( D_ERROR, "Stream_OpenWAV: %s missing RIFF chunk\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing RIFF chunk\n", filename );
FS_Close( file );
return NULL;
}
@ -334,7 +334,7 @@ stream_t *Stream_OpenWAV( const char *filename )
FS_Read( file, chunkName, 4 );
if( !Q_strncmp( chunkName, "WAVE", 4 ))
{
MsgDev( D_ERROR, "Stream_OpenWAV: %s missing WAVE chunk\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing WAVE chunk\n", filename );
FS_Close( file );
return NULL;
}
@ -344,7 +344,7 @@ stream_t *Stream_OpenWAV( const char *filename )
last_chunk = iff_data;
if( !StreamFindNextChunk( file, "fmt ", &last_chunk ))
{
MsgDev( D_ERROR, "Stream_OpenWAV: %s missing 'fmt ' chunk\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing 'fmt ' chunk\n", filename );
FS_Close( file );
return NULL;
}
@ -354,7 +354,7 @@ stream_t *Stream_OpenWAV( const char *filename )
FS_Read( file, &t, sizeof( t ));
if( t != 1 )
{
MsgDev( D_ERROR, "Stream_OpenWAV: %s not a microsoft PCM format\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenWAV: %s not a microsoft PCM format\n", filename );
FS_Close( file );
return NULL;
}
@ -375,7 +375,7 @@ stream_t *Stream_OpenWAV( const char *filename )
last_chunk = iff_data;
if( !StreamFindNextChunk( file, "data", &last_chunk ))
{
MsgDev( D_ERROR, "Stream_OpenWAV: %s missing 'data' chunk\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing 'data' chunk\n", filename );
FS_Close( file );
return NULL;
}

View File

@ -77,7 +77,7 @@ char *Sys_Input( void )
void Sys_DestroyConsole( void )
{
// last text message into console or log
MsgDev( D_NOTE, "Sys_DestroyConsole: Exiting!\n" );
Con_Reportf( "Sys_DestroyConsole: Exiting!\n" );
#ifdef _WIN32
Wcon_DestroyConsole();
#endif
@ -113,7 +113,7 @@ void Sys_InitLog( void )
if( s_ld.log_active )
{
s_ld.logfile = fopen( s_ld.log_path, mode );
if( !s_ld.logfile ) MsgDev( D_ERROR, "Sys_InitLog: can't create log file %s\n", s_ld.log_path );
if( !s_ld.logfile ) Con_Reportf( S_ERROR "Sys_InitLog: can't create log file %s\n", s_ld.log_path );
fprintf( s_ld.logfile, "=================================================================================\n" );
fprintf( s_ld.logfile, "\t%s (build %i) started at %s\n", s_ld.title, Q_buildnum(), Q_timestamp( TIME_FULL ));

View File

@ -302,7 +302,7 @@ void Sys_ShellExecute( const char *path, const char *parms, int shouldExit )
_exit( 1 );
}
}
else MsgDev( D_WARN, "Could not find "OPEN_COMMAND" utility\n" );
else Con_Reportf( S_WARN "Could not find "OPEN_COMMAND" utility\n" );
#elif defined(__ANDROID__) && !defined(XASH_DEDICATED)
Android_ShellExecute( path, parms );
#endif
@ -450,7 +450,7 @@ qboolean Sys_LoadLibrary( dll_info_t *dll )
if( !dll->name || !*dll->name )
return false; // nothing to load
MsgDev( D_NOTE, "Sys_LoadLibrary: Loading %s", dll->name );
Con_Reportf( "Sys_LoadLibrary: Loading %s", dll->name );
if( dll->fcts )
{
@ -477,14 +477,14 @@ qboolean Sys_LoadLibrary( dll_info_t *dll )
goto error;
}
}
MsgDev( D_NOTE, " - ok\n" );
Con_Reportf( " - ok\n" );
return true;
error:
MsgDev( D_NOTE, " - failed\n" );
Con_Reportf( " - failed\n" );
Sys_FreeLibrary( dll ); // trying to free
if( dll->crash ) Sys_Error( "%s", errorstring );
else MsgDev( D_ERROR, "%s", errorstring );
else Con_Reportf( S_ERROR "%s", errorstring );
return false;
}
@ -506,10 +506,10 @@ qboolean Sys_FreeLibrary( dll_info_t *dll )
if( host.status == HOST_CRASHED )
{
// we need to hold down all modules, while MSVC can find error
MsgDev( D_NOTE, "Sys_FreeLibrary: hold %s for debugging\n", dll->name );
Con_Reportf( "Sys_FreeLibrary: hold %s for debugging\n", dll->name );
return false;
}
else MsgDev( D_NOTE, "Sys_FreeLibrary: Unloading %s\n", dll->name );
else Con_Reportf( "Sys_FreeLibrary: Unloading %s\n", dll->name );
FreeLibrary( dll->link );
dll->link = NULL;

View File

@ -129,7 +129,6 @@ char *Wcon_Input( void );
// text messages
#define Msg Con_Printf
void MsgDev( int level, const char *pMsg, ... ) _format( 2 );
#ifdef __cplusplus
}

View File

@ -23,6 +23,7 @@
#define K_ENTER 13
#define K_ESCAPE 27
#define K_SPACE 32
#define K_SCROLLOCK 70
// normal keys should be passed as lowercased ascii

View File

@ -20,9 +20,9 @@ GNU General Public License for more details.
#include "library.h"
#include "filesystem.h"
#include "server.h"
#include "platform/android/android_lib.h"
#include "platform/emscripten/em_lib.h"
#include "platform/apple/ios_lib.h"
#include "platform/android/lib_android.h"
#include "platform/emscripten/lib_em.h"
#include "platform/apple/lib_ios.h"
#ifdef XASH_NO_LIBDL
#ifndef XASH_DLL_LOADER

View File

@ -69,7 +69,7 @@ qboolean SNDDMA_Init( void *hInst )
if( SDL_Init( SDL_INIT_AUDIO ) )
{
MsgDev( D_ERROR, "Audio: SDL: %s \n", SDL_GetError( ) );
Con_Reportf( S_ERROR "Audio: SDL: %s \n", SDL_GetError( ) );
return false;
}

View File

@ -297,21 +297,21 @@ static void WIN_SetDPIAwareness( void )
if( hResult == S_OK )
{
MsgDev( D_NOTE, "SetDPIAwareness: Success\n" );
Con_Reportf( "SetDPIAwareness: Success\n" );
bSuccess = TRUE;
}
else if( hResult == E_INVALIDARG ) MsgDev( D_NOTE, "SetDPIAwareness: Invalid argument\n" );
else if( hResult == E_ACCESSDENIED ) MsgDev( D_NOTE, "SetDPIAwareness: Access Denied\n" );
else if( hResult == E_INVALIDARG ) Con_Reportf( "SetDPIAwareness: Invalid argument\n" );
else if( hResult == E_ACCESSDENIED ) Con_Reportf( "SetDPIAwareness: Access Denied\n" );
}
else MsgDev( D_NOTE, "SetDPIAwareness: Can't get SetProcessDpiAwareness\n" );
else Con_Reportf( "SetDPIAwareness: Can't get SetProcessDpiAwareness\n" );
FreeLibrary( hModule );
}
else MsgDev( D_NOTE, "SetDPIAwareness: Can't load shcore.dll\n" );
else Con_Reportf( "SetDPIAwareness: Can't load shcore.dll\n" );
if( !bSuccess )
{
MsgDev( D_NOTE, "SetDPIAwareness: Trying SetProcessDPIAware...\n" );
Con_Reportf( "SetDPIAwareness: Trying SetProcessDPIAware...\n" );
if( ( hModule = LoadLibrary( "user32.dll" ) ) )
{
@ -322,15 +322,15 @@ static void WIN_SetDPIAwareness( void )
if( hResult )
{
MsgDev( D_NOTE, "SetDPIAwareness: Success\n" );
Con_Reportf( "SetDPIAwareness: Success\n" );
bSuccess = TRUE;
}
else MsgDev( D_NOTE, "SetDPIAwareness: fail\n" );
else Con_Reportf( "SetDPIAwareness: fail\n" );
}
else MsgDev( D_NOTE, "SetDPIAwareness: Can't get SetProcessDPIAware\n" );
else Con_Reportf( "SetDPIAwareness: Can't get SetProcessDPIAware\n" );
FreeLibrary( hModule );
}
else MsgDev( D_NOTE, "SetDPIAwareness: Can't load user32.dll\n" );
else Con_Reportf( "SetDPIAwareness: Can't load user32.dll\n" );
}
}
#endif
@ -384,7 +384,7 @@ void *GL_GetProcAddress( const char *name )
if( !func )
{
MsgDev( D_ERROR, "Error: GL_GetProcAddress failed for %s\n", name );
Con_Reportf( S_ERROR "Error: GL_GetProcAddress failed for %s\n", name );
}
return func;
@ -401,7 +401,7 @@ void GL_UpdateSwapInterval( void )
if( cls.state < ca_active )
{
if( SDL_GL_SetSwapInterval( gl_vsync->value ) )
MsgDev( D_ERROR, "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ) );
Con_Reportf( S_ERROR "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ) );
SetBits( gl_vsync->flags, FCVAR_CHANGED );
}
else if( FBitSet( gl_vsync->flags, FCVAR_CHANGED ))
@ -409,7 +409,7 @@ void GL_UpdateSwapInterval( void )
ClearBits( gl_vsync->flags, FCVAR_CHANGED );
if( SDL_GL_SetSwapInterval( gl_vsync->value ) )
MsgDev( D_ERROR, "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ) );
Con_Reportf( S_ERROR "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ) );
}
}
@ -584,7 +584,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
if( !host.hWnd )
{
MsgDev( D_ERROR, "VID_CreateWindow: couldn't create '%s': %s\n", wndname, SDL_GetError());
Con_Reportf( S_ERROR "VID_CreateWindow: couldn't create '%s': %s\n", wndname, SDL_GetError());
// remove MSAA, if it present, because
// window creating may fail on GLX visual choose
@ -735,7 +735,7 @@ static void GL_SetupAttributes( void )
#ifndef XASH_GL_STATIC
if( Sys_CheckParm( "-gldebug" ) )
{
MsgDev( D_NOTE, "Creating an extended GL context for debug...\n" );
Con_Reportf( "Creating an extended GL context for debug...\n" );
SetBits( context_flags, FCONTEXT_DEBUG_ARB );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG );
glw_state.extended = true;
@ -861,7 +861,7 @@ qboolean R_Init_Video( void )
if( SDL_GL_LoadLibrary( EGL_LIB ) )
{
MsgDev( D_ERROR, "Couldn't initialize OpenGL: %s\n", SDL_GetError());
Con_Reportf( S_ERROR "Couldn't initialize OpenGL: %s\n", SDL_GetError());
return false;
}
@ -1073,7 +1073,7 @@ void GL_InitExtensionsBigGL()
{
if( host_developer.value )
{
MsgDev( D_NOTE, "Installing GL_DebugOutput...\n");
Con_Reportf( "Installing GL_DebugOutput...\n");
pglDebugMessageCallbackARB( GL_DebugOutput, NULL );
// force everything to happen in the main thread instead of in a separate driver thread
@ -1231,21 +1231,21 @@ qboolean VID_SetMode( void )
if( err == rserr_invalid_fullscreen )
{
Cvar_SetValue( "fullscreen", 0 );
MsgDev( D_ERROR, "VID_SetMode: fullscreen unavailable in this mode\n" );
Con_Reportf( S_ERROR "VID_SetMode: fullscreen unavailable in this mode\n" );
Sys_Warn("fullscreen unavailable in this mode!");
if(( err = R_ChangeDisplaySettings( iScreenWidth, iScreenHeight, false )) == rserr_ok )
return true;
}
else if( err == rserr_invalid_mode )
{
MsgDev( D_ERROR, "VID_SetMode: invalid mode\n" );
Con_Reportf( S_ERROR "VID_SetMode: invalid mode\n" );
Sys_Warn( "invalid mode" );
}
// try setting it back to something safe
if(( err = R_ChangeDisplaySettings( glConfig.prev_width, glConfig.prev_height, false )) != rserr_ok )
{
MsgDev( D_ERROR, "VID_SetMode: could not revert to safe mode\n" );
Con_Reportf( S_ERROR "VID_SetMode: could not revert to safe mode\n" );
Sys_Warn("could not revert to safe mode!");
return false;
}

View File

@ -310,7 +310,7 @@ void Wcon_CreateConsole( void )
if( !RegisterClass( &wc ))
{
// print into log
MsgDev( D_ERROR, "Can't register window class '%s'\n", SYSCONSOLE );
Con_Reportf( S_ERROR "Can't register window class '%s'\n", SYSCONSOLE );
return;
}
@ -327,7 +327,7 @@ void Wcon_CreateConsole( void )
s_wcd.hWnd = CreateWindowEx( WS_EX_DLGMODALFRAME, SYSCONSOLE, s_wcd.title, DEDSTYLE, ( swidth - 600 ) / 2, ( sheight - 450 ) / 2 , rect.right - rect.left + 1, rect.bottom - rect.top + 1, NULL, NULL, host.hInst, NULL );
if( s_wcd.hWnd == NULL )
{
MsgDev( D_ERROR, "Can't create window '%s'\n", s_wcd.title );
Con_Reportf( S_ERROR "Can't create window '%s'\n", s_wcd.title );
return;
}
@ -397,7 +397,7 @@ destroy win32 console
void Wcon_DestroyConsole( void )
{
// last text message into console or log
MsgDev( D_NOTE, "Sys_FreeLibrary: Unloading xash.dll\n" );
Con_Reportf( "Sys_FreeLibrary: Unloading xash.dll\n" );
Sys_CloseLog();

View File

@ -582,7 +582,8 @@ void SV_PlaybackEventFull( int flags, const edict_t *pInvoker, word eventindex,
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
void SV_PlaybackReliableEvent( sizebuf_t *msg, word eventindex, float delay, event_args_t *args );
int SV_BuildSoundMsg( sizebuf_t *msg, edict_t *ent, int chan, const char *sample, int vol, float attn, int flags, int pitch, const vec3_t pos );
int SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax );
qboolean SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax );
void SV_QueueChangeLevel( const char *level, const char *landname );
void SV_WriteEntityPatch( const char *filename );
float SV_AngleMod( float ideal, float current, float speed );
void SV_SpawnEntities( const char *mapname );

View File

@ -1228,13 +1228,13 @@ void SV_PutClientInServer( sv_client_t *cl )
SetBits( ent->v.flags, FL_GODMODE|FL_NOTARGET );
cl->pViewEntity = NULL; // reset pViewEntity
}
if( svgame.globals->cdAudioTrack )
{
MSG_BeginServerCmd( &msg, svc_stufftext );
MSG_WriteString( &msg, va( "cd loop %3d\n", svgame.globals->cdAudioTrack ));
svgame.globals->cdAudioTrack = 0;
}
if( svgame.globals->cdAudioTrack )
{
MSG_BeginServerCmd( &msg, svc_stufftext );
MSG_WriteString( &msg, va( "cd loop %3d\n", svgame.globals->cdAudioTrack ));
svgame.globals->cdAudioTrack = 0;
}
#ifdef HACKS_RELATED_HLMODS
@ -1727,6 +1727,9 @@ static qboolean SV_Godmode_f( sv_client_t *cl )
return true;
pEntity->v.flags = pEntity->v.flags ^ FL_GODMODE;
if( pEntity->v.takedamage == DAMAGE_AIM )
pEntity->v.takedamage = DAMAGE_NO;
else pEntity->v.takedamage = DAMAGE_AIM;
if( !FBitSet( pEntity->v.flags, FL_GODMODE ))
SV_ClientPrintf( cl, "godmode OFF\n" );

View File

@ -440,6 +440,42 @@ void SV_Reload_f( void )
COM_LoadLevel( sv_hostmap->string, false );
}
/*
==================
SV_ChangeLevel_f
classic change level
==================
*/
void SV_ChangeLevel_f( void )
{
if( Cmd_Argc() != 2 )
{
Con_Printf( S_USAGE "changelevel <mapname>\n" );
return;
}
SV_QueueChangeLevel( Cmd_Argv( 1 ), NULL );
}
/*
==================
SV_ChangeLevel2_f
smooth change level
==================
*/
void SV_ChangeLevel2_f( void )
{
if( Cmd_Argc() != 3 )
{
Con_Printf( S_USAGE "changelevel2 <mapname> <landmark>\n" );
return;
}
SV_QueueChangeLevel( Cmd_Argv( 1 ), Cmd_Argv( 2 ));
}
/*
==================
SV_Kick_f
@ -802,6 +838,7 @@ void SV_InitHostCommands( void )
Cmd_AddCommand( "load", SV_Load_f, "load a saved game file" );
Cmd_AddCommand( "loadquick", SV_QuickLoad_f, "load a quick-saved game file" );
Cmd_AddCommand( "reload", SV_Reload_f, "continue from latest save or restart level" );
Cmd_AddCommand( "killsave", SV_DeleteSave_f, "delete a saved game file and saveshot" );
}
}
@ -824,13 +861,14 @@ void SV_InitOperatorCommands( void )
Cmd_AddCommand( "edict_usage", SV_EdictUsage_f, "show info about edicts usage" );
Cmd_AddCommand( "entity_info", SV_EntityInfo_f, "show more info about edicts" );
Cmd_AddCommand( "shutdownserver", SV_KillServer_f, "shutdown current server" );
Cmd_AddCommand( "changelevel", SV_ChangeLevel_f, "change level" );
Cmd_AddCommand( "changelevel2", SV_ChangeLevel2_f, "smooth change level" );
if( host.type == HOST_NORMAL )
{
Cmd_AddCommand( "save", SV_Save_f, "save the game to a file" );
Cmd_AddCommand( "savequick", SV_QuickSave_f, "save the game to the quicksave" );
Cmd_AddCommand( "autosave", SV_AutoSave_f, "save the game to 'autosave' file" );
Cmd_AddCommand( "killsave", SV_DeleteSave_f, "delete a saved game file and saveshot" );
}
else if( host.type == HOST_DEDICATED )
{
@ -857,12 +895,13 @@ void SV_KillOperatorCommands( void )
Cmd_RemoveCommand( "edict_usage" );
Cmd_RemoveCommand( "entity_info" );
Cmd_RemoveCommand( "shutdownserver" );
Cmd_RemoveCommand( "changelevel" );
Cmd_RemoveCommand( "changelevel2" );
if( host.type == HOST_NORMAL )
{
Cmd_RemoveCommand( "save" );
Cmd_RemoveCommand( "savequick" );
Cmd_RemoveCommand( "killsave" );
Cmd_RemoveCommand( "autosave" );
}
else if( host.type == HOST_DEDICATED )

View File

@ -653,13 +653,98 @@ SV_BoxInPVS
check brush boxes in fat pvs
==============
*/
int SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax )
qboolean SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax )
{
if( !Mod_BoxVisible( absmin, absmax, Mod_GetPVSForPoint( org )))
return false;
return true;
}
/*
=============
SV_ChangeLevel
Issue changing level
=============
*/
void SV_QueueChangeLevel( const char *level, const char *landname )
{
int flags, smooth = false;
char mapname[MAX_QPATH];
char *spawn_entity;
// hold mapname to other place
Q_strncpy( mapname, level, sizeof( mapname ));
COM_StripExtension( mapname );
if( COM_CheckString( landname ))
smooth = true;
// determine spawn entity classname
if( svs.maxclients == 1 )
spawn_entity = GI->sp_entity;
else spawn_entity = GI->mp_entity;
flags = SV_MapIsValid( mapname, spawn_entity, landname );
if( FBitSet( flags, MAP_INVALID_VERSION ))
{
Con_Printf( S_ERROR "changelevel: %s is invalid or not supported\n", mapname );
return;
}
if( !FBitSet( flags, MAP_IS_EXIST ))
{
Con_Printf( S_ERROR "changelevel: map %s doesn't exist\n", mapname );
return;
}
if( smooth && !FBitSet( flags, MAP_HAS_LANDMARK ))
{
if( sv_validate_changelevel->value )
{
// NOTE: we find valid map but specified landmark it's doesn't exist
// run simple changelevel like in q1, throw warning
Con_Printf( S_WARN "changelevel: %s doesn't contain landmark [%s]. smooth transition was disabled\n", mapname, landname );
smooth = false;
}
}
if( svs.maxclients > 1 )
smooth = false; // multiplayer doesn't support smooth transition
if( smooth && !Q_stricmp( sv.name, level ))
{
Con_Printf( S_ERROR "can't changelevel with same map. Ignored.\n" );
return;
}
if( !smooth && !FBitSet( flags, MAP_HAS_SPAWNPOINT ))
{
if( sv_validate_changelevel->value )
{
Con_Printf( S_ERROR "changelevel: %s doesn't have a valid spawnpoint. Ignored.\n", mapname );
return;
}
}
// bad changelevel position invoke enables in one-way transition
if( sv.framecount < 15 )
{
if( sv_validate_changelevel->value )
{
Con_Printf( S_WARN "an infinite changelevel was detected and will be disabled until a next save\\restore\n" );
return; // lock with svs.spawncount here
}
}
SV_SkipUpdates ();
// changelevel will be executed on a next frame
if( smooth ) COM_ChangeLevel( mapname, landname, sv.background ); // Smoothed Half-Life changelevel
else COM_ChangeLevel( mapname, NULL, sv.background ); // Classic Quake changlevel
}
/*
==============
SV_WriteEntityPatch
@ -1314,11 +1399,8 @@ pfnChangeLevel
*/
void pfnChangeLevel( const char *level, const char *landmark )
{
int flags, smooth = false;
static uint last_spawncount = 0;
char mapname[MAX_QPATH];
char landname[MAX_QPATH];
char *spawn_entity;
char *text;
if( !COM_CheckString( level ) || sv.state != ss_active )
@ -1328,10 +1410,6 @@ void pfnChangeLevel( const char *level, const char *landmark )
if( svs.spawncount == last_spawncount )
return;
last_spawncount = svs.spawncount;
// hold mapname to other place
Q_strncpy( mapname, level, sizeof( mapname ));
COM_StripExtension( mapname );
landname[0] ='\0';
#ifdef HACKS_RELATED_HLMODS
@ -1348,72 +1426,7 @@ void pfnChangeLevel( const char *level, const char *landmark )
#else
Q_strncpy( landname, landmark, sizeof( landname ));
#endif
if( COM_CheckString( landname ))
smooth = true;
// determine spawn entity classname
if( svs.maxclients == 1 )
spawn_entity = GI->sp_entity;
else spawn_entity = GI->mp_entity;
flags = SV_MapIsValid( mapname, spawn_entity, landname );
if( FBitSet( flags, MAP_INVALID_VERSION ))
{
Con_Printf( S_ERROR "changelevel: %s is invalid or not supported\n", mapname );
return;
}
if( !FBitSet( flags, MAP_IS_EXIST ))
{
Con_Printf( S_ERROR "changelevel: map %s doesn't exist\n", mapname );
return;
}
if( smooth && !FBitSet( flags, MAP_HAS_LANDMARK ))
{
if( sv_validate_changelevel->value )
{
// NOTE: we find valid map but specified landmark it's doesn't exist
// run simple changelevel like in q1, throw warning
Con_Printf( S_WARN "changelevel: %s doesn't contain landmark [%s]. smooth transition was disabled\n", mapname, landname );
smooth = false;
}
}
if( svs.maxclients > 1 )
smooth = false; // multiplayer doesn't support smooth transition
if( smooth && !Q_stricmp( sv.name, level ))
{
Con_Printf( S_ERROR "can't changelevel with same map. Ignored.\n" );
return;
}
if( !smooth && !FBitSet( flags, MAP_HAS_SPAWNPOINT ))
{
if( sv_validate_changelevel->value )
{
Con_Printf( S_ERROR "changelevel: %s doesn't have a valid spawnpoint. Ignored.\n", mapname );
return;
}
}
// bad changelevel position invoke enables in one-way transition
if( sv.framecount < 15 )
{
if( sv_validate_changelevel->value )
{
Con_Printf( S_WARN "an infinite changelevel was detected and will be disabled until a next save\\restore\n" );
return; // lock with svs.spawncount here
}
}
SV_SkipUpdates ();
// changelevel will be executed on a next frame
if( smooth ) COM_ChangeLevel( mapname, landname, sv.background ); // Smoothed Half-Life changelevel
else COM_ChangeLevel( mapname, NULL, sv.background ); // Classic Quake changlevel
SV_QueueChangeLevel( level, landname );
}
/*
@ -2024,6 +2037,9 @@ int SV_BuildSoundMsg( sizebuf_t *msg, edict_t *ent, int chan, const char *sample
}
else
{
// TESTTEST
if( *sample == '*' ) chan = CHAN_AUTO;
// precache_sound can be used twice: cache sounds when loading
// and return sound index when server is active
sound_idx = SV_SoundIndex( sample );
@ -2092,7 +2108,7 @@ void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float
msg_dest = MSG_ALL;
else if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
msg_dest = MSG_ALL;
else msg_dest = MSG_PAS_R;
else msg_dest = (svs.maxclients <= 1 ) ? MSG_ALL : MSG_PAS_R;
// always sending stop sound command
if( FBitSet( flags, SND_STOP ))
@ -2113,7 +2129,7 @@ pfnEmitAmbientSound
*/
void pfnEmitAmbientSound( edict_t *ent, float *pos, const char *sample, float vol, float attn, int flags, int pitch )
{
int msg_dest = MSG_PAS_R;
int msg_dest;
if( sv.state == ss_loading )
SetBits( flags, SND_SPAWNING );
@ -4603,8 +4619,11 @@ qboolean SV_ParseEdict( char **pfile, edict_t *ent )
}
// no reason to keep this data
Mem_Free( pkvd[i].szKeyName );
Mem_Free( pkvd[i].szValue );
if( Mem_IsAllocatedExt( host.mempool, pkvd[i].szKeyName ))
Mem_Free( pkvd[i].szKeyName );
if( Mem_IsAllocatedExt( host.mempool, pkvd[i].szValue ))
Mem_Free( pkvd[i].szValue );
}
if( classname )

View File

@ -673,6 +673,7 @@ void SV_ShutdownGame( void )
SV_FinalMessage( "", true );
S_StopBackgroundTrack();
CL_StopPlayback(); // stop demo too
if( GameState->newGame )
{

View File

@ -782,6 +782,7 @@ Does not change the entities velocity at all
trace_t SV_PushEntity( edict_t *ent, const vec3_t lpush, const vec3_t apush, int *blocked, float flDamage )
{
trace_t trace;
qboolean monsterBlock;
qboolean monsterClip;
int type;
vec3_t end;
@ -814,10 +815,14 @@ trace_t SV_PushEntity( edict_t *ent, const vec3_t lpush, const vec3_t apush, int
SV_LinkEdict( ent, true );
if( ent->v.movetype == MOVETYPE_WALK || ent->v.movetype == MOVETYPE_STEP || ent->v.movetype == MOVETYPE_PUSHSTEP )
monsterBlock = true;
else monsterBlock = false;
if( blocked )
{
// more accuracy blocking code
if( flDamage <= 0.0f && FBitSet( host.features, ENGINE_PHYSICS_PUSHER_EXT ))
if( monsterBlock )
*blocked = !VectorCompareEpsilon( ent->v.origin, end, ON_EPSILON ); // can't move full distance
else *blocked = true;
}

View File

@ -347,7 +347,7 @@ static void pfnParticle( const float *origin, int color, float life, int zpos, i
if( !origin )
{
MsgDev( D_ERROR, "SV_StartParticle: NULL origin. Ignored\n" );
Con_Reportf( S_ERROR "SV_StartParticle: NULL origin. Ignored\n" );
return;
}