本文整理汇总了C++中Position::GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Position::GetPosition方法的具体用法?C++ Position::GetPosition怎么用?C++ Position::GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position::GetPosition方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MoveTakeoff
void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed)
{
if (i_owner->GetTypeId() != TYPEID_UNIT)
return;
uint32 moveFlag = SPLINEFLAG_FLYING | SPLINEFLAG_ANIMATIONTIER;
uint32 moveTime = uint32(i_owner->GetExactDist(&pos) / speed) * IN_MILLISECONDS;
// CHARGING state makes the unit use m_TempSpeed and JUMPING prevents sending movement packet in PointMovementGenerator
i_owner->AddUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING);
i_owner->m_TempSpeed = speed;
float x, y, z;
pos.GetPosition(x, y, z);
sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", i_owner->GetEntry(), id, x, y, z);
Mutate(new PointMovementGenerator<Creature>(id, x, y, z), MOTION_SLOT_ACTIVE);
MonsterMoveData data;
data.DestLocation.Relocate(pos);
data.SplineFlag = moveFlag;
data.Time = moveTime;
data.AnimationState = ANIMATION_FLYING;
i_owner->SendMonsterMove(data);
}
示例2: TestCasePosition
/// Tests the Position Functions
/// @return True if all tests were executed, false if not
bool PositionTestSuite::TestCasePosition()
{
//------Last Checked------//
// - Jan 11, 2005
Position position;
// TEST CASE: IsValidPosition
{
wxUint32 i = 0;
for (; i <= (Position::MAX_POSITION + 1); i++)
{
TEST(wxString::Format(wxT("IsValidPosition - %d"), i),
(Position::IsValidPosition(i) == (i <= Position::MAX_POSITION))
);
}
}
// TEST CASE: SetPosition
{
wxUint32 i = 0;
for (; i <= (Position::MAX_POSITION + 1); i++)
{
TEST(wxT("SetPosition - %d"),
(position.SetPosition(i) == (i <= Position::MAX_POSITION)) &&
((i > Position::MAX_POSITION) ? 1 :
(position.GetPosition() == i))
);
}
}
return (true);
}
示例3: MoveTakeoff
void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed)
{
float x, y, z;
pos.GetPosition(x, y, z);
sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", i_owner->GetEntry(), id, x, y, z);
Movement::MoveSplineInit init(*i_owner);
init.MoveTo(x, y, z);
//init.SetVelocity(speed);
init.SetAnimation(Movement::ToFly);
init.Launch();
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
}
示例4: MoveTakeoff
void MotionMaster::MoveTakeoff(uint32 id, Position const& pos)
{
float x, y, z;
pos.GetPosition(x, y, z);
TC_LOG_DEBUG("misc", "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
Movement::MoveSplineInit init(_owner);
init.MoveTo(x, y, z);
init.SetAnimation(Movement::ToFly);
init.Launch();
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
}
示例5: MoveLand
void MotionMaster::MoveLand(uint32 id, Position const& pos)
{
float x, y, z;
pos.GetPosition(x, y, z);
sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
Movement::MoveSplineInit init(_owner);
init.MoveTo(x, y, z);
init.SetAnimation(Movement::ToGround);
init.Launch();
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
}
示例6: CreateDynamicObject
bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type)
{
SetMap(caster->GetMap());
Relocate(pos);
if (!IsPositionValid())
{
TC_LOG_ERROR("misc", "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY());
return false;
}
WorldObject::_Create(guidlow, HighGuid::DynamicObject, caster->GetPhaseMask());
SetEntry(spellId);
SetObjectScale(1);
SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetGUID());
// The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden
// by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane.
// If any other value is used, the client will _always_ use the radius provided in DYNAMICOBJECT_RADIUS, but
// precompensation is necessary (eg radius *= 2) for many spells. Anyway, blizz sends 0x0001 for all the spells
// I saw sniffed...
SetByteValue(DYNAMICOBJECT_BYTES, 0, type);
SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
SetUInt32Value(DYNAMICOBJECT_CASTTIME, GameTime::GetGameTimeMS());
if (IsWorldObject())
setActive(true); //must before add to map to be put in world container
Transport* transport = caster->GetTransport();
if (transport)
{
float x, y, z, o;
pos.GetPosition(x, y, z, o);
transport->CalculatePassengerOffset(x, y, z, &o);
m_movementInfo.transport.pos.Relocate(x, y, z, o);
// This object must be added to transport before adding to map for the client to properly display it
transport->AddPassenger(this);
}
if (!GetMap()->AddToMap(this))
{
// Returning false will cause the object to be deleted - remove from transport
if (transport)
transport->RemovePassenger(this);
return false;
}
return true;
}
示例7: CreateDynamicObject
bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type, uint32 spellXSpellVisualId)
{
_spellXSpellVisualId = spellXSpellVisualId;
SetMap(caster->GetMap());
Relocate(pos);
if (!IsPositionValid())
{
TC_LOG_ERROR("misc", "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spell->Id, GetPositionX(), GetPositionY());
return false;
}
WorldObject::_Create(ObjectGuid::Create<HighGuid::DynamicObject>(GetMapId(), spell->Id, guidlow));
SetPhaseMask(caster->GetPhaseMask(), false);
SetEntry(spell->Id);
SetObjectScale(1.0f);
SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetGUID());
SetUInt32Value(DYNAMICOBJECT_TYPE, type);
SetUInt32Value(DYNAMICOBJECT_SPELL_X_SPELL_VISUAL_ID, spellXSpellVisualId);
SetUInt32Value(DYNAMICOBJECT_SPELLID, spell->Id);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime());
if (IsWorldObject())
setActive(true); //must before add to map to be put in world container
Transport* transport = caster->GetTransport();
if (transport)
{
float x, y, z, o;
pos.GetPosition(x, y, z, o);
transport->CalculatePassengerOffset(x, y, z, &o);
m_movementInfo.transport.pos.Relocate(x, y, z, o);
// This object must be added to transport before adding to map for the client to properly display it
transport->AddPassenger(this);
}
if (!GetMap()->AddToMap(this))
{
// Returning false will cause the object to be deleted - remove from transport
if (transport)
transport->RemovePassenger(this);
return false;
}
return true;
}
示例8: Create
bool AreaTrigger::Create(uint32 spellMiscId, Unit* caster, Unit* target, SpellInfo const* spell, Position const& pos, int32 duration, uint32 spellXSpellVisualId, ObjectGuid const& castId, AuraEffect const* aurEff)
{
_targetGuid = target ? target->GetGUID() : ObjectGuid::Empty;
_aurEff = aurEff;
SetMap(caster->GetMap());
Relocate(pos);
if (!IsPositionValid())
{
TC_LOG_ERROR("entities.areatrigger", "AreaTrigger (spellMiscId %u) not created. Invalid coordinates (X: %f Y: %f)", spellMiscId, GetPositionX(), GetPositionY());
return false;
}
_areaTriggerMiscTemplate = sAreaTriggerDataStore->GetAreaTriggerMiscTemplate(spellMiscId);
if (!_areaTriggerMiscTemplate)
{
TC_LOG_ERROR("entities.areatrigger", "AreaTrigger (spellMiscId %u) not created. Invalid areatrigger miscid (%u)", spellMiscId, spellMiscId);
return false;
}
Object::_Create(ObjectGuid::Create<HighGuid::AreaTrigger>(GetMapId(), GetTemplate()->Id, caster->GetMap()->GenerateLowGuid<HighGuid::AreaTrigger>()));
SetEntry(GetTemplate()->Id);
SetDuration(duration);
SetObjectScale(1.0f);
SetGuidValue(AREATRIGGER_CASTER, caster->GetGUID());
SetGuidValue(AREATRIGGER_CREATING_EFFECT_GUID, castId);
SetUInt32Value(AREATRIGGER_SPELLID, spell->Id);
SetUInt32Value(AREATRIGGER_SPELL_FOR_VISUALS, spell->Id);
SetUInt32Value(AREATRIGGER_SPELL_X_SPELL_VISUAL_ID, spellXSpellVisualId);
SetUInt32Value(AREATRIGGER_TIME_TO_TARGET_SCALE, GetMiscTemplate()->TimeToTargetScale != 0 ? GetMiscTemplate()->TimeToTargetScale : GetUInt32Value(AREATRIGGER_DURATION));
SetFloatValue(AREATRIGGER_BOUNDS_RADIUS_2D, GetTemplate()->MaxSearchRadius);
SetUInt32Value(AREATRIGGER_DECAL_PROPERTIES_ID, GetMiscTemplate()->DecalPropertiesId);
for (uint8 scaleCurveIndex = 0; scaleCurveIndex < MAX_AREATRIGGER_SCALE; ++scaleCurveIndex)
if (GetMiscTemplate()->ExtraScale.Data.Raw[scaleCurveIndex])
SetUInt32Value(AREATRIGGER_EXTRA_SCALE_CURVE + scaleCurveIndex, GetMiscTemplate()->ExtraScale.Data.Raw[scaleCurveIndex]);
PhasingHandler::InheritPhaseShift(this, caster);
if (target && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_ATTACHED))
{
m_movementInfo.transport.guid = target->GetGUID();
}
UpdateShape();
uint32 timeToTarget = GetMiscTemplate()->TimeToTarget != 0 ? GetMiscTemplate()->TimeToTarget : GetUInt32Value(AREATRIGGER_DURATION);
if (GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_CIRCULAR_MOVEMENT))
{
AreaTriggerCircularMovementInfo cmi = GetMiscTemplate()->CircularMovementInfo;
if (target && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_ATTACHED))
cmi.PathTarget = target->GetGUID();
else
cmi.Center = pos;
InitCircularMovement(cmi, timeToTarget);
}
else if (GetMiscTemplate()->HasSplines())
{
InitSplineOffsets(GetMiscTemplate()->SplinePoints, timeToTarget);
}
// movement on transport of areatriggers on unit is handled by themself
Transport* transport = m_movementInfo.transport.guid.IsEmpty() ? caster->GetTransport() : nullptr;
if (transport)
{
float x, y, z, o;
pos.GetPosition(x, y, z, o);
transport->CalculatePassengerOffset(x, y, z, &o);
m_movementInfo.transport.pos.Relocate(x, y, z, o);
// This object must be added to transport before adding to map for the client to properly display it
transport->AddPassenger(this);
}
AI_Initialize();
// Relocate areatriggers with circular movement again
if (HasCircularMovement())
Relocate(CalculateCircularMovementPosition());
if (!GetMap()->AddToMap(this))
{
// Returning false will cause the object to be deleted - remove from transport
if (transport)
transport->RemovePassenger(this);
return false;
}
caster->_RegisterAreaTrigger(this);
_ai->OnCreate();
return true;
}
示例9: MoveTakeoff
void MotionMaster::MoveTakeoff(uint32 id, Position const& pos)
{
float x, y, z;
pos.GetPosition(x, y, z);
MoveTakeoff(id, x, y, z);
}
示例10: OnTestParseFile
//.........这里部分代码省略.........
wxCHECK2(floatingText != NULL, continue);
wxString text = floatingText->GetText();
wxRect rect = floatingText->GetRect();
wxByte alignment = floatingText->GetAlignment();
bool border = floatingText->HasBorder();
// Font setting for the text
const FontSetting& fontSetting = floatingText->GetFontSettingConstRef();
wxString faceName = fontSetting.GetFaceName();
wxInt32 pointSize = fontSetting.GetPointSize();
wxInt32 weight = fontSetting.GetWeight();
bool italic = fontSetting.IsItalic();
bool underline = fontSetting.IsUnderline();
bool strikeOut = fontSetting.IsStrikeOut();
wxColor color = fontSetting.GetColor();
}
// Parse the guitar ins in the score
// In Power Tab Editor v1.7, guitar ins can be accessed via the Guitar In dialog:
// Menu Guitar -> Guitar In
// Guitar Ins are stored in the array by order of their system, position and
// staff values
wxUint32 guitarInIndex = 0;
wxUint32 guitarInCount = score->GetGuitarInCount();
for (; guitarInIndex < guitarInCount; guitarInIndex++)
{
GuitarIn* guitarIn = score->GetGuitarIn(guitarInIndex);
wxCHECK2(guitarIn != NULL, continue);
wxWord system = guitarIn->GetSystem();
wxByte staff = guitarIn->GetStaff();
wxByte position = guitarIn->GetPosition();
if (guitarIn->HasStaffGuitarsSet())
{
wxByte staffGuitars = guitarIn->GetStaffGuitars();
}
if (guitarIn->HasRhythmSlashGuitarsSet())
{
wxByte rhythmSlashGuitars = guitarIn->GetRhythmSlashGuitars();
}
}
// Parse the tempo markers in the score
// In Power Tab Editor v1.7, tempo markers can be accessed via the Tempo Marker dialog:
// Menu Music Symbols -> Tempo Marker
// and the Alteration of Pace dialog:
// Menu Music Symbols -> Alteration of Pace
// Tempo Markers are stored in the array by order of their system, position and
// staff values
wxUint32 tempoMarkerIndex = 0;
wxUint32 tempoMarkerCount = score->GetTempoMarkerCount();
for (; tempoMarkerIndex < tempoMarkerCount; tempoMarkerIndex++)
{
TempoMarker* tempoMarker = score->GetTempoMarker(tempoMarkerIndex);
wxCHECK2(tempoMarker != NULL, continue);
if (tempoMarker->IsStandardMarker())
{
wxByte beatType = tempoMarker->GetBeatType();
wxUint32 beatsPerMinute = tempoMarker->GetBeatsPerMinute();
}