mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
norm: removed unused code
This commit is contained in:
parent
3cc73fc8ce
commit
6fe6eb0a9a
4 changed files with 2 additions and 140 deletions
23
src/consts.c
23
src/consts.c
|
|
@ -1,23 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* consts.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/28 14:33:12 by kcolin #+# #+# */
|
||||
/* Updated: 2025/07/29 12:01:33 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "consts.h"
|
||||
#include <math.h>
|
||||
|
||||
const float g_north = M_PI;
|
||||
const float g_south = 0;
|
||||
const float g_east = M_PI / 2;
|
||||
const float g_west = 3 * M_PI / 2;
|
||||
const float g_northwest = 5 * M_PI / 4;
|
||||
const float g_northeast = 3 * M_PI / 4;
|
||||
const float g_southwest = 7 * M_PI / 4;
|
||||
const float g_southeast = M_PI / 4;
|
||||
12
src/consts.h
12
src/consts.h
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:54:36 by kcolin #+# #+# */
|
||||
/* Updated: 2025/07/30 16:38:32 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/07/31 11:29:13 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,16 +18,6 @@
|
|||
|
||||
# define SIZE 64
|
||||
# define MAP_SIZE 20
|
||||
|
||||
extern const float g_north;
|
||||
extern const float g_south;
|
||||
extern const float g_east;
|
||||
extern const float g_west;
|
||||
extern const float g_northwest;
|
||||
extern const float g_northeast;
|
||||
extern const float g_southwest;
|
||||
extern const float g_southeast;
|
||||
|
||||
# define RESSOURCE_DIR "ressources"
|
||||
# define MOVEMENT_SPEED 0.1
|
||||
# define ROTATION_SPEED 0.1
|
||||
|
|
|
|||
106
src/main.c
106
src/main.c
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
|
||||
/* Updated: 2025/07/30 16:30:11 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/07/31 11:28:04 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -15,7 +15,6 @@
|
|||
#include "player/player.h"
|
||||
#include "consts.h"
|
||||
#include "cub3d_data.h"
|
||||
#include "draw/drawutils.h"
|
||||
#include "player/move.h"
|
||||
#include "map/map_checker.h"
|
||||
#include "draw/draw_map.h"
|
||||
|
|
@ -31,78 +30,6 @@
|
|||
#include <X11/X.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h> // BAD
|
||||
|
||||
bool touch(float px, float py, t_mapdata *map)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
|
||||
x = px / SIZE;
|
||||
y = py / SIZE;
|
||||
if (map->map[y][x] == '1')
|
||||
return (true);
|
||||
return (false);
|
||||
}
|
||||
|
||||
// void draw_line(t_cub3d_data *data, float start_angle)
|
||||
// {
|
||||
// float cos_angle = cos(start_angle);
|
||||
// float sin_angle = sin(start_angle);
|
||||
// float ray_x = data->player.x;
|
||||
// float ray_y = data->player.y;
|
||||
//
|
||||
// while(!touch(ray_x, ray_y, data->map))
|
||||
// {
|
||||
// my_mlx_pixel_put(data->img_data, (int)(MAP_SIZE * (ray_x / SIZE)), (int)(MAP_SIZE * (ray_y / SIZE)), 0xcc241b);
|
||||
// ray_x += sin_angle;
|
||||
// ray_y += cos_angle;
|
||||
// }
|
||||
// }
|
||||
|
||||
// t_cardinal_dir angle_cardinal_dir(float angle)
|
||||
// {
|
||||
// if (angle >= g_southwest || (angle > g_south && angle < g_southeast))
|
||||
// return (SOUTH);
|
||||
// if (angle >= g_southeast && angle < g_northeast)
|
||||
// return (EAST);
|
||||
// if (angle >= g_northeast && angle < g_northwest)
|
||||
// return (NORTH);
|
||||
// return (WEST);
|
||||
// }
|
||||
//
|
||||
// t_cardinal_dir player_cardinal_dir(t_player player)
|
||||
// {
|
||||
// return (angle_cardinal_dir(player.yaw));
|
||||
// }
|
||||
|
||||
t_intercardinal_dir angle_intercardinal_dir(float angle)
|
||||
{
|
||||
if (angle >= g_south && angle < g_east)
|
||||
return (SOUTHEAST);
|
||||
if (angle >= g_east && angle < g_north)
|
||||
return (NORTHEAST);
|
||||
if (angle >= g_north && angle < g_west)
|
||||
return (NORTHWEST);
|
||||
return (SOUTHWEST);
|
||||
}
|
||||
|
||||
// t_intercardinal_dir player_intercardinal_dir(t_player player)
|
||||
// {
|
||||
// return (angle_intercardinal_dir(player.yaw));
|
||||
// }
|
||||
|
||||
/*
|
||||
** Converts a coordinate from global map space to local tile space.
|
||||
**
|
||||
** input coordinate is in the full map
|
||||
** output coordinate is in the current tile
|
||||
*/
|
||||
float coord_global_to_local(float coord)
|
||||
{
|
||||
return (coord - floor(coord / SIZE) * SIZE);
|
||||
}
|
||||
|
||||
int game_loop(t_cub3d_data *data)
|
||||
{
|
||||
|
|
@ -113,37 +40,6 @@ int game_loop(t_cub3d_data *data)
|
|||
reset_matrix(data);
|
||||
raycaster(data, &ray);
|
||||
move_player(data);
|
||||
|
||||
// if (player_intercardinal_dir(data->player) == SOUTHEAST)
|
||||
// ft_printf("southeast ");
|
||||
// if (player_intercardinal_dir(data->player) == SOUTHWEST)
|
||||
// ft_printf("southwest ");
|
||||
// if (player_intercardinal_dir(data->player) == NORTHEAST)
|
||||
// ft_printf("northeast ");
|
||||
// if (player_intercardinal_dir(data->player) == NORTHWEST)
|
||||
// ft_printf("northwest ");
|
||||
//
|
||||
// if (player_cardinal_dir(data->player) == SOUTH)
|
||||
// ft_printf("south\n");
|
||||
// if (player_cardinal_dir(data->player) == EAST)
|
||||
// ft_printf("east\n");
|
||||
// if (player_cardinal_dir(data->player) == NORTH)
|
||||
// ft_printf("north\n");
|
||||
// if (player_cardinal_dir(data->player) == WEST)
|
||||
// ft_printf("west\n");
|
||||
//
|
||||
// float ray_angle = data->player.yaw - M_PI / 6;
|
||||
// float fraction = M_PI / 3 / WIDTH;
|
||||
// int column = 0;
|
||||
// while (column < WIDTH)
|
||||
// {
|
||||
// // hline check
|
||||
// /* float ray_atan = atan(ray_angle); */
|
||||
// draw_line(data, ray_angle);
|
||||
// column++;
|
||||
// ray_angle += fraction;
|
||||
// }
|
||||
|
||||
matrix_to_image(data);
|
||||
draw_map(data->map, &data->player, data->img_data);
|
||||
mlx_put_image_to_window(data->mlx, data->mlx_win,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue