From 939866b7cee1b4367fd5e611e99c579b4764259f Mon Sep 17 00:00:00 2001 From: Quinten Mennen Date: Wed, 11 Jun 2025 17:46:33 +0200 Subject: [PATCH] Update launch configuration, enhance shader functionality, and modify game mechanics --- .vscode/launch.json | 2 +- Makefile | 20 ++++++------ assets/shaders/frag.glsl | 61 ++++++++++++++++++++++++++++++++++--- assets/shaders/vert.glsl | 35 +++++++++++++++++++-- inc/cub3d.h | 21 +++++++------ inc/types.h | 16 +++++----- maps/invalid/test.cub | 5 +-- src/game/game.c | 7 +---- src/game/player.c | 4 +-- src/math/get_fraction.c | 14 ++++----- src/menu/end_screen.c | 17 ++++++----- src/menu/end_screen_utils.c | 3 +- src/monster/monster.c | 4 +-- src/render/render_floor.c | 32 +++++++++++++++---- src/shader/shaders.c | 9 +++++- test.cub | 10 +++--- test.sh | 2 +- 17 files changed, 186 insertions(+), 76 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 8b8dbce..de48db3 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/build/debug/cub3D", // Replace with your executable path - "args": ["test.cub"], + "args": ["maps/invalid/test.cub"], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], diff --git a/Makefile b/Makefile index ccb75a9..9e9176c 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,19 @@ # **************************************************************************** # # # -# :::::::: # -# Makefile :+: :+: # -# +:+ # -# By: whaffman +#+ # -# +#+ # -# Created: 2024/10/15 11:48:46 by whaffman #+# #+# # -# Updated: 2025/06/10 16:22:24 by whaffman ######## odam.nl # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: qmennen +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2024/10/15 11:48:46 by whaffman #+# #+# # +# Updated: 2025/06/11 17:41:17 by qmennen ### ########.fr # # # # **************************************************************************** # NAME = cub3D +FLAGS="-DFULLSCREEN=1" + DIST_PATH = dist SRC_PATH = src INC_PATH = inc @@ -46,10 +48,10 @@ SOURCES = $(shell basename -a $(shell find $(SRC_PATH) -type f -name "*.c")) # Build configurations BUILD_CONFIGS = release debug asan tsan -release_CFLAGS = -Wall -Wextra -Werror -flto -Ofast -march=native -mtune=native -ffast-math -DFULLSCREEN=0 +release_CFLAGS = -Wall -Wextra -Werror -flto -Ofast -march=native -mtune=native -ffast-math unity_CFLAGS = -Wall -Wextra -Werror -Ofast -march=native -mtune=native -ffast-math debug_CFLAGS = -Wall -Wextra -Werror -g3 -DDEBUG -DDBG='fprintf(stderr, RED "DEBUG: " RESET "%s:%d (%s)\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);' -asan_CFLAGS = -Wall -Wextra -Werror -flto -fsanitize=address,leak,undefined -g3 -DFULLSCREEN=0 +asan_CFLAGS = -Wall -Wextra -Werror -flto -fsanitize=address,leak,undefined -g3 tsan_CFLAGS = -Wall -Wextra -Werror -fsanitize=thread -g3 RUN_ARGS=test.cub diff --git a/assets/shaders/frag.glsl b/assets/shaders/frag.glsl index 1c8348a..601cd68 100644 --- a/assets/shaders/frag.glsl +++ b/assets/shaders/frag.glsl @@ -2,6 +2,7 @@ in vec2 TexCoord; flat in int TexIndex; +flat in vec3 originalTexCoord; out vec4 FragColor; uniform sampler2D Texture0; @@ -37,10 +38,56 @@ float hash(vec2 p) { return fract(p.x * p.y); } +vec2 fisheyeDistort(vec2 coord, float strength) { + // Scale down input coordinates to leave room for distortion + vec2 safeCoord = mix(vec2(0.5), coord, 0.85); // Scale down by 15% + + vec2 centered = safeCoord * 2.0 - 1.0; + float distance = length(centered); + + // Reduce strength near edges + float adjustedStrength = strength * (1.0 - smoothstep(0.7, 0.9, distance)); + + float distorted = distance * (1.0 + adjustedStrength * distance * distance); + + vec2 distortedCoord; + if (distance < 0.001) { + distortedCoord = centered; + } else { + distortedCoord = centered * (distorted / distance); + } + + distortedCoord = distortedCoord * 0.5 + 0.5; + + return distortedCoord; +} + +float calculateMask(vec2 coord, float fisheyeStrength, float maskThreshold, float softness) { + vec2 centered = coord * 2.0 - 1.0; + float distance = length(centered); + + if (distance == 0.0) { + return 1.0; + } + + float distorted = distance * (1.0 + fisheyeStrength * distance * distance); + vec2 distortedCoord = centered * (distorted / distance); + distortedCoord = distortedCoord * 0.5 + 0.5; + float maxDistortion = max( + max(abs(distortedCoord.x - 0.5), abs(distortedCoord.y - 0.5)) - 0.5, + 0.0 + ); + + float mask = 1.0 - smoothstep(maskThreshold - softness, maskThreshold + softness, maxDistortion); + + return mask; +} + void main() { vec4 texColor; vec4 noiseColor; + vec2 distortedCoord; switch (TexIndex) { case 0: texColor = texture(Texture0, TexCoord); break; @@ -81,15 +128,16 @@ void main() noise2 *= 0.9 + 0.1 * sin(uv.y * 400.0); noise3 *= 0.9 + 0.1 * sin(uv.y * 400.0); + distortedCoord = fisheyeDistort(TexCoord, u_battery * 1.2); + float offset = 0.001 / (u_battery * u_battery + 0.001 ); offset = offset > .05 ? .05 : offset; - float r = texture(Texture1, TexCoord + vec2(offset * 5, 0.0)).r; - float g = texture(Texture1, TexCoord + vec2(0.0, offset * 2.0)).g; - float b = texture(Texture1, TexCoord - vec2(offset, 0.0)).b; + float r = texture(Texture1, distortedCoord + vec2(offset * 5, 0.0)).r; + float g = texture(Texture1, distortedCoord + vec2(0.0, offset * 2.0)).g; + float b = texture(Texture1, distortedCoord - vec2(offset, 0.0)).b; vec3 color = vec3(r, g, b); vec3 noisyColor = mix(color.rgb, vec3(noise, noise2, noise3), (strength / 2 + .2)); - // float flicker = 0.75 + sin(u_time * 6.0 + sin(u_time * 3)) * 0.25; float flicker = (1 - strength * 0.5) + 0.25 * (strength * sin(u_time + sin(u_time * 7.0) + 1)); float dim = u_battery < 0.1 ? u_battery * 10.0 : 1; @@ -102,7 +150,10 @@ void main() float inv_hit = 1.0 - u_hit_timer; noiseColor *= vec4(vig) * vec4(1.0, inv_hit, inv_hit, 1.0); } - FragColor = noiseColor; + + float mask = calculateMask(gl_FragCoord.xy / u_resolution, 1, 0.08f, 0.02f); + FragColor = vec4(noiseColor.rgb * mask, noiseColor.a); + // FragColor = noiseColor; } else { FragColor = texColor; } diff --git a/assets/shaders/vert.glsl b/assets/shaders/vert.glsl index 2fbe8a4..8b3e47b 100644 --- a/assets/shaders/vert.glsl +++ b/assets/shaders/vert.glsl @@ -4,13 +4,44 @@ layout(location = 1) in vec2 aTexCoord; layout(location = 2) in int aTexIndex; out vec2 TexCoord; + flat out int TexIndex; +flat out vec3 originalTexCoord; + uniform mat4 ProjMatrix; +uniform float u_bobtime; +uniform int u_ismoving; + +const float bobbingSpeed = 18.0; // Speed of the bobbing effect +const float bobbingIntensity = 0.6; // Intensity of the bobbing effect void main() { - // Add view bobbing - gl_Position = ProjMatrix * vec4(aPos, 1.0); + vec3 position = aPos; + originalTexCoord = aPos; + if (u_ismoving == 1 && aTexIndex == 1) { + // Calculate bobbing offset based on sine waves + float verticalBob = sin(u_bobtime * bobbingSpeed) * bobbingIntensity; + float horizontalBob = sin(u_bobtime * bobbingSpeed * 0.5) * bobbingIntensity * 0.3; + + // Apply the bobbing offset + position.y += verticalBob; + position.x += horizontalBob; + + // Optional: Add slight rotation for more realistic head movement + float tiltAngle = sin(u_bobtime * bobbingSpeed * 0.7) * bobbingIntensity * 0.02; + + // Apply rotation around Z-axis (head tilt) + float cosA = cos(tiltAngle); + float sinA = sin(tiltAngle); + + float newX = position.x * cosA - position.y * sinA; + float newY = position.x * sinA + position.y * cosA; + + position.x = newX; + position.y = newY; + } + gl_Position = ProjMatrix * vec4(position, 1.0); TexCoord = aTexCoord; TexIndex = aTexIndex; } \ No newline at end of file diff --git a/inc/cub3d.h b/inc/cub3d.h index 853a6fe..4038a2e 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ -/* :::::::: */ -/* cub3d.h :+: :+: */ -/* +:+ */ -/* By: qmennen +#+ */ -/* +#+ */ -/* Created: 2025/04/15 12:22:29 by qmennen #+# #+# */ -/* Updated: 2025/06/10 20:44:48 by whaffman ######## odam.nl */ +/* ::: :::::::: */ +/* cub3d.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: qmennen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/04/15 12:22:29 by qmennen #+# #+# */ +/* Updated: 2025/06/11 16:29:00 by qmennen ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,10 +20,11 @@ # define HEIGHT 1080 # define TITLE "Cub3D" -# define ATTACK_DAMAGE 0.05f -# define INITIAL_BATTERY 0.5f +# define ATTACK_DAMAGE 0.03f +# define INITIAL_BATTERY 1.0f # define BATTERY_RATE 0.01f # define FLASH_BATTERY 0.05f +# define SLIDESHOW_DURATION 3.0f # ifndef FULLSCREEN # define FULLSCREEN 1 @@ -47,7 +48,7 @@ # define CYAN "\033[0;36m" # define WHITE "\033[0;37m" -# define MAX_SCREENSHOTS 3 +# define MAX_SCREENSHOTS 10 # define NUM_KEYS 300 # define TILE_SIZE 8 # define MINIMAP_SIZE 300 diff --git a/inc/types.h b/inc/types.h index 318aae7..48f860f 100644 --- a/inc/types.h +++ b/inc/types.h @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ -/* :::::::: */ -/* types.h :+: :+: */ -/* +:+ */ -/* By: qmennen +#+ */ -/* +#+ */ -/* Created: 2025/04/15 15:52:44 by qmennen #+# #+# */ -/* Updated: 2025/06/10 19:30:40 by whaffman ######## odam.nl */ +/* ::: :::::::: */ +/* types.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: qmennen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/04/15 15:52:44 by qmennen #+# #+# */ +/* Updated: 2025/06/11 16:56:03 by qmennen ### ########.fr */ /* */ /* ************************************************************************** */ @@ -127,6 +127,8 @@ typedef struct s_screen int u_resolution_location; int u_hit_timer_location; int u_enabled_location; + int u_bobtime_location; + int u_ismoving_location; int flash; } t_screen; diff --git a/maps/invalid/test.cub b/maps/invalid/test.cub index 5b6493e..1401dab 100644 --- a/maps/invalid/test.cub +++ b/maps/invalid/test.cub @@ -6,7 +6,8 @@ EA ./assets/bricksx64.png F 90,30,30 C 100,100,200 + 1111111 -100W001 -1N00001 +1000001 +1W00001 1111111 \ No newline at end of file diff --git a/src/game/game.c b/src/game/game.c index 4093a6a..1aa1fc9 100644 --- a/src/game/game.c +++ b/src/game/game.c @@ -6,7 +6,7 @@ /* By: qmennen +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/15 15:46:08 by qmennen #+# #+# */ -/* Updated: 2025/06/11 14:49:08 by qmennen ### ########.fr */ +/* Updated: 2025/06/11 17:44:59 by qmennen ### ########.fr */ /* */ /* ************************************************************************** */ @@ -52,11 +52,6 @@ void game_run(t_game *game) cast_rays(game); update_monsters(game); render_map(game); - if (game->player->is_moving) - { - game->screen->img->instances[0].x = sin(mlx_get_time() * 10) * 20; - game->screen->img->instances[0].y = cos(mlx_get_time() * 18) * 10; - } handle_battery(game); handle_record(game); handle_mouse(game); diff --git a/src/game/player.c b/src/game/player.c index 31478bc..bb0d426 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -6,7 +6,7 @@ /* By: qmennen +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/15 18:53:19 by qmennen #+# #+# */ -/* Updated: 2025/06/05 18:44:18 by qmennen ### ########.fr */ +/* Updated: 2025/06/11 16:26:14 by qmennen ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,7 +23,7 @@ int player_create(t_game **game) player->pos.x = -1; player->pos.y = -1; player->speed = 3.f; - player->battery = .5f; + player->battery = INITIAL_BATTERY; player->hit_timer = 0.f; (*game)->player = player; return (SUCCESS); diff --git a/src/math/get_fraction.c b/src/math/get_fraction.c index 8ee59d8..dab1e45 100644 --- a/src/math/get_fraction.c +++ b/src/math/get_fraction.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ -/* :::::::: */ -/* get_fraction.c :+: :+: */ -/* +:+ */ -/* By: whaffman +#+ */ -/* +#+ */ -/* Created: 2025/05/12 12:09:27 by whaffman #+# #+# */ -/* Updated: 2025/05/14 16:13:38 by whaffman ######## odam.nl */ +/* ::: :::::::: */ +/* get_fraction.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: qmennen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/05/12 12:09:27 by whaffman #+# #+# */ +/* Updated: 2025/06/11 15:19:32 by qmennen ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/src/menu/end_screen.c b/src/menu/end_screen.c index bfc6795..2039ec1 100644 --- a/src/menu/end_screen.c +++ b/src/menu/end_screen.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ -/* :::::::: */ -/* end_screen.c :+: :+: */ -/* +:+ */ -/* By: whaffman +#+ */ -/* +#+ */ -/* Created: 2025/06/03 16:20:35 by qmennen #+# #+# */ -/* Updated: 2025/06/10 21:39:35 by whaffman ######## odam.nl */ +/* ::: :::::::: */ +/* end_screen.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: qmennen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/06/03 16:20:35 by qmennen #+# #+# */ +/* Updated: 2025/06/11 17:44:51 by qmennen ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,7 +21,8 @@ static void slideshow(t_game *game) game->screenshots[frame_idx]->instances[0].enabled = true; if (last_frame_time == 0) last_frame_time = mlx_get_time(); - if (mlx_get_time() - last_frame_time > 5 && frame_idx < game->screenshot_idx + if (mlx_get_time() - last_frame_time > SLIDESHOW_DURATION + && frame_idx < game->screenshot_idx && frame_idx < MAX_SCREENSHOTS) { game->screenshots[frame_idx++]->instances[0].enabled = true; diff --git a/src/menu/end_screen_utils.c b/src/menu/end_screen_utils.c index d133448..e11ca93 100644 --- a/src/menu/end_screen_utils.c +++ b/src/menu/end_screen_utils.c @@ -6,7 +6,7 @@ /* By: qmennen +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/06/10 14:54:49 by qmennen #+# #+# */ -/* Updated: 2025/06/10 15:30:18 by qmennen ### ########.fr */ +/* Updated: 2025/06/11 16:24:05 by qmennen ### ########.fr */ /* */ /* ************************************************************************** */ @@ -53,7 +53,6 @@ void draw_score_line( free(text); return ; } - printf("Drawing score line: %s at (%d, %d)\n", text, pos.x, pos.y); *img = mlx_put_string(mlx, text, pos.x, pos.y); free(text); } diff --git a/src/monster/monster.c b/src/monster/monster.c index 7b44d11..0c72b4e 100644 --- a/src/monster/monster.c +++ b/src/monster/monster.c @@ -6,7 +6,7 @@ /* By: qmennen +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/28 17:15:52 by qmennen #+# #+# */ -/* Updated: 2025/06/10 14:45:44 by qmennen ### ########.fr */ +/* Updated: 2025/06/11 16:22:09 by qmennen ### ########.fr */ /* */ /* ************************************************************************** */ @@ -28,7 +28,7 @@ void update_monsters(t_game *game) continue ; d = sub(game->player->pos, sprite->pos); dist_squared = d.x * d.x + d.y * d.y; - if (dist_squared >= 0.02) + if (dist_squared >= 0.02 && dist_squared < 50) { inv_dist = 1.0 / sqrt(dist_squared); sprite->pos.x += d.x * inv_dist * .05f; diff --git a/src/render/render_floor.c b/src/render/render_floor.c index c9b3fec..b50e16d 100644 --- a/src/render/render_floor.c +++ b/src/render/render_floor.c @@ -6,7 +6,7 @@ /* By: qmennen +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/14 13:06:39 by whaffman #+# #+# */ -/* Updated: 2025/06/10 15:41:41 by qmennen ### ########.fr */ +/* Updated: 2025/06/11 17:45:31 by qmennen ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,27 +23,46 @@ static t_vec2 calc_floor_step(t_game *game, return (floor_step); } -static void draw_floor_ceiling_pixel(t_game *game, +static void draw_floor_pixel(t_game *game, t_vec2_int coord, double row_dist, t_vec2 floor_pos) { - const t_vec2_int tex = vec2_to_int( - mul(get_fraction(floor_pos), game->map->texture_floor->width)); - int color; + t_vec2_int tex; + int color; + int tex_width; if (game->map->texture_floor == NULL) color = game->map->floor_color << 8 | (int)(1.0 / row_dist * 255); else + { + tex_width = game->map->texture_floor->width; + tex = vec2_to_int( + mul(get_fraction(floor_pos), tex_width)); color = get_texture_color(game->map->texture_floor, (t_render){.perp_dist = row_dist, .sign = 0, .door = 0, .side = SIDE_DOOR, .wall_x = 0}, tex); + } mlx_put_pixel(game->screen->img, coord.x, coord.y, color); +} + +static void draw_ceiling_pixel(t_game *game, + t_vec2_int coord, double row_dist, t_vec2 ceiling_pos) +{ + t_vec2_int tex; + int color; + int tex_width; + if (game->map->texture_ceiling == NULL) color = game->map->ceiling_color << 8 | (int)(1.0 / row_dist * 255); else + { + tex_width = game->map->texture_ceiling->width; + tex = vec2_to_int( + mul(get_fraction(ceiling_pos), tex_width)); color = get_texture_color(game->map->texture_ceiling, (t_render){.perp_dist = row_dist, .sign = 0, .door = 0, .side = SIDE_DOOR, .wall_x = 0}, tex); + } mlx_put_pixel(game->screen->img, coord.x, game->screen->height - coord.y - 1, color); } @@ -63,7 +82,8 @@ static void draw_floor_row(t_game *game, return ; while (coord.x < (int) game->screen->width) { - draw_floor_ceiling_pixel(game, coord, row_dist, floor_pos); + draw_floor_pixel(game, coord, row_dist, floor_pos); + draw_ceiling_pixel(game, coord, row_dist, floor_pos); floor_pos = add(floor_pos, floor_step); coord.x++; } diff --git a/src/shader/shaders.c b/src/shader/shaders.c index 974293f..060c9e6 100644 --- a/src/shader/shaders.c +++ b/src/shader/shaders.c @@ -6,7 +6,7 @@ /* By: qmennen +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/08 18:27:59 by qmennen #+# #+# */ -/* Updated: 2025/06/10 15:48:16 by qmennen ### ########.fr */ +/* Updated: 2025/06/11 17:45:39 by qmennen ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,6 +17,9 @@ void set_uniforms(t_game *game) { glUniform1f(game->screen->u_time_location, (float)mlx_get_time()); + glUniform1f(game->screen->u_bobtime_location, (float)mlx_get_time()); + glUniform1i(game->screen->u_ismoving_location, + game->player->is_moving); glUniform1f(game->screen->u_battery_location, game->player->battery); glUniform2f(game->screen->u_resolution_location, (float)game->screen->width, (float)game->screen->height); @@ -40,6 +43,10 @@ int load_uniforms(t_game **game) ctx->shaderprogram, "u_enabled"); (*game)->screen->u_resolution_location = glGetUniformLocation( ctx->shaderprogram, "u_resolution"); + (*game)->screen->u_bobtime_location = glGetUniformLocation( + ctx->shaderprogram, "u_bobtime"); + (*game)->screen->u_ismoving_location = glGetUniformLocation( + ctx->shaderprogram, "u_ismoving"); if ((*game)->screen->u_time_location < 0 || (*game)->screen->u_battery_location < 0 || (*game)->screen->u_hit_timer_location < 0 diff --git a/test.cub b/test.cub index 022cd6f..562fcf2 100644 --- a/test.cub +++ b/test.cub @@ -24,20 +24,20 @@ CT ./assets/ceiling64x64.png -e e ./assets/flying_eye.png 1111111 111 1111 111111 1111111111 111111 -1000001110111001 100001 1000000001 10001 +1000001110111001 100001 1000000001 10e01 10010000000b0e01 100001 100000110111100011 10b0001110000001110011111111 1100b0001000000001 1000001 1000100a000010000001 100000e0100b000001 100m00111000100000b00000b00111110p00000100p00m001 -10b0e0bb00001111111111100000000000111111000000001 +10b0e0bb0000111111111110000000000011111100e000001 1000t0bW00001 1000011111111 1000001001 10p0011111DD1 111111100001 1111111111110001 100001 1001 1p00000000011111111000010111 10b01 -111111 1001 10000010000000000010b0000101 100001 +111111 10e1 100e0010000000000010b000e101 100001 1b01 10000p1111111111111000010001 10b00m1 - 1001 100000000000000000000111b001 100001 + 1001 100000000000000000000111b0e1 10e001 1001 1b000000b0000p00000011 11111 100001 10011111111100111111111111111111001110001 - 1000000000000000000000b000000000000000001 + 1000000000e00000000000b000000000000000001 111111b0111111101100111100011101011111111 1111 1111111 11111 11111 \ No newline at end of file diff --git a/test.sh b/test.sh index 5b8c232..b2e9884 100755 --- a/test.sh +++ b/test.sh @@ -19,7 +19,7 @@ for file in "$INVALID_DIR"/*; do test_name=$(basename "$file" | sed -e 's/\..*$//') # echo -e "${bu}Testing $test_name...${reset}" # Run the file with ./cub3D and send SIGINT after 1 second - timeout 1 ./cub3D "$file" > /dev/null 2>&1 + timeout 1 ./cub3D "$file" > /dev/null if [ $? -eq 1 ]; then # Print OK! [filename] if exit status is 1 echo -e "${gb}OK!${reset} $test_name"