#include "samantha.h" #include "ui.h" void initSamantha(Entity* entity) { entity->box = (BoundingBox){ .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) { // silly tv static effect. game->assets.models[SAMANTHA_MODEL].materials[0] .maps[MATERIAL_MAP_DIFFUSE].texture = game->assets.textures[ SAMANTHA_1_TEXTURE + ((int)(GetTime() * SAMANTHA_STATIC_SPEED) % SAMANTHA_STATIC_FRAMES)]; 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->interactionChat; Samantha* samantha = (Samantha*)entity->data; switch (selection) { case SELECTION_INTERACT: 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 { samantha->dialogCount = 0; return INTERACTION_END; } case SELECTION_LEAVE: samantha->dialogCount = 0; return INTERACTION_END; default: return INTERACTION_END; } }