2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
7 #ifndef CAFU_PLAYERCOMMAND_HPP_INCLUDED
8 #define CAFU_PLAYERCOMMAND_HPP_INCLUDED
10 #if defined(_WIN32) && _MSC_VER<1600
11 #include "pstdint.h" // Paul Hsieh's portable implementation of the stdint.h header.
17 // Player command key flags
18 const uint32_t PCK_MoveForward
= 0x00000001;
19 const uint32_t PCK_MoveBackward
= 0x00000002;
20 const uint32_t PCK_TurnLeft
= 0x00000004;
21 const uint32_t PCK_TurnRight
= 0x00000008;
22 const uint32_t PCK_StrafeLeft
= 0x00000010;
23 const uint32_t PCK_StrafeRight
= 0x00000020;
24 const uint32_t PCK_LookUp
= 0x00000040;
25 const uint32_t PCK_LookDown
= 0x00000080;
26 const uint32_t PCK_CenterView
= 0x00000100;
27 const uint32_t PCK_Jump
= 0x00000200;
28 const uint32_t PCK_Duck
= 0x00000400;
29 const uint32_t PCK_Walk
= 0x00000800; // Walk (slower than normal)
30 const uint32_t PCK_Fire1
= 0x00001000; // Primary Fire (also used e.g. for "Respawn")
31 const uint32_t PCK_Fire2
= 0x00002000; // Secondary Fire
32 const uint32_t PCK_Use
= 0x00004000; // for "using" or "activating" things
33 // Bits 28-31 are reserved for storing a number, e.g. for selecting the weapon slot.
34 // Only one such number can be active at any time.
37 /// This struct represents per-frame player inputs for controlling human player entities.
38 /// Player commands are acquired on the clients and sent to the server.
41 PlayerCommandT(uint32_t Keys_
=0)
50 bool IsDown(uint32_t Key
) const
52 return (Keys
& Key
) != 0;
55 void Set(uint32_t Key
, bool set
)
67 void SetNumber(uint32_t n
)
75 uint16_t DeltaHeading
;