本文整理汇总了C++中GetPositionZ函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPositionZ函数的具体用法?C++ GetPositionZ怎么用?C++ GetPositionZ使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPositionZ函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SummonVehicle
void Vehicle::InstallAccessory(uint32 entry, int8 seatId)
{
if(Unit *passenger = GetPassenger(seatId))
{
// already installed
if(passenger->GetEntry() == entry)
return;
passenger->ExitVehicle(); // this should not happen
}
const CreatureInfo *cInfo = objmgr.GetCreatureTemplate(entry);
if(!cInfo)
return;
Creature *accessory;
if(cInfo->VehicleId)
accessory = SummonVehicle(entry, GetPositionX(), GetPositionY(), GetPositionZ());
else
accessory = SummonCreature(entry, GetPositionX(), GetPositionY(), GetPositionZ());
if(!accessory)
return;
accessory->EnterVehicle(this, seatId);
// This is not good, we have to send update twice
accessory->SendMovementFlagUpdate();
}
示例2: GetOrientation
void Transport::UpdateNPCPositions()
{
for(CreatureSet::iterator itr = m_NPCPassengerSet.begin(); itr != m_NPCPassengerSet.end(); ++itr)
{
Creature* npc = *itr;
float x, y, z, o;
o = GetOrientation() + npc->m_movementInfo.t_pos.m_orientation;
MapManager::NormalizeOrientation(o);
x = GetPositionX() + (npc->m_movementInfo.t_pos.m_positionX * cos(GetOrientation()) + npc->m_movementInfo.t_pos.m_positionY * sin(GetOrientation() + M_PI));
y = GetPositionY() + (npc->m_movementInfo.t_pos.m_positionY * cos(GetOrientation()) + npc->m_movementInfo.t_pos.m_positionX * sin(GetOrientation()));
z = GetPositionZ() + npc->m_movementInfo.t_pos.m_positionZ;
npc->SetHomePosition(x, y, z, o);
GetMap()->CreatureRelocation(npc, x, y, z, o, false);
}
for(PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr)
{
Player* plr = *itr;
float x, y, z, o;
o = GetOrientation() + plr->m_movementInfo.t_pos.m_orientation;
MapManager::NormalizeOrientation(o);
x = GetPositionX() + (plr->m_movementInfo.t_pos.m_positionX * cos(GetOrientation()) + plr->m_movementInfo.t_pos.m_positionY * sin(GetOrientation() + M_PI));
y = GetPositionY() + (plr->m_movementInfo.t_pos.m_positionY * cos(GetOrientation()) + plr->m_movementInfo.t_pos.m_positionX * sin(GetOrientation()));
z = GetPositionZ() + plr->m_movementInfo.t_pos.m_positionZ;
plr->Relocate(x, y, z, o);
UpdateData transData;
WorldPacket packet;
transData.BuildPacket(&packet);
plr->SendDirectMessage(&packet);
}
}
示例3: GetPositionY
void Enemy::Die()
{
Plane::Die();
Effect* boom = Effect::Create("boom1");
boom->SetPosition(GetPositionX(), GetPositionY(), GetPositionZ());
boom->SetOrder(LAYER_ENEMY_BOOM);
GetScene()->Add(boom);
Effect* cool = Effect::Create("cool");
cool->SetColorRGB(rand() % 128 + 128, rand() % 128 + 128, rand() % 128 + 128);
cool->ResetVertex();
cool->SetPosition(GetPositionX() + rand() % 21 - 10, GetPositionY() + rand() % 21 - 10, GetPositionZ());
cool->RunAction(Frame2D::Move::Create(2.5, GetPositionX() + 50, GetPositionY()));
cool->SetOrder(LAYER_UI_1);
GetScene()->Add(cool);
// 如果有道具那么掉落道具
if (_itemID != 0)
{
Item* item = Item::Create(_itemID);
item->SetPosition(GetPositionX(), GetPositionY(), GetPositionZ());
item->SetOrder(LAYER_ITEM);
GetScene()->Add(item);
_itemID = 0;
}
}
示例4: GetTemplate
void AreaTrigger::SearchUnitInBox(std::list<Unit*>& targetList)
{
float extentsX = GetTemplate()->BoxDatas.Extents[0];
float extentsY = GetTemplate()->BoxDatas.Extents[1];
float extentsZ = GetTemplate()->BoxDatas.Extents[2];
Trinity::AnyUnitInObjectRangeCheck check(this, GetTemplate()->MaxSearchRadius, false);
Trinity::UnitListSearcher<Trinity::AnyUnitInObjectRangeCheck> searcher(this, targetList, check);
Cell::VisitAllObjects(this, searcher, GetTemplate()->MaxSearchRadius);
float halfExtentsX = extentsX / 2.0f;
float halfExtentsY = extentsY / 2.0f;
float halfExtentsZ = extentsZ / 2.0f;
float minX = GetPositionX() - halfExtentsX;
float maxX = GetPositionX() + halfExtentsX;
float minY = GetPositionY() - halfExtentsY;
float maxY = GetPositionY() + halfExtentsY;
float minZ = GetPositionZ() - halfExtentsZ;
float maxZ = GetPositionZ() + halfExtentsZ;
G3D::AABox const box({ minX, minY, minZ }, { maxX, maxY, maxZ });
targetList.remove_if([&box](Unit* unit) -> bool
{
return !box.contains({ unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ() });
});
}
示例5: VALUES
void GameObject::SaveToFile(std::stringstream & name)
{
std::stringstream ss;
ss << "REPLACE INTO gameobject_spawns VALUES("
<< ((m_spawn == NULL) ? 0 : m_spawn->id) << ","
<< GetEntry() << ","
<< GetMapId() << ","
<< GetPositionX() << ","
<< GetPositionY() << ","
<< GetPositionZ() << ","
<< GetOrientation() << ","
<< GetFloatValue(GAMEOBJECT_ROTATION) << ","
<< GetFloatValue(GAMEOBJECT_ROTATION_01) << ","
<< GetFloatValue(GAMEOBJECT_ROTATION_02) << ","
<< GetFloatValue(GAMEOBJECT_ROTATION_03) << ","
<< GetUInt32Value(GAMEOBJECT_STATE) << ","
<< GetUInt32Value(GAMEOBJECT_FLAGS) << ","
<< GetUInt32Value(GAMEOBJECT_FACTION) << ","
<< GetFloatValue(OBJECT_FIELD_SCALE_X) << ","
<< "0)";
FILE * OutFile;
OutFile = fopen(name.str().c_str(), "wb");
if (!OutFile) return;
fwrite(ss.str().c_str(),1,ss.str().size(),OutFile);
fclose(OutFile);
}
示例6: DeleteFromDB
void Corpse::SaveToDB()
{
// prevent DB data inconsistence problems and duplicates
SQLTransaction trans = CharacterDatabase.BeginTransaction();
DeleteFromDB(trans);
uint16 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
stmt->setUInt32(index++, GetGUIDLow()); // corpseGuid
stmt->setUInt32(index++, GUID_LOPART(GetOwnerGUID())); // guid
stmt->setFloat (index++, GetPositionX()); // posX
stmt->setFloat (index++, GetPositionY()); // posY
stmt->setFloat (index++, GetPositionZ()); // posZ
stmt->setFloat (index++, GetOrientation()); // orientation
stmt->setUInt16(index++, GetMapId()); // mapId
stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
stmt->setString(index++, _ConcatFields(CORPSE_FIELD_ITEMS, EQUIPMENT_SLOT_END)); // itemCache
stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_SKIN_ID)); // bytes1
stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_FACIAL_HAIR_STYLE_ID)); // bytes2
stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
stmt->setUInt32(index++, uint32(m_time)); // time
stmt->setUInt8 (index++, GetType()); // corpseType
stmt->setUInt32(index++, GetInstanceId()); // instanceId
stmt->setUInt32(index++, GetPhaseMask()); // phaseMask
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
}
示例7: SetInstanceId
bool Corpse::Create(uint32 guidlow, Player *owner)
{
SetInstanceId(owner->GetInstanceId());
WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetMapId());
Relocate(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), owner->GetOrientation());
if (!IsPositionValid())
{
sLog.outLog(LOG_DEFAULT, "ERROR: Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow,owner->GetName(),owner->GetPositionX(), owner->GetPositionY());
return false;
}
SetFloatValue(OBJECT_FIELD_SCALE_X, 1);
SetFloatValue(CORPSE_FIELD_POS_X, GetPositionX());
SetFloatValue(CORPSE_FIELD_POS_Y, GetPositionY());
SetFloatValue(CORPSE_FIELD_POS_Z, GetPositionZ());
SetFloatValue(CORPSE_FIELD_FACING, GetOrientation());
SetUInt64Value(CORPSE_FIELD_OWNER, owner->GetGUID());
m_grid = Hellground::ComputeGridPair(GetPositionX(), GetPositionY());
return true;
}
示例8: DeleteFromDB
void Corpse::SaveToDB()
{
// prevent DB data inconsistence problems and duplicates
RealmDataDatabase.BeginTransaction();
DeleteFromDB();
static SqlStatementID saveCorpse;
SqlStatement stmt = RealmDataDatabase.CreateStatement(saveCorpse, "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
stmt.addUInt64(GetGUIDLow());
stmt.addUInt64(GUID_LOPART(GetOwnerGUID()));
stmt.addFloat(GetPositionX());
stmt.addFloat(GetPositionY());
stmt.addFloat(GetPositionZ());
stmt.addFloat(GetOrientation());
stmt.addUInt32(GetZoneId());
stmt.addUInt32(GetMapId());
stmt.addString(GetUInt32ValuesString());
stmt.addUInt64(m_time);
stmt.addUInt32(GetType());
stmt.addInt32(GetInstanceId());
stmt.Execute();
RealmDataDatabase.CommitTransaction();
}
示例9: MANGOS_ASSERT
void Corpse::SaveToDB()
{
// bones should not be saved to DB (would be deleted on startup anyway)
MANGOS_ASSERT(GetType() != CORPSE_BONES);
// prevent DB data inconsistence problems and duplicates
CharacterDatabase.BeginTransaction();
DeleteFromDB();
std::ostringstream ss;
ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance) VALUES ("
<< GetGUIDLow() << ", "
<< GUID_LOPART(GetOwnerGUID()) << ", "
<< GetPositionX() << ", "
<< GetPositionY() << ", "
<< GetPositionZ() << ", "
<< GetOrientation() << ", "
<< GetZoneId() << ", "
<< GetMapId() << ", '";
for(uint16 i = 0; i < m_valuesCount; ++i)
ss << GetUInt32Value(i) << " ";
ss << "',"
<< uint64(m_time) <<", "
<< uint32(GetType()) << ", "
<< int(GetInstanceId()) << ")";
CharacterDatabase.Execute( ss.str().c_str() );
CharacterDatabase.CommitTransaction();
}
示例10: DeleteFromDB
void Corpse::SaveToDB()
{
// prevent DB data inconsistence problems and duplicates
CharacterDatabase.BeginTransaction();
DeleteFromDB();
std::ostringstream ss;
ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance,phaseMask) VALUES ("
<< GetGUIDLow() << ", "
<< GUID_LOPART(GetOwnerGUID()) << ", "
<< GetPositionX() << ", "
<< GetPositionY() << ", "
<< GetPositionZ() << ", "
<< GetOrientation() << ", "
<< GetZoneId() << ", "
<< GetMapId() << ", '";
for (uint16 i = 0; i < m_valuesCount; ++i)
ss << GetUInt32Value(i) << " ";
ss << "',"
<< uint64(m_time) <<", "
<< uint32(GetType()) << ", "
<< int(GetInstanceId()) << ", "
<< uint16(GetPhaseMask()) << ")"; // prevent out of range error
CharacterDatabase.Execute(ss.str().c_str());
CharacterDatabase.CommitTransaction();
}
示例11: GetPositionX
void Position::RelocateOffset(const Position & offset)
{
m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + float(M_PI)));
m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
m_positionZ = GetPositionZ() + offset.GetPositionZ();
SetOrientation(GetOrientation() + offset.GetOrientation());
}
示例12: GetPositionX
bool Position::IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const
{
// rotate the WorldObject position instead of rotating the whole cube, that way we can make a simplified
// is-in-cube check and we have to calculate only one point instead of 4
// 2PI = 360*, keep in mind that ingame orientation is counter-clockwise
double rotation = 2 * M_PI - center.GetOrientation();
double sinVal = std::sin(rotation);
double cosVal = std::cos(rotation);
float BoxDistX = GetPositionX() - center.GetPositionX();
float BoxDistY = GetPositionY() - center.GetPositionY();
float rotX = float(center.GetPositionX() + BoxDistX * cosVal - BoxDistY*sinVal);
float rotY = float(center.GetPositionY() + BoxDistY * cosVal + BoxDistX*sinVal);
// box edges are parallel to coordiante axis, so we can treat every dimension independently :D
float dz = GetPositionZ() - center.GetPositionZ();
float dx = rotX - center.GetPositionX();
float dy = rotY - center.GetPositionY();
if ((std::fabs(dx) > xradius) ||
(std::fabs(dy) > yradius) ||
(std::fabs(dz) > zradius))
return false;
return true;
}
示例13: GetPositionX
void Creature::GetRespawnPosition(float &x, float &y, float &z, float* ori, float* dist) const
{
if (m_DBTableGuid)
{
if (CreatureData const* data = sObjectMgr->GetCreatureData(GetDBTableGUIDLow()))
{
x = data->posX;
y = data->posY;
z = data->posZ;
if (ori)
*ori = data->orientation;
if (dist)
*dist = data->spawndist;
return;
}
}
x = GetPositionX();
y = GetPositionY();
z = GetPositionZ();
if (ori)
*ori = GetOrientation();
if (dist)
*dist = 0;
}
示例14: GetPositionX
void Transport::UpdatePassengerPositions()
{
for (UnitSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr)
{
Unit* passenger = *itr;
// transport teleported but passenger not yet (can happen for players)
if (passenger->GetMap() != GetMap())
continue;
float x = GetPositionX() + (passenger->m_movementInfo.t_pos.m_positionX * cos(GetOrientation()) + passenger->m_movementInfo.t_pos.m_positionY * sin(GetOrientation() + M_PI));
float y = GetPositionY() + (passenger->m_movementInfo.t_pos.m_positionY * cos(GetOrientation()) + passenger->m_movementInfo.t_pos.m_positionX * sin(GetOrientation()));
float z = GetPositionZ() + passenger->m_movementInfo.t_pos.m_positionZ;
float o = GetOrientation() + passenger->m_movementInfo.t_pos.m_orientation;
MapManager::NormalizeOrientation(o);
switch (passenger->GetTypeId())
{
case TYPEID_UNIT:
passenger->ToCreature()->SetHomePosition(x, y, z, o);
GetMap()->CreatureRelocation(passenger->ToCreature(), x, y, z, o, false);
break;
case TYPEID_PLAYER:
GetMap()->PlayerRelocation(passenger->ToPlayer(), x, y, z, o);
break;
}
if (passenger->IsVehicle())
passenger->GetVehicleKit()->RelocatePassengers(x, y, z, o);
}
}
示例15: GetPositionX
void SpriteGroup::Render()
{
Element::Render();
for (int i = 0; i < m_sprite_list.size(); ++i)
{
Sprite* sprite = m_sprite_list.at(i);
sprite->Render();
sprite->SetPosition(
sprite->GetPositionX() - GetPositionX(),
sprite->GetPositionY() - GetPositionY(),
sprite->GetPositionZ() - GetPositionZ());
sprite->SetAngle(
sprite->GetAngleX() - GetAngleX(),
sprite->GetAngleY() - GetAngleY(),
sprite->GetAngleZ() - GetAngleZ());
sprite->SetAnchor(
sprite->GetAnchorX() * 2.0f - GetAnchorX(),
sprite->GetAnchorY() * 2.0f - GetAnchorY());
if (GetScaleX() != 0)
{
sprite->SetScaleX(sprite->GetScaleX() / GetScaleX());
}
if (GetScaleY() != 0)
{
sprite->SetScaleY(sprite->GetScaleY() / GetScaleY());
}
}
}