Exemplo n.º 1
0
void KyraEngine_MR::changeChapter(int newChapter, int sceneId, int malcolmShapes, int facing) {
	resetItemList();

	_currentChapter = newChapter;
	runStartupScript(newChapter, 0);
	_mainCharacter.dlgIndex = 0;

	_malcolmsMood = 1;
	memset(_newSceneDlgState, 0, sizeof(_newSceneDlgState));

	if (malcolmShapes >= 0)
		loadCharacterShapes(malcolmShapes);

	enterNewScene(sceneId, facing, 0, 0, 0);
}
Exemplo n.º 2
0
int KyraEngine_MR::o3_disguiseMalcolm(EMCState *script) {
	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o3_disguiseMalcolm(%p) (%d)", (const void *)script, stackPos(0));
	loadCharacterShapes(stackPos(0));
	updateDlgIndex();
	return 0;
}
Exemplo n.º 3
0
Common::Error KyraEngine_MR::loadGameState(int slot) {
	const char *fileName = getSavegameFilename(slot);

	SaveHeader header;
	Common::InSaveFile *saveFile = openSaveForReading(fileName, header);
	if (!saveFile) {
		showMessageFromCCode(17, 0xB3, 0);
		snd_playSoundEffect(0x0D, 0xC8);
		return Common::kUnknownError;
	}

	if (header.originalSave)
		warning("Trying to load savegame from original interpreter, while this is possible, it is not officially supported");

	if (_inventoryState) {
		updateCharacterAnim(0);
		restorePage3();
		drawAnimObjects();
		_inventoryState = true;
		refreshAnimObjects(0);
		hideInventory();
	}

	_deathHandler = -1;
	if (!_unkSceneScreenFlag1)
		_lastMusicCommand = -1;

	int curShapes = _characterShapeFile;

	Common::SeekableSubReadStreamEndian in(saveFile, saveFile->pos(), saveFile->size(), !header.originalSave, DisposeAfterUse::YES);

	_screen->hideMouse();

	if (!header.originalSave) {
		_timer->loadDataFromFile(in, header.version);

		uint32 flagsSize = in.readUint32BE();
		assert(flagsSize <= sizeof(_flagsTable));
		in.read(_flagsTable, flagsSize);
	}

	_lastMusicCommand = in.readSint16();
	_currentChapter = in.readByte();
	_characterShapeFile = in.readByte();

	if (header.version >= 12 || header.originalSave)
		_album.curPage = in.readByte();
	if (header.originalSave)
		in.readByte();

	_score = in.readSint16();
	_scoreMax = in.readSint16();
	_malcolmsMood = in.readByte();

	if (header.originalSave)
		in.seek(8, SEEK_CUR);

	for (int i = 0; i < 30; ++i)
		in.read(_conversationState[i], 30);

	if (!header.originalSave) {
		in.read(_newSceneDlgState, 40);
	} else {
		for (int i = 0; i < 40; ++i)
			_newSceneDlgState[i] = in.readUint16();
	}

	for (int i = 0; i < 100; ++i)
		_hiddenItems[i] = in.readSint16();

	if (header.originalSave)
		in.read(_flagsTable, 69);
	in.read(_scoreFlagTable, 26);

	_mainCharacter.sceneId = in.readUint16();
	_mainCharacter.dlgIndex = in.readSint16();
	_mainCharacter.height = in.readByte();
	_mainCharacter.facing = in.readByte();
	_mainCharacter.animFrame = in.readUint16();
	if (!header.originalSave) {
		_mainCharacter.walkspeed = in.readByte();
	} else {
		in.seek(2, SEEK_CUR);
		_mainCharacter.walkspeed = in.readUint32();
	}
	for (int i = 0; i < 10; ++i)
		_mainCharacter.inventory[i] = in.readUint16();
	_mainCharacter.x1 = in.readSint16();
	_mainCharacter.y1 = in.readSint16();
	_mainCharacter.x2 = in.readSint16();
	_mainCharacter.y2 = in.readSint16();
	_mainCharacter.x3 = in.readSint16();
	_mainCharacter.y3 = in.readSint16();

	for (int i = 0; i < 50; ++i) {
		_itemList[i].id = in.readSint16();
		_itemList[i].sceneId = in.readUint16();
		_itemList[i].x = in.readSint16();
		_itemList[i].y = in.readSint16();
		if (header.version <= 9 || header.originalSave)
			in.readUint16();
	}

	for (int i = 0; i < 88; ++i) {
		in.read(_talkObjectList[i].filename, 13);
		_talkObjectList[i].sceneAnim = in.readByte();
		_talkObjectList[i].sceneScript = in.readByte();
		_talkObjectList[i].x = in.readSint16();
		_talkObjectList[i].y = in.readSint16();
		_talkObjectList[i].color = in.readByte();
		if (header.version >= 13 || header.originalSave)
			_talkObjectList[i].sceneId = in.readByte();
	}

	for (int i = 0; i < 98; ++i) {
		if (!header.originalSave) {
			in.read(_sceneList[i].filename1, 10);
		} else {
			in.read(_sceneList[i].filename1, 9);
			_sceneList[i].filename1[9] = 0;
		}

		if (!header.originalSave) {
			in.read(_sceneList[i].filename2, 10);
		} else {
			in.read(_sceneList[i].filename2, 9);
			_sceneList[i].filename2[9] = 0;
		}

		_sceneList[i].exit1 = in.readUint16();
		_sceneList[i].exit2 = in.readUint16();
		_sceneList[i].exit3 = in.readUint16();
		_sceneList[i].exit4 = in.readUint16();
		_sceneList[i].flags = in.readByte();
		_sceneList[i].sound = in.readByte();
	}

	_itemInHand = in.readSint16();

	if (header.originalSave) {
		uint32 currentTime = _system->getMillis();

		for (int i = 0; i < 6; ++i)
			_timer->setDelay(i, in.readSint32LE());

		for (int i = 0; i < 6; ++i) {
			if (in.readUint16LE())
				_timer->enable(i);
			else
				_timer->disable(i);
		}

		for (int i = 0; i < 6; ++i)
			_timer->setNextRun(i, currentTime + (in.readUint32LE() * _tickLength));

		_timer->resetNextRun();
	}

	_sceneExit1 = in.readUint16();
	_sceneExit2 = in.readUint16();
	_sceneExit3 = in.readUint16();
	_sceneExit4 = in.readUint16();

	if (saveFile->err() || saveFile->eos()) {
		warning("Load failed ('%s', '%s').", fileName, header.description.c_str());
		return Common::kUnknownError;
	} else {
		debugC(1, kDebugLevelMain, "Loaded savegame '%s.'", header.description.c_str());
	}

	_loadingState = true;
	updateCharacterAnim(0);
	_loadingState = false;

	if (curShapes != _characterShapeFile)
		loadCharacterShapes(_characterShapeFile);

	_mainCharX = _mainCharacter.x2 = _mainCharacter.x1;
	_mainCharY = _mainCharacter.y2 = _mainCharacter.y1;
	_mainCharacter.facing = 4;
	_badConscienceShown = false;
	_badConsciencePosition = false;
	_goodConscienceShown = false;
	_goodConsciencePosition = false;

	enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1);
	setHandItem(_itemInHand);

	if (_lastMusicCommand >= 0 && !_unkSceneScreenFlag1)
		snd_playWanderScoreViaMap(_lastMusicCommand, 1);
	else if (_lastMusicCommand == -1)
		snd_playWanderScoreViaMap(28, 1);

	while (!_screen->isMouseVisible())
		_screen->showMouse();

	setCommandLineRestoreTimer(7);
	_shownMessage = " ";
	_restoreCommandLine = false;

	// We didn't explicitly set the walk speed, but it's saved as part of
	// the _timers array, so we need to re-sync it with _configWalkspeed.
	setWalkspeed(_configWalkspeed);

	return Common::kNoError;
}
Exemplo n.º 4
0
void KyraEngine_HoF::startup() {
	_sound->setSoundList(&_soundData[kMusicIngame]);
	// The track map is exactly the same
	// for FM-TOWNS and DOS
	_trackMap = _dosTrackMap;
	_trackMapSize = _dosTrackMapSize;

	allocAnimObjects(1, 10, 30);

	_screen->_curPage = 0;

	memset(_sceneShapeTable, 0, sizeof(_sceneShapeTable));
	_gamePlayBuffer = new uint8[46080];
	_unkBuf500Bytes = new uint8[500];

	loadMouseShapes();
	loadItemShapes();

	_screen->setMouseCursor(0, 0, getShapePtr(0));

	_screenBuffer = new uint8[64000];
	_unkBuf200kByte = new uint8[200000];

	loadChapterBuffer(_newChapterFile);

	loadCCodeBuffer("C_CODE.XXX");

	if (_flags.isTalkie) {
		loadOptionsBuffer("OPTIONS.XXX");

		showMessageFromCCode(265, 150, 0);
		_screen->updateScreen();
		openTalkFile(0);
		_currentTalkFile = 1;
		openTalkFile(1);
	} else {
		_optionsBuffer = _cCodeBuffer;
	}

	showMessage(0, 207);

	_screen->setShapePages(5, 3);

	_mainCharacter.height = 0x30;
	_mainCharacter.facing = 4;
	_mainCharacter.animFrame = 0x12;

	memset(_sceneAnims, 0, sizeof(_sceneAnims));
	for (int i = 0; i < ARRAYSIZE(_sceneAnimMovie); ++i)
		_sceneAnimMovie[i] = new WSAMovie_v2(this);
	memset(_wsaSlots, 0, sizeof(_wsaSlots));
	for (int i = 0; i < ARRAYSIZE(_wsaSlots); ++i)
		_wsaSlots[i] = new WSAMovie_v2(this);

	_screen->_curPage = 0;

	_talkObjectList = new TalkObject[72];
	memset(_talkObjectList, 0, sizeof(TalkObject)*72);
	_shapeDescTable = new ShapeDesc[55];
	memset(_shapeDescTable, 0, sizeof(ShapeDesc)*55);

	for (int i = 9; i <= 32; ++i) {
		_shapeDescTable[i-9].width = 30;
		_shapeDescTable[i-9].height = 55;
		_shapeDescTable[i-9].xAdd = -15;
		_shapeDescTable[i-9].yAdd = -50;
	}

	for (int i = 19; i <= 24; ++i) {
		_shapeDescTable[i-9].width = 53;
		_shapeDescTable[i-9].yAdd = -51;
	}

	_gfxBackUpRect = new uint8[_screen->getRectSize(32, 32)];
	initItemList(30);
	loadButtonShapes();
	resetItemList();
	_characterShapeFile = 1;
	loadCharacterShapes(_characterShapeFile);
	initInventoryButtonList();
	setupLangButtonShapes();
	loadInventoryShapes();

	_screen->loadPalette("PALETTE.COL", _screen->getPalette(0));
	_screen->loadBitmap("_PLAYFLD.CPS", 3, 3, 0);
	_screen->copyPage(3, 0);
	_screen->showMouse();
	_screen->hideMouse();

	clearAnimObjects();

	for (int i = 0; i < 19; ++i)
		memset(_conversationState[i], -1, sizeof(int8)*14);
	clearCauldronTable();
	memset(_inputColorCode, -1, sizeof(_inputColorCode));
	memset(_newSceneDlgState, 0, sizeof(_newSceneDlgState));
	for (int i = 0; i < 23; ++i)
		resetCauldronStateTable(i);

	_sceneList = new SceneDesc[86];
	memset(_sceneList, 0, sizeof(SceneDesc)*86);
	_sceneListSize = 86;
	runStartScript(1, 0);
	loadNPCScript();

	if (_gameToLoad == -1) {
		snd_playWanderScoreViaMap(52, 1);
		enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1);
		saveGameStateIntern(0, "New Game", 0);
	} else {
		loadGameStateCheck(_gameToLoad);
	}

	_screen->showMouse();

	if (_menuDirectlyToLoad)
		(*_inventoryButtons[0].buttonCallback)(&_inventoryButtons[0]);

	setNextIdleAnimTimer();
	setWalkspeed(_configWalkspeed);
}
Exemplo n.º 5
0
void KyraEngine_LoK::startup() {
	static const uint8 colorMap[] = { 0, 0, 0, 0, 12, 12, 12, 0, 0, 0, 0, 0 };
	_screen->setTextColorMap(colorMap);

	_sound->selectAudioResourceSet(kMusicIngame);
	if (_flags.platform == Common::kPlatformPC98)
		_sound->loadSoundFile("SE.DAT");
	else
		_sound->loadSoundFile(0);

//	_screen->setFont(Screen::FID_6_FNT);
	_screen->setAnimBlockPtr(3750);
	memset(_sceneAnimTable, 0, sizeof(_sceneAnimTable));
	loadMouseShapes();
	_currentCharacter = &_characterList[0];
	for (int i = 1; i < 5; ++i)
		_animator->setCharacterDefaultFrame(i);
	for (int i = 5; i <= 10; ++i)
		setCharactersPositions(i);
	_animator->setCharactersHeight();
	resetBrandonPoisonFlags();
	_screen->_curPage = 0;
	// XXX
	for (int i = 0; i < 12; ++i) {
		int size = _screen->getRectSize(3, 24);
		_shapes[361 + i] = new byte[size];
	}

	_itemBkgBackUp[0] = new uint8[_screen->getRectSize(3, 24)];
	memset(_itemBkgBackUp[0], 0, _screen->getRectSize(3, 24));
	_itemBkgBackUp[1] = new uint8[_screen->getRectSize(4, 32)];
	memset(_itemBkgBackUp[1], 0, _screen->getRectSize(4, 32));

	for (int i = 0; i < _roomTableSize; ++i) {
		for (int item = 0; item < 12; ++item) {
			_roomTable[i].itemsTable[item] = kItemNone;
			_roomTable[i].itemsXPos[item] = 0xFFFF;
			_roomTable[i].itemsYPos[item] = 0xFF;
			_roomTable[i].needInit[item] = 0;
		}
	}

	loadCharacterShapes();
	loadSpecialEffectShapes();
	loadItems();
	loadButtonShapes();
	initMainButtonList();
	loadMainScreen();
	_screen->loadPalette("PALETTE.COL", _screen->getPalette(0));

	if (_flags.platform == Common::kPlatformAmiga)
		_screen->loadPaletteTable("PALETTE.DAT", 6);

	// XXX
	_animator->initAnimStateList();
	setCharactersInDefaultScene();

	if (!_emc->load("_STARTUP.EMC", &_npcScriptData, &_opcodes))
		error("Could not load \"_STARTUP.EMC\" script");
	_emc->init(&_scriptMain, &_npcScriptData);

	if (!_emc->start(&_scriptMain, 0))
		error("Could not start script function 0 of script \"_STARTUP.EMC\"");

	while (_emc->isValid(&_scriptMain))
		_emc->run(&_scriptMain);

	_emc->unload(&_npcScriptData);

	if (!_emc->load("_NPC.EMC", &_npcScriptData, &_opcodes))
		error("Could not load \"_NPC.EMC\" script");

	snd_playTheme(1, -1);
	if (_gameToLoad == -1) {
		enterNewScene(_currentCharacter->sceneId, _currentCharacter->facing, 0, 0, 1);
		if (_abortIntroFlag && _skipIntroFlag && saveFileLoadable(0)) {
			_menuDirectlyToLoad = true;
			_screen->setMouseCursor(1, 1, _shapes[0]);
			_screen->showMouse();
			_gui->buttonMenuCallback(0);
			_menuDirectlyToLoad = false;
		} else if (!shouldQuit()) {
			saveGameStateIntern(0, "New game", 0);
		}
	} else {
		_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
		loadGameStateCheck(_gameToLoad);
		_gameToLoad = -1;
	}
}
Exemplo n.º 6
0
Common::Error KyraEngine_HoF::loadGameState(int slot) {
	const char *fileName = getSavegameFilename(slot);

	SaveHeader header;
	Common::InSaveFile *saveFile = openSaveForReading(fileName, header);
	if (!saveFile) {
		showMessageFromCCode(0x35, 0x84, 0);
		snd_playSoundEffect(0x0D);
		return Common::kUnknownError;
	}

	if (header.originalSave)
		warning("Trying to load savegame from original interpreter, while this is possible, it is not officially supported");

	bool setFlag1EE = (queryGameFlag(0x1EE) != 0);

	_deathHandler = -1;
	if (!_unkSceneScreenFlag1) {
		_sound->beginFadeOut();
		_system->delayMillis(5 * _tickLength);
		_lastMusicCommand = -1;
	}

	int loadedZTable = _characterShapeFile;

	Common::SeekableSubReadStreamEndian in(saveFile, saveFile->pos(), saveFile->size(), !header.originalSave, DisposeAfterUse::YES);

	_screen->hideMouse();

	if (!header.originalSave) {
		_timer->loadDataFromFile(in, header.version);

		uint32 flagsSize = in.readUint32BE();
		assert(flagsSize <= sizeof(_flagsTable));
		in.read(_flagsTable, flagsSize);
	}

	// usually we have to save the flag set by opcode 10 here
	//word_2AB05 = in.readUint16();
	if (header.originalSave)
		in.readUint16();
	_lastMusicCommand = in.readSint16();
	_newChapterFile = in.readByte();
	_characterShapeFile = in.readByte();
	_cauldronState = in.readByte();
	_colorCodeFlag1 = in.readByte();
	_colorCodeFlag2 = in.readByte();
	_bookCurPage = in.readByte();
	_bookMaxPage = in.readByte();
	for (int i = 0; i < 7; ++i)
		_presetColorCode[i] = in.readByte();
	for (int i = 0; i < 7; ++i)
		_inputColorCode[i] = in.readByte();
	for (int i = 0; i < 25; ++i)
		_cauldronTable[i] = in.readSint16();
	for (int i = 0; i < 20; ++i)
		_hiddenItems[i] = in.readSint16();

	if (header.originalSave) {
		assert(sizeof(_flagsTable) >= 0x41);
		in.read(_flagsTable, 0x41);
	}

	for (int i = 0; i < 19; ++i)
		in.read(_conversationState[i], 14);

	if (!header.originalSave) {
		in.read(_newSceneDlgState, 32);
	} else {
		for (int i = 0; i < 31; ++i)
			_newSceneDlgState[i] = in.readUint16();
	}

	_cauldronUseCount = in.readSint16();

	if (header.originalSave)
		in.seek(6, SEEK_CUR);

	_mainCharacter.sceneId = in.readUint16();
	_mainCharacter.dlgIndex = in.readSint16();
	_mainCharacter.height = in.readByte();
	_mainCharacter.facing = in.readByte();
	_mainCharacter.animFrame = in.readUint16();

	if (header.version <= 10 || header.originalSave)
		in.seek(3, SEEK_CUR);

	for (int i = 0; i < 20; ++i)
		_mainCharacter.inventory[i] = in.readUint16();
	_mainCharacter.x1 = in.readSint16();
	_mainCharacter.y1 = in.readSint16();
	_mainCharacter.x2 = in.readSint16();
	_mainCharacter.y2 = in.readSint16();

	for (int i = 0; i < 30; ++i) {
		_itemList[i].id = in.readSint16();
		_itemList[i].sceneId = in.readUint16();
		_itemList[i].x = in.readSint16();
		_itemList[i].y = in.readByte();
		if (header.version <= 9 || header.originalSave)
			in.readUint16();
	}

	for (int i = 0; i < 72; ++i) {
		in.read(_talkObjectList[i].filename, 13);
		_talkObjectList[i].scriptId = in.readByte();
		_talkObjectList[i].x = in.readSint16();
		_talkObjectList[i].y = in.readSint16();
		_talkObjectList[i].color = in.readByte();
	}

	for (int i = 0; i < 86; ++i) {
		if (!header.originalSave) {
			in.read(_sceneList[i].filename1, 10);
		} else {
			in.read(_sceneList[i].filename1, 9);
			_sceneList[i].filename1[9] = 0;
		}

		_sceneList[i].exit1 = in.readUint16();
		_sceneList[i].exit2 = in.readUint16();
		_sceneList[i].exit3 = in.readUint16();
		_sceneList[i].exit4 = in.readUint16();
		_sceneList[i].flags = in.readByte();
		_sceneList[i].sound = in.readByte();
	}

	_itemInHand = in.readSint16();

	if (header.originalSave) {
		uint32 currentTime = _system->getMillis();

		for (int i = 0; i < 6; ++i)
			_timer->setDelay(i, in.readSint32LE());

		for (int i = 0; i < 6; ++i) {
			if (in.readUint16LE())
				_timer->enable(i);
			else
				_timer->disable(i);
		}

		for (int i = 0; i < 6; ++i)
			_timer->setNextRun(i, currentTime + (in.readUint32LE() * _tickLength));

		_timer->resetNextRun();
	}

	_sceneExit1 = in.readUint16();
	_sceneExit2 = in.readUint16();
	_sceneExit3 = in.readUint16();
	_sceneExit4 = in.readUint16();

	if (saveFile->err() || saveFile->eos()) {
		warning("Load failed ('%s', '%s').", fileName, header.description.c_str());
		return Common::kUnknownError;
	} else {
		debugC(1, kDebugLevelMain, "Loaded savegame '%s.'", header.description.c_str());
	}

	if (loadedZTable != _characterShapeFile)
		loadCharacterShapes(_characterShapeFile);

	_screen->loadBitmap("_PLAYFLD.CPS", 3, 3, 0);
	if (!queryGameFlag(1))
		_screen->copyRegion(0xCE, 0x90, 0xCE, 0x90, 0x2C, 0x2C, 2, 0, Screen::CR_NO_P_CHECK);
	if (!queryGameFlag(2))
		_screen->copyRegion(0xFA, 0x90, 0xFA, 0x90, 0x46, 0x2C, 2, 0, Screen::CR_NO_P_CHECK);
	_screen->loadBitmap("_PLAYALL.CPS", 3, 3, 0);
	if (queryGameFlag(1))
		_screen->copyRegion(0xCE, 0x90, 0xCE, 0x90, 0x2C, 0x2C, 2, 0, Screen::CR_NO_P_CHECK);
	if (queryGameFlag(2))
		_screen->copyRegion(0xFA, 0x90, 0xFA, 0x90, 0x46, 0x2C, 2, 0, Screen::CR_NO_P_CHECK);

	redrawInventory(0);
	int cauldronUseCount = _cauldronUseCount;
	setCauldronState(_cauldronState, 0);
	_cauldronUseCount = cauldronUseCount;
	_mainCharX = _mainCharacter.x2 = _mainCharacter.x1;
	_mainCharY = _mainCharacter.y2 = _mainCharacter.y1;
	_mainCharacter.facing = 4;

	enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1);
	setDelayedCursorUpdate();

	if (_lastMusicCommand >= 0 && !_unkSceneScreenFlag1)
		snd_playWanderScoreViaMap(_lastMusicCommand, 1);

	while (!_screen->isMouseVisible())
		_screen->showMouse();

	setTimer1DelaySecs(7);
	_shownMessage = " ";
	_fadeMessagePalette = false;

	if (setFlag1EE)
		setGameFlag(0x1EE);

	// We didn't explicitly set the walk speed, but it's saved as part of
	// the _timers array, so we need to re-sync it with _configWalkspeed.
	setWalkspeed(_configWalkspeed);

	return Common::kNoError;
}
Exemplo n.º 7
0
void KyraEngine_MR::startup() {
	_album.wsa = new WSAMovie_v2(this);
	assert(_album.wsa);
	_album.leftPage.wsa = new WSAMovie_v2(this);
	assert(_album.leftPage.wsa);
	_album.rightPage.wsa = new WSAMovie_v2(this);
	assert(_album.rightPage.wsa);

	_gamePlayBuffer = new uint8[64000];

	_interface = new uint8[17920];
	_interfaceCommandLine = new uint8[3840];

	_screen->setFont(Screen::FID_8_FNT);

	_stringBuffer = new char[500];
	allocAnimObjects(1, 16, 50);

	memset(_sceneShapes, 0, sizeof(_sceneShapes));
	_screenBuffer = new uint8[64000];

	if (!loadLanguageFile("ITEMS.", _itemFile))
		error("Couldn't load ITEMS");
	if (!loadLanguageFile("SCORE.", _scoreFile))
		error("Couldn't load SCORE");
	if (!loadLanguageFile("C_CODE.", _cCodeFile))
		error("Couldn't load C_CODE");
	if (!loadLanguageFile("SCENES.", _scenesFile))
		error("Couldn't load SCENES");
	if (!loadLanguageFile("OPTIONS.", _optionsFile))
		error("Couldn't load OPTIONS");
	if (!loadLanguageFile("_ACTOR.", _actorFile))
		error("couldn't load _ACTOR");

	openTalkFile(0);
	_currentTalkFile = 0;
	openTalkFile(1);
	loadCostPal();

	for (int i = 0; i < 16; ++i) {
		_sceneAnims[i].flags = 0;
		_sceneAnimMovie[i] = new WSAMovie_v2(this);
		assert(_sceneAnimMovie[i]);
	}

	_screen->_curPage = 0;

	_talkObjectList = new TalkObject[88];
	memset(_talkObjectList, 0, sizeof(TalkObject)*88);
	for (int i = 0; i < 88; ++i)
		_talkObjectList[i].sceneId = 0xFF;

	_gfxBackUpRect = new uint8[_screen->getRectSize(32, 32)];
	initItemList(50);
	resetItemList();

	loadShadowShape();
	loadExtrasShapes();
	_characterShapeFile = 0;
	loadCharacterShapes(_characterShapeFile);
	updateMalcolmShapes();
	initMainButtonList(true);
	loadButtonShapes();
	loadInterfaceShapes();

	_screen->loadPalette("PALETTE.COL", _screen->getPalette(0));
	_paletteOverlay = new uint8[256];
	_screen->generateOverlay(_screen->getPalette(0), _paletteOverlay, 0xF0, 0x19);

	loadInterface();

	clearAnimObjects();

	_scoreMax = 0;
	for (int i = 0; i < _scoreTableSize; ++i) {
		if (_scoreTable[i] > 0)
			_scoreMax += _scoreTable[i];
	}

	memset(_newSceneDlgState, 0, sizeof(_newSceneDlgState));
	memset(_conversationState, -1, sizeof(_conversationState));

	_sceneList = new SceneDesc[98];
	assert(_sceneList);
	memset(_sceneList, 0, sizeof(SceneDesc)*98);
	_sceneListSize = 98;

	runStartupScript(1, 0);
	_res->exists("MOODOMTR.WSA", true);
	_invWsa = new WSAMovie_v2(this);
	assert(_invWsa);
	_invWsa->open("MOODOMTR.WSA", 1, 0);
	_invWsaFrame = 6;
	saveGameStateIntern(0, "New Game", 0);
	if (_gameToLoad == -1)
		enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1);
	else
		loadGameStateCheck(_gameToLoad);

	if (_menuDirectlyToLoad)
		(*_mainButtonData[0].buttonCallback)(&_mainButtonData[0]);

	_screen->updateScreen();
	_screen->showMouse();

	setNextIdleAnimTimer();
	setWalkspeed(_configWalkspeed);
}