本文整理汇总了C++中MapSector::setFloatProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ MapSector::setFloatProperty方法的具体用法?C++ MapSector::setFloatProperty怎么用?C++ MapSector::setFloatProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapSector
的用法示例。
在下文中一共展示了MapSector::setFloatProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/* Edit3D::changeOffset
* Changes the offset of selected walls by [amount]. X axis if [x] is
* true, otherwise Y axis
*******************************************************************/
void Edit3D::changeOffset(int amount, bool x) const
{
// Get items to process
vector<MapEditor::Item> items;
auto& selection_3d = context_.selection();
auto hilight_3d = context_.hilightItem();
if (selection_3d.empty())
{
if (hilight_3d.index >= 0 && hilight_3d.type != ItemType::Thing)
items.push_back(hilight_3d);
}
else
{
for (unsigned a = 0; a < selection_3d.size(); a++)
{
if (selection_3d[a].type != ItemType::Thing)
items.push_back(selection_3d[a]);
}
}
if (items.empty())
return;
// Begin undo level
context_.beginUndoRecordLocked("Change Offset", true, false, false);
// Go through items
vector<int> done;
bool changed = false;
for (unsigned a = 0; a < items.size(); a++)
{
// Wall
if (items[a].type >= ItemType::WallTop && items[a].type <= ItemType::WallBottom)
{
MapSide* side = context_.map().getSide(items[a].index);
// If offsets are linked, just change the whole side offset
if (link_offset_)
{
// Check we haven't processed this side already
if (VECTOR_EXISTS(done, items[a].index))
continue;
// Change the appropriate offset
if (x)
{
int offset = side->intProperty("offsetx");
side->setIntProperty("offsetx", offset + amount);
}
else
{
int offset = side->intProperty("offsety");
side->setIntProperty("offsety", offset + amount);
}
// Add to done list
done.push_back(items[a].index);
}
// Unlinked offsets
else
{
// Build property string (offset[x/y]_[top/mid/bottom])
string ofs = "offsetx";
if (!x) ofs = "offsety";
if (items[a].type == ItemType::WallBottom)
ofs += "_bottom";
else if (items[a].type == ItemType::WallTop)
ofs += "_top";
else
ofs += "_mid";
// Change the offset
int offset = side->floatProperty(ofs);
side->setFloatProperty(ofs, offset + amount);
}
changed = true;
}
// Flat (UDMF only)
else
{
MapSector* sector = context_.map().getSector(items[a].index);
if (Game::configuration().featureSupported(Game::UDMFFeature::FlatPanning))
{
if (items[a].type == ItemType::Floor)
{
if (x)
{
double offset = sector->floatProperty("xpanningfloor");
sector->setFloatProperty("xpanningfloor", offset + amount);
}
else
{
double offset = sector->floatProperty("ypanningfloor");
//.........这里部分代码省略.........