rasterized clamp top/bottom
[gbajam22] / src / player.c
1 #include "player.h"
2 #include "gbaregs.h"
3 #include "xgl.h"
4
5 void player_input(struct player *p, uint16_t bnstate)
6 {
7         if(bnstate & KEY_UP) {
8                 p->phi += 0x800;
9                 if(p->phi > X_HPI) p->phi = X_HPI;
10         }
11         if(bnstate & KEY_DOWN) {
12                 p->phi -= 0x800;
13                 if(p->phi < -X_HPI) p->phi = -X_HPI;
14         }
15         if(bnstate & KEY_LEFT) {
16                 p->theta += 0x800;
17                 if(p->theta > X_2PI) p->theta -= X_2PI;
18         }
19         if(bnstate & KEY_RIGHT) {
20                 p->theta -= 0x800;
21                 if(p->theta < X_2PI) p->theta += X_2PI;
22         }
23         if(bnstate & KEY_A) {
24                 p->y += 0x1000;
25         }
26         if(bnstate & KEY_B) {
27                 p->y -= 0x1000;
28         }
29 }