#define GAME_COMMON_H
#include "lang.h"
+#include "solid_vary.h"
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
+extern const float GRAVITY_UP[];
+extern const float GRAVITY_DN[];
+
struct game_tilt
{
float x[3], rx;
/*---------------------------------------------------------------------------*/
+struct game_view
+{
+ float dc; /* Ideal view distance above ball */
+ float dp; /* Ideal view distance above ball */
+ float dz; /* Ideal view distance behind ball */
+
+ float c[3]; /* Current view center */
+ float p[3]; /* Current view position */
+ float e[3][3]; /* Current view reference frame */
+
+ float a; /* Ideal view rotation about Y axis */
+};
+
+void game_view_init(struct game_view *);
+void game_view_fly(struct game_view *, const struct s_vary *, float);
+
+/*---------------------------------------------------------------------------*/
+
+#define UPS 90
+#define DT (1.0f / (float) UPS)
+
+/*
+ * Simple fixed time step scheme.
+ */
+
+struct lockstep
+{
+ void (*step)(float);
+
+ float dt; /* Time step length */
+ float at; /* Accumulator */
+ float ts; /* Time scale factor */
+};
+
+void lockstep_clr(struct lockstep *);
+void lockstep_run(struct lockstep *, float);
+void lockstep_scl(struct lockstep *, float);
+
+#define lockstep_blend(ls) ((ls)->at / (ls)->dt)
+
+/*---------------------------------------------------------------------------*/
+
#endif