#ifndef MOVEMENTMGR_H #define MOVEMENTMGR_H #include "common.h" #include "UpdateData.h" #define MOVE_HEARTBEAT_DELAY 500 // -- // -- MovementFlags and MovementInfo can be found in UpdateData.h // -- enum MovementFlagsEx { // custom flags MOVEMENTFLAG_ANY_MOVE = (MOVEMENTFLAG_BACKWARD | MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_STRAFE_LEFT | MOVEMENTFLAG_STRAFE_RIGHT | MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT) }; enum MoveModes { MOVEMODE_AUTO, // CPU controlling movement, MyCharacter must be updated MOVEMODE_MANUAL, // user controlling movement, MyCharacter is updated by the GUI already }; class PseuInstance; class MyCharacter; class MovementMgr { public: MovementMgr(); ~MovementMgr(); void SetInstance(PseuInstance*); inline void SetMoveMode(uint8 mode) { _movemode = mode; } void Update(bool); void MoveStartForward(void); void MoveStartBackward(void); void MoveStop(void); void MoveStartStrafeLeft(void); void MoveStartStrafeRight(void); void MoveStartTurnLeft(void); void MoveStartTurnRight(void); void MoveStopTurn(void); void MoveFallLand(void); void MoveSetFacing(float); private: void _BuildPacket(uint16); PseuInstance *_instance; MyCharacter *_mychar; uint32 _moveFlags; // server relevant flags (move forward/backward/swim/fly/jump/etc) uint32 _updatetime; // timeMS of last update cycle uint32 _optime; // timeMS when last opcode was sent uint8 _movemode; // automatic or manual UnitMoveType _movetype; // index used for speed selection }; #endif