From 9f657ffcf9838745fb36fc77c300e91b40c32018 Mon Sep 17 00:00:00 2001 From: asrael Date: Fri, 27 Feb 2026 08:21:12 -0600 Subject: [PATCH] feat: distinct material palette for BSP 2 courtyard --- demo/mod/first_person3d.fnl | 31 +++++++++++++++++++++++-------- pxl8d/src/world.rs | 4 ++-- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/demo/mod/first_person3d.fnl b/demo/mod/first_person3d.fnl index 20c1240..cc10e25 100644 --- a/demo/mod/first_person3d.fnl +++ b/demo/mod/first_person3d.fnl @@ -41,6 +41,7 @@ (var cam-z 416) (var camera nil) (var ceiling-tex nil) +(var current-bsp-id 1) (var floor-tex nil) (var land-squash 0) (var last-dt 0.016) @@ -63,6 +64,11 @@ (local STONE_WALL_START 2) (local WOOD_COLOR 88) +(local ASHLAR_COLOR 64) +(local ASHLAR_MOSS 68) +(local STONE_FLOOR_COLOR 72) +(local STONE_TRIM_COLOR 72) + (fn preload [] (when (not network) (set network (net.get)) @@ -83,6 +89,20 @@ (let [chunk (world:active_chunk)] (and chunk (chunk:ready))))) +(fn setup-textures [bsp-id] + (if (= bsp-id 2) + (do + (set floor-tex (textures.rough-stone 44442 STONE_FLOOR_COLOR)) + (set wall-tex (textures.ashlar-wall 55552 ASHLAR_COLOR ASHLAR_MOSS)) + (set trim-tex (textures.rough-stone 77772 STONE_TRIM_COLOR)) + (set ceiling-tex (textures.plaster-wall 66662 PLASTER_COLOR))) + (do + (set floor-tex (textures.wood-planks 44444 WOOD_COLOR)) + (set wall-tex (textures.cobble-timber 55555 STONE_WALL_START MOSS_COLOR WOOD_COLOR)) + (set trim-tex (textures.wood-trim 77777 WOOD_COLOR)) + (set ceiling-tex (textures.plaster-wall 66666 PLASTER_COLOR)))) + (set current-bsp-id bsp-id)) + (fn init [] (pxl8.set_relative_mouse_mode true) (pxl8.load_palette "res/palettes/palette.ase") @@ -113,14 +133,7 @@ (set smooth-cam-x cam-x) (set smooth-cam-z cam-z)) - (when (not ceiling-tex) - (set ceiling-tex (textures.plaster-wall 66666 PLASTER_COLOR))) - (when (not floor-tex) - (set floor-tex (textures.wood-planks 44444 WOOD_COLOR))) - (when (not trim-tex) - (set trim-tex (textures.wood-trim 77777 WOOD_COLOR))) - (when (not wall-tex) - (set wall-tex (textures.cobble-timber 55555 STONE_WALL_START MOSS_COLOR WOOD_COLOR)))) + (setup-textures 1)) (fn setup-materials [] (when (and world (not bsp-materials-setup) floor-tex trim-tex wall-tex) @@ -182,6 +195,7 @@ (set smooth-cam-x 416) (set smooth-cam-z 416) (set bsp-materials-setup false) + (setup-textures 2) (set portal-cooldown 2.0)) (= current-id 2) (do @@ -194,6 +208,7 @@ (set smooth-cam-x 416) (set smooth-cam-z 416) (set bsp-materials-setup false) + (setup-textures 1) (set portal-cooldown 2.0))))))) (when world diff --git a/pxl8d/src/world.rs b/pxl8d/src/world.rs index 087ce7c..13bb8c0 100644 --- a/pxl8d/src/world.rs +++ b/pxl8d/src/world.rs @@ -4,7 +4,7 @@ use alloc::collections::BTreeMap; use crate::chunk::{Chunk, ChunkId}; use crate::math::Vec3; -use crate::procgen::{ProcgenParams, generate_rooms}; +use crate::procgen::{ProcgenParams, generate}; pub struct World { active: Option, @@ -69,7 +69,7 @@ impl World { ..Default::default() }; let p = params.unwrap_or(&default_params); - let bsp = generate_rooms(p); + let bsp = generate(p); self.chunks.insert(chunk_id, Chunk::Bsp { id, bsp, version: 1 }); } self.chunks.get(&chunk_id).unwrap()