TrinityCore
Loading...
Searching...
No Matches
MovementInfo.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef MovementInfo_h__
19#define MovementInfo_h__
20
21#include "ObjectGuid.h"
22#include "Position.h"
23
25{
26 // common
32
33 // transport
35 {
36 void Reset()
37 {
38 guid.Clear();
39 pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
40 seat = -1;
41 time = 0;
42 time2 = 0;
43 }
44
51
52 // swimming/flying
53 float pitch;
54
55 // falling
57
58 // jumping
59 struct JumpInfo
60 {
61 void Reset()
62 {
63 zspeed = sinAngle = cosAngle = xyspeed = 0.0f;
64 }
65
67
69
70 // spline
72
74 guid(), flags(0), flags2(0), time(0), pitch(0.0f), fallTime(0), splineElevation(0.0f)
75 {
76 pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
78 jump.Reset();
79 }
80
81 uint32 GetMovementFlags() const { return flags; }
82 void SetMovementFlags(uint32 flag) { flags = flag; }
83 void AddMovementFlag(uint32 flag) { flags |= flag; }
84 void RemoveMovementFlag(uint32 flag) { flags &= ~flag; }
85 bool HasMovementFlag(uint32 flag) const { return (flags & flag) != 0; }
86
88 void SetExtraMovementFlags(uint16 flag) { flags2 = flag; }
89 void AddExtraMovementFlag(uint16 flag) { flags2 |= flag; }
90 void RemoveExtraMovementFlag(uint16 flag) { flags2 &= ~flag; }
91 bool HasExtraMovementFlag(uint16 flag) const { return (flags2 & flag) != 0; }
92
93 uint32 GetFallTime() const { return fallTime; }
94 void SetFallTime(uint32 val) { fallTime = val; }
95
96 void OutDebug();
97};
98
99#endif // MovementInfo_h__
int8_t int8
Definition Define.h:131
uint16_t uint16
Definition Define.h:134
uint32_t uint32
Definition Define.h:133
void Clear()
Definition ObjectGuid.h:150
ObjectGuid guid
void SetExtraMovementFlags(uint16 flag)
uint16 GetExtraMovementFlags() const
uint32 GetFallTime() const
struct MovementInfo::JumpInfo jump
void RemoveMovementFlag(uint32 flag)
uint32 fallTime
struct MovementInfo::TransportInfo transport
float splineElevation
void SetMovementFlags(uint32 flag)
bool HasMovementFlag(uint32 flag) const
void RemoveExtraMovementFlag(uint16 flag)
uint32 GetMovementFlags() const
void AddMovementFlag(uint32 flag)
void SetFallTime(uint32 val)
void OutDebug()
Definition Object.cpp:906
bool HasExtraMovementFlag(uint16 flag) const
Position pos
void AddExtraMovementFlag(uint16 flag)
void Relocate(float x, float y)
Definition Position.h:66