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
+2 -2
View File
@@ -140,7 +140,7 @@ qboolean BaseCmd_Replace( base_command_type_e type, base_command_t *basecmd, con
if( !i )
{
MsgDev( D_ERROR, "BaseCmd_Replace: couldn't find %s\n", name);
Con_Reportf( S_ERROR "BaseCmd_Replace: couldn't find %s\n", name);
return false;
}
@@ -168,7 +168,7 @@ void BaseCmd_Remove( base_command_type_e type, const char *name )
if( !i )
{
MsgDev( D_ERROR, "Couldn't find %s in buckets\n", name );
Con_Reportf( S_ERROR "Couldn't find %s in buckets\n", name );
return;
}
+1 -1
View File
@@ -48,7 +48,7 @@ int Q_buildnum( void )
return b;
#else
return 4140;
return 4260;
#endif
}
+12 -18
View File
@@ -63,7 +63,7 @@ qboolean CSCR_ExpectString( parserstate_t *ps, const char *pExpect, qboolean ski
}
if( skip ) ps->buf = tmp;
if( error ) MsgDev( D_ERROR, "Syntax error in %s: got \"%s\" instead of \"%s\"\n", ps->filename, ps->token, pExpect );
if( error ) Con_DPrintf( S_ERROR "Syntax error in %s: got \"%s\" instead of \"%s\"\n", ps->filename, ps->token, pExpect );
return false;
}
@@ -85,7 +85,7 @@ cvartype_t CSCR_ParseType( parserstate_t *ps )
return i;
}
MsgDev( D_ERROR, "Cannot parse %s: Bad type %s\n", ps->filename, ps->token );
Con_DPrintf( S_ERROR "Cannot parse %s: Bad type %s\n", ps->filename, ps->token );
return T_NONE;
}
@@ -181,7 +181,7 @@ qboolean CSCR_ParseHeader( parserstate_t *ps )
if( Q_atof( ps->token ) != 1 )
{
MsgDev( D_ERROR, "File %s has wrong version %s!\n", ps->filename, ps->token );
Con_DPrintf( S_ERROR "File %s has wrong version %s!\n", ps->filename, ps->token );
return false;
}
@@ -192,7 +192,7 @@ qboolean CSCR_ParseHeader( parserstate_t *ps )
if( Q_stricmp( ps->token, "INFO_OPTIONS") && Q_stricmp( ps->token, "SERVER_OPTIONS" ))
{
MsgDev( D_ERROR, "DESCRIPTION must be INFO_OPTIONS or SERVER_OPTIONS\n");
Con_DPrintf( S_ERROR "DESCRIPTION must be INFO_OPTIONS or SERVER_OPTIONS\n");
return false;
}
@@ -223,13 +223,10 @@ int CSCR_WriteGameCVars( file_t *cfg, const char *scriptfilename )
if( !state.buf || !length )
return 0;
MsgDev( D_INFO, "Reading config script file %s\n", scriptfilename );
Con_DPrintf( "Reading config script file %s\n", scriptfilename );
if( !CSCR_ParseHeader( &state ))
{
MsgDev( D_ERROR, "Failed to parse header!\n" );
goto finish;
}
while( !CSCR_ExpectString( &state, "}", false, false ))
{
@@ -258,7 +255,7 @@ int CSCR_WriteGameCVars( file_t *cfg, const char *scriptfilename )
}
if( COM_ParseFile( state.buf, state.token ))
MsgDev( D_ERROR, "Got extra tokens!\n" );
Con_DPrintf( S_ERROR "Got extra tokens!\n" );
else success = true;
finish:
if( !success )
@@ -266,8 +263,8 @@ finish:
state.token[sizeof( state.token ) - 1] = 0;
if( start && state.buf )
MsgDev( D_ERROR, "Parse error in %s, byte %d, token %s\n", scriptfilename, (int)( state.buf - start ), state.token );
else MsgDev( D_ERROR, "Parse error in %s, token %s\n", scriptfilename, state.token );
Con_DPrintf( S_ERROR "Parse error in %s, byte %d, token %s\n", scriptfilename, (int)( state.buf - start ), state.token );
else Con_DPrintf( S_ERROR "Parse error in %s, token %s\n", scriptfilename, state.token );
}
if( start ) Mem_Free( start );
@@ -296,13 +293,10 @@ int CSCR_LoadDefaultCVars( const char *scriptfilename )
if( !state.buf || !length )
return 0;
MsgDev( D_INFO, "Reading config script file %s\n", scriptfilename );
Con_DPrintf( "Reading config script file %s\n", scriptfilename );
if( !CSCR_ParseHeader( &state ))
{
MsgDev( D_ERROR, "Failed to parse header!\n" );
goto finish;
}
while( !CSCR_ExpectString( &state, "}", false, false ))
{
@@ -322,15 +316,15 @@ int CSCR_LoadDefaultCVars( const char *scriptfilename )
}
if( COM_ParseFile( state.buf, state.token ))
MsgDev( D_ERROR, "Got extra tokens!\n" );
Con_DPrintf( S_ERROR "Got extra tokens!\n" );
else success = true;
finish:
if( !success )
{
state.token[sizeof( state.token ) - 1] = 0;
if( start && state.buf )
MsgDev( D_ERROR, "Parse error in %s, byte %d, token %s\n", scriptfilename, (int)( state.buf - start ), state.token );
else MsgDev( D_ERROR, "Parse error in %s, token %s\n", scriptfilename, state.token );
Con_DPrintf( S_ERROR "Parse error in %s, byte %d, token %s\n", scriptfilename, (int)( state.buf - start ), state.token );
else Con_DPrintf( S_ERROR "Parse error in %s, token %s\n", scriptfilename, state.token );
}
if( start ) Mem_Free( start );
+13 -11
View File
@@ -591,11 +591,11 @@ void Cmd_TokenizeString( char *text )
if( !*text )
return;
if( cmd_argc == 1 )
cmd_args = text;
host.com_ignorebracket = true;
host.com_ignorebracket = true;
text = COM_ParseFile( text, cmd_token );
host.com_ignorebracket = false;
@@ -621,7 +621,7 @@ static int Cmd_AddCommandEx( const char *funcname, const char *cmd_name, xcomman
if( !COM_CheckString( cmd_name ))
{
MsgDev( D_ERROR, "Cmd_AddCommand: NULL name\n" );
Con_Reportf( S_ERROR "Cmd_AddCommand: NULL name\n" );
return 0;
}
@@ -986,19 +986,21 @@ void Cmd_ExecuteString( char *text )
if( host.apply_game_config )
return; // don't send nothing to server: we is a server!
#ifndef XASH_DEDICATED
// forward the command line to the server, so the entity DLL can parse it
if( host.type == HOST_NORMAL )
{
#ifndef XASH_DEDICATED
if( cls.state >= ca_connected )
{
Cmd_ForwardToServer();
}
else
#endif
if( text[0] != '@' && host.type == HOST_NORMAL )
{
// commands with leading '@' are hidden system commands
Con_Printf( S_WARN "Unknown command \"%s\"\n", text );
}
else
#endif // XASH_DEDICATED
if( text[0] != '@' && Cvar_VariableInteger( "host_gameloaded" ))
{
// commands with leading '@' are hidden system commands
Con_Printf( S_WARN "Unknown command \"%s\"\n", text );
}
}
}
+6 -28
View File
@@ -89,7 +89,7 @@ XASH SPECIFIC - sort of hack that works only in Xash3D not in GoldSrc
#define MAX_SERVERINFO_STRING 512 // server handles too many settings. expand to 1024?
#define MAX_LOCALINFO_STRING 32768 // localinfo used on server and not sended to the clients
#define MAX_SYSPATH 1024 // system filepath
#define MAX_PRINT_MSG 8192 // how many symbols can handle single call of Msg or MsgDev
#define MAX_PRINT_MSG 8192 // how many symbols can handle single call of Con_Printf or Con_DPrintf
#define MAX_TOKEN 2048 // parse token length
#define MAX_MODS 512 // environment games that engine can keep visible
#define MAX_USERMSG_LENGTH 2048 // don't modify it's relies on a client-side definitions
@@ -276,9 +276,11 @@ typedef struct gameinfo_s
int gamemode;
qboolean secure; // prevent to console acess
qboolean nomodels; // don't let player to choose model (use player.mdl always)
qboolean noskills; // disable skill menu selection
char sp_entity[32]; // e.g. info_player_start
char mp_entity[32]; // e.g. info_player_deathmatch
char mp_filter[32]; // filtering multiplayer-maps
char ambientsound[NUM_AMBIENTS][MAX_QPATH]; // quake ambient sounds
@@ -655,7 +657,7 @@ typedef enum
IMAGE_ROT_90 = BIT(18), // flip from upper left corner to down right corner
IMAGE_ROT180 = IMAGE_FLIP_X|IMAGE_FLIP_Y,
IMAGE_ROT270 = IMAGE_FLIP_X|IMAGE_FLIP_Y|IMAGE_ROT_90,
// reserved
IMAGE_EMBOSS = BIT(19), // apply emboss mapping
IMAGE_RESAMPLE = BIT(20), // resample image to specified dims
// reserved
// reserved
@@ -666,16 +668,6 @@ typedef enum
IMAGE_REMAP = BIT(27), // interpret width and height as top and bottom color
} imgFlags_t;
// ordering is important!
typedef enum
{
BLUR_FILTER = 0,
BLUR_FILTER2,
EDGE_FILTER,
EMBOSS_FILTER,
NUM_FILTERS,
} pixfilter_t;
typedef struct rgbdata_s
{
word width; // image width
@@ -691,21 +683,6 @@ typedef struct rgbdata_s
size_t size; // for bounds checking
} rgbdata_t;
// imgfilter processing flags
typedef enum
{
FILTER_GRAYSCALE = BIT(0),
} flFlags_t;
typedef struct imgfilter_s
{
int filter; // pixfilter_t
float factor; // filter factor value
float bias; // filter bias value
flFlags_t flags; // filter additional flags
uint blendFunc; // blending mode
} imgfilter_t;
//
// imagelib
//
@@ -717,7 +694,7 @@ qboolean FS_SaveImage( const char *filename, rgbdata_t *pix );
rgbdata_t *FS_CopyImage( rgbdata_t *in );
void FS_FreeImage( rgbdata_t *pack );
extern const bpc_desc_t PFDesc[]; // image get pixelformat
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgfilter_t *filter );
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, float bumpscale );
void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end, int pal_size );
void Image_PaletteTranslate( byte *palSrc, int top, int bottom, int pal_size );
void Image_SetForceFlags( uint flags ); // set image force flags on loading
@@ -1026,6 +1003,7 @@ void SV_DrawDebugTriangles( void );
void SV_DrawOrthoTriangles( void );
double CL_GetDemoFramerate( void );
qboolean UI_CreditsActive( void );
void CL_StopPlayback( void );
void CL_ExtraUpdate( void );
int CL_GetMaxClients( void );
int SV_GetMaxClients( void );
+11 -2
View File
@@ -685,7 +685,9 @@ qboolean Cmd_GetCDList( const char *s, char *completedname, int length )
qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
{
qboolean use_filter = false;
byte buf[MAX_SYSPATH];
string mpfilter;
char *buffer;
string result;
int i, size;
@@ -695,6 +697,8 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
if( FS_FileSize( "maps.lst", onlyingamedir ) > 0 && !fRefresh )
return true; // exist
// setup mpfilter
Q_snprintf( mpfilter, sizeof( mpfilter ), "maps/%s", GI->mp_filter );
t = FS_Search( "maps/*.bsp", false, onlyingamedir );
if( !t )
@@ -708,6 +712,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
}
buffer = Mem_Calloc( host.mempool, t->numfilenames * 2 * sizeof( result ));
use_filter = Q_strlen( GI->mp_filter ) ? true : false;
for( i = 0; i < t->numfilenames; i++ )
{
@@ -718,6 +723,9 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
if( Q_stricmp( COM_FileExtension( t->filenames[i] ), "bsp" ))
continue;
if( use_filter && !Q_strnicmp( t->filenames[i], mpfilter, Q_strlen( mpfilter )))
continue;
f = FS_Open( t->filenames[i], "rb", onlyingamedir );
COM_FileBase( t->filenames[i], mapname );
@@ -775,7 +783,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
else if( !Q_strcmp( token, "classname" ))
{
pfile = COM_ParseFile( pfile, token );
if( !Q_strcmp( token, GI->mp_entity ))
if( !Q_strcmp( token, GI->mp_entity ) || use_filter )
num_spawnpoints++;
}
if( num_spawnpoints ) break; // valid map
@@ -823,6 +831,7 @@ int Cmd_CheckMapsList( int fRefresh )
autocomplete_list_t cmd_list[] =
{
{ "map_background", Cmd_GetMapList },
{ "changelevel2", Cmd_GetMapList },
{ "changelevel", Cmd_GetMapList },
{ "playdemo", Cmd_GetDemoList, },
{ "timedemo", Cmd_GetDemoList, },
@@ -1196,7 +1205,7 @@ void Cmd_WriteOpenGLVariables( file_t *f )
else\
{\
FS_Close( f );\
MsgDev( D_ERROR, "could not update " x "\n" );\
Con_Reportf( S_ERROR "could not update " x "\n" );\
}
/*
-1
View File
@@ -575,7 +575,6 @@ int Q_vsnprintf( char *buffer, size_t buffersize, const char *format, va_list ar
__except( EXCEPTION_EXECUTE_HANDLER )
{
Q_strncpy( buffer, "^1sprintf throw exception^7\n", buffersize );
// memset( buffer, 0, buffersize );
result = buffersize;
}
#endif
+12
View File
@@ -672,6 +672,18 @@ const char *Cvar_VariableString( const char *var_name )
return var->string;
}
/*
============
Cvar_Exists
============
*/
qboolean Cvar_Exists( const char *var_name )
{
if( Cvar_FindVar( var_name ))
return true;
return false;
}
/*
============
Cvar_SetCheatState
+1
View File
@@ -64,6 +64,7 @@ float Cvar_VariableValue( const char *var_name );
int Cvar_VariableInteger( const char *var_name );
const char *Cvar_VariableString( const char *var_name );
void Cvar_WriteVariables( file_t *f, int group );
qboolean Cvar_Exists( const char *var_name );
void Cvar_Reset( const char *var_name );
void Cvar_SetCheatState( void );
qboolean Cvar_Command( convar_t *v );
+4 -4
View File
@@ -335,13 +335,13 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
if( pin->ident != IDSPRITEHEADER )
{
MsgDev( D_ERROR, "%s has wrong id (%x should be %x)\n", mod->name, pin->ident, IDSPRITEHEADER );
Con_Reportf( S_ERROR "%s has wrong id (%x should be %x)\n", mod->name, pin->ident, IDSPRITEHEADER );
return;
}
if( i != SPRITE_VERSION_Q1 && i != SPRITE_VERSION_HL && i != SPRITE_VERSION_32 )
{
MsgDev( D_ERROR, "%s has wrong version number (%i should be %i or %i)\n", mod->name, i, SPRITE_VERSION_Q1, SPRITE_VERSION_HL );
Con_Reportf( S_ERROR "%s has wrong version number (%i should be %i or %i)\n", mod->name, i, SPRITE_VERSION_Q1, SPRITE_VERSION_HL );
return;
}
@@ -428,13 +428,13 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
}
else
{
MsgDev( D_ERROR, "%s has wrong number of palette colors %i (should be 256)\n", mod->name, *numi );
Con_Reportf( S_ERROR "%s has wrong number of palette colors %i (should be 256)\n", mod->name, *numi );
return;
}
if( mod->numframes < 1 )
{
MsgDev( D_ERROR, "%s has invalid # of frames: %d\n", mod->name, mod->numframes );
Con_Reportf( S_ERROR "%s has invalid # of frames: %d\n", mod->name, mod->numframes );
return;
}
+64 -42
View File
@@ -363,7 +363,7 @@ static const char *FS_FixFileCase( const char *path )
}
}
//MsgDev( D_NOTE, "FS_FixFileCase: %s\n", path );
//Con_Reportf( "FS_FixFileCase: %s\n", path );
if( !( dir = opendir( path2 ) ) )
return path;
@@ -374,7 +374,7 @@ static const char *FS_FixFileCase( const char *path )
continue;
path = va( "%s/%s", path2, entry->d_name );
//MsgDev( D_NOTE, "FS_FixFileCase: %s %s %s\n", path2, fname, entry->d_name );
//Con_Reportf( "FS_FixFileCase: %s %s %s\n", path2, fname, entry->d_name );
break;
}
closedir( dir );
@@ -406,7 +406,7 @@ static dpackfile_t *FS_AddFileToPack( const char *name, pack_t *pack, long offse
diff = Q_stricmp( pack->files[middle].name, name );
// If we found the file, there's a problem
if( !diff ) MsgDev( D_WARN, "package %s contains the file %s several times\n", pack->filename, name );
if( !diff ) Con_Reportf( S_WARN "package %s contains the file %s several times\n", pack->filename, name );
// If we're too far in the list
if( diff > 0 ) right = middle - 1;
@@ -521,7 +521,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( packhandle < 0 )
{
MsgDev( D_NOTE, "%s couldn't open\n", packfile );
Con_Reportf( "%s couldn't open\n", packfile );
if( error ) *error = PAK_LOAD_COULDNT_OPEN;
return NULL;
}
@@ -530,7 +530,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( header.ident != IDPACKV1HEADER )
{
MsgDev( D_NOTE, "%s is not a packfile. Ignored.\n", packfile );
Con_Reportf( "%s is not a packfile. Ignored.\n", packfile );
if( error ) *error = PAK_LOAD_BAD_HEADER;
close( packhandle );
return NULL;
@@ -538,7 +538,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( header.dirlen % sizeof( dpackfile_t ))
{
MsgDev( D_ERROR, "%s has an invalid directory size. Ignored.\n", packfile );
Con_Reportf( S_ERROR "%s has an invalid directory size. Ignored.\n", packfile );
if( error ) *error = PAK_LOAD_BAD_FOLDERS;
close( packhandle );
return NULL;
@@ -548,7 +548,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( numpackfiles > MAX_FILES_IN_PACK )
{
MsgDev( D_ERROR, "%s has too many files ( %i ). Ignored.\n", packfile, numpackfiles );
Con_Reportf( S_ERROR "%s has too many files ( %i ). Ignored.\n", packfile, numpackfiles );
if( error ) *error = PAK_LOAD_TOO_MANY_FILES;
close( packhandle );
return NULL;
@@ -556,7 +556,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( numpackfiles <= 0 )
{
MsgDev( D_NOTE, "%s has no files. Ignored.\n", packfile );
Con_Reportf( "%s has no files. Ignored.\n", packfile );
if( error ) *error = PAK_LOAD_NO_FILES;
close( packhandle );
return NULL;
@@ -567,7 +567,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
if( header.dirlen != read( packhandle, (void *)info, header.dirlen ))
{
MsgDev( D_NOTE, "%s is an incomplete PAK, not loading\n", packfile );
Con_Reportf( "%s is an incomplete PAK, not loading\n", packfile );
if( error ) *error = PAK_LOAD_CORRUPTED;
close( packhandle );
Mem_Free( info );
@@ -612,9 +612,11 @@ static qboolean FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loade
}
}
if( already_loaded ) *already_loaded = false;
if( !Q_stricmp( ext, "wad" )) wad = W_Open( wadfile, &errorcode );
else MsgDev( D_ERROR, "\"%s\" doesn't have a wad extension\n", wadfile );
if( already_loaded )
*already_loaded = false;
if( !Q_stricmp( ext, "wad" ))
wad = W_Open( wadfile, &errorcode );
if( wad )
{
@@ -630,7 +632,7 @@ static qboolean FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loade
else
{
if( errorcode != WAD_LOAD_NO_FILES )
MsgDev( D_ERROR, "FS_AddWad_Fullpath: unable to load wad \"%s\"\n", wadfile );
Con_Reportf( S_ERROR "FS_AddWad_Fullpath: unable to load wad \"%s\"\n", wadfile );
return false;
}
}
@@ -665,10 +667,11 @@ static qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loade
}
}
if( already_loaded ) *already_loaded = false;
if( already_loaded )
*already_loaded = false;
if( !Q_stricmp( ext, "pak" )) pak = FS_LoadPackPAK( pakfile, &errorcode );
else MsgDev( D_ERROR, "\"%s\" does not have a pack extension\n", pakfile );
if( !Q_stricmp( ext, "pak" ))
pak = FS_LoadPackPAK( pakfile, &errorcode );
if( pak )
{
@@ -697,7 +700,7 @@ static qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loade
else
{
if( errorcode != PAK_LOAD_NO_FILES )
MsgDev( D_ERROR, "FS_AddPak_Fullpath: unable to load pak \"%s\"\n", pakfile );
Con_Reportf( S_ERROR "FS_AddPak_Fullpath: unable to load pak \"%s\"\n", pakfile );
return false;
}
}
@@ -781,7 +784,7 @@ void FS_AddGameHierarchy( const char *dir, uint flags )
{
if( !Q_strnicmp( SI.games[i]->gamefolder, dir, 64 ))
{
MsgDev( D_NOTE, "FS_AddGameHierarchy: %d %s %s\n", i, SI.games[i]->gamefolder, SI.games[i]->basedir );
Con_Reportf( "FS_AddGameHierarchy: %d %s %s\n", i, SI.games[i]->gamefolder, SI.games[i]->basedir );
if( !SI.games[i]->added && Q_stricmp( SI.games[i]->gamefolder, SI.games[i]->basedir ) )
{
SI.games[i]->added = true;
@@ -898,7 +901,7 @@ FS_Rescan
*/
void FS_Rescan( void )
{
MsgDev( D_NOTE, "FS_Rescan( %s )\n", GI->title );
Con_Reportf( "FS_Rescan( %s )\n", GI->title );
FS_ClearSearchPath();
@@ -952,6 +955,8 @@ assume GameInfo is valid
static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
{
file_t *f = FS_Open( filepath, "w", false ); // we in binary-mode
int i, write_ambients = false;
if( !f ) Sys_Error( "FS_WriteGameInfo: can't write %s\n", filepath ); // may be disk-space is out?
FS_Printf( f, "// generated by %s %s-%s (%s-%s)\n\n\n", XASH_ENGINE_NAME, XASH_VERSION, Q_buildcommit(), Q_buildos(), Q_buildarch() );
@@ -1020,6 +1025,8 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
FS_Printf( f, "sp_entity\t\t\"%s\"\n", GameInfo->sp_entity );
if( Q_strlen( GameInfo->mp_entity ))
FS_Printf( f, "mp_entity\t\t\"%s\"\n", GameInfo->mp_entity );
if( Q_strlen( GameInfo->mp_filter ))
FS_Printf( f, "mp_filter\t\t\"%s\"\n", GameInfo->mp_filter );
if( GameInfo->secure )
FS_Printf( f, "secure\t\t\"%i\"\n", GameInfo->secure );
@@ -1036,6 +1043,19 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
if( GameInfo->max_particles > 0 )
FS_Printf( f, "max_particles\t%i\n", GameInfo->max_particles );
for( i = 0; i < NUM_AMBIENTS; i++ )
{
if( *GameInfo->ambientsound[i] )
{
if( !write_ambients )
{
FS_Print( f, "\n" );
write_ambients = true;
}
FS_Printf( f, "ambient%i\t\t%s\n", i, GameInfo->ambientsound[i] );
}
}
FS_Print( f, "\n\n\n" );
FS_Close( f ); // all done
}
@@ -1188,6 +1208,10 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
{
pfile = COM_ParseFile( pfile, GameInfo->mp_entity );
}
else if( !Q_stricmp( token, isGameInfo ? "mp_filter" : "mpfilter" ))
{
pfile = COM_ParseFile( pfile, GameInfo->mp_filter );
}
// valid for both
else if( !Q_stricmp( token, "secure" ))
{
@@ -1263,13 +1287,13 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
int ambientNum = Q_atoi( token + 7 );
if( ambientNum < 0 || ambientNum > ( NUM_AMBIENTS - 1 ))
{
MsgDev( D_ERROR, "FS_ParseGameInfo: Invalid ambient number %i. Ignored.\n", ambientNum );
}
else
{
pfile = COM_ParseFile( pfile, GameInfo->ambientsound[ambientNum] );
}
ambientNum = 0;
pfile = COM_ParseFile( pfile, GameInfo->ambientsound[ambientNum] );
}
else if( !Q_stricmp( token, "noskills" ))
{
pfile = COM_ParseFile( pfile, token );
GameInfo->noskills = Q_atoi( token );
}
}
}
@@ -1490,7 +1514,7 @@ void FS_LoadGameInfo( const char *rootfolder )
fs_ext_path = false;
if( rootfolder ) Q_strcpy( fs_gamedir, rootfolder );
MsgDev( D_NOTE, "FS_LoadGameInfo( %s )\n", fs_gamedir );
Con_Reportf( "FS_LoadGameInfo( %s )\n", fs_gamedir );
// clear any old pathes
FS_ClearSearchPath();
@@ -1724,7 +1748,6 @@ static file_t *FS_SysOpen( const char *filepath, const char *mode )
opt = O_CREAT;
break;
default:
MsgDev( D_ERROR, "FS_SysOpen(%s, %s): invalid mode\n", filepath, mode );
return NULL;
}
@@ -1739,7 +1762,6 @@ static file_t *FS_SysOpen( const char *filepath, const char *mode )
opt |= O_BINARY;
break;
default:
MsgDev( D_ERROR, "FS_SysOpen: %s: unknown char (%c) in mode (%s)\n", filepath, mode[ind], mode );
break;
}
}
@@ -1872,7 +1894,7 @@ qboolean FS_SysFolderExists( const char *path )
}
else
{
MsgDev( D_ERROR, "FS_SysFolderExists: problem while opening dir: %s\n", strerror( errno ) );
Con_Reportf( S_ERROR "FS_SysFolderExists: problem while opening dir: %s\n", strerror( errno ) );
return false;
}
#endif
@@ -2542,7 +2564,7 @@ qboolean FS_WriteFile( const char *filename, const void *data, long len )
if( !file )
{
MsgDev( D_ERROR, "FS_WriteFile: failed on %s\n", filename);
Con_Reportf( S_ERROR "FS_WriteFile: failed on %s\n", filename);
return false;
}
@@ -2832,7 +2854,7 @@ qboolean FS_FileCopy( file_t *pOutput, file_t *pInput, int fileSize )
if(( readSize = FS_Read( pInput, buf, size )) < size )
{
MsgDev( D_ERROR, "FS_FileCopy: unexpected end of input file (%d < %d)\n", readSize, size );
Con_Reportf( S_ERROR "FS_FileCopy: unexpected end of input file (%d < %d)\n", readSize, size );
fileSize = 0;
done = false;
break;
@@ -3205,7 +3227,7 @@ static dlumpinfo_t *W_AddFileToWad( const char *name, wfile_t *wad, dlumpinfo_t
diff = 1;
else if( wad->lumps[middle].type > newlump->type )
diff = -1;
else MsgDev( D_WARN, "Wad %s contains the file %s several times\n", wad->filename, name );
else Con_Reportf( S_WARN "Wad %s contains the file %s several times\n", wad->filename, name );
}
// If we're too far in the list
@@ -3246,7 +3268,7 @@ byte *W_ReadLump( wfile_t *wad, dlumpinfo_t *lump, long *lumpsizeptr )
if( FS_Seek( wad->handle, lump->filepos, SEEK_SET ) == -1 )
{
MsgDev( D_ERROR, "W_ReadLump: %s is corrupted\n", lump->name );
Con_Reportf( S_ERROR "W_ReadLump: %s is corrupted\n", lump->name );
FS_Seek( wad->handle, oldpos, SEEK_SET );
return NULL;
}
@@ -3256,7 +3278,7 @@ byte *W_ReadLump( wfile_t *wad, dlumpinfo_t *lump, long *lumpsizeptr )
if( size < lump->disksize )
{
MsgDev( D_WARN, "W_ReadLump: %s is probably corrupted\n", lump->name );
Con_Reportf( S_WARN "W_ReadLump: %s is probably corrupted\n", lump->name );
FS_Seek( wad->handle, oldpos, SEEK_SET );
Mem_Free( buf );
return NULL;
@@ -3303,7 +3325,7 @@ wfile_t *W_Open( const char *filename, int *error )
if( wad->handle == NULL )
{
MsgDev( D_ERROR, "W_Open: couldn't open %s\n", filename );
Con_Reportf( S_ERROR "W_Open: couldn't open %s\n", filename );
if( error ) *error = WAD_LOAD_COULDNT_OPEN;
W_Close( wad );
return NULL;
@@ -3316,7 +3338,7 @@ wfile_t *W_Open( const char *filename, int *error )
if( FS_Read( wad->handle, &header, sizeof( dwadinfo_t )) != sizeof( dwadinfo_t ))
{
MsgDev( D_ERROR, "W_Open: %s can't read header\n", filename );
Con_Reportf( S_ERROR "W_Open: %s can't read header\n", filename );
if( error ) *error = WAD_LOAD_BAD_HEADER;
W_Close( wad );
return NULL;
@@ -3324,7 +3346,7 @@ wfile_t *W_Open( const char *filename, int *error )
if( header.ident != IDWAD2HEADER && header.ident != IDWAD3HEADER )
{
MsgDev( D_ERROR, "W_Open: %s is not a WAD2 or WAD3 file\n", filename );
Con_Reportf( S_ERROR "W_Open: %s is not a WAD2 or WAD3 file\n", filename );
if( error ) *error = WAD_LOAD_BAD_HEADER;
W_Close( wad );
return NULL;
@@ -3334,12 +3356,12 @@ wfile_t *W_Open( const char *filename, int *error )
if( lumpcount >= MAX_FILES_IN_WAD )
{
MsgDev( D_WARN, "W_Open: %s is full (%i lumps)\n", filename, lumpcount );
Con_Reportf( S_WARN "W_Open: %s is full (%i lumps)\n", filename, lumpcount );
if( error ) *error = WAD_LOAD_TOO_MANY_FILES;
}
else if( lumpcount <= 0 )
{
MsgDev( D_ERROR, "W_Open: %s has no lumps\n", filename );
Con_Reportf( S_ERROR "W_Open: %s has no lumps\n", filename );
if( error ) *error = WAD_LOAD_NO_FILES;
W_Close( wad );
return NULL;
@@ -3350,7 +3372,7 @@ wfile_t *W_Open( const char *filename, int *error )
if( FS_Seek( wad->handle, wad->infotableofs, SEEK_SET ) == -1 )
{
MsgDev( D_ERROR, "W_Open: %s can't find lump allocation table\n", filename );
Con_Reportf( S_ERROR "W_Open: %s can't find lump allocation table\n", filename );
if( error ) *error = WAD_LOAD_BAD_FOLDERS;
W_Close( wad );
return NULL;
@@ -3363,7 +3385,7 @@ wfile_t *W_Open( const char *filename, int *error )
if( FS_Read( wad->handle, srclumps, lat_size ) != lat_size )
{
MsgDev( D_ERROR, "W_ReadLumpTable: %s has corrupted lump allocation table\n", wad->filename );
Con_Reportf( S_ERROR "W_ReadLumpTable: %s has corrupted lump allocation table\n", wad->filename );
if( error ) *error = WAD_LOAD_CORRUPTED;
Mem_Free( srclumps );
W_Close( wad );
+3 -2
View File
@@ -464,7 +464,7 @@ double Host_CalcFPS( void )
if( host.type != HOST_DEDICATED && Host_IsLocalGame( ) && !CL_IsTimeDemo( ))
{
// ajdust fps for vertical synchronization
if( gl_vsync != NULL && gl_vsync->value )
if( CVAR_TO_BOOL( gl_vsync ))
{
if( vid_displayfrequency->value != 0.0f )
fps = vid_displayfrequency->value;
@@ -772,7 +772,8 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
host.mempool = Mem_AllocPool( "Zone Engine" );
// HACKHACK: Quake console is always allowed
if( Sys_CheckParm( "-console" ) || !Q_stricmp( progname, "id1" ))
// TODO: determine if we are running QWrap more reliable
if( Sys_CheckParm( "-console" ) || !Q_stricmp( SI.exeName, "quake" ))
host.allow_console = true;
if( Sys_CheckParm( "-dev" ))
+43 -49
View File
@@ -95,20 +95,17 @@ void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, f
return;
if(( fin != NULL && pData != NULL ) || ( fin == NULL && pData == NULL ))
{
MsgDev( D_ERROR, "HPAK_CreatePak, must specify one of pData or fpSource\n" );
return;
}
Q_strncpy( pakname, filename, sizeof( pakname ));
COM_ReplaceExtension( pakname, ".hpk" );
MsgDev( D_INFO, "creating HPAK %s.\n", pakname );
Con_Printf( "creating HPAK %s.\n", pakname );
fout = FS_Open( pakname, "wb", false );
if( !fout )
{
MsgDev( D_ERROR, "HPAK_CreatePak: can't write %s.\n", pakname );
Con_DPrintf( S_ERROR "HPAK_CreatePak: can't write %s.\n", pakname );
return;
}
@@ -135,7 +132,7 @@ void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, f
if( memcmp( md5, pResource->rgucMD5_hash, 16 ))
{
MsgDev( D_ERROR, "HPAK_CreatePak: bad checksum for %s. Ignored\n", pakname );
Con_DPrintf( S_ERROR "HPAK_CreatePak: bad checksum for %s. Ignored\n", pakname );
return;
}
@@ -204,10 +201,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
MD5Context_t ctx;
if( pData == NULL && pFile == NULL )
{
MsgDev( D_ERROR, "HPAK_AddLump: no data\n" );
return;
}
if( pResource->nDownloadSize < HPAK_MIN_SIZE || pResource->nDownloadSize > HPAK_MAX_SIZE )
{
@@ -238,7 +232,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
if( memcmp( md5, pResource->rgucMD5_hash, 16 ))
{
MsgDev( D_ERROR, "HPAK_AddLump: bad checksum for %s. Ignored\n", pResource->szFileName );
Con_DPrintf( S_ERROR "HPAK_AddLump: bad checksum for %s. Ignored\n", pResource->szFileName );
return;
}
@@ -267,7 +261,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
if( !file_dst )
{
MsgDev( D_ERROR, "HPAK_AddLump: couldn't open %s.\n", srcname );
Con_DPrintf( S_ERROR "HPAK_AddLump: couldn't open %s.\n", srcname );
FS_Close( file_src );
return;
}
@@ -278,7 +272,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
if( hash_pack_header.version != IDHPAK_VERSION )
{
// we don't check the HPAK bit for some reason.
MsgDev( D_ERROR, "HPAK_AddLump: %s does not have a valid header.\n", srcname );
Con_DPrintf( S_ERROR "HPAK_AddLump: %s does not have a valid header.\n", srcname );
FS_Close( file_src );
FS_Close( file_dst );
}
@@ -292,7 +286,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
if( srcpak.count < 1 || srcpak.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "HPAK_AddLump: %s contain too many lumps.\n", srcname );
Con_DPrintf( S_ERROR "HPAK_AddLump: %s contain too many lumps.\n", srcname );
FS_Close( file_src );
FS_Close( file_dst );
return;
@@ -386,16 +380,16 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
f = FS_Open( pakname, "rb", false );
if( !f )
{
MsgDev( D_INFO, "Couldn't find %s.\n", pakname );
Con_DPrintf( S_ERROR "Couldn't find %s.\n", pakname );
return true;
}
if( !quiet ) MsgDev( D_INFO, "Validating %s\n", pakname );
if( !quiet ) Con_Printf( "Validating %s\n", pakname );
FS_Read( f, &hdr, sizeof( hdr ));
if( hdr.ident != IDHPAKHEADER || hdr.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "HPAK_ValidatePak: %s does not have a valid HPAK header.\n", pakname );
Con_DPrintf( S_ERROR "HPAK_ValidatePak: %s does not have a valid HPAK header.\n", pakname );
FS_Close( f );
return false;
}
@@ -405,24 +399,24 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
if( num_lumps < 1 || num_lumps > MAX_FILES_IN_WAD )
{
MsgDev( D_ERROR, "HPAK_ValidatePak: %s has too many lumps %u.\n", pakname, num_lumps );
Con_DPrintf( S_ERROR "HPAK_ValidatePak: %s has too many lumps %u.\n", pakname, num_lumps );
FS_Close( f );
return false;
}
if( !quiet ) MsgDev( D_INFO, "# of Entries: %i\n", num_lumps );
if( !quiet ) Con_Printf( "# of Entries: %i\n", num_lumps );
dataDir = Z_Malloc( sizeof( hpak_lump_t ) * num_lumps );
FS_Read( f, dataDir, sizeof( hpak_lump_t ) * num_lumps );
if( !quiet ) MsgDev( D_INFO, "# Type Size FileName : MD5 Hash\n" );
if( !quiet ) Con_Printf( "# Type Size FileName : MD5 Hash\n" );
for( i = 0; i < num_lumps; i++ )
{
if( dataDir[i].disksize < 1 || dataDir[i].disksize > 131071 )
{
// odd max size
MsgDev( D_ERROR, "HPAK_ValidatePak: lump %i has invalid size %s\n", i, Q_pretifymem( dataDir[i].disksize, 2 ));
Con_DPrintf( S_ERROR "HPAK_ValidatePak: lump %i has invalid size %s\n", i, Q_pretifymem( dataDir[i].disksize, 2 ));
Mem_Free( dataDir );
FS_Close(f);
return false;
@@ -439,24 +433,24 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
pRes = &dataDir[i].resource;
MsgDev( D_INFO, "%i: %s %s %s: ", i, HPAK_TypeFromIndex( pRes->type ),
Con_Printf( "%i: %s %s %s: ", i, HPAK_TypeFromIndex( pRes->type ),
Q_pretifymem( pRes->nDownloadSize, 2 ), pRes->szFileName );
if( memcmp( md5, pRes->rgucMD5_hash, 0x10 ))
{
if( quiet )
{
MsgDev( D_ERROR, "HPAK_ValidatePak: %s has invalid checksum.\n", pakname );
Con_DPrintf( S_ERROR "HPAK_ValidatePak: %s has invalid checksum.\n", pakname );
Mem_Free( dataPak );
Mem_Free( dataDir );
FS_Close( f );
return false;
}
else MsgDev( D_INFO, "failed\n" );
else Con_DPrintf( S_ERROR "failed\n" );
}
else
{
if( !quiet ) MsgDev( D_INFO, "OK\n" );
if( !quiet ) Con_Printf( "OK\n" );
}
// at this point, it's passed our checks.
@@ -584,21 +578,21 @@ static qboolean HPAK_ResourceForIndex( const char *filename, int index, resource
f = FS_Open( pakname, "rb", false );
if( !f )
{
MsgDev( D_ERROR, "couldn't open %s.\n", pakname );
Con_DPrintf( S_ERROR "couldn't open %s.\n", pakname );
return false;
}
FS_Read( f, &header, sizeof( header ));
if( header.ident != IDHPAKHEADER )
{
MsgDev( D_ERROR, "%s is not an HPAK file\n", pakname );
Con_DPrintf( S_ERROR "%s is not an HPAK file\n", pakname );
FS_Close( f );
return false;
}
if( header.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
Con_DPrintf( S_ERROR "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
FS_Close( f );
return false;
}
@@ -608,14 +602,14 @@ static qboolean HPAK_ResourceForIndex( const char *filename, int index, resource
if( directory.count < 1 || directory.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "%s has too many lumps %u.\n", pakname, directory.count );
Con_DPrintf( S_ERROR "%s has too many lumps %u.\n", pakname, directory.count );
FS_Close( f );
return false;
}
if( index < 1 || index > directory.count )
{
MsgDev( D_ERROR, "%s, lump with index %i doesn't exist.\n", pakname, index );
Con_DPrintf( S_ERROR "%s, lump with index %i doesn't exist.\n", pakname, index );
FS_Close( f );
return false;
}
@@ -674,14 +668,14 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte
if( header.ident != IDHPAKHEADER )
{
MsgDev( D_ERROR, "%s it's not a HPK file.\n", pakname );
Con_DPrintf( S_ERROR "%s it's not a HPK file.\n", pakname );
FS_Close( f );
return false;
}
if( header.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
Con_DPrintf( S_ERROR "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
FS_Close( f );
return false;
}
@@ -691,7 +685,7 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte
if( directory.count < 1 || directory.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "HPAK_GetDataPointer: %s has too many lumps %u.\n", filename, directory.count );
Con_DPrintf( S_ERROR "HPAK_GetDataPointer: %s has too many lumps %u.\n", filename, directory.count );
FS_Close( f );
return false;
}
@@ -751,7 +745,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
file_src = FS_Open( read_path, "rb", false );
if( !file_src )
{
MsgDev( D_ERROR, "%s couldn't open.\n", read_path );
Con_DPrintf( S_ERROR "%s couldn't open.\n", read_path );
return;
}
@@ -761,7 +755,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( !file_dst )
{
MsgDev( D_ERROR, "%s couldn't open.\n", save_path );
Con_DPrintf( S_ERROR "%s couldn't open.\n", save_path );
FS_Close( file_src );
return;
}
@@ -775,7 +769,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( hash_pack_header.ident != IDHPAKHEADER || hash_pack_header.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "%s has invalid header.\n", read_path );
Con_DPrintf( S_ERROR "%s has invalid header.\n", read_path );
FS_Close( file_src );
FS_Close( file_dst );
FS_Delete( save_path ); // delete temp file
@@ -787,7 +781,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( hpak_read.count < 1 || hpak_read.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "%s has invalid number of lumps.\n", read_path );
Con_DPrintf( S_ERROR "%s has invalid number of lumps.\n", read_path );
FS_Close( file_src );
FS_Close( file_dst );
FS_Delete( save_path ); // delete temp file
@@ -796,7 +790,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( hpak_read.count == 1 )
{
MsgDev( D_WARN, "%s only has one element, so HPAK will be removed\n", read_path );
Con_DPrintf( S_WARN "%s only has one element, so HPAK will be removed\n", read_path );
FS_Close( file_src );
FS_Close( file_dst );
FS_Delete( read_path );
@@ -812,7 +806,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( !HPAK_FindResource( &hpak_read, pResource->rgucMD5_hash, NULL ))
{
MsgDev( D_ERROR, "HPAK %s doesn't contain specified lump: %s\n", read_path, pResource->szFileName );
Con_DPrintf( S_ERROR "HPAK doesn't contain specified lump: %s\n", pResource->szFileName, read_path );
Mem_Free( hpak_read.entries );
Mem_Free( hpak_save.entries );
FS_Close( file_src );
@@ -821,7 +815,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
return;
}
MsgDev( D_INFO, "Removing %s from HPAK %s.\n", pResource->szFileName, read_path );
Con_Printf( "Removing %s from HPAK %s.\n", pResource->szFileName, read_path );
// If there's a collision, we've just corrupted this hpak.
for( i = 0, j = 0; i < hpak_read.count; i++ )
@@ -881,7 +875,7 @@ void HPAK_List_f( void )
f = FS_Open( pakname, "rb", false );
if( !f )
{
MsgDev( D_ERROR, "couldn't open %s.\n", pakname );
Con_DPrintf( S_ERROR "couldn't open %s.\n", pakname );
return;
}
@@ -889,14 +883,14 @@ void HPAK_List_f( void )
if( header.ident != IDHPAKHEADER )
{
MsgDev( D_ERROR, "%s is not an HPAK file\n", pakname );
Con_DPrintf( S_ERROR "%s is not an HPAK file\n", pakname );
FS_Close( f );
return;
}
if( header.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
Con_DPrintf( S_ERROR "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
FS_Close( f );
return;
}
@@ -906,7 +900,7 @@ void HPAK_List_f( void )
if( directory.count < 1 || directory.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "%s has too many lumps %u.\n", pakname, directory.count );
Con_DPrintf( S_ERROR "%s has too many lumps %u.\n", pakname, directory.count );
FS_Close( f );
return;
}
@@ -972,7 +966,7 @@ void HPAK_Extract_f( void )
f = FS_Open( pakname, "rb", false );
if( !f )
{
MsgDev( D_ERROR, "couldn't open %s.\n", pakname );
Con_DPrintf( S_ERROR "couldn't open %s.\n", pakname );
return;
}
@@ -980,14 +974,14 @@ void HPAK_Extract_f( void )
if( header.ident != IDHPAKHEADER )
{
MsgDev( D_ERROR, "%s is not an HPAK file\n", pakname );
Con_DPrintf( S_ERROR "%s is not an HPAK file\n", pakname );
FS_Close( f );
return;
}
if( header.version != IDHPAK_VERSION )
{
MsgDev( D_ERROR, "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
Con_DPrintf( S_ERROR "%s has invalid version (%i should be %i).\n", pakname, header.version, IDHPAK_VERSION );
FS_Close( f );
return;
}
@@ -997,7 +991,7 @@ void HPAK_Extract_f( void )
if( directory.count < 1 || directory.count > HPAK_MAX_ENTRIES )
{
MsgDev( D_ERROR, "%s has too many lumps %u.\n", pakname, directory.count );
Con_DPrintf( S_ERROR "%s has too many lumps %u.\n", pakname, directory.count );
FS_Close( f );
return;
}
@@ -1023,7 +1017,7 @@ void HPAK_Extract_f( void )
if( entry->disksize <= 0 || entry->disksize >= HPAK_MAX_SIZE )
{
MsgDev( D_WARN, "Unable to extract data, size invalid: %s\n", Q_memprint( entry->disksize ));
Con_DPrintf( S_WARN "Unable to extract data, size invalid: %s\n", Q_memprint( entry->disksize ));
continue;
}
@@ -1061,7 +1055,7 @@ void HPAK_Remove_f( void )
}
else
{
MsgDev( D_ERROR, "Could not locate resource %i in %s\n", Q_atoi( Cmd_Argv( 2 )), Cmd_Argv( 1 ));
Con_DPrintf( S_ERROR "Could not locate resource %i in %s\n", Q_atoi( Cmd_Argv( 2 )), Cmd_Argv( 1 ));
}
}
+4 -6
View File
@@ -69,13 +69,13 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
if( memcmp( bhdr.id, "BM", 2 ))
{
MsgDev( D_ERROR, "Image_LoadBMP: only Windows-style BMP files supported (%s)\n", name );
Con_DPrintf( S_ERROR "Image_LoadBMP: only Windows-style BMP files supported (%s)\n", name );
return false;
}
if( bhdr.bitmapHeaderSize != 0x28 )
{
MsgDev( D_ERROR, "Image_LoadBMP: invalid header size %i\n", bhdr.bitmapHeaderSize );
Con_DPrintf( S_ERROR "Image_LoadBMP: invalid header size %i\n", bhdr.bitmapHeaderSize );
return false;
}
@@ -83,13 +83,13 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
if( bhdr.fileSize != filesize )
{
// Sweet Half-Life issues. splash.bmp have bogus filesize
MsgDev( D_REPORT, "Image_LoadBMP: %s have incorrect file size %i should be %i\n", name, filesize, bhdr.fileSize );
Con_Reportf( S_WARN "Image_LoadBMP: %s have incorrect file size %i should be %i\n", name, filesize, bhdr.fileSize );
}
// bogus compression? Only non-compressed supported.
if( bhdr.compression != BI_RGB )
{
MsgDev( D_ERROR, "Image_LoadBMP: only uncompressed BMP files supported (%s)\n", name );
Con_DPrintf( S_ERROR "Image_LoadBMP: only uncompressed BMP files supported (%s)\n", name );
return false;
}
@@ -296,7 +296,6 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
if( alpha != 255 ) image.flags |= IMAGE_HAS_ALPHA;
break;
default:
MsgDev( D_ERROR, "Image_LoadBMP: illegal pixel_size (%s)\n", name );
Mem_Free( image.palette );
Mem_Free( image.rgba );
return false;
@@ -354,7 +353,6 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix )
pixel_size = 4;
break;
default:
MsgDev( D_ERROR, "Image_SaveBMP: unsupported image type %s\n", PFDesc[pix->type].name );
return false;
}
+4 -7
View File
@@ -217,7 +217,7 @@ uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
if( filesize != buffsize ) // main check
{
MsgDev( D_WARN, "Image_LoadDDS: (%s) probably corrupted(%i should be %i)\n", name, buffsize, filesize );
Con_DPrintf( S_WARN "Image_LoadDDS: (%s) probably corrupted (%i should be %i)\n", name, buffsize, filesize );
if( buffsize > filesize )
return false;
}
@@ -245,10 +245,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
byte *fin;
if( filesize < sizeof( dds_t ))
{
MsgDev( D_ERROR, "Image_LoadDDS: file (%s) have invalid size\n", name );
return false;
}
memcpy( &header, buffer, sizeof( dds_t ));
@@ -257,13 +254,13 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
if( header.dwSize != sizeof( dds_t ) - sizeof( uint )) // size of the structure (minus MagicNum)
{
MsgDev( D_ERROR, "Image_LoadDDS: (%s) have corrupted header\n", name );
Con_DPrintf( S_ERROR "Image_LoadDDS: (%s) have corrupted header\n", name );
return false;
}
if( header.dsPixelFormat.dwSize != sizeof( dds_pixf_t )) // size of the structure
{
MsgDev( D_ERROR, "Image_LoadDDS: (%s) have corrupt pixelformat header\n", name );
Con_DPrintf( S_ERROR "Image_LoadDDS: (%s) have corrupt pixelformat header\n", name );
return false;
}
@@ -284,7 +281,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
if( image.type == PF_UNKNOWN )
{
MsgDev( D_WARN, "Image_LoadDDS: (%s) has unrecognized type\n", name );
Con_DPrintf( S_ERROR "Image_LoadDDS: (%s) has unrecognized type\n", name );
return false;
}
+6 -7
View File
@@ -60,17 +60,17 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
// uncompressed colormapped image
if( targa_header.pixel_size != 8 )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 8 bit images supported for type 1 and 9\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 8 bit images supported for type 1 and 9\n", name );
return false;
}
if( targa_header.colormap_length != 256 )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 8 bit colormaps are supported for type 1 and 9\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 8 bit colormaps are supported for type 1 and 9\n", name );
return false;
}
if( targa_header.colormap_index )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) colormap_index is not supported for type 1 and 9\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) colormap_index is not supported for type 1 and 9\n", name );
return false;
}
if( targa_header.colormap_size == 24 )
@@ -95,7 +95,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
}
else
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) only 24 and 32 bit colormaps are supported for type 1 and 9\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) only 24 and 32 bit colormaps are supported for type 1 and 9\n", name );
return false;
}
}
@@ -104,7 +104,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
// uncompressed or RLE compressed RGB
if( targa_header.pixel_size != 32 && targa_header.pixel_size != 24 )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 32 or 24 bit images supported for type 2 and 10\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 32 or 24 bit images supported for type 2 and 10\n", name );
return false;
}
}
@@ -113,7 +113,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
// uncompressed greyscale
if( targa_header.pixel_size != 8 )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 8 bit images supported for type 3 and 11\n", name );
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 8 bit images supported for type 3 and 11\n", name );
return false;
}
}
@@ -257,7 +257,6 @@ qboolean Image_SaveTGA( const char *name, rgbdata_t *pix )
case PF_RGBA_32:
case PF_BGRA_32: pixel_size = 4; break;
default:
MsgDev( D_ERROR, "Image_SaveTGA: unsupported image type %s\n", PFDesc[pix->type].name );
Mem_Free( buffer );
return false;
}
+28 -71
View File
@@ -81,36 +81,13 @@ static byte palette_hl[768] =
147,255,247,199,255,255,255,159,91,83
};
static float FILTER[NUM_FILTERS][FILTER_SIZE][FILTER_SIZE] =
{
{ // regular blur
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f, 1.0f, 1.0f, 0.0f },
{ 0.0f, 1.0f, 1.0f, 1.0f, 0.0f },
{ 0.0f, 1.0f, 1.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
},
{ // light blur
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f, 1.0f, 1.0f, 0.0f },
{ 0.0f, 1.0f, 4.0f, 1.0f, 0.0f },
{ 0.0f, 1.0f, 1.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
},
{ // find edges
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, -1.0f, -1.0f, -1.0f, 0.0f },
{ 0.0f, -1.0f, 8.0f, -1.0f, 0.0f },
{ 0.0f, -1.0f, -1.0f, -1.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
},
{ // emboss
static float img_emboss[FILTER_SIZE][FILTER_SIZE] =
{
{-0.7f, -0.7f, -0.7f, -0.7f, 0.0f },
{-0.7f, -0.7f, -0.7f, 0.0f, 0.7f },
{-0.7f, -0.7f, 0.0f, 0.7f, 0.7f },
{-0.7f, 0.0f, 0.7f, 0.7f, 0.7f },
{ 0.0f, 0.7f, 0.7f, 0.7f, 0.7f },
}
};
/*
@@ -1361,7 +1338,7 @@ Filtering algorithm from http://www.student.kuleuven.ac.be/~m0216922/CG/filterin
All credit due
==================
*/
qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias, flFlags_t flags, GLenum blendFunc )
static void Image_ApplyFilter( rgbdata_t *pic, float factor )
{
int i, x, y;
uint *fin, *fout;
@@ -1369,7 +1346,7 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
// first expand the image into 32-bit buffer
pic = Image_DecompressInternal( pic );
factor = bound( 0.0f, factor, 1.0f );
size = image.width * image.height * 4;
image.tempbuffer = Mem_Realloc( host.imagepool, image.tempbuffer, size );
fout = (uint *)image.tempbuffer;
@@ -1381,6 +1358,7 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
{
vec3_t vout = { 0.0f, 0.0f, 0.0f };
int pos_x, pos_y;
float avg;
for( pos_x = 0; pos_x < FILTER_SIZE; pos_x++ )
{
@@ -1391,9 +1369,9 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
// casting's a unary operation anyway, so the othermost set of brackets in the left part
// of the rvalue should not be necessary... but i'm paranoid when it comes to C...
vout[0] += ((float)((byte *)&fin[img_y * image.width + img_x])[0]) * FILTER[filter][pos_x][pos_y];
vout[1] += ((float)((byte *)&fin[img_y * image.width + img_x])[1]) * FILTER[filter][pos_x][pos_y];
vout[2] += ((float)((byte *)&fin[img_y * image.width + img_x])[2]) * FILTER[filter][pos_x][pos_y];
vout[0] += ((float)((byte *)&fin[img_y * image.width + img_x])[0]) * img_emboss[pos_x][pos_y];
vout[1] += ((float)((byte *)&fin[img_y * image.width + img_x])[1]) * img_emboss[pos_x][pos_y];
vout[2] += ((float)((byte *)&fin[img_y * image.width + img_x])[2]) * img_emboss[pos_x][pos_y];
}
}
@@ -1401,20 +1379,17 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
for( i = 0; i < 3; i++ )
{
vout[i] *= factor;
vout[i] += bias;
vout[i] += 128.0f; // base
vout[i] = bound( 0.0f, vout[i], 255.0f );
}
if( flags & FILTER_GRAYSCALE )
{
// NTSC greyscale conversion standard
float avg = (vout[0] * 30.0f + vout[1] * 59.0f + vout[2] * 11.0f) / 100.0f;
// NTSC greyscale conversion standard
avg = (vout[0] * 30.0f + vout[1] * 59.0f + vout[2] * 11.0f) / 100.0f;
// divide by 255 so GL operations work as expected
vout[0] = avg / 255.0f;
vout[1] = avg / 255.0f;
vout[2] = avg / 255.0f;
}
// divide by 255 so GL operations work as expected
vout[0] = avg / 255.0f;
vout[1] = avg / 255.0f;
vout[2] = avg / 255.0f;
// write to temp - first, write data in (to get the alpha channel quickly and
// easily, which will be left well alone by this particular operation...!)
@@ -1429,29 +1404,9 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
float src = ((float)((byte *)&fin[y * image.width + x])[i]) / 255.0f;
float tmp;
switch( blendFunc )
{
case GL_ADD:
tmp = vout[i] + src;
break;
case GL_BLEND:
// default is FUNC_ADD here
// CsS + CdD works out as Src * Dst * 2
tmp = vout[i] * src * 2.0f;
break;
case GL_DECAL:
// same as GL_REPLACE unless there's alpha, which we ignore for this
case GL_REPLACE:
tmp = vout[i];
break;
case GL_ADD_SIGNED:
tmp = (vout[i] + src) - 0.5f;
break;
case GL_MODULATE:
default: // same as default
tmp = vout[i] * src;
break;
}
// default is GL_BLEND here
// CsS + CdD works out as Src * Dst * 2
tmp = vout[i] * src * 2.0f;
// multiply back by 255 to get the proper byte scale
tmp *= 255.0f;
@@ -1466,11 +1421,9 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias
// copy result back
memcpy( fin, fout, size );
return true;
}
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgfilter_t *filter )
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, float bumpscale )
{
rgbdata_t *pic = *pix;
qboolean result = true;
@@ -1483,7 +1436,7 @@ qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgf
return false;
}
if( !flags && !filter )
if( !flags )
{
// clear any force flags
image.force_flags = 0;
@@ -1497,7 +1450,7 @@ qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgf
ClearBits( pic->flags, IMAGE_HAS_LUMA );
}
if( flags & IMAGE_REMAP )
if( FBitSet( flags, IMAGE_REMAP ))
{
// NOTE: user should keep copy of indexed image manually for new changes
if( Image_RemapInternal( pic, width, height ))
@@ -1505,10 +1458,14 @@ qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgf
}
// update format to RGBA if any
if( flags & IMAGE_FORCE_RGBA ) pic = Image_DecompressInternal( pic );
if( flags & IMAGE_LIGHTGAMMA ) pic = Image_LightGamma( pic );
if( FBitSet( flags, IMAGE_FORCE_RGBA ))
pic = Image_DecompressInternal( pic );
if( filter ) Image_ApplyFilter( pic, filter->filter, filter->factor, filter->bias, filter->flags, filter->blendFunc );
if( FBitSet( flags, IMAGE_LIGHTGAMMA ))
pic = Image_LightGamma( pic );
if( FBitSet( flags, IMAGE_EMBOSS ))
Image_ApplyFilter( pic, bumpscale );
out = Image_FlipInternal( pic->buffer, &pic->width, &pic->height, pic->type, flags );
if( pic->buffer != out ) memcpy( pic->buffer, image.tempbuffer, pic->size );
+4 -24
View File
@@ -31,7 +31,7 @@ qboolean Image_LoadPAL( const char *name, const byte *buffer, size_t filesize )
if( filesize != 768 )
{
MsgDev( D_ERROR, "Image_LoadPAL: (%s) have invalid size (%d should be %d)\n", name, filesize, 768 );
Con_DPrintf( S_ERROR "Image_LoadPAL: (%s) have invalid size (%d should be %d)\n", name, filesize, 768 );
return false;
}
@@ -82,7 +82,7 @@ qboolean Image_LoadFNT( const char *name, const byte *buffer, size_t filesize )
int numcolors;
if( image.hint == IL_HINT_Q1 )
return false; // Quake1 doesn't have qfonts
return false; // Quake1 doesn't have qfonts
if( filesize < sizeof( font ))
return false;
@@ -120,8 +120,6 @@ qboolean Image_LoadFNT( const char *name, const byte *buffer, size_t filesize )
}
else
{
if( image.hint == IL_HINT_NO )
MsgDev( D_ERROR, "Image_LoadFNT: (%s) have invalid palette size %d\n", name, numcolors );
return false;
}
@@ -151,7 +149,8 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize )
pixels = image.width * image.height;
fin = (byte *)pin->index; // setup buffer
if( !Image_ValidSize( name )) return false;
if( !Image_ValidSize( name ))
return false;
if( image.hint == IL_HINT_HL )
{
@@ -169,8 +168,6 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize )
}
else
{
if( image.hint == IL_HINT_NO )
MsgDev( D_ERROR, "Image_LoadMDL: lump (%s) is corrupted\n", name );
return false; // unknown or unsupported mode rejected
}
@@ -193,10 +190,7 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, size_t filesize )
if( image.hint == IL_HINT_HL )
{
if( !image.d_currentpal )
{
MsgDev( D_ERROR, "Image_LoadSPR: (%s) palette not installed\n", name );
return false;
}
}
else if( image.hint == IL_HINT_Q1 )
{
@@ -213,10 +207,7 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, size_t filesize )
image.height = pin->height;
if( filesize < image.width * image.height )
{
MsgDev( D_ERROR, "Image_LoadSPR: file (%s) have invalid size\n", name );
return false;
}
if( filesize == ( image.width * image.height * 4 ))
truecolor = true;
@@ -263,10 +254,7 @@ qboolean Image_LoadLMP( const char *name, const byte *buffer, size_t filesize )
int i, pixels;
if( filesize < sizeof( lmp ))
{
MsgDev( D_ERROR, "Image_LoadLMP: file (%s) have invalid size\n", name );
return false;
}
// valve software trick (particle palette)
if( Q_stristr( name, "palette.lmp" ))
@@ -296,10 +284,7 @@ qboolean Image_LoadLMP( const char *name, const byte *buffer, size_t filesize )
pixels = image.width * image.height;
if( filesize < sizeof( lmp ) + pixels )
{
MsgDev( D_ERROR, "Image_LoadLMP: file (%s) have invalid size %d\n", name, filesize );
return false;
}
if( !Image_ValidSize( name ))
return false;
@@ -352,10 +337,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
int reflectivity[3] = { 0, 0, 0 };
if( filesize < sizeof( mip ))
{
MsgDev( D_ERROR, "Image_LoadMIP: file (%s) have invalid size\n", name );
return false;
}
memcpy( &mip, buffer, sizeof( mip ));
image.width = mip.width;
@@ -466,8 +448,6 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
}
else
{
if( image.hint == IL_HINT_NO )
MsgDev( D_ERROR, "Image_LoadMIP: lump (%s) is corrupted\n", name );
return false; // unknown or unsupported mode rejected
}
+1 -1
View File
@@ -49,6 +49,6 @@ const char *COM_OffsetNameForFunction( void *function )
{
static string sname;
Q_snprintf( sname, MAX_STRING, "ofs:%d", (size_t)((byte*)function - (byte*)svgame.dllFuncs.pfnGameInit) );
MsgDev( D_NOTE, "COM_OffsetNameForFunction %s\n", sname );
Con_Reportf( "COM_OffsetNameForFunction %s\n", sname );
return sname;
}
+2 -2
View File
@@ -215,7 +215,7 @@ void NET_SaveMasters( void )
if( !ml.modified )
{
MsgDev( D_NOTE, "Master server list not changed\n" );
Con_Reportf( "Master server list not changed\n" );
return;
}
@@ -223,7 +223,7 @@ void NET_SaveMasters( void )
if( !f )
{
MsgDev( D_ERROR, "Couldn't write xashcomm.lst\n" );
Con_Reportf( S_ERROR "Couldn't write xashcomm.lst\n" );
return;
}
+4 -6
View File
@@ -1771,7 +1771,6 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
int num, max, altmax;
qboolean custom_palette;
char texname[64];
imgfilter_t *filter;
mip_t *mt;
int i, j;
@@ -1823,7 +1822,6 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
// convert to lowercase
Q_strncpy( tx->name, mt->name, sizeof( tx->name ));
Q_strnlwr( tx->name, tx->name, sizeof( tx->name ));
filter = R_FindTexFilter( tx->name ); // grab texture filter
custom_palette = false;
tx->width = mt->width;
@@ -1877,7 +1875,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( FS_FileExists( texpath, false ))
{
tx->gl_texturenum = GL_LoadTexture( texpath, NULL, 0, 0, filter );
tx->gl_texturenum = GL_LoadTexture( texpath, NULL, 0, TF_ALLOW_EMBOSS );
bmod->wadlist.wadusage[j]++; // this wad are really used
break;
}
@@ -1893,7 +1891,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( custom_palette ) size += sizeof( short ) + 768;
Q_snprintf( texname, sizeof( texname ), "#%s:%s.mip", loadstat.name, mt->name );
tx->gl_texturenum = GL_LoadTexture( texname, (byte *)mt, size, 0, filter );
tx->gl_texturenum = GL_LoadTexture( texname, (byte *)mt, size, TF_ALLOW_EMBOSS );
}
// if texture is completely missed
@@ -1916,7 +1914,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
int size = (int)sizeof( mip_t ) + ((mt->width * mt->height * 85)>>6);
if( custom_palette ) size += sizeof( short ) + 768;
tx->fb_texturenum = GL_LoadTexture( texname, (byte *)mt, size, TF_MAKELUMA, NULL );
tx->fb_texturenum = GL_LoadTexture( texname, (byte *)mt, size, TF_MAKELUMA );
}
else
{
@@ -1941,7 +1939,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
}
// okay, loading it from wad or hi-res version
tx->fb_texturenum = GL_LoadTexture( texname, src, srcSize, TF_MAKELUMA, NULL );
tx->fb_texturenum = GL_LoadTexture( texname, src, srcSize, TF_MAKELUMA );
if( src ) Mem_Free( src );
}
}
+8 -5
View File
@@ -207,6 +207,7 @@ void Mod_Shutdown( void )
==================
Mod_FindName
never return NULL
==================
*/
model_t *Mod_FindName( const char *filename, qboolean trackCRC )
@@ -214,9 +215,6 @@ model_t *Mod_FindName( const char *filename, qboolean trackCRC )
char modname[MAX_QPATH];
model_t *mod;
int i;
if( !COM_CheckString( filename ))
return NULL;
Q_strncpy( modname, filename, sizeof( modname ));
@@ -399,7 +397,12 @@ Loads in a model for the given name
*/
model_t *Mod_ForName( const char *name, qboolean crash, qboolean trackCRC )
{
model_t *mod = Mod_FindName( name, trackCRC );
model_t *mod;
if( !COM_CheckString( name ))
return NULL;
mod = Mod_FindName( name, trackCRC );
return Mod_LoadModel( mod, crash );
}
@@ -624,7 +627,7 @@ model_t *GAME_EXPORT Mod_Handle( int handle )
{
if( handle < 0 || handle >= MAX_MODELS )
{
MsgDev( D_NOTE, "Mod_Handle: bad handle #%i\n", handle );
Con_Reportf( "Mod_Handle: bad handle #%i\n", handle );
return NULL;
}
return &mod_known[handle];
+17 -17
View File
@@ -618,7 +618,7 @@ static int NET_StringToSockaddr( const char *s, struct sockaddr *sadr, qboolean
}
else // failed to create thread
{
MsgDev( D_ERROR, "NET_StringToSockaddr: failed to create thread!\n");
Con_Reportf( S_ERROR "NET_StringToSockaddr: failed to create thread!\n");
nsthread.busy = false;
}
}
@@ -765,7 +765,7 @@ qboolean NET_CompareAdr( const netadr_t a, const netadr_t b )
return false;
}
MsgDev( D_ERROR, "NET_CompareAdr: bad address type\n" );
Con_DPrintf( S_ERROR "NET_CompareAdr: bad address type\n" );
return false;
}
@@ -1230,7 +1230,7 @@ qboolean NET_QueuePacket( netsrc_t sock, netadr_t *from, byte *data, size_t *len
}
else
{
MsgDev( D_REPORT, "NET_QueuePacket: oversize packet from %s\n", NET_AdrToString( *from ));
Con_Reportf( "NET_QueuePacket: oversize packet from %s\n", NET_AdrToString( *from ));
}
}
else
@@ -1245,7 +1245,7 @@ qboolean NET_QueuePacket( netsrc_t sock, netadr_t *from, byte *data, size_t *len
case WSAEMSGSIZE:
break;
default: // let's continue even after errors
MsgDev( D_ERROR, "NET_QueuePacket: %s from %s\n", NET_ErrorString(), NET_AdrToString( *from ));
Con_DPrintf( S_ERROR "NET_QueuePacket: %s from %s\n", NET_ErrorString(), NET_AdrToString( *from ));
break;
}
}
@@ -1395,11 +1395,11 @@ void NET_SendPacket( netsrc_t sock, size_t length, const void *data, netadr_t to
if( Host_IsDedicated() )
{
MsgDev( D_ERROR, "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to ));
Con_DPrintf( S_ERROR "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to ));
}
else if( err == WSAEADDRNOTAVAIL || err == WSAENOBUFS )
{
MsgDev( D_ERROR, "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to ));
Con_DPrintf( S_ERROR "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to ));
}
else
{
@@ -1487,13 +1487,13 @@ static int NET_IPSocket( const char *net_interface, int port, qboolean multicast
{
err = pWSAGetLastError();
if( err != WSAEAFNOSUPPORT )
MsgDev( D_WARN, "NET_UDPSocket: socket = %s\n", NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port: %d socket: %s\n", port, NET_ErrorString( ));
return INVALID_SOCKET;
}
if( NET_IsSocketError( pIoctlSocket( net_socket, FIONBIO, &_true ) ) )
{
MsgDev( D_WARN, "NET_UDPSocket: ioctlsocket FIONBIO = %s\n", NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port: %d ioctl FIONBIO: %s\n", port, NET_ErrorString( ));
pCloseSocket( net_socket );
return INVALID_SOCKET;
}
@@ -1501,7 +1501,7 @@ static int NET_IPSocket( const char *net_interface, int port, qboolean multicast
// make it broadcast capable
if( NET_IsSocketError( pSetSockopt( net_socket, SOL_SOCKET, SO_BROADCAST, (char *)&_true, sizeof( _true ) ) ) )
{
MsgDev( D_WARN, "NET_UDPSocket: setsockopt SO_BROADCAST = %s\n", NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port: %d setsockopt SO_BROADCAST: %s\n", port, NET_ErrorString( ));
pCloseSocket( net_socket );
return INVALID_SOCKET;
}
@@ -1510,7 +1510,7 @@ static int NET_IPSocket( const char *net_interface, int port, qboolean multicast
{
if( NET_IsSocketError( pSetSockopt( net_socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&optval, sizeof( optval )) ) )
{
MsgDev( D_WARN, "NET_UDPSocket: port: %d setsockopt SO_REUSEADDR: %s\n", port, NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port: %d setsockopt SO_REUSEADDR: %s\n", port, NET_ErrorString( ));
pCloseSocket( net_socket );
return INVALID_SOCKET;
}
@@ -1542,7 +1542,7 @@ static int NET_IPSocket( const char *net_interface, int port, qboolean multicast
if( NET_IsSocketError( pBind( net_socket, (void *)&addr, sizeof( addr )) ) )
{
MsgDev( D_WARN, "NET_UDPSocket: port: %d bind: %s\n", port, NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port: %d bind: %s\n", port, NET_ErrorString( ));
pCloseSocket( net_socket );
return INVALID_SOCKET;
}
@@ -1551,7 +1551,7 @@ static int NET_IPSocket( const char *net_interface, int port, qboolean multicast
{
optval = 1;
if( NET_IsSocketError( pSetSockopt( net_socket, IPPROTO_IP, IP_MULTICAST_LOOP, (const char *)&optval, sizeof( optval )) ) )
MsgDev( D_WARN, "NET_UDPSocket: port %d setsockopt IP_MULTICAST_LOOP: %s\n", port, NET_ErrorString( ));
Con_DPrintf( S_WARN "NET_UDPSocket: port %d setsockopt IP_MULTICAST_LOOP: %s\n", port, NET_ErrorString( ));
}
return net_socket;
@@ -1632,7 +1632,7 @@ void NET_GetLocalAddress( void )
if( NET_IsSocketError( pGetSockName( net.ip_sockets[NS_SERVER], (struct sockaddr *)&address, &namelen ) ) )
{
// this may happens if multiple clients running on single machine
MsgDev( D_ERROR, "Could not get TCP/IP address. Reason: %s\n", NET_ErrorString( ));
Con_DPrintf( S_ERROR "Could not get TCP/IP address. Reason: %s\n", NET_ErrorString( ));
// net.allow_ip = false;
}
else
@@ -1644,7 +1644,7 @@ void NET_GetLocalAddress( void )
}
else
{
MsgDev( D_ERROR, "Could not get TCP/IP address, Invalid hostname: '%s'\n", buff );
Con_DPrintf( S_ERROR "Could not get TCP/IP address, Invalid hostname: '%s'\n", buff );
}
}
else
@@ -1802,13 +1802,13 @@ void NET_Init( void )
#ifdef _WIN32
if( !NET_OpenWinSock( )) // loading wsock32.dll
{
MsgDev( D_ERROR, "network failed to load wsock32.dll.\n" );
Con_DPrintf( S_ERROR "network failed to load wsock32.dll.\n" );
return;
}
if( pWSAStartup( MAKEWORD( 1, 1 ), &net.winsockdata ))
{
MsgDev( D_ERROR, "network initialization failed.\n" );
Con_DPrintf( S_ERROR "network initialization failed.\n" );
NET_FreeWinSock();
return;
}
@@ -1831,7 +1831,7 @@ void NET_Init( void )
net.sequence_number = 1;
net.initialized = true;
MsgDev( D_REPORT, "Base networking initialized.\n" );
Con_Reportf( "Base networking initialized.\n" );
}
+28 -28
View File
@@ -134,10 +134,10 @@ Sequence_WriteDefaults
void Sequence_WriteDefaults( sequenceCommandLine_s *source, sequenceCommandLine_s *destination )
{
if( !destination )
MsgDev( D_ERROR, "Attempt to bake defaults into a non-existant command." );
Con_Reportf( S_ERROR "Attempt to bake defaults into a non-existant command." );
if( !source )
MsgDev( D_ERROR, "Attempt to bake defaults from a non-existant command." );
Con_Reportf( S_ERROR "Attempt to bake defaults from a non-existant command." );
if( source->modifierBitField & SEQUENCE_MODIFIER_EFFECT_BIT )
{
@@ -215,10 +215,10 @@ void Sequence_BakeDefaults( sequenceCommandLine_s *destination, sequenceCommandL
char *saveName, *saveMessage;
if( !destination )
MsgDev( D_ERROR, "Attempt to bake defaults into a non-existant command." );
Con_Reportf( S_ERROR "Attempt to bake defaults into a non-existant command." );
if( !source )
MsgDev( D_ERROR, "Attempt to bake defaults from a non-existant command." );
Con_Reportf( S_ERROR "Attempt to bake defaults from a non-existant command." );
saveName= destination->clientMessage.pName;
saveMessage = destination->clientMessage.pMessage;
@@ -325,9 +325,9 @@ size_t Sequence_GetNameValueString( char *token, size_t len )
if( !Sequence_IsNameValueChar( *g_scan ) )
{
if( *g_scan == '#' || *g_scan == '$' )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: cannot have more than one '%c' per line; '%c' must be at the beginning of the line ONLY\n", g_lineNum, g_sequenceParseFileName, *g_scan, *g_scan );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: cannot have more than one '%c' per line; '%c' must be at the beginning of the line ONLY\n", g_lineNum, g_sequenceParseFileName, *g_scan, *g_scan );
else
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: expected name/value, found illegal character '%c'\n", g_lineNum, g_sequenceParseFileName, *g_scan );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: expected name/value, found illegal character '%c'\n", g_lineNum, g_sequenceParseFileName, *g_scan );
}
for( p = token; Sequence_IsNameValueChar( *g_scan ) && len; p++, g_scan++, len-- )
@@ -373,7 +373,7 @@ void Sequence_ValidateNameValueString( char *token )
for( scan = token; *scan; scan++ )
{
if( !Sequence_IsNameValueChar( *scan ) )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: name/value string \"%s\" had illegal character '%c'\n", g_lineNum, g_sequenceParseFileName, token, *scan );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: name/value string \"%s\" had illegal character '%c'\n", g_lineNum, g_sequenceParseFileName, token, *scan );
}
}
@@ -393,7 +393,7 @@ size_t Sequence_GetToken( char *token, size_t size )
}
if( !Sequence_IsSymbol( *g_scan ) )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: expected token, found '%c' instead\n", g_lineNum, g_sequenceParseFileName, *g_scan );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: expected token, found '%c' instead\n", g_lineNum, g_sequenceParseFileName, *g_scan );
token[0] = *g_scan++;
token[1] = 0;
@@ -419,12 +419,12 @@ size_t Sequence_GetLine( char *line, int lineMaxLen )
read = Q_strchr( g_scan, '\n' );
if( !read )
MsgDev( D_ERROR, "Syntax Error on line %d of %s.seq: expected sentence definition or '}', found End-Of-File!\n", g_lineNum, g_sequenceParseFileName );
Con_Reportf( S_ERROR "Syntax Error on line %d of %s.seq: expected sentence definition or '}', found End-Of-File!\n", g_lineNum, g_sequenceParseFileName );
lineLen = read - g_scan;
if( lineLen >= lineMaxLen )
MsgDev( D_ERROR, "Syntax Error on line %d of %s.seq: line was too long (was %d chars; max is %d chars)\n", g_lineNum, g_sequenceParseFileName, lineLen, lineMaxLen - 1 );
Con_Reportf( S_ERROR "Syntax Error on line %d of %s.seq: line was too long (was %d chars; max is %d chars)\n", g_lineNum, g_sequenceParseFileName, lineLen, lineMaxLen - 1 );
Q_strncpy( write, g_scan, lineLen );
write[lineLen] = 0;
@@ -560,7 +560,7 @@ void Sequence_ReadQuotedString( char **dest, char *str, size_t len )
ch = Sequence_GetSymbol( );
if( ch != '\"' )
MsgDev( D_ERROR, "Parsing error on or before line %d of %s.seq: expected quote (\"), found '%c' instead\n", g_lineNum, g_sequenceParseFileName, ch );
Con_Reportf( S_ERROR "Parsing error on or before line %d of %s.seq: expected quote (\"), found '%c' instead\n", g_lineNum, g_sequenceParseFileName, ch );
for( write = str; *g_scan && len; write++, g_scan++, len-- )
{
@@ -609,7 +609,7 @@ qboolean Sequence_IsCommandAModifier( sequenceCommandEnum_e commandEnum )
return ( g_sequenceCommandMappingTable[i].commandType == SEQUENCE_TYPE_MODIFIER );
}
MsgDev( D_ERROR, "Internal error caused by line %d of %s.seq: unknown command enum = %d\n", g_lineNum, g_sequenceParseFileName, commandEnum );
Con_Reportf( S_ERROR "Internal error caused by line %d of %s.seq: unknown command enum = %d\n", g_lineNum, g_sequenceParseFileName, commandEnum );
return false;
}
@@ -712,7 +712,7 @@ void Sequence_ReadCommandData( sequenceCommandEnum_e commandEnum, sequenceComman
break;
default:
MsgDev( D_ERROR, "Internal error caused by line %d of %s.seq: unknown command enum = %d\n", g_lineNum, g_sequenceParseFileName, commandEnum );
Con_Reportf( S_ERROR "Internal error caused by line %d of %s.seq: unknown command enum = %d\n", g_lineNum, g_sequenceParseFileName, commandEnum );
}
}
@@ -732,20 +732,20 @@ char Sequence_ParseModifier( sequenceCommandLine_s *defaults )
modifierEnum = Sequence_GetCommandEnumForName( modifierName, SEQUENCE_TYPE_MODIFIER );
if( modifierEnum == SEQUENCE_COMMAND_ERROR )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: unknown modifier \"%s\"\n", g_lineNum, g_sequenceParseFileName, modifierName );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: unknown modifier \"%s\"\n", g_lineNum, g_sequenceParseFileName, modifierName );
if( !Sequence_IsCommandAModifier( modifierEnum ) )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: \"%s\" is a #command, not a $modifier\n", g_lineNum, g_sequenceParseFileName, modifierName );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: \"%s\" is a #command, not a $modifier\n", g_lineNum, g_sequenceParseFileName, modifierName );
delimiter = Sequence_GetSymbol( );
if( delimiter != '=' )
MsgDev( D_ERROR, "Parsing error on or after line %d of %s.seq: after modifier \"%s\", expected '=', found '%c'\n", g_lineNum, g_sequenceParseFileName, modifierName, delimiter );
Con_Reportf( S_ERROR "Parsing error on or after line %d of %s.seq: after modifier \"%s\", expected '=', found '%c'\n", g_lineNum, g_sequenceParseFileName, modifierName, delimiter );
Sequence_ReadCommandData( modifierEnum, defaults );
if( !Sequence_ConfirmCarriageReturnOrSymbol( ',' ) )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: after value(s) for modifier \"%s\", expected ',' or End-Of-Line; found '%c'\n", g_lineNum, g_sequenceParseFileName, modifierName, *g_scan );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: after value(s) for modifier \"%s\", expected ',' or End-Of-Line; found '%c'\n", g_lineNum, g_sequenceParseFileName, modifierName, *g_scan );
return Sequence_GetSymbol( );
}
@@ -818,7 +818,7 @@ char Sequence_ParseCommand( sequenceCommandLine_s *newCommandLine )
commandEnum = Sequence_GetCommandEnumForName( commandName, SEQUENCE_TYPE_COMMAND );
if( commandEnum == SEQUENCE_COMMAND_ERROR )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: unknown command \"%s\"\n", g_lineNum, g_sequenceParseFileName, commandName );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: unknown command \"%s\"\n", g_lineNum, g_sequenceParseFileName, commandName );
if( Sequence_IsCommandAModifier( commandEnum ) )
{
@@ -834,7 +834,7 @@ char Sequence_ParseCommand( sequenceCommandLine_s *newCommandLine )
ch = Sequence_GetSymbol( );
if( ch != '=' )
MsgDev( D_ERROR, "Parsing error on or before line %d of %s.seq: after command \"%s\", expected '=', found '%c'\n",
Con_Reportf( S_ERROR "Parsing error on or before line %d of %s.seq: after command \"%s\", expected '=', found '%c'\n",
g_lineNum, g_sequenceParseFileName, commandName, ch );
Sequence_ReadCommandData( commandEnum, newCommandLine );
@@ -921,7 +921,7 @@ char Sequence_ParseLine( char start, sequenceEntry_s *entry )
break;
default:
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: line must begin with either '#' (command) or '$' (modifier); found '%c'\n", g_lineNum, g_sequenceParseFileName, start );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: line must begin with either '#' (command) or '$' (modifier); found '%c'\n", g_lineNum, g_sequenceParseFileName, start );
}
return end;
@@ -1036,7 +1036,7 @@ char Sequence_ParseEntry( void )
symbol = Sequence_GetSymbol( );
if( symbol != '{' )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: expected '{' to start a\n new entry block; found '%c' instead!", g_lineNum, g_sequenceParseFileName, symbol );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: expected '{' to start a\n new entry block; found '%c' instead!", g_lineNum, g_sequenceParseFileName, symbol );
entry = Z_Malloc( sizeof( sequenceEntry_s ) );
Sequence_ResetDefaults( &g_blockScopeDefaults, &g_fileScopeDefaults );
@@ -1054,7 +1054,7 @@ char Sequence_ParseEntry( void )
}
if( !Sequence_IsEntrySafe( entry ) )
MsgDev( D_ERROR, "Logic error in file %s.seq before line %d: execution of entry \"%%%s\" would cause an infinite loop!", g_sequenceParseFileName, g_lineNum, entry->entryName );
Con_Reportf( S_ERROR "Logic error in file %s.seq before line %d: execution of entry \"%%%s\" would cause an infinite loop!", g_sequenceParseFileName, g_lineNum, entry->entryName );
entry->nextEntry = g_sequenceList;
g_sequenceList = entry;
@@ -1193,7 +1193,7 @@ void Sequence_AddSentenceToGroup( char *groupName, char *data )
group = Sequence_AddSentenceGroup( groupName );
if( !group )
MsgDev( D_ERROR, "Unable to allocate sentence group %s at line %d in file %s.seq", groupName, g_lineNum, g_sequenceParseFileName );
Con_Reportf( S_ERROR "Unable to allocate sentence group %s at line %d in file %s.seq", groupName, g_lineNum, g_sequenceParseFileName );
}
entry = Z_Malloc( sizeof( sentenceEntry_s ) );
@@ -1270,7 +1270,7 @@ char Sequence_ParseSentenceBlock( void )
qboolean end = false;
char ch = Sequence_GetSymbol( );
if( ch != '{' )
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: expected '{' to start a\n new sentence block; found '%c' instead!", g_lineNum, g_sequenceParseFileName, ch );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: expected '{' to start a\n new sentence block; found '%c' instead!", g_lineNum, g_sequenceParseFileName, ch );
while( !end )
{
@@ -1293,7 +1293,7 @@ char Sequence_ParseGlobalDataBlock( void )
Sequence_GetNameValueString( token, MAX_STRING );
if( Q_stricmp( token, "Sentences" ) )
MsgDev( D_ERROR, "Syntax error in file %s.seq on line %d: found global data block symbol '!' with unknown data type \"%s\"", g_sequenceParseFileName, g_lineNum, token );
Con_Reportf( S_ERROR "Syntax error in file %s.seq on line %d: found global data block symbol '!' with unknown data type \"%s\"", g_sequenceParseFileName, g_lineNum, token );
return Sequence_ParseSentenceBlock( );
}
@@ -1401,12 +1401,12 @@ qboolean Sequence_ExpandGosubsForEntry( sequenceEntry_s *entry )
continue;
if( !Q_stricmp( cmd->clientMessage.pName, entry->entryName ) )
MsgDev( D_ERROR, "Error in %s.seq: entry \"%s\" gosubs itself!\n", entry->fileName, entry->entryName );
Con_Reportf( S_ERROR "Error in %s.seq: entry \"%s\" gosubs itself!\n", entry->fileName, entry->entryName );
gosubEntry = Sequence_GetEntryForName( cmd->clientMessage.pName );
if( !gosubEntry )
MsgDev( D_ERROR, "Error in %s.seq: Gosub in entry \"%s\" specified unknown entry \"%s\"\n", entry->fileName, entry->entryName, cmd->clientMessage.pName );
Con_Reportf( S_ERROR "Error in %s.seq: Gosub in entry \"%s\" specified unknown entry \"%s\"\n", entry->fileName, entry->entryName, cmd->clientMessage.pName );
foundGosubs = true;
copyList = Sequence_CopyCommandList( gosubEntry->firstCommand );
@@ -1537,7 +1537,7 @@ void Sequence_ParseBuffer( byte *buffer, int bufferSize )
break;
default:
MsgDev( D_ERROR, "Parsing error on line %d of %s.seq: At file scope, lines must begin with '$' (modifier) or '%%' (entry block) or '!' (sentence / global data block); found '%c'\n", g_lineNum, g_sequenceParseFileName, symbol );
Con_Reportf( S_ERROR "Parsing error on line %d of %s.seq: At file scope, lines must begin with '$' (modifier) or '%%' (entry block) or '!' (sentence / global data block); found '%c'\n", g_lineNum, g_sequenceParseFileName, symbol );
}
}
+1 -1
View File
@@ -118,7 +118,7 @@ load_internal:
}
if( filename[0] != '#' )
Con_Reportf( S_WARN "FS_LoadSound: couldn't load \"%s\"\n", loadname );
Con_DPrintf( S_WARN "FS_LoadSound: couldn't load \"%s\"\n", loadname );
return NULL;
}
+8 -8
View File
@@ -71,16 +71,16 @@ qboolean Sound_LoadMPG( const char *name, const byte *buffer, size_t filesize )
return false;
#ifdef _DEBUG
if( ret ) MsgDev( D_ERROR, "%s\n", get_error( mpeg ));
if( ret ) Con_DPrintf( S_ERROR "%s\n", get_error( mpeg ));
#endif
// trying to read header
if( !feed_mpeg_header( mpeg, buffer, FRAME_SIZE, filesize, &sc ))
{
#ifdef _DEBUG
MsgDev( D_ERROR, "Sound_LoadMPG: failed to load (%s): %s\n", name, get_error( mpeg ));
Con_DPrintf( S_ERROR "Sound_LoadMPG: failed to load (%s): %s\n", name, get_error( mpeg ));
#else
MsgDev( D_ERROR, "Sound_LoadMPG: (%s) is probably corrupted\n", name );
Con_DPrintf( S_ERROR "Sound_LoadMPG: (%s) is probably corrupted\n", name );
#endif
close_decoder( mpeg );
return false;
@@ -97,7 +97,7 @@ qboolean Sound_LoadMPG( const char *name, const byte *buffer, size_t filesize )
if( !sound.size )
{
// bad mpeg file ?
MsgDev( D_ERROR, "Sound_LoadMPG: (%s) is probably corrupted\n", name );
Con_DPrintf( S_ERROR "Sound_LoadMPG: (%s) is probably corrupted\n", name );
close_decoder( mpeg );
return false;
}
@@ -164,22 +164,22 @@ stream_t *Stream_OpenMPG( const char *filename )
// couldn't create decoder
if(( mpeg = create_decoder( &ret )) == NULL )
{
MsgDev( D_ERROR, "Stream_OpenMPG: couldn't create decoder\n" );
Con_DPrintf( S_ERROR "Stream_OpenMPG: couldn't create decoder\n" );
Mem_Free( stream );
FS_Close( file );
return NULL;
}
#ifdef _DEBUG
if( ret ) MsgDev( D_ERROR, "%s\n", get_error( mpeg ));
if( ret ) Con_DPrintf( S_ERROR "%s\n", get_error( mpeg ));
#endif
// trying to open stream and read header
if( !open_mpeg_stream( mpeg, file, FS_Read, FS_Seek, &sc ))
{
#ifdef _DEBUG
MsgDev( D_ERROR, "Stream_OpenMPG: failed to load (%s): %s\n", filename, get_error( mpeg ));
Con_DPrintf( S_ERROR "Stream_OpenMPG: failed to load (%s): %s\n", filename, get_error( mpeg ));
#else
MsgDev( D_ERROR, "Stream_OpenMPG: (%s) is probably corrupted\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenMPG: (%s) is probably corrupted\n", filename );
#endif
close_decoder( mpeg );
Mem_Free( stream );
+13 -13
View File
@@ -155,7 +155,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
if( !( iff_dataPtr && !Q_strncmp( iff_dataPtr + 8, "WAVE", 4 )))
{
MsgDev( D_ERROR, "Sound_LoadWAV: %s missing 'RIFF/WAVE' chunks\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: %s missing 'RIFF/WAVE' chunks\n", name );
return false;
}
@@ -165,7 +165,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
if( !iff_dataPtr )
{
MsgDev( D_ERROR, "Sound_LoadWAV: %s missing 'fmt ' chunk\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: %s missing 'fmt ' chunk\n", name );
return false;
}
@@ -176,7 +176,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
{
if( fmt != 85 )
{
MsgDev( D_ERROR, "Sound_LoadWAV: %s not a microsoft PCM format\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: %s not a microsoft PCM format\n", name );
return false;
}
else
@@ -189,7 +189,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
sound.channels = GetLittleShort();
if( sound.channels != 1 && sound.channels != 2 )
{
MsgDev( D_ERROR, "Sound_LoadWAV: only mono and stereo WAV files supported (%s)\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: only mono and stereo WAV files supported (%s)\n", name );
return false;
}
@@ -201,7 +201,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
if( sound.width != 1 && sound.width != 2 )
{
MsgDev( D_WARN, "Sound_LoadWAV: only 8 and 16 bit WAV files supported (%s)\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: only 8 and 16 bit WAV files supported (%s)\n", name );
return false;
}
@@ -235,7 +235,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
if( !iff_dataPtr )
{
MsgDev( D_WARN, "Sound_LoadWAV: %s missing 'data' chunk\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: %s missing 'data' chunk\n", name );
return false;
}
@@ -246,7 +246,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
{
if( samples < sound.samples )
{
MsgDev( D_ERROR, "Sound_LoadWAV: %s has a bad loop length\n", name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: %s has a bad loop length\n", name );
return false;
}
}
@@ -254,7 +254,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
if( sound.samples <= 0 )
{
MsgDev( D_ERROR, "Sound_LoadWAV: file with %i samples (%s)\n", sound.samples, name );
Con_DPrintf( S_ERROR "Sound_LoadWAV: file with %i samples (%s)\n", sound.samples, name );
return false;
}
@@ -326,7 +326,7 @@ stream_t *Stream_OpenWAV( const char *filename )
// find "RIFF" chunk
if( !StreamFindNextChunk( file, "RIFF", &last_chunk ))
{
MsgDev( D_ERROR, "Stream_OpenWAV: %s missing RIFF chunk\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing RIFF chunk\n", filename );
FS_Close( file );
return NULL;
}
@@ -334,7 +334,7 @@ stream_t *Stream_OpenWAV( const char *filename )
FS_Read( file, chunkName, 4 );
if( !Q_strncmp( chunkName, "WAVE", 4 ))
{
MsgDev( D_ERROR, "Stream_OpenWAV: %s missing WAVE chunk\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing WAVE chunk\n", filename );
FS_Close( file );
return NULL;
}
@@ -344,7 +344,7 @@ stream_t *Stream_OpenWAV( const char *filename )
last_chunk = iff_data;
if( !StreamFindNextChunk( file, "fmt ", &last_chunk ))
{
MsgDev( D_ERROR, "Stream_OpenWAV: %s missing 'fmt ' chunk\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing 'fmt ' chunk\n", filename );
FS_Close( file );
return NULL;
}
@@ -354,7 +354,7 @@ stream_t *Stream_OpenWAV( const char *filename )
FS_Read( file, &t, sizeof( t ));
if( t != 1 )
{
MsgDev( D_ERROR, "Stream_OpenWAV: %s not a microsoft PCM format\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenWAV: %s not a microsoft PCM format\n", filename );
FS_Close( file );
return NULL;
}
@@ -375,7 +375,7 @@ stream_t *Stream_OpenWAV( const char *filename )
last_chunk = iff_data;
if( !StreamFindNextChunk( file, "data", &last_chunk ))
{
MsgDev( D_ERROR, "Stream_OpenWAV: %s missing 'data' chunk\n", filename );
Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing 'data' chunk\n", filename );
FS_Close( file );
return NULL;
}
+2 -2
View File
@@ -77,7 +77,7 @@ char *Sys_Input( void )
void Sys_DestroyConsole( void )
{
// last text message into console or log
MsgDev( D_NOTE, "Sys_DestroyConsole: Exiting!\n" );
Con_Reportf( "Sys_DestroyConsole: Exiting!\n" );
#ifdef _WIN32
Wcon_DestroyConsole();
#endif
@@ -113,7 +113,7 @@ void Sys_InitLog( void )
if( s_ld.log_active )
{
s_ld.logfile = fopen( s_ld.log_path, mode );
if( !s_ld.logfile ) MsgDev( D_ERROR, "Sys_InitLog: can't create log file %s\n", s_ld.log_path );
if( !s_ld.logfile ) Con_Reportf( S_ERROR "Sys_InitLog: can't create log file %s\n", s_ld.log_path );
fprintf( s_ld.logfile, "=================================================================================\n" );
fprintf( s_ld.logfile, "\t%s (build %i) started at %s\n", s_ld.title, Q_buildnum(), Q_timestamp( TIME_FULL ));
+7 -7
View File
@@ -302,7 +302,7 @@ void Sys_ShellExecute( const char *path, const char *parms, int shouldExit )
_exit( 1 );
}
}
else MsgDev( D_WARN, "Could not find "OPEN_COMMAND" utility\n" );
else Con_Reportf( S_WARN "Could not find "OPEN_COMMAND" utility\n" );
#elif defined(__ANDROID__) && !defined(XASH_DEDICATED)
Android_ShellExecute( path, parms );
#endif
@@ -450,7 +450,7 @@ qboolean Sys_LoadLibrary( dll_info_t *dll )
if( !dll->name || !*dll->name )
return false; // nothing to load
MsgDev( D_NOTE, "Sys_LoadLibrary: Loading %s", dll->name );
Con_Reportf( "Sys_LoadLibrary: Loading %s", dll->name );
if( dll->fcts )
{
@@ -477,14 +477,14 @@ qboolean Sys_LoadLibrary( dll_info_t *dll )
goto error;
}
}
MsgDev( D_NOTE, " - ok\n" );
Con_Reportf( " - ok\n" );
return true;
error:
MsgDev( D_NOTE, " - failed\n" );
Con_Reportf( " - failed\n" );
Sys_FreeLibrary( dll ); // trying to free
if( dll->crash ) Sys_Error( "%s", errorstring );
else MsgDev( D_ERROR, "%s", errorstring );
else Con_Reportf( S_ERROR "%s", errorstring );
return false;
}
@@ -506,10 +506,10 @@ qboolean Sys_FreeLibrary( dll_info_t *dll )
if( host.status == HOST_CRASHED )
{
// we need to hold down all modules, while MSVC can find error
MsgDev( D_NOTE, "Sys_FreeLibrary: hold %s for debugging\n", dll->name );
Con_Reportf( "Sys_FreeLibrary: hold %s for debugging\n", dll->name );
return false;
}
else MsgDev( D_NOTE, "Sys_FreeLibrary: Unloading %s\n", dll->name );
else Con_Reportf( "Sys_FreeLibrary: Unloading %s\n", dll->name );
FreeLibrary( dll->link );
dll->link = NULL;
-1
View File
@@ -129,7 +129,6 @@ char *Wcon_Input( void );
// text messages
#define Msg Con_Printf
void MsgDev( int level, const char *pMsg, ... ) _format( 2 );
#ifdef __cplusplus
}