moveManager.h

Engine/source/T3D/gameBase/moveManager.h

More...

Classes:

class

Public Enumerations

enum
MoveConstants {
  MaxTriggerKeys = 6
  MaxMoveQueueSize = 45
}

Public Variables

Detailed Description

Public Enumerations

MoveConstants

Enumerator

MaxTriggerKeys = 6
MaxMoveQueueSize = 45

Public Variables

const Move NullMove 
  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _MOVEMANAGER_H_
 25#define _MOVEMANAGER_H_
 26
 27#ifndef _PLATFORM_H_
 28#include "platform/platform.h"
 29#endif
 30
 31enum MoveConstants {
 32   MaxTriggerKeys = 6,
 33   MaxMoveQueueSize = 45,
 34};
 35
 36class BitStream;
 37
 38struct Move
 39{
 40   enum : <a href="/coding/file/types_8h/#types_8h_1ac3df7cf3c8cb172a588adec881447d68">U32</a> 
 41   { 
 42      ChecksumBits = 16, 
 43      ChecksumMask = ((1<<ChecksumBits)-1), 
 44      ChecksumMismatch = U32(-1) 
 45   };
 46
 47   // packed storage rep, set in clamp
 48   S32 px, py, pz;
 49   U32 pyaw, ppitch, proll;
 50   F32 x, y, z;          // float -1 to 1
 51   F32 yaw, pitch, roll; // 0-2PI
 52   U32 id;               // sync'd between server & client - debugging tool.
 53   U32 sendCount;
 54   U32 checksum;
 55
 56   bool deviceIsKeyboardMouse;
 57   bool freeLook;
 58   bool trigger[MaxTriggerKeys];
 59
 60   Move();
 61
 62   virtual void pack(BitStream *stream, const Move * move = NULL);
 63   virtual void unpack(BitStream *stream, const Move * move = NULL);
 64   virtual void clamp();
 65   virtual void unclamp();
 66
 67protected:
 68   bool packMove(BitStream *stream, const Move* basemove, bool alwaysWriteAll);
 69   bool unpackMove(BitStream *stream, const Move* basemove, bool alwaysReadAll);
 70};
 71
 72extern const Move NullMove;
 73
 74class MoveManager
 75{
 76public:
 77   static bool mDeviceIsKeyboardMouse;
 78   static F32 mForwardAction;
 79   static F32 mBackwardAction;
 80   static F32 mUpAction;
 81   static F32 mDownAction;
 82   static F32 mLeftAction;
 83   static F32 mRightAction;
 84
 85   static bool mFreeLook;
 86   static F32 mPitch;
 87   static F32 mYaw;
 88   static F32 mRoll;
 89
 90   static F32 mPitchUpSpeed;
 91   static F32 mPitchDownSpeed;
 92   static F32 mYawLeftSpeed;
 93   static F32 mYawRightSpeed;
 94   static F32 mRollLeftSpeed;
 95   static F32 mRollRightSpeed;
 96   static F32 mXAxis_L;
 97   static F32 mYAxis_L;
 98   static F32 mXAxis_R;
 99   static F32 mYAxis_R;
100
101   static U32 mTriggerCount[MaxTriggerKeys];
102   static U32 mPrevTriggerCount[MaxTriggerKeys];
103
104   static void init();
105};
106
107#endif
108