Project

General

Profile

Statistics
| Revision:

root / proj / include / proj_structures.h @ 338

History | View | Annotate | Download (2.29 KB)

1
#ifndef PROJ_STRUCTURES_H_INCLUDED
2
#define PROJ_STRUCTURES_H_INCLUDED
3

    
4
#include <stdint.h>
5
#include "ent.h"
6

    
7
typedef struct keys {
8
    /// @brief W is pressed when 1
9
    uint8_t w_pressed       : 1;
10
    /// @brief A is pressed when 1
11
    uint8_t a_pressed       : 1;
12
    /// @brief S is pressed when 1
13
    uint8_t s_pressed       : 1;
14
    /// @brief D is pressed when 1
15
    uint8_t d_pressed       : 1;
16
    /// @brief Ctrl is pressed when 1
17
    uint8_t ctrl_pressed    : 1;
18
    /// @brief Plus (+) is pressed when 1
19
    uint8_t plus_pressed    : 1;
20
    /// @brief Minus (-) is pressed when 1
21
    uint8_t minus_pressed   : 1;
22
    /// @brief Mouse left button is pressed when 1
23
    uint8_t lb_pressed      : 1;
24
} keys_t;
25

    
26
typedef struct {
27
    // host
28
    /// @brief Host player X-position
29
    int16_t    host_x;
30
    /// @brief Host player Y-postition
31
    int16_t    host_y;
32
    /// @brief Host player angle
33
    int16_t    host_angle;
34
    /// @brief Host player health
35
    int16_t    host_health;
36
    /// @brief Host player current health
37
    int16_t    host_current_health;
38

    
39
    // remote
40
    /// @brief Remote player X-position
41
    int16_t    remote_x;
42
    /// @brief Remote player Y-postition
43
    int16_t    remote_y;
44
    /// @brief Remote player angle
45
    int16_t    remote_angle;
46
    /// @brief Remote player health
47
    int16_t    remote_health;
48
    /// @brief Remote player current health
49
    int16_t    remote_current_health;
50

    
51
    // bullets
52
    uint8_t    no_bullets;
53
    int16_t   *bullets_x;
54
    int16_t   *bullets_y;
55
    int16_t   *bullets_vx;
56
    int16_t   *bullets_vy;
57
    bool      *bullets_shooter; // false for host, true for remote
58
} host_info_t;
59

    
60
typedef struct {
61
    /// @brief Remote keys that are pressed
62
    keys_t  remote_keys_pressed;
63
    /// @brief Remote player angle
64
    double  remote_angle;
65
} remote_info_t;
66

    
67
typedef struct {
68
    /// @brief New bullet signal from remote
69
    bool   new_bullet;
70
} bullet_info_t;
71

    
72
host_info_t* host_info_ctor(gunner_t *host, gunner_t *remote);
73

    
74
void host_info_dtor(host_info_t *p);
75

    
76
remote_info_t* remote_info_ctor(void);
77

    
78
void remote_info_dtor(remote_info_t *p);
79

    
80
bullet_info_t* bullet_info_ctor(void);
81

    
82
void bullet_info_dtor(bullet_info_t *p);
83

    
84
#endif /* end of include guard: PROJ_STRUCTURES_H_INCLUDED */