本文整理汇总了C++中LoadPath函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadPath函数的具体用法?C++ LoadPath怎么用?C++ LoadPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LoadPath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadPath
void WaypointMovementGenerator<Creature>::InitializeWaypointPath(Creature& u, int32 id, WaypointPathOrigin wpSource, uint32 initialDelay, uint32 overwriteEntry)
{
LoadPath(u, id, wpSource, overwriteEntry);
i_nextMoveTime.Reset(initialDelay);
// Start moving if possible
StartMove(u);
}
示例2: StopPath
void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/)
{
if (me->isInCombat())// no wp movement in combat
{
sLog->outError("SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
return;
}
if (HasEscortState(SMART_ESCORT_ESCORTING))
StopPath();
if (path)
if (!LoadPath(path))
return;
if (!mWayPoints || mWayPoints->empty())
return;
AddEscortState(SMART_ESCORT_ESCORTING);
mCanRepeatPath = repeat;
SetRun(run);
WayPoint* wp = GetNextWayPoint();
if (wp)
{
me->GetPosition(&mLastOOCPos);
me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, NULL, wp->id, GetScript()->GetPathId());
}
}
示例3: LoadPath
void WaypointMovementGenerator<Creature>::Reset(Creature &creature)
{
i_path = NULL;
LoadPath(creature);
SetStoppedByPlayer(false);
i_nextMoveTime.Reset(0);
creature.addUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
}
示例4: atunnel_InitTunnel
/*=================== Tunnel Initialization ================================*/
struct tunnel_state *
atunnel_InitTunnel(void)
{
struct tunnel_state *st = (struct tunnel_state *) calloc (1, sizeof(*st));
LoadPath(st);
st->current_texture = NRAND(MAX_TEXTURE);
return st;
}
示例5: LoadPath
void WaypointMovementGenerator<Creature>::Initialize(Creature& creature)
{
creature.addUnitState(UNIT_STAT_ROAMING);
creature.clearUnitState(UNIT_STAT_WAYPOINT_PAUSED);
LoadPath(creature);
StartMoveNow(creature);
}
示例6: LoadPath
void
FlightPathMovementGenerator::Initialize(Player &player)
{
player.getHostilRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT);
LoadPath(player);
i_currentNode = 0;
Traveller<Player> traveller(player);
// do not send movement, it was sent already
i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false);
}
示例7: LoadPath
void WaypointMovementGenerator<Creature>::DoInitialize(Creature* owner)
{
if (!owner)
return;
if (!owner->isAlive())
return;
LoadPath(owner);
owner->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
}
示例8: LoadPath
void FlightPathMovementGenerator::Initialize(Player &player)
{
player.getHostilRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT);
player.SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
LoadPath(player);
Traveller<Player> traveller(player);
// do not send movement, it was sent already
i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false);
player.SendMonsterMoveByPath(GetPath(),GetCurrentNode(),GetPathAtMapEnd(),MOVEMENTFLAG_WALK_MODE|MOVEMENTFLAG_ONTRANSPORT);
}
示例9: LoadPath
void FlightPathMovementGenerator::Initialize(Player &player)
{
// Random handlers used for quests etc. - best would be to add FlightPathMovementGenerator::Initialize to sub-script class (Feanor)
if( player.m_taxi.GetTaxiDestination() == 158 || player.m_taxi.GetTaxiDestination() == 243 )
player.SetDisplayId(16587);
player.getHostileRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT);
player.SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
LoadPath(player);
Traveller<Player> traveller(player);
// do not send movement, it was sent already
i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false);
player.SendMonsterMoveByPath(GetPath(),GetCurrentNode(),GetPathAtMapEnd(), SplineFlags(SPLINEFLAG_WALKMODE|SPLINEFLAG_FLYING));
}
示例10: LoadPath
void PathBehavior::DoStepPostEvents(RuntimeScene & scene)
{
if(!isPathLoaded)
{
LoadPath(scene);
Reset();
}
if(futureSegment != -1)
{
EnterSegment(futureSegment);
futureSegment = -1;
}
if(futurePosition != -1)
{
timeOnSegment = futurePosition * totalSegmentTime;
futurePosition = -1;
}
}
示例11: LoadPath
/**
* Called at each frame before events :
* Position the object on the path
*/
void PathBehavior::DoStepPreEvents(RuntimeScene & scene)
{
if(!isPathLoaded)
{
LoadPath(scene);
Reset();
}
// add to the current time along the path
timeOnSegment += static_cast<double>(scene.GetTimeManager().GetElapsedTime())
/ 1000000.0 * speed;
// if I reached the end of this segment, move to a new segment
if (timeOnSegment >= totalSegmentTime && currentSegment < path.size())
EnterSegment(currentSegment + 1);
//Position object on the segment
sf::Vector2f newPos;
if ( !path.empty() && currentSegment < path.size()-1 )
newPos = offset + path[currentSegment] + (path[currentSegment + 1] - path[currentSegment]) * (timeOnSegment / totalSegmentTime);
else
{
if ( stopAtEnd && !path.empty()) newPos = path.back() + offset;
else if (reverseAtEnd)
{
std::reverse(path.begin(), path.end());
EnterSegment(0);
if (!path.empty()) newPos = path.front() + offset;
}
else
{
EnterSegment(0);
if (!path.empty()) newPos = path.front() + offset;
}
}
object->SetX(newPos.x);
object->SetY(newPos.y);
return;
}
示例12: TC_LOG_ERROR
void SmartAI::StartPath(bool run/* = false*/, uint32 pathId/* = 0*/, bool repeat/* = false*/, Unit* invoker/* = nullptr*/, uint32 nodeId/* = 1*/)
{
if (me->IsInCombat()) // no wp movement in combat
{
TC_LOG_ERROR("misc", "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement (%u) while in combat, ignoring.", me->GetEntry(), pathId);
return;
}
if (HasEscortState(SMART_ESCORT_ESCORTING))
StopPath();
SetRun(run);
if (pathId)
{
if (!LoadPath(pathId))
return;
}
if (_path.nodes.empty())
return;
_currentWaypointNode = nodeId;
_waypointPathEnded = false;
_repeatWaypointPath = repeat;
// Do not use AddEscortState, removing everything from previous
_escortState = SMART_ESCORT_ESCORTING;
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
{
_escortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
me->SetFlag(UNIT_NPC_FLAGS, 0);
}
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, _currentWaypointNode, GetScript()->GetPathId());
me->GetMotionMaster()->MovePath(_path, _repeatWaypointPath);
}
示例13: StopPath
void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
{
if (me->IsInCombat())// no wp movement in combat
{
sLog->outError("SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
return;
}
if (HasEscortState(SMART_ESCORT_ESCORTING))
StopPath();
if (path)
{
if (!LoadPath(path))
return;
}
if (!mWayPoints || mWayPoints->empty())
return;
if (WayPoint* wp = GetNextWayPoint())
{
AddEscortState(SMART_ESCORT_ESCORTING);
mCanRepeatPath = repeat;
SetRun(run);
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
{
mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
}
Movement::PointsArray pathPoints;
GenerateWayPointArray(&pathPoints);
me->GetMotionMaster()->MoveSplinePath(&pathPoints);
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, NULL, wp->id, GetScript()->GetPathId());
}
}
示例14: LoadPath
void FlightPathMovementGenerator::Initialize(Player &player)
{
player.getHostileRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT);
player.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
LoadPath(player);
Traveller<Player> traveller(player);
// do not send movement, it was sent already
i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false);
player.SendMonsterMoveByPath(GetPath(), GetCurrentNode(), GetPathAtMapEnd());
// Storage to preload flightmaster grid at end of flight. For multi-stop flights, this will
// be reinitialized for each flightmaster at the end of each spline (or stop) in the flight.
uint32 nodeCount = i_mapIds.size(); // Get the number of nodes in the path. i_path and i_mapIds are the
// same size when loaded in ObjectMgr::GetTaxiPathNodes, called from LoadPath()
m_endMapId = i_mapIds[nodeCount -1]; // Get the map ID from the last node
m_preloadTargetNode = nodeCount - 3; // 2 nodes before the final node, we pre-load the grid
m_endGridX = i_path[nodeCount -1].x; // Get the X position from the last node
m_endGridY = i_path[nodeCount -1].y; // Get tye Y position from the last node
}
示例15: TC_LOG_ERROR
void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
{
if (me->IsInCombat())// no wp movement in combat
{
TC_LOG_ERROR("misc", "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
return;
}
if (HasEscortState(SMART_ESCORT_ESCORTING))
StopPath();
SetRun(run);
if (path)
if (!LoadPath(path))
return;
if (_path.nodes.empty())
return;
mCurrentWPID = 1;
m_Ended = false;
// Do not use AddEscortState, removing everything from previous cycle
mEscortState = SMART_ESCORT_ESCORTING;
mCanRepeatPath = repeat;
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
{
mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
me->SetFlag(UNIT_NPC_FLAGS, 0);
}
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, mCurrentWPID, GetScript()->GetPathId());
me->GetMotionMaster()->MovePath(_path, mCanRepeatPath);
}