summaryrefslogtreecommitdiff
path: root/player.c
diff options
context:
space:
mode:
Diffstat (limited to 'player.c')
-rw-r--r--player.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/player.c b/player.c
new file mode 100644
index 0000000..2ba3885
--- /dev/null
+++ b/player.c
@@ -0,0 +1,33 @@
+#include "maths.h"
+#include "plat.h"
+#include "player.h"
+#include "services.h"
+
+void init_player(Player* p) {
+ int ip[] = { 0, 0, -(5 << fbits) };
+ vec_cpy(p->p, ip, 3);
+ p->r[0] = 0;
+ p->r[1] = 0;
+}
+
+void update_player(Player* p, struct Services* s) {
+ App* a = s->a;
+/* p->r[0] -= a->dmy;*/
+ p->r[1] -= a->dmx;
+/* p->p[0] -= sin_table[p->r[1] & sin_table_mask] / 3;
+ p->p[2] += cos_table[p->r[1] & sin_table_mask] / 3;*/
+}
+
+void push_player_cam(const Player* p) {
+ int v[3];
+ v[0] = -p->p[0];
+ v[1] = -p->p[1];
+ v[2] = -p->p[2];
+ mtx_push_rot_y(p->r[1] / 10);
+ mtx_push_rot_x(p->r[0] / 10);
+ mtx_push_trans(v);
+}
+
+void pop_player_cam(void) {
+ mtx_popn(3);
+}