aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities/samantha.c
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2025-12-19 02:23:24 +0000
committernathan <nathansmith@disroot.org>2025-12-19 02:23:24 +0000
commite4acecf8cebacbcbb6b7739aff7f34fd0147ed45 (patch)
tree90f266e8aee4b94682c318e9bc77ef6b1e034556 /src/entities/samantha.c
parent8394a306ed1d8dfdc9ca72e4c2c7888a4b79c576 (diff)
downloadFindThings-e4acecf8cebacbcbb6b7739aff7f34fd0147ed45.tar.gz
FindThings-e4acecf8cebacbcbb6b7739aff7f34fd0147ed45.tar.bz2
FindThings-e4acecf8cebacbcbb6b7739aff7f34fd0147ed45.zip
So little yet so much
Diffstat (limited to 'src/entities/samantha.c')
-rw-r--r--src/entities/samantha.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/entities/samantha.c b/src/entities/samantha.c
index bc70b7a..d3c345b 100644
--- a/src/entities/samantha.c
+++ b/src/entities/samantha.c
@@ -7,6 +7,17 @@ void initSamantha(Entity* entity)
.min = (Vector3){-SAMANTHA_WIDTH, -SAMANTHA_HEIGHT, -SAMANTHA_THICKNESS},
.max = (Vector3){SAMANTHA_WIDTH, SAMANTHA_HEIGHT, SAMANTHA_THICKNESS}
};
+
+ entity->data = FT_MALLOC(sizeof(Samantha));
+
+ if (entity->data == NULL)
+ {
+ ALLOCATION_ERROR;
+ return;
+ }
+
+ Samantha* samantha = (Samantha*)entity->data;
+ samantha->dialogCount = 0;
}
void updateSamantha(Entity* entity, Game* game)
@@ -21,17 +32,36 @@ void updateSamantha(Entity* entity, Game* game)
DrawModel(game->assets.models[SAMANTHA_MODEL], entity->position, 1.0, WHITE);
}
+void closeSamantha(Entity* entity)
+{
+ if (entity->data != NULL)
+ {
+ FT_FREE(entity->data);
+ }
+}
+
InteractionCommand interactWithSamantha(Entity* entity, Game* game,
Selection selection)
{
InteractionChat* chat = &game->chat;
+ Samantha* samantha = (Samantha*)entity->data;
switch (selection)
{
case SELECTION_INTERACT:
- writeToInteractionChat(chat, "hihi");
+ setInteractionChat(chat, "hihi");
return INTERACTION_TALK;
case SELECTION_NEXT_MESSAGE:
+ if (samantha->dialogCount == 0)
+ {
+ setInteractionChat(chat, "I WILL DESTROY THE WORLD");
+ ++samantha->dialogCount;
+ return INTERACTION_TALK;
+ }
+ else
+ {
+ return INTERACTION_END;
+ }
case SELECTION_LEAVE:
return INTERACTION_END;
default: