Skip to content

Commit

Permalink
Fix stack overflow causing fps counter to go wild.
Browse files Browse the repository at this point in the history
  • Loading branch information
JopjeKnopje committed Feb 5, 2024
1 parent 2b091df commit d6074e4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
20 changes: 11 additions & 9 deletions include/meta.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
/* ************************************************************************** */
/**/
/* :::::::: */
/* */
/* :::::::: */
/* meta.h :+: :+: */
/*+:+ */
/* By: jboeve <[email protected]>+#+ */
/* +#+ */
/* Created: 2023/11/01 20:07:37 by jboeve#+##+# */
/* Updated: 2024/01/29 15:27:32 by yesimzaim ######## odam.nl */
/**/
/* +:+ */
/* By: joppe <[email protected]> +#+ */
/* +#+ */
/* Created: 2024/02/05 14:01:44 by joppe #+# #+# */
/* Updated: 2024/02/05 14:01:52 by joppe ######## odam.nl */
/* */
/* ************************************************************************** */



#ifndef META_H
#define META_H

Expand Down Expand Up @@ -232,12 +234,12 @@ typedef struct s_meta {
t_timer update_timer;
t_minimap minimap;
t_timer fps_timer;
t_player player;
uint32_t fps;
t_map map;
t_attr attributes;
const char *scene_name;
t_flag *elements;
t_player player;
} t_meta;


Expand Down
4 changes: 2 additions & 2 deletions src/game/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: yzaim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/08 15:27:23 by yzaim #+# #+# */
/* Updated: 2024/01/25 16:02:17 by jboeve ######## odam.nl */
/* Updated: 2024/02/05 14:03:01 by joppe ######## odam.nl */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -115,8 +115,8 @@ void player_raycast(t_player *p)
ray_start = vec2d_add(p->direction, vec2d_scalar_product(p->cam_plane, camera_x));
p->rays[col] = raycaster_cast(p->position, ray_start, bound_check, p->meta);
// printf("wall x: %f\n", p->rays[col].wall_x);
col++;
p->z_buffer[col] = p->rays[col].length;
col++;
}

sprite_calculate(p);
Expand Down
14 changes: 10 additions & 4 deletions test_maps/valid_tex.cub
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ SO texture_examples/purplestone2.png
F texture_examples/floor.png
C texture_examples/ceiling_square.png

SP texture_examples/barrel.png 3.5 2.5
SP texture_examples/barrel.png 4.5 2.5
SP texture_examples/barrel.png 5.5 2.5
SP texture_examples/hoofd.png 6.5 2.5
SP texture_examples/sexy.png 7.5 2.5

11111111111111
1000010001
1000N10001
1000000001
1000000001
1000000001
111000000111
100000100001
1000000001
1111101111
111000N00111
100000000001
10000000011
1111111111

0 comments on commit d6074e4

Please sign in to comment.