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 "Define.h"
22#include "EnumFlag.h"
23#include <string>
24
25namespace Movement
26{
27 // EnumUtils: DESCRIBE THIS
29 {
30 None = 0x00000000,
31 Unknown_0x1 = 0x00000001, // NOT VERIFIED
32 Unknown_0x2 = 0x00000002, // NOT VERIFIED
33 Unknown_0x4 = 0x00000004, // NOT VERIFIED
34 JumpOrientationFixed= 0x00000008, // Model orientation fixed (jump animation)
35 FallingSlow = 0x00000010,
36 Done = 0x00000020,
37 Falling = 0x00000040, // Affects elevation computation, can't be combined with Parabolic flag
38 No_Spline = 0x00000080,
39 Unknown_0x100 = 0x00000100, // NOT VERIFIED
40 Flying = 0x00000200, // Smooth movement(Catmullrom interpolation mode), flying animation
41 OrientationFixed = 0x00000400, // Model orientation fixed (knockback animation)
42 Catmullrom = 0x00000800, // Used Catmullrom interpolation mode
43 Cyclic = 0x00001000, // Movement by cycled spline
44 Enter_Cycle = 0x00002000, // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done
45 Turning = 0x00004000, // Turns in place
46 TransportEnter = 0x00008000,
47 TransportExit = 0x00010000,
48 Unknown_0x20000 = 0x00020000, // NOT VERIFIED
49 Unknown_0x40000 = 0x00040000, // NOT VERIFIED
50 Backward = 0x00080000,
51 SmoothGroundPath = 0x00100000,
52 CanSwim = 0x00200000,
53 UncompressedPath = 0x00400000,
54 Unknown_0x800000 = 0x00800000, // NOT VERIFIED
55 FastSteering = 0x01000000, // Predicts spline only 500ms into the future for smoothing instead of 1s (making turns sharper) and turns off clientside obstacle detection
56 Animation = 0x02000000, // Plays animation after some time passed
57 Parabolic = 0x04000000, // Affects elevation computation, can't be combined with Falling flag
58 FadeObject = 0x08000000,
59 Steering = 0x10000000,
60 UnlimitedSpeed = 0x20000000,
61 Unknown_0x40000000 = 0x40000000, // NOT VERIFIED
62 Unknown_0x80000000 = 0x80000000, // NOT VERIFIED
63
64 // Masks
65 // flags that shouldn't be appended into SMSG_MONSTER_MOVE\SMSG_MONSTER_MOVE_TRANSPORT packet, should be more probably
66 Mask_No_Monster_Move = Done, // SKIP
67 // Unused, not suported flags
70 };
71
73
75 {
76 switch (flag)
77 {
90 default: break;
91 }
93 }
94
96 {
99
100 // Constant interface
101
102 constexpr bool isSmooth() const { return Raw.HasFlag(MoveSplineFlagEnum::Catmullrom); }
103 constexpr bool isLinear() const { return !isSmooth(); }
104
105 constexpr bool HasAllFlags(MoveSplineFlagEnum f) const { return Raw.HasAllFlags(f); }
106 constexpr bool HasFlag(MoveSplineFlagEnum f) const { return Raw.HasFlag(f); }
107 constexpr MoveSplineFlagEnum operator&(MoveSplineFlagEnum f) const { return (Raw & f); }
108 constexpr MoveSplineFlagEnum operator|(MoveSplineFlagEnum f) const { return (Raw | f); }
109 std::string ToString() const;
110
111 // Not constant interface
112
113 constexpr MoveSplineFlag& operator&=(MoveSplineFlagEnum f) { Raw &= f; return *this; }
114 constexpr MoveSplineFlag& operator|=(MoveSplineFlagEnum f) { Raw |= f; return *this; }
115
117
118 template <MoveSplineFlagEnum Flag>
120 {
121 // force compile time evaluation - workaround for clang <= 14
122 static constexpr MoveSplineFlagEnum DisallowedFlag = std::integral_constant<MoveSplineFlagEnum, GetDisallowedFlagsFor(Flag)>::value;
123
124 constexpr operator bool() const { return (Raw & Flag) != MoveSplineFlagEnum::None; }
125 constexpr FlagAccessor& operator=(bool val) { if (val) { Raw = Raw & ~DisallowedFlag | Flag; } else Raw &= ~Flag; return *this; }
127 };
128
129#define MAKE_FLAG_ACCESSOR_FIELD(flag) FlagAccessor<MoveSplineFlagEnum::flag> flag
130
163
164#undef MAKE_FLAG_ACCESSOR_FIELD
165 };
166}
167
168#endif // TRINITYSERVER_MOVESPLINEFLAG_H
uint32_t uint32
Definition Define.h:154
#define DEFINE_ENUM_FLAG(enumType)
Definition EnumFlag.h:26
constexpr bool HasFlag(T flag) const
Definition EnumFlag.h:106
constexpr bool HasAllFlags(T flags) const
Definition EnumFlag.h:112
consteval MoveSplineFlagEnum GetDisallowedFlagsFor(MoveSplineFlagEnum flag)
constexpr FlagAccessor & operator=(bool val)
static constexpr MoveSplineFlagEnum DisallowedFlag
constexpr bool isLinear() const
std::string ToString() const
MAKE_FLAG_ACCESSOR_FIELD(UncompressedPath)
MAKE_FLAG_ACCESSOR_FIELD(Unknown_0x80000000)
MAKE_FLAG_ACCESSOR_FIELD(Unknown_0x40000000)
MAKE_FLAG_ACCESSOR_FIELD(Parabolic)
MAKE_FLAG_ACCESSOR_FIELD(No_Spline)
MAKE_FLAG_ACCESSOR_FIELD(Backward)
MAKE_FLAG_ACCESSOR_FIELD(JumpOrientationFixed)
MAKE_FLAG_ACCESSOR_FIELD(Unknown_0x100)
MAKE_FLAG_ACCESSOR_FIELD(Unknown_0x40000)
constexpr MoveSplineFlag(MoveSplineFlagEnum f)
MAKE_FLAG_ACCESSOR_FIELD(Unknown_0x2)
constexpr bool HasAllFlags(MoveSplineFlagEnum f) const
constexpr MoveSplineFlagEnum operator&(MoveSplineFlagEnum f) const
MAKE_FLAG_ACCESSOR_FIELD(Animation)
MAKE_FLAG_ACCESSOR_FIELD(Unknown_0x800000)
MAKE_FLAG_ACCESSOR_FIELD(Catmullrom)
MAKE_FLAG_ACCESSOR_FIELD(UnlimitedSpeed)
constexpr bool isSmooth() const
constexpr MoveSplineFlag & operator|=(MoveSplineFlagEnum f)
MAKE_FLAG_ACCESSOR_FIELD(FallingSlow)
MAKE_FLAG_ACCESSOR_FIELD(OrientationFixed)
EnumFlag< MoveSplineFlagEnum > Raw
constexpr bool HasFlag(MoveSplineFlagEnum f) const
MAKE_FLAG_ACCESSOR_FIELD(SmoothGroundPath)
constexpr MoveSplineFlagEnum operator|(MoveSplineFlagEnum f) const
MAKE_FLAG_ACCESSOR_FIELD(Unknown_0x1)
MAKE_FLAG_ACCESSOR_FIELD(FadeObject)
MAKE_FLAG_ACCESSOR_FIELD(TransportExit)
MAKE_FLAG_ACCESSOR_FIELD(Steering)
MAKE_FLAG_ACCESSOR_FIELD(Unknown_0x4)
MAKE_FLAG_ACCESSOR_FIELD(Unknown_0x20000)
MAKE_FLAG_ACCESSOR_FIELD(FastSteering)
MAKE_FLAG_ACCESSOR_FIELD(TransportEnter)
MAKE_FLAG_ACCESSOR_FIELD(Enter_Cycle)
constexpr MoveSplineFlag & operator&=(MoveSplineFlagEnum f)