aboutsummaryrefslogtreecommitdiffstats
path: root/src/entity.c
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2025-12-18 10:23:19 +0000
committernathan <nathansmith@disroot.org>2025-12-18 10:23:19 +0000
commitbcdd09d5075c9755538a93db8e3ca2690a803cc1 (patch)
tree25a9e2e307bcc7d0908a81f7de6f365ab9230ff1 /src/entity.c
parentedaafadf2c5de7f23dfc20d420e973ed9dc92039 (diff)
downloadFindThings-bcdd09d5075c9755538a93db8e3ca2690a803cc1.tar.gz
FindThings-bcdd09d5075c9755538a93db8e3ca2690a803cc1.tar.bz2
FindThings-bcdd09d5075c9755538a93db8e3ca2690a803cc1.zip
Finally getting interaction stuff done
Diffstat (limited to 'src/entity.c')
-rw-r--r--src/entity.c47
1 files changed, 30 insertions, 17 deletions
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);