a breakable with a underscore in it's name will now try and load files from it's parent if it cant find any itself

ex glass_blue will load sounds from glass if there is no glass_blue/sounds/break1.wav
This commit is contained in:
Scott Brooks 2002-06-06 03:01:46 +00:00
parent 5c6ddb1c72
commit 8dca6af6c5
2 changed files with 105 additions and 45 deletions

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.73 2002/06/06 03:01:46 blaze
// a breakable with a underscore in it's name will now try and load files from it's parent if it cant find any itself
// ex glass_blue will load sounds from glass if there is no glass_blue/sounds/break1.wav
//
// Revision 1.72 2002/06/06 01:53:51 niceass
// pressure change
//
@ -1170,6 +1174,29 @@ static void CG_RegisterSounds( void ) {
}
//===================================================================================
/*
=================
CG_CheckFile
This function checks to see if a file exists
=================
*/
static qboolean CG_CheckFile(const char *fpath)
{
fileHandle_t f;
int len;
len = trap_FS_FOpenFile( fpath, &f, FS_READ ) ;
if(len == -1)
{
trap_FS_FCloseFile( f );
return qfalse;
}
trap_FS_FCloseFile( f );
return qtrue;
}
//===================================================================================
/*
=================
@ -1182,6 +1209,8 @@ static void CG_RegisterBreakables(void){
int i,id;
const char *breakInfo;
const char *name;
char baseName[80];
CG_Printf("In registerbreakables\n");
for (i=0;i < RQ3_MAX_BREAKABLES; i++)
{
@ -1195,14 +1224,46 @@ static void CG_RegisterBreakables(void){
name = Info_ValueForKey(breakInfo,"type");
Com_Printf("Registering breakable %s ID=%d\n",name, id);
//Blaze: Breakable stuff - register the models, sounds, and explosion shader
if (CG_CheckFile(va("breakables/%s/models/break1.md3",name)) == qtrue)
{
cgs.media.breakables[id].model[0] = trap_R_RegisterModel( va("breakables/%s/models/break1.md3",name));
cgs.media.breakables[id].model[1] = trap_R_RegisterModel( va("breakables/%s/models/break2.md3",name));
cgs.media.breakables[id].model[2] = trap_R_RegisterModel( va("breakables/%s/models/break3.md3",name));
cgs.media.breakables[id].shader = trap_R_RegisterShader( va("breakable_%s_explosion",name));
}
else
{
strncpy(baseName,name,80);
baseName[strstr(name,"_") - name]='\0';
cgs.media.breakables[id].model[0] = trap_R_RegisterModel( va("breakables/%s/models/break1.md3",baseName));
cgs.media.breakables[id].model[1] = trap_R_RegisterModel( va("breakables/%s/models/break2.md3",baseName));
cgs.media.breakables[id].model[2] = trap_R_RegisterModel( va("breakables/%s/models/break3.md3",baseName));
}
if (CG_CheckFile(va("breakables/%s/sounds/break1.wav", name)) == qtrue)
{
cgs.media.breakables[id].sound[0] = trap_S_RegisterSound( va("breakables/%s/sounds/break1.wav", name), qfalse);
cgs.media.breakables[id].sound[1] = trap_S_RegisterSound( va("breakables/%s/sounds/break2.wav", name), qfalse);
cgs.media.breakables[id].sound[2] = trap_S_RegisterSound( va("breakables/%s/sounds/break3.wav", name), qfalse);
}
else
{
strncpy(baseName,name,80);
baseName[strstr(name,"_") - name]='\0';
cgs.media.breakables[id].sound[0] = trap_S_RegisterSound( va("breakables/%s/sounds/break1.wav", baseName), qfalse);
cgs.media.breakables[id].sound[1] = trap_S_RegisterSound( va("breakables/%s/sounds/break2.wav", baseName), qfalse);
cgs.media.breakables[id].sound[2] = trap_S_RegisterSound( va("breakables/%s/sounds/break3.wav", baseName), qfalse);
}
if (CG_CheckFile(va("breakables/%s/sounds/explosion.wav", name)) == qtrue)
{
cgs.media.breakables[id].exp_sound = trap_S_RegisterSound( va("breakables/%s/sounds/explosion.wav", name), qfalse);
}
else
{
strncpy(baseName,name,80);
baseName[strstr(name,"_") - name]='\0';
cgs.media.breakables[id].exp_sound = trap_S_RegisterSound( va("breakables/%s/sounds/explosion.wav", baseName), qfalse);
}
cgs.media.breakables[id].shader = trap_R_RegisterShader( va("breakable_%s_explosion",name));
cgs.media.breakables[id].velocity = atoi(Info_ValueForKey(breakInfo,"velocity"));
cgs.media.breakables[id].jump = atoi(Info_ValueForKey(breakInfo,"jump"));
} else {

View file

@ -3,57 +3,56 @@
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: cgame - Win32 Release--------------------
--------------------Configuration: cgame - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP87.tmp" with contents
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPCF.tmp" with contents
[
/nologo /G6 /ML /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"Release/cgame.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
"C:\Games\Quake3\rq3source\reaction\cgame\cg_info.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_main.c"
/nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"Debug/" /Fp"Debug/cgame.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /c
"C:\Development\reaction\cgame\cg_main.c"
]
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP87.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP88.tmp" with contents
Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPCF.tmp"
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPD0.tmp" with contents
[
/nologo /base:"0x30000000" /subsystem:windows /dll /incremental:no /pdb:"Release/cgamex86.pdb" /map:"Release/cgamex86.map" /machine:I386 /def:".\cgame.def" /out:"../Release/cgamex86.dll" /implib:"Release/cgamex86.lib"
.\Release\bg_misc.obj
.\Release\bg_pmove.obj
.\Release\bg_slidemove.obj
.\Release\cg_consolecmds.obj
.\Release\cg_draw.obj
.\Release\cg_drawtools.obj
.\Release\cg_effects.obj
.\Release\cg_ents.obj
.\Release\cg_event.obj
.\Release\cg_info.obj
.\Release\cg_localents.obj
.\Release\cg_main.obj
.\Release\cg_marks.obj
.\Release\cg_players.obj
.\Release\cg_playerstate.obj
.\Release\cg_predict.obj
.\Release\cg_scoreboard.obj
.\Release\cg_servercmds.obj
.\Release\cg_snapshot.obj
.\Release\cg_syscalls.obj
.\Release\cg_view.obj
.\Release\cg_weapons.obj
.\Release\q_math.obj
.\Release\q_shared.obj
.\Release\ui_shared.obj
/nologo /base:"0x30000000" /subsystem:windows /dll /incremental:yes /pdb:"Debug/cgamex86.pdb" /map:"Debug/cgamex86.map" /debug /machine:I386 /def:".\cgame.def" /out:"../Debug/cgamex86.dll" /implib:"Debug/cgamex86.lib"
.\Debug\bg_misc.obj
.\Debug\bg_pmove.obj
.\Debug\bg_slidemove.obj
.\Debug\cg_consolecmds.obj
.\Debug\cg_draw.obj
.\Debug\cg_drawtools.obj
.\Debug\cg_effects.obj
.\Debug\cg_ents.obj
.\Debug\cg_event.obj
.\Debug\cg_info.obj
.\Debug\cg_localents.obj
.\Debug\cg_main.obj
.\Debug\cg_marks.obj
.\Debug\cg_players.obj
.\Debug\cg_playerstate.obj
.\Debug\cg_predict.obj
.\Debug\cg_scoreboard.obj
.\Debug\cg_servercmds.obj
.\Debug\cg_snapshot.obj
.\Debug\cg_syscalls.obj
.\Debug\cg_view.obj
.\Debug\cg_weapons.obj
.\Debug\q_math.obj
.\Debug\q_shared.obj
.\Debug\ui_shared.obj
]
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP88.tmp"
Creating command line "link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPD0.tmp"
<h3>Output Window</h3>
Compiling...
cg_info.c
cg_main.c
Linking...
Creating library Release/cgamex86.lib and object Release/cgamex86.exp
C:\Development\reaction\cgame\cg_main.c(1245) : error C2110: cannot add two pointers
C:\Development\reaction\cgame\cg_main.c(1245) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.
<h3>Results</h3>
cgamex86.dll - 0 error(s), 0 warning(s)
cgamex86.dll - 2 error(s), 0 warning(s)
</pre>
</body>
</html>