[Scummvm-cvs-logs] scummvm master -> 5e976490c75ad9fdf11bff8f07dc1985eb56b15e

wjp wjp at usecode.org
Sun Dec 25 13:04:01 CET 2011


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

Summary:
fb068a1dbc DREAMWEB: Simplify order of checkObjectSize checks
85e5457402 DREAMWEB: Move talk functions to DreamBase
5e976490c7 DREAMWEB: Move remaining talk functions to DreamBase


Commit: fb068a1dbc4471b22ccc088816343e92bd1a94b4
    https://github.com/scummvm/scummvm/commit/fb068a1dbc4471b22ccc088816343e92bd1a94b4
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-12-25T03:41:37-08:00

Commit Message:
DREAMWEB: Simplify order of checkObjectSize checks

Changed paths:
    engines/dreamweb/object.cpp



diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 7e1ba1c..4addfc4 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -771,39 +771,26 @@ bool DreamGenContext::checkObjectSizeCPP() {
 	// to 6. This could be a bad idea, according to the original source.
 	byte objectSize = (object->objectSize != 255) ? object->objectSize : 6;
 
-	if (objectSize >= 100) {
-		// Special case
-		if (containerSize >= 100) {
-			// Both objects are special
-			if (containerSize == objectSize) {
-				return true;
-			} else {
-				errorMessage3();
-				return false;
-			}
-		} else {
-			if (containerSize >= (byte)(objectSize - 100)) {
-				return true;
-			} else {
-				errorMessage2();
-				return false;
-			}
-		}
-	} else if (containerSize >= 100) {	// The current object isn't special, but the container object is
+	if (containerSize >= 100) {
+		// Special type of container: only objects of the same special type fit.
+		if (containerSize == objectSize)
+			return true;
+
 		errorMessage3();
 		return false;
-	} else if (containerSize >= objectSize) {
-		return true;
-	} else {
-		// The original continues here to the special case above. It checks if
-		// cl (containerSize) < al (objectSize) and continues if this is so.
-		// However, in this case, the code subtracts 100 from objectSize, which
-		// was between 0 - 99, so it now is between 156 and 255. containerSize is
-		// smaller than 100, so comparing it with objectSize will always be true,
-		// thus this bit of code always falls through to the errorMessage2() case.
-		errorMessage2();
-		return false;
 	}
+
+	if (objectSize >= 100) {
+		// Special type of object, but a regular container.
+		// Subtract 100 from the size to get its regular size.
+		objectSize -= 100;
+	}
+
+	if (containerSize >= objectSize)
+		return true;
+
+	errorMessage2();
+	return false;
 }
 
 } // End of namespace DreamGen


Commit: 85e54574023fde58933da06a5192793597de1ec0
    https://github.com/scummvm/scummvm/commit/85e54574023fde58933da06a5192793597de1ec0
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-12-25T03:54:12-08:00

Commit Message:
DREAMWEB: Move talk functions to DreamBase

Changed paths:
    engines/dreamweb/dreambase.h
    engines/dreamweb/stubs.h
    engines/dreamweb/talk.cpp



diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index 0123943..be88295 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -539,6 +539,12 @@ public:
 	void entryAnims();
 	bool finishedWalking();
 
+	// from talk.cpp
+	void convIcons();
+	uint16 getPersFrame(uint8 index);
+	const uint8 *getPersonText(uint8 index);
+	void startTalk();
+
 	// from use.cpp
 	void placeFreeObject(uint8 index);
 	void removeFreeObject(uint8 index);
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index bf5f5c5..52798f5 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -96,10 +96,6 @@
 		DreamBase::hangOn(frameCount);
 	}
 	void showCity();
-	uint16 getPersFrame(uint8 index);
-	void convIcons();
-	void startTalk();
-	void getPersonText(uint8 index);
 	void doSomeTalk();
 	void examineOb(bool examineAgain = true);
 	void dumpWatch();
diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp
index f13f40e..e364d63 100644
--- a/engines/dreamweb/talk.cpp
+++ b/engines/dreamweb/talk.cpp
@@ -73,22 +73,21 @@ void DreamGenContext::talk() {
 	}
 }
 
