Minor improvements, add east and west ramp
All checks were successful
Build Dusk / build-linux (push) Successful in 48s
Build Dusk / build-psp (push) Successful in 1m0s

This commit is contained in:
2025-11-19 13:25:58 -06:00
parent 903dab49e3
commit bd5a67676b
5 changed files with 118 additions and 46 deletions

View File

@@ -1 +1 @@
{"shapes": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}

View File

@@ -76,6 +76,7 @@ class Chunk:
with open(fname, 'w') as f: with open(fname, 'w') as f:
json.dump(dataOut, f) json.dump(dataOut, f)
self.dirty = False self.dirty = False
self.onChunkData.invoke(self)
except Exception as e: except Exception as e:
raise RuntimeError(f"Failed to save chunk file: {e}") raise RuntimeError(f"Failed to save chunk file: {e}")

View File

@@ -35,13 +35,6 @@ class ChunkPanel(QWidget):
# Add expandable tree list # Add expandable tree list
self.tree = QTreeWidget() self.tree = QTreeWidget()
self.tree.setHeaderLabel("Chunks") self.tree.setHeaderLabel("Chunks")
# Example tree items
parentItem = QTreeWidgetItem(self.tree, ["Chunk 1"])
childItem1 = QTreeWidgetItem(parentItem, ["Tile A"])
childItem2 = QTreeWidgetItem(parentItem, ["Tile B"])
parentItem2 = QTreeWidgetItem(self.tree, ["Chunk 2"])
QTreeWidgetItem(parentItem2, ["Tile C"])
QTreeWidgetItem(parentItem2, ["Tile D"])
self.tree.expandAll() # Expand by default, remove if you want collapsed self.tree.expandAll() # Expand by default, remove if you want collapsed
layout.addWidget(self.tree) # Removed invalid stretch factor layout.addWidget(self.tree) # Removed invalid stretch factor
@@ -60,10 +53,22 @@ class ChunkPanel(QWidget):
self.parent.map.onPositionChange.sub(self.onPositionChange) self.parent.map.onPositionChange.sub(self.onPositionChange)
self.tileShapeDropdown.currentTextChanged.connect(self.onTileShapeChanged) self.tileShapeDropdown.currentTextChanged.connect(self.onTileShapeChanged)
# For each chunk
for chunk in self.parent.map.chunks.values():
# Create tree element
item = QTreeWidgetItem(self.tree, ["Chunk ({}, {}, {})".format(chunk.x, chunk.y, chunk.z)])
chunk.chunkPanelTree = item
chunk.chunkPanelTree.setExpanded(True)
item.setData(0, 0, chunk) # Store chunk reference
chunk.onChunkData.sub(self.onChunkData)
def onMapData(self, data): def onMapData(self, data):
pass pass
def onPositionChange(self, pos): def onPositionChange(self, pos):
self.updateChunkList()
tile = self.parent.map.getTileAtWorldPos(*self.parent.map.position) tile = self.parent.map.getTileAtWorldPos(*self.parent.map.position)
if tile is None: if tile is None:
return return
@@ -81,4 +86,21 @@ class ChunkPanel(QWidget):
if tile is None or shape_key not in TILE_SHAPES: if tile is None or shape_key not in TILE_SHAPES:
return return
tile.setShape(TILE_SHAPES[shape_key]) tile.setShape(TILE_SHAPES[shape_key])
def updateChunkList(self):
# Clear existing items
currentChunk = self.parent.map.getChunkAtWorldPos(*self.parent.map.position)
# Example tree items
for chunk in self.parent.map.chunks.values():
title = "Chunk ({}, {}, {})".format(chunk.x, chunk.y, chunk.z)
if chunk == currentChunk:
title += " [C]"
if chunk.isDirty():
title += " *"
item = chunk.chunkPanelTree
item.setText(0, title)
def onChunkData(self, chunk):
self.updateChunkList()

View File

@@ -1,5 +1,6 @@
import os import os
from PyQt5.QtWidgets import QAction, QMenuBar, QFileDialog from PyQt5.QtWidgets import QAction, QMenuBar, QFileDialog
from PyQt5.QtGui import QKeySequence
from editortool.map.map import MAP_DEFAULT_PATH from editortool.map.map import MAP_DEFAULT_PATH
class MapMenubar: class MapMenubar:
@@ -14,6 +15,11 @@ class MapMenubar:
self.actionSave = QAction("Save", parent) self.actionSave = QAction("Save", parent)
self.actionSaveAs = QAction("Save As", parent) self.actionSaveAs = QAction("Save As", parent)
self.actionNew.setShortcut(QKeySequence("Ctrl+N"))
self.actionOpen.setShortcut(QKeySequence("Ctrl+O"))
self.actionSave.setShortcut(QKeySequence("Ctrl+S"))
self.actionSaveAs.setShortcut(QKeySequence("Ctrl+Shift+S"))
self.actionNew.triggered.connect(self.newFile) self.actionNew.triggered.connect(self.newFile)
self.actionOpen.triggered.connect(self.openFile) self.actionOpen.triggered.connect(self.openFile)
self.actionSave.triggered.connect(self.saveFile) self.actionSave.triggered.connect(self.saveFile)

View File

@@ -1,5 +1,11 @@
from OpenGL.GL import * from OpenGL.GL import *
from editortool.map.mapdefs import TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH, CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH, TILE_SHAPE_NULL, TILE_SHAPE_FLOOR, TILE_SHAPE_RAMP_NORTH from editortool.map.mapdefs import (
TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH,
CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH,
TILE_SHAPE_NULL, TILE_SHAPE_FLOOR,
TILE_SHAPE_RAMP_NORTH, TILE_SHAPE_RAMP_SOUTH,
TILE_SHAPE_RAMP_EAST, TILE_SHAPE_RAMP_WEST
)
def getItem(arr, index, default): def getItem(arr, index, default):
if index < len(arr): if index < len(arr):
@@ -24,51 +30,88 @@ class Tile:
self.shape = getItem(chunkData['shapes'], self.index, TILE_SHAPE_NULL) self.shape = getItem(chunkData['shapes'], self.index, TILE_SHAPE_NULL)
def setShape(self, shape): def setShape(self, shape):
if shape == self.shape:
return
self.shape = shape self.shape = shape
self.chunk.dirty = True self.chunk.dirty = True
self.chunk.tileUpdateVertices() self.chunk.tileUpdateVertices()
self.chunk.onChunkData.invoke(self.chunk)
def getBaseTileModel(self): def getBaseTileModel(self):
vertices = [] vertices = []
indices = [] indices = []
uvs = [] uvs = []
colors = [] colors = []
if self.shape == TILE_SHAPE_NULL: if self.shape == TILE_SHAPE_NULL:
pass pass
elif self.shape == TILE_SHAPE_FLOOR: elif self.shape == TILE_SHAPE_FLOOR:
vertices = [ vertices = [
(self.posX, self.posY, self.posZ), (self.posX, self.posY, self.posZ),
(self.posX + TILE_WIDTH, self.posY, self.posZ), (self.posX + TILE_WIDTH, self.posY, self.posZ),
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ), (self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ),
(self.posX, self.posY + TILE_HEIGHT, self.posZ) (self.posX, self.posY + TILE_HEIGHT, self.posZ)
] ]
indices = [0, 1, 2, 0, 2, 3] indices = [0, 1, 2, 0, 2, 3]
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ] uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
colors = [ ( 255, 255, 255, 255 ) ] * 4 colors = [ (255, 255, 255, 255) ] * 4
elif self.shape == TILE_SHAPE_RAMP_NORTH:
vertices = [
(self.posX, self.posY, self.posZ + TILE_DEPTH),
(self.posX + TILE_WIDTH, self.posY, self.posZ + TILE_DEPTH),
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ),
(self.posX, self.posY + TILE_HEIGHT, self.posZ)
]
indices = [0, 1, 2, 0, 2, 3]
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
colors = [ ( 255, 0, 0, 255 ) ] * 4
else: elif self.shape == TILE_SHAPE_RAMP_NORTH:
print("Unknown tile shape:", self.shape) vertices = [
pass (self.posX, self.posY, self.posZ + TILE_DEPTH),
(self.posX + TILE_WIDTH, self.posY, self.posZ + TILE_DEPTH),
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ),
(self.posX, self.posY + TILE_HEIGHT, self.posZ)
]
indices = [0, 1, 2, 0, 2, 3]
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
colors = [ (255, 0, 0, 255) ] * 4
return { elif self.shape == TILE_SHAPE_RAMP_SOUTH:
'vertices': vertices, vertices = [
'indices': indices, (self.posX, self.posY, self.posZ),
'uvs': uvs, (self.posX + TILE_WIDTH, self.posY, self.posZ),
'colors': colors (self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH),
} (self.posX, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH)
]
indices = [0, 1, 2, 0, 2, 3]
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
colors = [ (0, 255, 0, 255) ] * 4
elif self.shape == TILE_SHAPE_RAMP_EAST:
vertices = [
(self.posX, self.posY, self.posZ),
(self.posX + TILE_WIDTH, self.posY, self.posZ + TILE_DEPTH),
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH),
(self.posX, self.posY + TILE_HEIGHT, self.posZ)
]
indices = [0, 1, 2, 0, 2, 3]
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
colors = [ (0, 0, 255, 255) ] * 4
elif self.shape == TILE_SHAPE_RAMP_WEST:
vertices = [
(self.posX, self.posY, self.posZ + TILE_DEPTH),
(self.posX + TILE_WIDTH, self.posY, self.posZ),
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ),
(self.posX, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH)
]
indices = [0, 1, 2, 0, 2, 3]
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
colors = [ (255, 255, 0, 255) ] * 4
else:
print("Unknown tile shape:", self.shape)
pass
return {
'vertices': vertices,
'indices': indices,
'uvs': uvs,
'colors': colors
}
def buffer(self, vertexBuffer): def buffer(self, vertexBuffer):
if self.shape == TILE_SHAPE_NULL: if self.shape == TILE_SHAPE_NULL: