Cleanup, prep for editor
Some checks failed
Build Dusk / build-linux (push) Failing after 40s
Build Dusk / build-psp (push) Failing after 1m7s

This commit is contained in:
2025-11-15 22:21:03 -06:00
parent 7278bd0c6f
commit c53439066e
17 changed files with 132 additions and 131 deletions

View File

@@ -1,50 +1,12 @@
import os
import sys, os
import argparse
import sys
# Check if the script is run with the correct arguments
parser = argparse.ArgumentParser(description="Generate chunk header files")
parser.add_argument('--assets', required=True, help='Dir to output built assets')
parser.add_argument('--build-type', choices=['wad', 'header'], default='raw', help='Type of build to perform')
parser.add_argument('--output-file', required=True, help='Output file for built assets (required for wad build)')
parser.add_argument('--headers-dir', required=True, help='Directory to output individual asset headers (required for header build)')
parser.add_argument('--output-headers', help='Output header file for built assets (required for header build)')
parser.add_argument('--output-assets', required=True, help='Output directory for built assets')
parser.add_argument('--output-file', required=True, help='Output file for built assets (required for wad build)')
parser.add_argument('--input', required=True, help='Input assets to process', nargs='+')
args = parser.parse_args()
inputAssets = []
for inputArg in args.input:
files = inputArg.split('$')
for file in files:
if str(file).strip() == '':
continue
pieces = file.split('#')
if len(pieces) < 2:
print(f"Error: Invalid input asset format '{file}'. Expected format: type#path[#option1%option2...]")
sys.exit(1)
options = {}
if len(pieces) > 2:
optionParts = pieces[2].split('%')
for part in optionParts:
partSplit = part.split('=')
if len(partSplit) < 1:
continue
if len(partSplit) == 2:
options[partSplit[0]] = partSplit[1]
else:
options[partSplit[0]] = True
inputAssets.append({
'type': pieces[0],
'path': pieces[1],
'options': options
})
if not inputAssets:
print("Error: No input assets provided.")
sys.exit(1)
args = parser.parse_args()

View File

@@ -1,5 +1,5 @@
import os
from args import args
from assetstool.args import args
def getAssetRelativePath(fullPath):
# Get the relative path to the asset

View File

@@ -1 +0,0 @@
ASSET_FILE_NAME_MAX_LENGTH = 256

View File

@@ -1,49 +0,0 @@
import sys, os
from args import inputAssets, args
from processasset import processAsset
from processpalette import processPaletteList
from processtileset import processTilesetList
from processlanguage import processLanguageList
from assethelpers import getBuiltAssetsRelativePath
import zipfile
# Setup headers directory.
# setOutputDir(args.output)
# outputHeaders = []
# # Create output directory if it doesn't exist
# if not os.path.exists(args.output):
# os.makedirs(args.output)
files = []
for asset in inputAssets:
asset = processAsset(asset)
files.extend(asset['files'])
files.extend(processLanguageList()['files'])
# Take assets and add to a zip archive.
outputFileName = args.output_file
print(f"Creating output file: {outputFileName}")
with zipfile.ZipFile(outputFileName, 'w') as zipf:
for file in files:
relativeOutputPath = getBuiltAssetsRelativePath(file)
zipf.write(file, arcname=relativeOutputPath)
# Generate additional headers.
processPaletteList()
processTilesetList()
# Finalize build
if args.build_type == 'header':
print("Error: Header build not implemented yet.")
sys.exit(1)
elif args.build_type == 'wad':
# Nothing to do, already created above!
pass
else:
print("Error: Unknown build type.")
sys.exit(1)

View File

@@ -1,10 +1,10 @@
import sys
# from processtileset import processTileset
from processimage import processImage
from processpalette import processPalette
from processtileset import processTileset
from processmap import processMap
from processlanguage import processLanguage
from assetstool.processimage import processImage
from assetstool.processpalette import processPalette
from assetstool.processtileset import processTileset
from assetstool.processmap import processMap
from assetstool.processlanguage import processLanguage
processedAssets = []

View File

@@ -1,10 +1,10 @@
import os
import sys
from PIL import Image
from processpalette import extractPaletteFromImage, palettes
from args import args
from assethelpers import getAssetRelativePath
from assetcache import assetGetCache, assetCache
from assetstool.processpalette import extractPaletteFromImage, palettes
from assetstool.args import args
from assetstool.assethelpers import getAssetRelativePath
from assetstool.assetcache import assetGetCache, assetCache
images = []

View File

@@ -1,8 +1,8 @@
import sys
import os
from args import args
from assetcache import assetCache, assetGetCache
from assethelpers import getAssetRelativePath
from assetstool.args import args
from assetstool.assetcache import assetCache, assetGetCache
from assetstool.assethelpers import getAssetRelativePath
import polib
import re

View File

@@ -2,17 +2,19 @@ import struct
import sys
import os
import json
from args import args
from assetcache import assetCache, assetGetCache
from assethelpers import getAssetRelativePath
from assetstool.args import args
from assetstool.assetcache import assetCache, assetGetCache
from assetstool.assethelpers import getAssetRelativePath
from dusk.defs import defs
CHUNK_WIDTH = 16
CHUNK_HEIGHT = 16
CHUNK_DEPTH = 4
CHUNK_WIDTH = int(defs.get('CHUNK_WIDTH'))
CHUNK_HEIGHT = int(defs.get('CHUNK_HEIGHT'))
CHUNK_DEPTH = int(defs.get('CHUNK_DEPTH'))
CHUNK_TILE_COUNT = CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_DEPTH
TILE_WIDTH = 16.0
TILE_HEIGHT = 16.0
TILE_DEPTH = 11.36
TILE_WIDTH = float(defs.get('TILE_WIDTH'))
TILE_HEIGHT = float(defs.get('TILE_HEIGHT'))
TILE_DEPTH = float(defs.get('TILE_DEPTH'))
def processTile(tileIndex, x=0, y=0, z=0, chunkX=0, chunkY=0, chunkZ=0):
vertices = []

View File

@@ -1,9 +1,8 @@
import os
from PIL import Image
from args import args
import sys
import datetime
from assetcache import assetCache, assetGetCache
from assetstool.args import args
from assetstool.assetcache import assetCache, assetGetCache
palettes = []

View File

@@ -1,12 +1,12 @@
import json
from processimage import processImage
import sys
from assethelpers import getAssetRelativePath
import os
import datetime
from args import args
from xml.etree import ElementTree
from assetcache import assetGetCache, assetCache
from assetstool.processimage import processImage
from assetstool.assethelpers import getAssetRelativePath
from assetstool.args import args
from assetstool.assetcache import assetGetCache, assetCache
tilesets = []