aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--include/cub3d.h13
-rw-r--r--minimalist.cub14
-rw-r--r--src/event.c7
-rw-r--r--src/helper.c5
-rw-r--r--src/parse/parse.c10
-rw-r--r--src/parse/parse_color.c2
-rw-r--r--src/render.c42
-rw-r--r--src/render_state.c46
-rw-r--r--src/texture.c55
-rw-r--r--textures/barrel.xpm97
-rw-r--r--textures/bluestone.xpm90
-rw-r--r--textures/brick.xpm114
-rw-r--r--textures/colorstone.xpm96
-rw-r--r--textures/eagle.xpm126
-rw-r--r--textures/greenlight.xpm96
-rw-r--r--textures/greystone.xpm (renamed from textures/stone.xpm)26
-rw-r--r--textures/mossy.xpm16
-rw-r--r--textures/pillar.xpm91
-rw-r--r--textures/purplestone.xpm90
-rw-r--r--textures/redbrick.xpm96
-rw-r--r--textures/wood.xpm154
22 files changed, 988 insertions, 301 deletions
diff --git a/Makefile b/Makefile
index 5b4222e..8df44eb 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,8 @@ SRCFILES = main.c \
render_state.c \
helper.c \
error.c \
- capture.c
+ capture.c \
+ texture.c
SRC = $(addprefix $(SRCDIR)/,$(SRCFILES))
$(info $(SRC))
OBJ = $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
diff --git a/include/cub3d.h b/include/cub3d.h
index 2c5d0c3..4f5b38c 100644
--- a/include/cub3d.h
+++ b/include/cub3d.h
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/15 06:40:37 by cacharle #+# #+# */
-/* Updated: 2020/01/30 15:05:20 by cacharle ### ########.fr */
+/* Updated: 2020/02/01 11:58:35 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
@@ -206,7 +206,7 @@ int render_update(void *param);
void render_update_window(t_state *state);
void render_column(t_state *state, int x);
void render_window_column(t_state *state, t_render_state *rstate);
-void render_texture(t_state *state, t_render_state *rstate);
+void render_texture(t_state *state, t_render_state *rstate, int *i);
/*
** vector.c
@@ -254,8 +254,13 @@ void rstate_init_probe(t_state *state, t_render_state *rstate);
void rstate_perp_dist(t_state *state, t_render_state *rstate);
void rstate_line_height(t_state *state, t_render_state *rstate);
void rstate_next_probe(t_render_state *rstate);
-t_image *get_tex(t_state *state, t_render_state *rstate);
-int get_tex_x(t_state *state, t_render_state *rstate, t_image *texture);
+
+/*
+** texture.c
+*/
+
+t_image *texture_select(t_state *state, t_render_state *rstate);
+int texture_x(t_state *state, t_render_state *rstate, t_image *texture);
/*
** capture.c
diff --git a/minimalist.cub b/minimalist.cub
index a1d6433..a50631f 100644
--- a/minimalist.cub
+++ b/minimalist.cub
@@ -1,12 +1,12 @@
-R 700 500
+R 1500 1200
NO ./textures/wood.xpm
-SO ./textures/wood.xpm
-WE ./textures/brick.xpm
-EA ./textures/stone.xpm
+SO ./textures/eagle.xpm
+WE ./textures/redbrick.xpm
+EA ./textures/eagle.xpm
-S ./textures/brick.xpm
-F 0,225,0
-C 200,200,0
+S ./textures/barrel.xpm
+F 10,10,50
+C 20,20,0
1 1 1 1 1 1 1 1 1 1 1 1 1 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 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
diff --git a/src/event.c b/src/event.c
index 9dcaa75..cff9e5d 100644
--- a/src/event.c
+++ b/src/event.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/15 06:39:37 by cacharle #+# #+# */
-/* Updated: 2020/01/30 15:20:18 by cacharle ### ########.fr */
+/* Updated: 2020/02/01 12:30:49 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,6 +17,9 @@
int event_keydown(int key, t_state *state)
{
+ t_vector saved_pos;
+
+ saved_pos = state->pos;
if (key == MLXK_ESC)
state->running = FALSE;
else if (key == MLXK_A)
@@ -35,6 +38,8 @@ int event_keydown(int key, t_state *state)
helper_rotate_player(state, -ROTATE_STEP);
else if (key == MLXK_RIGHT)
helper_rotate_player(state, ROTATE_STEP);
+ if (state->map[(int)state->pos.y][(int)state->pos.x] == CELL_WALL)
+ state->pos = saved_pos;
return (0);
}
diff --git a/src/helper.c b/src/helper.c
index 9940848..6fa7ffe 100644
--- a/src/helper.c
+++ b/src/helper.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/11 07:32:20 by cacharle #+# #+# */
-/* Updated: 2020/01/16 08:57:01 by cacharle ### ########.fr */
+/* Updated: 2020/02/01 11:32:15 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -38,7 +38,8 @@ void helper_rotate_player(t_state *state, double rotation)
/*
** Initial player direction vector
-** Since the map [0 0] is in the top left corner the north/south direction are slipped.
+** Since the map [0 0] is in the top left corner
+** the north/south direction are slipped.
** The camera plane has to stay perpendicular to the direction and
** create a camera with a 66 degree angle (which is a recommended angle for fps)
*/
diff --git a/src/parse/parse.c b/src/parse/parse.c
index f4b5b66..581056a 100644
--- a/src/parse/parse.c
+++ b/src/parse/parse.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/15 09:29:21 by cacharle #+# #+# */
-/* Updated: 2020/01/30 12:03:54 by cacharle ### ########.fr */
+/* Updated: 2020/02/01 11:35:32 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -32,8 +32,8 @@ t_state *parse(char *filename)
"parse configuration", state, lines));
}
if ((state = parse_map(state, lines + i)) == NULL)
- return (error_put_return_lines_state_destroy(
- "parse map", state, lines));
+ return (error_put_return_lines_state_destroy("parse map",
+ state, lines));
helper_free_splited(lines);
return (state);
}
@@ -73,8 +73,6 @@ static t_option_parser g_option_parsers[] =
{"C", parse_ceilling_color}
};
-#define OPTIONS_PARSERS_SIZE (sizeof(g_option_parsers) / sizeof(t_option_parser))
-
t_bool parse_line(t_state *state, char *line)
{
int i;
@@ -82,7 +80,7 @@ t_bool parse_line(t_state *state, char *line)
if (!*line)
return (TRUE);
i = -1;
- while (++i < (int)OPTIONS_PARSERS_SIZE)
+ while (++i < (int)(sizeof(g_option_parsers) / sizeof(t_option_parser)))
if (ft_strncmp(g_option_parsers[i].id, line,
ft_strlen(g_option_parsers[i].id)) == 0)
return (g_option_parsers[i].func(
diff --git a/src/parse/parse_color.c b/src/parse/parse_color.c
index fd482e5..3c025de 100644
--- a/src/parse/parse_color.c
+++ b/src/parse/parse_color.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/11 09:52:34 by cacharle #+# #+# */
-/* Updated: 2020/01/30 14:17:37 by cacharle ### ########.fr */
+/* Updated: 2020/02/01 11:32:33 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
diff --git a/src/render.c b/src/render.c
index 88b0cae..820036d 100644
--- a/src/render.c
+++ b/src/render.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/11 13:37:17 by cacharle #+# #+# */
-/* Updated: 2020/01/30 15:17:49 by cacharle ### ########.fr */
+/* Updated: 2020/02/01 12:06:58 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -24,7 +24,8 @@ int render_update(void *param)
return (0);
}
render_update_window(state);
- mlx_put_image_to_window(state->mlx_ptr, state->window_ptr, state->window.id, 0, 0);
+ mlx_put_image_to_window(state->mlx_ptr, state->window_ptr,
+ state->window.id, 0, 0);
return (0);
}
@@ -43,7 +44,7 @@ void render_column(t_state *state, int x)
rstate.x = x;
rstate_ray(state, &rstate);
- rstate.map_pos = vector_new((double)((int)state->pos.x), (double)((int)state->pos.y)); //floor?
+ rstate.map_pos = vector_new((double)((int)state->pos.x), (double)((int)state->pos.y));
rstate_delta(&rstate);
rstate_init_probe(state, &rstate);
rstate.map_step = vector_new(rstate.ray.x < 0.0 ? -1.0 : 1.0, rstate.ray.y < 0.0 ? -1.0 : 1.0);
@@ -73,35 +74,32 @@ void render_window_column(t_state *state, t_render_state *rstate)
white.hexcode = 0x00ffffff;
i = 0;
while (i < rstate->draw_start)
- ((t_color*)state->window.data)[i++ * state->window.width + rstate->x] = state->ceilling_color;
- while (i < rstate->draw_end)
- ((t_color*)state->window.data)[i++ * state->window.width + rstate->x] = white;
- render_texture(state, rstate);
- i = rstate->draw_end;
+ ((t_color*)state->window.data)[i++ * state->window.width + rstate->x] =
+ state->ceilling_color;
+ render_texture(state, rstate, &i);
while (i < state->window.height)
- ((t_color*)state->window.data)[i++ * state->window.width + rstate->x] = state->floor_color;
+ ((t_color*)state->window.data)[i++ * state->window.width + rstate->x] =
+ state->floor_color;
}
-void render_texture(t_state *state, t_render_state *rstate)
+void render_texture(t_state *state, t_render_state *rstate, int *i)
{
- int i;
- double step;
- double tex_pos;
- int tex_y;
int tex_x;
+ int tex_y;
+ double tex_step;
+ double tex_pos;
t_image *texture;
- texture = get_tex(state, rstate);
- tex_x = get_tex_x(state, rstate, texture);
- step = 1.0 * texture->height / rstate->line_height;
- tex_pos = (rstate->draw_start - state->window.height / 2 + rstate->line_height / 2) * step;
- i = rstate->draw_start - 1;
- while (++i < rstate->draw_end)
+ texture = texture_select(state, rstate);
+ tex_x = texture_x(state, rstate, texture);
+ tex_step = (double)texture->height / (double)rstate->line_height;
+ tex_pos = (rstate->draw_start - state->window.height / 2 + rstate->line_height / 2) * tex_step;
+ while (++(*i) < rstate->draw_end)
{
tex_y = (int)tex_pos & (texture->height - 1);
- tex_pos += step;
- ((t_color*)state->window.data)[i * state->window.width + rstate->x] =
+ tex_pos += tex_step;
+ ((t_color*)state->window.data)[*i * state->window.width + rstate->x] =
((t_color*)texture->data)[texture->height * tex_y + tex_x];
}
}
diff --git a/src/render_state.c b/src/render_state.c
index 46fc7c5..ff777e2 100644
--- a/src/render_state.c
+++ b/src/render_state.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/15 14:40:14 by cacharle #+# #+# */
-/* Updated: 2020/01/30 15:50:48 by cacharle ### ########.fr */
+/* Updated: 2020/02/01 11:39:09 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -159,47 +159,3 @@ void rstate_line_height(t_state *state, t_render_state *rstate)
{
rstate->line_height = (int)((double)state->window.height / rstate->perp_dist);
}
-
-t_image *get_tex(t_state *state, t_render_state *rstate)
-{
- if (rstate->side == SIDE_NS)
- {
- if (rstate->probe.y < state->pos.y)
- return (state->textures + TEX_NORTH);
- else
- return (state->textures + TEX_SOUTH);
- }
- else if (rstate->side == SIDE_WE)
- {
- if (rstate->probe.x > state->pos.x)
- return (state->textures + TEX_WEST);
- else
- return (state->textures + TEX_EAST);
- }
- return (NULL);
-}
-
-/*
-** Since we're drawing each column, all the texels we want to draw on the window
-** are on a single column of the texture.
-** First we find the x-coord relative to the wall we hit
-*/
-
-int get_tex_x(t_state *state, t_render_state *rstate, t_image *texture)
-{
- int tex_x;
- double wall_x;
-
- if (rstate->side == SIDE_WE)
- wall_x = state->pos.y + rstate->perp_dist * rstate->ray.y;
- else
- wall_x = state->pos.x + rstate->perp_dist * rstate->ray.x;
- wall_x -= floor(wall_x);
-
- tex_x = (int)(wall_x * (double)texture->width);
- if (rstate->side == 0 && rstate->ray.x > 0)
- tex_x = texture->width - tex_x - 1;
- if (rstate->side == 1 && rstate->ray.y < 0)
- tex_x = texture->width - tex_x - 1;
- return (tex_x);
-}
diff --git a/src/texture.c b/src/texture.c
new file mode 100644
index 0000000..725e0aa
--- /dev/null
+++ b/src/texture.c
@@ -0,0 +1,55 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* texture.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/01 11:38:43 by cacharle #+# #+# */
+/* Updated: 2020/02/01 12:24:40 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "cub3d.h"
+
+t_image *texture_select(t_state *state, t_render_state *rstate)
+{
+ if (rstate->side == SIDE_NS)
+ {
+ if (rstate->map_pos.y < state->pos.y)
+ return (state->textures + TEX_NORTH);
+ else
+ return (state->textures + TEX_SOUTH);
+ }
+ else if (rstate->side == SIDE_WE)
+ {
+ if (rstate->map_pos.x > state->pos.x)
+ return (state->textures + TEX_WEST);
+ else
+ return (state->textures + TEX_EAST);
+ }
+ return (NULL);
+}
+
+/*
+** Since we're drawing each column, all the texels we want to draw on the window
+** are on a single column of the texture.
+** First we find the x-coord relative to the wall we hit
+*/
+
+int texture_x(t_state *state, t_render_state *rstate, t_image *texture)
+{
+ int tex_x;
+ double wall_x;
+
+ if (rstate->side == SIDE_WE)
+ wall_x = state->pos.y + rstate->perp_dist * rstate->ray.y;
+ else
+ wall_x = state->pos.x + rstate->perp_dist * rstate->ray.x;
+ wall_x -= floor(wall_x);
+ tex_x = (int)(wall_x * (double)texture->width);
+ if ((rstate->side == SIDE_NS && rstate->ray.x > 0) ||
+ (rstate->side == SIDE_WE && rstate->ray.y < 0))
+ tex_x = texture->width - tex_x - 1;
+ return (tex_x);
+}
diff --git a/textures/barrel.xpm b/textures/barrel.xpm
new file mode 100644
index 0000000..7d45baf
--- /dev/null
+++ b/textures/barrel.xpm
@@ -0,0 +1,97 @@
+/* XPM */
+static char *barrel[] = {
+/* columns rows colors chars-per-pixel */
+"64 64 27 1 ",
+" c black",
+". c gray11",
+"X c #231C0A",
+"o c #312611",
+"O c #382A15",
+"+ c #3F3115",
+"@ c gray15",
+"# c #313131",
+"$ c #3F3F3F",
+"% c #493418",
+"& c #50381C",
+"* c #5E3F1F",
+"= c #654223",
+"- c #704626",
+"; c #774D2A",
+": c #7E502D",
+"> c #494949",
+", c gray34",
+"< c #626262",
+"1 c #6C6C6C",
+"2 c gray48",
+"3 c #885431",
+"4 c #8C5734",
+"5 c #935B38",
+"6 c #9D623B",
+"7 c #A4693F",
+"8 c gray52",
+/* pixels */
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" <<<<<<<<<1111112222 ",
+" 1<>>>>>>>>>>>,,,,,<<<21 ",
+" 12>#....@@@@@@@##$$$$><>< ",
+" 112882211111<<<<,,,,>>$## ",
+" 33112211<<<,,,,>>>$$$####++ ",
+" ;4:33;---====***&&&++++++&+ ",
+" 3;446737664:5543:=*-==%=*++&+ ",
+" ;4;6745766:;5543:=*--=*&=*+&+ ",
+" ;4;6737666::5543:-&---=%=*+&$ ",
+" >,12<737665:5543:;-&---=%$$$$# ",
+" ><1122821111<<<<<,,,,,>>>>####+ ",
+" >111112<<<<,,,,>>>>>>$$$$#####+ ",
+" ;=>,<11<<<<,,,,>>>>>>$$$$$###&+ ",
+" ;4;644&3:;-+===****X&++++%&&+&+ ",
+" ;4;67747666:5433:;-&---=*%&&+&+ ",
+" ;4;67747666:5433:;-&---=*%&&+&+ ",
+" ;4;67747666;5433:;-&---=*%&&+&+ ",
+" ;4;67747666;5433:;-&---=*%&&+&+ ",
+" ;4;67747666;5433:;-&---=*%&&+&+ ",
+" ;4;67747666;5433:;-&---=*%&&+&+ ",
+" 14;67737666-5433:;-&---=*%&&+$$ ",
+" <2221737666-5433:;-&---=*%$$$$# ",
+" ,11128211111<<<<<,,,,,>>>>$### ",
+" >,<1121<<<<,,,,>>>>>>$$$$$####O ",
+" =>,,,<<<<<,,,,>>>>>>$$$$$OOO%& ",
+" ;;------**o**&&&&&X&&&&OO&+&+& ",
+" ;4;5737553=3::::;-&--=*+&&+&+ ",
+" ;446;5553=;::::;*&--=*+&&+&+ ",
+" <4;44;553=-:::;-&&--=&+&+&+ ",
+" <2824;333-=;;;;-&*-=*+&+++# ",
+" 1112222111<<,,,>>>$$$##@. ",
+" 1<11<<<,,,,>>>>$$$###@@ ",
+" >>>>>$$$$$####@@@@@ "
+};
diff --git a/textures/bluestone.xpm b/textures/bluestone.xpm
new file mode 100644
index 0000000..c8951d9
--- /dev/null
+++ b/textures/bluestone.xpm
@@ -0,0 +1,90 @@
+/* XPM */
+static char *bluestone_png[] = {
+/* columns rows colors chars-per-pixel */
+"64 64 20 1 ",
+" c black",
+". c #202020",
+"X c #2C2C2C",
+"o c gray22",
+"O c #000040",
+"+ c #00004C",
+"@ c #000058",
+"# c #000064",
+"$ c #000070",
+"% c #00007C",
+"& c gray33",
+"* c #000088",
+"= c #000098",
+"- c #0000A4",
+"; c #0000B0",
+": c #0000BC",
+"> c #0000C8",
+", c #0000D4",
+"< c #0000E0",
+"1 c #4040FC",
+/* pixels */
+"o$%%%%%%%%%%%%%%%%%%%$oo****************************oo$%%%%%%%$X",
+".---------------------..::::::::::::::::::::::::::::..;;;;;;;;;.",
+" ---*-%--=%==%==%-%$$@ .:-:;%-:=$$=*--*$*-:-*=-::-=$ .;:-=-;;=% ",
+" -=%*===%%-=-#==%$%%$# .::-===$=@$@@%--#$$#$$@$**$#$ .;;--%=--@ ",
+" -*-$>>=%%%=**%#@%$@@# . .;-;::;-%% ",
+" -*%->>#%%%-===*$$%@@O .-------------------...........;:-;-%%#@ ",
+" -==;;---=---==$$#@#$# .-:::;-==:==;==;::-- .----==#..;==-%**## ",
+" --=-;;-=%#--=**%##@OO .-;:<>;-:-===;;---=- .-==*=%# .;==-$***# ",
+" -=%=--*=%=$$***$%%#@O .-;>:>=;--:==-%-%=-% .-===%%# .;:-=--**O ",
+" -***-%%%--$@##$#%%%@O .-;;;===;----=*#%%%# .--=%%@@ .:%%=--=@O ",
+" =%*-**$=--$$#@###%%@O .-:;;;==;::--##*%%#@ .--=%-%@ .:%:-%==@O ",
+" =*=%%-*#%@%#@#%O@OO#O .-:--;;;;:;;-##$-##O .-%*=%@@ .::%%##%%O ",
+" =%=%#**%#%#%#O$$OOO#O .-;--=:==-;;-==%%@@# .-***$$# .:%$#%#%%O ",
+" ==%%%$#@@#%#$#OO$O#@O .-;<>**==*%%%*=*%##O .--**$$# .:%%$@@@@O ",
+" =%=##$#%#OOOOOOOOOOOO .-:>>***--%**%*$%#@O .-%=-@@@ . ",
+" .-:--=**---**=##%#@O .---=-@# ...........",
+"-:;-;-----;---- ;;;--== -;=-*=----%==%%@@OO .=-=-=$# .---- :::::",
+":;-=-:;-*--%-=% ;;=::%: ----:-=---*#$%OO#@O .==%$%$@ .-;*% ::-;:",
+":;==*--*%==%%== ;::;=%% -;=-:-*%**#%%$OO#OO .==@@@#O .-;;% :-;;;",
+";-=;;==%%%=%%%% ;:;;==# -;---*-%%#$$@@@##@O .=%@#@@O .-*%@ :::;;",
+"-*=;:;%%==%=@%% ;:=%==# ---====%#@##@##@OOO .=%#@@OO .-@#@ ::;;;",
+"--*=;,%=%%##$%% ;=:%%%# . .::--=",
+";*%*=-=%%=#$%@@ ;==#%%@ .........................;;;;;;;;..:--==",
+";-*=%=%==%$%#%@ ;:=*#@# .;;;;;;;;;;;;;;;;;;;;=-..;>;>---= .:;===",
+";;=*;====%%$@@@ -:%**#@ .;:;-:::;:-;-:;%-:::%-@ .;>;>>-=* .::===",
+";-*%*;;#%=**$@# -%#$$@# .;:-;><<:,<-:--::----%@ .;>>>>-*% .:;:--",
+"-=%*-;;-=%**$@# =%@@@@# .;;-:,,<:<,,;%-%%-%%-@@ .;;->-*-# .:::--",
+";=;==-;-#%$$$@@ .;::;;>>--,,--%%%$-%%@@ .;>----*# .:::;;",
+"-**--=--#$@#@OO .........;;:;;;---:---%**%%@@@# .;>>--*%$ .:--:;",
+"-=*---=%$#@##@@ .;;;;--..;--:;**-:;%--%***$$$@@ .;>>==--@ .:--;;",
+"=*=*--%##@@@#O# .;;*-=* .;:;:;**---%---$**@$$$O .;;>===-@ .::==%",
+"=**%**%##$%%#OO .;--=*= .;::-;;;=-%%%--$@#@#$$O .;;-*;--# .:**==",
+"=*-=$%%$#$%%#@O .;-=*$# .;:-%-;;--%$%#$$$@OO@OO .;;>*;;=# .:**%%",
+"=-=**%##@++$#@O .;;*;*@ .;--:%--=%$%%##$$#OO##O .;->-*==@ .::%%%",
+"%==*%%%%@++@@#O .;;;$$# .;%:%--%%$#%%%##@@###+O .;>--=@$# .:--==",
+"%**%$%%%@@#@@@@ .;;;-@@ .;-:%--$##@%%%#@@@@+++O .;>-=%=$@ .:--=*",
+"%*#$%#%%@#@O@#@ .;==@*# .;-%--%@@@@####@OOOOOOO .;>-%==%# .:=--%",
+"%=%#%#$@#OO@OOO .;==;@# . .-;-%#%%# .:=**%",
+"%*=*$%$@@@O#O@O .;;*;*@ .........................-;;-%@#O .::**%",
+"%=*%#$%$OOOOOOO .;;**@# .----------------------..-;-:-%#O .:==%*",
+" .;;%%@@ .-::::::;-------=*%:=-% .->--:*@O . ",
+".....@@$$***%$#..-;%%%@ .;:>>:--;;>:==--=%*%*=% .----**@O .*=** ",
+".=-;:::::::::::..--*%%# .;:>>>;;;;::%%%%---==%# .->-%$@@O .==%% ",
+".-:::::;-;:---: .--=@## .;::::,,;;;%%%%%%=%%$=# .-;*$#@$O .=%$$ ",
+".-:;;,,;:::=-:: .-=*@@@ .;::;:,,,%-=%%$$$*%%%%# .--$#$@@O .=$%@ ",
+".:::;,,:==-::=; . .-;:;::,,:--=%$$##@%%%# .*%%@@@#O .*%$@ ",
+".:-;-;;;===:-** .........--;>==:-:----%%##%#@++ . .*$@# ",
+".::;=*;;-==-::- .::;--=..-->>===;---%%=*$##@@OO ............... ",
+".::=-:;*-;;;%-- .:%:*=* .-:::;==:::-%%%%###@@OO .;;;;:::::::::: ",
+".::::-*:*;%%-*- .:-;;=% .-;--;;;::::-%*$@###$@+ .;;--;;;;-*:--% ",
+".:-:=--:;=%+%-- .::%-%$ .-:---=-::::---@@@@#$$# .;-;,,;;;=---=% ",
+".:;==:<:-*-%%-- .:;--%- .-::--:**:::---$@@#@+++ .;::,>>;;**-=%# ",
+".:-:-<1<==-=*%* .:;-%-$ .--:==%%%*---%%%##@@@OO .;=:=>>;;--%%%@ ",
+".:;:;:<:-%--++# .:-;;%# .--:-**%%%*%*@@==$$@+OO .;:;===--%%%%@# ",
+".:-:;;;***%$++# .::;=*# .-=::=:%%*%%*%@==*$$#@# .;;-===-%$#%@@# ",
+".-:;;-%%=-==%## .:;-**% .-:=-:-*%$$**@@%==%$@@O .;;=-==-%$#$%@@ ",
+".:-:;**;%--=$%@ .:-:%%% .-:---=*--$$@$@@%%%#@@O .;;:;*;;=%#==@O ",
+".:-:-=*%#*--=$# .::-### .---==%*---$#$$@+++#OOO .::;*-;;;=%==%O ",
+".;-***-#+#*==$$ .:;-%$@ .-;-==:-%--@@$$#@OO@OOO .:;-*--;;=%%%%O ",
+".;-$#*#-%%=@#@@ .;-###@ .-;:%::-@###@@+++OO+@OO .:;-:--%*$$%%@O ",
+".--**#*@#@#$#$# .;-*$## .--;:-%=@###@@OO$$#O+O@ .:::=-%%$%%$#O# ",
+".-=%%%%%$$$$%%%..-*%%%%..--=-=%%%%%%$#@@%%%%@@$..:--%=-%%%%%$$% ",
+"o***%%%%%%%%%%%oo**%%%%oo->*****%%%%%%%%%%%%%%%oo:**%%%%%%%%%%%.",
+"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&o"
+};
diff --git a/textures/brick.xpm b/textures/brick.xpm
deleted file mode 100644
index 691f4c0..0000000
--- a/textures/brick.xpm
+++ /dev/null
@@ -1,114 +0,0 @@
-/* XPM */
-static char *_z63a_fwq0i[] = {
-/* columns rows colors chars-per-pixel */
-"32 32 76 1 ",
-" c #280C0C",
-". c #2A0C0C",
-"X c #2B0D0D",
-"o c #2D0D0D",
-"O c #2F0D0D",
-"+ c #300E0E",
-"@ c #320E0E",
-"# c #330F0F",
-"$ c #350F0F",
-"% c #361010",
-"& c #481414",
-"* c #491515",
-"= c #4B1515",
-"- c #4C1616",
-"; c #4E1616",
-": c #501616",
-"> c #511717",
-", c #531717",
-"< c #541818",
-"1 c #561818",
-"2 c #571919",
-"3 c #561B19",
-"4 c #561C1A",
-"5 c #591919",
-"6 c #581C1A",
-"7 c #591D1B",
-"8 c #5B1D1B",
-"9 c #5D1D1B",
-"0 c #5E1E1C",
-"q c #601E1C",
-"w c #611F1D",
-"e c #621F1D",
-"r c #64231F",
-"t c #652320",
-"y c #672320",
-"u c #692320",
-"i c #6A2421",
-"p c #6B2421",
-"a c #6E2623",
-"s c #752A25",
-"d c gray40",
-"f c #686868",
-"g c #6F6F6F",
-"h c gray44",
-"j c #717171",
-"k c gray48",
-"l c #7C7C7C",
-"z c gray49",
-"x c #7E7E7E",
-"c c #808080",
-"v c #818181",
-"b c gray52",
-"n c gray53",
-"m c #8B8B8B",
-"M c #8D8D8D",
-"N c gray56",
-"B c #909090",
-"V c #929292",
-"C c #939393",
-"Z c gray58",
-"A c #959595",
-"S c gray59",
-"D c #979797",
-"F c #989898",
-"G c gray60",
-"H c #9B9B9B",
-"J c gray61",
-"K c #9D9D9D",
-"L c #A2A2A2",
-"P c #A4A4A4",
-"I c #A5A5A5",
-"U c gray65",
-"Y c #AFAFAF",
-"T c #B1B1B1",
-"R c #B4B4B4",
-"E c gray71",
-/* pixels */
-"kbMFDDJKNBNNNBBBNNNBNBNYETLIPDmn",
-".sypuuyuurtq09w778qw439979q7687f",
-"Ou8e9904940w*--->11,=:<=*<:*:;,d",
-"$i4*,:,<:;11<<;-=1&->;,=;>-==-<g",
-"$y0::;->*:,12,,-=;>::<=;<-,>-=*h",
-"+a<>:,2<&><>11:=,-->,,<1->:,*=,x",
-"@0>:&>*<>;1-;;<::2:=<-;-<>;1<:1l",
-"oe=-<>*,<>,-<,:&>-<:;:1,1=><>2=Z",
-"#,=;=-:>-*:,,-::>&=1,;2-=>:>,>:V",
-"O;*,--:>1;>;2,22-1<=,:=,-15-><:A",
-"+;=;;;<=;,<=:,,>--*5;>;1;;>>-*>C",
-"#:*-2<:>:-2,<<1><:><;-:>*>>:,21C",
-"$;,<<>;>2-:->&:;=;;&:-,=&-<:>=;A",
-"+&;;-:,=,*112>=:>1;*1,>;*1<,;;:S",
-"@;=>=:**>:>1==,,;,>1,,-;,>&>-;:l",
-"O+O+o+@oXOO o++X+X$O@.%+#X@ooo+z",
-"PPIPILLUJHHGcGcfjcvvIREYETJHJKKl",
-"8qw439979q7687Xdsypuuyuurtq09w77",
-"11,=:<=*<:*:;,Xgu8e9904940w*--->",
-"1&->;,=;>-==-<+hi4*,:,<:;11<<;-=",
-";>::<=;<-,>-=*+xy0::;->*:,12,,-=",
-"-->,,<1->:,*=,@la<>:,2<&><>11:=,",
-"2:=<-;-<>;1<:1$Z0>:&>*<>;1-;;<::",
-"-<:;:1,1=><>2=oVe=-<>*,<>,-<,:&>",
-"&=1,;2-=>:>,>:oA,=;=-:>-*:,,-::>",
-"1<=,:=,-15-><:OC;*,--:>1;>;2,22-",
-"-*5;>;1;;>>-*>.C;=;;;<=;,<=:,,>-",
-":><;-:>*>>:,21%A:*-2<:>:-2,<<1><",
-";;&:-,=&-<:>=;oS;,<<>;>2-:->&:;=",
-"1;*1,>;*1<,;;:%l&;;-:,=,*112>=:>",
-",>1,,-;,>&>-;:+z;=>=:**>:>1==,,;",
-"X$O@.%+#X@ooo+Xl+O+o+@oXOO o++X+"
-};
diff --git a/textures/colorstone.xpm b/textures/colorstone.xpm
new file mode 100644
index 0000000..81ec831
--- /dev/null
+++ b/textures/colorstone.xpm
@@ -0,0 +1,96 @@
+/* XPM */
+static char *colorstone_png[] = {
+/* columns rows colors chars-per-pixel */
+"64 64 26 1 ",
+" c gray11",
+". c #382C14",
+"X c #202020",
+"o c #282828",
+"O c #2C2C2C",
+"+ c gray19",
+"@ c #343434",
+"# c gray22",
+"$ c #403018",
+"% c #483818",
+"& c #543C1C",
+"* c #5C4020",
+"= c #6C4824",
+"- c #744C28",
+"; c gray25",
+": c #484848",
+"> c #4C4C4C",
+", c gray33",
+"< c gray36",
+"1 c #646464",
+"2 c gray44",
+"3 c #7C7C7C",
+"4 c #80502C",
+"5 c gray55",
+"6 c #989898",
+"7 c gray66",
+/* pixels */
+"333%&**-**************&$%****&&%,1332222OOOOOOO:12,1,,>>>>,<<123",
+"322,%&*-*******&******&$%***&%%,13323233:OOOOO:12,1,>>,,<1111112",
+"2221,%&=********&&****&$%*&&%:,11:****:11:OOO:12,1,>,<1111111111",
+",2321,%=********&&****%$%&%%,13:**%%$%$%11:::12,111111<,,>>>>>>>",
+">,2231%=*************&%$%%,133:*%%%%$%$%:31112,1<<<<<<<<<<<<<<<<",
+">>,222%&*****&******&$$%,1331**%%%%%$%$$.1572,1,>>>>>>>>>>>>>>>>",
+">>>,23,%&**********&$$:,133:*%%%%%%%$$%..173,1,>>>>>:>>>>>>>>>>>",
+">>>>,23,%&*******&&$%,1131**%%%%%%%%$$%..1631,>>>>>>>>>>>>>>>>>>",
+">>>>:,31,%&****&&$$,1133:*&%%%%%%$%%$.%..161,>>>>:>>>>>>>>>:>>>>",
+">>>>::331,%&&&&$$,13331**&%%%%%%%$%%$.$..151,>>>:>>>>>>>>>>>>>>>",
+">>>>::3231,$$$$:,1331:*&&%%%%%%%%%%%%.$.;151<>:>>>:>>>>>>>>>>>>>",
+">>>>::22331,,,,,1331**&%%%&%%%%%%.%%%...>231<>>>:>>>>>>::>>>>>>:",
+">>>>:#221,,,1266521*&&%&&%%%%%%%%.%%%...,251,>>>>>>>>>>::>::::>>",
+">>>:#131,,,,:16551*%&&%&&%%%%%%%%.%%%...1231,>>>>>>>>>>>>>::::>>",
+">>:#132,,,,,::253*&%*%%%%%%%%%%%%.%%%..;1331,>>>>>>>>>>>>>::::>>",
+">:#1331,,,,,:::1,*%*&%%%%%%%%%%%$.%%%..>2331,>>>>>>>>>>>>>::::>:",
+":#13321,,,,,;>,:1*%*%%&%%%%%%%%%$.%%$..,333,>>>>>>>>>>>>>>>>>>:#",
+"#11::12,,,,>;,,11*%&%%%%%%%%%%%%..%%$..1=*1,>>>>>>>>:>>>>>>>>:#;",
+"11:&&:11,,,;;,,,