Merge 4281 update

This commit is contained in:
Alibek Omarov
2018-10-28 00:39:29 +03:00
78 changed files with 1010 additions and 847 deletions
+3 -2
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 );
+7 -2
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 )
+19 -5
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;
+36 -19
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 ();
}
}
+55 -7
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 )
+6 -4
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 );
+16 -29
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;
}
+2 -2
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 );
+1 -1
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 );
+119 -11
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();
}
+2 -2
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;
+10 -10
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 );
}
/*
+21 -10
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();
}
+3 -1
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 );
+2
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 );
+10 -10
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
+15 -31
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;
}
+2 -2
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 );
}
+24 -13
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;
}
}
+5 -5
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;
+4 -14
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,
+2 -115
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
+6 -9
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;
+2 -7
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 )
{
+1 -1
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 ? ", " : ". " );
}
+1 -1
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 );
+2 -2
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;
}
+15 -15
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 )
+10 -5
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 );
}
}
+8 -6
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 )
+84 -10
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;
}
+6
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 );
+5 -5
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;
}
+8 -6
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" );