Esempio n. 1
0
void Inter_v7::o7_loadIFFPalette() {
	Common::String file = _vm->_game->_script->evalString();
	if (!file.contains('.'))
		file += ".LBM";

	int16 startIndex = CLIP<int16>(_vm->_game->_script->readValExpr(), 0, 255);
	int16 stopIndex  = CLIP<int16>(_vm->_game->_script->readValExpr(), 0, 255);

	if (startIndex > stopIndex)
		SWAP(startIndex, stopIndex);

	Common::SeekableReadStream *iffFile = _vm->_dataIO->getFile(file);
	if (!iffFile) {
		warning("o7_loadIFFPalette(): No such file \"%s\"", file.c_str());
		return;
	}

	ImageType type = Surface::identifyImage(*iffFile);
	if (type != kImageTypeIFF) {
		warning("o7_loadIFFPalette(): \"%s\" is no IFF", file.c_str());
		return;
	}

	Image::IFFDecoder decoder;
	decoder.loadStream(*iffFile);
	if (!decoder.getPalette() || decoder.getPaletteColorCount() != 256) {
		warning("o7_loadIFFPalette(): Failed reading palette from IFF \"%s\"", file.c_str());
		return;
	}

	const byte *palette = decoder.getPalette();

	startIndex *= 3;
	stopIndex  *= 3;

	byte *dst = (byte *)_vm->_draw->_vgaPalette + startIndex;
	const byte *src = palette + startIndex;
	for (int i = startIndex; i <= stopIndex + 2; ++i) {
		*dst++ = *src++ >> 2;
	}

	if (startIndex == 0) {
		dst = (byte *)_vm->_draw->_vgaPalette;
		dst[0] = dst[1] = dst[2] = 0x00 >> 2;
	}
Esempio n. 2
0
void CineEngine::showSplashScreen() {
	Common::File file;
	if (!file.open("sony.lbm"))
		return;

	Image::IFFDecoder decoder;
	if (!decoder.loadStream(file))
		return;

	const Graphics::Surface *surface = decoder.getSurface();
	if (surface->getWidth() == 640 && surface->getHeight() == 480) {
		initGraphics(640, 480, true);

		const byte *palette = decoder.getPalette();
		int paletteColorCount = decoder.getPaletteColorCount();
		g_system->getPaletteManager()->setPalette(palette, 0, paletteColorCount);

		g_system->copyRectToScreen(surface->getPixels(), 640, 0, 0, 640, 480);
		g_system->updateScreen();

		Common::EventManager *eventMan = g_system->getEventManager();

		bool done = false;
		uint32 now = g_system->getMillis();

		while (!done && g_system->getMillis() - now < 2000) {
			Common::Event event;
			while (eventMan->pollEvent(event)) {
				if (event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
					done = true;
					break;
				}
				if (shouldQuit())
					done = true;
			}
		}
	}

	decoder.destroy();
}