Files
Viano-Core/src/server/game/Entities/Object/MovementInfo.h
T
2020-01-01 18:47:28 +01:00

112 lines
2.8 KiB
C

/*
* Copyright (C) 2008-2020 TrinityCore <http://www.trinitycore.org/>
*
* 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 MovementInfo_h__
#define MovementInfo_h__
#include "ObjectGuid.h"
#include "Position.h"
struct MovementInfo
{
// common
ObjectGuid guid;
uint32 flags;
uint16 flags2;
Position pos;
uint32 time;
// transport
struct TransportInfo
{
void Reset()
{
guid.Clear();
pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
seat = -1;
time = 0;
time2 = 0;
vehicleId = 0;
}
ObjectGuid guid;
Position pos;
int8 seat;
uint32 time;
uint32 time2;
uint32 vehicleId;
} transport;
// swimming/flying
float pitch;
// jumping
struct JumpInfo
{
void Reset()
{
fallTime = 0;
zspeed = sinAngle = cosAngle = xyspeed = 0.0f;
}
uint32 fallTime;
float zspeed, sinAngle, cosAngle, xyspeed;
} jump;
// spline
float splineElevation;
MovementInfo() :
flags(0), flags2(0), time(0), pitch(0.0f), splineElevation(0.0f)
{
pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
transport.Reset();
jump.Reset();
}
uint32 GetMovementFlags() const { return flags; }
void SetMovementFlags(uint32 flag) { flags = flag; }
void AddMovementFlag(uint32 flag) { flags |= flag; }
void RemoveMovementFlag(uint32 flag) { flags &= ~flag; }
bool HasMovementFlag(uint32 flag) const { return (flags & flag) != 0; }
uint16 GetExtraMovementFlags() const { return flags2; }
void SetExtraMovementFlags(uint16 flag) { flags2 = flag; }
void AddExtraMovementFlag(uint16 flag) { flags2 |= flag; }
void RemoveExtraMovementFlag(uint16 flag) { flags2 &= ~flag; }
bool HasExtraMovementFlag(uint16 flag) const { return (flags2 & flag) != 0; }
uint32 GetFallTime() const { return jump.fallTime; }
void SetFallTime(uint32 time) { jump.fallTime = time; }
void ResetTransport()
{
transport.Reset();
}
void ResetJump()
{
jump.Reset();
}
void OutDebug();
};
#endif // MovementInfo_h__