1 //-------------------------------------------------------------------------
2 /*
3 Copyright (C) 2010-2019 EDuke32 developers and contributors
4 Copyright (C) 2019 Nuke.YKT
5 
6 This file is part of NBlood.
7 
8 NBlood is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License version 2
10 as published by the Free Software Foundation.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 
16 See the GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 */
22 //-------------------------------------------------------------------------
23 #pragma once
24 
25 #pragma pack(push, 1)
26 
27 union BUTTONFLAGS
28 {
29     int8_t byte;
30     struct
31     {
32         unsigned int jump : 1;
33         unsigned int crouch : 1;
34         unsigned int shoot : 1;
35         unsigned int shoot2 : 1;
36         unsigned int lookUp : 1;
37         unsigned int lookDown : 1;
38     };
39 };
40 
41 union KEYFLAGS
42 {
43     int16_t word;
44     struct
45     {
46         unsigned int action : 1;
47         unsigned int jab : 1;
48         unsigned int prevItem : 1;
49         unsigned int nextItem : 1;
50         unsigned int useItem : 1;
51         unsigned int prevWeapon : 1;
52         unsigned int nextWeapon : 1;
53         unsigned int holsterWeapon : 1;
54         unsigned int lookCenter : 1;
55         unsigned int lookLeft : 1;
56         unsigned int lookRight : 1;
57         unsigned int spin180 : 1;
58         unsigned int pause : 1;
59         unsigned int quit : 1;
60         unsigned int restart : 1;
61     };
62 };
63 
64 union USEFLAGS
65 {
66     uint8_t byte;
67     struct
68     {
69         unsigned int useBeastVision : 1;
70         unsigned int useCrystalBall : 1;
71         unsigned int useJumpBoots : 1;
72         unsigned int useMedKit : 1;
73     };
74 };
75 
76 union SYNCFLAGS
77 {
78     uint8_t byte;
79     struct
80     {
81         unsigned int buttonChange : 1;
82         unsigned int keyChange : 1;
83         unsigned int useChange : 1;
84         unsigned int weaponChange : 1;
85         unsigned int mlookChange : 1;
86         unsigned int run : 1;
87     };
88 };
89 struct GINPUT
90 {
91     SYNCFLAGS syncFlags;
92     int16_t forward;
93     fix16_t q16turn;
94     int16_t strafe;
95     BUTTONFLAGS buttonFlags;
96     KEYFLAGS keyFlags;
97     USEFLAGS useFlags;
98     uint8_t newWeapon;
99     fix16_t q16mlook;
100 };
101 
102 #pragma pack(pop)
103 
104 extern GINPUT gInput, gNetInput;
105 extern bool bSilentAim;
106 extern int32_t gMouseAim; // Should be an int32 due to being passed to OSD
107 
108 extern fix16_t gViewLook, gViewAngle;
109 extern float gViewAngleAdjust;
110 extern float gViewLookAdjust;
111 extern int gViewLookRecenter;
112 
113 int32_t ctrlCheckAllInput(void);
114 void ctrlClearAllInput(void);
115 void ctrlInit();
116 void ctrlGetInput();
117 
118