Example #1
0
bool SafeControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
	if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
		return false;

	if (_rectangle.contains(backgroundImageSpacePos)) {
		int32 mR = backgroundImageSpacePos.sqrDist(_center);
		if (mR <= _outerRadiusSqr && mR >= _innerRadiusSqr) {
			setVenus();

			Common::Point tmp = backgroundImageSpacePos - _center;

			float dd = atan2((float)tmp.x, (float)tmp.y) * 57.29578;

			int16 dp_state = 360 / _statesCount;

			int16 m_state = (_statesCount - ((((int16)dd + 540) % 360) / dp_state)) % _statesCount;

			int16 tmp2 = (m_state + _curState - _zeroPointer + _statesCount - 1) % _statesCount;

			if (_animation)
				_animation->seekToFrame((_curState + _statesCount - _startPointer) % _statesCount);

			_curState = (_statesCount * 2 + tmp2) % _statesCount;

			_targetFrame = (_curState + _statesCount - _startPointer) % _statesCount;
			return true;
		}
	}
	return false;
}
Example #2
0
bool SlotControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
	if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
		return false;

	if (_hotspot.contains(backgroundImageSpacePos)) {
		setVenus();

		int item = _engine->getScriptManager()->getStateValue(_key);
		int mouseItem = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem);
		if (item != 0) {
			if (mouseItem != 0) {
				if (eligeblity(mouseItem)) {
					_engine->getScriptManager()->inventoryDrop(mouseItem);
					_engine->getScriptManager()->inventoryAdd(item);
					_engine->getScriptManager()->setStateValue(_key, mouseItem);
				}
			} else {
				_engine->getScriptManager()->inventoryAdd(item);
				_engine->getScriptManager()->setStateValue(_key, 0);
			}
		} else if (mouseItem == 0) {
			if (eligeblity(0)) {
				_engine->getScriptManager()->inventoryDrop(0);
				_engine->getScriptManager()->setStateValue(_key, 0);
			}
		} else if (eligeblity(mouseItem)) {
			_engine->getScriptManager()->setStateValue(_key, mouseItem);
			_engine->getScriptManager()->inventoryDrop(mouseItem);
		}
	}
	return false;
}
Example #3
0
bool InputControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
	if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
		return false;

	if (_textRectangle.contains(backgroundImageSpacePos)) {
		if (!_readOnly) {
			// Save
			_engine->getScriptManager()->focusControl(_key);
			setVenus();
		} else {
			// Restore
			if (_currentInputText.size()) {
				setVenus();
				_enterPressed = true;
			}
		}
	}
	return false;
}
Example #4
0
bool LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
	if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
		return false;

	if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) {
		setVenus();
		_mouseIsCaptured = true;
		_lastMousePos = backgroundImageSpacePos;
	}
	return false;
}
Example #5
0
bool PaintControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
    if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
        return false;

    if (_rectangle.contains(backgroundImageSpacePos)) {
        int mouseItem = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem);

        if (eligeblity(mouseItem)) {
            setVenus();
            _mouseDown = true;
        }
    }

    return false;
}
bool PushToggleControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
	if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
		return false;

	if (_event != Common::EVENT_LBUTTONUP)
		return false;

	if (contain(backgroundImageSpacePos)) {
		setVenus();
		int32 val = _engine->getScriptManager()->getStateValue(_key);
		val = (val + 1) % _countTo;
		_engine->getScriptManager()->setStateValue(_key, val);
		return true;
	}
	return false;
}