Skip to content

Commit

Permalink
Revert "Move file existence check into trap_ function."
Browse files Browse the repository at this point in the history
This reverts commit a4b1158.
This commit makes movers disappear.
  • Loading branch information
DolceTriade committed Apr 11, 2016
1 parent 21ca53e commit c416d1f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
5 changes: 0 additions & 5 deletions src/cgame/cg_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,6 @@ void trap_R_LoadWorldMap( const char *mapname )
qhandle_t trap_R_RegisterModel( const char *name )
{
int handle;

if ( !CG_FileExists( name ) ) {
return 0;
}

VM::SendMsg<Render::RegisterModelMsg>(name, handle);
return handle;
}
Expand Down
1 change: 1 addition & 0 deletions src/cgame/cg_buildable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ void CG_InitBuildables()
//Prefer md5 models over md3

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",
buildableName, buildableName ) ) ) )
{
Expand Down
10 changes: 8 additions & 2 deletions src/cgame/cg_players.cpp
Original file line number 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",
modelName, modelName );
ci->bodyModel = trap_R_RegisterModel( filename );
if ( CG_FileExists( filename ) )
{
ci->bodyModel = trap_R_RegisterModel( filename );
}

if ( ! ci->bodyModel ) {
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
{
Expand Down
33 changes: 26 additions & 7 deletions src/cgame/cg_weapons.cpp
Original file line number 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 );

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;

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 );
}
}
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;

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

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

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

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

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

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

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

continue;
}
Expand Down

0 comments on commit c416d1f

Please sign in to comment.