Replace .psxcsv format with .cnk (rename only)

This commit is contained in:
Lucas S. Vieira 2025-02-07 19:50:33 -03:00
parent 1b88cfc265
commit 47a82fdc0b
3 changed files with 16 additions and 16 deletions

View file

@ -153,14 +153,14 @@ cleancook:
# Also generates 128.png to create a 128x128 tileset (should be done manually)
# (Depends on tilemap128.tmx map generated on Tiled)
%/MAP128.MAP: %/tilemap128.tmx
tiled --export-map $< "$(basename $<).psxcsv"
tiled --export-map $< "$(basename $<).cnk"
tmxrasterizer $< "$(dir $<)128.png"
./tools/chunkgen.py "$(basename $<).psxcsv" $@
rm -f "$(basename $<).psxcsv"
rm -f "$(basename $<)_solid.psxcsv"
rm -f "$(basename $<)_oneway.psxcsv"
rm -f "$(basename $<)_none.psxcsv"
rm -f "$(basename $<)_front.psxcsv"
./tools/chunkgen.py "$(basename $<).cnk" $@
rm -f "$(basename $<).cnk"
rm -f "$(basename $<)_solid.cnk"
rm -f "$(basename $<)_oneway.cnk"
rm -f "$(basename $<)_none.cnk"
rm -f "$(basename $<)_front.cnk"
# =========== Level maps ===========
# These maps should use a tileset generated from "128.png".

View file

@ -3,8 +3,8 @@
# chunkgen.py
# Tool for converting 128x128 chunks generated from a .tmx tilemap in Tiled
# to a proper .MAP file for the PlayStation engine-psx.
# Converts map128.psxcsv -> MAP128.MAP
# Make sure you export your .tmx map to .psxcsv before using this tool.
# Converts map128.cnk -> MAP128.MAP
# Make sure you export your .tmx map to .cnk before using this tool.
import os
import sys
import pandas as pd
@ -122,10 +122,10 @@ def main():
solid_layer = load_data(sys.argv[1])
else:
basepath = os.path.splitext(sys.argv[1])[0]
solid_layer = load_data(f"{basepath}_solid.psxcsv")
oneway_layer = load_data(f"{basepath}_oneway.psxcsv")
none_layer = load_data(f"{basepath}_none.psxcsv")
front_layer = load_data(f"{basepath}_front.psxcsv")
solid_layer = load_data(f"{basepath}_solid.cnk")
oneway_layer = load_data(f"{basepath}_oneway.cnk")
none_layer = load_data(f"{basepath}_none.cnk")
front_layer = load_data(f"{basepath}_front.cnk")
with open(out, "wb") as f:
export_binary(f, solid_layer, oneway_layer, none_layer, front_layer)

View file

@ -10,11 +10,11 @@ import os
class PSXChunk(Plugin):
@classmethod
def nameFilter(cls):
return "PlayStation chunk proto map (*.psxcsv)"
return "PlayStation chunk proto map (*.cnk)"
@classmethod
def shortName(cls):
return "psxcsv"
return "cnk"
@classmethod
def write(cls, tileMap, fileName):
@ -23,7 +23,7 @@ class PSXChunk(Plugin):
tileLayer = tileLayerAt(tileMap, ilayer)
actual_filename = fileName
if tileMap.layerCount() > 1:
actual_filename = f"{os.path.splitext(fileName)[0]}_{tileLayer.name().lower()}.psxcsv"
actual_filename = f"{os.path.splitext(fileName)[0]}_{tileLayer.name().lower()}.cnk"
with open(actual_filename, "w") as f:
width = tileLayer.width()
if width % 8 > 0: