Esempio n. 1
0
void AGOSEngine::scrollScreen() {
	byte *dst;
	const byte *src;
	uint x, y;

	dst = getBackGround();

	if (_scrollXMax == 0) {
		uint screenSize = 8 * _screenWidth;
		if (_scrollFlag < 0) {
			memmove(dst + screenSize, dst, _scrollWidth * _screenHeight - screenSize);
		} else {
			memmove(dst, dst + screenSize, _scrollWidth * _screenHeight - screenSize);
		}

		y = _scrollY - 8;

		if (_scrollFlag > 0) {
			dst += _screenHeight * _screenWidth - screenSize;
			y += 488;
		}

		src = _scrollImage + y / 2;
		decodeRow(dst, src + readUint32Wrapper(src), _scrollWidth, _backGroundBuf->pitch);

		_scrollY += _scrollFlag;
		vcWriteVar(250, _scrollY);

		fillBackFromBackGround(_screenHeight, _scrollWidth);
	} else {
		if (_scrollFlag < 0) {
			memmove(dst + 8, dst, _screenWidth * _scrollHeight - 8);
		} else {
			memmove(dst, dst + 8, _screenWidth * _scrollHeight - 8);
		}

		x = _scrollX;
		x -= (getGameType() == GType_FF) ? 8 : 1;

		if (_scrollFlag > 0) {
			dst += _screenWidth - 8;
			x += (getGameType() == GType_FF) ? 648 : 41;
		}

		if (getGameType() == GType_FF)
			src = _scrollImage + x / 2;
		else
			src = _scrollImage + x * 4;
		decodeColumn(dst, src + readUint32Wrapper(src), _scrollHeight, _backGroundBuf->pitch);

		_scrollX += _scrollFlag;
		vcWriteVar(251, _scrollX);

		if (getGameType() == GType_SIMON2) {
			src = getBackGround();
			dst = (byte *)_window4BackScn->pixels;
			for (int i = 0; i < _scrollHeight; i++) {
				memcpy(dst, src, _screenWidth);
				src += _backGroundBuf->pitch;
				dst += _window4BackScn->pitch;
			}
		} else {
			fillBackFromBackGround(_scrollHeight, _screenWidth);
		}

		setMoveRect(0, 0, 320, _scrollHeight);

		_window4Flag = 1;
	}

	_scrollFlag = 0;

	if (getGameType() == GType_SIMON2) {
		AnimTable *animTable = _screenAnim1;
		while (animTable->srcPtr) {
			animTable->srcPtr = 0;
			animTable++;
		}

		VgaSprite *vsp = _vgaSprites;
		while (vsp->id) {
			vsp->windowNum |= 0x8000;
			vsp++;
		}
	}
}
Esempio n. 2
0
void AGOSEngine::dumpBitmap(const char *filename, const byte *offs, uint16 w, uint16 h, int flags, const byte *palette,
								 byte base) {

	byte *imageBuffer = (byte *)malloc(w * h);
	assert(imageBuffer);

	VC10_state state;
	state.depack_cont = -0x80;
	state.srcPtr = offs;
	state.dh = h;
	state.height = h;
	state.width = w / 16;

	if (getFeatures() & GF_PLANAR) {
		state.srcPtr = convertImage(&state, (getGameType() == GType_PN || (flags & 0x80) != 0));
		flags &= ~0x80;
	}

	const byte *src = state.srcPtr;
	byte *dst = imageBuffer;
	int i, j;

	if (w > _screenWidth) {
		for (i = 0; i < w; i += 8) {
			decodeColumn(dst, src + readUint32Wrapper(src), h, w);
			dst += 8;
			src += 4;
		}
	} else if (h > _screenHeight) {
		for (i = 0; i < h; i += 8) {
			decodeRow(dst, src + readUint32Wrapper(src), w, w);
			dst += 8 * w;
			src += 4;
		}
	} else if (getGameType() == GType_FF || getGameType() == GType_PP) {
		if ((flags & 0x80)) {
			for (i = 0; i != w; i++) {
				byte *c = vc10_depackColumn(&state);
				for (j = 0; j != h; j++) {
					dst[j * w + i] = c[j];
				}
			}
		} else {
			for (j = 0; j != h; j++) {
				for (i = 0; i != w; i++) {
					dst[i] = src[i];
				}
			}
			dst += w;
			src += w;
		}
	} else if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && w == 320 && (h == 134 || h == 200)) {
		for (j = 0; j != h; j++) {
			uint16 count = w / 8;

			byte *dstPtr = dst;
			do {
				uint32 bits = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | (src[3]);

				dstPtr[0] = (byte)((bits >> (32 - 5)) & 31);
				dstPtr[1] = (byte)((bits >> (32 - 10)) & 31);
				dstPtr[2] = (byte)((bits >> (32 - 15)) & 31);
				dstPtr[3] = (byte)((bits >> (32 - 20)) & 31);
				dstPtr[4] = (byte)((bits >> (32 - 25)) & 31);
				dstPtr[5] = (byte)((bits >> (32 - 30)) & 31);

				bits = (bits << 8) | src[4];

				dstPtr[6] = (byte)((bits >> (40 - 35)) & 31);
				dstPtr[7] = (byte)((bits) & 31);

				dstPtr += 8;
				src += 5;
			} while (--count);
			dst += w;
		}
	} else if (flags & 0x80) {