Fixed custom level textures

This commit is contained in:
MysterD 2022-04-02 15:32:21 -07:00
parent 046c595f92
commit 7230c6fccc
3 changed files with 16 additions and 1 deletions

View file

@ -695,6 +695,7 @@ s16 *DynOS_Level_GetWarpDeath(s32 aLevel, s32 aArea);
void DynOS_Lvl_Add(const SysPath &aPackFolder, const char *aLevelName); void DynOS_Lvl_Add(const SysPath &aPackFolder, const char *aLevelName);
LevelScript* DynOS_Lvl_Get(const char* levelName); LevelScript* DynOS_Lvl_Get(const char* levelName);
DataNode<TexData> *DynOS_Lvl_Texture_Get(void *aPtr);
// //
// Warps // Warps

View file

@ -257,7 +257,7 @@ static DataNode<TexData> *DynOS_Gfx_RetrieveNode(void *aPtr) {
} }
} }
} }
return NULL; return DynOS_Lvl_Texture_Get(aPtr);
} }
static bool DynOS_Gfx_ImportTexture_Typed(THN **aOutput, void *aPtr, s32 aTile, GRAPI *aGfxRApi, THN **aHashMap, THN *aPool, u32 *aPoolPos, u32 aPoolSize) { static bool DynOS_Gfx_ImportTexture_Typed(THN **aOutput, void *aPtr, s32 aTile, GRAPI *aGfxRApi, THN **aHashMap, THN *aPool, u32 *aPoolPos, u32 aPoolSize) {

View file

@ -638,3 +638,17 @@ LevelScript* DynOS_Lvl_Get(const char* levelName) {
} }
return NULL; return NULL;
} }
DataNode<TexData> *DynOS_Lvl_Texture_Get(void *aPtr) {
for (s32 i = 0; i < sDynosCustomLevelScripts.Count(); ++i) {
auto &mTextures = sDynosCustomLevelScripts[i].second->mTextures;
for (s32 j = 0; j < mTextures.Count(); j++) {
auto &texture = mTextures[j];
if (texture == aPtr) {
return texture;
}
}
}
return NULL;
}