From f6b409e97f3df88d03f9885e9ddb053c66d670a6 Mon Sep 17 00:00:00 2001 From: narnaud Date: Thu, 2 Jun 2022 16:22:10 +0200 Subject: [PATCH] add: walls textures --- README.md | 13 ++-- includes/cub3d.h | 33 ++++++---- includes/mlx_keycode.h | 3 +- maps/racetrack.cub | 26 ++++++++ maps/scene.cub | 6 +- maps/scene_big.cub | 30 ++++----- maps/tester.cub | 24 +++++++ sources/hooks.c | 15 +++-- sources/main.c | 21 ++++++- sources/parsing.c | 30 ++++----- sources/render.c | 136 +++++++++++++++++++++------------------- textures/colorstone.xpm | 96 ++++++++++++++++++++++++++++ textures/greystone.xpm | 92 +++++++++++++++++++++++++++ textures/redbrick.xpm | 96 ++++++++++++++++++++++++++++ textures/wood.xpm | 79 +++++++++++++++++++++++ 15 files changed, 576 insertions(+), 124 deletions(-) create mode 100755 maps/racetrack.cub create mode 100644 maps/tester.cub create mode 100755 textures/colorstone.xpm create mode 100755 textures/greystone.xpm create mode 100755 textures/redbrick.xpm create mode 100755 textures/wood.xpm diff --git a/README.md b/README.md index f172e87..f2d1112 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,10 @@ CUBE3D - [Tester & maps](https://github.com/MichelleJiam/cub3D_tester) ## Issues: -- Distances increase while time pass. + + +## Memo: +- ToDo: add F1 keycode on linux ## Program life cycle : ### Parsing @@ -21,7 +24,7 @@ CUBE3D - [x] comvert list to 2D array. - [x] save player pos, - [ ] handle errors, - - [-] not closed map + - [x] not closed map - [ ] texture files not exist, not permited or with wrong extension - [ ] impossible color used - [-] missing map @@ -29,15 +32,17 @@ CUBE3D ### Window ### Render - [x] display ceil, walls and floor -- [ ] display wall's texture +- [x] display wall's texture ### Control - [x] enable commands - [x] wasd to move -- [ ] react to commands : +- [o] react to commands : - [x] calculate new pos, - [x] display new view, - [x] avoid colisions - [x] M to show minimap - [x] SHIFT to run + - [-] Debugs window with F1 + - [x] Exit with Esc and X ### Quit - [ ] clean and exit diff --git a/includes/cub3d.h b/includes/cub3d.h index f54b337..96b942d 100644 --- a/includes/cub3d.h +++ b/includes/cub3d.h @@ -6,7 +6,7 @@ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/21 19:24:12 by narnaud #+# #+# */ -/* Updated: 2022/06/01 19:55:25 by narnaud ### ########.fr */ +/* Updated: 2022/06/02 14:22:08 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ @@ -61,26 +61,35 @@ typedef struct s_rectangle int color; } t_rectangle; -typedef struct s_control -{ - int up; - int down; - int left; - int right; -} t_control; - typedef struct s_raycast { t_vec_d vec; - int cell[2]; + int *cell; double sDist[2]; double dDist[2]; int *step; - + int face; + double dist; + double wallX; } t_raycast; +typedef struct s_img +{ + char *file; + int *img; + int width; + int height; + int *buffer; + int pixel_bits; + int line_bytes; + int endian; + +} t_img; + typedef struct s_env { + long tick; + int debug; void *mlx; void *win; void *img; @@ -88,9 +97,9 @@ typedef struct s_env int line_bytes; int endian; int *buffer; + t_img wall[4]; int minimap; int controls[KEYS_LIMIT]; - char *wallTexture[4]; int floorColor; int ceilColor; char **map; diff --git a/includes/mlx_keycode.h b/includes/mlx_keycode.h index 5c142bb..ac840a5 100644 --- a/includes/mlx_keycode.h +++ b/includes/mlx_keycode.h @@ -6,7 +6,7 @@ /* By: bledda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/08/10 20:43:21 by bledda #+# #+# */ -/* Updated: 2022/06/01 14:58:39 by narnaud ### ########.fr */ +/* Updated: 2022/06/02 07:49:04 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ @@ -113,6 +113,7 @@ # define KEY_SHFT 257 # define KEY_CTRL 256 # define KEY_SPACE 49 +# define KEY_F1 122 # endif #endif diff --git a/maps/racetrack.cub b/maps/racetrack.cub new file mode 100755 index 0000000..278d32f --- /dev/null +++ b/maps/racetrack.cub @@ -0,0 +1,26 @@ +NO ./textures/wood.xpm +EA ./textures/colorstone.xpm +SO ./textures/wood.xpm +WE ./textures/wood.xpm + +F 18 ,176, 12 +C 27, 210, 227 + + + + 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + 11100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 + 111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 + 1111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 + 11111000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000001 + 11100000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000011111111111110000001 + 10000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000111111111000000011 + 1000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000111000001111111100000001 + 1110000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000111100000111000000001111 + 1111100000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000111100000000000001111 + 1111111000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000001111000000000111 + 11111111100000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000111111111111 + 11111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 + 11111000000000000000000000000000000000000000000000000000W0000000000000000000000000000000000000000000000011 + 11100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011 + 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 diff --git a/maps/scene.cub b/maps/scene.cub index 7206318..f81a050 100755 --- a/maps/scene.cub +++ b/maps/scene.cub @@ -1,9 +1,9 @@ NO ./textures/wood.xpm EA ./textures/colorstone.xpm -SO ./textures/wood.xpm -WE ./textures/wood.xpm +SO ./textures/redbrick.xpm +WE ./textures/greystone.xpm -F 18, 176, 12 +F 100, 70, 20 C 27, 210, 227 11110000 diff --git a/maps/scene_big.cub b/maps/scene_big.cub index 95e6343..08dffb7 100755 --- a/maps/scene_big.cub +++ b/maps/scene_big.cub @@ -1,9 +1,9 @@ NO ./textures/wood.xpm EA ./textures/colorstone.xpm -SO ./textures/wood.xpm -WE ./textures/wood.xpm +SO ./textures/greystone.xpm +WE ./textures/redbrick.xpm -F 18, 176, 12 +F 0, 156, 8 C 27, 210, 227 111100001111111111111111111111111111111111111111 @@ -24,21 +24,21 @@ C 27, 210, 227 10000000000001 100000000010011111111111111111111111111111001 10111111111111 111111111110000000000000000000000000000000001 100000001 100000000011111111111111111111111111111111101 -1111110011111111111110000000001 101 +1111110011111000000010000000000 101 10000000100010000000000000000111 101 10000000000000000000000000000101 101 11111111110000000001111111111101111111111111111111111111111111101111111 -11111111110000000001111111111100000000000000000000000000000000000000001 -11111111110000000001111111111101111111111111111100000000000000000000001 -11111111110000000001111111111101111111111110000000000000000011110000001 -1111111111000000000111111111110111111111111000000000000000001 10000001 -1111111111000000000111111111110100000000000001100000000000001 10000001 -1100000000011110000000001111110100000000000001100000111111111 10000001 -1100000000011110000000001111110100000000000001111111111111111 11111111 -11000000000111100000000011111101001111111111111111111111111111111111111 -11000000000111100000000011111101000000000000000000000000000000000000001 -11101111111101111111100000000001010001000100010001000100010001000100101 -11101111111111111111111111111111000100010001000100010001000100010001001 +10000000010000000001000000000100000000000000000000000000000000000000001 +10000000010000000001000000000000111111111111111100000000000000000000001 +10000000010000000001000000000000000000000010000000000000000000110000001 +1000000001000000000100000000010111111111111000000000000000001 10000001 +1011111111000000000111111000010100000000000001100000000000001 10000001 +1010000000011110000000001000010100000000000001100000111111111 10000001 +1010000000011110000000001000010100000000000001111111100000000 11111111 +10100000000111100000000010000101001111111111111111111111111111111111111 +10100000000111100000000011111101000000000000000000000000000000000000001 +10101111111101111111100000000001010001000100010001000100010001000100101 +10101111111111111111111111111111000100010001000100010001000100010001001 10101000000000000100000000000010010001000100010001000100010001000100011 10101111110111110101111111101111000100010001000100010001000100010001001 10101000000101000001000000000010010001000100010001000100010001000100011 diff --git a/maps/tester.cub b/maps/tester.cub new file mode 100644 index 0000000..fb10246 --- /dev/null +++ b/maps/tester.cub @@ -0,0 +1,24 @@ +NO ./textures/wood.xpm +EA ./textures/colorstone.xpm +SO ./textures/wood.xpm +WE ./textures/wood.xpm + +F 0, 156, 8 +C 27, 210, 227 + +111111111111111111111111111111111111111111111111 +100000000000000000010000000000000000000000000001 +101000001000010000101000010000100000000000000001 +101100000100001000010000100001110000000000000001 +101110000010000100000001000010101000000000000001 +101011000001000010000010000100100100000000000001 +101001100000100001000100001000100010000000000001 +101000110000010000101000010000100101000000000001 +101000011000001000010000100000101000100000000001 +101000001100000100000001000000110000010000000001 +101000000110000010000010000000100000001000000001 +101000000011000001000100000001010000000100000001 +1010000000011000001N1000000010001000000010000001 +101111111111110000010000000100100100000001000001 +100000000000000000000000000001010000000000000001 +111111111111111111111111111111111111111111111111 diff --git a/sources/hooks.c b/sources/hooks.c index e333cea..3e0f841 100644 --- a/sources/hooks.c +++ b/sources/hooks.c @@ -6,7 +6,7 @@ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/06/01 13:47:30 by narnaud #+# #+# */ -/* Updated: 2022/06/01 18:29:53 by narnaud ### ########.fr */ +/* Updated: 2022/06/02 08:19:26 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,8 +16,12 @@ int key_press_hook(int keycode, t_env *env) { if (keycode == KEY_M) env->minimap = !env->minimap; + if (keycode == KEY_F1) + env->debug = !env->debug; else env->controls[keycode] = 1; + if (env->debug) + printf("Key pressed: %d\n", keycode); return (1); } @@ -32,11 +36,11 @@ int update_hook(t_env *env) double dX; double dY; + env->tick++; dX = (env->controls[KEY_W] - env->controls[KEY_S]) * env->playerDir.x / (20 - env->controls[KEY_SHFT] * 10); dY = (env->controls[KEY_W] - env->controls[KEY_S]) * env->playerDir.y / (20 - env->controls[KEY_SHFT] * 10); - if (env->map[(int)env->playerPos.y][(int)(env->playerPos.x + dX)] == '0') set_vec(&env->playerPos, env->playerPos.x + dX, env->playerPos.y); if (env->map[(int)(env->playerPos.y + dY)][(int)env->playerPos.x] == '0') @@ -44,10 +48,11 @@ int update_hook(t_env *env) env->playerDir = rot_vec(env->playerDir, (double)(env->controls[KEY_D] - env->controls[KEY_A]) * M_PI / 72, 1); env->camPlan = rot_vec(env->playerDir, M_PI / 2, 0.66); - if (DEBUG) + if (env->debug && !(env->tick % 50)) { - printf("playerPos: %f, %f. playerDir: %f, %f\n", env->playerPos.x, env->playerPos.y, env->playerDir.x, env->playerDir.y); - printf("camPlan: %f, %f\n", env->camPlan.x, env->camPlan.y); + printf("playerPos: %f, %f. playerDir: %f, %f\n", + env->playerPos.x, env->playerPos.y, env->playerDir.x, env->playerDir.y); + printf("camPlan: %f, %f\n", env->camPlan.x, env->camPlan.y); } render(env); return (1); diff --git a/sources/main.c b/sources/main.c index ccfbc32..18cd65e 100644 --- a/sources/main.c +++ b/sources/main.c @@ -6,7 +6,7 @@ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/21 19:22:50 by narnaud #+# #+# */ -/* Updated: 2022/06/01 13:49:31 by narnaud ### ########.fr */ +/* Updated: 2022/06/02 15:31:02 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ @@ -40,8 +40,8 @@ int main(int argc, char **argv) if (DEBUG) { printf("\e[1;32m========> WALLS <========\e[0m\nNorth: %s\nSouth: %s\nWest: %s\nEast: %s\n",\ - env->wallTexture[0], env->wallTexture[1],\ - env->wallTexture[2], env->wallTexture[3]); + env->wall[0].file, env->wall[1].file,\ + env->wall[2].file, env->wall[3].file); printf("\e[1;32m========================\e[0m\n"); printf("=> Floor color: %d\n=> Ceil color: %d\n", env->floorColor, env->ceilColor); printf("\e[1;32m========> MAP <========\e[0m\n"); @@ -50,10 +50,25 @@ int main(int argc, char **argv) printf("%s\n", env->map[y++]); } init_window(env); + y = 0; + while (y < 4) + { + env->wall[y].img = mlx_xpm_file_to_image(env->mlx, + env->wall[y].file, &env->wall[y].width, &env->wall[y].height); + env->wall[y].buffer = (int *)mlx_get_data_addr(env->wall[y].img, \ + &env->wall[y].pixel_bits, &env->wall[y].line_bytes, &env->wall[y].endian); + env->wall[y].line_bytes /= 4; + y++; + } + env->img = mlx_new_image(env->mlx, WIN_X_SZ, WIN_Y_SZ); + env->buffer = (int *)mlx_get_data_addr(env->img, \ + &env->pixel_bits, &env->line_bytes, &env->endian); + env->line_bytes /= 4; render(env); mlx_hook(env->win, 2, 1L<<0, key_press_hook, env); mlx_hook(env->win, 3, 1L<<1, key_release_hook, env); mlx_loop_hook(env->mlx, update_hook, env); mlx_loop(env->mlx); + mlx_destroy_image(env->mlx, env->img); return (EXIT_SUCCESS); } diff --git a/sources/parsing.c b/sources/parsing.c index d7adb71..a91ee33 100644 --- a/sources/parsing.c +++ b/sources/parsing.c @@ -6,7 +6,7 @@ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/23 17:20:29 by narnaud #+# #+# */ -/* Updated: 2022/06/01 18:23:37 by narnaud ### ########.fr */ +/* Updated: 2022/06/02 12:34:56 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,14 +15,14 @@ int cleanup_datas(t_env *env) { - if (env->wallTexture[0]) - free(env->wallTexture[0]); - if (env->wallTexture[1]) - free(env->wallTexture[1]); - if (env->wallTexture[2]) - free(env->wallTexture[2]); - if (env->wallTexture[3]) - free(env->wallTexture[3]); + if (env->wall[0].file) + free(env->wall[0].file); + if (env->wall[1].file) + free(env->wall[1].file); + if (env->wall[2].file) + free(env->wall[2].file); + if (env->wall[3].file) + free(env->wall[3].file); return (1); } @@ -34,13 +34,13 @@ void register_settings(int *progress, t_env *env, char *line) if (!elem[0] || !elem[1]) return ; if (!ft_strncmp(elem[0],"NO", 3)) - env->wallTexture[0] = ft_strtrim(elem[1], "\n"); + env->wall[0].file = ft_strtrim(elem[1], "\n"); else if (!ft_strncmp(elem[0],"SO", 3)) - env->wallTexture[1] = ft_strtrim(elem[1], "\n"); + env->wall[1].file = ft_strtrim(elem[1], "\n"); else if (!ft_strncmp(elem[0],"WE", 3)) - env->wallTexture[2] = ft_strtrim(elem[1], "\n"); + env->wall[2].file = ft_strtrim(elem[1], "\n"); else if (!ft_strncmp(elem[0],"EA", 3)) - env->wallTexture[3] = ft_strtrim(elem[1], "\n"); + env->wall[3].file = ft_strtrim(elem[1], "\n"); else if (!ft_strncmp(elem[0],"F", 2)) env->floorColor = rgb_to_int(elem); else if (!ft_strncmp(elem[0],"C", 2)) @@ -114,7 +114,7 @@ int init_player(t_env *env, int x, int y) orientation = env->map[y][x]; env->map[y][x] = '0'; - set_vec(&env->playerPos, x, y); + set_vec(&env->playerPos, x + 0.5, y + 0.5); if (orientation == 'N') set_vec(&env->playerDir, 0, -1); else if (orientation == 'S') @@ -122,7 +122,7 @@ int init_player(t_env *env, int x, int y) else if (orientation == 'E') set_vec(&env->playerDir, 1, 0); else if (orientation == 'W') - set_vec(&env->playerDir, -1, -1); + set_vec(&env->playerDir, -1, 0); env->camPlan = rot_vec(env->playerDir, M_PI / 2, 0.66); return (1); diff --git a/sources/render.c b/sources/render.c index dc39edf..32e6e09 100644 --- a/sources/render.c +++ b/sources/render.c @@ -6,7 +6,7 @@ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/31 09:33:02 by narnaud #+# #+# */ -/* Updated: 2022/06/01 19:57:30 by narnaud ### ########.fr */ +/* Updated: 2022/06/02 16:05:48 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ @@ -35,13 +35,6 @@ void draw_rectangle(t_env *env, t_rectangle rect, int borders) } } -void draw_vert(t_env *env, int x, int *startEnd, int color) -{ - draw_rectangle(env, (t_rectangle){x, 0, 1, startEnd[0] - 1, env->ceilColor}, 0); - draw_rectangle(env, (t_rectangle){x, startEnd[0], 1, startEnd[1] - startEnd[0] - 1, color}, 0); - draw_rectangle(env, (t_rectangle){x, startEnd[1], 1, WIN_Y_SZ - startEnd[1], env->floorColor}, 0); -} - void render_minimap(t_env *env, t_vec size) { char **map; @@ -61,7 +54,7 @@ void render_minimap(t_env *env, t_vec size) if (map[vec.y][vec.x] == '0') draw_rectangle(env, (t_rectangle){vec.x * dX, vec.y * dY, dX, dY, 39424}, 1); else if (map[vec.y][vec.x] == '1') - draw_rectangle(env, (t_rectangle){vec.x * dX, vec.y * dY, dX, dY, 11885067}, 1); + draw_rectangle(env, (t_rectangle){vec.x * dX, vec.y * dY, dX, dY, 9539977}, 1); vec.x++; } vec.y++; @@ -70,66 +63,59 @@ void render_minimap(t_env *env, t_vec size) env->playerPos.x * dX - dX / 4, env->playerPos.y * dY - dY / 4, dX / 2, dY / 2, 255}, 0); } - - -double calculate_dist(t_env *env, t_raycast rc) +void render_view(t_env* env) { + double camX; int side; - - while (1) - { - side = 0; - if (rc.sDist[0] > rc.sDist[1]) - side++; - rc.sDist[side] += rc.dDist[side]; - rc.cell[side] += rc.step[side]; - if (env->map[rc.cell[1]][rc.cell[0]] > '0') - return (rc.sDist[side] - rc.dDist[side]); - } -} - -double get_wall_dist(t_env *env, int x) -{ - double camX; t_raycast rc; - - camX = 2 * x / (double)WIN_X_SZ - 1; - set_vec(&rc.vec, env->playerDir.x + env->camPlan.x * camX, - env->playerDir.y + env->camPlan.y * camX); - rc.cell[0] = (int)(env->playerPos.x); - rc.cell[1] = (int)(env->playerPos.y); - if (rc.vec.x == 0) - rc.dDist[0] = 1e30; - else - rc.dDist[0] = fabs(1 / rc.vec.x); - if (rc.vec.y == 0) - rc.dDist[1] = 1e30; - else - rc.dDist[1] = fabs(1 / rc.vec.y); - rc.step = (int[2]){0, 0}; - if (rc.vec.x < 0 && --rc.step[0]) - rc.sDist[0] = (env->playerPos.x - rc.cell[0]) * rc.dDist[0]; - else if (++rc.step[0]) - rc.sDist[0] = (rc.cell[0] + 1.0 - env->playerPos.x) * rc.dDist[0]; - if (rc.vec.y < 0 && --rc.step[1]) - rc.sDist[1] = (env->playerPos.y - rc.cell[1]) * rc.dDist[1]; - else if (++rc.step[1]) - rc.sDist[1] = (rc.cell[1] + 1.0 - env->playerPos.y) * rc.dDist[1]; - return (calculate_dist(env, rc)); -} - -void render_view(t_env *env) -{ int x; - double wallDist; int startEnd[2]; int lineHeight; - + x = 0; while (x < WIN_X_SZ) { - wallDist = get_wall_dist(env, x); - lineHeight = (int)(WIN_Y_SZ / wallDist); + ft_bzero(&rc, sizeof(rc)); + camX = 2 * x / (double)WIN_X_SZ - 1; + set_vec(&rc.vec, env->playerDir.x + env->camPlan.x * camX, + env->playerDir.y + env->camPlan.y * camX); + rc.cell = (int[2]){env->playerPos.x, env->playerPos.y}; + if (rc.vec.x == 0) + rc.dDist[0] = 1e30; + else + rc.dDist[0] = fabs(1 / rc.vec.x); + if (rc.vec.y == 0) + rc.dDist[1] = 1e30; + else + rc.dDist[1] = fabs(1 / rc.vec.y); + rc.step = (int[2]){0, 0}; + if (rc.vec.x < 0 && --rc.step[0]) + rc.sDist[0] = (env->playerPos.x - rc.cell[0]) * rc.dDist[0]; + else if (++rc.step[0]) + rc.sDist[0] = (rc.cell[0] + 1.0 - env->playerPos.x) * rc.dDist[0]; + if (rc.vec.y < 0 && --rc.step[1]) + rc.sDist[1] = (env->playerPos.y - rc.cell[1]) * rc.dDist[1]; + else if (++rc.step[1]) + rc.sDist[1] = (rc.cell[1] + 1.0 - env->playerPos.y) * rc.dDist[1]; + while (1) + { + side = 0; + if (rc.sDist[0] > rc.sDist[1]) + side++; + rc.cell[side] += rc.step[side]; + if (env->map[rc.cell[1]][rc.cell[0]] > '0') + { + rc.face = 3 - side * 2 - (rc.step[side] + 1) / 2; + if (!side) + rc.wallX= env->playerPos.y + rc.sDist[side] * rc.vec.y; + else + rc.wallX = env->playerPos.x + rc.sDist[side] * rc.vec.x; + rc.wallX -= floor(rc.wallX); + break ; + } + rc.sDist[side] += rc.dDist[side]; + } + lineHeight = (int)(WIN_Y_SZ / rc.sDist[side]); if (lineHeight < 0) lineHeight = 0; startEnd[0] = -lineHeight / 2 + WIN_Y_SZ / 2; @@ -138,20 +124,38 @@ void render_view(t_env *env) startEnd[1] = lineHeight / 2 + WIN_Y_SZ / 2; if(startEnd[1] >= WIN_Y_SZ) startEnd[1] = WIN_Y_SZ - 1; - draw_vert(env, x, startEnd, 11885067); + + int texHeight = env->wall[rc.face].height; + draw_rectangle(env, (t_rectangle){x, 0, 1, startEnd[0], env->ceilColor}, 0); + //draw_rectangle(env, (t_rectangle){x, startEnd[0], 1, startEnd[1] - startEnd[0] - 1, color}, 0); + //int texY = (int)(y * env->wall[rc.face].height / (startEnd[1] - startEnd[0])); + int texX = (int)(rc.wallX * (double)env->wall[rc.face].width); + if(rc.face >= 2 && rc.vec.x > 0) + texX = env->wall[rc.face].width - texX - 1; + if(rc.face < 2 && rc.vec.y < 0) + texX = env->wall[rc.face].width - texX - 1; + double step = 1.0 * texHeight / lineHeight; + // --- + double texPos = (startEnd[0] - WIN_Y_SZ / 2 + lineHeight / 2) * step; + for(int y = startEnd[0]; ybuffer[env->line_bytes * y + x] \ + = env->wall[rc.face].buffer[texHeight * texY + texX]; + } + draw_rectangle(env, (t_rectangle){x, startEnd[1], 1, WIN_Y_SZ - startEnd[1], env->floorColor}, 0); + x++; } } void render(t_env *env) { - env->img = mlx_new_image(env->mlx, WIN_X_SZ, WIN_Y_SZ); - env->buffer = (int *)mlx_get_data_addr(env->img, \ - &env->pixel_bits, &env->line_bytes, &env->endian); - env->line_bytes /= 4; + bzero(env->buffer, WIN_Y_SZ * WIN_X_SZ * sizeof(int)); + render_view(env); if (env->minimap) render_minimap(env, (t_vec){env->wide * 8, env->deep * 8}); mlx_put_image_to_window(env->mlx, env->win, env->img, 0, 0); - mlx_destroy_image(env->mlx, env->img); } diff --git a/textures/colorstone.xpm b/textures/colorstone.xpm new file mode 100755 index 0000000..80d517f --- /dev/null +++ b/textures/colorstone.xpm @@ -0,0 +1,96 @@ +/* XPM */ +static char *_4eb85b01dbd4a40acc6293cc7d4be69Nm7XLkWyvHEHisQr[] = { +/* 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,,,;;,,,2*&&%%%%%%%%%%%%.$%$.$<=**,1;>>>>>>>>>>>>>>:;#;;", +"1:&*%&:3:,;;;,,,11&&%%%%%%%%%%%$.$..$1=***%11;:>>>>>>>>>:;#@@#;1", +":&*%%%$12:;,;,,,:3:&%%%%%%%%%%$....>13%%%%%221;;;:::::;;#@#;#,11", +"&*%%%%$:31:,;,,,:21$%%%%%%%%%%....>133311115511;#@@@@@@@#;;#,13:", +"*%%%%%$$12:,;,,,#13:%%%%%%%%%...;<1,,,,,,,356621,#;;;;;;;;#,13:&", +"%%%&%%$%131:;,,>#131$%%%%%%%..;,11,:;#;;;;,366531,#;;;;;##,13:&*", +"%%%%%%$%:331;,>:#133:.$%%%$..,131,:;;##;;;;,355231,######,131&*%", +"%%%%%%$%$132#:::#2231.......;131,:;;;#;#;;#;232,,31,####,131:*%%", +"%&&%%%.%$,231###23333:....;><3,,:;::;#;#;;#:121::,31,,,,131:&%%%", +"%&&%%%.%$:3521123,==,1::><<33,,:;;::;#;;#;@,12,:::,3335532:&%%%%", +"%%%&%%.%$:325221==****111232,,:;;;;;;@;;##+,11:::::1355321&%%%%%", +"%%%%%$.%$:32222=******&3322,,:;;;:;;;@;;##:12,,::::,1221<,&%%&&&", +"%%%%%$$%$,252221******%323,,,;;;;;;;;@;;#@,233111111132<,<&%%&&&", +"%%%%%.$$$,331,133***&%%33,,:,;;;;;;;;@;;#+1,---------%*-<1&%%&&&", +"%%%%$.%$:131,<,133&&%%13,,::,:;;;;;;;+;;@,2===*******%***3&%%%%%", +"%%%%$.$:111,<,,,1331,,31,:;:,:;;;;;;#+;#+,1=*=*******%**&1&%%&%%", +"%%%%.$:113,<,,,,,135353,:;;:,:;;;;;;#+;#+1,4*=**&****%**&1&%%%%%", +"%%%$.:1121,<,,,,,,13555,;;;:,>;;;;;;@+;+12:4*=*******%**&1$%%%%%", +"%%%.:1133,<,,,,,,,,1566,;;;:,>;;;;;;@+#:22=4*=*******%**&1:$%%%%", +"%%$:11231,<,,,,,,,,,1661;;;:,>:;;;;;++@,31=4*=*******&**&11:$%%%", +"%$:11231,<,,<,,,,,:,,152#;;:,>:;;;;;+++13,=4********&&**&131:$%%", +"$:113321,,,,,,,,,,,:,,55,##:,:>;;;;;++:22=*4*=******&***%1331:$$", +":115531,,,,,<,,,,,,;,,122+##,;>;;;;;++,31=*4=*******&***%13331::", +"116651,,,,,,<,,,,,,;:,,11:+@+;>;;;;;++,3,=*4-******&****%1OO#,11", +"13662,,,,<<,,,,<,,,:;,,,1,:++#::;;;#+:12=**-4******&****%1OOOO#,", +"O:551,,,<<<,,,,,,,,:;,,,,:,1,@@:;;;#+,23=**=4*****&*****%1OOOOXO", +"OX:3,,,,<<<,,,,,,:,:;:,,,:11,+@@#;;#+133&***-********&**%1OOOOXO", +"OX:2,,,,<<,,,,,,,,,:;:,,:#155,+@@;;@:2221&**==**********%1OOOOXO", +"X:11,,,,,,,<,,,,,:,:;:,:#:3553,+@##+,32231&**=*****&&**&%1OOOXOO", +":111:,,<<,,,,,,,,:,:@::#:,3:%:3,++++231##11&&*=****&&*&%:1OOOXOO", +"12221:,<<,,,,,,,,:,:@;#:,1:&%$:31,,131#OO#121&*******&%:11XXXXXX", +"332231::,,,,,,,,,:,;@#:,1:&%%$%$:3331#OOOO#121&&****&%:1233:::::", +"3235551::,,,,,,,::,;@:,1:&%%%$%$%:33:#OOOOO#122,&&&%%:1,,,,,,133", +"3,==,551:#,,,,,,:::@:,1:&%%%%$%$%$31#oOOOooO#132,&%::11,,,,,,:13", +"==**==,31:#:,,,:::#:,1:&%%%%%$%$%$3#OOoOOooOO#132,::13,,,>,,,:13", +"******==,1:#:,::##:1::&%%%%$%$%$$:1#OOOXoOOOOO#1321151>>,,,,>:13", +"*&******=%1:#::#:,1:&*&%%%%%%$$$:1#OOOOOXXOoOOO#13255,>>,,,,>:1=", +"*******&*%**:##:,1:&*&%%%%%$%$$$,##OOOOOoXXoOOOO#1351,,,,,,>::1=", +"**&&***&*%**&::,1:&&*&%%%%%$%$$:1#OOooOOOoXXoOOOO#13,,,,,,,::,=*", +"**&&***&*%&%%,,1:&%&*%%%%%%$%$:1:#OOoooOOoXXXoOOOO#13,,,,,:>:1=*", +"******&%&$%%,11:&%%&*%&%%%%$$$,1##OOooOoOOXXXXoOOOO#11,,,>::,=**", +"******&%%$%,333:%%%&*%%%%%%$$:1#O#OOOOOOOOoXXoXoOOOO#1>>>:>:,=**", +"******&%$$,3333,%%%&*%%%%%%$:1:#O#OOOOOOOOoXXXoXoOOOOX1>:,,:=***", +"******%$$,3,;,31:%%&*%%%%%%$,1#OO#OOOOooOOOoX ooXoOOOX,1,,>1=***", +"*****&%$,3,;;;,3,%%&*%%%%%$:1#OOO#OOOOooOOOoX XOXXoOOX,3>>1=****", +"****&$$,33;;;;;,1%%&%%%%%$:,1OOOO#OOoOOOOOOoX XOoXXoOX,3311=****" +}; diff --git a/textures/greystone.xpm b/textures/greystone.xpm new file mode 100755 index 0000000..5991b61 --- /dev/null +++ b/textures/greystone.xpm @@ -0,0 +1,92 @@ +/* XPM */ +static char *_325d918ca194104c6a2f797ea66149e3jfQmwgOZA9Z3aRa[] = { +/* columns rows colors chars-per-pixel */ +"64 64 22 1 ", +" c gray12", +". c gray23", +"X c #3F3F3F", +"o c gray28", +"O c #4B4B4B", +"+ c gray31", +"@ c #535353", +"# c gray34", +"$ c #5F5F5F", +"% c #676767", +"& c gray42", +"* c gray45", +"= c #7B7B7B", +"- c #838383", +"; c gray56", +": c #9B9B9B", +"> c gray67", +", c #B7B7B7", +"< c gray78", +"1 c LightGray", +"2 c #DFDFDF", +"3 c #EFEFEF", +/* pixels */ +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .", +"#@#+#+#+#+O1222121222121222 .->,1<11<1,<>-# oooooooooo@+#+#+#+#+", +"@#@@#@@@#@o21<1,111<11,11<; .-<,;>-;;;;->+. .&;;-;;;=&%oooOoooOo", +";;-;;;-; @O2<<,1,<<,<<,,1;$ .>1>;>;>->;>-#. .;122212,,>;-;;;-;;;", +"1111,>;- #o21>>:>;>>>>:>>=@ .;,;;->>>>-;*+. .-22,<,1222121<111<1", +">>>>:>=* @o3,:>>>>:>;>->>&@ .o>;>>-;:;>&#@. .;1,>;>;>>:;;>;>->;:", +",:::>;=& Oo31>->;>;:::;;>;+ .o=;->;>>->*... .-2,;>-:-;;>-;:;>:;:", +",>-,-:$# .o3<;:;>>:;=;;>;$# .oo;>>:;;;>&... .;2>>-:=>:=;>->>;=>:", +":>>;:*oO O<,>:>->;:-:;;>&@ O@o=........ ..*22;>--:*:;>;;=>>*;", +";;-;*@oo .o>3>:>;;;;;;->-#= .o....... . ooo<<;;;;:::-;>;>>->;", +"*&**+O.. O;1;>;;=;;>->;>&#. .o. . . O@o<>;>->;-;*&%$$%$%$", +"@#ooo .X*2>-:===>:;-=;&%. .ooOO*=;>:>>:*.+O,;&*%$%#@@@oOoOooO", +" . . .@o2<;;;::-;>=;>;+. .X*>>123111:&@ @o;&%$@Ooo..... . . ", +" . . . ..+o>1;>-=;>;-:;-*+. .>,21,->;>-*. ........... ", +"..........OO;<>->:-=;=;>;+#. .X>2,>;;;-;;+. . . . . XX.......", +"@O...... .@o*<->:;>:>->->+*o O>3>;->;>->@. .o#@## oOooOoooooooX", +"::;:;:;:: #o<,:;-::*;;;;&#@ O>3-;>>->;;+. .&>21#o@=::;:::;::::", +"1<11<1,>*X #o;,;>;=;;->;&;&O O><>>;->;>-#. .>1<> o=<12221222121", +">:;>;>>&*. @o*:>->>->*;&@*@O O><>;&**&@#@. .1<>- O:11,,>,,,>,,,", +">;:;>-;&*. o@o:;**&*@@*+*@o .:;*;&....... $2>;; o:2>>:>;>;:-::", +">;;>->>&#. o@o%@#@#ooo. ;*... $2>>- O:1>;:-:;:*-;-", +">;>;>-;*+. o@o . . ..+. . . ;2>>; o;<->:>;>;:-::", +";>*=;;>&#. .+#O. +OO+OOo;;;>>;;;=# X%,2>-= O-<>-:;:-:==;;", +";--=;>-%o. .-2221<>>;$.O%=>>,<<2221222<:% .=2<:>* o-,>:;>->;==;;", +";;>>-;;$O. .1<>;::>;:.+O=1322<,,<,<,<,<&# .;2>:;& O&<->;;:;->;>;", +":>-;>-*@.. .2:;:>>;:> @O:2<;>->:->:>:;-%o .;3>-># Oo;*$#@@%%&=;-", +"%$%$%@o... .1>>>->;>$ Oo:3>:>;=>>;-;>->#o .-3>>;# @ ..ooooOoo@#@", +"@Oo... .2->;>>;=$ Oo:3->;:>-;=;>;;;+O .;3->;+ #. ..o", +" . OOo2>:->;>=$ .o:3;;>-;=;=;-;>;+O .-3>>-# #....... . ", +"o%%&;:;-;;o 2>*:;>--%. o;3>;-;=;=;>=;->@o .;3;>>+ #oXo+@+#@@#...", +"%;,21211<>* 2>>-=;>-%. o;2,:;>;>*=;=;>-#. .;1;;>+ O>21,;$#ooOoo@", +"%>1<<,>>:>X 3;:>=;>:&o O=1<>-;*;==>;>--+. .;2>;;@ O2-;,221222;.@", +"%2,>>->;>-* 3:>;>>->&O .+<2>>:;>->==;>&#. X;1;>;+ O2;->>-;>;--.+", +"%1,:->;>->* 3:-:>;>-%@ #>3>>:;;=;==>-*o. O;1>>-# o2>>-;>>->;$.o", +"%2>;>;>>=>+ 2>>>;;;>%+ .+;3,>;>-;:->;>$o .X;1:;>+ O<>;>>-;>;>$.o", +"%2>>;;::>-# 2,=:=>>:$# O&1,>;=:-;:;;;$. O;1;>+# O<>:>;>-;>:#.o", +"%1,;>>;>->@ <2-:>;;;$# O@,2>->;>;>-;%@. .o=>=+...X>>;>:;>;->#..", +"%2,>:;>;>;+ ,2=>-;;>&# .+;,>;=%$@oO.... .X#....Xo *+o@#@#@@#@..", +"%2>;>>->=>@ :1:=>>-;&# .@o;;$#o. .o+oo+@#@# .", +"%1,;-:>;>-# =2>:>-;>%+ +o. . . . . .o@#ooOoooOoo..........", +"%2,>>-:>;>@ #3;:;;>-%@ .ooo.....OoOX+OoOoo#@================*.+", +"%2>;;>->;&# o3>;-=;>&# X%=============;;;:>,><,<,<,,<,<,<,<=.+", +"%<,>>;>;>+ +3:;>;;-%#. .=<,<,<,<<,<,<,<,122333333333331211;% O", +"%1,;>;>>-# .X3;>=:->%+. =<<3333322332333332211,,,<,>,<,,<,=# +", +"%,,>;>-;;+ .o2>>->;;$#. =<<,<,<,<>,<>,<,,>>::;;>;>-;;>->;>&#..", +"O<-;>-*&*@ .o1-;>->;&#. %,2,;;-;;;>->>;;:>>>;=:->>:->;>>:;&@ .", +"o,>>:;#@@ Xo,>-;>;-*@. o<2,;;;>;:;:>-;:>>-:;:;;=-::;>->;>&#..", +"o===#@#@@ ..X::>-;;&%@. ,21>>-;;;=;->;:->:=-;>-;>;=*;=:;;*@ .", +"o. #@@# .XO=%$%%$%@@. .>11;->;>-;>;==::->;>;;>-;=;;->;*-&# .", +"@#@o. ..X........... ;1,>;;>->=;-:=:;:=>-;=;;;->;=;;-=&# .", +"oOoooOo. .O.. .-:&**&**&>;>>-;=-;;=;;>->;;>-;;;:&# .", +"o=>>>>;;%OO@.. . . . . .@o.. . . #*&=;===================%+ .", +"o><12122,>>;&$#O..........X#oo...... O@@#@#@#@#@@@#@#@@#@#@@@ ..", +"o>1>>;,1222,>>>>>>>:;;-==&%%+#oooXo.. . . . . . . .X", +"o>2>>>,>;>,222121212222<1<,>>>>>-O@o......... . . . . . . ...oO", +"o>2>->==>:;=>->;>;>>->;>>><1211,-.o+Ooo... .................XoO@", +"o><>>>;>;;;:>-;>=*;>=;-;>->;>>>=% .+O>12:=OOo@@@ooXoooXooXoo+#@@", +"o><>->==:>->>:-=>=;=:->;>;>->>:%@ .oo2>>2221,@@O,22122211<>:=Oo@", +"o>-%$%$%$%%$%$%%$%$%$%%$%$%$%$%#@. .o1,>,>,,,$#=2:>>;>->:>;>1: @", +"o;%............................... O,>,,:$:-%o,>;>->>>->;>->@ #", +"o. +.o.+%$%%$O2:::>>;:>::>;;+ #", +"@O... . . . . . . . . . . . X+#.. .@#@@@@@#+@#@#+# @", +"@#+@oooOOoOO.........................+#+@......+@ #", +"................................................................" +}; diff --git a/textures/redbrick.xpm b/textures/redbrick.xpm new file mode 100755 index 0000000..9832f13 --- /dev/null +++ b/textures/redbrick.xpm @@ -0,0 +1,96 @@ +/* XPM */ +static char *_b5a7e7efb414f3bb578ade0f180d64bkrjcui0RVaKIC1jq[] = { +/* columns rows colors chars-per-pixel */ +"64 64 26 1 ", +" c #202020", +". c #2C2C2C", +"X c gray19", +"o c #343434", +"O c gray22", +"+ c #400000", +"@ c #4C0000", +"# c #580000", +"$ c #640000", +"% c #700000", +"& c #7C0000", +"* c gray25", +"= c #484848", +"- c #4C4C4C", +"; c gray33", +": c gray36", +"> c #646464", +", c #880000", +"< c #980000", +"1 c #A40000", +"2 c #B00000", +"3 c #BC0000", +"4 c #C80000", +"5 c #D40000", +"6 c #E00000", +"7 c #EC0000", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +";O;=====;======;=O=======;;;;;;=========;;;;;;;====OOO==;;=====O", +"O775555555551==;775555555555555555551=O;77776666665555544443331=", +"=74225,15,41$.=;73,3,3,3&3<3<3&3&341%.=O51424224%4&424,21&4<41&.", +"=51&1,1<%1,%$.=;53,,1,%11%<11%<1%1<%#.=;511&$1,%,1&,11,1&,1#1%$.", +"=5&11%<11%1#+.=;5,31,1%1,1%1%,&1%<&%#.==5%1$,1$1%1&1,1$1<&1&1%@.", +"=41&,<&1%,1%+.=;33,1,,<1%,%1,%<&,%1%+.O=3%1&1,$1%%11%1,11&1#1,@.", +"=3&11%1<%<%#+.==34,1%1%1%1%<,%&1%<&%#.O=3<1$,1&,%,&1,1$1&,1&1%+.", +"=31%,#%&#%,%+.O;<<%%@,%%,%@%,%,%@,%%+.O=3%%#%%@,@%#,@%@,$@%,%,+.", +"=&$$$++++++++.O=&$$#########+++++++++.O=,$$$$$$$$$$#########+++.", +"==........ .O;=..... .. .....=;O........... .......", +";OOOO====OOOOO=O=======OOO;===OO======;O=;;;;:>>:;;==*O*;O;===;O", +"7555333333333331=;=7755555544444443333333333333333331=*;77555555", +"2,,2<&2&<,2$2,1+O=;7%24&3$,3,,4<1,&,1,1,1&4$4,<34<41+O=O74&2,2,2", +",1,1&,,$1,$,11%+.==52%1&11,1$1%$,1&1&1$11,$1,1%,1%1%+O=;42&1,&1<", +"%11,<$1&,,<$1,%+.O=5%1,<,,$,,%1,$1,&$&,,1#,&1%1%11%%+.*=4&111&1&", +"1,,1,&&,&1<$1$%+.O=5%11&1$,1$%1$,1&,&1$1,#1$1%,%1%1%+.O=42&1&1<&", +"%1$1%,&<$1$,11%+.=;52#1&1,$,#,%$1,&#&1$,#,1$,1%,1%1%+ O=2&11#1&,", +"%2$%@&%<%<%#<%%+.=;21%,#%<%,$%,#%<%<$,%,,#<%%,@%<%,%+ *;21&%#%<%", +"+@@@@@@@@@@@@+++O=;1$$$$$$$$$$$$$##################++ =O1$+$++$+", +"... ... ... .O=O=Oo......ooOOo... ... .....O=;=.......", +";;=OO=;O;O==OOOO==;===*O*O*O*===;O;=*OOO**==;*OO*===;=;O;*O*;===", +";775555555333333333333333331=;;77555555555533333333333333333331=", +";7,23&3&3&2,2,24,2,2,32$24%+O=;73%512,12,2<2&$1,%,1&,1<,1&,1#1+.", +"O72,1<1&%,11,<,1,$1%1,$,1%2+.=:53<1$1$,%<,$1$,1$1%1&1,1$1<&1&%+.", +"=3$11%,#1$1%1,<1$,1%,1,$&1%+.;>53&1&1$1%<1&1&1,$1%%1<%<,11&1#%+.", +"=32,1@1#%,1,%&1&,$&1$1,$1%#+.;:5%1%<,$,<%1$,$,1&,%,&1,1$1&,1&%+.", +";3%$1@,&1$1#1$1,$,1,$1$,&&2+.=;54%1%1,1,%1$1#%%@1@1#1@11,$@%,%+.", +"=41$%%%#%@%%,$,%%,%%$%<%<%%+.O;41%<%,#%%%%$,%,@1#%1@%,@1#1@1%%+.", +"=1<$$$$$$$$$$$$$$@@@@@@@@@++.O;1$$$$$$$$$$$$$$############+#&#+.", +"==O.................OOO......===........ .OOO. ...........", +";;;;;==O=OOO=;>>;;;===**OO*OO*;===;O;=;=*O*O*=;;==*O*===;O;===;O", +"33333333331=O;55555555333333333333333331=;;475555555553333333333", +"1212<42241+O=O51$1%11$1,11%1,$11$11%1&1+O=;51&1%11$1&,&1%1,1&1%1", +"1&,1<1&1,%+.=;5$1&,1&1<%1,,%,,1,$1%,1$1+O;;51#1%1,$1,1&,,<%<&<,%", +",&1<&1&<1%+.=O5$11&<1%1%1,1#1@,,1,%<1&1+O;>51&1%1,1,11&1%<,1<&1%", +"1,&1<1<&,%+O=;5<$1&1&#<,,,%,1$1,$,<%,1&+O;>5&11%1$11&&1&1,<<,&%,", +"1,&1&1&<1%+O==5$1&#<1%,,1,1%,@$<$1<%1&1+O=;41&11%1,,&1&1%<,1&,1%", +"%%,<%%<%%%+O==<$11#1&%1%1$1#,$1,$<%<1$&+.=;41#1%11,1,1&1%<%<&11%", +"++@@@@@@@++.==1$$$$$$$$$##############++.==1$$$$$$$$$$$$$$$####+", +"............=;=. ..OOO. .........O===....OO=O.. .......", +";=;O=OO==OOOO==OOO=====;;==OOO;===;O=O=O==;=;O;=;:>;-==O;=;=;O;O", +"O7555555533333333333333333333331O;O7755555555333333333333333331=", +";51,,1$11&<1&1%,1$1&1,1$1$11&%1+O=;711$1$1#1%1#1,#<,%1,&1&<%,1+.", +"=51$1,$1,<&1$,#1<$1#,<,$1&1&1%<+.==5,1$,$&#,#<&1#1$1%,%1,&<1$,+.", +"=5,$1$,%$1$1,&,1$<,,#&1@<#,$,,%+.O=5,1$$,1&#<1#1%%1%1&1%,$1+.", +"O51,1,$1,&<1&1#,1$1#,1#<1&111%&+.O=51$1,$1#1%<&&#,$1&,<,<&%1,1+.", +";51$,1$1$1$1$1%1$$1#,&1&,$<$,%1+ O;51$$1$#1#<#1$,%1%&1&<,$%+.", +"O41$1$,%,<&1,,,1<$,&#$1@1%<&1%1+ O;4%1$,$1#&1&#<%,$1%1%1&<%1$1+.", +";1$$$$$$$$$@@@@@@@@@@@@@@@@@@@@+.=;1$$$$$$$$$#####@@@@@@@@@@@++.", +"O=..........OOO. ... .. ..=O=...... .oOo. .... ......", +";O;O;=;====;>>;=;O;=;=*OOO*=;==O==;O;========-;;;-====OX XO==;=", +"555553333333333331=;=77555555553333333333333331=O;75555533333333", +"&1#11$<$1&4&1$1&1+.==51111$1@1&1$1$1<1$1$1#1%$+O=;51$,1#1%1%1$1%", +"1&&1&1$<&$1#&$,$,+.==5&1%1$%@&<&1,$,<$&,%,#1$1+o=;5$1#1%1%,1%1,@", +"1&#&1$<$&1,$<&+.=*5&&%1$&&1#1@11$1$1$,#,,$%+.=;5$1%%11,%,%$%,", +"&<#<$$1$1&1#&%$1$+.=*51@%1$1@1&<$1$,&$1$1,#%<$+.=;51$#1,%%1%1$%1", +"$1&1$1$,1$1&#,1&,+.=*5@11$1&%,#&@1$1$&&$,%#,%$+.==5$1,1%1,%%#1%1", +"$1&&$<<$<$$1$<+.==5@1%1$&&,@<$,@1&$1,$1#1#,+.O=5$1#%#1%1%#$1@", +"&<#1$$,$&&1#1$%,&+.=;41@%1$1@,$1$1%$1$&1$,%,$,+.O=4$$#1#1%1%1$1%", +"@@@@@@@@@@@@@@@@++.==1+++++@@@@@@@@@@@@@@@@@@++ =;1++@@@@@@@@@@@", +"...................=;=Ooo.............. . O==...... ..", +"O;O;OOO=====;;O====;;;;;===;===;==O===*OO*OO*=*O*;==O;====*O*===", +";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" +}; diff --git a/textures/wood.xpm b/textures/wood.xpm new file mode 100755 index 0000000..8d9f1c5 --- /dev/null +++ b/textures/wood.xpm @@ -0,0 +1,79 @@ +/* XPM */ +static char *_a69134763a34ce5c9fec3f4e96face6MidS5Qd0zP6RchJM[] = { +/* columns rows colors chars-per-pixel */ +"64 64 9 1 ", +" c #28200C", +". c #382C14", +"X c #403018", +"o c #483818", +"O c #543C1C", +"+ c #5C4020", +"@ c #6C4824", +"# c #744C28", +"$ c #905C34", +/* pixels */ +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", +"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"OOOOOOO.O .OOOOOOOOOOOOOO.O .OOOO.O .OOOOOO.O .OOOOOOOOOOO.O .OO", +"oo@####O$ O$+oooo##o@o@ooO$ O$#o#O$ O$+ooo+O$ O$o#oo#o#o##O$ O$@", +"oo@###+O$ O$@oooO##o@o@ooO$ O$#o#O$ O$#+o+#O$ O$o#oo#o#o##O$ O$@", +"oo+###OO$ O$#OooO##o@o@ooO$ O$@o#O$ O$##+##O$ O$o#oo#o#o##O$ O$@", +"OoO@##OO$ O$#Ooo+#@o@o@ooO$ O$@o#O$ O$#####O$ O$o#oo#o#o##O$ O$@", +"@oo+#+oO$ O$#+oO@#@o@o@ooO$ O$@o#O$ O$#####O$ O$o#oo#o#o@#O$ O$O", +"@oOo+OoO$ O$#@o+##+o@o@ooO$ O$+o#O$ O$#####O$ O$o#oo#o#o@#O$ O$O", +"#OooOooO$ O$##+@##+o@o@ooO$ O$+o#O$ O$#####O$ O$o#oo#o#o+#O$ O$O", +"#OooooOO$ O$##@###Oo@o@ooO$ O$oo#O$ O$#####O$ O$o#oo#o#o+#O$ O$o", +"@#oooO#O$ O$##@###Oo@o@ooO$ O$o+#O$ O$@####O$ O$o#oo#o#Oo#O$ O$o", +"@#OooO#O$ O$#####@oo@o@ooO$ O$o+#O$ O$@###@O$ O$o#oo#o#Oo#O$ O$o", +"+##oO##O$ O$#####@oo@o@ooO$ O$o##O$ O$+###@O$ O$o#oo#o#Oo#O$ O$o", +"O###O#+O$ O$@####@oo@o@ooO$ O$+##O$ O$o@#@+O$ O$o#oo#o#Oo#O$ O$O", +"o@##+#OO$ O$@####+oo@o@ooO$ O$+#@O$ O$o+@+oO$ O$o#oo#o#+o#O$ O$O", +"o@####OO$ O$+####+oo@o@ooO$ O$##@O$ O$oo+ooO$ O$o#oo#o#+o@O$ O$O", +"o+@###oO$ O$+####Ooo@o@ooO$ O$##+O$ O$oooooO$ O$o#oo#o#@o@O$ O$@", +"oO@##+oO$ O$O@###OoO@o@ooO$ O$#@+O$ O$oooooO$ O$o#oo#o#@o@O$ O$@", +"oo+##OoO$ O$O@##@ooO@o@ooO$ O$#@oO$ O$oooooO$ O$o#oo#o#@o+O$ O$@", +"ooO##OoO$ O$o+##@ooO@o@ooO$ O$#+oO$ O$+ooo+O$ O$o#oo#o##o+O$ O$@", +"OoO+OooO$ O$o+##+oo+@o@ooO$ O$@ooO$ O$@+o+@O$ O$o#oo#o@#ooO$ O$@", +"OooOooOO$ O$oO@@+oo+@o@ooO$ O$+ooO$ O$#@+@#O$ O$o#oo#o@#OoO$ O$@", +"OoooooOO$ O$oO++Ooo++o@ooO$ O$oooO$ O$##@##O$ O$o#oo#o+#OoO$ O$+", +"@ooooo@O$ O$ooOOooo@Oo@ooO$ O$oooO$ O$#####O$ O$o#oo#o+#+oO$ O$O", +"@ooooo@O$ O$ooooooo@Oo@ooO$ O$ooOO$ O$#####O$ O$o#oo#oO#+oO$ O$O", +"@OoooO+O$ O$ooooooO#oo@ooO$ O$ooOO$ O$#####O$ O$o#oo#oO#@OO$ O$o", +"+OoooOOO$ O$oooooo+#oo@ooO$ O$oo+O$ O$@####O$ O$o#oo#oO#@OO$ O$o", +"O@ooo@OO$ O$oooooo+#oo@ooO$ O$oo@O$ O$@####O$ O$o#oo#oo##+o$ O$o", +"O@Ooo@oO$ O$oooooo@#oo@ooO$ O$oO@O$ O$+###@O$ O$o#oo#oo##+O$ O$o", +"o+Oo@+oO$ O$Oooooo@#oo@ooO$ O$o+#O$ O$+@##@O$ O$o#oo#oo@#@O$ O$o", +"oO@O@OoO$ O$+ooooO#@oO@ooO$ O$O@#O$ O$o@##+O$ O$o#oo#oo@#@O$ O$o", +"oO@O@OoO$ O$@Oooo+#@oO@ooO$ O$+##O$ O$o+#@oO$ O$o#oo#Oo+##O$ O$o", +"oo+@+ooO$ O$#+ooO+#+o+@ooO$ O$@##O$ O$oo@+oO$ O$o#oo#Oo+##O$ O$O", +"ooO+OooO$ O$#@OoO##Oo+@ooO$ O$###O$ O$oo+ooO$ O$o#oo#OoO##O$ O$O", +"oooOoooO$ O$##+o+##Oo+@ooO$ O$##@O$ O$oooooO$ O$o#oo#OoO##O$ O$+", +"oooooooO$ O$###+###oo@@ooO$ O$##@O$ O$oooooO$ O$o#oo#+oO##O$ O$@", +"ooooooOO$ O$######@oo@@ooO$ O$##+O$ O$oooooO$ O$o#oo#+oo@#O$ O$@", +"OoooooOO$ O$@#####@oo#@ooO$ O$#@+O$ O$+ooooO$ O$o#oo#@oo@#O$ O$@", +"Oooooo+O$ O$@#####+oo#@ooO$ O$#@oO$ O$+ooooO$ O$o#oo@@oo+#O$ O$O", +"@OoooO+O$ O$+#####Ooo#+ooO$ O$#+oO$ O$@+oo+O$ O$o#oo@#oo+#O$ O$O", +"@OoooO@O$ O$O#####ooo#+ooO$ O$@+oO$ O$#+o++O$ O$o#oo+#OoO@O$ O$o", +"@+OoO+@O$ O$o@###@ooO#oooO$ O$@ooO$ O$#@++@O$ O$o#oo+#OoO@O$ O$o", +"@@OOO@+O$ O$o+###+oo+#oooO$ O$+ooO$ O$##+@#O$ O$o#ooO#OoO+O$ O$o", +"+@+O+@OO$ O$oO@#@Ooo@#oooO$ O$oooO$ O$##@##O$ O$o#ooO#+oo+O$ O$o", +"O@@+@@OO$ O$ooO@+ooo@#oooO$ O$ooOO$ O$#####O$ O$o#ooO#+OoOO$ O$o", +"O@@+@@oO$ O$oooOOooo#@oooO$ O$ooOO$ O$#####O$ O$o#ooO#@OoOO$ O$o", +"o@###@oO$ O$OooooooO#@oooO$ O$oo+O$ O$####@O$ O$o#ooo#@OoOO$ O$o", +"o+###@oO$ O$Ooooooo+#+oooO$ O$oO@O$ O$@###@O$ O$o#ooo@#+ooO$ O$o", +"oO@##@oO$ O$+oooooo@#+oooO$ O$o+#O$ O$@###+O$ O$o#ooo@#+OoO$ O$o", +"oO@##+oO$ O$@Oooooo@#ooooO$ O$O@#O$ O$+###+O$ O$o#ooo+#@OoO$ O$O", +"oo+#@+oO$ O$#OooooO#@ooooO$ O$@##O$ O$+##@OO$ O$o#ooo+#@+oO$ O$O", +"ooO@@OoO$ O$#+oooo+#@oo+oO$ O$###O$ O$O@#@OO$ O$o#OooO@#+OO$ O$+", +"ooO@+OoO$ O$@@Oooo@#+oo+oO$ O$###O$ O$O@#+oO$ O$o#OooO+#@OO$ O$+", +"ooo++ooO$ O$@#OooO@#ooo@oO$ O$###O$ O$o+@OoO$ O$o#Oooo+#@OO$ O$@", +"oooOOooO$ O$+#@OoO##ooo@oO$ O$###O$ O$oO+ooO$ O$o#OoooO@#OO$ O$@", +"OoooooOO$ O$o@#@O##@ooo@oO$ O$###O$ O$ooOooO$ O$o@+oooO+#@O$ O$#", +"OoooooOO$ O$o+#####+ooo#oO$ O$##@O$ O$oooooO$ O$o@@oooo+#@O$ O$#", +"+ooooo@O$ O$oo####@ooo+#oO$ O$##@O$ O$oooooO$ O$o+@OoooO@@O$ O$#", +"+OoooO@O$ O$oo+@#@+ooo@#oO$ O$#@+O$ O$oooooO$ O$o+#Ooooo++O$ O$#", +"@OoooO@O$ O$ooo+@+oooo@#oO$ O$#@+O$ O$oooooO$ O$oo#OoooooOO$ O$#", +"@+oooO@O$ O$oooo+oooo@##+O$ O$@+oO$ O$oooooO$ O$+o#+ooooooO$ O$#", +"+++++++O$ O$+ooooooo+++++O$ O$+ooO$ O$+ooo+O$ O$+o++ooooooO$ O$+" +};