-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.h
57 lines (50 loc) · 1.1 KB
/
player.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// player state and movement
#ifndef __PLAYER_H
#define __PLAYER_H
// player state
typedef struct {
uint8_t tx, ty; // tile pos
int16_t px, py; // pixel pos
uint16_t score;
uint8_t lives;
// on ground flag
uint8_t on_ground;
// last facing direction
int8_t last_dir;
uint16_t tick;
// input flags
uint8_t try_right;
uint8_t try_left;
uint8_t try_jump;
uint8_t try_fire;
uint8_t try_jetpack;
uint8_t try_up, try_down; // jetpack/climbing
uint8_t do_right;
uint8_t do_left;
uint8_t do_jump;
uint8_t do_fire;
uint8_t do_jetpack;
uint8_t do_up, do_down;
uint8_t jump_timer;
uint8_t dead_timer;
// pickup tile pos
uint8_t check_pickup_x;
uint8_t check_pickup_y;
// door was hit, check if passable
uint8_t check_door;
// item flags; jetpack is also fuel count
uint8_t trophy, gun, jetpack;
// bullet
uint16_t bullet_px, bullet_py;
int8_t bullet_dir;
// collision point clear flags; 1 = clear
uint8_t col_point[8];
} player_state_t;
void P_Spawn();
void P_PickupItem();
void P_UpdateCollision();
void P_UpdateBullet();
void P_VerifyInput();
void P_Move();
void P_ApplyGravity();
#endif