
/*********************************************************************
 ** Copyright (c) 1992-2022 MAK Technologies, Inc.
 ** All rights reserved.
 *********************************************************************/


/*********************************************************************
 **
 *t  diguyMotionDirection Type Declaration
 **
 */

#ifndef __diguyMotionDirection_H
#define __diguyMotionDirection_H

#ifdef SWIG
%module diguyMotionDirection
#else
#define CPLUSPLUS_ONLY
#endif

extern "C" {

#include <declspec_diguy.h>


/****************************************************************************/
typedef enum {
   DIGUY_MOTION_DIRECTION_NONE = 0,
   DIGUY_MOTION_DIRECTION_FORWARD,
   DIGUY_MOTION_DIRECTION_BACKWARD,
   DIGUY_MOTION_DIRECTION_LEFT,
   DIGUY_MOTION_DIRECTION_RIGHT,
   DIGUY_MOTION_DIRECTION_LOCOMOTION,

   DIGUY_MOTION_DIRECTION_UP,
   DIGUY_MOTION_DIRECTION_DOWN,
   DIGUY_MOTION_DIRECTION_TURN_LEFT,
   DIGUY_MOTION_DIRECTION_TURN_RIGHT,
   DIGUY_MOTION_DIRECTION_NONLINEAR,
   DIGUY_MOTION_DIRECTION_LINEAR_OFFAXIS,
   DIGUY_MOTION_DIRECTION_INHERIT,
   DIGUY_MOTION_DIRECTION_UNKNOWN,
   DIGUY_MOTION_DIRECTION_COUNT
} diguyMotionDirection;

/*l
 *b  Description:
 **
 **    This function converts the passed direction enumeration into
 **    a NULL-terminated C-style string.
 **
 *b  Returns:
 **
 **    C-style string identifying direction
 **
 *b  Callable From:
 **
 *-    - C++
 *-    - Script
 */
BDI_DECLSPEC_diguy
const char* diguy_motion_direction_to_string(diguyMotionDirection direction);

/*l
 *b  Description:
 **
 **    This function converts the passed C-style string into an
 **    enumerated value.
 **
 **    Directions are used in functions such as
 **    diguyCharacter::get_action_from_description().
 **
 *b  Returns:
 **
 **    enumeration value of direction
 **
 *b  Callable From:
 **
 *-    - C++
 *-    - Script
 */
BDI_DECLSPEC_diguy
diguyMotionDirection diguy_motion_direction_from_string(const char* string);

/*l
 *b  Description:
 **
 **    This function converts the passed direction enumeration into
 **    a floating point angle.  The returned angle is in degrees.
 **
 **    Currently only the following directions return useful angles:
 **
 *-      - DIGUY_MOTION_DIRECTION_FORWARD  (angle = 0)
 *-      - DIGUY_MOTION_DIRECTION_BACKWARD (angle = 180)
 *-      - DIGUY_MOTION_DIRECTION_LEFT     (angle = 90)
 *-      - DIGUY_MOTION_DIRECTION_RIGHT    (angle = 270)
 **
 **    All other directions return an angle of 0.
 **
 *b  Returns:
 **
 **    yaw angle of direction in degrees
 **
 *b  Callable From:
 **
 *-    - C++
 *-    - Script
 */
BDI_DECLSPEC_diguy
float diguy_motion_direction_to_angle(diguyMotionDirection direction);

/*l
 *b  Description:
 **
 **    This function converts the passed angle into a
 **    direction enumeration.
 **
 **    Currently only the following directions will be returned:
 **
 *-      - DIGUY_MOTION_DIRECTION_FORWARD  (angle approx. 0)
 *-      - DIGUY_MOTION_DIRECTION_BACKWARD (angle approx. 180)
 *-      - DIGUY_MOTION_DIRECTION_LEFT     (angle approx. 90)
 *-      - DIGUY_MOTION_DIRECTION_RIGHT    (angle approx. 270)
 *-      - DIGUY_MOTION_DIRECTION_UNKNOWN  (everything else)
 **
 **    If the passed angle isn't within the specified error amount
 **    of any direction's "exact" angle, the value
 **    DIGUY_MOTION_DIRECTION_UNKNOWN will be returned.
 **
 *b  Arguments:
 **
 *a    angle         - angle for which to retrieve direction, in degrees
 *a    allowed_error - how much error there can be from the
 *a                    direction's "exact" angle
 **
 *b  Returns:
 **
 **    enumeration value of direction
 **
 *b  Callable From:
 **
 *-    - C++
 *-    - Script
 */
BDI_DECLSPEC_diguy
diguyMotionDirection diguy_motion_direction_from_angle(float angle,
   float allowed_error = 1.0f);


} /* end extern "C" */

#endif /* __diguyMotionDirection_H */


/*********************************************************************
 ** Copyright (c) 1992-2022 MAK Technologies, Inc.
 ** All rights reserved.
 *********************************************************************/

