better struct and files organization, and still only half raycast on map but no view created

This commit is contained in:
hugogogo
2022-04-22 17:38:29 +02:00
parent 00c9dfd6b8
commit fac1f78230
17 changed files with 602 additions and 505 deletions

View File

@@ -4,9 +4,9 @@ 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)
if (cell_x > game->map.size_x || cell_y > game->map.size_y)
return (1);
if (game->map[cell_y][cell_x] != '0')
if (game->map.content[cell_y][cell_x] != '0')
return (1);
return (0);
}
@@ -18,10 +18,10 @@ int plr_out_limits(t_game *game, int x, int y)
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;
xmax = game->map_img.sizel / (game->map_img.bpp / 8);
ymax = game->map_win.size_y;
cell_x = x / CELL;
cell_y = y / CELL;
if (is_wall(game, cell_x, cell_y))
return (1);
if (x < 0 || y < 0 || x > xmax || y > ymax)