[Scummvm-cvs-logs] scummvm master -> ef2096736d9b14c842094b94bff1b772de311e72

wjp wjp at usecode.org
Mon Dec 12 11:46:37 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ef2096736d DREAMWEB: Convert greyscaleSum, allPalette, dumpCurrent


Commit: ef2096736d9b14c842094b94bff1b772de311e72
    https://github.com/scummvm/scummvm/commit/ef2096736d9b14c842094b94bff1b772de311e72
Author: Max Horn (max at quendi.de)
Date: 2011-12-12T02:45:35-08:00

Commit Message:
DREAMWEB: Convert greyscaleSum, allPalette, dumpCurrent

Changed paths:
    devtools/tasmrecover/tasm-recover
    engines/dreamweb/dreambase.h
    engines/dreamweb/dreamgen.cpp
    engines/dreamweb/dreamgen.h
    engines/dreamweb/stubs.cpp
    engines/dreamweb/vgafades.cpp
    engines/dreamweb/vgagrafx.cpp



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 50c9f22..dac600a 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -202,6 +202,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'allocateload',
 	'allocatemem',
 	'allocatework',
+	'allpalette',
 	'allpointer',
 	'animpointer',
 	'atmospheres',
@@ -320,6 +321,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'droperror',
 	'drunk',
 	'dumpblink',
+	'dumpcurrent',
 	'dumpeverything',
 	'dumpkeypad',
 	'dumpmap',
@@ -419,6 +421,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'getxad',
 	'getyad',
 	'grafittidoor',
+	'greyscalesum',
 	'handclap',
 	'hangon',
 	'hangoncurs',
@@ -837,7 +840,6 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'allocateload' : 'allocateLoad',
 	'allocatemem' : 'allocateMem',
 	'allocatework' : 'allocateWork',
-	'allpalette' : 'allPalette',
 	'allpointer' : 'allPointer',
 	'animpointer' : 'animPointer',
 	'atmospheres' : 'atmospheres',
@@ -969,7 +971,6 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'dropobject' : 'dropObject',
 	'drunk' : 'drunk',
 	'dumpblink' : 'dumpBlink',
-	'dumpcurrent' : 'dumpCurrent',
 	'dumpdiarykeys' : 'dumpDiaryKeys',
 	'dumpeverything' : 'dumpEverything',
 	'dumpkeypad' : 'dumpKeypad',
@@ -1099,7 +1100,6 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'getxad' : 'getXAd',
 	'getyad' : 'getYAd',
 	'grafittidoor' : 'grafittiDoor',
-	'greyscalesum' : 'greyscaleSum',
 	'handclap' : 'handClap',
 	'hangon' : 'hangOn',
 	'hangoncurs' : 'hangOnCurs',
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index 285c44b..ad6748d 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -170,6 +170,9 @@ public:
 	void fadeScreenUpHalf();
 	void fadeScreenDown();
 	void fadeScreenDowns();
+	void greyscaleSum();
+	void allPalette();
+	void dumpCurrent();
 
 	// from vgagrafx.cpp
 	uint8 _workspace[(0x1000 + 2) * 16];
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 8fd359f..94658a1 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -1027,89 +1027,6 @@ endearly2:
 	cx = pop();
 }
 
