Esempio n. 1
0
Common::Error KyraEngine_LoK::go() {
	if (_res->getFileSize("6.FNT"))
		_screen->loadFont(Screen::FID_6_FNT, "6.FNT");
	_screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT");

	_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);

	_screen->setScreenDim(0);

	_abortIntroFlag = false;

	if (_flags.isDemo && !_flags.isTalkie) {
		_seqPlayerFlag = true;
		seq_demo();
		_seqPlayerFlag = false;
	} else {
		setGameFlag(0xF3);
		setGameFlag(0xFD);
		if (_gameToLoad == -1) {
			setGameFlag(0xEF);
			_seqPlayerFlag = true;
			seq_intro();
			_seqPlayerFlag = false;

			if (_flags.isDemo) {
				_screen->fadeToBlack();
				return Common::kNoError;
			}

			if (shouldQuit())
				return Common::kNoError;

			if (_skipIntroFlag && _abortIntroFlag && saveFileLoadable(0))
				resetGameFlag(0xEF);
		}
		_eventList.clear();
		startup();
		resetGameFlag(0xEF);
		mainLoop();
	}
	return Common::kNoError;
}
Esempio n. 2
0
void KyraEngine_MR::eelScript() {
	if (_chatText)
		return;
	_screen->hideMouse();

	if (_inventoryState)
		hideInventory();
	removeHandItem();

	objectChat((const char *)getTableEntry(_cCodeFile, 35), 0, 204, 35);
	objectChat((const char *)getTableEntry(_cCodeFile, 40), 0, 204, 40);

	setGameFlag(0xD1);

	snd_playSoundEffect(0x2A, 0xC8);

	setGameFlag(0x171);

	switch (_characterShapeFile-1) {
	case 0:
		runAnimationScript("EELS01.EMC", 0, 0, 1, 1);
		break;

	case 1:
		runAnimationScript("EELS02.EMC", 0, 0, 1, 1);
		break;

	case 2:
		runAnimationScript("EELS03.EMC", 0, 0, 1, 1);
		break;

	case 3:
		runAnimationScript("EELS04.EMC", 0, 0, 1, 1);
		break;

	default:
		resetGameFlag(0x171);
		runAnimationScript("EELS00.EMC", 0, 0, 1, 1);
	}

	changeChapter(2, 29, 0, 4);
	_screen->showMouse();
}
Esempio n. 3
0
void KyraEngine_HoF::handleInput(int x, int y) {
	setNextIdleAnimTimer();
	if (_unk5) {
		_unk5 = 0;
		return;
	}

	if (!_screen->isMouseVisible())
		return;

	if (_savedMouseState == -2) {
		snd_playSoundEffect(13);
		return;
	}

	setNextIdleAnimTimer();

	if (x <= 6 || x >= 312 || y <= 6 || y >= 135) {
		bool exitOk = false;
		assert(_savedMouseState + 6 >= 0);
		switch (_savedMouseState + 6) {
		case 0:
			if (_sceneExit1 != 0xFFFF)
				exitOk = true;
			break;

		case 1:
			if (_sceneExit2 != 0xFFFF)
				exitOk = true;
			break;

		case 2:
			if (_sceneExit3 != 0xFFFF)
				exitOk = true;
			break;

		case 3:
			if (_sceneExit4 != 0xFFFF)
				exitOk = true;
			break;

		default:
			break;
		}

		if (exitOk) {
			inputSceneChange(x, y, 1, 1);
			return;
		}
	}

	if (checkCharCollision(x, y) && _savedMouseState >= -1) {
		runSceneScript2();
		return;
	} else if (pickUpItem(x, y)) {
		return;
	} else {
		int skipHandling = 0;

		if (checkItemCollision(x, y) == -1) {
			resetGameFlag(0x1EF);
			skipHandling = handleInputUnkSub(x, y) ? 1 : 0;

			if (queryGameFlag(0x1EF)) {
				resetGameFlag(0x1EF);
				return;
			}

			if (_unk5) {
				_unk5 = 0;
				return;
			}
		}

		if (_deathHandler > -1)
			skipHandling = 1;

		if (skipHandling)
			return;

		if (checkCharCollision(x, y)) {
			runSceneScript2();
			return;
		}

		if (_itemInHand >= 0) {
			if (y > 136)
				return;

			dropItem(0, _itemInHand, x, y, 1);
		} else {
			if (_savedMouseState == -2 || y > 135)
				return;

			if (!_unk5) {
				inputSceneChange(x, y, 1, 1);
				return;
			}

			_unk5 = 0;
		}
	}
}
Esempio n. 4
0
void KyraEngine_HoF::runLoop() {
	_screen->updateScreen();

	_runFlag = true;
	while (!shouldQuit() && _runFlag) {
		if (_deathHandler >= 0) {
			removeHandItem();
			delay(5);
			_drawNoShapeFlag = 0;
			_gui->optionsButton(0);
			_deathHandler = -1;

			if (!_runFlag || shouldQuit())
				break;
		}

		if (_system->getMillis() > _nextIdleAnim)
			showIdleAnim();

		if (queryGameFlag(0x159)) {
			dinoRide();
			resetGameFlag(0x159);
		}

		if (queryGameFlag(0x124) && !queryGameFlag(0x125)) {
			_mainCharacter.animFrame = 32;
			enterNewScene(39, -1, 0, 0, 0);
		}

		if (queryGameFlag(0xD8)) {
			resetGameFlag(0xD8);
			if (_mainCharacter.sceneId == 34) {
				if (queryGameFlag(0xD1)) {
					initTalkObject(28);
					npcChatSequence(getTableString(0xFA, _cCodeBuffer, 1), 28, 0x83, 0xFA);
					deinitTalkObject(28);
					enterNewScene(35, 4, 0, 0, 0);
				} else if (queryGameFlag(0xD0)) {
					initTalkObject(29);
					npcChatSequence(getTableString(0xFB, _cCodeBuffer, 1), 29, 0x83, 0xFB);
					deinitTalkObject(29);
					enterNewScene(33, 6, 0, 0, 0);
				}
			}
		}

		int inputFlag = checkInput(_buttonList, true);
		removeInputTop();

		update();

		if (inputFlag == 198 || inputFlag == 199) {
			_savedMouseState = _mouseState;
			handleInput(_mouseX, _mouseY);
		}

		//if (queryGameFlag(0x1EE) && inputFlag)
		//	sub_13B19(inputFlag);

		_system->delayMillis(10);
	}
}
Esempio n. 5
0
int KyraEngine_v1::o1_resetGameFlag(EMCState *script) {
	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_resetGameFlag(%p) (0x%X)", (const void *)script, stackPos(0));
	return resetGameFlag(stackPos(0));
}
Esempio n. 6
0
void KyraEngine_MR::handleInput(int x, int y) {
	if (_inventoryState)
		return;
	setNextIdleAnimTimer();

	if (_unk5) {
		_unk5 = 0;
		return;
	}

	if (!_screen->isMouseVisible())
		return;

	if (_savedMouseState == -3) {
		snd_playSoundEffect(0x0D, 0x80);
		return;
	}

	setNextIdleAnimTimer();

	int skip = 0;

	if (checkCharCollision(x, y) && _savedMouseState >= -1 && runSceneScript2()) {
		return;
	} else if (_itemInHand != 27 && pickUpItem(x, y, 1)) {
		return;
	} else if (checkItemCollision(x, y) == -1) {
		resetGameFlag(1);
		skip = runSceneScript1(x, y);

		if (queryGameFlag(1)) {
			resetGameFlag(1);
			return;
		} else if (_unk5) {
			_unk5 = 0;
			return;
		}
	}

	if (_deathHandler >= 0)
		skip = 1;

	if (skip)
		return;

	if (checkCharCollision(x, y)) {
		if (runSceneScript2())
			return;
	} else if (_itemInHand >= 0 && _savedMouseState >= 0) {
		if (_itemInHand == 27) {
			makeCharFacingMouse();
		} else if (y <= 187) {
			if (_itemInHand == 43)
				removeHandItem();
			else
				dropItem(0, _itemInHand, x, y, 1);
		}
		return;
	} else if (_savedMouseState == -3) {
		return;
	} else {
		if (y > 187 && _savedMouseState > -4)
			return;
		if (_unk5) {
			_unk5 = 0;
			return;
		}
	}

	inputSceneChange(x, y, 1, 1);
}