aboutsummaryrefslogtreecommitdiff
path: root/src/entities/antifaShip.c
diff options
context:
space:
mode:
authornathansmithsmith <thenathansmithsmith@gmail.com>2023-07-21 13:48:02 -0600
committernathansmithsmith <thenathansmithsmith@gmail.com>2023-07-21 13:48:02 -0600
commita408b352f13df546b2262ca01cf162b60891cdae (patch)
tree6a7f7053efbf01c65cb82df4478721c3a818f07a /src/entities/antifaShip.c
parentd4b40dcf7589bef2bbd0b6b940ee992da9db2343 (diff)
Sonic fast collision
Diffstat (limited to 'src/entities/antifaShip.c')
-rw-r--r--src/entities/antifaShip.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/entities/antifaShip.c b/src/entities/antifaShip.c
index 6fe4b66..94fc8c8 100644
--- a/src/entities/antifaShip.c
+++ b/src/entities/antifaShip.c
@@ -5,6 +5,8 @@
void initAntifaShip(Entity * entity, Game * game) {
entity->model = &game->assets.models[ANTIFA_SHIP_ASSET];
+ entity->collisionModel = entityCreateCollisionModel(*entity->model);
+ entity->transformedCollisionModel = entityCreateCollisionModel(*entity->model);
setEntityRadius(entity);
// Acceleration stuff.
@@ -31,6 +33,9 @@ void initAntifaShip(Entity * entity, Game * game) {
void closeAntifaShip(Entity * entity) {
if (entity->data != NULL)
KF_FREE(entity->data);
+
+ entityFreeCollisionModel(entity->collisionModel);
+ entityFreeCollisionModel(entity->transformedCollisionModel);
}
void controlAntifaShipJoystick(Game * game, Entity * entity) {
@@ -102,6 +107,8 @@ void controlAntifaShipKeyboardAndMouse(Game * game, Entity * entity) {
}
void updateAntifaShip(Game * game, Entity * entity) {
+ entityUpdateLastValues(entity);
+
switch (game->settings.controlMode) {
case JOYSTICK_CONTROL:
controlAntifaShipJoystick(game, entity);
@@ -112,6 +119,8 @@ void updateAntifaShip(Game * game, Entity * entity) {
default:
break;
}
+
+ entityCheckTransformedCollisionModel(entity);
}
void drawAntifaShip(Game * game, Entity * entity) {