/** * Copyright (c) 2024 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "assert/assert.h" #include "rpg/entity/entitydirection.h" #include "symbol.h" #include "game/time.h" char_t symbolGetCharByEntity(const entity_t *ent) { assertNotNull(ent, "Entity cannot be NULL."); switch(ent->type) { case ENTITY_TYPE_SIGN: return '+'; case ENTITY_TYPE_DOOR: return 'D'; default: break; } switch(ent->direction) { case ENTITY_DIRECTION_EAST: return '>'; case ENTITY_DIRECTION_WEST: return '<'; case ENTITY_DIRECTION_NORTH: return '^'; case ENTITY_DIRECTION_SOUTH: return 'v'; default: assertUnreachable("Invalid entity direction."); } } uint8_t symbolGetColorByEntity(const entity_t *ent) { assertNotNull(ent, "Entity cannot be NULL."); switch(ent->type) { case ENTITY_TYPE_PLAYER: return COLOR_RED; case ENTITY_TYPE_NPC: return COLOR_MAGENTA; case ENTITY_TYPE_SIGN: return COLOR_YELLOW; case ENTITY_TYPE_DOOR: return COLOR_BROWN; default: assertUnreachable("Invalid entity type."); } }