fix:mistake on merge port

[Fix] Fixed pos_i on the moves (used on the draw calls)
[Del] Removed trailling debug exit on search_hit func
This commit is contained in:
Baptiste GOULARD 2024-12-01 17:17:17 +01:00
parent aa496d4f5d
commit 0d432c6ba3
2 changed files with 12 additions and 7 deletions

View file

@ -6,13 +6,19 @@
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/28 14:10:44 by bgoulard #+# #+# */
/* Updated: 2024/11/28 14:50:48 by bgoulard ### ########.fr */
/* Updated: 2024/12/01 17:15:27 by bgoulard ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
#include "cub3d_struct.h"
void update_pos_i(t_player *player)
{
player->pos_i.x = (int)player->pos.x;
player->pos_i.y = (int)player->pos.y;
}
void move_straight(t_info *data)
{
t_tile *tile_x;
@ -26,6 +32,7 @@ void move_straight(t_info *data)
(t_ipoint){(int)data->player.pos.x, (int)(data->player.pos.y + data->player.dir.y * MOVE_SPEED)});
if (tile_y->tile_type == EMPTY)
data->player.pos.y += data->player.dir.y * MOVE_SPEED;
update_pos_i(&data->player);
}
void move_backward(t_info *data)
@ -41,6 +48,7 @@ void move_backward(t_info *data)
(t_ipoint){(int)data->player.pos.x, (int)(data->player.pos.y - data->player.dir.y * MOVE_SPEED)});
if (tile_y->tile_type == EMPTY)
data->player.pos.y -= data->player.dir.y * MOVE_SPEED;
update_pos_i(&data->player);
}
void move_left(t_info *data)
@ -59,6 +67,7 @@ void move_left(t_info *data)
(t_ipoint){(int)data->player.pos.x, (int)(data->player.pos.y + pplayer.y * MOVE_SPEED)});
if (tile_y->tile_type == EMPTY)
data->player.pos.y += pplayer.y * MOVE_SPEED;
update_pos_i(&data->player);
}
void move_right(t_info *data)
@ -77,4 +86,5 @@ void move_right(t_info *data)
(t_ipoint){(int)data->player.pos.x, (int)(data->player.pos.y - pplayer.y * MOVE_SPEED)});
if (tile_y->tile_type == EMPTY)
data->player.pos.y -= pplayer.y * MOVE_SPEED;
update_pos_i(&data->player);
}