1 #include "game_common.h"
4 const char *status_to_str(int s)
8 case GAME_NONE: return _("Aborted");
9 case GAME_TIME: return _("Time-out");
10 case GAME_GOAL: return _("Success");
11 case GAME_FALL: return _("Fall-out");
12 default: return _("Unknown");
16 const char *view_to_str(int v)
20 case VIEW_CHASE: return _("Chase");
21 case VIEW_LAZY: return _("Lazy");
22 case VIEW_MANUAL: return _("Manual");
23 case VIEW_TOPDOWN: return _("Top-Down");
24 default: return _("Unknown");
28 /*---------------------------------------------------------------------------*/
30 void game_tilt_init(struct game_tilt *tilt)
46 * Compute appropriate tilt axes from the view basis.
48 void game_tilt_axes(struct game_tilt *tilt, float view_e[3][3])
50 const float Y[3] = { 0.0f, 1.0f, 0.0f };
52 v_cpy(tilt->x, view_e[0]);
53 v_cpy(tilt->z, view_e[2]);
55 /* Handle possible top-down view. */
57 if (fabsf(v_dot(view_e[1], Y)) < fabsf(v_dot(view_e[2], Y)))
58 v_inv(tilt->z, view_e[1]);
61 void game_tilt_grav(float h[3], const float g[3], const struct game_tilt *tilt)
67 /* Compute the gravity vector from the given world rotations. */
69 m_rot (Z, tilt->z, V_RAD(tilt->rz));
70 m_rot (X, tilt->x, V_RAD(tilt->rx));
75 /*---------------------------------------------------------------------------*/