1010import org .apache .commons .io .FilenameUtils ;
1111
1212import app .input .InputFileException ;
13+ import assets .AssetHandle ;
14+ import assets .AssetManager ;
15+ import assets .AssetSubdir ;
1316import game .texture .TextureArchive .JsonTexture ;
1417
1518public class Texture
@@ -246,7 +249,8 @@ public static Texture parseTexture(File archiveFile, String dir, String name, Li
246249 public static Texture parseTexture (File source , JsonTexture json ) throws IOException
247250 {
248251 File dir = source .getParentFile ();
249- File subdir = new File (dir , FilenameUtils .getBaseName (source .getName ()));
252+ String texName = FilenameUtils .getBaseName (source .getName ());
253+ //File subdir = new File(dir, FilenameUtils.getBaseName(source.getName()));
250254
251255 Texture tx = new Texture (json .name );
252256 tx .hWrap = new int [2 ];
@@ -305,10 +309,14 @@ public static Texture parseTexture(File source, JsonTexture json) throws IOExcep
305309 throw new InputFileException (source , "(%s) Texture cannot have both mipmaps and aux." , json .name );
306310 }
307311
308- tx . main = Tile . load ( subdir + "/" + tx .name + ".png" , imgFormat );
312+ AssetHandle mainAsset = AssetManager . get ( AssetSubdir . MAP_TEX , texName + "/" + tx .name + ".png" );
309313
310- if (tx .hasAux )
311- tx .aux = Tile .load (subdir + "/" + tx .name + "_AUX.png" , auxFormat );
314+ tx .main = Tile .load (mainAsset , imgFormat );
315+
316+ if (tx .hasAux ) {
317+ AssetHandle auxAsset = AssetManager .get (AssetSubdir .MAP_TEX , texName + "/" + tx .name + "_AUX.png" );
318+ tx .aux = Tile .load (auxAsset , auxFormat );
319+ }
312320
313321 if (tx .hasMipmaps ) {
314322 int divisor = 2 ;
@@ -321,7 +329,8 @@ public static Texture parseTexture(File source, JsonTexture json) throws IOExcep
321329 int mmWidth = tx .main .width / divisor ;
322330
323331 String mmName = tx .name + "_MM" + (tx .mipmapList .size () + 1 );
324- Tile mipmap = Tile .load (subdir + "/" + mmName + ".png" , imgFormat );
332+ AssetHandle mmAsset = AssetManager .get (AssetSubdir .MAP_TEX , texName + "/" + mmName + ".png" );
333+ Tile mipmap = Tile .load (mmAsset , imgFormat );
325334
326335 if (mipmap .height != mmHeight )
327336 throw new InputFileException (source , "%s has incorrect height: %s instead of %s" , mmName , mipmap .height , mmHeight );
0 commit comments