Exemplo n.º 1
0
Surface *Surface::getScreen(uint16 resourceId) {
	MemoryBlock *block = Disk::getReference().getEntry(resourceId);
	PictureDecoder d;
	MemoryBlock *decodedData = d.decode(block);
	delete block;
	return new Surface(decodedData, FULL_SCREEN_WIDTH, decodedData->size() / FULL_SCREEN_WIDTH);
}
Exemplo n.º 2
0
void Surface::loadScreen(MemoryBlock *rawData) {
	PictureDecoder decoder;
	uint16 v = READ_BE_UINT16(rawData->data());
	bool is5Bit = (v & 0xfffe) == 0x140;
	MemoryBlock *tmpScreen;

	if (is5Bit)
		// 5-bit decompression
		tmpScreen = decoder.egaDecode(rawData, FULL_SCREEN_HEIGHT * FULL_SCREEN_WIDTH + 1);
	else
		// VGA decompression
		tmpScreen = decoder.vgaDecode(rawData, FULL_SCREEN_HEIGHT * FULL_SCREEN_WIDTH + 1);

	empty();
	_data->copyFrom(tmpScreen, 0, MENUBAR_Y_SIZE * FULL_SCREEN_WIDTH,
		(FULL_SCREEN_HEIGHT - MENUBAR_Y_SIZE) * FULL_SCREEN_WIDTH);
	delete tmpScreen;
}
Exemplo n.º 3
0
Menu::Menu() {
	int_menu = this;
	StringList &sl = Resources::getReference().stringList();
	Common::Language language = LureEngine::getReference().getLanguage();

	MemoryBlock *data = Disk::getReference().getEntry(MENU_RESOURCE_ID);
	PictureDecoder decoder;
	_menu = decoder.decode(data, SCREEN_SIZE);
	delete data;

	const MenuRecordLanguage *rec = &menuList[0];
	while ((rec->language != Common::UNK_LANG) && (rec->language != language))
		++rec;
	if (rec->language == Common::UNK_LANG)
		error("Unknown language encountered in top line handler");

	_menus[0] = new MenuRecord(&rec->menus[0], 1, sl.getString(S_CREDITS));
	_menus[1] = new MenuRecord(&rec->menus[1], 3,
		sl.getString(S_RESTART_GAME), sl.getString(S_SAVE_GAME), sl.getString(S_RESTORE_GAME));
	_menus[2] = new MenuRecord(&rec->menus[2], 3,
		sl.getString(S_QUIT), sl.getString(S_SLOW_TEXT), sl.getString(S_SOUND_ON));

	_selectedMenu = NULL;
}
Exemplo n.º 4
0
AnimationSequence::AnimationSequence(uint16 screenId, Palette &palette,  bool fadeIn, int frameDelay,
					 const AnimSoundSequence *soundList): _screenId(screenId), _palette(palette),
					 _frameDelay(frameDelay), _soundList(soundList) {
	Screen &screen = Screen::getReference();
	PictureDecoder decoder;
	Disk &d = Disk::getReference();

	// Get the data and decode it. Note that VGA decompression is used
	// even if the decompressed contents is actually EGA data
	MemoryBlock *data = d.getEntry(_screenId);
	_decodedData = decoder.vgaDecode(data, MAX_ANIM_DECODER_BUFFER_SIZE);
	delete data;

	_isEGA = LureEngine::getReference().isEGA();
	if (_isEGA) {
		// Setup for EGA animation
		_lineRefs = NULL;

		// Reset the palette and clear the screen for EGA decoding
		screen.setPaletteEmpty(RES_PALETTE_ENTRIES);
		screen.screen().empty();

		// Load the screen - each four bytes contain the four planes
		// worth of data for 8 sequential pixels
		byte *pSrc = _decodedData->data();
		byte *pDest = screen.screen().data().data() +
			(FULL_SCREEN_WIDTH * MENUBAR_Y_SIZE);

		for (int ctr = 0; ctr < FULL_SCREEN_WIDTH * (FULL_SCREEN_HEIGHT -
				MENUBAR_Y_SIZE) / 8; ++ctr, pDest += EGA_PIXELS_PER_BYTE) {
			for (int planeCtr = 0; planeCtr < EGA_NUM_LAYERS; ++planeCtr, ++pSrc) {
				byte v = *pSrc;
				for (int bitCtr = 0; bitCtr < 8; ++bitCtr, v <<= 1) {
					if ((v & 0x80) != 0)
					*(pDest + bitCtr) |= 1 << planeCtr;
				}
			}
		}

		screen.update();
		screen.setPalette(&_palette, 0, _palette.numEntries());

		// Set pointers for animation
		_pPixels = pSrc;
		_pPixelsEnd = _decodedData->data() + _decodedData->size() - 1;
		_pLines = NULL;
		_pLinesEnd = NULL;

	} else {
		// Setup for VGA animation
		_lineRefs = d.getEntry(_screenId + 1);

		// Reset the palette and set the initial starting screen
		screen.setPaletteEmpty(RES_PALETTE_ENTRIES);
		screen.screen().data().copyFrom(_decodedData, 0, 0, FULL_SCREEN_HEIGHT * FULL_SCREEN_WIDTH);
		screen.update();

		// Set the palette
		if (fadeIn)	screen.paletteFadeIn(&_palette);
		else screen.setPalette(&_palette, 0, _palette.numEntries());

		// Set up frame pointers
		_pPixels = _decodedData->data() + SCREEN_SIZE;
		_pPixelsEnd = _decodedData->data() + _decodedData->size() - 1;
		_pLines = _lineRefs->data();
		_pLinesEnd = _lineRefs->data() + _lineRefs->size() - 1;
	}
}