mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
dev: changed the c var in place_base_sprites to a counter in data struct
This commit is contained in:
parent
4a70e44697
commit
0d6cc4063a
2 changed files with 6 additions and 7 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/07/17 14:59:37 by kcolin #+# #+# */
|
/* Created: 2025/07/17 14:59:37 by kcolin #+# #+# */
|
||||||
/* Updated: 2025/08/11 11:59:21 by tchampio ### ########.fr */
|
/* Updated: 2025/08/14 21:36:15 by tchampio ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -40,6 +40,7 @@ typedef struct s_cub3d_data
|
||||||
int delta;
|
int delta;
|
||||||
int last_tick;
|
int last_tick;
|
||||||
t_sprite **sprite_list;
|
t_sprite **sprite_list;
|
||||||
|
int sprite_counter;
|
||||||
double zbuffer[WIDTH];
|
double zbuffer[WIDTH];
|
||||||
int sprite_order[MAX_SPRITES];
|
int sprite_order[MAX_SPRITES];
|
||||||
double sprite_distances[MAX_SPRITES];
|
double sprite_distances[MAX_SPRITES];
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/07/31 13:43:05 by kcolin #+# #+# */
|
/* Created: 2025/07/31 13:43:05 by kcolin #+# #+# */
|
||||||
/* Updated: 2025/08/14 21:26:14 by tchampio ### ########.fr */
|
/* Updated: 2025/08/14 21:37:58 by tchampio ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -58,10 +58,8 @@ void place_base_sprites(t_cub3d_data *data, char **map)
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
int x;
|
int x;
|
||||||
int c;
|
|
||||||
|
|
||||||
y = 0;
|
y = 0;
|
||||||
c = 0;
|
|
||||||
while (y < data->map->mapheight)
|
while (y < data->map->mapheight)
|
||||||
{
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
|
|
@ -70,9 +68,9 @@ void place_base_sprites(t_cub3d_data *data, char **map)
|
||||||
if (map[y][x] == 'M' || map[y][x] == 'Q'
|
if (map[y][x] == 'M' || map[y][x] == 'Q'
|
||||||
|| map[y][x] == 'J' || map[y][x] == 'D')
|
|| map[y][x] == 'J' || map[y][x] == 'D')
|
||||||
{
|
{
|
||||||
if (c < MAX_SPRITES)
|
if (data->sprite_counter < MAX_SPRITES)
|
||||||
data->sprite_list[c++] = place_right_sprite(data,
|
data->sprite_list[data->sprite_counter++] =
|
||||||
map[y][x], x, y);
|
place_right_sprite(data, map[y][x], x, y);
|
||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue