diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/bullets.h | 23 | ||||
| -rw-r--r-- | include/map.h | 2 | ||||
| -rw-r--r-- | include/math_helper.h | 21 | ||||
| -rw-r--r-- | include/players.h | 13 |
4 files changed, 47 insertions, 12 deletions
diff --git a/include/bullets.h b/include/bullets.h new file mode 100644 index 0000000..e8ddb86 --- /dev/null +++ b/include/bullets.h @@ -0,0 +1,23 @@ +#ifndef INCLUDE_BULLETS +#define INCLUDE_BULLETS + +#include <projectbase/project_base.h> + +#include "players.h" +#include "objects.h" +#include "map.h" + +typedef struct t_bullet { + bool active; + vec3f position; + float endx; + float endy; + float alive_time; +} bullet; + +bullet bullets[500] = {0}; +int max_bullets = 500; + +void draw_bullets(platform_window* window); + +#endif
\ No newline at end of file diff --git a/include/map.h b/include/map.h index 735c106..80772b1 100644 --- a/include/map.h +++ b/include/map.h @@ -31,7 +31,7 @@ typedef struct t_map_info { int tile_width; int tile_height; int px_raised_per_h; - int px_incline; + float px_incline; } map_info; // data data that is stored on disk diff --git a/include/math_helper.h b/include/math_helper.h new file mode 100644 index 0000000..1b84ebf --- /dev/null +++ b/include/math_helper.h @@ -0,0 +1,21 @@ +#ifndef INCLUDE_MATH_HELPER +#define INCLUDE_MATH_HELPER + +#include <projectbase/project_base.h> + +#include "players.h" +#include "objects.h" +#include "map.h" + +#define MAP_RENDER_DEPTH renderer->set_render_depth(1); +#define BULLET_RENDER_DEPTH(_h) renderer->set_render_depth(4 + ceil(_h)); +#define OBJECT_RENDER_DEPTH(_h) renderer->set_render_depth(5 + ceil(_h)); + +bool onSegment(vec2f p, vec2f q, vec2f r); +int orientation(vec2f p, vec2f q, vec2f r); +bool lines_intersect(vec2f p1, vec2f q1, vec2f p2, vec2f q2); +vec2f get_intersection_point(vec2f A, vec2f B, vec2f C, vec2f D); +box get_render_box_of_square(platform_window* window, vec3f position, vec3f size); +box get_box_of_square(platform_window* window, vec3f position, vec3f size); + +#endif
\ No newline at end of file diff --git a/include/players.h b/include/players.h index 844cb17..ef94489 100644 --- a/include/players.h +++ b/include/players.h @@ -5,17 +5,8 @@ #include "map.h" #include "objects.h" - -typedef struct t_bullet { - bool active; - vec3f position; - float endx; - float endy; - float alive_time; -} bullet; - -bullet bullets[500] = {0}; -int max_bullets = 500; +#include "zombies.h" +#include "math_helper.h" float sec_since_last_shot = 10.0f; float playerx = 3; |
