aboutsummaryrefslogtreecommitdiff
path: root/src/bullets.h
diff options
context:
space:
mode:
authornathansmithsmith <thenathansmithsmith@gmail.com>2023-07-20 03:08:57 -0600
committernathansmithsmith <thenathansmithsmith@gmail.com>2023-07-20 03:08:57 -0600
commit43e31b6e124da754ef928d22fbb9a1d7640aab4b (patch)
tree698f723866bd99982a6c606c63cfa0387863e2db /src/bullets.h
parentf3f5fedbf591c10fa675a32103bab9480b42abe8 (diff)
New bullet system
Diffstat (limited to 'src/bullets.h')
-rw-r--r--src/bullets.h29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/bullets.h b/src/bullets.h
index a01a967..eb6c15c 100644
--- a/src/bullets.h
+++ b/src/bullets.h
@@ -1,34 +1,29 @@
#include "gameCommon.h"
#include "entity.h"
+#include "world.h"
#ifndef BULLET_H
#define BULLET_H
// Just a simple, deadly, bullet.
typedef struct Bullet {
- bool hit;
Ray ray;
EntityId fromId;
- EntityFingerprint fromFingerprint; // Shooter gets shot before bullet hits object hehe.
+ EntityFingerprint fromFingerprint;
float damage;
} Bullet;
-// All the simple, deadly, bullets.
-typedef struct Bullets {
- Bullet * bullets;
- size_t bulletsCount;
-} Bullets;
-
-// Create the simple, deadly, bullet. offset is the bullet offset from the entity.
-Bullet createBullet(Entity entity, Vector3 direction, Vector3 offset, float damage);
-
-void initBullets(Bullets * bullets);
-void freeBullets(Bullets * bullets);
+typedef struct BulletHitInfo {
+ bool hit;
+ bool killed;
+ EntityId hitId;
+ EntityFingerprint hitFingerprint;
+} BulletHitInfo;
-KfError addBullet(Bullets * bullets, Bullet bullet);
-KfError popBackBullets(Bullets * bullets);
+// Uses entity postion and direction to create bullet ray.
+Bullet createBulletFromEntity(Entity entity, float damage);
-void updateBullets(Game * game, Bullets * bullets);
-void updateBullet(Game * game, Bullet * bullet);
+// Shoot this fucker.
+BulletHitInfo shootBullet(World * world, Bullet bullet);
#endif