本文整理汇总了C++中MapSector::floatProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ MapSector::floatProperty方法的具体用法?C++ MapSector::floatProperty怎么用?C++ MapSector::floatProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapSector
的用法示例。
在下文中一共展示了MapSector::floatProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/* InfoOverlay3D::update
* Updates the info text for the object of [item_type] at [item_index]
* in [map]
*******************************************************************/
void InfoOverlay3D::update(int item_index, int item_type, SLADEMap* map)
{
// Clear current info
info.clear();
info2.clear();
// Setup variables
current_type = item_type;
texname = "";
texture = NULL;
thing_icon = false;
int map_format = theMapEditor->currentMapDesc().format;
// Wall
if (item_type == MapEditor::SEL_SIDE_BOTTOM || item_type == MapEditor::SEL_SIDE_MIDDLE || item_type == MapEditor::SEL_SIDE_TOP)
{
// Get line and side
MapSide* side = map->getSide(item_index);
if (!side) return;
MapLine* line = side->getParentLine();
if (!line) return;
object = side;
// --- Line/side info ---
info.push_back(S_FMT("Line #%d", line->getIndex()));
if (side == line->s1())
info.push_back(S_FMT("Front Side #%d", side->getIndex()));
else
info.push_back(S_FMT("Back Side #%d", side->getIndex()));
// Relevant flags
string flags = "";
if (theGameConfiguration->lineBasicFlagSet("dontpegtop", line, map_format))
flags += "Upper Unpegged, ";
if (theGameConfiguration->lineBasicFlagSet("dontpegbottom", line, map_format))
flags += "Lower Unpegged, ";
if (theGameConfiguration->lineBasicFlagSet("blocking", line, map_format))
flags += "Blocking, ";
if (!flags.IsEmpty())
flags.RemoveLast(2);
info.push_back(flags);
info.push_back(S_FMT("Length: %d", (int)line->getLength()));
// Other potential info: special, sector#
// --- Wall part info ---
// Part
if (item_type == MapEditor::SEL_SIDE_BOTTOM)
info2.push_back("Lower Texture");
else if (item_type == MapEditor::SEL_SIDE_MIDDLE)
info2.push_back("Middle Texture");
else
info2.push_back("Upper Texture");
// Offsets
if (theGameConfiguration->udmfNamespace() == "zdoom")
{
// Get x offset info
int xoff = side->intProperty("offsetx");
double xoff_part = 0;
if (item_type == MapEditor::SEL_SIDE_BOTTOM)
xoff_part = side->floatProperty("offsetx_bottom");
else if (item_type == MapEditor::SEL_SIDE_MIDDLE)
xoff_part = side->floatProperty("offsetx_mid");
else
xoff_part = side->floatProperty("offsetx_top");
// Add x offset string
string xoff_info;
if (xoff_part == 0)
xoff_info = S_FMT("%d", xoff);
else if (xoff_part > 0)
xoff_info = S_FMT("%1.2f (%d+%1.2f)", (double)xoff+xoff_part, xoff, xoff_part);
else
xoff_info = S_FMT("%1.2f (%d-%1.2f)", (double)xoff+xoff_part, xoff, -xoff_part);
// Get y offset info
int yoff = side->intProperty("offsety");
double yoff_part = 0;
if (item_type == MapEditor::SEL_SIDE_BOTTOM)
yoff_part = side->floatProperty("offsety_bottom");
else if (item_type == MapEditor::SEL_SIDE_MIDDLE)
yoff_part = side->floatProperty("offsety_mid");
else
yoff_part = side->floatProperty("offsety_top");
// Add y offset string
string yoff_info;
if (yoff_part == 0)
yoff_info = S_FMT("%d", yoff);
else if (yoff_part > 0)
yoff_info = S_FMT("%1.2f (%d+%1.2f)", (double)yoff+yoff_part, yoff, yoff_part);
else
//.........这里部分代码省略.........
示例2: 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");
//.........这里部分代码省略.........