diff --git a/CMakeLists.txt b/CMakeLists.txt
index 99ad201..cfee90c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,10 +35,6 @@ set(SOURCES
)
set(ASSETS
# Tilesets
- assets-cg/tileset_base.png
- assets-cg/tileset_decor.png
- assets-cg/tileset_base_2.png
- assets-cg/tileset_decor_2.png
assets-cg/tilesets/cavern.tsx
assets-cg/tilesets/lab.tsx
# Levels
diff --git a/assets-cg/converters.py b/assets-cg/converters.py
index 90beca4..55b2b56 100644
--- a/assets-cg/converters.py
+++ b/assets-cg/converters.py
@@ -432,12 +432,20 @@ def convert_tiled_map(input, output, params):
p = dict()
for prop in tile.find("properties").findall("property"):
name = prop.attrib["name"]
- type = prop.attrib["type"]
+ type = prop.attrib.get("type", "string")
value = prop.attrib["value"]
if type == "bool":
value = (value == "true")
- else:
+ elif type == "float":
+ value = float(value)
+ elif type == "file":
+ pass
+ elif type == "int":
+ value = int(value)
+ elif type == "string":
+ pass
+ else: # including "color" and "object"
raise Exception(f"unknown tile property type {type}")
p[name] = value
tileprops[tile_id] = p
@@ -453,9 +461,12 @@ def convert_tiled_map(input, output, params):
t2 = 0 if t2 < tileset_base else t2 - tileset_base
solid = 0
- if t1 in tileprops and tileprops[t1].get("solid", False):
- solid = 1
- tiles += bytes([solid, t1, t2])
+ plane = "FLOOR"
+ if t1 in tileprops:
+ solid = (tileprops[t1].get("solid", False) == True)
+ plane = tileprops[t1].get("plane", "FLOOR")
+ plane = ["WALL", "FLOOR", "CEILING"].index(plane)
+ tiles += bytes([solid, plane, t1, t2])
o = fxconv.Structure()
o += fxconv.u16(width)
diff --git a/assets-cg/example.png b/assets-cg/example.png
deleted file mode 100644
index 8826800..0000000
Binary files a/assets-cg/example.png and /dev/null differ
diff --git a/assets-cg/player-attack-down.aseprite b/assets-cg/player-attack-down.aseprite
deleted file mode 100644
index b05ab57..0000000
Binary files a/assets-cg/player-attack-down.aseprite and /dev/null differ
diff --git a/assets-cg/tileset_base.png b/assets-cg/tileset_base.png
deleted file mode 100644
index bb3b18b..0000000
Binary files a/assets-cg/tileset_base.png and /dev/null differ
diff --git a/assets-cg/tileset_base_2.png b/assets-cg/tileset_base_2.png
deleted file mode 100644
index 7dee4c4..0000000
Binary files a/assets-cg/tileset_base_2.png and /dev/null differ
diff --git a/assets-cg/tileset_decor.png b/assets-cg/tileset_decor.png
deleted file mode 100644
index c82e1dc..0000000
Binary files a/assets-cg/tileset_decor.png and /dev/null differ
diff --git a/assets-cg/tileset_decor_2.png b/assets-cg/tileset_decor_2.png
deleted file mode 100644
index 83775dc..0000000
Binary files a/assets-cg/tileset_decor_2.png and /dev/null differ
diff --git a/assets-cg/tilesets/cavern.tsx b/assets-cg/tilesets/cavern.tsx
index dd6b9ce..05a315a 100644
--- a/assets-cg/tilesets/cavern.tsx
+++ b/assets-cg/tilesets/cavern.tsx
@@ -3,12 +3,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets-cg/tilesets/lab.png b/assets-cg/tilesets/lab.png
index c110208..ce25be6 100644
Binary files a/assets-cg/tilesets/lab.png and b/assets-cg/tilesets/lab.png differ
diff --git a/assets-cg/tilesets/lab.tsx b/assets-cg/tilesets/lab.tsx
index 6335468..20aa6f8 100644
--- a/assets-cg/tilesets/lab.tsx
+++ b/assets-cg/tilesets/lab.tsx
@@ -1,4 +1,25 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/map.h b/src/map.h
index 0b99e58..1a3d61d 100644
--- a/src/map.h
+++ b/src/map.h
@@ -27,6 +27,8 @@ typedef struct
/* TODO: Layers of objects, stuff, dynamic elements, etc? */
/* TODO: Allow any collision shape for the tile! */
bool solid;
+ /* Rendering plane for that tile */
+ uint8_t plane;
/* Base layer: floor/wall pattern */
uint8_t base;
/* Decoration layer */
diff --git a/src/render.c b/src/render.c
index b2fdb21..50637d4 100644
--- a/src/render.c
+++ b/src/render.c
@@ -127,16 +127,17 @@ static void render_map_layer(map_t const *m, camera_t const *c, int layer)
vec2 tile_pos = { fix(col), fix(row) };
ivec2 p = camera_map2screen(c, tile_pos);
- if(!t) {
+ if(!t && layer == CEILING) {
drect(p.x, p.y, p.x+15, p.y+15, C_BLACK);
continue;
}
+ if(t->plane != layer)
+ continue;
- if(layer == 0) dsubimage(p.x, p.y, m->tileset,
+ dsubimage(p.x, p.y, m->tileset,
TILE_WIDTH * (t->base % 8), TILE_HEIGHT * (t->base / 8),
TILE_WIDTH, TILE_HEIGHT, DIMAGE_NOCLIP);
- /* Decoration layer */
- if(layer == 1 && t->decor) dsubimage(p.x, p.y, m->tileset,
+ if(t->decor) dsubimage(p.x, p.y, m->tileset,
TILE_WIDTH * (t->decor % 8), TILE_HEIGHT * (t->decor / 8),
TILE_WIDTH, TILE_HEIGHT, DIMAGE_NOCLIP);
}
@@ -264,20 +265,17 @@ void render_game(game_t const *g, bool show_hitboxes)
{
camera_t const *camera = &g->camera;
- /* Render map floor */
- render_map_layer(g->map, camera, 0);
-
- /* Render floor entities */
+ /* Render map floor and floor entities */
+ render_map_layer(g->map, camera, HORIZONTAL);
render_entities(g, camera, floor_depth_measure, show_hitboxes);
- /* Render map walls */
- render_map_layer(g->map, camera, 1);
-
- /* Render wall entities
- TODO ECS: Sort walls along wall entities! */
+ /* Render map walls and vertical entities
+ TODO ECS: Sort walls and wall entities together for proper ordering!*/
+ render_map_layer(g->map, camera, VERTICAL);
render_entities(g, camera, wall_depth_measure, show_hitboxes);
- /* Render ceiling entities */
+ /* Render ceiling tiles (including out of bounds) and ceiling entities */
+ render_map_layer(g->map, camera, CEILING);
render_entities(g, camera, ceiling_depth_measure, show_hitboxes);
extern font_t font_rogue;