Compare commits
16 Commits
hugo_clean
...
hugo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6640c9e6d3 | ||
|
|
285f6f3c55 | ||
|
|
5e8afcb245 | ||
|
|
4f0e5fcd00 | ||
|
|
3501a20abb | ||
|
|
a0f32dee98 | ||
|
|
f3ced10b82 | ||
|
|
be650f085e | ||
|
|
791110c88c | ||
|
|
ef4cc1a996 | ||
|
|
0d9e5879c0 | ||
|
|
03f61d989b | ||
|
|
a11ea35ac1 | ||
|
|
bb3a9db930 | ||
|
|
9359e87f6f | ||
|
|
e9b0dd7ec9 |
@@ -1,3 +1,8 @@
|
|||||||
|
# todo
|
||||||
|
|
||||||
|
- resolve view buble
|
||||||
|
- add textures
|
||||||
|
|
||||||
# ressources
|
# ressources
|
||||||
|
|
||||||
- [tuto mlx](https://harm-smits.github.io/42docs/libs/minilibx/getting_started.html)
|
- [tuto mlx](https://harm-smits.github.io/42docs/libs/minilibx/getting_started.html)
|
||||||
|
|||||||
@@ -17,6 +17,12 @@
|
|||||||
# define SCREEN_FOCAL 90
|
# define SCREEN_FOCAL 90
|
||||||
/* size of a cell on the map */
|
/* size of a cell on the map */
|
||||||
# define CELL 20
|
# define CELL 20
|
||||||
|
/* horizon fr perspectiv */
|
||||||
|
# define HORIZON 700
|
||||||
|
|
||||||
|
/*
|
||||||
|
* keys macro
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* keys macro
|
* keys macro
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ void rotate_double(t_plr *plr, t_d_coord *coord);
|
|||||||
void plr_turn_right(t_plr *plr);
|
void plr_turn_right(t_plr *plr);
|
||||||
void plr_turn_left(t_plr *plr);
|
void plr_turn_left(t_plr *plr);
|
||||||
// player_limits.c
|
// player_limits.c
|
||||||
int plr_out_limits(t_game *game, int x, int y);
|
|
||||||
int is_wall(t_game *game, int cell_x, int cell_y);
|
int is_wall(t_game *game, int cell_x, int cell_y);
|
||||||
|
int plr_out_limits(t_game *game, int x, int y);
|
||||||
|
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
// SRC/DRAW
|
// SRC/DRAW
|
||||||
|
|||||||
@@ -32,12 +32,13 @@ typedef struct s_vec
|
|||||||
|
|
||||||
typedef struct s_rcast
|
typedef struct s_rcast
|
||||||
{
|
{
|
||||||
t_vec screen_dist;
|
|
||||||
t_vec screen_size;
|
t_vec screen_size;
|
||||||
t_vec ray;
|
t_vec ray;
|
||||||
t_vec wall;
|
t_vec wall;
|
||||||
|
int hor;
|
||||||
int screen_width;
|
int screen_width;
|
||||||
int screen_height;
|
int screen_height;
|
||||||
|
int screen_dist;
|
||||||
int cell;
|
int cell;
|
||||||
int cell_x;
|
int cell_x;
|
||||||
int cell_y;
|
int cell_y;
|
||||||
@@ -55,6 +56,7 @@ typedef struct s_rcast
|
|||||||
int ray_step_y;
|
int ray_step_y;
|
||||||
int is_x;
|
int is_x;
|
||||||
int ray_nb;
|
int ray_nb;
|
||||||
|
int ray_len;
|
||||||
double ratio;
|
double ratio;
|
||||||
} t_rcast;
|
} t_rcast;
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ void draw_line(t_img *img, t_vec *vec, int color)
|
|||||||
draw_square(game, pos, 0x00999900, 0x00330033, cell, 1);
|
draw_square(game, pos, 0x00999900, 0x00330033, cell, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
static void draw_screen(t_game *game, t_rcast *rcast)
|
static void draw_screen(t_game *game, t_rcast *rcast)
|
||||||
{
|
{
|
||||||
t_vec screen;
|
t_vec screen;
|
||||||
@@ -122,6 +123,7 @@ void draw_line(t_img *img, t_vec *vec, int color)
|
|||||||
rotate(&(game->plr), &(screen.end));
|
rotate(&(game->plr), &(screen.end));
|
||||||
draw_line(&game->map_img, &screen, 0x00FFFFFF);
|
draw_line(&game->map_img, &screen, 0x00FFFFFF);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// tmp end
|
// tmp end
|
||||||
|
|
||||||
void draw(t_game *game)
|
void draw(t_game *game)
|
||||||
@@ -133,7 +135,7 @@ void draw(t_game *game)
|
|||||||
raycast(game, &(game->rcast));
|
raycast(game, &(game->rcast));
|
||||||
|
|
||||||
// tmp, to draw map
|
// tmp, to draw map
|
||||||
draw_screen(game, &(game->rcast));
|
// draw_screen(game, &(game->rcast));
|
||||||
mlx_put_image_to_window(game->mlx_ptr, game->map_win.ptr, game->map_img.ptr, 0, SCREEN_HEIGHT);
|
mlx_put_image_to_window(game->mlx_ptr, game->map_win.ptr, game->map_img.ptr, 0, SCREEN_HEIGHT);
|
||||||
// tmp end
|
// tmp end
|
||||||
|
|
||||||
|
|||||||
@@ -1,48 +1,62 @@
|
|||||||
#include "cube3d.h"
|
#include "cube3d.h"
|
||||||
|
|
||||||
static void init_raycast(t_rcast *rcast, t_vec *ray)
|
static void init_ray_params(t_rcast *rcast, t_vec *ray)
|
||||||
{
|
{
|
||||||
rcast->is_x = 0;
|
|
||||||
// ray sign
|
|
||||||
rcast->ray_sign_x = 1;
|
rcast->ray_sign_x = 1;
|
||||||
if (ray->start.x < ray->end.x)
|
if (ray->start.x < ray->end.x)
|
||||||
rcast->ray_sign_x = -1;
|
rcast->ray_sign_x = -1;
|
||||||
rcast->ray_sign_y = 1;
|
rcast->ray_sign_y = 1;
|
||||||
if (ray->start.y < ray->end.y)
|
if (ray->start.y < ray->end.y)
|
||||||
rcast->ray_sign_y = -1;
|
rcast->ray_sign_y = -1;
|
||||||
// cell position of ray
|
|
||||||
rcast->cell_x = ray->start.x / rcast->cell;
|
rcast->cell_x = ray->start.x / rcast->cell;
|
||||||
rcast->cell_y = ray->start.y / rcast->cell;
|
rcast->cell_y = ray->start.y / rcast->cell;
|
||||||
// slope of ray
|
|
||||||
rcast->slope_x = ray->end.x - ray->start.x;
|
rcast->slope_x = ray->end.x - ray->start.x;
|
||||||
rcast->slope_y = ray->end.y - ray->start.y;
|
rcast->slope_y = ray->end.y - ray->start.y;
|
||||||
// direction of next cell
|
|
||||||
rcast->next_cell_x = -rcast->ray_sign_x;
|
rcast->next_cell_x = -rcast->ray_sign_x;
|
||||||
rcast->next_cell_y = -rcast->ray_sign_y;
|
rcast->next_cell_y = -rcast->ray_sign_y;
|
||||||
// ray steps in both axis
|
|
||||||
rcast->ray_step_x = ft_abs(rcast->cell * rcast->slope_y);
|
|
||||||
rcast->ray_step_y = ft_abs(rcast->cell * rcast->slope_x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_first_step(t_rcast *rcast, t_vec *ray)
|
static void init_first_step(t_rcast *rcast, t_vec *ray)
|
||||||
{
|
{
|
||||||
rcast->first_next_x = ray->start.x % rcast->cell;
|
rcast->first_next_x = 0;
|
||||||
if (rcast->first_next_x && rcast->ray_sign_x < 0)
|
if (rcast->slope_x)
|
||||||
rcast->first_next_x = rcast->cell - rcast->first_next_x;
|
rcast->first_next_x = ray->start.x % rcast->cell;
|
||||||
if (!rcast->first_next_x && rcast->ray_sign_x < 0)
|
if (rcast->ray_sign_x < 0)
|
||||||
rcast->first_next_x = rcast->cell;
|
rcast->first_next_x -= rcast->cell;
|
||||||
rcast->first_next_y = ray->start.y % rcast->cell;
|
rcast->first_next_y = 0;
|
||||||
if (rcast->first_next_y && rcast->ray_sign_y < 0)
|
if (rcast->slope_y)
|
||||||
rcast->first_next_y = rcast->cell - rcast->first_next_y;
|
rcast->first_next_y = ray->start.y % rcast->cell;
|
||||||
if (!rcast->first_next_y && rcast->ray_sign_y < 0)
|
if (rcast->ray_sign_y < 0)
|
||||||
rcast->first_next_y = rcast->cell;
|
rcast->first_next_y -= rcast->cell;
|
||||||
rcast->next_x = ft_abs(rcast->first_next_x * rcast->slope_y);
|
rcast->next_x = ft_abs(rcast->first_next_x);
|
||||||
rcast->next_y = ft_abs(rcast->first_next_y * rcast->slope_x);
|
if (rcast->slope_y != 0)
|
||||||
|
rcast->next_x *= ft_abs(rcast->slope_y);
|
||||||
|
rcast->next_y = ft_abs(rcast->first_next_y);
|
||||||
|
if (rcast->slope_x != 0)
|
||||||
|
rcast->next_y *= ft_abs(rcast->slope_x);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void init_steps(t_rcast *rcast)
|
||||||
|
{
|
||||||
|
rcast->ray_step_x = 0;
|
||||||
|
if (rcast->slope_x)
|
||||||
|
{
|
||||||
|
rcast->ray_step_x = ft_abs(rcast->cell);
|
||||||
|
if (rcast->slope_y)
|
||||||
|
rcast->ray_step_x *= ft_abs(rcast->slope_y);
|
||||||
|
}
|
||||||
|
rcast->ray_step_y = 0;
|
||||||
|
if (rcast->slope_y)
|
||||||
|
{
|
||||||
|
rcast->ray_step_y = ft_abs(rcast->cell);
|
||||||
|
if (rcast->slope_x)
|
||||||
|
rcast->ray_step_y *= ft_abs(rcast->slope_x);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void next_cell(t_rcast *rcast)
|
static void next_cell(t_rcast *rcast)
|
||||||
{
|
{
|
||||||
if (rcast->next_x > rcast->next_y)
|
if (!rcast->slope_x || (rcast->next_x > rcast->next_y && rcast->slope_y))
|
||||||
{
|
{
|
||||||
rcast->cell_y += rcast->next_cell_y;
|
rcast->cell_y += rcast->next_cell_y;
|
||||||
rcast->next_y += rcast->ray_step_y;
|
rcast->next_y += rcast->ray_step_y;
|
||||||
@@ -64,8 +78,9 @@ void ray_intersect(t_game *game, t_rcast *rcast, t_vec *ray)
|
|||||||
ray->end.x += rcast->ray_nb;
|
ray->end.x += rcast->ray_nb;
|
||||||
ray->end.y = rcast->ray.end.y + game->plr.pos.y;
|
ray->end.y = rcast->ray.end.y + game->plr.pos.y;
|
||||||
rotate(&(game->plr), &(ray->end));
|
rotate(&(game->plr), &(ray->end));
|
||||||
init_raycast(rcast, ray);
|
init_ray_params(rcast, ray);
|
||||||
init_first_step(rcast, ray);
|
init_first_step(rcast, ray);
|
||||||
|
init_steps(rcast);
|
||||||
while (!is_wall(game, rcast->cell_x, rcast->cell_y))
|
while (!is_wall(game, rcast->cell_x, rcast->cell_y))
|
||||||
next_cell(rcast);
|
next_cell(rcast);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,44 +30,70 @@
|
|||||||
}
|
}
|
||||||
// tmp end
|
// tmp end
|
||||||
|
|
||||||
static void calcul_wall(t_rcast *rcast)
|
static void wall_length(t_rcast *rcast)
|
||||||
{
|
{
|
||||||
int height;
|
int len;
|
||||||
|
|
||||||
rcast->wall.start.x = rcast->ray_nb;
|
rcast->wall.start.x = rcast->ray_nb;
|
||||||
rcast->wall.end.x = rcast->ray_nb;
|
rcast->wall.end.x = rcast->ray_nb;
|
||||||
if (rcast->is_x == 1 && rcast->slope_y != 0)
|
// len = sqrt(pow(ray->end.x - ray->start.x, 2) + pow(ray->end.y - ray->start.y, 2));
|
||||||
height = (rcast->next_x - rcast->ray_step_x) / ft_abs(rcast->slope_y);
|
if (rcast->is_x == 1)
|
||||||
if (rcast->is_x == 0 && rcast->slope_x != 0)
|
{
|
||||||
height = (rcast->next_y - rcast->ray_step_y) / ft_abs(rcast->slope_x);
|
len = rcast->next_x - rcast->ray_step_x;
|
||||||
|
if (rcast->slope_y)
|
||||||
|
len /= ft_abs(rcast->slope_y);
|
||||||
|
// len = (double)len * (double)rcast->screen_dist.end.y / (double)rcast->slope_x;
|
||||||
|
// len = rcast->screen_dist * len / (rcast->slope_x);
|
||||||
|
}
|
||||||
|
else if (rcast->is_x == 0)
|
||||||
|
{
|
||||||
|
len = rcast->next_y - rcast->ray_step_y;
|
||||||
|
if (rcast->slope_x)
|
||||||
|
len /= ft_abs(rcast->slope_x);
|
||||||
|
// len = (double)len * (double)rcast->screen_dist.end.y / (double)rcast->slope_y;
|
||||||
|
// len = rcast->screen_dist * len / (rcast->slope_y);
|
||||||
|
}
|
||||||
|
rcast->ray_len = ft_abs(len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void wall_height(t_rcast *rcast)
|
||||||
|
{
|
||||||
|
int height;
|
||||||
|
|
||||||
|
height = rcast->screen_height * (rcast->hor - rcast->ray_len) / rcast->hor;
|
||||||
|
|
||||||
|
if (height < 0)
|
||||||
|
height = 0;
|
||||||
if (height > rcast->screen_height)
|
if (height > rcast->screen_height)
|
||||||
height = rcast->screen_height;
|
height = rcast->screen_height;
|
||||||
|
|
||||||
rcast->wall.start.y = rcast->screen_height / 2 + height / 2;
|
rcast->wall.start.y = rcast->screen_height / 2 + height / 2;
|
||||||
rcast->wall.end.y = rcast->screen_height / 2 - height / 2;
|
rcast->wall.end.y = rcast->screen_height / 2 - height / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_column(t_game *game, t_rcast *rcast)
|
void draw_column(t_game *game, t_rcast *rcast)
|
||||||
{
|
{
|
||||||
t_vec floor;
|
t_vec plan;
|
||||||
t_vec ceilling;
|
int color;
|
||||||
|
|
||||||
|
plan.start.x = rcast->ray_nb;
|
||||||
|
plan.end.x = rcast->ray_nb;
|
||||||
if (rcast->wall.start.y > 0)
|
if (rcast->wall.start.y > 0)
|
||||||
{
|
{
|
||||||
floor.start.x = rcast->ray_nb;
|
plan.start.y = rcast->screen_height;
|
||||||
floor.end.x = rcast->ray_nb;
|
plan.end.y = rcast->wall.start.y;
|
||||||
floor.start.y = rcast->screen_height;
|
draw_line(&game->img, &plan, 0x00FF0000);
|
||||||
floor.end.y = rcast->wall.start.y;
|
|
||||||
draw_line(&game->img, &floor, 0x00FF0000);
|
|
||||||
}
|
}
|
||||||
if (rcast->wall.start.y < rcast->screen_height)
|
if (rcast->wall.start.y < rcast->screen_height)
|
||||||
{
|
{
|
||||||
ceilling.start.x = rcast->ray_nb;
|
plan.start.y = rcast->wall.end.y;
|
||||||
ceilling.end.x = rcast->ray_nb;
|
plan.end.y = 0;
|
||||||
ceilling.start.y = rcast->wall.end.y;
|
draw_line(&game->img, &plan, 0x000000FF);
|
||||||
ceilling.end.y = 0;
|
|
||||||
draw_line(&game->img, &ceilling, 0x00FF0000);
|
|
||||||
}
|
}
|
||||||
draw_line(&game->img, &rcast->wall, 0x00FF00FF);
|
color = 0x00FF00FF;
|
||||||
|
if (rcast->is_x)
|
||||||
|
color = 0x00EE00EE;
|
||||||
|
draw_line(&game->img, &rcast->wall, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raycast(t_game *game, t_rcast *rcast)
|
void raycast(t_game *game, t_rcast *rcast)
|
||||||
@@ -84,7 +110,9 @@ void raycast(t_game *game, t_rcast *rcast)
|
|||||||
draw_line(&game->map_img, &ray, 0x00FF00FF);
|
draw_line(&game->map_img, &ray, 0x00FF00FF);
|
||||||
// tmp end
|
// tmp end
|
||||||
|
|
||||||
calcul_wall(rcast);
|
|
||||||
|
wall_length(rcast);
|
||||||
|
wall_height(rcast);
|
||||||
draw_column(game, rcast);
|
draw_column(game, rcast);
|
||||||
(rcast->ray_nb)++;
|
(rcast->ray_nb)++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,13 +68,10 @@ static void init_raycast(t_rcast *rcast)
|
|||||||
|
|
||||||
dist = (SCREEN_FOCAL / 2) * M_PI / 180;
|
dist = (SCREEN_FOCAL / 2) * M_PI / 180;
|
||||||
dist = cos(dist) * ((SCREEN_WIDTH / 2) / sin(dist));
|
dist = cos(dist) * ((SCREEN_WIDTH / 2) / sin(dist));
|
||||||
|
rcast->screen_dist = dist;
|
||||||
rcast->screen_width = SCREEN_WIDTH;
|
rcast->screen_width = SCREEN_WIDTH;
|
||||||
rcast->screen_height = SCREEN_HEIGHT;
|
rcast->screen_height = SCREEN_HEIGHT;
|
||||||
// screen dist
|
rcast->hor = HORIZON;
|
||||||
rcast->screen_dist.start.x = 0;
|
|
||||||
rcast->screen_dist.start.y = 0;
|
|
||||||
rcast->screen_dist.end.x = 0;
|
|
||||||
rcast->screen_dist.end.y = -dist;
|
|
||||||
// screen size
|
// screen size
|
||||||
rcast->screen_size.start.x = -SCREEN_WIDTH / 2;
|
rcast->screen_size.start.x = -SCREEN_WIDTH / 2;
|
||||||
rcast->screen_size.start.y = -dist;
|
rcast->screen_size.start.y = -dist;
|
||||||
|
|||||||
@@ -3,12 +3,18 @@
|
|||||||
void plr_posx_decrement(t_game *game, t_plr *plr)
|
void plr_posx_decrement(t_game *game, t_plr *plr)
|
||||||
{
|
{
|
||||||
t_d_coord pos;
|
t_d_coord pos;
|
||||||
|
int limit_x;
|
||||||
|
int limit_y;
|
||||||
|
|
||||||
pos.x = plr->exact.x - PLR_MV;
|
pos.x = plr->exact.x - PLR_MV;
|
||||||
pos.y = plr->exact.y;
|
pos.y = plr->exact.y;
|
||||||
rotate_double(plr, &pos);
|
rotate_double(plr, &pos);
|
||||||
if (plr_out_limits(game, pos.x, pos.y))
|
limit_x = plr_out_limits(game, pos.x, plr->pos.y);
|
||||||
return ;
|
limit_y = plr_out_limits(game, plr->pos.x, pos.y);
|
||||||
|
if (limit_x)
|
||||||
|
pos.x = plr->exact.x;
|
||||||
|
if (limit_y)
|
||||||
|
pos.y = plr->exact.y;
|
||||||
plr->exact.x = pos.x;
|
plr->exact.x = pos.x;
|
||||||
plr->exact.y = pos.y;
|
plr->exact.y = pos.y;
|
||||||
(plr->pos.x) = (int)(pos.x);
|
(plr->pos.x) = (int)(pos.x);
|
||||||
@@ -18,12 +24,18 @@ void plr_posx_decrement(t_game *game, t_plr *plr)
|
|||||||
void plr_posy_decrement(t_game *game, t_plr *plr)
|
void plr_posy_decrement(t_game *game, t_plr *plr)
|
||||||
{
|
{
|
||||||
t_d_coord pos;
|
t_d_coord pos;
|
||||||
|
int limit_x;
|
||||||
|
int limit_y;
|
||||||
|
|
||||||
pos.x = plr->exact.x;
|
pos.x = plr->exact.x;
|
||||||
pos.y = plr->exact.y - PLR_MV;
|
pos.y = plr->exact.y - PLR_MV;
|
||||||
rotate_double(plr, &(pos));
|
rotate_double(plr, &(pos));
|
||||||
if (plr_out_limits(game, pos.x, pos.y))
|
limit_x = plr_out_limits(game, pos.x, plr->pos.y);
|
||||||
return ;
|
limit_y = plr_out_limits(game, plr->pos.x, pos.y);
|
||||||
|
if (limit_x)
|
||||||
|
pos.x = plr->exact.x;
|
||||||
|
if (limit_y)
|
||||||
|
pos.y = plr->exact.y;
|
||||||
plr->exact.x = pos.x;
|
plr->exact.x = pos.x;
|
||||||
plr->exact.y = pos.y;
|
plr->exact.y = pos.y;
|
||||||
(plr->pos.x) = (int)(pos.x);
|
(plr->pos.x) = (int)(pos.x);
|
||||||
@@ -33,12 +45,18 @@ void plr_posy_decrement(t_game *game, t_plr *plr)
|
|||||||
void plr_posx_increment(t_game *game, t_plr *plr)
|
void plr_posx_increment(t_game *game, t_plr *plr)
|
||||||
{
|
{
|
||||||
t_d_coord pos;
|
t_d_coord pos;
|
||||||
|
int limit_x;
|
||||||
|
int limit_y;
|
||||||
|
|
||||||
pos.x = plr->exact.x + PLR_MV;
|
pos.x = plr->exact.x + PLR_MV;
|
||||||
pos.y = plr->exact.y;
|
pos.y = plr->exact.y;
|
||||||
rotate_double(plr, &(pos));
|
rotate_double(plr, &(pos));
|
||||||
if (plr_out_limits(game, pos.x, pos.y))
|
limit_x = plr_out_limits(game, pos.x, plr->pos.y);
|
||||||
return ;
|
limit_y = plr_out_limits(game, plr->pos.x, pos.y);
|
||||||
|
if (limit_x)
|
||||||
|
pos.x = plr->exact.x;
|
||||||
|
if (limit_y)
|
||||||
|
pos.y = plr->exact.y;
|
||||||
plr->exact.x = pos.x;
|
plr->exact.x = pos.x;
|
||||||
plr->exact.y = pos.y;
|
plr->exact.y = pos.y;
|
||||||
(plr->pos.x) = (int)(pos.x);
|
(plr->pos.x) = (int)(pos.x);
|
||||||
@@ -48,12 +66,18 @@ void plr_posx_increment(t_game *game, t_plr *plr)
|
|||||||
void plr_posy_increment(t_game *game, t_plr *plr)
|
void plr_posy_increment(t_game *game, t_plr *plr)
|
||||||
{
|
{
|
||||||
t_d_coord pos;
|
t_d_coord pos;
|
||||||
|
int limit_x;
|
||||||
|
int limit_y;
|
||||||
|
|
||||||
pos.x = plr->exact.x;
|
pos.x = plr->exact.x;
|
||||||
pos.y = plr->exact.y + PLR_MV;
|
pos.y = plr->exact.y + PLR_MV;
|
||||||
rotate_double(plr, &(pos));
|
rotate_double(plr, &(pos));
|
||||||
if (plr_out_limits(game, pos.x, pos.y))
|
limit_x = plr_out_limits(game, pos.x, plr->pos.y);
|
||||||
return ;
|
limit_y = plr_out_limits(game, plr->pos.x, pos.y);
|
||||||
|
if (limit_x)
|
||||||
|
pos.x = plr->exact.x;
|
||||||
|
if (limit_y)
|
||||||
|
pos.y = plr->exact.y;
|
||||||
plr->exact.x = pos.x;
|
plr->exact.x = pos.x;
|
||||||
plr->exact.y = pos.y;
|
plr->exact.y = pos.y;
|
||||||
(plr->pos.x) = (int)(pos.x);
|
(plr->pos.x) = (int)(pos.x);
|
||||||
|
|||||||
Reference in New Issue
Block a user