Project

General

Profile

Statistics
| Revision:

root / proj / include / proj_structures.h @ 336

History | View | Annotate | Download (2.29 KB)

1 312 up20180655
#ifndef PROJ_STRUCTURES_H_INCLUDED
2
#define PROJ_STRUCTURES_H_INCLUDED
3
4
#include <stdint.h>
5 320 up20180655
#include "ent.h"
6 312 up20180655
7
typedef struct keys {
8 336 up20180642
    /// @brief W is pressed when 1
9 312 up20180655
    uint8_t w_pressed       : 1;
10 336 up20180642
    /// @brief A is pressed when 1
11 312 up20180655
    uint8_t a_pressed       : 1;
12 336 up20180642
    /// @brief S is pressed when 1
13 312 up20180655
    uint8_t s_pressed       : 1;
14 336 up20180642
    /// @brief D is pressed when 1
15 312 up20180655
    uint8_t d_pressed       : 1;
16 336 up20180642
    /// @brief Ctrl is pressed when 1
17 312 up20180655
    uint8_t ctrl_pressed    : 1;
18 336 up20180642
    /// @brief Plus (+) is pressed when 1
19 312 up20180655
    uint8_t plus_pressed    : 1;
20 336 up20180642
    /// @brief Minus (-) is pressed when 1
21 312 up20180655
    uint8_t minus_pressed   : 1;
22 336 up20180642
    /// @brief Mouse left button is pressed when 1
23 312 up20180655
    uint8_t lb_pressed      : 1;
24
} keys_t;
25
26 321 up20180642
typedef struct {
27 312 up20180655
    // host
28 336 up20180642
    /// @brief Host player X-position
29 329 up20180655
    int16_t    host_x;
30 336 up20180642
    /// @brief Host player Y-postition
31 329 up20180655
    int16_t    host_y;
32 336 up20180642
    /// @brief Host player angle
33 329 up20180655
    int16_t    host_angle;
34 336 up20180642
    /// @brief Host player health
35 329 up20180655
    int16_t    host_health;
36 336 up20180642
    /// @brief Host player current health
37 329 up20180655
    int16_t    host_current_health;
38 312 up20180655
39
    // remote
40 336 up20180642
    /// @brief Remote player X-position
41 329 up20180655
    int16_t    remote_x;
42 336 up20180642
    /// @brief Remote player Y-postition
43 329 up20180655
    int16_t    remote_y;
44 336 up20180642
    /// @brief Remote player angle
45 329 up20180655
    int16_t    remote_angle;
46 336 up20180642
    /// @brief Remote player health
47 329 up20180655
    int16_t    remote_health;
48 336 up20180642
    /// @brief Remote player current health
49 329 up20180655
    int16_t    remote_current_health;
50 312 up20180655
51
    // bullets
52 329 up20180655
    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 312 up20180655
} host_info_t;
59
60 321 up20180642
typedef struct {
61 336 up20180642
    /// @brief Remote keys that are pressed
62 312 up20180655
    keys_t  remote_keys_pressed;
63 336 up20180642
    /// @brief Remote player angle
64 320 up20180655
    double  remote_angle;
65 312 up20180655
} remote_info_t;
66
67 321 up20180642
typedef struct {
68 336 up20180642
    /// @brief New bullet signal from remote
69 320 up20180655
    bool   new_bullet;
70
} bullet_info_t;
71
72
host_info_t* host_info_ctor(gunner_t *host, gunner_t *remote);
73
74 312 up20180655
void host_info_dtor(host_info_t *p);
75
76 324 up20180642
remote_info_t* remote_info_ctor(void);
77 320 up20180655
78 312 up20180655
void remote_info_dtor(remote_info_t *p);
79
80 324 up20180642
bullet_info_t* bullet_info_ctor(void);
81 320 up20180655
82
void bullet_info_dtor(bullet_info_t *p);
83
84 312 up20180655
#endif /* end of include guard: PROJ_STRUCTURES_H_INCLUDED */