From bcdd09d5075c9755538a93db8e3ca2690a803cc1 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 18 Dec 2025 03:23:19 -0700 Subject: Finally getting interaction stuff done --- src/entity.c | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) (limited to 'src/entity.c') diff --git a/src/entity.c b/src/entity.c index 90ee641..92d4cf2 100644 --- a/src/entity.c +++ b/src/entity.c @@ -3,22 +3,27 @@ #include "entitiesInclude.h" const EntityEntry entityEntries[ENTITY_COUNT] = { - (EntityEntry){initOldMint, updateOldMint, NULL, NULL, false, true}, - (EntityEntry){initStickyNickel, updateStickyNickel, NULL, NULL, false, true}, - (EntityEntry){initTree, updateTree, NULL, NULL, false, true}, - (EntityEntry){initBush, updateBush, NULL, NULL, false, true}, - (EntityEntry){initFlower, updateFlower, NULL, NULL, false, true}, - (EntityEntry){initPond, updatePond, NULL, NULL, true, true}, - (EntityEntry){initUtilityPole, NULL, NULL, NULL, false, false}, - (EntityEntry){initSamantha, updateSamantha, NULL, interactWithSamantha, - false, true}, - (EntityEntry){initSamanthasSpot, updateSamanthasSpot, NULL, NULL, true, + (EntityEntry){"Old Mint", initOldMint, updateOldMint, NULL, NULL, false, + true}, + (EntityEntry){"Sticky Nickel", initStickyNickel, updateStickyNickel, NULL, + NULL, false, true}, + (EntityEntry){"Tree", initTree, updateTree, NULL, NULL, false, true}, + (EntityEntry){"Bush", initBush, updateBush, NULL, NULL, false, true}, + (EntityEntry){"Flower", initFlower, updateFlower, NULL, NULL, false, true}, + (EntityEntry){"Pond", initPond, updatePond, NULL, NULL, true, true}, + (EntityEntry){"Utility Pole", initUtilityPole, NULL, NULL, NULL, false, false}, - (EntityEntry){initTrashcan, updateTrashcan, NULL, NULL, false, true}, - (EntityEntry){initTrash, updateTrash, NULL, NULL, false, true}, - (EntityEntry){initMedicalTrash, updateMedicalTrash, NULL, NULL, false, true}, - (EntityEntry){initJohn, updateJohn, NULL, NULL, false, true}, - (EntityEntry){initRon, updateRon, NULL, NULL, false, true} + (EntityEntry){"Samantha", initSamantha, updateSamantha, NULL, + interactWithSamantha, false, true}, + (EntityEntry){"Samantha's Spot", initSamanthasSpot, updateSamanthasSpot, + NULL, NULL, true, false}, + (EntityEntry){"Trashcan", initTrashcan, updateTrashcan, NULL, NULL, false, + true}, + (EntityEntry){"Trash", initTrash, updateTrash, NULL, NULL, false, true}, + (EntityEntry){"Medical Trash", initMedicalTrash, updateMedicalTrash, NULL, + NULL, false, true}, + (EntityEntry){"John", initJohn, updateJohn, NULL, NULL, false, true}, + (EntityEntry){"Ron", initRon, updateRon, NULL, NULL, false, true} }; Entity createEntity(EntityId id, Vector3 position) @@ -43,8 +48,6 @@ Entity createEntity(EntityId id, Vector3 position) void updateEntity(Entity* entity, Game* game) { - //DrawBoundingBox(entity->box, BLUE); - if (entity->id == ENTITY_NONE) { return; @@ -76,6 +79,16 @@ void closeEntity(Entity* entity) entity->id = ENTITY_NONE; } +const char* getEntityName(EntityId id) +{ + if (id == ENTITY_NONE) + { + return NULL; + } + + return entityEntries[id].name; +} + void setEntityPosition(Entity* entity, Vector3 position) { Vector3 movedBy = Vector3Subtract(position, entity->position); -- cgit v1.2.3