-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfork_knife.h
42 lines (33 loc) · 1.07 KB
/
fork_knife.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
#ifndef FORK_KNIFE_H
#define FORK_KNIFE_H
#include <stdint.h>
#include "math.h"
enum player_state { alive, wounded, dead };
typedef struct {
char *name; /**< Weapon name */
uint8_t max_ammo; /**< Maximum ammo */
uint8_t max_ammo_in_clip; /**< Maximum ammo in clip */
uint8_t ammo; /**< Current ammo */
uint8_t ammo_in_clip; /**< Current ammo in clip */
uint16_t range; /**< Shooting range */
} weapon_t;
typedef struct {
char *name; /**< The player's Steam name */
uint8_t max_health; /**< The maximum health */
uint8_t health; /**< Current player health */
weapon_t weapon; /**< Current weapon, NULL if no weapon */
player_state state; /**< Current player state */
} player_t;
/**
* Initialize world environment and spawn players
*/
void setup_world();
/**
* Shoot a player weapon.
*
* @param shooter The player initiating the shot
* @param direction The direction in which the player shoots
* @return player_t* Returns the shot player, NULL if no player was hit
*/
player_t *fire_weapon(player_t *shooter, vector_t direction);
#endif