Beispiel #1
0
void ToucheEngine::saveGameStateData(Common::WriteStream *stream) {
	setKeyCharMoney();
	stream->writeUint16LE(_currentEpisodeNum);
	stream->writeUint16LE(_currentMusicNum);
	stream->writeUint16LE(_currentRoomNum);
	stream->writeUint16LE(_flagsTable[614]);
	stream->writeUint16LE(_flagsTable[615]);
	stream->writeUint16LE(_disabledInputCounter);
	saveOrLoadCommonArray(*stream, _programHitBoxTable);
	saveOrLoadCommonArray(*stream, _programBackgroundTable);
	saveOrLoadCommonArray(*stream, _programAreaTable);
	saveOrLoadCommonArray(*stream, _programWalkTable);
	saveOrLoadCommonArray(*stream, _programPointsTable);
	stream->write(_updatedRoomAreasTable, 200);
	saveOrLoadStaticArray(*stream, _sequenceEntryTable, NUM_SEQUENCES);
	saveOrLoadStaticArray(*stream, _flagsTable, 1024);
	saveOrLoadStaticArray(*stream, _inventoryList1, 100);
	saveOrLoadStaticArray(*stream, _inventoryList2, 100);
	saveOrLoadStaticArray(*stream, _inventoryList3, 6);
	saveOrLoadStaticArray(*stream, _keyCharsTable, NUM_KEYCHARS);
	saveOrLoadStaticArray(*stream, _inventoryItemsInfoTable, NUM_INVENTORY_ITEMS);
	saveOrLoadStaticArray(*stream, _talkTable, NUM_TALK_ENTRIES);
	stream->writeUint16LE(_talkListEnd);
	stream->writeUint16LE(_talkListCurrent);
	stream->writeUint32LE(saveLoadEndMarker);
}
Beispiel #2
0
void ToucheEngine::op_setInventoryItem() {
	debugC(9, kDebugOpcodes, "ToucheEngine::op_setInventoryItem()");
	int16 keyChar = _script.readNextWord();
	uint16 item = _script.readNextWord();
	if (item == 4) {
		setKeyCharMoney();
	}
	if (keyChar == 256) {
		keyChar = _currentKeyCharNum;
	}
	assert(keyChar >= 0 && keyChar < NUM_KEYCHARS);
	assert(item < sizeof(_keyCharsTable[keyChar].inventoryItems));
	_keyCharsTable[keyChar].inventoryItems[item] = *_script.stackDataPtr;
	if (item == 4 && !_hideInventoryTexts) {
		drawAmountOfMoneyInInventory();
	}
}
Beispiel #3
0
void ToucheEngine::loadGameStateData(Common::ReadStream *stream) {
	setKeyCharMoney();
	clearDirtyRects();
	_flagsTable[115] = 0;
	clearRoomArea();
	_currentEpisodeNum = stream->readUint16LE();
	_newMusicNum = stream->readUint16LE();
	_currentRoomNum = stream->readUint16LE();
	res_loadRoom(_currentRoomNum);
	int16 roomOffsX = _flagsTable[614] = stream->readUint16LE();
	int16 roomOffsY = _flagsTable[615] = stream->readUint16LE();
	_disabledInputCounter = stream->readUint16LE();
	res_loadProgram(_currentEpisodeNum);
	setupEpisode(-1);
	saveOrLoadCommonArray(*stream, _programHitBoxTable);
	saveOrLoadCommonArray(*stream, _programBackgroundTable);
	saveOrLoadCommonArray(*stream, _programAreaTable);
	saveOrLoadCommonArray(*stream, _programWalkTable);
	saveOrLoadCommonArray(*stream, _programPointsTable);
	stream->read(_updatedRoomAreasTable, 200);
	for (uint i = 1; i < _updatedRoomAreasTable[0]; ++i) {
		updateRoomAreas(_updatedRoomAreasTable[i], -1);
	}
	saveOrLoadStaticArray(*stream, _sequenceEntryTable, NUM_SEQUENCES);
	saveOrLoadStaticArray(*stream, _flagsTable, 1024);
	saveOrLoadStaticArray(*stream, _inventoryList1, 100);
	saveOrLoadStaticArray(*stream, _inventoryList2, 100);
	saveOrLoadStaticArray(*stream, _inventoryList3, 6);
	saveOrLoadStaticArray(*stream, _keyCharsTable, NUM_KEYCHARS);
	saveOrLoadStaticArray(*stream, _inventoryItemsInfoTable, NUM_INVENTORY_ITEMS);
	saveOrLoadStaticArray(*stream, _talkTable, NUM_TALK_ENTRIES);
	_talkListEnd = stream->readUint16LE();
	_talkListCurrent = stream->readUint16LE();
	if (stream->readUint32LE() != saveLoadEndMarker) {
		warning("Corrupted gamestate data");
		// if that ever happens, exit the game
		quitGame();
	}
	_flagsTable[614] = roomOffsX;
	_flagsTable[615] = roomOffsY;
	for (uint i = 0; i < NUM_SEQUENCES; ++i) {
		if (_sequenceEntryTable[i].seqNum != -1) {
			res_loadSequence(_sequenceEntryTable[i].seqNum, i);
		}
		if (_sequenceEntryTable[i].sprNum != -1) {
			res_loadSprite(_sequenceEntryTable[i].sprNum, i);
		}
	}
	_currentKeyCharNum = _flagsTable[104];
	_inventoryStateTable[0].displayOffset = 0;
	_inventoryStateTable[1].displayOffset = 0;
	_inventoryStateTable[2].displayOffset = 0;
	drawInventory(_currentKeyCharNum, 1);
	Graphics::copyRect(_offscreenBuffer, kScreenWidth, 0, 0,
	  _backdropBuffer, _currentBitmapWidth, _flagsTable[614], _flagsTable[615],
	  kScreenWidth, kRoomHeight);
	updateRoomRegions();
	_fullRedrawCounter = 1;
	_roomNeedRedraw = false;
	if (_flagsTable[617] != 0) {
		res_loadSpeech(_flagsTable[617]);
	}
	debug(0, "Loaded state, current episode %d", _currentEpisodeNum);
}