summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2024-01-12 05:33:09 +0100
committerkdx <kikoodx@paranoici.org>2024-01-12 05:33:09 +0100
commit24edf4c91dd98a9a7f622e6ebb4658e3ed410436 (patch)
treedd24841a8c03b70459c09a217c2fe50a4291c9dd
parente6fb7a17425d49b4cc19c6df660a448478238925 (diff)
download008-24edf4c91dd98a9a7f622e6ebb4658e3ed410436.tar.gz
upside down spikesHEADmain
-rw-r--r--res/spike.mesh28
-rw-r--r--res/tset.bmpbin3210 -> 8330 bytes
-rw-r--r--res/world/0.csv18
-rw-r--r--src/cell.c13
-rw-r--r--src/mesh.c5
-rw-r--r--src/player.c2
6 files changed, 41 insertions, 25 deletions
diff --git a/res/spike.mesh b/res/spike.mesh
index 7875c34..e87b027 100644
--- a/res/spike.mesh
+++ b/res/spike.mesh
@@ -5,22 +5,22 @@ LINES
0.5 0.5 -0.5
-0.5 0.5 0.5
0.5 0.5 0.5
- 0.0 -0.3 -1.0
--0.5 0.5 -1.5
- 0.5 0.5 -1.5
- 0.0 -0.3 1.0
--0.5 0.5 1.5
- 0.5 0.5 1.5
+# 0.0 -0.3 -1.0
+#-0.5 0.5 -1.5
+# 0.5 0.5 -1.5
+# 0.0 -0.3 1.0
+#-0.5 0.5 1.5
+# 0.5 0.5 1.5
0 1
0 2
0 3
0 4
-5 1
-5 2
-5 6
-5 7
-8 3
-8 4
-8 9
-8 10
+#5 1
+#5 2
+#5 6
+#5 7
+#8 3
+#8 4
+#8 9
+#8 10
diff --git a/res/tset.bmp b/res/tset.bmp
index 8103453..33a13bf 100644
--- a/res/tset.bmp
+++ b/res/tset.bmp
Binary files differ
diff --git a/res/world/0.csv b/res/world/0.csv
index 4df35c3..e527951 100644
--- a/res/world/0.csv
+++ b/res/world/0.csv
@@ -1,17 +1,17 @@
16,16
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
-1,0,0,0,0,0,0,0,0,0,0,0,2,2,4,1
+1,0,0,0,0,3,3,3,3,0,0,0,0,0,0,1
+1,0,0,0,0,0,0,0,0,0,0,0,2,2,7,1
1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1
-1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1
-1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,1
+1,0,0,0,0,0,0,0,2,0,0,0,1,1,1,1
+1,0,2,0,0,0,0,0,3,0,0,0,0,3,3,1
1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1
1,1,1,0,0,0,0,2,2,0,0,0,0,0,0,1
-1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1
-1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1
+1,3,0,0,0,0,1,1,1,1,0,0,0,0,0,1
+1,0,0,0,0,0,0,3,3,0,0,0,0,0,2,1
1,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,0,1,1,1
-1,0,0,0,2,0,0,0,0,0,0,0,0,1,1,1
+1,0,0,0,0,0,0,0,0,0,0,0,3,1,1,1
+1,0,0,0,2,2,0,0,0,0,0,0,0,1,1,1
1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1
-1,0,3,0,1,1,1,2,2,2,0,0,0,2,2,1
+1,0,6,0,1,1,1,2,2,2,0,0,0,2,2,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 \ No newline at end of file
diff --git a/src/cell.c b/src/cell.c
index 218ec48..25acf8f 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -72,13 +72,17 @@ cell_draw(Cell *this, f64 x, f64 y)
extern Mesh *g_dot;
Mat4 m = mat4_identity();
- m = mat4_dot(m, mat4_scaling(1, 1, 48));
+ m = mat4_dot(m, mat4_scaling(1, 1, 16));
m = mat4_dot(m, mat4_translating(-7.5 - x, -7.5 - y, -256));
Mat4 m_spike = mat4_identity();
m_spike = mat4_dot(m_spike, mat4_scaling(1, 1, 16));
m_spike = mat4_dot(m_spike, mat4_translating(-7.5 - x, -7.5 - y, -256));
+ Mat4 m_spike_down = mat4_identity();
+ m_spike_down = mat4_dot(m_spike_down, mat4_scaling(1, -1, 16));
+ m_spike_down = mat4_dot(m_spike_down, mat4_translating(-7.5 - x, -7.5 - y, -256));
+
repeat (ty, this->height) {
repeat (tx, this->width) {
switch (this->data[tx + ty * this->width]) {
@@ -103,6 +107,13 @@ cell_draw(Cell *this, f64 x, f64 y)
mesh_draw(g_spike, lm);
break;
}
+ case 3: {
+ Mat4 lm = m_spike_down;
+ lm = mat4_dot(lm, mat4_translating(tx, ty, 0));
+ TZR_DrawSetColor(1, 0, 0);
+ mesh_draw(g_spike, lm);
+ break;
+ }
default:
break;
}
diff --git a/src/mesh.c b/src/mesh.c
index 5ac96ff..42556b1 100644
--- a/src/mesh.c
+++ b/src/mesh.c
@@ -53,6 +53,9 @@ mesh_load(const char *path)
if (line[0] == '\n' && line[1] == '\0')
break;
+ if (line[0] == '#')
+ continue;
+
Point vertex;
size_t i = 0;
auto tok = strtok(line, delim);
@@ -70,6 +73,8 @@ mesh_load(const char *path)
}
while (tupsize > 1 && fgets(line, sizeof(line) - 1, fp) != nullptr) {
+ if (line[0] == '#')
+ continue;
size_t i = 0;
auto tok = strtok(line, delim);
while (tok != nullptr) {
diff --git a/src/player.c b/src/player.c
index 6048bc7..ff578c9 100644
--- a/src/player.c
+++ b/src/player.c
@@ -3,7 +3,7 @@ static Point pos;
void
player_reset(void)
{
- const auto spawn = world_find(2);
+ const auto spawn = world_find(5);
pos = point(spawn.x, spawn.y, 0);
}