mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-11 15:47:55 +00:00
engine: fix various compiler warnings
This commit is contained in:
parent
a0cbac4fc7
commit
4beba75159
@ -222,7 +222,7 @@ typedef struct render_api_s
|
||||
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );
|
||||
const struct ref_overview_s *( *GetOverviewParms )( void );
|
||||
const char *( *GetFileByIndex )( int fileindex );
|
||||
int (*pfnSaveFile)( const char *filename, const void *data, long len );
|
||||
int (*pfnSaveFile)( const char *filename, const void *data, int len );
|
||||
void (*R_Reserved0)( void );
|
||||
|
||||
// static allocations
|
||||
|
@ -488,7 +488,8 @@ Optimized version of pointfile - use beams instead of particles
|
||||
*/
|
||||
void CL_ReadLineFile_f( void )
|
||||
{
|
||||
char *afile, *pfile;
|
||||
byte *afile;
|
||||
char *pfile;
|
||||
vec3_t p1, p2;
|
||||
int count, modelIndex;
|
||||
char filename[MAX_QPATH];
|
||||
@ -507,7 +508,7 @@ void CL_ReadLineFile_f( void )
|
||||
Con_Printf( "Reading %s...\n", filename );
|
||||
|
||||
count = 0;
|
||||
pfile = afile;
|
||||
pfile = (char *)afile;
|
||||
model = CL_LoadModel( DEFAULT_LASERBEAM_PATH, &modelIndex );
|
||||
|
||||
while( 1 )
|
||||
@ -1995,7 +1996,8 @@ CL_ReadPointFile_f
|
||||
*/
|
||||
void CL_ReadPointFile_f( void )
|
||||
{
|
||||
char *afile, *pfile;
|
||||
byte *afile;
|
||||
char *pfile;
|
||||
vec3_t org;
|
||||
int count;
|
||||
particle_t *p;
|
||||
@ -2014,7 +2016,7 @@ void CL_ReadPointFile_f( void )
|
||||
Con_Printf( "Reading %s...\n", filename );
|
||||
|
||||
count = 0;
|
||||
pfile = afile;
|
||||
pfile = (char *)afile;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
|
@ -217,7 +217,8 @@ Initialize CD playlist
|
||||
*/
|
||||
void CL_InitCDAudio( const char *filename )
|
||||
{
|
||||
char *afile, *pfile;
|
||||
byte *afile;
|
||||
char *pfile;
|
||||
string token;
|
||||
int c = 0;
|
||||
|
||||
@ -230,7 +231,7 @@ void CL_InitCDAudio( const char *filename )
|
||||
afile = FS_LoadFile( filename, NULL, false );
|
||||
if( !afile ) return;
|
||||
|
||||
pfile = afile;
|
||||
pfile = (char *)afile;
|
||||
|
||||
// format: trackname\n [num]
|
||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
||||
@ -1516,7 +1517,8 @@ static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount )
|
||||
{
|
||||
cached_spritelist_t *pEntry = &clgame.sprlist[0];
|
||||
int slot, index, numSprites = 0;
|
||||
char *afile, *pfile;
|
||||
byte *afile;
|
||||
char *pfile;
|
||||
string token;
|
||||
|
||||
if( piCount ) *piCount = 0;
|
||||
@ -1547,7 +1549,7 @@ static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount )
|
||||
afile = FS_LoadFile( psz, NULL, false );
|
||||
if( !afile ) return NULL;
|
||||
|
||||
pfile = afile;
|
||||
pfile = (char *)afile;
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
numSprites = Q_atoi( token );
|
||||
|
||||
|
@ -2164,7 +2164,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
else if( clgame.dllFuncs.pfnConnectionlessPacket( &from, args, buf, &len ))
|
||||
{
|
||||
// user out of band message (must be handled in CL_ConnectionlessPacket)
|
||||
if( len > 0 ) Netchan_OutOfBand( NS_SERVER, from, len, buf );
|
||||
if( len > 0 ) Netchan_OutOfBand( NS_SERVER, from, len, (byte *)buf );
|
||||
}
|
||||
else Con_DPrintf( S_ERROR "bad connectionless packet from %s:\n%s\n", NET_AdrToString( from ), args );
|
||||
}
|
||||
|
@ -528,6 +528,9 @@ void CL_BatchResourceRequest( qboolean initialize )
|
||||
break;
|
||||
CL_MoveToOnHandList( p );
|
||||
break;
|
||||
case t_world:
|
||||
ASSERT( 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -586,7 +589,10 @@ int CL_EstimateNeededResources( void )
|
||||
nTotalSize += p->nDownloadSize;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case t_world:
|
||||
ASSERT( 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return nTotalSize;
|
||||
@ -1511,7 +1517,7 @@ void CL_RegisterResources( sizebuf_t *msg )
|
||||
model_t *mod;
|
||||
int i;
|
||||
|
||||
if( cls.dl.custom || cls.signon == SIGNONS && cls.state == ca_active )
|
||||
if( cls.dl.custom || ( cls.signon == SIGNONS && cls.state == ca_active ) )
|
||||
{
|
||||
cls.dl.custom = false;
|
||||
return;
|
||||
|
@ -84,7 +84,8 @@ void SCR_CreateStartupVids( void )
|
||||
void SCR_CheckStartupVids( void )
|
||||
{
|
||||
int c = 0;
|
||||
char *afile, *pfile;
|
||||
byte *afile;
|
||||
char *pfile;
|
||||
string token;
|
||||
|
||||
if( Sys_CheckParm( "-nointro" ) || host_developer.value || cls.demonum != -1 || GameState->nextstate != STATE_RUNFRAME )
|
||||
@ -101,7 +102,7 @@ void SCR_CheckStartupVids( void )
|
||||
afile = FS_LoadFile( DEFAULT_VIDEOLIST_PATH, NULL, false );
|
||||
if( !afile ) return; // something bad happens
|
||||
|
||||
pfile = afile;
|
||||
pfile = (char *)afile;
|
||||
|
||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
||||
{
|
||||
|
@ -407,7 +407,7 @@ Appends a given string as a new line to the console.
|
||||
*/
|
||||
void Con_AddLine( const char *line, int length, qboolean newline )
|
||||
{
|
||||
byte *putpos;
|
||||
char *putpos;
|
||||
con_lineinfo_t *p;
|
||||
|
||||
if( !con.initialized || !con.buffer )
|
||||
@ -1094,8 +1094,8 @@ int Con_DrawString( int x, int y, const char *string, rgba_t setColor )
|
||||
|
||||
void Con_LoadHistory( void )
|
||||
{
|
||||
const char *aFile = FS_LoadFile( "console_history.txt", NULL, true );
|
||||
const char *pLine = aFile, *pFile = aFile;
|
||||
const byte *aFile = FS_LoadFile( "console_history.txt", NULL, true );
|
||||
const char *pLine = (char *)aFile, *pFile = (char *)aFile;
|
||||
int i;
|
||||
|
||||
if( !aFile )
|
||||
|
@ -42,7 +42,7 @@ int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample )
|
||||
|
||||
if( pWaveData->width == 1 )
|
||||
{
|
||||
char *pData = pWaveData->buffer + sample * sampleSize;
|
||||
signed char *pData = (signed char *)(pWaveData->buffer + sample * sampleSize);
|
||||
qboolean zero = false;
|
||||
|
||||
if( pWaveData->channels == 1 )
|
||||
@ -139,7 +139,7 @@ int S_ZeroCrossingAfter( wavdata_t *pWaveData, int sample )
|
||||
|
||||
if( pWaveData->width == 1 ) // 8-bit
|
||||
{
|
||||
char *pData = pWaveData->buffer + sample * sampleSize;
|
||||
signed char *pData = (signed char *)(pWaveData->buffer + sample * sampleSize);
|
||||
qboolean zero = false;
|
||||
|
||||
if( pWaveData->channels == 1 )
|
||||
@ -303,4 +303,4 @@ void S_SetSampleEnd( channel_t *pChan, wavdata_t *pSource, int newEndPosition )
|
||||
newEndPosition = pChan->pMixer.sample;
|
||||
|
||||
pChan->pMixer.forcedEndSample = newEndPosition;
|
||||
}
|
||||
}
|
||||
|
@ -60,10 +60,7 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||
{
|
||||
search_t *t;
|
||||
file_t *f;
|
||||
string message;
|
||||
string compiler;
|
||||
string generator;
|
||||
string matchbuf;
|
||||
string message, compiler, generator, matchbuf;
|
||||
byte buf[MAX_SYSPATH]; // 1 kb
|
||||
int i, nummaps;
|
||||
|
||||
@ -83,6 +80,8 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||
char *ents = NULL, *pfile;
|
||||
qboolean validmap = false;
|
||||
int version = 0;
|
||||
char *szBuf;
|
||||
string version_description;
|
||||
|
||||
if( Q_stricmp( ext, "bsp" )) continue;
|
||||
Q_strncpy( message, "^1error^7", sizeof( message ));
|
||||
@ -114,7 +113,7 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||
Q_strncpy( entfilename, t->filenames[i], sizeof( entfilename ));
|
||||
COM_StripExtension( entfilename );
|
||||
COM_DefaultExtension( entfilename, ".ent" );
|
||||
ents = FS_LoadFile( entfilename, NULL, true );
|
||||
ents = (char *)FS_LoadFile( entfilename, NULL, true );
|
||||
|
||||
if( !ents && lumplen >= 10 )
|
||||
{
|
||||
@ -162,24 +161,24 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||
switch( ver )
|
||||
{
|
||||
case Q1BSP_VERSION:
|
||||
Q_strncpy( buf, "Quake", sizeof( buf ));
|
||||
Q_strncpy( version_description, "Quake", sizeof( version_description ));
|
||||
break;
|
||||
case QBSP2_VERSION:
|
||||
Q_strncpy( buf, "Darkplaces BSP2", sizeof( buf ));
|
||||
Q_strncpy( version_description, "Darkplaces BSP2", sizeof( version_description ));
|
||||
break;
|
||||
case HLBSP_VERSION:
|
||||
switch( version )
|
||||
{
|
||||
case 1: Q_strncpy( buf, "XashXT old format", sizeof( buf )); break;
|
||||
case 2: Q_strncpy( buf, "Paranoia 2: Savior", sizeof( buf )); break;
|
||||
case 4: Q_strncpy( buf, "Half-Life extended", sizeof( buf )); break;
|
||||
default: Q_strncpy( buf, "Half-Life", sizeof( buf )); break;
|
||||
case 1: Q_strncpy( version_description, "XashXT old format", sizeof( version_description )); break;
|
||||
case 2: Q_strncpy( version_description, "Paranoia 2: Savior", sizeof( version_description )); break;
|
||||
case 4: Q_strncpy( version_description, "Half-Life extended", sizeof( version_description )); break;
|
||||
default: Q_strncpy( version_description, "Half-Life", sizeof( version_description )); break;
|
||||
}
|
||||
break;
|
||||
default: Q_strncpy( buf, "??", sizeof( buf )); break;
|
||||
default: Q_strncpy( version_description, "??", sizeof( version_description )); break;
|
||||
}
|
||||
|
||||
Con_Printf( "%16s (%s) ^3%s^7 ^2%s %s^7\n", matchbuf, buf, message, compiler, generator );
|
||||
Con_Printf( "%16s (%s) ^3%s^7 ^2%s %s^7\n", matchbuf, version_description, message, compiler, generator );
|
||||
nummaps++;
|
||||
}
|
||||
|
||||
@ -896,7 +895,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
||||
Q_strncpy( entfilename, t->filenames[i], sizeof( entfilename ));
|
||||
COM_StripExtension( entfilename );
|
||||
COM_DefaultExtension( entfilename, ".ent" );
|
||||
ents = FS_LoadFile( entfilename, NULL, true );
|
||||
ents = (char *)FS_LoadFile( entfilename, NULL, true );
|
||||
|
||||
if( !ents && lumplen >= 10 )
|
||||
{
|
||||
|
@ -1699,7 +1699,7 @@ static qboolean FS_ParseLiblistGam( const char *filename, const char *gamedir, g
|
||||
char *afile;
|
||||
|
||||
if( !GameInfo ) return false;
|
||||
afile = FS_LoadFile( filename, NULL, false );
|
||||
afile = (char *)FS_LoadFile( filename, NULL, false );
|
||||
if( !afile ) return false;
|
||||
|
||||
FS_InitGameInfo( GameInfo, gamedir );
|
||||
@ -1742,7 +1742,7 @@ static qboolean FS_ReadGameInfo( const char *filepath, const char *gamedir, game
|
||||
{
|
||||
char *afile;
|
||||
|
||||
afile = FS_LoadFile( filepath, NULL, false );
|
||||
afile = (char *)FS_LoadFile( filepath, NULL, false );
|
||||
if( !afile ) return false;
|
||||
|
||||
FS_InitGameInfo( GameInfo, gamedir );
|
||||
@ -1813,7 +1813,7 @@ static qboolean FS_ParseGameInfo( const char *gamedir, gameinfo_t *GameInfo )
|
||||
}
|
||||
else if( roGameInfoTime > rwGameInfoTime )
|
||||
{
|
||||
char *afile_ro = FS_LoadDirectFile( filepath_ro, NULL );
|
||||
char *afile_ro = (char *)FS_LoadDirectFile( filepath_ro, NULL );
|
||||
|
||||
if( afile_ro )
|
||||
{
|
||||
@ -2909,7 +2909,7 @@ qboolean CRC32_File( dword *crcvalue, const char *filename )
|
||||
qboolean MD5_HashFile( byte digest[16], const char *pszFileName, uint seed[4] )
|
||||
{
|
||||
file_t *file;
|
||||
char buffer[1024];
|
||||
byte buffer[1024];
|
||||
MD5Context_t MD5_Hash;
|
||||
int bytes;
|
||||
|
||||
|
@ -256,7 +256,8 @@ Host_Exec_f
|
||||
void Host_Exec_f( void )
|
||||
{
|
||||
string cfgpath;
|
||||
char *f, *txt;
|
||||
byte *f;
|
||||
char *txt;
|
||||
fs_offset_t len;
|
||||
|
||||
if( Cmd_Argc() != 2 )
|
||||
|
@ -86,8 +86,7 @@ void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, f
|
||||
{
|
||||
int filelocation;
|
||||
string pakname;
|
||||
char md5[16];
|
||||
char *temp;
|
||||
byte md5[16];
|
||||
file_t *fout;
|
||||
MD5Context_t ctx;
|
||||
|
||||
@ -115,6 +114,8 @@ void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, f
|
||||
|
||||
if( pData == NULL )
|
||||
{
|
||||
byte *temp;
|
||||
|
||||
// there are better ways
|
||||
filelocation = FS_Tell( fin );
|
||||
temp = Z_Malloc( pResource->nDownloadSize );
|
||||
@ -196,8 +197,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
|
||||
hpak_info_t srcpak, dstpak;
|
||||
file_t *file_src;
|
||||
file_t *file_dst;
|
||||
char md5[16];
|
||||
byte *temp;
|
||||
byte md5[16];
|
||||
MD5Context_t ctx;
|
||||
|
||||
if( pData == NULL && pFile == NULL )
|
||||
@ -215,6 +215,8 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
|
||||
|
||||
if( pData == NULL )
|
||||
{
|
||||
byte *temp;
|
||||
|
||||
// there are better ways
|
||||
position = FS_Tell( pFile );
|
||||
temp = Z_Malloc( pResource->nDownloadSize );
|
||||
@ -369,7 +371,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
|
||||
MD5Context_t MD5_Hash;
|
||||
string pakname;
|
||||
resource_t *pRes;
|
||||
char md5[16];
|
||||
byte md5[16];
|
||||
|
||||
if( quiet ) HPAK_FlushHostQueue();
|
||||
|
||||
|
@ -174,10 +174,11 @@ Load master server list from xashcomm.lst
|
||||
*/
|
||||
static void NET_LoadMasters( void )
|
||||
{
|
||||
byte *afile, *pfile;
|
||||
byte *afile;
|
||||
char *pfile;
|
||||
char token[MAX_TOKEN];
|
||||
|
||||
pfile = afile = FS_LoadFile( "xashcomm.lst", NULL, true );
|
||||
afile = FS_LoadFile( "xashcomm.lst", NULL, true );
|
||||
|
||||
if( !afile ) // file doesn't exist yet
|
||||
{
|
||||
@ -185,6 +186,8 @@ static void NET_LoadMasters( void )
|
||||
return;
|
||||
}
|
||||
|
||||
pfile = (char*)afile;
|
||||
|
||||
// format: master <addr>\n
|
||||
while( ( pfile = COM_ParseFile( pfile, token ) ) )
|
||||
{
|
||||
|
@ -351,7 +351,7 @@ Returns true if the bandwidth choke isn't active
|
||||
qboolean Netchan_CanPacket( netchan_t *chan, qboolean choke )
|
||||
{
|
||||
// never choke loopback packets.
|
||||
if( !choke || !net_chokeloopback->value && NET_IsLocalAddress( chan->remote_address ))
|
||||
if( !choke || ( !net_chokeloopback->value && NET_IsLocalAddress( chan->remote_address ) ))
|
||||
{
|
||||
chan->cleartime = host.realtime;
|
||||
return true;
|
||||
@ -528,7 +528,7 @@ void Netchan_OutOfBandPrint( int net_socket, netadr_t adr, char *format, ... )
|
||||
Q_vsnprintf( string, sizeof( string ) - 1, format, argptr );
|
||||
va_end( argptr );
|
||||
|
||||
Netchan_OutOfBand( net_socket, adr, Q_strlen( string ), string );
|
||||
Netchan_OutOfBand( net_socket, adr, Q_strlen( string ), (byte *)string );
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1640,7 +1640,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
|
||||
if( chan->pfnBlockSize )
|
||||
maxsize = chan->pfnBlockSize( chan->client, FRAGSIZE_UNRELIABLE );
|
||||
|
||||
if( MSG_GetNumBytesWritten( &send ) + length >> 3 <= maxsize )
|
||||
if( (( MSG_GetNumBytesWritten( &send ) + length ) >> 3) <= maxsize )
|
||||
MSG_WriteBits( &send, data, length );
|
||||
else Con_Printf( S_WARN "Netchan_Transmit: unreliable message overflow: %d\n", MSG_GetNumBytesWritten( &send ) );
|
||||
}
|
||||
|
@ -515,6 +515,7 @@ void Delta_ParseTableField( sizebuf_t *msg )
|
||||
float mul = 1.0f, post_mul = 1.0f;
|
||||
int flags, bits;
|
||||
const char *pName;
|
||||
qboolean ignore = false;
|
||||
delta_info_t *dt;
|
||||
|
||||
tableIndex = MSG_ReadUBitLong( msg, 4 );
|
||||
@ -523,18 +524,15 @@ void Delta_ParseTableField( sizebuf_t *msg )
|
||||
Host_Error( "Delta_ParseTableField: not initialized" );
|
||||
|
||||
nameIndex = MSG_ReadUBitLong( msg, 8 ); // read field name index
|
||||
if( !( nameIndex >= 0 && nameIndex < dt->maxFields ) )
|
||||
if( ( nameIndex >= 0 && nameIndex < dt->maxFields ) )
|
||||
{
|
||||
Con_Reportf( "Delta_ParseTableField: wrong nameIndex %d for table %s, ignoring\n", nameIndex, dt->pName );
|
||||
MSG_ReadUBitLong( msg, 10 );
|
||||
MSG_ReadUBitLong( msg, 5 ) + 1;
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
MSG_ReadFloat( msg );
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
MSG_ReadFloat( msg );
|
||||
return;
|
||||
pName = dt->pInfo[nameIndex].name;
|
||||
}
|
||||
else
|
||||
{
|
||||
ignore = true;
|
||||
Con_Reportf( "Delta_ParseTableField: wrong nameIndex %d for table %s, ignoring\n", nameIndex, dt->pName );
|
||||
}
|
||||
pName = dt->pInfo[nameIndex].name;
|
||||
|
||||
flags = MSG_ReadUBitLong( msg, 10 );
|
||||
bits = MSG_ReadUBitLong( msg, 5 ) + 1;
|
||||
@ -546,6 +544,9 @@ void Delta_ParseTableField( sizebuf_t *msg )
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
post_mul = MSG_ReadFloat( msg );
|
||||
|
||||
if( ignore )
|
||||
return;
|
||||
|
||||
// delta encoders it's already initialized on this machine (local game)
|
||||
if( delta_init )
|
||||
Delta_Shutdown();
|
||||
@ -750,14 +751,15 @@ void Delta_ParseTable( char **delta_script, delta_info_t *dt, const char *encode
|
||||
|
||||
void Delta_InitFields( void )
|
||||
{
|
||||
char *afile, *pfile;
|
||||
byte *afile;
|
||||
char *pfile;
|
||||
string encodeDll, encodeFunc, token;
|
||||
delta_info_t *dt;
|
||||
|
||||
afile = FS_LoadFile( DELTA_PATH, NULL, false );
|
||||
if( !afile ) Sys_Error( "DELTA_Load: couldn't load file %s\n", DELTA_PATH );
|
||||
|
||||
pfile = afile;
|
||||
pfile = (char *)afile;
|
||||
|
||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
||||
{
|
||||
@ -1083,7 +1085,7 @@ int Delta_TestBaseline( entity_state_t *from, entity_state_t *to, qboolean playe
|
||||
{
|
||||
// strings are handled difference
|
||||
if( FBitSet( pField->flags, DT_STRING ))
|
||||
countBits += Q_strlen(((byte *)to + pField->offset )) * 8;
|
||||
countBits += Q_strlen((char *)((byte *)to + pField->offset )) * 8;
|
||||
else countBits += pField->bits;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ GNU General Public License for more details.
|
||||
#include "pm_local.h"
|
||||
#include "ref_common.h"
|
||||
|
||||
#undef FRAC_EPSILON
|
||||
#define FRAC_EPSILON (1.0f / 32.0f)
|
||||
|
||||
typedef struct
|
||||
|
@ -1505,7 +1505,7 @@ Sequence_ParseBuffer
|
||||
|
||||
==============
|
||||
*/
|
||||
void Sequence_ParseBuffer( byte *buffer, int bufferSize )
|
||||
static void Sequence_ParseBuffer( char *buffer, int bufferSize )
|
||||
{
|
||||
char symbol;
|
||||
|
||||
@ -1566,7 +1566,7 @@ void Sequence_ParseFile( const char *fileName, qboolean isGlobal )
|
||||
|
||||
Con_Reportf( "reading sequence file: %s\n", fileName );
|
||||
|
||||
Sequence_ParseBuffer( buffer, bufSize );
|
||||
Sequence_ParseBuffer( (char *)buffer, bufSize );
|
||||
|
||||
Mem_Free( buffer );
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ void *create_decoder( int *error )
|
||||
return mpg;
|
||||
}
|
||||
|
||||
int feed_mpeg_header( void *mpg, const char *data, long bufsize, long streamsize, wavinfo_t *sc )
|
||||
int feed_mpeg_header( void *mpg, const byte *data, long bufsize, long streamsize, wavinfo_t *sc )
|
||||
{
|
||||
mpg123_handle_t *mh = (mpg123_handle_t *)mpg;
|
||||
int ret, no;
|
||||
@ -67,7 +67,7 @@ int feed_mpeg_header( void *mpg, const char *data, long bufsize, long streamsize
|
||||
return 1;
|
||||
}
|
||||
|
||||
int feed_mpeg_stream( void *mpg, const char *data, long bufsize, char *outbuf, size_t *outsize )
|
||||
int feed_mpeg_stream( void *mpg, const byte *data, long bufsize, byte *outbuf, size_t *outsize )
|
||||
{
|
||||
switch( mpg123_decode( mpg, data, bufsize, outbuf, OUTBUF_SIZE, outsize ))
|
||||
{
|
||||
@ -87,7 +87,7 @@ int open_mpeg_stream( void *mpg, void *file, pfread f_read, pfseek f_seek, wavin
|
||||
|
||||
if( !mh || !sc ) return 0;
|
||||
|
||||
ret = mpg123_replace_reader_handle( mh, f_read, f_seek, NULL );
|
||||
ret = mpg123_replace_reader_handle( mh, (void *)f_read, (void *)f_seek, NULL );
|
||||
if( ret != MPG123_OK )
|
||||
return 0;
|
||||
|
||||
@ -106,7 +106,7 @@ int open_mpeg_stream( void *mpg, void *file, pfread f_read, pfseek f_seek, wavin
|
||||
return 1;
|
||||
}
|
||||
|
||||
int read_mpeg_stream( void *mpg, char *outbuf, size_t *outsize )
|
||||
int read_mpeg_stream( void *mpg, byte *outbuf, size_t *outsize )
|
||||
{
|
||||
switch( mpg123_read( mpg, outbuf, OUTBUF_SIZE, outsize ))
|
||||
{
|
||||
@ -131,4 +131,4 @@ void close_decoder( void *mpg )
|
||||
{
|
||||
mpg123_delete( mpg );
|
||||
mpg123_exit();
|
||||
}
|
||||
}
|
||||
|
@ -39,10 +39,10 @@ typedef long (*pfread)( void *handle, void *buf, size_t count );
|
||||
typedef long (*pfseek)( void *handle, long offset, int whence );
|
||||
|
||||
extern void *create_decoder( int *error );
|
||||
extern int feed_mpeg_header( void *mpg, const char *data, long bufsize, long streamsize, wavinfo_t *sc );
|
||||
extern int feed_mpeg_header( void *mpg, const byte *data, long bufsize, long streamsize, wavinfo_t *sc );
|
||||
extern int feed_mpeg_stream( void *mpg, const char *data, long bufsize, char *outbuf, size_t *outsize );
|
||||
extern int open_mpeg_stream( void *mpg, void *file, pfread f_read, pfseek f_seek, wavinfo_t *sc );
|
||||
extern int read_mpeg_stream( void *mpg, char *outbuf, size_t *outsize );
|
||||
extern int read_mpeg_stream(void *mpg, byte *outbuf, size_t *outsize );
|
||||
extern int get_stream_pos( void *mpg );
|
||||
extern int set_stream_pos( void *mpg, int curpos );
|
||||
extern void close_decoder( void *mpg );
|
||||
@ -52,4 +52,4 @@ const char *get_error( void *mpeg );
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//LIBMPG_H
|
||||
#endif//LIBMPG_H
|
||||
|
@ -14,36 +14,7 @@ GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "soundlib.h"
|
||||
|
||||
/*
|
||||
=======================================================================
|
||||
MPG123 DEFINITION
|
||||
=======================================================================
|
||||
*/
|
||||
#define MP3_ERR -1
|
||||
#define MP3_OK 0
|
||||
#define MP3_NEED_MORE 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int rate; // num samples per second (e.g. 11025 - 11 khz)
|
||||
int channels; // num channels (1 - mono, 2 - stereo)
|
||||
int playtime; // stream size in milliseconds
|
||||
} wavinfo_t;
|
||||
|
||||
// custom stdio
|
||||
typedef int (*pfread)( void *handle, void *buf, size_t count );
|
||||
typedef int (*pfseek)( void *handle, int offset, int whence );
|
||||
|
||||
extern void *create_decoder( int *error );
|
||||
extern int feed_mpeg_header( void *mpg, const char *data, int bufsize, int streamsize, wavinfo_t *sc );
|
||||
extern int feed_mpeg_stream( void *mpg, const char *data, int bufsize, char *outbuf, size_t *outsize );
|
||||
extern int open_mpeg_stream( void *mpg, void *file, pfread f_read, pfseek f_seek, wavinfo_t *sc );
|
||||
extern int read_mpeg_stream( void *mpg, char *outbuf, size_t *outsize );
|
||||
extern int get_stream_pos( void *mpg );
|
||||
extern int set_stream_pos( void *mpg, int curpos );
|
||||
extern void close_decoder( void *mpg );
|
||||
const char *get_error( void *mpeg );
|
||||
#include "libmpg.h"
|
||||
|
||||
/*
|
||||
=================================================================
|
||||
@ -57,7 +28,7 @@ qboolean Sound_LoadMPG( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
void *mpeg;
|
||||
size_t pos = 0;
|
||||
size_t bytesWrite = 0;
|
||||
char out[OUTBUF_SIZE];
|
||||
byte out[OUTBUF_SIZE];
|
||||
size_t outsize, padsize;
|
||||
int ret;
|
||||
wavinfo_t sc;
|
||||
|
@ -85,7 +85,7 @@ static void FindNextChunk( const char *name )
|
||||
iff_dataPtr -= 8;
|
||||
iff_lastChunk = iff_dataPtr + 8 + ((iff_chunkLen + 1) & ~1);
|
||||
|
||||
if( !Q_strncmp( iff_dataPtr, name, 4 ))
|
||||
if( !Q_strncmp( (const char *)iff_dataPtr, name, 4 ))
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -153,7 +153,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
// find "RIFF" chunk
|
||||
FindChunk( "RIFF" );
|
||||
|
||||
if( !( iff_dataPtr && !Q_strncmp( iff_dataPtr + 8, "WAVE", 4 )))
|
||||
if( !( iff_dataPtr && !Q_strncmp( (const char *)iff_dataPtr + 8, "WAVE", 4 )))
|
||||
{
|
||||
Con_DPrintf( S_ERROR "Sound_LoadWAV: %s missing 'RIFF/WAVE' chunks\n", name );
|
||||
return false;
|
||||
@ -216,7 +216,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
|
||||
if( iff_dataPtr )
|
||||
{
|
||||
if( !Q_strncmp( iff_dataPtr + 28, "mark", 4 ))
|
||||
if( !Q_strncmp( (const char *)iff_dataPtr + 28, "mark", 4 ))
|
||||
{
|
||||
// this is not a proper parse, but it works with CoolEdit...
|
||||
iff_dataPtr += 24;
|
||||
@ -287,7 +287,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
if( sound.width == 1 )
|
||||
{
|
||||
int i, j;
|
||||
char *pData = sound.wav;
|
||||
signed char *pData = (signed char *)sound.wav;
|
||||
|
||||
for( i = 0; i < sound.samples; i++ )
|
||||
{
|
||||
|
@ -90,7 +90,8 @@ qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *
|
||||
|
||||
if( !SDL_LockTexture(sw.tex, NULL, &pixels, &pitch ) )
|
||||
{
|
||||
int bits, amask;
|
||||
int bits;
|
||||
uint amask;
|
||||
// lock successfull, release
|
||||
SDL_UnlockTexture(sw.tex);
|
||||
|
||||
@ -896,9 +897,9 @@ rserr_t R_ChangeDisplaySettings( int width, int height, qboolean fullscreen )
|
||||
if( SDL_SetWindowFullscreen( host.hWnd, 0 ) )
|
||||
return rserr_invalid_fullscreen;
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 5 )
|
||||
SDL_SetWindowResizable( host.hWnd, true );
|
||||
SDL_SetWindowResizable( host.hWnd, SDL_TRUE );
|
||||
#endif
|
||||
SDL_SetWindowBordered( host.hWnd, true );
|
||||
SDL_SetWindowBordered( host.hWnd, SDL_TRUE );
|
||||
SDL_SetWindowSize( host.hWnd, width, height );
|
||||
if( !glw_state.software )
|
||||
SDL_GL_GetDrawableSize( host.hWnd, &width, &height );
|
||||
|
@ -672,7 +672,7 @@ const char *SV_GetClientIDString( sv_client_t *cl )
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_snprintf( result, sizeof( result ), "ID_%s", MD5_Print( cl->hashedcdkey ));
|
||||
Q_snprintf( result, sizeof( result ), "ID_%s", MD5_Print( (byte *)cl->hashedcdkey ));
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -1138,7 +1138,7 @@ void SV_FullClientUpdate( sv_client_t *cl, sizebuf_t *msg )
|
||||
MSG_WriteString( msg, info );
|
||||
|
||||
MD5Init( &ctx );
|
||||
MD5Update( &ctx, cl->hashedcdkey, sizeof( cl->hashedcdkey ));
|
||||
MD5Update( &ctx, (byte *)cl->hashedcdkey, sizeof( cl->hashedcdkey ));
|
||||
MD5Final( digest, &ctx );
|
||||
|
||||
MSG_WriteBytes( msg, digest, sizeof( digest ));
|
||||
@ -2227,7 +2227,7 @@ void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
else if( svgame.dllFuncs.pfnConnectionlessPacket( &from, args, buf, &len ))
|
||||
{
|
||||
// user out of band message (must be handled in CL_ConnectionlessPacket)
|
||||
if( len > 0 ) Netchan_OutOfBand( NS_SERVER, from, len, buf );
|
||||
if( len > 0 ) Netchan_OutOfBand( NS_SERVER, from, len, (byte*)buf );
|
||||
}
|
||||
else Con_DPrintf( S_ERROR "bad connectionless packet from %s:\n%s\n", NET_AdrToString( from ), args );
|
||||
}
|
||||
|
@ -855,7 +855,7 @@ static char *SV_ReadEntityScript( const char *filename, int *flags )
|
||||
if( ft2 != -1 && ft1 < ft2 )
|
||||
{
|
||||
// grab .ent files only from gamedir
|
||||
ents = FS_LoadFile( entfilename, NULL, true );
|
||||
ents = (char *)FS_LoadFile( entfilename, NULL, true );
|
||||
}
|
||||
|
||||
// at least entities should contain "{ "classname" "worldspawn" }\0"
|
||||
@ -1271,7 +1271,7 @@ int pfnPrecacheModel( const char *s )
|
||||
if( *s == '!' )
|
||||
{
|
||||
optional = true;
|
||||
*s++;
|
||||
s++;
|
||||
}
|
||||
|
||||
if(( i = SV_ModelIndex( s )) == 0 )
|
||||
@ -1570,6 +1570,9 @@ edict_t *SV_FindEntityByString( edict_t *pStartEdict, const char *pszField, cons
|
||||
return ed;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ASSERT( 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,12 +276,13 @@ model_t *SV_ModelHandle( int modelindex )
|
||||
void SV_ReadResourceList( const char *filename )
|
||||
{
|
||||
string token;
|
||||
char *afile, *pfile;
|
||||
byte *afile;
|
||||
char *pfile;
|
||||
|
||||
afile = FS_LoadFile( filename, NULL, false );
|
||||
if( !afile ) return;
|
||||
|
||||
pfile = afile;
|
||||
pfile = (char *)afile;
|
||||
|
||||
Con_DPrintf( "Precaching from %s\n", filename );
|
||||
Con_DPrintf( "----------------------------------\n" );
|
||||
|
@ -438,7 +438,7 @@ transform hash to hexadecimal printable symbols
|
||||
char *MD5_Print( byte hash[16] )
|
||||
{
|
||||
static char szReturn[64];
|
||||
byte szChunk[10];
|
||||
char szChunk[10];
|
||||
int i;
|
||||
|
||||
memset( szReturn, 0, 64 );
|
||||
|
@ -1188,7 +1188,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic )
|
||||
int mipCount = GL_CalcMipmapCount( tex, ( buf != NULL ));
|
||||
|
||||
// NOTE: only single uncompressed textures can be resamples, no mips, no layers, no sides
|
||||
if(( tex->depth == 1 ) && ( pic->width != tex->width ) || ( pic->height != tex->height ))
|
||||
if((( tex->depth == 1 ) && ( pic->width != tex->width )) || ( pic->height != tex->height ))
|
||||
data = GL_ResampleTexture( buf, pic->width, pic->height, tex->width, tex->height, normalMap );
|
||||
else data = buf;
|
||||
|
||||
|
@ -712,10 +712,10 @@ void GL_InitExtensions( void )
|
||||
GL_CheckExtension( "OpenGL 1.1.0", opengl_110funcs, NULL, GL_OPENGL_110 );
|
||||
|
||||
// get our various GL strings
|
||||
glConfig.vendor_string = pglGetString( GL_VENDOR );
|
||||
glConfig.renderer_string = pglGetString( GL_RENDERER );
|
||||
glConfig.version_string = pglGetString( GL_VERSION );
|
||||
glConfig.extensions_string = pglGetString( GL_EXTENSIONS );
|
||||
glConfig.vendor_string = (const char *)pglGetString( GL_VENDOR );
|
||||
glConfig.renderer_string = (const char *)pglGetString( GL_RENDERER );
|
||||
glConfig.version_string = (const char *)pglGetString( GL_VERSION );
|
||||
glConfig.extensions_string = (const char *)pglGetString( GL_EXTENSIONS );
|
||||
gEngfuncs.Con_Reportf( "^3Video^7: %s\n", glConfig.renderer_string );
|
||||
|
||||
#ifdef XASH_GLES
|
||||
|
@ -20,7 +20,8 @@ GNU General Public License for more details.
|
||||
|
||||
static void R_ParseDetailTextures( const char *filename )
|
||||
{
|
||||
char *afile, *pfile;
|
||||
byte *afile;
|
||||
char *pfile;
|
||||
string token, texname;
|
||||
string detail_texname;
|
||||
string detail_path;
|
||||
@ -31,7 +32,7 @@ static void R_ParseDetailTextures( const char *filename )
|
||||
afile = gEngfuncs.COM_LoadFile( filename, NULL, false );
|
||||
if( !afile ) return;
|
||||
|
||||
pfile = afile;
|
||||
pfile = (char *)afile;
|
||||
|
||||
// format: 'texturename' 'detailtexture' 'xScale' 'yScale'
|
||||
while(( pfile = gEngfuncs.COM_ParseFile( pfile, token )) != NULL )
|
||||
|
@ -1132,7 +1132,7 @@ void R_StudioBuildNormalTable( void )
|
||||
pmesh = (mstudiomesh_t *)((byte *)m_pStudioHeader + m_pSubModel->meshindex) + j;
|
||||
ptricmds = (short *)((byte *)m_pStudioHeader + pmesh->triindex);
|
||||
|
||||
while( i = *( ptricmds++ ))
|
||||
while(( i = *( ptricmds++ )))
|
||||
{
|
||||
if( i < 0 ) i = -i;
|
||||
|
||||
@ -1180,7 +1180,7 @@ void R_StudioGenerateNormals( void )
|
||||
pmesh = (mstudiomesh_t *)((byte *)m_pStudioHeader + m_pSubModel->meshindex) + j;
|
||||
ptricmds = (short *)((byte *)m_pStudioHeader + pmesh->triindex);
|
||||
|
||||
while( i = *( ptricmds++ ))
|
||||
while(( i = *( ptricmds++ )))
|
||||
{
|
||||
if( i < 0 )
|
||||
{
|
||||
@ -1955,7 +1955,7 @@ _inline void R_StudioDrawNormalMesh( short *ptricmds, vec3_t *pstudionorms, floa
|
||||
float *lv;
|
||||
int i;
|
||||
|
||||
while( i = *( ptricmds++ ))
|
||||
while(( i = *( ptricmds++ )))
|
||||
{
|
||||
if( i < 0 )
|
||||
{
|
||||
@ -1988,7 +1988,7 @@ _inline void R_StudioDrawFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
||||
float *lv;
|
||||
int i;
|
||||
|
||||
while( i = *( ptricmds++ ))
|
||||
while(( i = *( ptricmds++ )))
|
||||
{
|
||||
if( i < 0 )
|
||||
{
|
||||
@ -2022,7 +2022,7 @@ _inline void R_StudioDrawChromeMesh( short *ptricmds, vec3_t *pstudionorms, floa
|
||||
qboolean glowShell = (scale > 0.0f) ? true : false;
|
||||
vec3_t vert;
|
||||
|
||||
while( i = *( ptricmds++ ))
|
||||
while(( i = *( ptricmds++ )))
|
||||
{
|
||||
if( i < 0 )
|
||||
{
|
||||
@ -2109,7 +2109,7 @@ _inline void R_StudioBuildArrayNormalMesh( short *ptricmds, vec3_t *pstudionorms
|
||||
int i;
|
||||
float alpha = tr.blend;
|
||||
|
||||
while( i = *( ptricmds++ ))
|
||||
while(( i = *( ptricmds++ )))
|
||||
{
|
||||
int vertexState = 0;
|
||||
qboolean tri_strip = true;
|
||||
@ -2152,7 +2152,7 @@ _inline void R_StudioBuildArrayFloatMesh( short *ptricmds, vec3_t *pstudionorms
|
||||
int i;
|
||||
float alpha = tr.blend;
|
||||
|
||||
while( i = *( ptricmds++ ))
|
||||
while(( i = *( ptricmds++ )))
|
||||
{
|
||||
int vertexState = 0;
|
||||
qboolean tri_strip = true;
|
||||
@ -2197,7 +2197,7 @@ _inline void R_StudioBuildArrayChromeMesh( short *ptricmds, vec3_t *pstudionorms
|
||||
vec3_t vert;
|
||||
float alpha = tr.blend;
|
||||
|
||||
while( i = *( ptricmds++ ))
|
||||
while(( i = *( ptricmds++ )))
|
||||
{
|
||||
int vertexState = 0;
|
||||
qboolean tri_strip = true;
|
||||
@ -2987,7 +2987,7 @@ static void R_StudioDrawPointsShadow( void )
|
||||
|
||||
r_stats.c_studio_polys += pmesh->numtris;
|
||||
|
||||
while( i = *( ptricmds++ ))
|
||||
while(( i = *( ptricmds++ )))
|
||||
{
|
||||
if( i < 0 )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user