-void DreamGenContext::convIcons() {
+void DreamBase::convIcons() {
 	uint8 index = data.byte(kCharacter) & 127;
 	uint16 frame = getPersFrame(index);
 	const Frame *base = findSource(frame);
 	showFrame(base, 234, 2, frame, 0);
 }
 
-uint16 DreamGenContext::getPersFrame(uint8 index) {
+uint16 DreamBase::getPersFrame(uint8 index) {
 	return getSegment(data.word(kPeople)).word(kPersonframes + index * 2);
 }
 
-void DreamGenContext::startTalk() {
+void DreamBase::startTalk() {
 	data.byte(kTalkmode) = 0;
 
-	getPersonText(data.byte(kCharacter) & 0x7F);
-	const uint8 *str = es.ptr(si, 0);
+	const uint8 *str = getPersonText(data.byte(kCharacter) & 0x7F);
 	uint16 y;
 
 	data.word(kCharshift) = 91+91;
@@ -108,9 +107,9 @@ void DreamGenContext::startTalk() {
 	}
 }
 
-void DreamGenContext::getPersonText(uint8 index) {
-	es = data.word(kPeople);
-	si = es.word((index * 64 * 2) + kPersontxtdat) + kPersontext;
+const uint8 *DreamBase::getPersonText(uint8 index) {
+	uint16 offset = kPersontext + getSegment(data.word(kPeople)).word((index * 64 * 2) + kPersontxtdat);
+	return getSegment(data.word(kPeople)).ptr(offset, 0);
 }
 
 void DreamGenContext::moreTalk() {


Commit: 5e976490c75ad9fdf11bff8f07dc1985eb56b15e
    https://github.com/scummvm/scummvm/commit/5e976490c75ad9fdf11bff8f07dc1985eb56b15e
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-12-25T04:02:56-08:00

Commit Message:
DREAMWEB: Move remaining talk functions to DreamBase

Changed paths:
    engines/dreamweb/dreambase.h
    engines/dreamweb/stubs.h
    engines/dreamweb/talk.cpp



diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index be88295..3b53353 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -540,10 +540,15 @@ public:
 	bool finishedWalking();
 
 	// from talk.cpp
+	void talk();
 	void convIcons();
 	uint16 getPersFrame(uint8 index);
-	const uint8 *getPersonText(uint8 index);
+	const uint8 *getPersonText(uint8 index, uint8 talkPos);
 	void startTalk();
+	void moreTalk();
+	void doSomeTalk();
+	bool hangOnPQ();
+	void redes();
 
 	// from use.cpp
 	void placeFreeObject(uint8 index);
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 52798f5..0f473c8 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -96,7 +96,6 @@
 		DreamBase::hangOn(frameCount);
 	}
 	void showCity();
-	void doSomeTalk();
 	void examineOb(bool examineAgain = true);
 	void dumpWatch();
 	void transferText();
@@ -157,8 +156,6 @@
 	void nextDest();
 	void lastDest();
 	void destSelect();
-	void moreTalk();
-	void redes();
 	void selectLocation();
 	void loadSpeech();
 	bool loadSpeech(byte type1, int idx1, byte type2, int idx2) {
@@ -168,8 +165,6 @@
 	void afterNewRoom();
 	void madmanRun();
 	void decide();
-	void talk();
-	bool hangOnPQ();
 	void showGun();
 	void endGame();
 	void newPlace();
diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp
index e364d63..131e164 100644
--- a/engines/dreamweb/talk.cpp
+++ b/engines/dreamweb/talk.cpp
@@ -24,7 +24,7 @@
 
 namespace DreamGen {
 
-void DreamGenContext::talk() {
+void DreamBase::talk() {
 	data.byte(kTalkpos) = 0;
 	data.byte(kInmaparea) = 0;
 	data.byte(kCharacter) = data.byte(kCommand);
@@ -42,7 +42,7 @@ void DreamGenContext::talk() {
 
 	RectWithCallback<DreamGenContext> talkList[] = {
 		{ 273,320,157,198,&DreamBase::getBack1 },
-		{ 240,290,2,44,&DreamGenContext::moreTalk },
+		{ 240,290,2,44,&DreamBase::moreTalk },
 		{ 0,320,0,200,&DreamBase::blank },
 		{ 0xFFFF,0,0,0,0 }
 	};
@@ -87,7 +87,7 @@ uint16 DreamBase::getPersFrame(uint8 index) {
 void DreamBase::startTalk() {
 	data.byte(kTalkmode) = 0;
 
-	const uint8 *str = getPersonText(data.byte(kCharacter) & 0x7F);
+	const uint8 *str = getPersonText(data.byte(kCharacter) & 0x7F, 0);
 	uint16 y;
 
 	data.word(kCharshift) = 91+91;
@@ -107,12 +107,12 @@ void DreamBase::startTalk() {
 	}
 }
 
-const uint8 *DreamBase::getPersonText(uint8 index) {
-	uint16 offset = kPersontext + getSegment(data.word(kPeople)).word((index * 64 * 2) + kPersontxtdat);
+const uint8 *DreamBase::getPersonText(uint8 index, uint8 talkPos) {
+	uint16 offset = kPersontext + getSegment(data.word(kPeople)).word(((index * 64 + talkPos) * 2) + kPersontxtdat);
 	return getSegment(data.word(kPeople)).ptr(offset, 0);
 }
 
-void DreamGenContext::moreTalk() {
+void DreamBase::moreTalk() {
 	if (data.byte(kTalkmode) != 0) {
 		redes();
 		return;
@@ -137,33 +137,23 @@ void DreamGenContext::moreTalk() {
 	doSomeTalk();
 }
 
-void DreamGenContext::doSomeTalk() {
+void DreamBase::doSomeTalk() {
 	while (true) {
-		es = data.word(kPeople);
-		si = ((data.byte(kTalkpos) + (64 * (data.byte(kCharacter) & 0x7F))) * 2) + kPersontxtdat;
-		si = es.word(si) + kPersontext;
+		const uint8 *str = getPersonText(data.byte(kCharacter) & 0x7F, data.byte(kTalkpos));
 
-		if (es.byte(si) == 0) {
+		if (*str == 0) {
 			// endheartalk
 			data.byte(kPointermode) = 0;
 			return;
 		}
 
-		push(es);
-		push(si);
-
 		createPanel();
 		showPanel();
 		showMan();
 		showExit();
 		convIcons();
 
-		si = pop();
-		es = pop();
-
-		const uint8 *str = es.ptr(si, 0);
-		uint16 y = 64;
-		printDirect(&str, 164, &y, 144, false);
+		printDirect(str, 164, 64, 144, false);
 
 		loadSpeech('R', data.byte(kReallocation), 'C', (64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos));
 		if (data.byte(kSpeechloaded) != 0)
@@ -171,38 +161,25 @@ void DreamGenContext::doSomeTalk() {
 
 		data.byte(kPointermode) = 3;
 		workToScreenM();
-		cx = 180;
 		if (hangOnPQ())
 			return;
 
 		data.byte(kTalkpos)++;
 
-		es = data.word(kPeople);	
-		si = kPersontxtdat + (((64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos)) * 2);
-		si = es.word(si) + kPersontext;
-
-		if (es.byte(si) == 0) {
+		str = getPersonText(data.byte(kCharacter) & 0x7F, data.byte(kTalkpos));
+		if (*str == 0) {
 			// endheartalk
 			data.byte(kPointermode) = 0;
 			return;
 		}
 
-		if (es.byte(si) != ':' && es.byte(si) != 32) {
-			push(es);
-			push(si);
-
+		if (*str != ':' && *str != 32) {
 			createPanel();
 			showPanel();
 			showMan();
 			showExit();
 			convIcons();
-
-			si = pop();
-			es = pop();
-
-			str = es.ptr(si, 0);
-			y = 128;
-			printDirect(&str, 48, &y, 144, false);
+			printDirect(str, 48, 128, 144, false);
 
 			loadSpeech('R', data.byte(kReallocation), 'C', (64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos));
 			if (data.byte(kSpeechloaded) != 0)
@@ -210,7 +187,6 @@ void DreamGenContext::doSomeTalk() {
 
 			data.byte(kPointermode) = 3;
 			workToScreenM();
-			cx = 180;
 			if (hangOnPQ())
 				return;
 		}
@@ -219,7 +195,7 @@ void DreamGenContext::doSomeTalk() {
 	}
 }
 
-bool DreamGenContext::hangOnPQ() {
+bool DreamBase::hangOnPQ() {
 	data.byte(kGetback) = 0;
 
 	RectWithCallback<DreamBase> quitList[] = {
@@ -260,7 +236,7 @@ bool DreamGenContext::hangOnPQ() {
 	return false;
 }
 
-void DreamGenContext::redes() {
+void DreamBase::redes() {
 	if (data.byte(kCh1playing) != 255 || data.byte(kTalkmode) != 2) {
 		blank();
 		return;






More information about the Scummvm-git-logs mailing list