added some sprites

This commit is contained in:
djonker 2023-11-05 09:07:07 +01:00
parent b1ba73ae64
commit 28b1b21186
81 changed files with 132 additions and 109 deletions

BIN
assets/decoration/armor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 955 B

After

Width:  |  Height:  |  Size: 955 B

BIN
assets/decoration/hskel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
assets/decoration/plant.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
assets/decoration/table.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
assets/decoration/vase.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 998 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 813 B

After

Width:  |  Height:  |  Size: 813 B

BIN
assets/pickup/biscuits.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

View File

Before

Width:  |  Height:  |  Size: 901 B

After

Width:  |  Height:  |  Size: 901 B

View File

Before

Width:  |  Height:  |  Size: 1018 B

After

Width:  |  Height:  |  Size: 1018 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 889 B

After

Width:  |  Height:  |  Size: 889 B

View File

Before

Width:  |  Height:  |  Size: 871 B

After

Width:  |  Height:  |  Size: 871 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 865 B

After

Width:  |  Height:  |  Size: 865 B

View File

Before

Width:  |  Height:  |  Size: 1008 B

After

Width:  |  Height:  |  Size: 1008 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 994 B

After

Width:  |  Height:  |  Size: 994 B

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1003 B

After

Width:  |  Height:  |  Size: 1003 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 697 B

After

Width:  |  Height:  |  Size: 697 B

View File

Before

Width:  |  Height:  |  Size: 887 B

After

Width:  |  Height:  |  Size: 887 B

View File

Before

Width:  |  Height:  |  Size: 963 B

After

Width:  |  Height:  |  Size: 963 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 963 B

After

Width:  |  Height:  |  Size: 963 B

View File

Before

Width:  |  Height:  |  Size: 816 B

After

Width:  |  Height:  |  Size: 816 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 984 B

After

Width:  |  Height:  |  Size: 984 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

