mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
fix: Fixed door closing and stucking player if on the same tile
This commit is contained in:
parent
437b76a68c
commit
efe33ec6c5
1 changed files with 6 additions and 1 deletions
|
|
@ -14,6 +14,11 @@
|
|||
#include "../../libft/includes/libft.h"
|
||||
#include "../player/pay.h"
|
||||
|
||||
bool check_door_pos(t_cub3d_data *data)
|
||||
{
|
||||
return (data->map->map[(int)data->player.y][(int)data->player.x] == 'i');
|
||||
}
|
||||
|
||||
void handle_door_ray(t_ray *ray, t_cub3d_data *data)
|
||||
{
|
||||
char current_tile;
|
||||
|
|
@ -31,7 +36,7 @@ void handle_door_ray(t_ray *ray, t_cub3d_data *data)
|
|||
data->map->map[ray->map_y][ray->map_x] = 'i';
|
||||
else if (current_tile == 'P' && pay(data, data->door_amount, true))
|
||||
data->map->map[ray->map_y][ray->map_x] = '0';
|
||||
else if (current_tile == 'i')
|
||||
else if (current_tile == 'i' && !check_door_pos(data))
|
||||
data->map->map[ray->map_y][ray->map_x] = 'd';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue