7 void init_player(struct player *p, struct level *lvl)
9 memset(p, 0, sizeof *p);
12 cell_to_pos(lvl, lvl->orgx, lvl->orgy, &p->x, &p->y);
13 p->cell = level_cell(lvl, lvl->orgx, lvl->orgy);
16 void player_input(struct player *p, uint16_t bnstate)
18 if(bnstate & KEY_UP) {
20 if(p->phi > X_HPI) p->phi = X_HPI;
22 if(bnstate & KEY_DOWN) {
24 if(p->phi < -X_HPI) p->phi = -X_HPI;
26 if(bnstate & KEY_LEFT) {
28 if(p->theta >= X_2PI) p->theta -= X_2PI;
30 if(bnstate & KEY_RIGHT) {
32 if(p->theta < 0) p->theta += X_2PI;