From bd890b57980ecef17f8f5344d83029d27385895d Mon Sep 17 00:00:00 2001 From: djonker Date: Sun, 5 Nov 2023 07:37:08 +0100 Subject: [PATCH] little cleanup --- src/draw/raycast.c | 6 +++--- src/draw/texture.c | 6 +++--- src/draw/world.c | 12 ++++++------ src/input/game.c | 4 ++-- src/input/rest.c | 3 +-- src/main/main.c | 8 ++++++-- src/parse/parse.c | 4 ++-- 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/draw/raycast.c b/src/draw/raycast.c index 9b9be4b..98f8efd 100644 --- a/src/draw/raycast.c +++ b/src/draw/raycast.c @@ -6,13 +6,13 @@ /* By: djonker +#+ */ /* +#+ */ /* Created: 2023/10/27 14:36:42 by djonker #+# #+# */ -/* Updated: 2023/11/05 06:45:03 by houtworm ######## odam.nl */ +/* Updated: 2023/11/05 07:28:58 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ #include "../../cub3d.h" -int ft_getstepx(t_varlist *vl, int mapx) +int ft_getstepx(t_varlist *vl, int mapx) { int stepx; @@ -29,7 +29,7 @@ int ft_getstepx(t_varlist *vl, int mapx) return (stepx); } -int ft_getstepy(t_varlist *vl, int mapy) +int ft_getstepy(t_varlist *vl, int mapy) { int stepy; diff --git a/src/draw/texture.c b/src/draw/texture.c index 361b2ec..bd47267 100644 --- a/src/draw/texture.c +++ b/src/draw/texture.c @@ -6,7 +6,7 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 16:54:20 by houtworm #+# #+# */ -/* Updated: 2023/11/05 07:23:45 by houtworm ######## odam.nl */ +/* Updated: 2023/11/05 07:29:26 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -51,8 +51,8 @@ int ft_gettextx(t_varlist *vl) uint32_t ft_gettextcolor(t_varlist *vl, int texty, int textx) { - uint8_t *texel; - uint32_t color; + uint8_t *texel; + uint32_t color; texel = &vl->curtext->pixels[(vl->curtext->width * texty + textx) * 4]; color = texel[0] << 24 | texel[1] << 16 | texel[2] << 8 | texel[3]; diff --git a/src/draw/world.c b/src/draw/world.c index 65163c5..9645343 100644 --- a/src/draw/world.c +++ b/src/draw/world.c @@ -6,7 +6,7 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 16:54:20 by houtworm #+# #+# */ -/* Updated: 2023/11/05 07:23:20 by houtworm ######## odam.nl */ +/* Updated: 2023/11/05 07:32:02 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -27,11 +27,11 @@ int ft_drawceiling(int x, t_varlist *vl, int drawstart) int ft_drawwall(int x, t_varlist *vl, int drawstart, int drawend, int y) { - int textx; - double step; - double textpos; - int texty; - uint32_t color; + int textx; + double step; + double textpos; + int texty; + uint32_t color; textx = ft_gettextx(vl); step = 64.0 / vl->lineheight; diff --git a/src/input/game.c b/src/input/game.c index bd1b33b..7d22dab 100644 --- a/src/input/game.c +++ b/src/input/game.c @@ -6,7 +6,7 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 16:50:23 by houtworm #+# #+# */ -/* Updated: 2023/11/05 05:18:53 by houtworm ######## odam.nl */ +/* Updated: 2023/11/05 07:36:08 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -17,7 +17,7 @@ void keyhook(mlx_key_data_t kd, void *param) t_varlist *vl; vl = param; - vl->w =vl->w; + vl->w = vl->w; if (mlx_is_key_down(vl->mlx, MLX_KEY_ESCAPE)) { ft_putendl("escape is pressed"); diff --git a/src/input/rest.c b/src/input/rest.c index 28a20a6..090402a 100644 --- a/src/input/rest.c +++ b/src/input/rest.c @@ -6,7 +6,7 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 16:50:23 by houtworm #+# #+# */ -/* Updated: 2023/11/05 05:42:54 by houtworm ######## odam.nl */ +/* Updated: 2023/11/05 07:35:52 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -48,4 +48,3 @@ void scrollhook(double xdelta, double ydelta, void *param) if (ydelta < 0) ft_putendl("Next Weapon"); } - diff --git a/src/main/main.c b/src/main/main.c index 0561aae..9be2852 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -6,7 +6,7 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 14:13:07 by houtworm #+# #+# */ -/* Updated: 2023/11/05 04:55:32 by houtworm ######## odam.nl */ +/* Updated: 2023/11/05 07:35:27 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -45,7 +45,9 @@ void ft_pickup(t_varlist *vl) while (vl->sprite[i].x) { if ((int)vl->sprite[i].x == (int)vl->posx) + { if ((int)vl->sprite[i].y == (int)vl->posy) + { if (vl->sprite[i].type == 4) { while (vl->sprite[i].x) @@ -56,6 +58,8 @@ void ft_pickup(t_varlist *vl) vl->spritecount--; vl->treasure++; } + } + } i++; } } @@ -97,7 +101,7 @@ int main(int argc, char **argv) if (argc == 2) vl = ft_parseconfigfile(vl, argv[1]); else - ft_errorexit("Please include a .cub file ", "", 2); // we could start with a menu here + ft_errorexit("Please include a .cub file ", "", 2); if (!vl.img || (mlx_image_to_window(vl.mlx, vl.img, 0, 0) < 0)) ft_errorexit("image to window failed ", "main", 1); mlx_key_hook(vl.mlx, &keyhook, &vl); diff --git a/src/parse/parse.c b/src/parse/parse.c index 285ff68..73e63ca 100644 --- a/src/parse/parse.c +++ b/src/parse/parse.c @@ -6,7 +6,7 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 16:48:55 by houtworm #+# #+# */ -/* Updated: 2023/11/05 04:42:46 by houtworm ######## odam.nl */ +/* Updated: 2023/11/05 07:33:11 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -86,7 +86,7 @@ char *ft_checkline(t_varlist *vl, char *line) char *ft_checkline2(t_varlist *vl, char *line) { - if (!ft_strncmp(line, "EA ", 3)) + if (!ft_strncmp(line, "EA ", 3)) { if (!vl->easttext) ft_settexture(vl, line, 2);