aboutsummaryrefslogtreecommitdiff
path: root/src/entities
diff options
context:
space:
mode:
authornathansmithsmith <thenathansmithsmith@gmail.com>2023-07-13 20:57:32 -0600
committernathansmithsmith <thenathansmithsmith@gmail.com>2023-07-13 20:57:32 -0600
commit9eeb5293fc0d022298fb772338241aa7e8672dac (patch)
treed6ddbaf8f0398d6c83125a64a8c42e1c71ea48b4 /src/entities
parentf368f2811a3f8ca0a4b9572b300358bd17d8dac1 (diff)
Half working mussolini
Diffstat (limited to 'src/entities')
-rw-r--r--src/entities/generale.c19
-rw-r--r--src/entities/generale.h12
-rw-r--r--src/entities/mussolini.c34
-rw-r--r--src/entities/mussolini.h12
4 files changed, 77 insertions, 0 deletions
diff --git a/src/entities/generale.c b/src/entities/generale.c
new file mode 100644
index 0000000..8e86e3f
--- /dev/null
+++ b/src/entities/generale.c
@@ -0,0 +1,19 @@
+#include "generale.h"
+#include "assets.h"
+#include "game.h"
+
+void initGenerale(Entity * entity, Game * game) {
+ entity->model = &game->assets.models[GENERALE_ASSET];
+ entity->velocity.angularVelocity = (AxisAngle){(Vector3){1.0, 1.0, 1.0}, 1.0};
+}
+
+void closeGenerale(Entity * entity) {
+}
+
+void updateGenerale(Game * game, Entity * entity) {
+ entityUpdateRotation(entity);
+}
+
+void drawGenerale(Game * game, Entity * entity) {
+ entityDraw(entity);
+}
diff --git a/src/entities/generale.h b/src/entities/generale.h
new file mode 100644
index 0000000..12b1ccb
--- /dev/null
+++ b/src/entities/generale.h
@@ -0,0 +1,12 @@
+#include "gameCommon.h"
+#include "entity.h"
+
+#ifndef GENERALE_H
+#define GENERALE_H
+
+void initGenerale(Entity * entity, Game * game);
+void closeGenerale(Entity * entity);
+void updateGenerale(Game * game, Entity * entity);
+void drawGenerale(Game * game, Entity * entity);
+
+#endif
diff --git a/src/entities/mussolini.c b/src/entities/mussolini.c
new file mode 100644
index 0000000..2770d2f
--- /dev/null
+++ b/src/entities/mussolini.c
@@ -0,0 +1,34 @@
+#include "mussolini.h"
+#include "assets.h"
+#include "game.h"
+
+void initMussolini(Entity * entity, Game * game) {
+ entity->model = &game->assets.models[MUSSOLINI_ASSET];
+}
+
+void closeMussolini(Entity * entity) {
+}
+
+void updateMussolini(Game * game, Entity * entity) {
+ Entity * player = getEntityFromWorld(game->world, 0);
+
+ float pitch = Vector2Angle(
+ (Vector2){entity->position.y, entity->position.x},
+ (Vector2){player->position.y, player->position.x}
+ );
+
+ float yaw = Vector2Angle(
+ (Vector2){entity->position.x, entity->position.z},
+ (Vector2){player->position.x, player->position.z}
+ );
+
+ entity->rotation = QuaternionFromEuler(
+ pitch - (PI/2),
+ -(yaw - (PI/2)),
+ 0.0
+ );
+}
+
+void drawMussolini(Game * game, Entity * entity) {
+ entityDraw(entity);
+}
diff --git a/src/entities/mussolini.h b/src/entities/mussolini.h
new file mode 100644
index 0000000..ee595f5
--- /dev/null
+++ b/src/entities/mussolini.h
@@ -0,0 +1,12 @@
+#include "gameCommon.h"
+#include "entity.h"
+
+#ifndef MUSSOLINI_H
+#define MUSSOLINI_H
+
+void initMussolini(Entity * entity, Game * game);
+void closeMussolini(Entity * entity);
+void updateMussolini(Game * game, Entity * entity);
+void drawMussolini(Game * game, Entity * entity);
+
+#endif