visibility determination
[vrlugburz] / src / player.h
1 #ifndef PLAYER_H_
2 #define PLAYER_H_
3
4 #include "cgmath/cgmath.h"
5 #include "level.h"
6
7 struct player {
8         struct level *lvl;
9         struct cell *vis;       /* cell visibility list */
10
11         int cx, cy;
12         cgm_vec3 cpos;          /* cell position (derived from cx,cy) */
13         float theta, phi;       /* mouselook/VR controller rotation (theta only) */
14         cgm_vec3 vpos;          /* VR position within the cell */
15         cgm_quat vrot;          /* VR orientation */
16
17         int dir;                        /* cardinal direction, clockwise, 0 is north */
18         float height;
19
20         /* view matrix, derived from all of the above by upd_player_xform */
21         float view_xform[16];
22
23         int hp, mp, hp_max, mp_max;
24 };
25
26 void init_player(struct player *p);
27
28 void move_player(struct player *p, int right, int fwd);
29 void turn_player(struct player *p, int turn);
30
31 void upd_player_xform(struct player *p);
32
33 void upd_player_vis(struct player *p);
34
35 #endif  /* PLAYER_H_ */