-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yesim Zaim
committed
Feb 7, 2024
1 parent
a2ae9df
commit ae3c212
Showing
7 changed files
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: yzaim <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2024/01/08 15:24:47 by yzaim #+# #+# */ | ||
/* Updated: 2024/02/02 15:42:44 by yesimzaim ######## odam.nl */ | ||
/* Updated: 2024/02/07 12:04:12 by yzaim ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: yzaim <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/01/08 15:26:51 by yzaim #+# #+# */ | ||
/* Updated: 2024/01/29 12:51:57 by yesimzaim ######## odam.nl */ | ||
/* Updated: 2024/02/07 12:15:51 by yzaim ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: jboeve <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2024/01/25 16:01:20 by jboeve #+# #+# */ | ||
/* Updated: 2024/01/29 13:00:59 by yesimzaim ######## odam.nl */ | ||
/* Updated: 2024/02/07 12:48:55 by yzaim ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -58,7 +58,9 @@ void sprite_calculate(t_player *p) | |
} | ||
|
||
sprite_sort(p->sprite_dist, p->sprite_order, p->meta->attributes.sprite_count); | ||
|
||
|
||
// print_double_array("SPRITE DIST", p->sprite_dist, p->meta->attributes.sprite_count); | ||
|
||
i = 0; | ||
while (i < p->meta->attributes.sprite_count) | ||
{ | ||
|
@@ -70,7 +72,7 @@ void sprite_calculate(t_player *p) | |
|
||
|
||
const t_vec2d transform = {inv_det * (p->direction.y * s_pos.x - p->direction.x * s_pos.y), | ||
inv_det * (-p->cam_plane.y * s_pos.x + p->cam_plane.x * s_pos.y)}; | ||
inv_det * (-(p->cam_plane.y) * s_pos.x + p->cam_plane.x * s_pos.y)}; | ||
|
||
const int32_t sprite_screen_x = (int32_t)(p->meta->image->width / 2) * (1 + transform.x / transform.y); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: yzaim <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2024/01/08 15:30:18 by yzaim #+# #+# */ | ||
/* Updated: 2024/02/01 16:26:58 by yesimzaim ######## odam.nl */ | ||
/* Updated: 2024/02/07 11:16:09 by yzaim ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -178,6 +178,7 @@ int lexer(t_meta *meta, char *map_file) | |
if (!file) | ||
return(EXIT_FAILURE); | ||
if (lex(file, &meta->map, &meta->elements)) | ||
return (free_t_flag_list(&meta->elements), EXIT_FAILURE); //also free everything in case of error! | ||
return (free(file), free_t_flag_list(&meta->elements), EXIT_FAILURE); //also free everything in case of error! | ||
free(file); | ||
return (EXIT_SUCCESS); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: yzaim <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2024/01/08 15:56:45 by yzaim #+# #+# */ | ||
/* Updated: 2024/01/25 00:29:36 by joppe ######## odam.nl */ | ||
/* Updated: 2024/02/07 12:03:56 by yzaim ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* :::::::: */ | ||
/* free.c :+: :+: */ | ||
/* free.c :+: :+: */ | ||
/* +:+ */ | ||
/* By: yzaim <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2024/01/08 15:53:55 by yzaim #+# #+# */ | ||
/* Updated: 2024/01/24 11:22:41 by yzaim ######## odam.nl */ | ||
/* Updated: 2024/02/07 12:04:35 by yzaim ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -19,7 +19,9 @@ void f_tex(t_tex *attr) | |
if (attr->tex_path) | ||
free(attr->tex_path); | ||
if (attr->tex) | ||
{ | ||
mlx_delete_texture(attr->tex); | ||
} | ||
} | ||
|
||
static void free_t_tex(t_attr *attributes) | ||
|
@@ -30,6 +32,7 @@ static void free_t_tex(t_attr *attributes) | |
f_tex(&attributes->w); | ||
f_tex(&attributes->f); | ||
f_tex(&attributes->c); | ||
f_tex(&attributes->c_alt); | ||
} | ||
|
||
void free_t_flag_list(t_flag **list) | ||
|
@@ -67,6 +70,7 @@ void meta_free(t_meta *meta) | |
{ | ||
free_t_tex(&meta->attributes); | ||
free(meta->map.level); | ||
if (meta->attributes.sprites) | ||
free_t_sprites(&meta->attributes.sprites, meta->attributes.sprite_count); | ||
free_t_sprites(&meta->attributes.sprites, meta->attributes.sprite_count); | ||
free(meta->player.sprite_dist); | ||
free(meta->player.sprite_order); | ||
} |