little cleanup

This commit is contained in:
djonker 2023-11-05 07:37:08 +01:00
parent 4932da0ad3
commit bd890b5798
7 changed files with 23 additions and 20 deletions

View File

@ -6,13 +6,13 @@
/* By: djonker <codam@houtworm.net> +#+ */
/* +#+ */
/* 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;

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* 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];

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* 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;

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* 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");

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* 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");
}

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* 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);

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* 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);