本文整理汇总了C++中refexport_t::RegisterImages_LevelLoadEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ refexport_t::RegisterImages_LevelLoadEnd方法的具体用法?C++ refexport_t::RegisterImages_LevelLoadEnd怎么用?C++ refexport_t::RegisterImages_LevelLoadEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类refexport_t
的用法示例。
在下文中一共展示了refexport_t::RegisterImages_LevelLoadEnd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SND_RegisterAudio_LevelLoadEnd
void *Z_Malloc(int iSize, memtag_t eTag, qboolean bZeroit, int unusedAlign)
#endif
{
gbMemFreeupOccured = qfalse;
if (iSize == 0)
{
zoneHeader_t *pMemory = (zoneHeader_t *) &gZeroMalloc;
return &pMemory[1];
}
// Add in tracking info and round to a longword... (ignore longword aligning now we're not using contiguous blocks)
//
// int iRealSize = (iSize + sizeof(zoneHeader_t) + sizeof(zoneTail_t) + 3) & 0xfffffffc;
int iRealSize = (iSize + sizeof(zoneHeader_t) + sizeof(zoneTail_t));
// Allocate a chunk...
//
zoneHeader_t *pMemory = NULL;
while (pMemory == NULL)
{
#ifdef _WIN32
if (gbMemFreeupOccured)
{
Sleep(1000); // sleep for a second, so Windows has a chance to shuffle mem to de-swiss-cheese it
}
#endif
if (bZeroit) {
pMemory = (zoneHeader_t *) calloc ( iRealSize, 1 );
} else {
pMemory = (zoneHeader_t *) malloc ( iRealSize );
}
if (!pMemory)
{
// new bit, if we fail to malloc memory, try dumping some of the cached stuff that's non-vital and try again...
//
// ditch the BSP cache...
//
if (CM_DeleteCachedMap(qfalse))
{
gbMemFreeupOccured = qtrue;
continue; // we've just ditched a whole load of memory, so try again with the malloc
}
// ditch any sounds not used on this level...
//
extern qboolean SND_RegisterAudio_LevelLoadEnd(qboolean bDeleteEverythingNotUsedThisLevel);
if (SND_RegisterAudio_LevelLoadEnd(qtrue))
{
gbMemFreeupOccured = qtrue;
continue; // we've dropped at least one sound, so try again with the malloc
}
// ditch any image_t's (and associated GL texture mem) not used on this level...
//
if (re.RegisterImages_LevelLoadEnd())
{
gbMemFreeupOccured = qtrue;
continue; // we've dropped at least one image, so try again with the malloc
}
// ditch the model-binaries cache... (must be getting desperate here!)
//
if (re.RegisterModels_LevelLoadEnd(qtrue))
{
gbMemFreeupOccured = qtrue;
continue;
}
// as a last panic measure, dump all the audio memory, but not if we're in the audio loader
// (which is annoying, but I'm not sure how to ensure we're not dumping any memory needed by the sound
// currently being loaded if that was the case)...
//
// note that this keeps querying until it's freed up as many bytes as the requested size, but freeing
// several small blocks might not mean that one larger one is satisfiable after freeup, however that'll
// just make it go round again and try for freeing up another bunch of blocks until the total is satisfied
// again (though this will have freed twice the requested amount in that case), so it'll either work
// eventually or not free up enough and drop through to the final ERR_DROP. No worries...
//
extern qboolean gbInsideLoadSound;
extern int SND_FreeOldestSound(void); // I had to add a void-arg version of this because of link issues, sigh
if (!gbInsideLoadSound)
{
int iBytesFreed = SND_FreeOldestSound();
if (iBytesFreed)
{
int iTheseBytesFreed = 0;
while ( (iTheseBytesFreed = SND_FreeOldestSound()) != 0)
{
iBytesFreed += iTheseBytesFreed;
if (iBytesFreed >= iRealSize)
break; // early opt-out since we've managed to recover enough (mem-contiguity issues aside)
}
gbMemFreeupOccured = qtrue;
continue;
//.........这里部分代码省略.........