player rotates and moves, rays for raycasting on map

This commit is contained in:
Hugo LAMY
2022-04-18 18:27:16 +02:00
parent 00b3612c16
commit 01eb2255d2
21 changed files with 689 additions and 138 deletions

View File

@@ -0,0 +1,30 @@
#include "cube3d.h"
int is_wall(t_game *game, int cell_x, int cell_y)
{
if (cell_x < 0 || cell_y < 0)
return (1);
if (cell_x > game->map_size_x || cell_y > game->map_size_y)
return (1);
if (game->map[cell_y][cell_x] != '0')
return (1);
return (0);
}
int plr_out_limits(t_game *game, int x, int y)
{
int xmax;
int ymax;
int cell_x;
int cell_y;
xmax = game->sizel / (game->bpp / 8);
ymax = game->win_size_y;
cell_x = x / game->cell;
cell_y = y / game->cell;
if (is_wall(game, cell_x, cell_y))
return (1);
if (x < 0 || y < 0 || x > xmax || y > ymax)
return (1);
return (0);
}