norme: normed everything

This commit is contained in:
Theo Champion 2025-08-12 16:15:02 +02:00
parent 00e8a73d14
commit dafe94804e
4 changed files with 28 additions and 12 deletions

View file

@ -6,7 +6,7 @@
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/12 15:43:19 by tchampio #+# #+# */
/* Updated: 2025/08/12 15:53:05 by tchampio ### ########.fr */
/* Updated: 2025/08/12 16:14:27 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -28,3 +28,21 @@ t_sprite *create_sprite(t_cub3d_data *data, char *texture,
sprite->image = load_single_texture(data, texture);
return (sprite);
}
t_sprite *place_right_sprite(t_cub3d_data *data, char c, double x, double y)
{
t_sprite *sprite;
if (c == 'M')
sprite = create_sprite(data, "ressources/box.xpm", x + 0.5, y + 0.5);
if (c == 'Q')
sprite = create_sprite(data,
"ressources/revive.xpm", x + 0.5, y + 0.5);
if (c == 'J')
sprite = create_sprite(data,
"ressources/juggernog.xpm", x + 0.5, y + 0.5);
if (c == 'D')
sprite = create_sprite(data,
"ressources/doubletap.xpm", x + 0.5, y + 0.5);
return (sprite);
}

View file

@ -6,7 +6,7 @@
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/12 15:49:25 by tchampio #+# #+# */
/* Updated: 2025/08/12 15:53:12 by tchampio ### ########.fr */
/* Updated: 2025/08/12 16:13:02 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,5 +17,7 @@
t_sprite *create_sprite(t_cub3d_data *data,
char *filename, double x, double y);
t_sprite *place_right_sprite(t_cub3d_data *data, char c, double x,
double y);
#endif // CREATE_SPRITE_H

View file

@ -6,7 +6,7 @@
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/05 12:59:44 by tchampio #+# #+# */
/* Updated: 2025/08/06 14:41:17 by tchampio ### ########.fr */
/* Updated: 2025/08/12 16:12:37 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/31 13:43:05 by kcolin #+# #+# */
/* Updated: 2025/08/12 15:55:51 by tchampio ### ########.fr */
/* Updated: 2025/08/12 16:13:50 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -67,14 +67,10 @@ void place_base_sprites(t_cub3d_data *data, char **map)
x = 0;
while (x < (int)ft_strlen(map[y]))
{
if (map[y][x] == 'M')
data->sprite_list[c++] = create_sprite(data, "ressources/box.xpm", x + 0.5, y + 0.5);
if (map[y][x] == 'Q')
data->sprite_list[c++] = create_sprite(data, "ressources/revive.xpm", x + 0.5, y + 0.5);
if (map[y][x] == 'J')
data->sprite_list[c++] = create_sprite(data, "ressources/juggernog.xpm", x + 0.5, y + 0.5);
if (map[y][x] == 'D')
data->sprite_list[c++] = create_sprite(data, "ressources/doubletap.xpm", x + 0.5, y + 0.5);
if (map[y][x] == 'M' || map[y][x] == 'Q'
|| map[y][x] == 'J' || map[y][x] == 'D')
data->sprite_list[c++] = place_right_sprite(data,
map[y][x], x, y);
x++;
}
y++;