16
cub3d.h
View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 10:46:35 by houtworm #+# #+# */
/* Updated: 2023/11/05 08:05:51 by houtworm ######## odam.nl */
/* Updated: 2023/11/05 08:22:47 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -37,16 +37,10 @@ typedef struct s_varlist
mlx_image_t *tstat;
mlx_image_t *kstat;
mlx_texture_t *temptext;
mlx_texture_t *northtext;
mlx_texture_t *easttext;
mlx_texture_t *southtext;
mlx_texture_t *westtext;
mlx_texture_t *barreltext;
mlx_texture_t *hlamptext;
mlx_texture_t *slamptext;
mlx_texture_t *treasuretext;
mlx_texture_t *endtext;
mlx_texture_t *nazitext;
mlx_texture_t **walltext;
mlx_texture_t **decotext;
mlx_texture_t **picktext;
mlx_texture_t **nazitext;
t_sprite *sprite;
int spritecount;
int w;

View File

@ -1,10 +1,10 @@
C 50,50,50
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
NO ./assets/wall/bluestone.png
EA ./assets/wall/colorstone.png
SO ./assets/wall/redbrick.png
WE ./assets/wall/wood.png
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1G B1 1 1 1 1 1

View File

@ -1,10 +1,10 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
NO ./assets/wall/bluestone.png
EA ./assets/wall/colorstone.png
SO ./assets/wall/redbrick.png
WE ./assets/wall/wood.png
1111111
1 N1

View File

@ -1,10 +1,10 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
NO ./assets/wall/bluestone.png
EA ./assets/wall/colorstone.png
SO ./assets/wall/redbrick.png
WE ./assets/wall/wood.png
1111111
1N 1

View File

@ -1,10 +1,10 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
NO ./assets/wall/bluestone.png
EA ./assets/wall/colorstone.png
SO ./assets/wall/redbrick.png
WE ./assets/wall/wood.png
1111111
1 1

View File

@ -1,10 +1,10 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
NO ./assets/wall/bluestone.png
EA ./assets/wall/colorstone.png
SO ./assets/wall/redbrick.png
WE ./assets/wall/wood.png
1111111
1 1

View File

@ -1,10 +1,10 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
NO ./assets/wall/bluestone.png
EA ./assets/wall/colorstone.png
SO ./assets/wall/redbrick.png
WE ./assets/wall/wood.png
111111111111111111111111
1 B1

View File

@ -1,10 +1,10 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
NO ./assets/wall/bluestone.png
EA ./assets/wall/colorstone.png
SO ./assets/wall/redbrick.png
WE ./assets/wall/wood.png
1111111
1B1B1B1

View File

@ -1,10 +1,10 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
NO ./assets/wall/bluestone.png
EA ./assets/wall/colorstone.png
SO ./assets/wall/redbrick.png
WE ./assets/wall/wood.png
1111111
1CCCCC1

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 16:54:20 by houtworm #+# #+# */
/* Updated: 2023/11/05 08:06:21 by houtworm ######## odam.nl */
/* Updated: 2023/11/05 08:17:39 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -17,16 +17,16 @@ void ft_selecttexture(t_varlist *vl)
if (vl->side == 0)
{
if (vl->raydirx > 0)
vl->temptext = vl->northtext;
vl->temptext = vl->walltext[0];
else
vl->temptext = vl->southtext;
vl->temptext = vl->walltext[2];
}
else
{
if (vl->raydiry > 0)
vl->temptext = vl->westtext;
vl->temptext = vl->walltext[3];
else
vl->temptext = vl->easttext;
vl->temptext = vl->walltext[1];
}
}

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:47:25 by houtworm ######## odam.nl */
/* Updated: 2023/11/05 09:05:31 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -21,16 +21,10 @@ void ft_moveforward(t_varlist *vl, double movespeed)
else
distance = vl->sidedistx - vl->deltadistx;
if (vl->map[(int)(vl->posx + vl->dirx * movespeed)][(int)vl->posy] == '0' && distance > 0.4)
{
vl->posx += vl->dirx * movespeed * vl->run;
vl->posy += vl->diry * movespeed * vl->run;
}
if (vl->map[(int)vl->posx][(int)(vl->posy + vl->diry * movespeed)] == '0' && distance > 0.4)
{
vl->posx += vl->dirx * movespeed * vl->run;
vl->posy += vl->diry * movespeed * vl->run;
}
}
void ft_movebackward(t_varlist *vl, double movespeed)
{
@ -41,16 +35,10 @@ void ft_movebackward(t_varlist *vl, double movespeed)
else
distance = vl->sidedistx - vl->deltadistx;
if (vl->map[(int)(vl->posx - vl->dirx * movespeed)][(int)vl->posy] == '0' && distance > 0.4)
{
vl->posx -= vl->dirx * movespeed * vl->run;
vl->posy -= vl->diry * movespeed * vl->run;
}
if (vl->map[(int)vl->posx][(int)(vl->posy - vl->diry * movespeed)] == '0' && distance > 0.4)
{
vl->posx -= vl->dirx * movespeed * vl->run;
vl->posy -= vl->diry * movespeed * vl->run;
}
}
void ft_moveleft(t_varlist *vl, double movespeed)
{
@ -61,16 +49,10 @@ void ft_moveleft(t_varlist *vl, double movespeed)
else
distance = vl->sidedistx - vl->deltadistx;
if (vl->map[(int)(vl->posx - vl->dirx * movespeed)][(int)vl->posy] == '0' && distance > 0.4)
{
vl->posx -= vl->diry * movespeed * vl->run;
vl->posy += vl->dirx * movespeed * vl->run;
}
if (vl->map[(int)vl->posx][(int)(vl->posy - vl->diry * movespeed)] == '0' && distance > 0.4)
{
vl->posx -= vl->diry * movespeed * vl->run;
vl->posy += vl->dirx * movespeed * vl->run;
}
}
void ft_moveright(t_varlist *vl, double movespeed)
{
@ -81,16 +63,10 @@ void ft_moveright(t_varlist *vl, double movespeed)
else
distance = vl->sidedistx - vl->deltadistx;
if (vl->map[(int)(vl->posx + vl->dirx * movespeed)][(int)vl->posy] == '0' && distance > 0.4)
{
vl->posx += vl->diry * movespeed * vl->run;
vl->posy -= vl->dirx * movespeed * vl->run;
}
if (vl->map[(int)vl->posx][(int)(vl->posy + vl->diry * movespeed)] == '0' && distance > 0.4)
{
vl->posx += vl->diry * movespeed * vl->run;
vl->posy -= vl->dirx * movespeed * vl->run;
}
}
void ft_processmove(t_varlist *vl, double movespeed)
{

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 14:13:07 by houtworm #+# #+# */
/* Updated: 2023/11/05 07:56:34 by houtworm ######## odam.nl */
/* Updated: 2023/11/05 08:40:06 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -14,10 +14,33 @@
void ft_cleanup(t_varlist *vl)
{
mlx_delete_texture(vl->northtext);
mlx_delete_texture(vl->easttext);
mlx_delete_texture(vl->southtext);
mlx_delete_texture(vl->westtext);
mlx_delete_texture(vl->barreltext);
mlx_delete_texture(vl->walltext[0]);
mlx_delete_texture(vl->walltext[1]);
mlx_delete_texture(vl->walltext[2]);
mlx_delete_texture(vl->walltext[3]);
mlx_delete_texture(vl->decotext[0]);
mlx_delete_texture(vl->decotext[1]);
mlx_delete_texture(vl->decotext[2]);
mlx_delete_texture(vl->decotext[3]);
mlx_delete_texture(vl->decotext[4]);
mlx_delete_texture(vl->decotext[5]);
mlx_delete_texture(vl->decotext[6]);
mlx_delete_texture(vl->decotext[7]);
mlx_delete_texture(vl->decotext[8]);
mlx_delete_texture(vl->decotext[9]);
mlx_delete_texture(vl->decotext[10]);
mlx_delete_texture(vl->decotext[11]);
mlx_delete_texture(vl->picktext[0]);
mlx_delete_texture(vl->picktext[1]);
mlx_delete_texture(vl->picktext[2]);
mlx_delete_texture(vl->picktext[3]);
mlx_delete_texture(vl->picktext[4]);
mlx_delete_texture(vl->picktext[5]);
mlx_delete_texture(vl->picktext[6]);
mlx_delete_texture(vl->picktext[7]);
mlx_delete_texture(vl->picktext[8]);
mlx_delete_texture(vl->picktext[9]);
mlx_delete_texture(vl->picktext[10]);
mlx_delete_texture(vl->picktext[11]);
mlx_delete_image(vl->mlx, vl->img);
}

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 16:49:12 by houtworm #+# #+# */
/* Updated: 2023/11/05 07:51:11 by houtworm ######## odam.nl */
/* Updated: 2023/11/05 08:59:03 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -14,20 +14,42 @@
void ft_initsprites(t_varlist *vl)
{
vl->barreltext = mlx_load_png("./assets/barrel.png");
vl->hlamptext = mlx_load_png("./assets/hlamp.png");
vl->slamptext = mlx_load_png("./assets/slamp.png");
vl->endtext = mlx_load_png("./assets/bkey.png");
vl->decotext = ft_calloc(4096, 8);
vl->decotext[0] = mlx_load_png("./assets/decoration/barrel.png");
vl->decotext[1] = mlx_load_png("./assets/decoration/gbarrel.png");
vl->decotext[2] = mlx_load_png("./assets/decoration/slamp.png");
vl->decotext[3] = mlx_load_png("./assets/decoration/armor.png");
vl->decotext[4] = mlx_load_png("./assets/decoration/pillar.png");
vl->decotext[5] = mlx_load_png("./assets/decoration/plant.png");
vl->decotext[6] = mlx_load_png("./assets/decoration/vase.png");
vl->decotext[7] = mlx_load_png("./assets/decoration/faucet.png");
vl->decotext[8] = mlx_load_png("./assets/decoration/table.png");
vl->decotext[9] = mlx_load_png("./assets/decoration/hskel.png");
vl->decotext[10] = mlx_load_png("./assets/decoration/hlamp.png");
vl->decotext[11] = mlx_load_png("./assets/decoration/chandel.png");
}
void ft_initpickups(t_varlist *vl)
{
vl->treasuretext = mlx_load_png("./assets/treasure3.png");
vl->picktext = ft_calloc(4096, 8);
vl->picktext[0] = mlx_load_png("./assets/pickup/treasure1.png");
vl->picktext[1] = mlx_load_png("./assets/pickup/treasure2.png");
vl->picktext[2] = mlx_load_png("./assets/pickup/treasure3.png");
vl->picktext[3] = mlx_load_png("./assets/pickup/treasure4.png");
vl->picktext[4] = mlx_load_png("./assets/pickup/hpkit.png");
vl->picktext[5] = mlx_load_png("./assets/pickup/food.png");
vl->picktext[6] = mlx_load_png("./assets/pickup/biscuits.png");
vl->picktext[7] = mlx_load_png("./assets/pickup/gkey.png");
vl->picktext[8] = mlx_load_png("./assets/pickup/bkey.png");
vl->picktext[9] = mlx_load_png("./assets/pickup/mgun.png");
vl->picktext[10] = mlx_load_png("./assets/pickup/ggun.png");
vl->picktext[11] = mlx_load_png("./assets/pickup/ammo.png");
}
void ft_initenemies(t_varlist *vl)
{
vl->nazitext = mlx_load_png("./assets/guard1.png");
vl->nazitext = ft_calloc(4096, 8);
vl->nazitext[0] = mlx_load_png("./assets/nazi/guard/guard1.png");
}
void ft_initmainstuff(t_varlist *vl)
@ -36,6 +58,7 @@ void ft_initmainstuff(t_varlist *vl)
vl->h = 600;
vl->sprite = ft_calloc(4096, 8);
vl->distance = ft_calloc(4096, 8);
vl->walltext = ft_calloc(4096, 8);
vl->spritecount = 0;
vl->vaim = 0;
vl->jump = 0;
@ -47,10 +70,10 @@ void ft_initmainstuff(t_varlist *vl)
vl->ggun = 0;
vl->ccolor = 0;
vl->fcolor = 0;
vl->northtext = NULL;
vl->easttext = NULL;
vl->southtext = NULL;
vl->westtext = NULL;
vl->walltext[0] = NULL;
vl->walltext[1] = NULL;
vl->walltext[2] = NULL;
vl->walltext[3] = NULL;
}
t_varlist initgame(void)

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 16:48:55 by houtworm #+# #+# */
/* Updated: 2023/11/05 07:33:11 by houtworm ######## odam.nl */
/* Updated: 2023/11/05 08:19:52 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -20,13 +20,13 @@ int ft_settexture(t_varlist *vl, char *line, int direction)
while (line[i] != '.')
i++;
if (direction == 1)
vl->northtext = mlx_load_png(&line[i]);
vl->walltext[0] = mlx_load_png(&line[i]);
if (direction == 2)
vl->easttext = mlx_load_png(&line[i]);
vl->walltext[1] = mlx_load_png(&line[i]);
if (direction == 3)
vl->southtext = mlx_load_png(&line[i]);
vl->walltext[2] = mlx_load_png(&line[i]);
if (direction == 4)
vl->westtext = mlx_load_png(&line[i]);
vl->walltext[3] = mlx_load_png(&line[i]);
return (0);
}
@ -76,7 +76,7 @@ char *ft_checkline(t_varlist *vl, char *line)
}
else if (!ft_strncmp(line, "NO ", 3))
{
if (!vl->northtext)
if (!vl->walltext[0])
ft_settexture(vl, line, 1);
else
return (" north texture");
@ -88,21 +88,21 @@ char *ft_checkline2(t_varlist *vl, char *line)
{
if (!ft_strncmp(line, "EA ", 3))
{
if (!vl->easttext)
if (!vl->walltext[1])
ft_settexture(vl, line, 2);
else
return (" east texture");
}
else if (!ft_strncmp(line, "SO ", 3))
{
if (!vl->southtext)
if (!vl->walltext[2])
ft_settexture(vl, line, 3);
else
return (" south texture");
}
else if (!ft_strncmp(line, "WE ", 3))
{
if (!vl->westtext)
if (!vl->walltext[3])
ft_settexture(vl, line, 4);
else
return (" west texture");
@ -126,7 +126,7 @@ t_varlist ft_parseconfigfile(t_varlist vl, char *filename)
error = ft_checkline2(&vl, line);
if (error)
ft_errorexit("Double config declaration in .cub file", error, 1);
if (vl.ccolor && vl.fcolor && vl.northtext && vl.easttext && vl.southtext && vl.westtext)
if (vl.ccolor && vl.fcolor && vl.walltext[0] && vl.walltext[1] && vl.walltext[2] && vl.walltext[3])
{
vl.map = ft_getmap(&vl, fd);
break ;

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 16:54:20 by houtworm #+# #+# */
/* Updated: 2023/11/05 08:06:48 by houtworm ######## odam.nl */
/* Updated: 2023/11/05 08:44:20 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -17,17 +17,17 @@ mlx_texture_t *ft_selectsprite(t_varlist *vl, int type)
mlx_texture_t *sprite;
if (type == 1)
sprite = vl->barreltext;
sprite = vl->decotext[0];
else if (type == 2)
sprite = vl->slamptext;
sprite = vl->decotext[2];
else if (type == 3)
sprite = vl->hlamptext;
sprite = vl->decotext[10];
else if (type == 4)
sprite = vl->treasuretext;
sprite = vl->picktext[0];
else if (type == 5)
sprite = vl->endtext;
sprite = vl->picktext[1];
else if (type == 6)
sprite = vl->nazitext;
sprite = vl->nazitext[0];
else
ft_errorexit("what?", "what?", 1);
return (sprite);

View File

@ -6,13 +6,13 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 14:13:07 by houtworm #+# #+# */
/* Updated: 2023/11/05 07:54:44 by houtworm ######## odam.nl */
/* Updated: 2023/11/05 08:20:00 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../../cub3d.h"
void ft_pickup(t_varlist *vl)
void ft_pickuptreasure(t_varlist *vl)
{
int i;
@ -38,3 +38,10 @@ void ft_pickup(t_varlist *vl)
i++;
}
}
void ft_pickup(t_varlist *vl)
{
ft_pickuptreasure(vl);
/*ft_pickuphealth(vl);*/
/*ft_pickupweapon(vl);*/
}