summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bullets.h2
-rw-r--r--include/list.h27
-rw-r--r--include/map.h2
-rw-r--r--include/objects.h4
-rw-r--r--include/pathfinding.h23
-rw-r--r--include/players.h25
-rw-r--r--include/zombies.h10
7 files changed, 79 insertions, 14 deletions
diff --git a/include/bullets.h b/include/bullets.h
index e8ddb86..ed64333 100644
--- a/include/bullets.h
+++ b/include/bullets.h
@@ -8,6 +8,7 @@
#include "map.h"
typedef struct t_bullet {
+ int player_id;
bool active;
vec3f position;
float endx;
@@ -18,6 +19,7 @@ typedef struct t_bullet {
bullet bullets[500] = {0};
int max_bullets = 500;
+void shoot(platform_window* window, player p);
void draw_bullets(platform_window* window);
#endif \ No newline at end of file
diff --git a/include/list.h b/include/list.h
new file mode 100644
index 0000000..d4809de
--- /dev/null
+++ b/include/list.h
@@ -0,0 +1,27 @@
+
+#ifndef INCLUDE_LIST
+#define INCLUDE_LIST
+
+#include <projectbase/project_base.h>
+
+typedef struct t_list_item
+{
+ void *next;
+ void *data;
+} list_item;
+
+typedef struct t_list
+{
+ list_item *start;
+ u32 count;
+ u16 size;
+} list;
+
+void list_destroy(list* list);
+list list_create(u16 size);
+list_item *list_push(list *list, void *data);
+void* list_at(list *list, u32 index);
+void list_remove_at(list *list, u32 index);
+void list_debug_print(list *list);
+
+#endif \ No newline at end of file
diff --git a/include/map.h b/include/map.h
index 82584e9..3bc8273 100644
--- a/include/map.h
+++ b/include/map.h
@@ -49,7 +49,7 @@ int map[MAP_SIZE_Y][MAP_SIZE_X] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
diff --git a/include/objects.h b/include/objects.h
index c4bb689..b7c14b3 100644
--- a/include/objects.h
+++ b/include/objects.h
@@ -28,8 +28,8 @@ typedef struct t_box {
vec2f br_u;
} box;
-object objects[50];
-int max_objects = 50;
+int max_objects = 150;
+object objects[150];
void create_objects();
void draw_objects_at_row(platform_window* window, int row);
diff --git a/include/pathfinding.h b/include/pathfinding.h
new file mode 100644
index 0000000..2b38766
--- /dev/null
+++ b/include/pathfinding.h
@@ -0,0 +1,23 @@
+#ifndef INCLUDE_PATHFINDING
+#define INCLUDE_PATHFINDING
+
+#include <projectbase/project_base.h>
+
+#include "players.h"
+#include "objects.h"
+#include "list.h"
+
+typedef struct t_pathfinding_request
+{
+ vec2f start;
+ vec2f end;
+ array *to_fill;
+ bool cancelled;
+ bool done;
+} pathfinding_request;
+
+array global_pathfinding_queue;
+
+void make_pathfinding_request(vec2f start, vec2f end, array *to_fill, pathfinding_request *request);
+
+#endif \ No newline at end of file
diff --git a/include/players.h b/include/players.h
index 7107797..cd7560f 100644
--- a/include/players.h
+++ b/include/players.h
@@ -8,15 +8,24 @@
#include "zombies.h"
#include "math_helper.h"
-float sec_since_last_shot = 10.0f;
-float playerx = 3;
-float playery = 3;
-float gunx = 0.0f;
-float guny = 0.0f;
-float gun_height = 0.0f;
+typedef struct t_player {
+ int id;
+ bool active;
+ float sec_since_last_shot;
+ float playerx;
+ float playery;
+ float gunx;
+ float guny;
+ float gun_height;
+} player;
-void shoot(platform_window* window);
-void draw_player(platform_window* window);
+int my_id = 1;
+
+int max_players = 10;
+player players[10] = {0};
+
+player get_player_by_id(int id);
+void draw_players_at_tile(platform_window* window, int x, int y);
void draw_bullets(platform_window* window);
float get_player_size(platform_window* window);
diff --git a/include/zombies.h b/include/zombies.h
index 44b2956..a8a58fe 100644
--- a/include/zombies.h
+++ b/include/zombies.h
@@ -5,12 +5,17 @@
#include "players.h"
#include "objects.h"
+#include "pathfinding.h"
typedef struct t_zombie {
bool alive;
float health;
vec3f position;
vec3f size;
+ array path;
+ array next_path;
+ float time_since_last_path;
+ pathfinding_request request;
} zombie;
typedef struct t_spawner {
@@ -20,11 +25,10 @@ typedef struct t_spawner {
// data data that is stored on disk
spawner spawner_tiles[2] = {
- {9, 0, 0},
- {1, 8, 0},
+ {15, 5, 999},
+ {3, 8, 999},
};
-
zombie zombies[50] = {0};
int max_zombies = 50;