forked from DizzyThermal/TKViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding TMX Conversion code that works with LITIEngine
- Loading branch information
1 parent
4869f99
commit 69800d2
Showing
3 changed files
with
277 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.gamemode.tkviewer; | ||
import com.gamemode.tkviewer.resources.Resources; | ||
import com.gamemode.tkviewer.utilities.FileUtils; | ||
import com.gamemode.tkviewer.utilities.Utils; | ||
|
||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class TKTmxer { | ||
|
||
private static String outputDirectory = "C:\\TKTmxer"; | ||
|
||
private static String tileDirectory = Paths.get(outputDirectory, "tiles").toString(); | ||
private static String sObjDirectory = Paths.get(outputDirectory, "objects").toString(); | ||
|
||
private static List<Integer> mapsToConvert = new ArrayList<Integer>( | ||
Arrays.asList( | ||
2, | ||
41 | ||
) | ||
); | ||
|
||
public static void main(String[] args) { | ||
generateResources(); | ||
convertMaps(Paths.get(outputDirectory)); | ||
} | ||
|
||
private static void generateResources() { | ||
FileUtils.generateGroundTileImages(Paths.get(tileDirectory)); | ||
FileUtils.generateStaticObjectTileImages(Paths.get(sObjDirectory)); | ||
FileUtils.generateGroundTileSets(Paths.get(outputDirectory)); | ||
FileUtils.generateStaticObjectTileSets(Paths.get(outputDirectory)); | ||
} | ||
|
||
private static void convertMaps(Path outputDirectory) { | ||
if (!outputDirectory.toFile().exists()) { | ||
outputDirectory.toFile().mkdirs(); | ||
} | ||
|
||
for (Integer mapId : mapsToConvert) { | ||
if (!Paths.get(outputDirectory.toString(), Utils.pad(mapId, 6) + ".tmx").toFile().exists()) { | ||
FileUtils.cmpFileToTmxFile( | ||
Paths.get(Resources.NTK_MAP_DIRECTORY, "TK" + Utils.pad(mapId, 6) + ".cmp").toFile(), | ||
Paths.get(outputDirectory.toString(), Utils.pad(mapId, 6) + ".tmx").toFile() | ||
); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.