better struct and files organization, and still only half raycast on map but no view created
This commit is contained in:
@@ -1,65 +1,61 @@
|
||||
#include "cube3d.h"
|
||||
|
||||
void plr_posx_decrement(t_game *game)
|
||||
void plr_posx_decrement(t_game *game, t_plr *plr)
|
||||
{
|
||||
double pos_x;
|
||||
double pos_y;
|
||||
t_d_coord pos;
|
||||
|
||||
pos_x = game->plr_exact_x - 5;
|
||||
pos_y = game->plr_exact_y;
|
||||
rotate_double(game, &pos_x, &pos_y);
|
||||
if (plr_out_limits(game, pos_x, pos_y))
|
||||
pos.x = plr->exact.x - PLR_MV;
|
||||
pos.y = plr->exact.y;
|
||||
rotate_double(plr, &pos);
|
||||
if (plr_out_limits(game, pos.x, pos.y))
|
||||
return ;
|
||||
game->plr_exact_x = pos_x;
|
||||
game->plr_exact_y = pos_y;
|
||||
(game->plr_x) = (int)pos_x;
|
||||
(game->plr_y) = (int)pos_y;
|
||||
plr->exact.x = pos.x;
|
||||
plr->exact.y = pos.y;
|
||||
(plr->pos.x) = (int)(pos.x);
|
||||
(plr->pos.y) = (int)(pos.y);
|
||||
}
|
||||
|
||||
void plr_posy_decrement(t_game *game)
|
||||
void plr_posy_decrement(t_game *game, t_plr *plr)
|
||||
{
|
||||
double pos_x;
|
||||
double pos_y;
|
||||
t_d_coord pos;
|
||||
|
||||
pos_x = game->plr_exact_x;
|
||||
pos_y = game->plr_exact_y - 5;
|
||||
rotate_double(game, &pos_x, &pos_y);
|
||||
if (plr_out_limits(game, pos_x, pos_y))
|
||||
pos.x = plr->exact.x;
|
||||
pos.y = plr->exact.y - PLR_MV;
|
||||
rotate_double(plr, &(pos));
|
||||
if (plr_out_limits(game, pos.x, pos.y))
|
||||
return ;
|
||||
game->plr_exact_x = pos_x;
|
||||
game->plr_exact_y = pos_y;
|
||||
(game->plr_x) = (int)pos_x;
|
||||
(game->plr_y) = (int)pos_y;
|
||||
plr->exact.x = pos.x;
|
||||
plr->exact.y = pos.y;
|
||||
(plr->pos.x) = (int)(pos.x);
|
||||
(plr->pos.y) = (int)(pos.y);
|
||||
}
|
||||
|
||||
void plr_posx_increment(t_game *game)
|
||||
void plr_posx_increment(t_game *game, t_plr *plr)
|
||||
{
|
||||
double pos_x;
|
||||
double pos_y;
|
||||
t_d_coord pos;
|
||||
|
||||
pos_x = game->plr_exact_x + 5;
|
||||
pos_y = game->plr_exact_y;
|
||||
rotate_double(game, &pos_x, &pos_y);
|
||||
if (plr_out_limits(game, pos_x, pos_y))
|
||||
pos.x = plr->exact.x + PLR_MV;
|
||||
pos.y = plr->exact.y;
|
||||
rotate_double(plr, &(pos));
|
||||
if (plr_out_limits(game, pos.x, pos.y))
|
||||
return ;
|
||||
game->plr_exact_x = pos_x;
|
||||
game->plr_exact_y = pos_y;
|
||||
(game->plr_x) = (int)pos_x;
|
||||
(game->plr_y) = (int)pos_y;
|
||||
plr->exact.x = pos.x;
|
||||
plr->exact.y = pos.y;
|
||||
(plr->pos.x) = (int)(pos.x);
|
||||
(plr->pos.y) = (int)(pos.y);
|
||||
}
|
||||
|
||||
void plr_posy_increment(t_game *game)
|
||||
void plr_posy_increment(t_game *game, t_plr *plr)
|
||||
{
|
||||
double pos_x;
|
||||
double pos_y;
|
||||
t_d_coord pos;
|
||||
|
||||
pos_x = game->plr_exact_x;
|
||||
pos_y = game->plr_exact_y + 5;
|
||||
rotate_double(game, &pos_x, &pos_y);
|
||||
if (plr_out_limits(game, pos_x, pos_y))
|
||||
pos.x = plr->exact.x;
|
||||
pos.y = plr->exact.y + PLR_MV;
|
||||
rotate_double(plr, &(pos));
|
||||
if (plr_out_limits(game, pos.x, pos.y))
|
||||
return ;
|
||||
game->plr_exact_x = pos_x;
|
||||
game->plr_exact_y = pos_y;
|
||||
(game->plr_x) = (int)pos_x;
|
||||
(game->plr_y) = (int)pos_y;
|
||||
plr->exact.x = pos.x;
|
||||
plr->exact.y = pos.y;
|
||||
(plr->pos.x) = (int)(pos.x);
|
||||
(plr->pos.y) = (int)(pos.y);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user