Fixed custom level textures

This commit is contained in:
MysterD 2022-04-02 15:32:21 -07:00
parent 4052347247
commit 95e826d1c8
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);
LevelScript* DynOS_Lvl_Get(const char* levelName);
DataNode<TexData> *DynOS_Lvl_Texture_Get(void *aPtr);
//
// 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) {

View File

@ -638,3 +638,17 @@ LevelScript* DynOS_Lvl_Get(const char* levelName) {
}
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;
}