这篇教程C++ AIM_Initialize函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AIM_Initialize函数的典型用法代码示例。如果您正苦于以下问题:C++ AIM_Initialize函数的具体用法?C++ AIM_Initialize怎么用?C++ AIM_Initialize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AIM_Initialize函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SetInstanceIdvoid Totem::Summon(Unit* owner){ sLog.outDebug("AddObject at Totem.cpp line 49"); SetInstanceId(owner->GetInstanceId()); owner->GetMap()->Add((Creature*)this); // select totem model in dependent from owner team CreatureInfo const *cinfo = GetCreatureInfo(); if(owner->GetTypeId()==TYPEID_PLAYER && cinfo) { uint32 display_id = objmgr.ChooseDisplayId(((Player*)owner)->GetTeam(),cinfo); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; SetDisplayId(display_id); } WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << GetGUID(); SendMessageToSet(&data,true); AIM_Initialize(); switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; }}
开发者ID:Aemu,项目名称:mangos,代码行数:31,
示例2: setPowerTypevoid Vehicle::AddToWorld(){ if(!IsInWorld()) { if(m_zoneScript) m_zoneScript->OnCreatureCreate(this, true); ObjectAccessor::Instance().AddObject(this); for(uint32 i = 0; i < MAX_SPELL_VEHICLE; ++i) { if(!m_spells[i]) continue; SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i]); if(!spellInfo) continue; if(spellInfo->powerType == POWER_MANA) break; if(spellInfo->powerType == POWER_ENERGY) { setPowerType(POWER_ENERGY); SetMaxPower(POWER_ENERGY, 100); break; } } Unit::AddToWorld(); InstallAllAccessories(); AIM_Initialize(); }}
开发者ID:MilchBuby,项目名称:riboncore,代码行数:34,
示例3: AIM_Initializevoid Totem::Summon(Unit* owner){ AIM_Initialize(); owner->GetMap()->Add((Creature*)this); if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->JustSummoned((Creature*)this); // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch(m_type) { case TOTEM_PASSIVE: for (int i=0; i<MAX_CREATURE_SPELL_DATA_SLOT; ++i) if (m_spells[i]) CastSpell(this, m_spells[i], true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; }}
开发者ID:koksneo,项目名称:MangosBack,代码行数:26,
示例4: AIM_Initializevoid Totem::Summon(Unit* owner){ AIM_Initialize(); owner->GetMap()->Add((Creature*)this); if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->JustSummoned((Creature*)this);#ifdef ENABLE_ELUNA sEluna->OnSummoned(this, owner);#endif /* ENABLE_ELUNA */ // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch (m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; }}
开发者ID:mangosthree,项目名称:server,代码行数:26,
示例5: AIM_Initializevoid Totem::Summon(Unit* owner){ AIM_Initialize(); owner->GetMap()->Add((Creature*)this); if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->JustSummoned((Creature*)this); // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); // Totem of Wrath, Area Aura Enemies: Mod Crit % Taken if (m_spells[1] == 30708) CastSpell(this, m_spells[1], true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; }}
开发者ID:SPIRITnsk,项目名称:mangos,代码行数:26,
示例6: SetMaxHealthvoid Totem::Summon(Unit* owner){ if(!owner) return; // Mana Tide Totem should have 10% of caster's health if(GetSpell() == 16191) { SetMaxHealth(owner->GetMaxHealth()*10/100); SetHealth(GetMaxHealth()); } owner->GetMap()->Add((Creature*)this); AIM_Initialize(); // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; }}
开发者ID:AwkwardDev,项目名称:MangosFX,代码行数:31,
示例7: AIM_Initializevoid Totem::Summon(Unit* owner){ AIM_Initialize(); owner->GetMap()->Add((Creature*)this); WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << GetObjectGuid(); SendMessageToSet(&data,true); if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->JustSummoned((Creature*)this); // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; }}
开发者ID:Deffender,项目名称:mangos1,代码行数:27,
示例8: GetCreatureInfovoid Totem::Summon(Unit* owner){ owner->GetMap()->Add((Creature*)this); // select totem model in dependent from owner team CreatureInfo const *cinfo = GetCreatureInfo(); if(owner->GetTypeId() == TYPEID_PLAYER && cinfo) { uint32 display_id = sObjectMgr.ChooseDisplayId(((Player*)owner)->GetTeam(), cinfo); CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; SetDisplayId(display_id); } AIM_Initialize(); // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; }}
开发者ID:AdharRuafo,项目名称:mangos,代码行数:32,
示例9: AIM_Initializevoid Totem::Summon(Unit* owner){ AIM_Initialize(); owner->GetMap()->Add((Creature*)this); if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->JustSummoned((Creature*)this); switch(m_type) { case TOTEM_PASSIVE: { for (uint32 i = 0; i <= GetSpellMaxIndex(); ++i) { if (uint32 spellId = GetSpell(i)) CastSpell(this, spellId, true); } break; } case TOTEM_STATUE: { if (GetSpell(0)) CastSpell(GetOwner(), GetSpell(0), true); break; } default: break; }}
开发者ID:beyourself,项目名称:RustEmu-Core,代码行数:29,
示例10: SetMapIdbool Vehicle::Create(uint32 guidlow, Map *map, uint32 Entry, uint32 vehicleId, uint32 team){ SetMapId(map->GetId()); SetInstanceId(map->GetInstanceId()); Object::_Create(guidlow, Entry, HIGHGUID_VEHICLE); if(!InitEntry(Entry, team)) return false; m_defaultMovementType = IDLE_MOTION_TYPE; AIM_Initialize(); SetVehicleId(vehicleId); SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); CreatureInfo const *ci = GetCreatureInfo(); setFaction(team == ALLIANCE ? ci->faction_A : ci->faction_H); SetMaxHealth(ci->maxhealth); SelectLevel(ci); SetHealth(GetMaxHealth()); return true;}
开发者ID:Aemu,项目名称:mangos,代码行数:27,
示例11: SetSummonPropertiesvoid TemporarySummon::Summon(TempSummonType type, uint32 lifetime){ SetSummonProperties(type, lifetime); GetMap()->Add((Creature*)this); AIM_Initialize();}
开发者ID:Chuck5ta,项目名称:server-3,代码行数:8,
示例12: AIM_Initializevoid TemporarySummon::Summon(TempSummonType type, uint32 lifetime){ m_type = type; m_timer = lifetime; m_lifetime = lifetime; AIM_Initialize(); GetMap()->Add((Creature*)this);}
开发者ID:SeTM,项目名称:mangos,代码行数:9,
示例13: AIM_Initializevoid TemporarySummon::Summon(TempSummonType type, uint32 lifetime){ m_type = type; m_timer = lifetime; m_lifetime = lifetime; MapManager::Instance().GetMap(GetMapId(), this)->Add((Creature*)this); AIM_Initialize();}
开发者ID:yunishaa,项目名称:mangos-112,代码行数:10,
示例14: UpdateNPCPositionsvoid Transport::Update(uint32 p_diff){ UpdateNPCPositions(); if (!AI()) { if (!AIM_Initialize()) sLog->outError("Could not initialize GameObjectAI for Transport"); } else AI()->UpdateAI(p_diff); if (m_WayPoints.size() <= 1) return; m_timer = getMSTime() % m_period; while (((m_timer - m_curr->first) % m_pathTime) > ((m_next->first - m_curr->first) % m_pathTime)) { DoEventIfAny(*m_curr, true); m_curr = GetNextWayPoint(); m_next = GetNextWayPoint(); DoEventIfAny(*m_curr, false); // first check help in case client-server transport coordinates de-synchronization if (m_curr->second.mapid != GetMapId() || m_curr->second.teleport) { TeleportTransport(m_curr->second.mapid, m_curr->second.x, m_curr->second.y, m_curr->second.z); } else { Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z, GetAngle(m_next->second.x, m_next->second.y) + float(M_PI)); } sScriptMgr->OnRelocate(this, m_curr->first, m_curr->second.mapid, m_curr->second.x, m_curr->second.y, m_curr->second.z); m_nextNodeTime = m_curr->first; if (m_curr == m_WayPoints.begin()) sLog->outDebug(LOG_FILTER_TRANSPORTS, " ************ BEGIN ************** %s", m_name.c_str()); sLog->outDebug(LOG_FILTER_TRANSPORTS, "%s moved to %d %f %f %f %d", m_name.c_str(), m_curr->second.id, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid); } sScriptMgr->OnTransportUpdate(this, p_diff);}
开发者ID:FrenchCORE,项目名称:Server,代码行数:52,
示例15: Updatevoid Transport::Update(uint32 p_diff){ if (!AI()) { if (!AIM_Initialize()) TC_LOG_ERROR("entities.transport", "Could not initialize GameObjectAI for Transport"); } else AI()->UpdateAI(p_diff); if (m_WayPoints.size() <= 1) return; if (!m_period) return; m_timer = getMSTime() % m_period; while (((m_timer - m_curr->first) % m_pathTime) > ((m_next->first - m_curr->first) % m_pathTime)) { DoEventIfAny(*m_curr, true); m_curr = GetNextWayPoint(); m_next = GetNextWayPoint(); DoEventIfAny(*m_curr, false); // first check help in case client-server transport coordinates de-synchronization if (m_curr->second.mapid != GetMapId() || m_curr->second.teleport) { TeleportTransport(m_curr->second.mapid, m_curr->second.x, m_curr->second.y, m_curr->second.z); } else { Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z, GetAngle(m_next->second.x, m_next->second.y) + float(M_PI)); UpdateNPCPositions(); // COME BACK MARKER // This forces the server to update positions in transportation for players -- gunship UpdatePlayerPositions(); } sScriptMgr->OnRelocate(this, m_curr->first, m_curr->second.mapid, m_curr->second.x, m_curr->second.y, m_curr->second.z); m_nextNodeTime = m_curr->first; if (m_curr == m_WayPoints.begin()) TC_LOG_DEBUG("entities.transport", " ************ BEGIN ************** %s", m_name.c_str()); TC_LOG_DEBUG("entities.transport", "%s moved to %d %f %f %f %d", m_name.c_str(), m_curr->second.id, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid); } sScriptMgr->OnTransportUpdate(this, p_diff);}
开发者ID:Exodius,项目名称:chuspi,代码行数:51,
示例16: datavoid Totem::Summon(){ sLog.outDebug("AddObject at Totem.cpp line 49"); MapManager::Instance().GetMap(GetMapId())->Add((Creature*)this); WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM, 8); data << GetGUID(); SendMessageToSet(&data,true); AIM_Initialize(); if (m_type == TOTEM_PASSIVE) this->CastSpell(this, m_spell, true);}
开发者ID:Artea,项目名称:mangos-svn,代码行数:14,
示例17: GetCreatureInfovoid Totem::Summon(Unit* owner){ CreatureInfo const *cinfo = GetCreatureInfo(); if (owner->GetTypeId()==TYPEID_PLAYER && cinfo) { uint32 modelid = 0; if(((Player*)owner)->GetTeam() == HORDE) { if(cinfo->Modelid_H1) modelid = cinfo->Modelid_H1; else if(cinfo->Modelid_H2) modelid = cinfo->Modelid_H2; } else { if(cinfo->Modelid_A1) modelid = cinfo->Modelid_A1; else if(cinfo->Modelid_A2) modelid = cinfo->Modelid_A2; } if (modelid) SetDisplayId(modelid); else sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.",GetEntry(),((Player*)owner)->GetTeam()); } // Only add if a display exists. sLog.outDebug("AddObject at Totem.cpp line 49"); SetInstanceId(owner->GetInstanceId()); owner->GetMap()->Add((Creature*)this); WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << GetGUID(); SendMessageToSet(&data,true); AIM_Initialize(); switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; } if(GetEntry() == SENTRY_TOTEM_ENTRY) SetReactState(REACT_AGGRESSIVE);}
开发者ID:Bootz,项目名称:TC-One,代码行数:47,
示例18: SetInstanceIdvoid Totem::Summon(Unit* owner){ sLog.outDebug("AddObject at Totem.cpp line 49"); SetInstanceId(owner->GetInstanceId()); owner->GetMap()->Add((Creature*)this); // select totem model in dependent from owner team [-ZERO] not implemented/useful CreatureInfo const *cinfo = GetCreatureInfo(); if(owner->GetTypeId() == TYPEID_PLAYER && cinfo) { uint32 display_id = sObjectMgr.ChooseDisplayId(((Player*)owner)->GetTeam(), cinfo); CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; SetDisplayId(display_id); } WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << GetGUID(); SendMessageToSet(&data,true); AIM_Initialize(); if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->JustSummoned((Creature*)this); // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; }}
开发者ID:dythzer,项目名称:mangoszero,代码行数:42,
示例19: ASSERTvoid Creature::LoadFromDB(uint32 guid){ std::stringstream ss; ss << "SELECT * FROM creatures WHERE id=" << guid; QueryResult *result = sDatabase.Query( ss.str().c_str() ); ASSERT(result); Field *fields = result->Fetch(); Create(fields[8].GetUInt32(), objmgr.GetCreatureName(fields[8].GetUInt32())->Name.c_str(), fields[6].GetUInt32(), fields[1].GetFloat(), fields[2].GetFloat(), fields[3].GetFloat(), fields[4].GetFloat(), fields[8].GetUInt32()); m_zoneId = fields[5].GetUInt32(); m_moveRandom = fields[9].GetBool(); m_moveRun = fields[10].GetBool(); LoadValues(fields[7].GetString()); SetNameId(fields[8].GetUInt32()); _RealtimeSetCreatureInfo(); delete result; if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR ) ) _LoadGoods(); if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER ) ) _LoadQuests(); SetUInt32Value( OBJECT_FIELD_GUID+1, HIGHGUID_UNIT ); AIM_Initialize();}
开发者ID:Artea,项目名称:mangos-svn,代码行数:40,
示例20: AIM_Initializevoid Totem::Summon(Unit* owner){ owner->GetMap()->Add((Creature*)this); AIM_Initialize(); if (owner->AI()) owner->AI()->JustSummoned((Creature*)this); sEluna->OnSummoned(this, owner); // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch (m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), TRIGGERED_OLD_TRIGGERED); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), TRIGGERED_OLD_TRIGGERED); break; default: break; }}
开发者ID:ElunaLuaEngine,项目名称:ElunaMangosWotlk,代码行数:24,
示例21: ONbool Creature::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId){ bool external = (result != NULL); if (!external) // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 result = sDatabase.PQuery("SELECT `id`,`map`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`spawn_position_x`,`spawn_position_y`,`spawn_position_z`,`curhealth`,`curmana`,`respawntime`,`DeathState`,`MovementType`,`auras` " "FROM `creature` LEFT JOIN `creature_respawn` ON ((`creature`.`guid`=`creature_respawn`.`guid`) AND (`creature_respawn`.`instance` = '%u')) WHERE `creature`.`guid` = '%u'", InstanceId, guid); if(!result) { sLog.outErrorDb("Creature (GUID: %u) not found in table `creature`, can't load. ",guid); return false; } Field *fields = result->Fetch(); uint32 stored_guid = guid; if (InstanceId != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT); SetInstanceId(InstanceId); if(!Create(guid,fields[1].GetUInt32(),fields[2].GetFloat(),fields[3].GetFloat(), fields[4].GetFloat(),fields[5].GetFloat(),fields[0].GetUInt32())) { if (!external) delete result; return false; } m_DBTableGuid = stored_guid; if(GetCreatureInfo()->rank > 0) this->m_corpseDelay *= 3; //if creature is elite, then remove corpse later SetHealth(fields[11].GetUInt32()); SetPower(POWER_MANA,fields[12].GetUInt32()); m_respawnradius = fields[7].GetFloat(); respawn_cord[0] = fields[8].GetFloat(); respawn_cord[1] = fields[9].GetFloat(); respawn_cord[2] = fields[10].GetFloat(); m_respawnDelay = fields[6].GetUInt32(); m_deathState = (DeathState)fields[14].GetUInt32(); if(m_deathState == JUST_DIED) // Dont must be set to JUST_DEAD, see Creature::setDeathState JUST_DIED -> CORPSE promoting. { sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_DEAD (1). State set to ALIVE.",GetGUIDLow(),GetEntry()); m_deathState = ALIVE; } else if(m_deathState < ALIVE || m_deathState > DEAD) { sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u ) in wrong state: %d. State set to ALIVE.",GetGUIDLow(),GetEntry(),m_deathState); m_deathState = ALIVE; } m_respawnTime = (time_t)fields[13].GetUInt64(); if(m_respawnTime > time(NULL)) // not ready to respawn m_deathState = DEAD; else // ready to respawn { m_respawnTime = 0; sDatabase.PExecute("DELETE FROM `creature_respawn` WHERE `guid` = '%u' AND `instance` = '%u'", m_DBTableGuid, GetInstanceId()); } { uint32 mtg = fields[15].GetUInt32(); if(mtg < MAX_DB_MOTION_TYPE) m_defaultMovementType = MovementGeneratorType(mtg); else { m_defaultMovementType = IDLE_MOTION_TYPE; sLog.outErrorDb("Creature (GUID: %u ID: %u) have wrong movement generator type value %u, ignore and set to IDLE.",guid,GetEntry(),mtg); } } if(!external) delete result; LoadFlagRelatedData(); AIM_Initialize(); return true;}
开发者ID:chrayn,项目名称:mangos-06,代码行数:81,
示例22: AIvoid Transport::Update(uint32 diff){ uint32 const positionUpdateDelay = 200; if (AI()) AI()->UpdateAI(diff); else if (!AIM_Initialize()) TC_LOG_ERROR("entities.transport", "Could not initialize GameObjectAI for Transport"); if (GetKeyFrames().size() <= 1) return; m_goValue.Transport.PathProgress += diff; uint32 timer = m_goValue.Transport.PathProgress % GetPeriod(); // Set current waypoint // Desired outcome: _currentFrame->DepartureTime < timer < _nextFrame->ArriveTime // ... arrive | ... delay ... | departure // event / event / for (;;) { if (timer >= _currentFrame->ArriveTime) { if (!_triggeredArrivalEvent) { DoEventIfAny(*_currentFrame, false); _triggeredArrivalEvent = true; } if (timer < _currentFrame->DepartureTime) { SetMoving(false); if (_pendingStop) SetGoState(GO_STATE_READY); break; // its a stop frame and we are waiting } } if (_pendingStop && timer >= _currentFrame->DepartureTime && GetGoState() == GO_STATE_READY) { m_goValue.Transport.PathProgress = (m_goValue.Transport.PathProgress / GetPeriod()); m_goValue.Transport.PathProgress *= GetPeriod(); m_goValue.Transport.PathProgress += _currentFrame->ArriveTime; break; } if (timer >= _currentFrame->DepartureTime && !_triggeredDepartureEvent) { DoEventIfAny(*_currentFrame, true); // departure event _triggeredDepartureEvent = true; } if (timer >= _currentFrame->DepartureTime && timer < _currentFrame->NextArriveTime) break; // found current waypoint MoveToNextWaypoint(); // not waiting anymore SetMoving(true); // Enable movement if (GetGOInfo()->moTransport.canBeStopped) SetGoState(GO_STATE_ACTIVE); sScriptMgr->OnRelocate(this, _currentFrame->Node->index, _currentFrame->Node->mapid, _currentFrame->Node->x, _currentFrame->Node->y, _currentFrame->Node->z); TC_LOG_DEBUG("entities.transport", "Transport %u (%s) moved to node %u %u %f %f %f", GetEntry(), GetName().c_str(), _currentFrame->Node->index, _currentFrame->Node->mapid, _currentFrame->Node->x, _currentFrame->Node->y, _currentFrame->Node->z); // Departure event if (_currentFrame->IsTeleportFrame()) if (TeleportTransport(_nextFrame->Node->mapid, _nextFrame->Node->x, _nextFrame->Node->y, _nextFrame->Node->z)) return; // Update more in new map thread } // Add model to map after we are fully done with moving maps if (_delayedAddModel) { _delayedAddModel = false; if (m_model) GetMap()->InsertGameObjectModel(*m_model); } // Set position _positionChangeTimer.Update(diff); if (_positionChangeTimer.Passed()) { _positionChangeTimer.Reset(positionUpdateDelay); if (IsMoving()) { float t = CalculateSegmentPos(float(timer) * 0.001f); G3D::Vector3 pos, dir; _currentFrame->Spline->evaluate_percent(_currentFrame->Index, t, pos); _currentFrame->Spline->evaluate_derivative(_currentFrame->Index, t, dir); UpdatePosition(pos.x, pos.y, pos.z, atan2(dir.x, dir.y)); } } sScriptMgr->OnTransportUpdate(this, diff);}
开发者ID:Caydan,项目名称:WoWSCore548,代码行数:100,
示例23: Updatevoid Transport::Update(uint32 diff){ if (!AI()) { if (!AIM_Initialize()) sLog->outError("Could not initialize GameObjectAI for Transport"); } else AI()->UpdateAI(diff); if (_isStopped) return; if (GetKeyFrames().size() <= 1) return; //_moveTimer = getMSTime() % _transportInfo->pathTime; _moveTimer += diff; _moveTimer %= _transportInfo->pathTime; // need restart path from beginning /* if (m_timer < m_curr->pathTime) { m_curr = keyFrames.begin(); m_next = m_curr + 1; } */ while (_moveTimer > _nextFrame->pathTime || _moveTimer < _currentFrame->departureTime) { // arrived at next stop point if (_transportInfo->pathTime > _nextFrame->pathTime && _moveTimer < _nextFrame->departureTime) { if (IsMoving()) { SetMoving(false); DoEventIfAny(*_currentFrame, false); } break; } MoveToNextWayPoint(); SetMoving(true); DoEventIfAny(*_currentFrame, true); // first check help in case client-server transport coordinates de-synchronization if (_currentFrame->IsTeleportFrame()) TeleportTransport(_nextFrame->node->mapid, _nextFrame->node->x, _nextFrame->node->y, _nextFrame->node->z); ASSERT(_nextFrame != GetKeyFrames().begin()); sScriptMgr->OnRelocate(this, _currentFrame->node->index, _currentFrame->node->mapid, _currentFrame->node->x, _currentFrame->node->y, _currentFrame->node->z); sLog->outDebug(LOG_FILTER_TRANSPORTS, "%s moved to %f %f %f %d", GetName(), GetPositionX(), GetPositionY(), GetPositionZ(), _currentFrame->node->mapid); } if (IsMoving()) { if (_moveTimer < _currentFrame->departureTime || _moveTimer > _nextFrame->pathTime) sLog->outError("strange times, c.dep:%u, n.pt:%u (%s, %u)", _currentFrame->departureTime, _nextFrame->pathTime, GetName(), m_goInfo->moTransport.mapID); float t = CalculateSegmentPos((float)_moveTimer/(float)IN_MILLISECONDS); //if (t < -0.01f || t > 1.01f) // sLog.outError("strange t=%f (%s, %u)", t, GetName(), m_goInfo->moTransport.mapID); //G3D::Vector3 pos; //m_spline->Evaluate(m_curr->node->index - 1, t, pos); //G3D::Vector3 dir; //m_spline->EvaluateDerivative(m_curr->node->index - 1, t, dir); //dir.z = 0.0f; //dir = -dir.direction(); //Relocate(pos.x, pos.y, pos.z); float x = _currentFrame->node->x * (1.0f - t) + _nextFrame->node->x * t; float y = _currentFrame->node->y * (1.0f - t) + _nextFrame->node->y * t; float z = _currentFrame->node->z * (1.0f - t) + _nextFrame->node->z * t; float o = GetAngle(_nextFrame->node->x, _nextFrame->node->y) + float(M_PI); Relocate(x, y, z, o); UpdatePassengerPositions(); } sScriptMgr->OnTransportUpdate(this, diff);}
开发者ID:Devilcleave,项目名称:TrilliumEMU,代码行数:79,
示例24: AIvoid Transport::Update(uint32 diff){ uint32 const positionUpdateDelay = 200; if (AI()) AI()->UpdateAI(diff); else if (!AIM_Initialize()) TC_LOG_ERROR("entities.transport", "Could not initialize GameObjectAI for Transport"); if (GetKeyFrames().size() <= 1) return; if (IsMoving() || !_pendingStop) m_goValue.Transport.PathProgress += diff; uint32 timer = m_goValue.Transport.PathProgress % GetPeriod(); // Set current waypoint // Desired outcome: _currentFrame->DepartureTime < timer < _nextFrame->ArriveTime // ... arrive | ... delay ... | departure // event / event / for (;;) { if (timer >= _currentFrame->ArriveTime) { if (!_triggeredArrivalEvent) { DoEventIfAny(*_currentFrame, false); _triggeredArrivalEvent = true; } if (timer < _currentFrame->DepartureTime) { SetMoving(false); if (_pendingStop && GetGoState() != GO_STATE_READY) { SetGoState(GO_STATE_READY); m_goValue.Transport.PathProgress = (m_goValue.Transport.PathProgress / GetPeriod()); m_goValue.Transport.PathProgress *= GetPeriod(); m_goValue.Transport.PathProgress += _currentFrame->ArriveTime; } break; // its a stop frame and we are waiting } } if (timer >= _currentFrame->DepartureTime && !_triggeredDepartureEvent) { DoEventIfAny(*_currentFrame, true); // departure event _triggeredDepartureEvent = true; } // not waiting anymore SetMoving(true); // Enable movement if (GetGOInfo()->moTransport.canBeStopped) SetGoState(GO_STATE_ACTIVE); if (timer >= _currentFrame->DepartureTime && timer < _currentFrame->NextArriveTime) break; // found current waypoint MoveToNextWaypoint(); sScriptMgr->OnRelocate(this, _currentFrame->Node->index, _currentFrame->Node->mapid, _currentFrame->Node->x, _currentFrame->Node->y, _currentFrame->Node->z); TC_LOG_DEBUG("entities.transport", "Transport %u (%s) moved to node %u %u %f %f %f", GetEntry(), GetName().c_str(), _currentFrame->Node->index, _currentFrame->Node->mapid, _currentFrame->Node->x, _currentFrame->Node->y, _currentFrame->Node->z); // Departure event if (_currentFrame->IsTeleportFrame()) if (TeleportTransport(_nextFrame->Node->mapid, _nextFrame->Node->x, _nextFrame->Node->y, _nextFrame->Node->z, _nextFrame->InitialOrientation)) return; // Update more in new map thread } // Set position _positionChangeTimer.Update(diff); if (_positionChangeTimer.Passed()) { _positionChangeTimer.Reset(positionUpdateDelay); if (IsMoving()) { float t = CalculateSegmentPos(float(timer) * 0.001f); G3D::Vector3 pos, dir; _currentFrame->Spline->evaluate_percent(_currentFrame->Index, t, pos); _currentFrame->Spline->evaluate_derivative(_currentFrame->Index, t, dir); UpdatePosition(pos.x, pos.y, pos.z, atan2(dir.y, dir.x) + M_PI); } else { /* There are four possible scenarios that trigger loading/unloading passengers: 1. transport moves from inactive to active grid 2. the grid that transport is currently in becomes active 3. transport moves from active to inactive grid 4. the grid that transport is currently in unloads */ if (_staticPassengers.empty() && GetMap()->IsGridLoaded(GetPositionX(), GetPositionY())) // 2. LoadStaticPassengers(); } } sScriptMgr->OnTransportUpdate(this, diff);//.........这里部分代码省略.........
开发者ID:BravadoToDeath,项目名称:ArkCORE-NG,代码行数:101,
示例25: AIvoid Transport::Update(uint32 diff){ uint32 const positionUpdateDelay = 200; if (AI()) AI()->UpdateAI(diff); else if (!AIM_Initialize()) TC_LOG_ERROR("entities.transport", "Could not initialize GameObjectAI for Transport"); if (GetKeyFrames().size() <= 1) return; if (IsMoving() || !_pendingStop) m_goValue.Transport.PathProgress += diff; uint32 timer = m_goValue.Transport.PathProgress % GetTransportPeriod(); bool justStopped = false; // Set current waypoint // Desired outcome: _currentFrame->DepartureTime < timer < _nextFrame->ArriveTime // ... arrive | ... delay ... | departure // event / event / for (;;) { if (timer >= _currentFrame->ArriveTime) { if (!_triggeredArrivalEvent) { DoEventIfAny(*_currentFrame, false); _triggeredArrivalEvent = true; } if (timer < _currentFrame->DepartureTime) { SetMoving(false); justStopped = true; if (_pendingStop && GetGoState() != GO_STATE_READY) { SetGoState(GO_STATE_READY); m_goValue.Transport.PathProgress = (m_goValue.Transport.PathProgress / GetTransportPeriod()); m_goValue.Transport.PathProgress *= GetTransportPeriod(); m_goValue.Transport.PathProgress += _currentFrame->ArriveTime; } break; // its a stop frame and we are waiting } } if (timer >= _currentFrame->DepartureTime && !_triggeredDepartureEvent) { DoEventIfAny(*_currentFrame, true); // departure event _triggeredDepartureEvent = true; } // not waiting anymore SetMoving(true); // Enable movement if (GetGOInfo()->moTransport.allowstopping) SetGoState(GO_STATE_ACTIVE); if (timer >= _currentFrame->DepartureTime && timer < _currentFrame->NextArriveTime) break; // found current waypoint MoveToNextWaypoint(); sScriptMgr->OnRelocate(this, _currentFrame->Node->NodeIndex, _currentFrame->Node->ContinentID, _currentFrame->Node->Loc.X, _currentFrame->Node->Loc.Y, _currentFrame->Node->Loc.Z); TC_LOG_DEBUG("entities.transport", "Transport %u (%s) moved to node %u %u %f %f %f", GetEntry(), GetName().c_str(), _currentFrame->Node->NodeIndex, _currentFrame->Node->ContinentID, _currentFrame->Node->Loc.X, _currentFrame->Node->Loc.Y, _currentFrame->Node->Loc.Z); // Departure event if (_currentFrame->IsTeleportFrame()) if (TeleportTransport(_nextFrame->Node->ContinentID, _nextFrame->Node->Loc.X, _nextFrame->Node->Loc.Y, _nextFrame->Node->Loc.Z, _nextFrame->InitialOrientation)) return; // Update more in new map thread } // Add model to map after we are fully done with moving maps if (_delayedAddModel) { _delayedAddModel = false; if (m_model) GetMap()->InsertGameObjectModel(*m_model); } // Set position _positionChangeTimer.Update(diff); if (_positionChangeTimer.Passed()) { _positionChangeTimer.Reset(positionUpdateDelay); if (IsMoving()) { float t = !justStopped ? CalculateSegmentPos(float(timer) * 0.001f) : 1.0f; G3D::Vector3 pos, dir; _currentFrame->Spline->evaluate_percent(_currentFrame->Index, t, pos); _currentFrame->Spline->evaluate_derivative(_currentFrame->Index, t, dir); UpdatePosition(pos.x, pos.y, pos.z, std::atan2(dir.y, dir.x) + float(M_PI)); } else if (justStopped) UpdatePosition(_currentFrame->Node->Loc.X, _currentFrame->Node->Loc.Y, _currentFrame->Node->Loc.Z, _currentFrame->InitialOrientation); else {//.........这里部分代码省略.........
开发者ID:Asandru,项目名称:TrinityCore,代码行数:101,
注:本文中的AIM_Initialize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AIR_AFFINE函数代码示例 C++ AH_PRIVATE函数代码示例 |