mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Fixed some crashes
This commit is contained in:
parent
09bed43f97
commit
86df24e13c
3 changed files with 24 additions and 3 deletions
|
@ -626,6 +626,7 @@ void SkeletorCacheUnloadData( int index )
|
|||
|
||||
if( m_cachedData[ m_cachedDataLookup[ index ] ].data ) {
|
||||
skelAnimDataGameHeader_s::DeallocAnimData( m_cachedData[ m_cachedDataLookup[ index ] ].data );
|
||||
m_cachedData[ m_cachedDataLookup[ index ] ].data = NULL;
|
||||
}
|
||||
|
||||
m_cachedData[ m_cachedDataLookup[ index ] ].lookup = -1;
|
||||
|
@ -864,6 +865,7 @@ dtikianim_t *TIKI_InitTiki( dloaddef_t *ld, size_t defsize )
|
|||
if( !SkeletorCacheLoadData( anim->name, bPrecache, index ) )
|
||||
{
|
||||
TIKI_Error( "TIKI_InitTiki: Failed to load animation '%s' at %s\n", anim->name, anim->location );
|
||||
panim->m_aliases[ i ] = -1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -837,6 +837,24 @@ skelHeaderGame_t *TIKI_GetSkel( int index )
|
|||
return skelcache[ index ].skel;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
TIKI_GetSkelCache
|
||||
===============
|
||||
*/
|
||||
int TIKI_GetSkelCache( skelHeaderGame_t *pSkel )
|
||||
{
|
||||
for( int index = 0; index < cache_maxskel; index++ )
|
||||
{
|
||||
if( skelcache[ index ].skel == pSkel )
|
||||
{
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
TIKI_FreeSkel
|
||||
|
@ -869,7 +887,7 @@ void TIKI_FreeSkelCache( skelcache_t *cache )
|
|||
{
|
||||
skelSurfaceGame_t *pSurf;
|
||||
|
||||
if( !cache->skel ) {
|
||||
if( cache->skel == NULL ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -959,9 +977,9 @@ int TIKI_RegisterSkel( const char *path, dtiki_t *tiki )
|
|||
return -1;
|
||||
}
|
||||
|
||||
if( cache - skelcache > cache_maxskel )
|
||||
if( cache - skelcache + 1 > cache_maxskel )
|
||||
{
|
||||
cache_maxskel = cache - skelcache;
|
||||
cache_maxskel = cache - skelcache + 1;
|
||||
}
|
||||
|
||||
extension = TIKI_FileExtension( path );
|
||||
|
|
|
@ -34,6 +34,7 @@ void TIKI_CalcLodConsts( lodControl_t *LOD );
|
|||
qboolean TIKI_LoadSKB( const char *path, skelcache_t *cache );
|
||||
qboolean TIKI_LoadSKD( const char *path, skelcache_t *cache );
|
||||
skelHeaderGame_t *TIKI_GetSkel( int index );
|
||||
int TIKI_GetSkelCache( skelHeaderGame_t *pSkel );
|
||||
void TIKI_FreeSkel( int index );
|
||||
void TIKI_FreeSkelCache( skelcache_t *cache );
|
||||
skelcache_t *TIKI_FindSkel( const char *path );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue