summaryrefslogtreecommitdiff
path: root/src/entity.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/entity.c')
-rw-r--r--src/entity.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/entity.c b/src/entity.c
index 53ee9d3..5f3a0dd 100644
--- a/src/entity.c
+++ b/src/entity.c
@@ -2,9 +2,12 @@
#include "game.h"
#include "map.h"
#include "cfg.h"
+#include "entitytag.h"
#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
-void
+static void
_points(Entity *this, int ox, int oy, int *x0, int *x1, int *y0, int *y1)
{
*x0 = this->pos[0] - this->width / 2 + ox;
@@ -13,6 +16,15 @@ _points(Entity *this, int ox, int oy, int *x0, int *x1, int *y0, int *y1)
*y1 = *y0 + this->height - 1;
}
+unsigned int
+entity_type(const char *type)
+{
+ for (unsigned int i = 0; i < num_entitytags; i++)
+ if (strcmp(type, entitytags[i]) == 0)
+ return i + 1;
+ fprintf(stderr, "unknown type '%s'\n", type);
+ return 0;
+}
bool
entity_collide(Entity *this, Game *g, int ox, int oy)