Ejemplo n.º 1
0
bool CPetInventoryGlyph::dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) {
	if (!_item)
		return false;

	if (_background) {
		_field34 = 0;
		stopMovie();
	}

	CPetControl *petControl = getPetControl();
	if (!petControl)
		return false;

	CGameObject *carryParcel = petControl->getHiddenObject("CarryParcel");

	if (petControl->isSuccUBusActive() && carryParcel) {
		petControl->removeFromInventory(_item, carryParcel, false, true);
		petControl->removeFromInventory(_item, false, false);

		carryParcel->setPosition(Point(msg->_mousePos.x - carryParcel->getBounds().width() / 2,
			msg->_mousePos.y - carryParcel->getBounds().height() / 2));
		_item->setPosition(Point(SCREEN_WIDTH, SCREEN_HEIGHT));
	} else {
		petControl->removeFromInventory(_item, false, true);

		_item->setPosition(Point(msg->_mousePos.x - carryParcel->getBounds().width() / 2,
			msg->_mousePos.y - carryParcel->getBounds().height() / 2));
		_item->setVisible(true);
	}

	msg->_handled = true;
	if (msg->execute(carryParcel)) {
		_item = nullptr;
		_background = nullptr;
		_field34 = 0;
		petControl->setAreaChangeType(1);
		return true;
	} else {
		petControl->addToInventory(carryParcel);
		return false;
	}
}
Ejemplo n.º 2
0
bool CPetRoomsGlyph::dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) {
	bool isShiftPressed = g_vm->_window->getSpecialButtons() & MK_SHIFT;
	CPetControl *petControl = getPetControl();

	if (!isShiftPressed && petControl) {
		CGameObject *chevron = petControl->getHiddenObject("3PetChevron");

		if (chevron) {
			chevron->_id = _roomFlags;
			chevron->_isMail = _field38;
			petControl->removeFromInventory(chevron, false, false);
			chevron->loadSurface();

			chevron->dragMove(msg->_mousePos);
			msg->_handled = true;

			if (msg->execute(chevron))
				return true;
		}
	}

	return false;
}