1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id: d_ticcmd.h 1502 2020-03-17 02:30:10Z wesleyjohnson $
5 //
6 // Copyright (C) 1993-1996 by id Software, Inc.
7 // Portions Copyright (C) 1998-2000 by DooM Legacy Team.
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 //
20 // $Log: d_ticcmd.h,v $
21 // Revision 1.4  2001/03/03 06:17:33  bpereira
22 // Revision 1.3  2000/08/31 14:30:55  bpereira
23 // Revision 1.2  2000/02/27 00:42:10  hurdler
24 // Revision 1.1.1.1  2000/02/22 20:32:32  hurdler
25 // Initial import into CVS (v1.29 pr3)
26 //
27 //
28 // DESCRIPTION:
29 //     On Tick button and command interface stuff.
30 //
31 //-----------------------------------------------------------------------------
32 
33 
34 #ifndef D_TICCMD_H
35 #define D_TICCMD_H
36 
37 #include "doomdef.h"
38   // CLIENTPREDICTION
39 #include "doomtype.h"
40 #include "m_fixed.h"
41 
42 #ifdef __GNUG__
43 #pragma interface
44 #endif
45 
46 
47 //
48 // Button/action code definitions.
49 //
50 
51 //added:16-02-98: bit of value 64 doesnt seem to be used,
52 //                now its used to jump
53 
54 typedef enum
55 {
56     // Press "Fire".
57     BT_ATTACK           = 1,
58     // Use button, to open doors, activate switches.
59     BT_USE              = 2,
60 
61     // Flag, weapon change pending.
62     // If true, the next 3 bits hold weapon num.
63     BT_CHANGE           = 4,
64     // The 3bit weapon mask and shift, convenience.
65     BT_WEAPONMASK       = (8+16+32),
66     BT_WEAPONSHIFT      = 3,
67 
68     // Jump button.
69     BT_JUMP             = 64,
70     BT_EXTRAWEAPON      = 128
71 } buttoncode_t;
72 
73 
74 // The data sampled per tick (single player)
75 // and transmitted to other peers (multiplayer).
76 // Mainly movements/button commands per game tick,
77 // plus a checksum for internal state consistency.
78 
79 // TICCMD_148: Ticcmd flags into ticflags.
80 // Old code had flags in angleturn without even masking them out.
81 #define TICCMD_148
82 
83 #ifdef TICCMD_148
84 typedef enum {
85   TC_received = 0x01,  // network
86   TC_XY       = 0x02,  // Client prediction
87   TC_flydown  = 0x04,  // Heretic
88   TC_faked    = 0x08  // DEBUG
89 }  ticcmd_e;
90 #else
91 // bits in angleturn
92 #define TICCMD_RECEIVED 1
93 #define TICCMD_XY       2
94 #define BT_FLYDOWN      4
95 #endif
96 
97 // [WDJ] This was being padded by compiler to 8 bytes,
98 // so addition of flags has little cost, and eliminates noise in the angleturn.
99 typedef struct
100 {
101 #ifdef CLIENTPREDICTION2
102     fixed_t      x;
103     fixed_t      y;
104 #endif
105     int8_t       forwardmove;    // *2048 for move
106     int8_t       sidemove;       // *2048 for move
107     int16_t      angleturn;      // <<16 for angle delta
108                                  // SAVED AS A BYTE into demos
109     int16_t      aiming;    // pitch angle (up-down)
110     byte         buttons;
111 #ifdef TICCMD_148
112     byte         ticflags;  // ticcmd_e
113 #endif
114 } ticcmd_t;
115 
116 
117 #endif
118