mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Refactor texture loading and update terrain path
Updated the terrain texture path and refactored the readImage function to simplify image loading.
This commit is contained in:
parent
208b93a3f3
commit
e4b367590c
|
|
@ -235,7 +235,7 @@ Textures::Textures(TexturePackRepository *skins, Options *options)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// 4J Stu - Changed these to our PreStitchedTextureMap from TextureMap
|
// 4J Stu - Changed these to our PreStitchedTextureMap from TextureMap
|
||||||
terrain = new PreStitchedTextureMap(Icon::TYPE_TERRAIN, L"terrain", L"textures/block/", missingNo, true);
|
terrain = new PreStitchedTextureMap(Icon::TYPE_TERRAIN, L"blocks", L"res/TitleUpdate/res/textures/block/", missingNo, true);
|
||||||
items = new PreStitchedTextureMap(Icon::TYPE_ITEM, L"items", L"textures/items/", missingNo, true);
|
items = new PreStitchedTextureMap(Icon::TYPE_ITEM, L"items", L"textures/items/", missingNo, true);
|
||||||
|
|
||||||
// 4J - added - preload a set of commonly used textures that can then be referenced directly be an enumerated type rather by string
|
// 4J - added - preload a set of commonly used textures that can then be referenced directly be an enumerated type rather by string
|
||||||
|
|
@ -1206,57 +1206,23 @@ Icon *Textures::getMissingIcon(int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedImage *Textures::readImage(TEXTURE_NAME texId, const wstring& name) // 4J was InputStream *in
|
BufferedImage *Textures::readImage(TEXTURE_NAME texId, const wstring& name)
|
||||||
{
|
{
|
||||||
BufferedImage *img=NULL;
|
BufferedImage *img = nullptr;
|
||||||
MemSect(32);
|
|
||||||
// is this image one of the Title Update ones?
|
|
||||||
bool isTu = IsTUImage(texId, name);
|
|
||||||
wstring drive = L"";
|
|
||||||
|
|
||||||
if(!skins->isUsingDefaultSkin() && skins->getSelected()->hasFile(L"res/" + name,false))
|
// Only for terrain blocks
|
||||||
{
|
if(texId == TN_TERRAIN)
|
||||||
drive = skins->getSelected()->getPath(isTu);
|
{
|
||||||
img = skins->getSelected()->getImageResource(name, false, isTu, drive); //new BufferedImage(name,false,isTu,drive);
|
// Build path to individual block texture
|
||||||
}
|
wstring filePath = L"res/TitleUpdate/res/textures/block/" + name + L".png";
|
||||||
else
|
img = new BufferedImage(filePath); // load from file directly
|
||||||
{
|
}
|
||||||
const char *pchName=wstringtofilename(name);
|
else
|
||||||
#ifdef __PS3__
|
{
|
||||||
if(app.GetBootedFromDiscPatch() && app.IsFileInPatchList(pchName))
|
// fallback to existing behavior for items, fonts, etc.
|
||||||
{
|
img = skins->getSelected()->getImageResource(name, false, IsTUImage(texId, name));
|
||||||
char *pchUsrDir = app.GetBDUsrDirPath(pchName);
|
}
|
||||||
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
|
|
||||||
|
|
||||||
if(isTu)
|
|
||||||
{
|
|
||||||
drive= wstr + L"\\Common\\res\\TitleUpdate\\";
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
drive= wstr + L"\\Common\\";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
drive = skins->getDefault()->getPath(isTu);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *pchDrive=wstringtofilename(drive);
|
|
||||||
|
|
||||||
if(IsOriginalImage(texId, name) || isTu)
|
|
||||||
{
|
|
||||||
img = skins->getDefault()->getImageResource(name,false,isTu,drive); //new BufferedImage(name,false,isTu,drive);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
img = skins->getDefault()->getImageResource(L"1_2_2/" + name, false, isTu, drive); //new BufferedImage(L"/1_2_2" + name,false,isTu,drive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MemSect(0);
|
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue