little cleanup
This commit is contained in:
parent
4932da0ad3
commit
bd890b5798
@ -6,13 +6,13 @@
|
|||||||
/* By: djonker <codam@houtworm.net> +#+ */
|
/* By: djonker <codam@houtworm.net> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2023/10/27 14:36:42 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"
|
#include "../../cub3d.h"
|
||||||
|
|
||||||
int ft_getstepx(t_varlist *vl, int mapx)
|
int ft_getstepx(t_varlist *vl, int mapx)
|
||||||
{
|
{
|
||||||
int stepx;
|
int stepx;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ int ft_getstepx(t_varlist *vl, int mapx)
|
|||||||
return (stepx);
|
return (stepx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_getstepy(t_varlist *vl, int mapy)
|
int ft_getstepy(t_varlist *vl, int mapy)
|
||||||
{
|
{
|
||||||
int stepy;
|
int stepy;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: houtworm <codam@houtworm.net> +#+ */
|
/* By: houtworm <codam@houtworm.net> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2023/10/26 16:54:20 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)
|
uint32_t ft_gettextcolor(t_varlist *vl, int texty, int textx)
|
||||||
{
|
{
|
||||||
uint8_t *texel;
|
uint8_t *texel;
|
||||||
uint32_t color;
|
uint32_t color;
|
||||||
|
|
||||||
texel = &vl->curtext->pixels[(vl->curtext->width * texty + textx) * 4];
|
texel = &vl->curtext->pixels[(vl->curtext->width * texty + textx) * 4];
|
||||||
color = texel[0] << 24 | texel[1] << 16 | texel[2] << 8 | texel[3];
|
color = texel[0] << 24 | texel[1] << 16 | texel[2] << 8 | texel[3];
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: houtworm <codam@houtworm.net> +#+ */
|
/* By: houtworm <codam@houtworm.net> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2023/10/26 16:54:20 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 ft_drawwall(int x, t_varlist *vl, int drawstart, int drawend, int y)
|
||||||
{
|
{
|
||||||
int textx;
|
int textx;
|
||||||
double step;
|
double step;
|
||||||
double textpos;
|
double textpos;
|
||||||
int texty;
|
int texty;
|
||||||
uint32_t color;
|
uint32_t color;
|
||||||
|
|
||||||
textx = ft_gettextx(vl);
|
textx = ft_gettextx(vl);
|
||||||
step = 64.0 / vl->lineheight;
|
step = 64.0 / vl->lineheight;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: houtworm <codam@houtworm.net> +#+ */
|
/* By: houtworm <codam@houtworm.net> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2023/10/26 16:50:23 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;
|
t_varlist *vl;
|
||||||
|
|
||||||
vl = param;
|
vl = param;
|
||||||
vl->w =vl->w;
|
vl->w = vl->w;
|
||||||
if (mlx_is_key_down(vl->mlx, MLX_KEY_ESCAPE))
|
if (mlx_is_key_down(vl->mlx, MLX_KEY_ESCAPE))
|
||||||
{
|
{
|
||||||
ft_putendl("escape is pressed");
|
ft_putendl("escape is pressed");
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: houtworm <codam@houtworm.net> +#+ */
|
/* By: houtworm <codam@houtworm.net> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2023/10/26 16:50:23 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)
|
if (ydelta < 0)
|
||||||
ft_putendl("Next Weapon");
|
ft_putendl("Next Weapon");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: houtworm <codam@houtworm.net> +#+ */
|
/* By: houtworm <codam@houtworm.net> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2023/10/26 14:13:07 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)
|
while (vl->sprite[i].x)
|
||||||
{
|
{
|
||||||
if ((int)vl->sprite[i].x == (int)vl->posx)
|
if ((int)vl->sprite[i].x == (int)vl->posx)
|
||||||
|
{
|
||||||
if ((int)vl->sprite[i].y == (int)vl->posy)
|
if ((int)vl->sprite[i].y == (int)vl->posy)
|
||||||
|
{
|
||||||
if (vl->sprite[i].type == 4)
|
if (vl->sprite[i].type == 4)
|
||||||
{
|
{
|
||||||
while (vl->sprite[i].x)
|
while (vl->sprite[i].x)
|
||||||
@ -56,6 +58,8 @@ void ft_pickup(t_varlist *vl)
|
|||||||
vl->spritecount--;
|
vl->spritecount--;
|
||||||
vl->treasure++;
|
vl->treasure++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +101,7 @@ int main(int argc, char **argv)
|
|||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
vl = ft_parseconfigfile(vl, argv[1]);
|
vl = ft_parseconfigfile(vl, argv[1]);
|
||||||
else
|
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))
|
if (!vl.img || (mlx_image_to_window(vl.mlx, vl.img, 0, 0) < 0))
|
||||||
ft_errorexit("image to window failed ", "main", 1);
|
ft_errorexit("image to window failed ", "main", 1);
|
||||||
mlx_key_hook(vl.mlx, &keyhook, &vl);
|
mlx_key_hook(vl.mlx, &keyhook, &vl);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: houtworm <codam@houtworm.net> +#+ */
|
/* By: houtworm <codam@houtworm.net> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2023/10/26 16:48:55 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)
|
char *ft_checkline2(t_varlist *vl, char *line)
|
||||||
{
|
{
|
||||||
if (!ft_strncmp(line, "EA ", 3))
|
if (!ft_strncmp(line, "EA ", 3))
|
||||||
{
|
{
|
||||||
if (!vl->easttext)
|
if (!vl->easttext)
|
||||||
ft_settexture(vl, line, 2);
|
ft_settexture(vl, line, 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user