/** * Copyright (c) 2025 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "rpg/overworld/worldpos.h" typedef enum { ENTITY_DIR_UP = ENTITY_DIR_NORTH, ENTITY_DIR_DOWN = ENTITY_DIR_SOUTH, ENTITY_DIR_LEFT = ENTITY_DIR_WEST, ENTITY_DIR_RIGHT = ENTITY_DIR_EAST, } entitydir_t; /** * Gets the opposite direction of a given direction. * * @param dir The direction to get the opposite of. * @return entitydir_t The opposite direction. */ entitydir_t entityDirGetOpposite(const entitydir_t dir); /** * Asserts a given direction is valid. * * @param dir The direction to validate. * @param msg The message to display if the assertion fails. */ #define assertValidEntityDir(dir, msg) \ assertTrue( \ (dir) == ENTITY_DIR_NORTH || \ (dir) == ENTITY_DIR_EAST || \ (dir) == ENTITY_DIR_SOUTH || \ (dir) == ENTITY_DIR_WEST, \ msg \ ) /** * Gets the relative x and y offsets for a given direction. * * @param dir The direction to get offsets for. * @param relX Pointer to store the relative x offset. * @param relY Pointer to store the relative y offset. */ void entityDirGetRelative( const entitydir_t dir, worldunits_t *relX, worldunits_t *relY );