Skip to content

Commit

Permalink
Fix 'missing' model warnings in debug build
Browse files Browse the repository at this point in the history
  • Loading branch information
jaytersen committed Apr 2, 2016
1 parent 62a64e4 commit 433996c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/cgame/cg_buildable.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ void CG_InitBuildables()
//Prefer md5 models over md3 //Prefer md5 models over md3


if ( cg_highPolyBuildableModels.integer && if ( cg_highPolyBuildableModels.integer &&
CG_FileExists( va( "models/buildables/%s/%s.iqm", buildableName, buildableName ) ) &&
( bi->models[ 0 ] = trap_R_RegisterModel( va( "models/buildables/%s/%s.iqm", ( bi->models[ 0 ] = trap_R_RegisterModel( va( "models/buildables/%s/%s.iqm",
buildableName, buildableName ) ) ) ) buildableName, buildableName ) ) ) )
{ {
Expand Down
10 changes: 8 additions & 2 deletions src/cgame/cg_players.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -893,11 +893,17 @@ static bool CG_RegisterClientModelname( clientInfo_t *ci, const char *modelName,
{ {
Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s.iqm", Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s.iqm",
modelName, modelName ); modelName, modelName );
ci->bodyModel = trap_R_RegisterModel( filename ); if ( CG_FileExists( filename ) )
{
ci->bodyModel = trap_R_RegisterModel( filename );
}


if ( ! ci->bodyModel ) { if ( ! ci->bodyModel ) {
Com_sprintf( filename, sizeof( filename ), "models/players/%s/body.md5mesh", modelName ); Com_sprintf( filename, sizeof( filename ), "models/players/%s/body.md5mesh", modelName );
ci->bodyModel = trap_R_RegisterModel( filename ); if ( CG_FileExists(filename) )
{
ci->bodyModel = trap_R_RegisterModel( filename );
}
} }
else else
{ {
Expand Down
33 changes: 26 additions & 7 deletions src/cgame/cg_weapons.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -726,7 +726,9 @@ static bool CG_ParseWeaponFile( const char *filename, int weapon, weaponInfo_t *


COM_StripExtension( token, token2 ); COM_StripExtension( token, token2 );


if ( cg_highPolyWeaponModels.integer && ( wi->weaponModel = trap_R_RegisterModel( va( "%s_view.iqm", token2 ) ) ) ) if ( cg_highPolyWeaponModels.integer &&
CG_FileExists( va( "%s_view.iqm", token2 ) ) &&
( wi->weaponModel = trap_R_RegisterModel( va( "%s_view.iqm", token2 ) ) ) )
{ {
wi->md5 = true; wi->md5 = true;


Expand Down Expand Up @@ -816,7 +818,9 @@ static bool CG_ParseWeaponFile( const char *filename, int weapon, weaponInfo_t *
va( "%s_view.iqm:fire7", token2 ), false, false, false ); va( "%s_view.iqm:fire7", token2 ), false, false, false );
} }
} }
else if ( cg_highPolyWeaponModels.integer && ( wi->weaponModel = trap_R_RegisterModel( va( "%s_view.md5mesh", token2 ) ) ) ) else if ( cg_highPolyWeaponModels.integer &&
CG_FileExists( va( "%s_view.md5mesh", token2 ) ) &&
( wi->weaponModel = trap_R_RegisterModel( va( "%s_view.md5mesh", token2 ) ) ) )
{ {
wi->md5 = true; wi->md5 = true;


Expand Down Expand Up @@ -918,15 +922,24 @@ static bool CG_ParseWeaponFile( const char *filename, int weapon, weaponInfo_t *


COM_StripExtension( token, path ); COM_StripExtension( token, path );
strcat( path, "_flash.md3" ); strcat( path, "_flash.md3" );
wi->flashModel = trap_R_RegisterModel( path ); if ( CG_FileExists( path ) )
{
wi->flashModel = trap_R_RegisterModel( path );
}


COM_StripExtension( token, path ); COM_StripExtension( token, path );
strcat( path, "_barrel.md3" ); strcat( path, "_barrel.md3" );
wi->barrelModel = trap_R_RegisterModel( path ); if ( CG_FileExists( path ) )
{
wi->barrelModel = trap_R_RegisterModel( path );
}


COM_StripExtension( token, path ); COM_StripExtension( token, path );
strcat( path, "_hand.md3" ); strcat( path, "_hand.md3" );
wi->handsModel = trap_R_RegisterModel( path ); if ( CG_FileExists( path ) )
{
wi->handsModel = trap_R_RegisterModel( path );
}


continue; continue;
} }
Expand All @@ -951,11 +964,17 @@ static bool CG_ParseWeaponFile( const char *filename, int weapon, weaponInfo_t *


COM_StripExtension( token, path ); COM_StripExtension( token, path );
strcat( path, "_flash.md3" ); strcat( path, "_flash.md3" );
wi->flashModel3rdPerson = trap_R_RegisterModel( path ); if ( CG_FileExists( path ) )
{
wi->flashModel3rdPerson = trap_R_RegisterModel( path );
}


COM_StripExtension( token, path ); COM_StripExtension( token, path );
strcat( path, "_barrel.md3" ); strcat( path, "_barrel.md3" );
wi->barrelModel3rdPerson = trap_R_RegisterModel( path ); if ( CG_FileExists( path ) )
{
wi->barrelModel3rdPerson = trap_R_RegisterModel( path );
}


continue; continue;
} }
Expand Down

0 comments on commit 433996c

Please sign in to comment.