当前位置: 首页>>代码示例>>C++>>正文


C++ MapLine::s2方法代码示例

本文整理汇总了C++中MapLine::s2方法的典型用法代码示例。如果您正苦于以下问题:C++ MapLine::s2方法的具体用法?C++ MapLine::s2怎么用?C++ MapLine::s2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MapLine的用法示例。


在下文中一共展示了MapLine::s2方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: doCheck

	void doCheck()
	{
		double radius;

		// Get list of lines to check
		vector<MapLine*> check_lines;
		MapLine* line;
		for (unsigned a = 0; a < map->nLines(); a++)
		{
			line = map->getLine(a);

			// Skip if line is 2-sided and not blocking
			if (line->s2() && !theGameConfiguration->lineBasicFlagSet("blocking", line, map->currentFormat()))
				continue;

			check_lines.push_back(line);
		}

		// Go through things
		for (unsigned a = 0; a < map->nThings(); a++)
		{
			MapThing* thing = map->getThing(a);
			ThingType* tt = theGameConfiguration->thingType(thing->getType());

			// Skip if not a solid thing
			if (!tt->isSolid())
				continue;

			radius = tt->getRadius() - 1;

			// Go through lines
			for (unsigned b = 0; b < check_lines.size(); b++)
			{
				line = check_lines[b];

				// Check intersection
				if (MathStuff::boxLineIntersect(thing->xPos() - radius, thing->yPos() - radius,
					thing->xPos() + radius, thing->yPos() + radius,
					line->x1(), line->y1(), line->x2(), line->y2()))
				{
					things.push_back(thing);
					lines.push_back(line);
					break;
				}
			}
		}
	}
开发者ID:DemolisherOfSouls,项目名称:SLADE,代码行数:47,代码来源:MapChecks.cpp

示例2: fixProblem

	bool fixProblem(unsigned index, unsigned fix_type, MapEditor* editor)
	{
		if (index >= lines.size())
			return false;

		MapLine* line = map->getLine(lines[index]);
		if (line->s2())
		{
			// Flip
			if (fix_type == 0)
			{
				line->flip();
				return true;
			}

			// Create sector
			else if (fix_type == 1)
			{
				fpoint2_t pos = line->dirTabPoint(0.1);
				editor->createSector(pos.x, pos.y);
				doCheck();
				return true;
			}
		}
		else
		{
			// Delete
			if (fix_type == 0)
			{
				map->removeLine(line);
				doCheck();
				return true;
			}

			// Create sector
			else if (fix_type == 1)
			{
				fpoint2_t pos = line->dirTabPoint(0.1);
				editor->createSector(pos.x, pos.y);
				doCheck();
				return true;
			}
		}

		return false;
	}
开发者ID:jonrimmer,项目名称:SLADE,代码行数:46,代码来源:MapChecks.cpp

示例3: if


//.........这里部分代码省略.........
			// Scale
			double xscale, yscale;
			if (item_type == MapEditor::SEL_SIDE_BOTTOM)
			{
				xscale = side->floatProperty("scalex_bottom");
				yscale = side->floatProperty("scaley_bottom");
			}
			else if (item_type == MapEditor::SEL_SIDE_MIDDLE)
			{
				xscale = side->floatProperty("scalex_mid");
				yscale = side->floatProperty("scaley_mid");
			}
			else
			{
				xscale = side->floatProperty("scalex_top");
				yscale = side->floatProperty("scaley_top");
			}
			info2.push_back(S_FMT("Scale: %1.2fx, %1.2fx", xscale, yscale));
		}
		else
		{
			info2.push_back("");
		}

		// Height of this section of the wall
		// TODO this is wrong in the case of slopes, but slope support only
		// exists in the 3.1.1 branch
		fpoint2_t left_point, right_point;
		MapSide* other_side;
		if (side == line->s1())
		{
			left_point = line->v1()->getPoint(0);
			right_point = line->v2()->getPoint(0);
			other_side = line->s2();
		}
		else
		{
			left_point = line->v2()->getPoint(0);
			right_point = line->v1()->getPoint(0);
			other_side = line->s1();
		}

		MapSector* this_sector = side->getSector();
		MapSector* other_sector = NULL;
		if (other_side)
			other_sector = other_side->getSector();

		double left_height, right_height;
		if (item_type == MapEditor::SEL_SIDE_MIDDLE && other_sector)
		{
			// A two-sided line's middle area is the smallest distance between
			// both sides' floors and ceilings, which is more complicated with
			// slopes.
			plane_t floor1 = this_sector->getFloorPlane();
			plane_t floor2 = other_sector->getFloorPlane();
			plane_t ceiling1 = this_sector->getCeilingPlane();
			plane_t ceiling2 = other_sector->getCeilingPlane();
			left_height = min(ceiling1.height_at(left_point), ceiling2.height_at(left_point))
			            - max(floor1.height_at(left_point), floor2.height_at(left_point));
			right_height = min(ceiling1.height_at(right_point), ceiling2.height_at(right_point))
			             - max(floor1.height_at(right_point), floor2.height_at(right_point));
		}
		else
		{
			plane_t top_plane, bottom_plane;
			if (item_type == MapEditor::SEL_SIDE_MIDDLE)
开发者ID:Manuel-K,项目名称:SLADE,代码行数:67,代码来源:InfoOverlay3d.cpp


注:本文中的MapLine::s2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。