diff --git a/builds/draw.o b/builds/draw.o deleted file mode 100644 index bd215e4..0000000 Binary files a/builds/draw.o and /dev/null differ diff --git a/builds/draw_bonus.o b/builds/draw_bonus.o new file mode 100644 index 0000000..2eed6e9 Binary files /dev/null and b/builds/draw_bonus.o differ diff --git a/builds/fdf.o b/builds/fdf.o index 76d79d6..adebeb9 100644 Binary files a/builds/fdf.o and b/builds/fdf.o differ diff --git a/builds/keypress.o b/builds/keypress.o deleted file mode 100644 index 872fdff..0000000 Binary files a/builds/keypress.o and /dev/null differ diff --git a/builds/keypress_bonus.o b/builds/keypress_bonus.o new file mode 100644 index 0000000..1085807 Binary files /dev/null and b/builds/keypress_bonus.o differ diff --git a/builds/modifs.o b/builds/modifs.o index 46ab7d3..a613194 100644 Binary files a/builds/modifs.o and b/builds/modifs.o differ diff --git a/builds/parse.o b/builds/parse.o index f6e44bc..c92ea48 100644 Binary files a/builds/parse.o and b/builds/parse.o differ diff --git a/fdf b/fdf index 7b165f6..018bcd4 100755 Binary files a/fdf and b/fdf differ diff --git a/includes/fdf.h b/includes/fdf.h index d30690e..84e94bd 100644 --- a/includes/fdf.h +++ b/includes/fdf.h @@ -68,6 +68,11 @@ int is_color(char *color); void size_map(t_fdf *fdf, char *raw, int height); int **parse_map(t_fdf *fdf, int fd); +// steps size for the hight transform with p and o +// must be > 0 +// 100 is small, 1 is the biggest +# define Z_HIGHT 10 + # define ESCAPE 65307 # define UP 65362 # define DOWN 65364 diff --git a/srcs/draw_bonus.c b/srcs/draw_bonus.c index 4d1e969..d89679f 100644 --- a/srcs/draw_bonus.c +++ b/srcs/draw_bonus.c @@ -75,7 +75,8 @@ void draw_color_pixel(t_fdf *fdf, int new_x, int new_y, int z) color = 0xffffff; z -= (z * fdf->zoom) / fdf->offset; - z /= fdf->altitude; + if (z > 0) + z /= fdf->altitude; if (z > fdf->min_z && fdf->z_amplitude) { color = color ^ (((0xff / fdf->z_amplitude) * (z - fdf->min_z)) << 16); diff --git a/srcs/keypress_bonus.c b/srcs/keypress_bonus.c index b0b0801..d6121dd 100644 --- a/srcs/keypress_bonus.c +++ b/srcs/keypress_bonus.c @@ -30,7 +30,7 @@ void keypress_more(int keycode, t_fdf *fdf) else if (keycode == O) fdf->altitude++; else if (keycode == P) - if (fdf->altitude > 1) + if (fdf->altitude > 0) fdf->altitude--; } diff --git a/srcs/modifs.c b/srcs/modifs.c index 74031cc..f18fa2e 100644 --- a/srcs/modifs.c +++ b/srcs/modifs.c @@ -28,8 +28,14 @@ int *new_coordinates(t_fdf *fdf, int i, int j) y = j * (fdf->offset + fdf->zoom); x -= (fdf->map_size_x + fdf->zoom * fdf->map_width) / 2; y -= (fdf->map_size_y + fdf->zoom * fdf->map_height) / 2; - z = fdf->map[j][i] * fdf->altitude; + if (fdf->altitude > 0) + z = fdf->map[j][i] * fdf->altitude; + else if (fdf->altitude == 0) + z = 0; + else + z = fdf->map[j][i]; z += (z * fdf->zoom) / fdf->offset; + z /= Z_HIGHT; point[0] = x * cos(fdf->rad_x) + y * sin(fdf->rad_x); point[1] = y * cos(fdf->rad_x) - x * sin(fdf->rad_x); point[1] = point[1] * cos(fdf->rad_y) - -z * sin(fdf->rad_y);