diff options
-rw-r--r-- | res/spike.mesh | 28 | ||||
-rw-r--r-- | res/tset.bmp | bin | 3210 -> 8330 bytes | |||
-rw-r--r-- | res/world/0.csv | 18 | ||||
-rw-r--r-- | src/cell.c | 13 | ||||
-rw-r--r-- | src/mesh.c | 5 | ||||
-rw-r--r-- | src/player.c | 2 |
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 Binary files differindex 8103453..33a13bf 100644 --- a/res/tset.bmp +++ b/res/tset.bmp 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 @@ -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; } @@ -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); } |