aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Movement/Spline/MoveSplineInitArgs.h
blob: 46cd0779e21faf5b3beed3dd66b6571932843966 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef TRINITYSERVER_MOVESPLINEINIT_ARGS_H
#define TRINITYSERVER_MOVESPLINEINIT_ARGS_H

#include "Duration.h"
#include "MoveSplineFlag.h"
#include "MovementTypedefs.h"
#include "ObjectGuid.h"
#include "Optional.h"

class Unit;

enum class AnimTier : uint8;

namespace Movement
{
    typedef std::vector<Vector3> PointsArray;

    struct FacingInfo
    {
        struct
        {
            float x, y, z;
        } f;
        ObjectGuid target;
        float angle;

        MonsterMoveType type;

        FacingInfo() : angle(0.0f), type(MONSTER_MOVE_NORMAL) { f.x = f.y = f.z = 0.0f; }
    };

    struct SpellEffectExtraData
    {
        ObjectGuid Target;
        uint32 SpellVisualId = 0;
        uint32 ProgressCurveId = 0;
        uint32 ParabolicCurveId = 0;
    };

    struct TurnData
    {
        float StartFacing = 0.0f;
        float TotalTurnRads = 0.0f;
        float RadsPerSec = 0.0f;
    };

    struct AnimTierTransition
    {
        uint32 TierTransitionId = 0;
        ::AnimTier AnimTier = ::AnimTier(0);
    };

    struct MoveSplineInitArgs
    {
        explicit MoveSplineInitArgs();
        MoveSplineInitArgs(MoveSplineInitArgs&& args) noexcept;
        ~MoveSplineInitArgs();

        PointsArray path;
        FacingInfo facing;
        MoveSplineFlag flags;
        int32 path_Idx_offset;
        float velocity;
        float parabolic_amplitude;
        float vertical_acceleration;
        float effect_start_time_percent; // fraction of total spline duration
        Milliseconds effect_start_time;  // absolute value
        uint32 splineId;
        float initialOrientation;
        Optional<SpellEffectExtraData> spellEffectExtra;
        Optional<TurnData> turnData;
        Optional<AnimTierTransition> animTier;
        bool walk;
        bool HasVelocity;
        bool TransformForTransport;

        /** Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed. */
        bool Validate(Unit const* unit);

    private:
        bool _checkPathLengths();
    };
}

#endif // TRINITYSERVER_MOVESPLINEINIT_ARGS_H