// // param "bAllowScreenDissolve" is just a convenient way of getting hold of a bool which can be checked by the code that // issues the InitDissolve command later in RE_RegisterMedia_LevelLoadEnd() // void RE_RegisterMedia_LevelLoadBegin(const char *psMapName, ForceReload_e eForceReload, qboolean bAllowScreenDissolve) { gbAllowScreenDissolve = bAllowScreenDissolve; tr.numBSPModels = 0; // for development purposes we may want to ditch certain media just before loading a map... // switch (eForceReload) { case eForceReload_BSP: ri.CM_DeleteCachedMap(qtrue); R_Images_DeleteLightMaps(); break; case eForceReload_MODELS: RE_RegisterModels_DeleteAll(); break; case eForceReload_ALL: // BSP... // ri.CM_DeleteCachedMap(qtrue); R_Images_DeleteLightMaps(); // // models... // RE_RegisterModels_DeleteAll(); break; default: break; } // at some stage I'll probably want to put some special logic here, like not incrementing the level number // when going into a map like "brig" or something, so returning to the previous level doesn't require an // asset reload etc, but for now... // // only bump level number if we're not on the same level. // Note that this will hide uncached models, which is perhaps a bad thing?... // static char sPrevMapName[MAX_QPATH]={0}; if (Q_stricmp( psMapName,sPrevMapName )) { Q_strncpyz( sPrevMapName, psMapName, sizeof(sPrevMapName) ); giRegisterMedia_CurrentLevel++; } }
void RE_RegisterMedia_LevelLoadBegin(const char *psMapName, ForceReload_e eForceReload) { // for development purposes we may want to ditch certain media just before loading a map... // bool bDeleteModels = eForceReload == eForceReload_MODELS || eForceReload == eForceReload_ALL; // bool bDeleteBSP = eForceReload == eForceReload_BSP || eForceReload == eForceReload_ALL; if (bDeleteModels) { RE_RegisterModels_DeleteAll(); } else { if ( ri->Cvar_VariableIntegerValue( "sv_pure" ) ) { RE_RegisterModels_DumpNonPure(); } } tr.numBSPModels = 0; // at some stage I'll probably want to put some special logic here, like not incrementing the level number // when going into a map like "brig" or something, so returning to the previous level doesn't require an // asset reload etc, but for now... // // only bump level number if we're not on the same level. // Note that this will hide uncached models, which is perhaps a bad thing?... // static char sPrevMapName[MAX_QPATH]={0}; if (Q_stricmp( psMapName,sPrevMapName )) { Q_strncpyz( sPrevMapName, psMapName, sizeof(sPrevMapName) ); giRegisterMedia_CurrentLevel++; } }
void R_ModelFree(void) { if(CachedModels) { RE_RegisterModels_DeleteAll(); delete CachedModels; CachedModels = NULL; } }