diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-07 23:10:23 -0600 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-07 23:10:23 -0600 |
commit | e5268813dcbdc0d90a081b2223ebc21749038635 (patch) | |
tree | 7c917996749e4123fb1fe49ddd1ed3b8f7e92334 /src/entity.c | |
parent | a90e1987de75cfecc2693952625af8cce507ae95 (diff) |
Better world
Diffstat (limited to 'src/entity.c')
-rw-r--r-- | src/entity.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/entity.c b/src/entity.c index c88c767..f4066b5 100644 --- a/src/entity.c +++ b/src/entity.c @@ -1,9 +1,11 @@ #include "entity.h" #include "entities/antifaShip.h" +#include "entities/soldato.h" // This fucker is used for creating entities. const EntityTypeInfo entityTypeInfo[ENTITY_TYPE_COUNT] = { - (EntityTypeInfo){initAntifaShip, closeAntifaShip, updateAntifaShip, drawAntifaShip} + (EntityTypeInfo){initAntifaShip, closeAntifaShip, updateAntifaShip, drawAntifaShip}, + (EntityTypeInfo){initSoldato, closeSoldato, updateSoldato, drawSoldato} }; EntityVelocity entityVelocityIdentity() { @@ -32,7 +34,7 @@ Vector3 accelerateVector3(Vector3 value, Vector3 lastValue, Vector3 up, Vector3 }; } -Entity createEntity(EntityType type) { +Entity createEntity(EntityType type, Game * game) { EntityTypeInfo info = entityTypeInfo[type]; // Set defaults. @@ -49,7 +51,7 @@ Entity createEntity(EntityType type) { }; // Init. - info.initCb(&entity); + info.initCb(&entity, game); return entity; } @@ -60,10 +62,10 @@ void closeEntity(Entity * entity) { // Basic wireframe drawing. void entityDraw(Entity * entity) { - entity->model.transform = QuaternionToMatrix(entity->rotation); + entity->model->transform = QuaternionToMatrix(entity->rotation); DrawModelWires( - entity->model, + *entity->model, entity->position, 1, GREEN @@ -110,8 +112,8 @@ void entityJoystickControl(Entity * entity, Vector3 stick, float speed) { st = accelerateVector3( stick, entity->lastVelocity.stick, - Vector3Scale(entity->acceleration.rotationUp, t), - Vector3Scale(entity->acceleration.rotationDown, t) + Vector3Scale(entity->acceleration.rotation, t), + Vector3Scale(entity->acceleration.rotation, t) ); } |