[go: up one dir, main page]

Menu

[904618]: / src / d_ticcmd.h  Maximize  Restore  History

Download this file

254 lines (205 with data), 7.8 kB

  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
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
// -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*-
// ----------------------------------------------------------------------------
// :oCCCCOCoc.
// .cCO8OOOOOOOOO8Oo:
// .oOO8OOOOOOOOOOOOOOOCc
// cO8888: .:oOOOOC. TM
// :888888: :CCCc .oOOOOC. ### ### #########
// C888888: .ooo: .C######## ##### ##### ###### ###### ##########
// O888888: .oO### ### ##### ##### ######## ######## #### ###
// C888888: :8O. .C########## ### #### ### ## ## ## ## #### ###
// :8@@@@8: :888c o### ### #### ### ######## ######## ##########
// :8@@@@C C@@@@ oo######## ### ## ### ###### ###### #########
// cO@@@@@@@@@@@@@@@@@Oc0
// :oO8@@@@@@@@@@Oo.
// .oCOOOOOCc. http://remood.org/
// ----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2008-2013 GhostlyDeath <ghostlydeath@remood.org>
// <ghostlydeath@gmail.com>
// ----------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// ----------------------------------------------------------------------------
// DESCRIPTION: System specific interface stuff.
#ifndef __D_TICCMD__
#define __D_TICCMD__
#include "doomtype.h"
//
// Button/action code definitions.
//
//added:16-02-98: bit of value 64 doesnt seem to be used,
// now its used to jump
typedef enum
{
// Press "Fire".
BT_ATTACK = 0x1,
// Use button, to open doors, activate switches.
BT_USE = 0x2,
// Flag, weapon change pending.
// If true, the next 3 bits hold weapon num.
BT_CHANGE = 0x4,
// Jump button.
BT_JUMP = 0x8,
// Suicide
BT_SUICIDE = 0x10,
// The 3bit weapon mask and shift, convenience.
BT_WEAPONMASK = 0x1E0,
BT_WEAPONSHIFT = 5,
BT_EXTRAWEAPON = 0x200,
BT_SLOTMASK = 0x3C00,
BT_SLOTSHIFT = 11,
BT_FLYLAND = UINT32_C(0x00010000), // Fly Up
BT_PANLOOK = UINT32_C(0x00020000), // Panning Loop
BT_RESETAIM = UINT32_C(0x00040000), // Reset aim
} buttoncode_t;
// The data sampled per tick (single player)
// and transmitted to other peers (multiplayer).
// Mainly movements/button commands per game tick,
// plus a checksum for internal state consistency.
enum
{
TICCMD_NOTHING, // Do nothing
TICCMD_INVLEFT, // Move Inventory Left
TICCMD_INVRIGHT, // Move Inventory Right
TICCMD_INVUSE, // Use Inventory
};
#define TICCMD_INVACTSHIFT UINT32_C(0) // Action Shift
#define TICCMD_INVACTMASK UINT32_C(0x3) // Action Mask
#define MAXTCSTRINGCAT 48 // Max length for string cat
#define MAXTCWEAPNAME 32 // Max length for weapon name
#define MAXTCDATABUF 384 // Data Buffer size
#define TICPINGSIGNALSHIFT UINT16_C(14)
#define TICPINGSIGNALMASK UINT16_C(0xC000)
#define TICPINGAMOUNTMASK UINT16_C(0x3FFF)
/* Define ticcmd_t */
#if !defined(__REMOOD_TICCMDT_DEFINED)
typedef union ticcmd_u ticcmd_t;
#define __REMOOD_TICCMDT_DEFINED
#endif
/* D_TicControl_t -- Tic Control */
typedef struct D_TicControl_s
{
uint8_t Type; // Type of Command
uint16_t Ping; // Players' Ping
} D_TicControl_t;
/* ticcmd_t -- Tic Command Structure */
union ticcmd_u
{
D_TicControl_t Ctrl; // Control
struct
{
D_TicControl_t Ctrl; // Control
int8_t forwardmove; // *2048 for move
int8_t sidemove; // *2048 for move
int16_t angleturn; // <<16 for angle delta
// SAVED AS A BYTE into demos
uint16_t aiming; //added:16-02-98:mouse aiming
uint32_t buttons;
uint8_t artifact; // For Heretic
// Extended tic command stuff
uint8_t XSNewWeapon[MAXTCWEAPNAME]; // New weapon (string based)
//uint8_t XNewWeapon; // New weapon to switch to
int16_t BaseAngleTurn; // Base angle turning
int16_t BaseAiming; // Base Aiming
uint8_t InventoryBits; // Inventory Control
uint32_t StatFlags; // Player Status Flags
int16_t FlySwim; // Fly/Swim
uint16_t DataSize; // Size of Data
uint8_t DataBuf[MAXTCDATABUF]; // Data Buffer
} Std;
struct
{
D_TicControl_t Ctrl; // Control
uint16_t DataSize; // Size of Data
uint8_t DataBuf[MAXTCDATABUF]; // Data Buffer
} Ext;
};
void D_TicCmdFillWeapon(ticcmd_t* const a_Target, const int32_t a_ID);
#define MAXTCCBUFSIZE 32 // Max buffer size in commands
enum
{
DTCT_NULL, // NULL
// Simple Networking
DTCT_SNJOINPLAYER, // Player Joins
DTCT_MAPCHANGE, // Change the map
DTCT_GAMEVAR, // Game Variable
DTCT_XCHANGEMONSTERTEAM, // Changes Monster Team
DTCT_XMORPHPLAYER, // Morph Player
DTCT_SNQUITREASON, // Reason for quitting
DTCT_SNCLEANUPHOST, // Tell clients to cleanup host
DTCT_SNJOINHOST, // Host Joins
DTCT_SNPARTPLAYER, // Player parts
DTCT_SNJOINPORT, // Port is joined
DTCT_SNCHATFRAG, // Chat Fragment
DTCT_SNPORTSETTING, // Setting of port
DTCT_SNUNPLUGPORT, // Unplug port
NUMDTCT
};
/* D_TCJoinFlags_t -- Join Flags */
typedef enum D_TCJoinFlags_e
{
DTCJF_ISBOT = 0x0001, // Is a Bot
DTCJF_MONSTERTEAM = 0x0002, // On monster team
} D_TCJoinFlags_t;
/* D_TCStatFlags_t -- Status Flags */
typedef enum D_TCStatFlags_e
{
DTSF_LOCALSTICK = UINT32_C(0x00000001), // Local client is sticking
} D_TCStatFlags_t;
/* D_DiffBits_t -- Diff bits */
typedef enum D_DiffBits_e
{
/* Important <= 128 */
DDB_FORWARD = 0x0001, // Forward Changes
DDB_SIDE = 0x0002, // Side Changes
DDB_AIMING = 0x0004, // Aiming Changes
DDB_BUTTONS = 0x0008, // Button Changes
DDB_WEAPON = 0x0010, // Weapon Changes
DDB_ANGLE = 0x0020, // Angle changes
DDB_STATFLAGS = 0x0040, // Status Flags
/* Less Important > 128 */
DDB_BAT = 0x0080, // Base turn angle changes
DDB_BAM = 0x0100, // Base aiming changes
DDB_INVENTORY = 0x0200, // Inventory Control
DDB_ARTIFACT = 0x0400, // Artifact Changes
DDB_FLYSWIM = 0x0800, // Flying/Swimming
DDB_UNUSED1000 = 0x1000, // Not used
DDB_UNUSED2000 = 0x2000, // Not used
DDB_UNUSED4000 = 0x4000, // Not used
/* DO NOT USE */
DDB_UNUSED8000 = 0x8000, // Unused [ DO NOT USE! ]
} D_DiffBits_t;
extern const int32_t c_TCDataSize[NUMDTCT];
/* SN_TicBufVersion_t -- TicBuf version number */
// This is for net compat, but mostly for demos!
typedef enum SN_TicBufVersion_s
{
DXNTBV_ILLEGALVERSION, // Illegal Version
DXNTBV_VER20130327, // 2013/03/27
DXNTBV_VER20130731, // 2013/07/31
DXNTBV_LATEST = DXNTBV_VER20130731, // Lastest Version
} SN_TicBufVersion_t;
/* SN_SyncCodeInfo_t -- Sync Code Data (sync debugging) */
typedef struct SN_SyncCodeInfo_s
{
uint32_t Code; // Generated Code
} SN_SyncCodeInfo_t;
/* SN_TicBuf_t -- Tic Command Buffer */
typedef struct SN_TicBuf_s
{
tic_t GameTic; // Gametic to run at
uint32_t SyncCode; // Synchronization Code
bool_t GotTic; // Got tic
ticcmd_t Tics[MAXPLAYERS + 1]; // Tic Commands
uint32_t PIGRevMask; // Player in reverse game mask
} SN_TicBuf_t;
#endif