コード例 #1
0
ファイル: pspit.cpp プロジェクト: BenCastricum/scummvm
void PSpit::xpisland990_elevcombo(const ArgumentArray &args) {
	// Play button sound based on args[0]
	_vm->_sound->playSound(args[0] + 5);
	_vm->_cursor->hideCursor();
	_vm->delay(500);
	_vm->_cursor->showCursor();

	// If the user released the mouse button during the wait time, the mouse up event
	// is not forwarded to the game script handler. The button appears to be down
	// until the user moves the mouse outside of the button hotspot.
	// This happens with the original engine as well.
	// To work around this issue we run the mouse up script if the mouse is not
	// pressed anymore at this point.
	if (!mouseIsDown()) {
		Common::String buttonName = Common::String::format("combo%d", args[0]);
		RivenHotspot *button = _vm->getCard()->getHotspotByName(buttonName);
		RivenScriptPtr mouseUpScript = button->getScript(kMouseUpScript);
		_vm->_scriptMan->runScript(mouseUpScript, false);
	}

	// It is impossible to get here if Gehn is not trapped. However,
	// the original also disallows brute forcing the ending if you have
	// not yet trapped Gehn.
	if (_vm->_vars["agehn"] != 4)
		return;

	uint32 &correctDigits = _vm->_vars["pelevcombo"];

	// pelevcombo keeps count of how many buttons we have pressed in the correct order.
	// When pelevcombo is 5, clicking the handle will show the video freeing Catherine.
	if (correctDigits < 5 && args[0] == getComboDigit(_vm->_vars["pcorrectorder"], correctDigits))
		correctDigits++;
	else
		correctDigits = 0;
}
コード例 #2
0
ファイル: tspit.cpp プロジェクト: AReim1982/scummvm
void TSpit::xtisland390_covercombo(const ArgumentArray &args) {
	// Called when clicking the telescope cover buttons. args[0] is the button number (1...5).
	uint32 &correctDigits = _vm->_vars["tcovercombo"];

	if (correctDigits < 5 && args[0] == getComboDigit(_vm->_vars["tcorrectorder"], correctDigits))
		correctDigits++;
	else
		correctDigits = 0;

	// If we have hit the correct 5 buttons in a row, activate the hotspot to open up the
	// telescope cover.
	RivenHotspot *openCover = _vm->getCard()->getHotspotByName("openCover");
	openCover->enable(correctDigits == 5);
}
コード例 #3
0
void ASpit::cathBookDrawTelescopeCombination() {// Draw the telescope combination
	// The images for the numbers are tBMP's 13 through 17.
	// The start point is at (156, 247)
	uint32 teleCombo = _vm->_vars["tcorrectorder"];
	static const uint16 kNumberWidth = 32;
	static const uint16 kNumberHeight = 25;
	static const uint16 kDstX = 156;
	static const uint16 kDstY = 247;

	for (byte i = 0; i < 5; i++) {
			uint16 offset = (getComboDigit(teleCombo, i) - 1) * kNumberWidth;
			Common::Rect srcRect = Common::Rect(offset, 0, offset + kNumberWidth, kNumberHeight);
			Common::Rect dstRect = Common::Rect(i * kNumberWidth + kDstX, kDstY, (i + 1) * kNumberWidth + kDstX, kDstY + kNumberHeight);
			_vm->_gfx->drawImageRect(i + 13, srcRect, dstRect);
		}
}
コード例 #4
0
ファイル: ospit.cpp プロジェクト: BenCastricum/scummvm
void OSpit::xgwatch(const ArgumentArray &args) {
	// Hide the cursor
	_vm->_cursor->setCursor(kRivenHideCursor);

	uint32 prisonCombo = _vm->_vars["pcorrectorder"];

	byte curSound = 0;
	while (curSound < 5 && !_vm->hasGameEnded()) {
		// Play a sound every half second
		_vm->_sound->playSound(getComboDigit(prisonCombo, curSound) + 13);
		_vm->delay(500);

		curSound++;
	}

	// Now play the video for the watch
	_vm->getCard()->playMovie(1);
	RivenVideo *watchVideo = _vm->_video->openSlot(1);
	watchVideo->playBlocking();
}