2018-07-18 06:24:38 +00:00
|
|
|
// player state and movement
|
|
|
|
#ifndef __PLAYER_H
|
|
|
|
#define __PLAYER_H
|
|
|
|
|
|
|
|
// player state
|
|
|
|
typedef struct {
|
|
|
|
uint8_t tx, ty; // tile pos
|
2018-07-22 03:26:09 +00:00
|
|
|
int16_t px, py; // pixel pos
|
2018-07-18 06:24:38 +00:00
|
|
|
uint16_t score;
|
|
|
|
uint8_t lives;
|
|
|
|
// on ground flag
|
|
|
|
uint8_t on_ground;
|
2018-07-20 05:40:51 +00:00
|
|
|
// last facing direction
|
|
|
|
int8_t last_dir;
|
2018-08-11 03:19:28 +00:00
|
|
|
uint16_t tick;
|
2018-07-18 06:24:38 +00:00
|
|
|
|
|
|
|
// 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;
|
2018-07-29 02:17:56 +00:00
|
|
|
uint8_t dead_timer;
|
2018-07-18 06:24:38 +00:00
|
|
|
// 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;
|
2018-07-20 05:40:51 +00:00
|
|
|
// bullet
|
|
|
|
uint16_t bullet_px, bullet_py;
|
|
|
|
int8_t bullet_dir;
|
2018-07-18 06:24:38 +00:00
|
|
|
|
|
|
|
// collision point clear flags; 1 = clear
|
|
|
|
uint8_t col_point[8];
|
|
|
|
} player_state_t;
|
|
|
|
|
|
|
|
void P_Spawn();
|
|
|
|
void P_PickupItem();
|
|
|
|
void P_UpdateCollision();
|
2018-07-20 05:40:51 +00:00
|
|
|
void P_UpdateBullet();
|
2018-07-18 06:24:38 +00:00
|
|
|
void P_VerifyInput();
|
|
|
|
void P_Move();
|
|
|
|
void P_ApplyGravity();
|
|
|
|
|
|
|
|
#endif
|