aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inc/cub3d.h3
-rw-r--r--inc/cub3d_structs.h1
-rw-r--r--src/ft_draw_circle.c1
-rw-r--r--src/ft_draw_handweap.c30
-rw-r--r--src/ft_draw_heals_extra.c3
-rw-r--r--src/ft_draw_hud.c2
-rw-r--r--src/ft_draw_life_bar.c4
-rw-r--r--src/ft_draw_map.c2
-rw-r--r--src/ft_draw_sprite_extra.c2
-rw-r--r--src/ft_draw_square.c1
-rw-r--r--src/ft_draw_textures.c6
-rw-r--r--src/ft_draw_traps.c3
-rw-r--r--src/ft_draw_traps_extra.c3
-rw-r--r--src/ft_draw_weapons.c3
-rw-r--r--src/ft_draw_weapons_extra.c2
-rw-r--r--src/ft_treat_args.c3
-rw-r--r--src/main.c4
17 files changed, 31 insertions, 42 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h
index 81cb3d0..6a1ed2d 100644
--- a/inc/cub3d.h
+++ b/inc/cub3d.h
@@ -146,8 +146,7 @@ size_t ft_get_line_len(char *line);
*/
uint8_t ft_check_map_arg(int argc, const char *argv[]);
-uint8_t ft_use_args(int argc, const char *argv[],
- char *const envp[], t_cub *clist);
+uint8_t ft_use_args(int argc, const char *argv[], t_cub *clist);
/*
** ====== RAYCAST ======
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index 85031bb..9b220c1 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -233,7 +233,6 @@ typedef struct s_cub
uint8_t doicast;
uint16_t currlvl;
uint16_t i;
- char *const *envp;
char errmsg[64];
int32_t key_input[5];
char fps_count[9];
diff --git a/src/ft_draw_circle.c b/src/ft_draw_circle.c
index 249b2e9..4456aca 100644
--- a/src/ft_draw_circle.c
+++ b/src/ft_draw_circle.c
@@ -11,7 +11,6 @@
/* ************************************************************************** */
#include <cub3d.h>
-#include <mlx.h>
#include <stdint.h>
#include <math.h>
diff --git a/src/ft_draw_handweap.c b/src/ft_draw_handweap.c
index 9a1a44b..42e7bfd 100644
--- a/src/ft_draw_handweap.c
+++ b/src/ft_draw_handweap.c
@@ -55,23 +55,15 @@ static int16_t
}
}
-void
- ft_draw_handweap(t_cub *cl)
+static void
+ ft_put_handweap(int8_t w_id, int32_t y_ratio, int32_t x_ratio, t_cub *cl)
{
- int32_t x_ratio;
- int32_t y_ratio;
int16_t x;
int16_t y;
int16_t move;
- int8_t w_id;
- w_id = cl->plist.handles_weapon;
- w_id += (cl->plist.fire == 1) ? (1) : 0;
- x_ratio = (int32_t)(((cl->tweap[w_id].img_w - 50) << 16) / cl->wlist.x_size) + 1;
- y_ratio = (int32_t)(((cl->tweap[w_id].img_h - 50) << 16) / cl->wlist.y_size) + 1;
y = 0;
- move = ft_set_move(cl);
- move = (cl->plist.fire == 1) ? (0) : (move);
+ move = (cl->plist.fire == 1) ? (0) : (ft_set_move(cl));
while (y < (int16_t)cl->wlist.y_size)
{
cl->tweap[w_id].tex_y = ((y * y_ratio) >> 16);
@@ -89,3 +81,19 @@ void
y++;
}
}
+
+void
+ ft_draw_handweap(t_cub *cl)
+{
+ int32_t x_ratio;
+ int32_t y_ratio;
+ int8_t w_id;
+
+ w_id = cl->plist.handles_weapon;
+ w_id += (cl->plist.fire == 1) ? (1) : (0);
+ x_ratio = (int32_t)(((cl->tweap[w_id].img_w - 50) << 16)
+ / cl->wlist.x_size) + 1;
+ y_ratio = (int32_t)(((cl->tweap[w_id].img_h - 50) << 16)
+ / cl->wlist.y_size) + 1;
+ ft_put_handweap(w_id, y_ratio, x_ratio, cl);
+}
diff --git a/src/ft_draw_heals_extra.c b/src/ft_draw_heals_extra.c
index 62c64b0..1e5a775 100644
--- a/src/ft_draw_heals_extra.c
+++ b/src/ft_draw_heals_extra.c
@@ -10,11 +10,8 @@
/* */
/* ************************************************************************** */
-#include <libft.h>
#include <cub3d.h>
#include <stdint.h>
-#include <stdlib.h>
-#include <math.h>
void
ft_calc_heal(t_cub *cl)
diff --git a/src/ft_draw_hud.c b/src/ft_draw_hud.c
index 5feab32..d98ff31 100644
--- a/src/ft_draw_hud.c
+++ b/src/ft_draw_hud.c
@@ -58,9 +58,9 @@ static void
static void
ft_draw_minimap_back(size_t map_h, size_t map_w, t_win *wl, t_cub *cl)
{
- const uint16_t scl = cl->mlist.scale;
uint16_t x;
uint16_t y;
+ const uint16_t scl = cl->mlist.scale;
x = 0;
y = wl->y_size - (map_h * scl) - 20;
diff --git a/src/ft_draw_life_bar.c b/src/ft_draw_life_bar.c
index 64d1f1f..7aa5afc 100644
--- a/src/ft_draw_life_bar.c
+++ b/src/ft_draw_life_bar.c
@@ -88,8 +88,8 @@ static void
static void
ft_get_hw(t_cub *cl)
{
- int16_t x;
- int16_t y;
+ int16_t x;
+ int16_t y;
const int16_t scl = cl->mlist.scale;
x = ((cl->mlist.map_w * scl) + 20) + (32 * scl) - ((32 * scl) / 4);
diff --git a/src/ft_draw_map.c b/src/ft_draw_map.c
index 286f69d..02bdfc3 100644
--- a/src/ft_draw_map.c
+++ b/src/ft_draw_map.c
@@ -39,9 +39,9 @@ static void
void
ft_draw_map(char **map, t_cub *clist)
{
- const uint8_t scale = clist->mlist.scale;
size_t x;
size_t y;
+ const uint8_t scale = clist->mlist.scale;
x = 0;
y = 0;
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c
index f4ac6ee..323906a 100644
--- a/src/ft_draw_sprite_extra.c
+++ b/src/ft_draw_sprite_extra.c
@@ -10,11 +10,9 @@
/* */
/* ************************************************************************** */
-#include <libft.h>
#include <cub3d.h>
#include <stdint.h>
#include <stdlib.h>
-#include <math.h>
void
ft_sprite_h_w(t_cub *cl, t_sprite *sprite)
diff --git a/src/ft_draw_square.c b/src/ft_draw_square.c
index 4223f26..a535be4 100644
--- a/src/ft_draw_square.c
+++ b/src/ft_draw_square.c
@@ -11,7 +11,6 @@
/* ************************************************************************** */
#include <cub3d.h>
-#include <mlx.h>
#include <stdint.h>
void
diff --git a/src/ft_draw_textures.c b/src/ft_draw_textures.c
index dcd36e7..126d0af 100644
--- a/src/ft_draw_textures.c
+++ b/src/ft_draw_textures.c
@@ -22,7 +22,8 @@
** 4 : sprite
*/
-void ft_draw_texture(t_cub *cl, int x, int y, int tex_y)
+void
+ ft_draw_texture(t_cub *cl, int x, int y, int tex_y)
{
float dist;
float calc;
@@ -43,7 +44,8 @@ void ft_draw_texture(t_cub *cl, int x, int y, int tex_y)
cl->tlist[cl->w_side].img_h * tex_y + 2] / calc;
}
-void ft_choose_tex(t_cub *clist)
+void
+ ft_choose_tex(t_cub *clist)
{
if (clist->rlist.sqy == clist->mlist.nlx
&& clist->rlist.sqx == clist->mlist.nly)
diff --git a/src/ft_draw_traps.c b/src/ft_draw_traps.c
index 71e8fe8..05e8446 100644
--- a/src/ft_draw_traps.c
+++ b/src/ft_draw_traps.c
@@ -10,11 +10,8 @@
/* */
/* ************************************************************************** */
-#include <libft.h>
#include <cub3d.h>
#include <stdint.h>
-#include <stdlib.h>
-#include <math.h>
static void
ft_sort_traps_norme(float *dist_tab, int32_t it, t_cub *cl)
diff --git a/src/ft_draw_traps_extra.c b/src/ft_draw_traps_extra.c
index c524190..cbeffe1 100644
--- a/src/ft_draw_traps_extra.c
+++ b/src/ft_draw_traps_extra.c
@@ -10,11 +10,8 @@
/* */
/* ************************************************************************** */
-#include <libft.h>
#include <cub3d.h>
#include <stdint.h>
-#include <stdlib.h>
-#include <math.h>
void
ft_calc_trap(t_cub *cl)
diff --git a/src/ft_draw_weapons.c b/src/ft_draw_weapons.c
index 4a75c9f..2e1ec13 100644
--- a/src/ft_draw_weapons.c
+++ b/src/ft_draw_weapons.c
@@ -10,11 +10,8 @@
/* */
/* ************************************************************************** */
-#include <libft.h>
#include <cub3d.h>
#include <stdint.h>
-#include <stdlib.h>
-#include <math.h>
static void
ft_sort_weapons_norme(float *dist_tab, int16_t *i, uint16_t j, t_cub *cl)
diff --git a/src/ft_draw_weapons_extra.c b/src/ft_draw_weapons_extra.c
index 04b61ea..781598f 100644
--- a/src/ft_draw_weapons_extra.c
+++ b/src/ft_draw_weapons_extra.c
@@ -10,10 +10,8 @@
/* */
/* ************************************************************************** */
-#include <libft.h>
#include <cub3d.h>
#include <stdint.h>
-#include <stdlib.h>
static void
ft_calc_weapon(uint8_t id, t_cub *cl)
diff --git a/src/ft_treat_args.c b/src/ft_treat_args.c
index 4cc759e..0e1eae3 100644
--- a/src/ft_treat_args.c
+++ b/src/ft_treat_args.c
@@ -30,9 +30,8 @@ uint8_t
}
uint8_t
- ft_use_args(int argc, const char *argv[], char *const envp[], t_cub *clist)
+ ft_use_args(int argc, const char *argv[], t_cub *clist)
{
- clist->envp = envp;
if (argc < 3)
{
if (ft_init_winptr(clist) < 0)
diff --git a/src/main.c b/src/main.c
index 623787b..c50508f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -16,7 +16,7 @@
#include <stdlib.h>
int
- main(int argc, const char *argv[], char *const envp[])
+ main(int argc, const char *argv[])
{
t_cub *clist;
@@ -31,6 +31,6 @@ int
return (ft_exit(FT_RET_FAILED_MLX, clist));
ft_wall_tex_init(clist);
ft_weap_tex_init(clist);
- ft_use_args(argc, argv, envp, clist);
+ ft_use_args(argc, argv, clist);
return (FT_RET_FINE);
}