From 6a403e6cafb5dc98b4f04282187cccfa05ab9fd5 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Tue, 30 Jun 2026 18:21:46 -0500 Subject: [PATCH] Add test hill --- assets/chunks/0_0_0.dcf | Bin 32864 -> 32864 bytes assets/meshes/chunks/chunk_0_0_0_0.dmf | Bin 28932 -> 28932 bytes assetsraw/chunks/chunk_0_0_0.json | 1470 ++++-------------------- src/dusk/rpg/entity/entity.c | 4 +- src/dusk/rpg/overworld/tile.h | 20 +- tools/asset/chunk/__main__.py | 73 +- 6 files changed, 319 insertions(+), 1248 deletions(-) diff --git a/assets/chunks/0_0_0.dcf b/assets/chunks/0_0_0.dcf index 943bd015b90b8d28ef8d1cd5d2d95cac1b13deaf..516bdc2cb8a87b3aa29f721163fadd3944a6f0b0 100644 GIT binary patch delta 68 zcmaFR!1SPjX~PC4PBsPx1|}e8pD1X~$qZzG04s>Y0c5ZMG3UgG=O_AzY*t{o!89>} OWitnhK;>kPh6n)E$quss delta 30 lcmaFR!1SPjX~PDljUOTyC;EtN7GVET0VKXKP3CBb007XC41WLs diff --git a/assets/meshes/chunks/chunk_0_0_0_0.dmf b/assets/meshes/chunks/chunk_0_0_0_0.dmf index ceceabbafa1a9d1fca2b65714bf4c5559ddd7dd3..1271d94d07ec2d13fde5c2a167fb278f0cc67f30 100644 GIT binary patch delta 357 zcmZp9#MttPal<(g9TI08w2K0JbI|TnuJ>gO}K3 zzd#j`{vff*U4dXb8@!|@|ML>qd@N9e4djLi5n_|Kg-cB4iZB723^Emr5hfpq7n__F z0oDy-dc})Oz7_!Df{Z;E0kU9nL!{VduE<~FlUY24(m?(JyADJH&4Ks_YA#d^;%aRE L#;p!)Cfr>B2Gd$E delta 232 zcmZp9#MttPal<>0$(uZ6CUbf6Og0LTncU?lFuBV~WOA6Nz~m-JiOF?9+ATn2@+Ba9 zmuJG{FfW DCF + DMF # --------------------------------------------------------------------------- +def _tile_quad(u0, u1, v0, v1, fx, fy, sw_z, se_z, ne_z, nw_z): + """Six vertices (2 CCW triangles) for a quad with per-corner Z heights. + Corner order: SW=(fx,fy), SE=(fx+1,fy), NE=(fx+1,fy+1), NW=(fx,fy+1). + NORTH=+Y, EAST=+X (matches entityDirGetRelative).""" + verts = [ + (u0, v0, fx, fy, sw_z), + (u1, v0, fx+1, fy, se_z), + (u1, v1, fx+1, fy+1, ne_z), + (u0, v0, fx, fy, sw_z), + (u1, v1, fx+1, fy+1, ne_z), + (u0, v1, fx, fy+1, nw_z), + ] + buf = bytearray() + for v in verts: + buf += struct.pack('<5f', *v) + return bytes(buf) + + +# Per-shape corner heights as (sw, se, ne, nw) offsets from tile base Z. +# NORTH=+Y, EAST=+X. Cardinal ramps: low face at 0, high face at 1. +# Diagonal ramps: opposite corner at 0/1, adjacent corners at 0.5. +_RAMP_CORNERS = { + TILE_SHAPE_GROUND: (0.0, 0.0, 0.0, 0.0), + TILE_SHAPE_RAMP_NORTH: (0.0, 0.0, 1.0, 1.0), # south=low, north=high + TILE_SHAPE_RAMP_SOUTH: (1.0, 1.0, 0.0, 0.0), # south=high, north=low + TILE_SHAPE_RAMP_EAST: (0.0, 1.0, 1.0, 0.0), # west=low, east=high + TILE_SHAPE_RAMP_WEST: (1.0, 0.0, 0.0, 1.0), # west=high, east=low + TILE_SHAPE_RAMP_NORTHEAST: (0.0, 0.0, 1.0, 0.0), # only NE raised + TILE_SHAPE_RAMP_NORTHWEST: (0.0, 0.0, 0.0, 1.0), # only NW raised + TILE_SHAPE_RAMP_SOUTHEAST: (0.0, 1.0, 0.0, 0.0), # only SE raised + TILE_SHAPE_RAMP_SOUTHWEST: (1.0, 0.0, 0.0, 0.0), # only SW raised +} + + def build_terrain_verts(tiles_bytes): - """Generate top-face quads for every TILE_SHAPE_GROUND tile.""" + """Generate quads for every non-null tile, shaped to match tile type.""" buf = bytearray() for z in range(CHUNK_DEPTH): for y in range(CHUNK_HEIGHT): @@ -157,22 +199,19 @@ def build_terrain_verts(tiles_bytes): tile_type = struct.unpack_from( '