summaryrefslogtreecommitdiff
path: root/player.c
blob: 2ba3885fd2513f22792097597a29846190685344 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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);
}