mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
Compare commits
4 commits
fe665eaa4e
...
f407f5b7ce
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f407f5b7ce | ||
|
|
80150ce24d | ||
|
|
baccf93ac3 | ||
|
|
416b7a833d |
8 changed files with 6718 additions and 11 deletions
6668
ressources/weapon.xpm
Normal file
6668
ressources/weapon.xpm
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:59:37 by kcolin #+# #+# */
|
||||
/* Updated: 2025/09/03 18:22:15 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/05 20:26:30 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -34,6 +34,7 @@ typedef struct s_cub3d_data
|
|||
t_img_data *perk_logos[3];
|
||||
t_img_data *tally_marks[5];
|
||||
t_img_data *round_figures[10];
|
||||
t_img_data *gun;
|
||||
t_mapdata *map;
|
||||
t_player player;
|
||||
t_keypresses keypresses;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:20:00 by kcolin #+# #+# */
|
||||
/* Updated: 2025/08/05 15:20:47 by kcolin ### ########.fr */
|
||||
/* Updated: 2025/09/08 13:58:59 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -77,8 +77,6 @@ void draw_map(t_mapdata *map, t_player *player, t_img_data *data)
|
|||
{
|
||||
if (map->map[i][j] == '1')
|
||||
draw_2d_wall(map->f_color, data, MAP_SIZE * j, MAP_SIZE * i);
|
||||
else if (map->map[i][j] == 'Z' || map->map[i][j] == 'z')
|
||||
draw_2d_wall(0x0008D9D6, data, MAP_SIZE * j, MAP_SIZE * i);
|
||||
else if (map->map[i][j] == 'D' || map->map[i][j] == 'd')
|
||||
draw_2d_wall(0x00FF2E63, data, MAP_SIZE * j, MAP_SIZE * i);
|
||||
else if (map->map[i][j] == 's')
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/09/03 17:02:08 by tchampio #+# #+# */
|
||||
/* Updated: 2025/09/03 18:24:18 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/05 20:26:20 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -92,4 +92,5 @@ void load_textures(t_cub3d_data *data)
|
|||
load_points_textures(data);
|
||||
load_perk_logos(data);
|
||||
load_round_indicators(data);
|
||||
data->gun = load_hud_texture(data, "ressources/weapon.xpm");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
|
||||
/* Updated: 2025/09/03 18:31:54 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/08 13:56:27 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -64,9 +64,9 @@ void draw_perks(t_cub3d_data *data)
|
|||
{
|
||||
if (data->player.perk_order[i] == REVIVE)
|
||||
matrix_image_put(data, data->perk_logos[1], perk_pos, HEIGHT - 200);
|
||||
if (data->player.perk_order[i] == JUGGERNOG)
|
||||
else if (data->player.perk_order[i] == JUGGERNOG)
|
||||
matrix_image_put(data, data->perk_logos[0], perk_pos, HEIGHT - 200);
|
||||
if (data->player.perk_order[i] == DOUBLETAP)
|
||||
else if (data->player.perk_order[i] == DOUBLETAP)
|
||||
matrix_image_put(data, data->perk_logos[2], perk_pos, HEIGHT - 200);
|
||||
perk_pos += 50;
|
||||
}
|
||||
|
|
@ -102,6 +102,7 @@ void create_hud(t_cub3d_data *data)
|
|||
// draw round
|
||||
draw_round(data);
|
||||
// draw weapon
|
||||
matrix_image_put(data, data->gun, WIDTH / 2, HEIGHT - 175);
|
||||
// draw map
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/08/18 13:05:31 by kcolin #+# #+# */
|
||||
/* Updated: 2025/08/18 13:05:31 by kcolin ### ########.fr */
|
||||
/* Updated: 2025/09/08 17:02:43 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,6 +14,15 @@
|
|||
#include "../../mlx/mlx.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void destroy_texture(t_cub3d_data *data, t_img_data *data_img)
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
mlx_destroy_image(data->mlx, data_img->img);
|
||||
}
|
||||
free(data_img);
|
||||
}
|
||||
|
||||
void destroy_textures(t_cub3d_data *data)
|
||||
{
|
||||
if (data->no_texture)
|
||||
|
|
@ -45,3 +54,30 @@ void destroy_sprites(t_cub3d_data *data)
|
|||
sprite++;
|
||||
}
|
||||
}
|
||||
|
||||
void destroy_hud_textures(t_cub3d_data *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (i < 10)
|
||||
{
|
||||
destroy_texture(data, data->point_figures[i++]);
|
||||
}
|
||||
i = 0;
|
||||
while (i < 10)
|
||||
{
|
||||
destroy_texture(data, data->round_figures[i++]);
|
||||
}
|
||||
i = 0;
|
||||
while (i < 5)
|
||||
{
|
||||
destroy_texture(data, data->tally_marks[i++]);
|
||||
}
|
||||
i = 0;
|
||||
while (i < 3)
|
||||
{
|
||||
destroy_texture(data, data->perk_logos[i++]);
|
||||
}
|
||||
destroy_texture(data, data->gun);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/08/11 12:07:48 by tchampio #+# #+# */
|
||||
/* Updated: 2025/08/11 12:10:21 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/08 14:15:25 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -17,5 +17,6 @@
|
|||
|
||||
void destroy_textures(t_cub3d_data *data);
|
||||
void destroy_sprites(t_cub3d_data *data);
|
||||
void destroy_hud_textures(t_cub3d_data *data);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 13:59:27 by kcolin #+# #+# */
|
||||
/* Updated: 2025/08/12 15:38:45 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/08 14:15:58 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -67,6 +67,7 @@ int destroy(t_cub3d_data *data, int exit_code)
|
|||
if (data->img_data)
|
||||
mlx_destroy_image(data->mlx, data->img_data->img);
|
||||
destroy_textures(data);
|
||||
destroy_hud_textures(data);
|
||||
destroy_sprites(data);
|
||||
free(data->img_data);
|
||||
if (data->mlx)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue