Beispiel #1
0
void CRoom::setAlignType(RoomAlignType val)
{
    if (val == getAlignType())
        return;
    room.set_flag_align(static_cast<mapdata::Room::RoomAlignType>(val));
    rebuildDisplayList();
    setModified(true);
}
point2_t ModifyOffsetsDialog::calculateOffsets(int xoff, int yoff, int width, int height)
{
	int type = getAlignType();
	point2_t offset = getOffset();
	int x = xoff;
	int y = yoff;

	if (type >= 0)
	{
		// Monster
		if (type == 0)
		{
			x = width * 0.5;
			y = height - 4;
		}

		// Monster (GL-friendly)
		else if (type == 1)
		{
			x = width * 0.5;
			y = height;
		}

		// Projectile
		else if (type == 2)
		{
			x = width * 0.5;
			y = height * 0.5;
		}

		// Weapon (Fullscreen)
		else if (type == 3)
		{
			x = -160 + (width * 0.5);
			y = -200 + height;
		}

		// Weapon (Doom status bar)
		else if (type == 4)
		{
			x = -160 + (width * 0.5);
			y = -200 + 32 + height;
		}

		// Weapon (Heretic status bar)
		else if (type == 5)
		{
			x = -160 + (width * 0.5);
			y = -200 + 42 + height;
		}

		// Weapon (Hexen status bar)
		else if (type == 6)
		{
			x = -160 + (width * 0.5);
			y = -200 + 38 + height;
		}
	}
	else
	{
		// Relative offset
		if (relativeOffset())
		{
			if (xOffChange()) x = xoff + offset.x;
			if (yOffChange()) y = yoff + offset.y;
		}
		
		// Set offset
		else
		{
			if (xOffChange()) x = offset.x;
			if (yOffChange()) y = offset.y;
		}
	}

	return point2_t(x, y);
}