3 void init_player(struct player *p)
5 memset(p, 0, sizeof *p);
6 cgm_qcons(&p->vrot, 0, 0, 0, 1);
9 p->hp = p->hp_max = 10;
10 p->mp = p->mp_max = 10;
13 void upd_player_xform(struct player *p)
16 float celld = p->lvl ? p->lvl->cell_size : DEF_CELL_SIZE;
18 cgm_vcons(&pos, p->cx * celld, p->height, -p->cy * celld);
19 cgm_vadd(&pos, &p->cpos);
21 cgm_midentity(p->view_xform);
22 cgm_mprerotate_x(p->view_xform, -p->phi);
23 cgm_mprerotate_y(p->view_xform, -p->theta);
24 cgm_mrotate_quat(p->view_xform, &p->vrot);
25 cgm_mpretranslate(p->view_xform, -pos.x, -pos.y, -pos.z);