-void DreamGenContext::greyscaleSum() {
-	STACK_CHECK;
-	es = data.word(kBuffers);
-	si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768);
-	di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
-	cx = 256;
-greysumloop1:
-	push(cx);
-	bx = 0;
-	al = es.byte(si);
-	ah = 0;
-	cx = 20;
-	_mul(cx);
-	_add(bx, ax);
-	al = es.byte(si+1);
-	ah = 0;
-	cx = 59;
-	_mul(cx);
-	_add(bx, ax);
-	al = es.byte(si+2);
-	ah = 0;
-	cx = 11;
-	_mul(cx);
-	_add(bx, ax);
-	al = -1;
-greysumloop2:
-	_inc(al);
-	_sub(bx, 100);
-	if (!flags.c())
-		goto greysumloop2;
-	bl = al;
-	al = bl;
-	ah = data.byte(kAddtored);
-	_cmp(al, 0);
-	_add(al, ah);
-	_stosb();
-	ah = data.byte(kAddtogreen);
-	al = bl;
-	_cmp(al, 0);
-	if (flags.z())
-		goto noaddg;
-	_add(al, ah);
-noaddg:
-	_stosb();
-	ah = data.byte(kAddtoblue);
-	al = bl;
-	_cmp(al, 0);
-	if (flags.z())
-		goto noaddb;
-	_add(al, ah);
-noaddb:
-	_stosb();
-	_add(si, 3);
-	cx = pop();
-	if (--cx)
-		goto greysumloop1;
-}
-
-void DreamGenContext::allPalette() {
-	STACK_CHECK;
-	es = data.word(kBuffers);
-	ds = data.word(kBuffers);
-	di = (0+(228*13)+32+60+(32*32)+(11*10*3));
-	si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768);
-	cx = 768/2;
-	_movsw(cx, true);
-	dumpCurrent();
-}
-
-void DreamGenContext::dumpCurrent() {
-	STACK_CHECK;
-	si = (0+(228*13)+32+60+(32*32)+(11*10*3));
-	ds = data.word(kBuffers);
-	vSync();
-	al = 0;
-	cx = 128;
-	showGroup();
-	vSync();
-	al = 128;
-	cx = 128;
-	showGroup();
-}
-
 void DreamGenContext::fadeDownMon() {
 	STACK_CHECK;
 	palToStartPal();
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index f537db7..ef45dd5 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -517,7 +517,6 @@ public:
 	void moneyPoke();
 	void doSomeTalk();
 	void resetLocation();
-	void greyscaleSum();
 	void getOpenedSize();
 	void adjustUp();
 	void fadeScreenDownHalf();
@@ -547,7 +546,6 @@ public:
 	void dirFile();
 	void pickupConts();
 	void nextColon();
-	void allPalette();
 	void findInvPos();
 	void rollEndCredits();
 	void getKeyAndLogo();
@@ -589,7 +587,6 @@ public:
 	void openOb();
 	void drawItAll();
 	void useStereo();
-	void dumpCurrent();
 	void showDiaryKeys();
 	void rollEndCredits2();
 	void useOpened();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 409b235..226c085 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -995,15 +995,6 @@ void DreamGenContext::DOSReturn() {
 void DreamGenContext::set16ColPalette() {
 }
 
-void DreamGenContext::showGroup() {
-	engine->processEvents();
-	unsigned n = (uint16)cx;
-	uint8 *src = ds.ptr(si, n * 3);
-	engine->setPalette(src, al, n);
-	si += n * 3;
-	cx = 0;
-}
-
 void DreamGenContext::eraseOldObs() {
 	if (data.byte(kNewobs) == 0)
 		return;
diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp
index ceb4178..6f5af57 100644
--- a/engines/dreamweb/vgafades.cpp
+++ b/engines/dreamweb/vgafades.cpp
@@ -190,4 +190,62 @@ void DreamGenContext::clearPalette() {
 	dumpCurrent();
 }
 
+// Converts palette to grey scale, summed using formula
+// .20xred + .59xGreen + .11xBlue
+void DreamBase::greyscaleSum() {
+	byte *src = mainPalette();
+	byte *dst = endPalette();
+
+	for (int i = 0; i < 256; ++i) {
+		const unsigned int r = 20 * *src++;
+		const unsigned int g = 59 * *src++;
+		const unsigned int b = 11 * *src++;
+		const byte grey = (r + b + g) / 100;
+		byte tmp;
+
+		tmp = grey;
+		//if (tmp != 0)	// FIXME: The assembler code has this check commented out. Bug or feature?
+			tmp += data.byte(kAddtored);
+		*dst++ = tmp;
+
+		tmp = grey;
+		if (tmp != 0)
+			tmp += data.byte(kAddtogreen);
+		*dst++ = tmp;
+
+		tmp = grey;
+		if (tmp != 0)
+			tmp += data.byte(kAddtoblue);
+		*dst++ = tmp;
+	}
+}
+
+void DreamBase::allPalette() {
+	memcpy(startPalette(), mainPalette(), 3 * 256);
+	dumpCurrent();
+}
+
+void DreamBase::dumpCurrent() {
+	uint8 *pal = startPalette();
+
+	engine->waitForVSync();
+	engine->processEvents();
+	engine->setPalette(pal, 0, 128);
+
+	pal += 128 * 3;
+
+	engine->waitForVSync();
+	engine->processEvents();
+	engine->setPalette(pal, 128, 128);
+}
+
+void DreamGenContext::showGroup() {
+	engine->processEvents();
+	unsigned n = (uint16)cx;
+	uint8 *src = ds.ptr(si, n * 3);
+	engine->setPalette(src, al, n);
+	si += n * 3;
+	cx = 0;
+}
+
 } // End of namespace DreamGen
diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
index c7d17c1..cea9dbe 100644
--- a/engines/dreamweb/vgagrafx.cpp
+++ b/engines/dreamweb/vgagrafx.cpp
@@ -183,7 +183,7 @@ void DreamBase::vSync() {
 }
 
 void DreamBase::setMode() {
-	vSync();
+	engine->waitForVSync();
 	initGraphics(320, 200, false);
 }
 






More information about the Scummvm-git-logs mailing list