TrinityCore
Loading...
Searching...
No Matches
MoveSplineFlag.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 TRINITYSERVER_MOVESPLINEFLAG_H
19#define TRINITYSERVER_MOVESPLINEFLAG_H
20
21#include "MovementTypedefs.h"
22
23namespace Movement
24{
25#pragma pack(push, 1)
26
28 {
29 public:
30 enum eFlags
31 {
32 None = 0x00000000,
33 // x00-xFF(first byte) used as animation Ids storage in pair with Animation flag
34 Done = 0x00000100,
35 Falling = 0x00000200, // Affects elevation computation, can't be combined with Parabolic flag
36 No_Spline = 0x00000400,
37 Parabolic = 0x00000800, // Affects elevation computation, can't be combined with Falling flag
38 CanSwim = 0x00001000,
39 Flying = 0x00002000, // Smooth movement(Catmullrom interpolation mode), flying animation
40 OrientationFixed = 0x00004000, // Model orientation fixed
41 Final_Point = 0x00008000,
42 Final_Target = 0x00010000,
43 Final_Angle = 0x00020000,
44 Catmullrom = 0x00040000, // Used Catmullrom interpolation mode
45 Cyclic = 0x00080000, // Movement by cycled spline
46 Enter_Cycle = 0x00100000, // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done
47 Animation = 0x00200000, // Plays animation after some time passed
48 Frozen = 0x00400000, // Will never arrive
49 TransportEnter = 0x00800000,
50 TransportExit = 0x01000000,
51 Unknown7 = 0x02000000,
52 Unknown8 = 0x04000000,
53 Backward = 0x08000000,
54 Unknown10 = 0x10000000,
55 Unknown11 = 0x20000000,
56 Unknown12 = 0x40000000,
57 Unknown13 = 0x80000000,
58
59 // Masks
61 // animation ids stored here, see AnimTier enum, used with Animation flag
63 // flags that shouldn't be appended into SMSG_MONSTER_MOVE\SMSG_MONSTER_MOVE_TRANSPORT packet, should be more probably
65 // CatmullRom interpolation mode used
67 // Unused, not suported flags
69 };
70
71 inline uint32& raw() { return (uint32&)*this; }
72 inline uint32 const& raw() const { return (uint32 const&)*this; }
73
74 MoveSplineFlag() { raw() = 0; }
76
77 // Constant interface
78
79 bool isSmooth() const { return (raw() & Mask_CatmullRom) != 0; }
80 bool isLinear() const { return !isSmooth(); }
81 bool isFacing() const { return (raw() & Mask_Final_Facing) != 0; }
82
83 bool hasAllFlags(uint32 f) const { return (raw() & f) == f; }
84 bool hasFlag(uint32 f) const { return (raw() & f) != 0; }
85 uint32 operator & (uint32 f) const { return (raw() & f); }
86 uint32 operator | (uint32 f) const { return (raw() | f); }
87 std::string ToString() const;
88
89 // Not constant interface
90
91 void operator &= (uint32 f) { raw() &= f; }
92 void operator |= (uint32 f) { raw() |= f; }
93
94 void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations | Falling | Parabolic)) | Animation | anim; }
97 void EnableFlying() { raw() = (raw() & ~(Falling | Catmullrom)) | Flying; }
98 void EnableCatmullRom() { raw() = (raw() & ~Flying) | Catmullrom; }
99 void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point; }
100 void EnableFacingAngle() { raw() = (raw() & ~Mask_Final_Facing) | Final_Angle; }
101 void EnableFacingTarget() { raw() = (raw() & ~Mask_Final_Facing) | Final_Target; }
102 void EnableTransportEnter() { raw() = (raw() & ~TransportExit) | TransportEnter; }
103 void EnableTransportExit() { raw() = (raw() & ~TransportEnter) | TransportExit; }
104 void EnableSwim() { raw() = raw() | CanSwim; }
105
107 bool done : 1;
108 bool falling : 1;
109 bool no_spline : 1;
110 bool parabolic : 1;
111 bool canswim : 1;
112 bool flying : 1;
114 bool final_point : 1;
115 bool final_target : 1;
116 bool final_angle : 1;
117 bool catmullrom : 1;
118 bool cyclic : 1;
119 bool enter_cycle : 1;
120 bool animation : 1;
121 bool frozen : 1;
124 bool unknown7 : 1;
125 bool unknown8 : 1;
126 bool backward : 1;
127 bool unknown10 : 1;
128 bool unknown11 : 1;
129 bool unknown12 : 1;
130 bool unknown13 : 1;
131 };
132#pragma pack(pop)
133}
134
135#endif // TRINITYSERVER_MOVESPLINEFLAG_H
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
std::string ToString() const
bool hasAllFlags(uint32 f) const
uint32 operator&(uint32 f) const
uint32 const & raw() const
void EnableAnimation(uint8 anim)
bool hasFlag(uint32 f) const
uint32 operator|(uint32 f) const