aboutsummaryrefslogtreecommitdiff
path: root/src/level.zig
diff options
context:
space:
mode:
authortslil clingman <>2021-10-07 11:25:09 -0400
committertslil clingman <>2021-10-07 11:33:36 -0400
commitd4f2376bb0ea219b79dac3f4f37b77342ca6ef4a (patch)
treee4afd788bfca55acddb37f5fdf23bb972ff7c14a /src/level.zig
parentd78ee4134820941bd1680f6a3362352059753087 (diff)
Variable height ceilings!
Plus bonus graphical artefacts around the edges of such! In the end the majority of this code was rather easy: take the upwards floor drawing code and reflect it. However, there were many edge-cases and plenty of off-by-one pixels and rounding issues that didn't quite work the same way going down as they do going up. Also the object drawing code used to take advantage of the fact that the z-buffer was painted bottom-up only, so that required change too.
Diffstat (limited to 'src/level.zig')
-rw-r--r--src/level.zig11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/level.zig b/src/level.zig
index 1d61a02..a5d7330 100644
--- a/src/level.zig
+++ b/src/level.zig
@@ -27,12 +27,17 @@ pub const Object = struct {
};
pub const Cell = struct {
- height: f32,
- wall_texture: u8 = 0,
+ floor_height: f32 = 0,
+ ceiling_height : f32 = DEFAULT_HEIGHT,
+ draw_down: bool = false,
+ lower_texture: u8 = 0,
+ upper_texture: u8 = 0,
floor_texture: u8 = 0,
ceiling_texture: u8 = 2,
- const floor = Cell{ .height = 0 };
+ pub const floor = Cell{ };
+
+ pub const DEFAULT_HEIGHT : f32 = 4;
};
pub const Map = struct {