123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- #ifndef __USERCMDGEN_H__
- #define __USERCMDGEN_H__
- const int USERCMD_HZ = 60;
- const int USERCMD_MSEC = 1000 / USERCMD_HZ;
- const int BUTTON_ATTACK = BIT(0);
- const int BUTTON_RUN = BIT(1);
- const int BUTTON_ZOOM = BIT(2);
- const int BUTTON_SCORES = BIT(3);
- const int BUTTON_MLOOK = BIT(4);
- const int BUTTON_5 = BIT(5);
- const int BUTTON_6 = BIT(6);
- const int BUTTON_7 = BIT(7);
- const int IMPULSE_0 = 0;
- const int IMPULSE_1 = 1;
- const int IMPULSE_2 = 2;
- const int IMPULSE_3 = 3;
- const int IMPULSE_4 = 4;
- const int IMPULSE_5 = 5;
- const int IMPULSE_6 = 6;
- const int IMPULSE_7 = 7;
- const int IMPULSE_8 = 8;
- const int IMPULSE_9 = 9;
- const int IMPULSE_10 = 10;
- const int IMPULSE_11 = 11;
- const int IMPULSE_12 = 12;
- const int IMPULSE_13 = 13;
- const int IMPULSE_14 = 14;
- const int IMPULSE_15 = 15;
- const int IMPULSE_16 = 16;
- const int IMPULSE_17 = 17;
- const int IMPULSE_18 = 18;
- const int IMPULSE_19 = 19;
- const int IMPULSE_20 = 20;
- const int IMPULSE_21 = 21;
- const int IMPULSE_22 = 22;
- const int IMPULSE_23 = 23;
- const int IMPULSE_24 = 24;
- const int IMPULSE_25 = 25;
- const int IMPULSE_26 = 26;
- const int IMPULSE_27 = 27;
- const int IMPULSE_28 = 28;
- const int IMPULSE_29 = 29;
- const int IMPULSE_40 = 40;
- const int UCF_IMPULSE_SEQUENCE = 0x0001;
- class usercmd_t {
- public:
- int gameFrame;
- int gameTime;
- int duplicateCount;
- byte buttons;
- signed char forwardmove;
- signed char rightmove;
- signed char upmove;
- short angles[3];
- short mx;
- short my;
- signed char impulse;
- byte flags;
- int sequence;
- public:
- void ByteSwap();
- bool operator==( const usercmd_t &rhs ) const;
- };
- typedef enum {
- INHIBIT_SESSION = 0,
- INHIBIT_ASYNC
- } inhibit_t;
- const int MAX_BUFFERED_USERCMD = 64;
- class idUsercmdGen {
- public:
- virtual ~idUsercmdGen( void ) {}
-
- virtual void Init( void ) = 0;
-
- virtual void InitForNewMap( void ) = 0;
-
- virtual void Shutdown( void ) = 0;
-
- virtual void Clear( void ) = 0;
-
- virtual void ClearAngles( void ) = 0;
-
-
- virtual void InhibitUsercmd( inhibit_t subsystem, bool inhibit ) = 0;
-
- virtual usercmd_t TicCmd( int ticNumber ) = 0;
-
- virtual void UsercmdInterrupt( void ) = 0;
-
- virtual int CommandStringUsercmdData( const char *cmdString ) = 0;
-
- virtual int GetNumUserCommands( void ) = 0;
-
- virtual const char *GetUserCommandName( int index ) = 0;
-
- virtual void MouseState( int *x, int *y, int *button, bool *down ) = 0;
-
- virtual int ButtonState( int key ) = 0;
-
- virtual int KeyState( int key ) = 0;
-
- virtual usercmd_t GetDirectUsercmd( void ) = 0;
- };
- extern idUsercmdGen *usercmdGen;
- #endif
|