/** * Copyright (c) 2024 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "dawn.h" typedef enum { ENTITY_DIRECTION_SOUTH = 0, ENTITY_DIRECTION_NORTH = 1, ENTITY_DIRECTION_WEST = 2, ENTITY_DIRECTION_EAST = 3 } entitydirection_t; /** * Returns the offset for a given direction. * * @param dir Direction to get offset for. * @param x Pointer to store x offset. * @param y Pointer to store y offset. */ void entityDirectionOffsetGet( const entitydirection_t dir, uint16_t *x, uint16_t *y ); /** * Adds the offset for a given direction to the given x and y. * * @param dir Direction to get offset for. * @param x Pointer to add x offset to. * @param y Pointer to add y offset to. */ void entityDirectionOffsetAdd( const entitydirection_t dir, uint16_t *x, uint16_t *y ); /** * Returns the direction to look at from one point to another. * * @param srcX Source X position. * @param srcY Source Y position. * @param trgX Target X position. * @param trgY Target Y position. * @return Direction to look at. */ entitydirection_t entityDirectionLookAt( const uint16_t srcX, const uint16_t srcY, const uint16_t trgX, const uint16_t trgY );