[Scummvm-cvs-logs] scummvm master -> 0f36350e03c69ce605fde1277118c43487f724af

wjp wjp at usecode.org
Fri Dec 23 19:17:15 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:
0f36350e03 DREAMWEB: Fix regression from moving ReelRoutines out of data


Commit: 0f36350e03c69ce605fde1277118c43487f724af
    https://github.com/scummvm/scummvm/commit/0f36350e03c69ce605fde1277118c43487f724af
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-12-23T10:15:25-08:00

Commit Message:
DREAMWEB: Fix regression from moving ReelRoutines out of data

The struct People still had an old-style pointer to a ReelRoutine.
Fix this by converting People to use a real ReelRoutine * and moving
the PeopleList from the buffers segment to a Common::List.

Thanks to digitall for the assistance with tracking this down.

Changed paths:
    engines/dreamweb/dreambase.h
    engines/dreamweb/people.cpp
    engines/dreamweb/structs.h
    engines/dreamweb/stubs.cpp



diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index 18eff56..d624f82 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -24,6 +24,7 @@
 #define DREAMBASE_H
 
 #include "common/scummsys.h"
+#include "common/list.h"
 
 #include "dreamweb/segment.h"
 
@@ -65,6 +66,8 @@ protected:
 
 	// from people.cpp
 	ReelRoutine _reelRoutines[kNumReelRoutines+1];
+	Common::List<People> _peopleList;
+	ReelRoutine *_personData;
 
 public:
 	DreamBase(DreamWeb::DreamWebEngine *en);
diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp
index 1e79471..32fbbc0 100644
--- a/engines/dreamweb/people.cpp
+++ b/engines/dreamweb/people.cpp
@@ -129,8 +129,7 @@ void DreamBase::setupInitialReelRoutines() {
 }
 
 void DreamBase::updatePeople() {
-	data.word(kListpos) = kPeoplelist;
-	memset(getSegment(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People));
+	_peopleList.clear();
 	++data.word(kMaintimer);
 
 	for (int i = 0; _reelRoutines[i].reallocation != 255; ++i) {
@@ -220,13 +219,12 @@ void DreamBase::madMode() {
 }
 
 void DreamBase::addToPeopleList(ReelRoutine *routine) {
-	uint16 routinePointer = (const uint8 *)routine - data.ptr(0, 0);
+	People people;
+	people._reelPointer = routine->reelPointer();
+	people._routinePointer = routine;
+	people.b4 = routine->b7;
 
-	People *people = (People *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(People));
-	people->setReelPointer(routine->reelPointer());
-	people->setRoutinePointer(routinePointer);
-	people->b4 = routine->b7;
-	data.word(kListpos) += sizeof(People);
+	_peopleList.push_back(people);
 }
 
 bool DreamBase::checkSpeed(ReelRoutine &routine) {
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index 320ed7e..6140045 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -179,14 +179,8 @@ struct ReelRoutine {
 };
 
 struct People {
-	uint8 b0;
-	uint8 b1;
-	uint16 reelPointer() const { return READ_LE_UINT16(&b0); }
-	void setReelPointer(uint16 v) { WRITE_LE_UINT16(&b0, v); }
-	uint8 b2;
-	uint8 b3;
-	uint16 routinePointer() const { return READ_LE_UINT16(&b2); }
-	void setRoutinePointer(uint16 v) { WRITE_LE_UINT16(&b2, v); }
+	uint16 _reelPointer;
+	ReelRoutine *_routinePointer;
 	uint8 b4;
 
 };
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index dde9613..f3c908a 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1168,12 +1168,10 @@ void DreamGenContext::checkIfPerson() {
 }
 
 bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) {
-	People *people = (People *)getSegment(data.word(kBuffers)).ptr(kPeoplelist, 0);
-
-	for (size_t i = 0; i < 12; ++i, ++people) {
-		if (people->b4 == 255)
-			continue;
-		Reel *reel = getReelStart(people->reelPointer());
+	Common::List<People>::iterator i;
+	for (i = _peopleList.begin(); i != _peopleList.end(); ++i) {
+		People &people = *i;
+		Reel *reel = getReelStart(people._reelPointer);
 		if (reel->frame() == 0xffff)
 			++reel;
 		const Frame *frame = getReelFrameAX(reel->frame());
@@ -1189,8 +1187,8 @@ bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) {
 			continue;
 		if (y >= ymax)
 			continue;
-		data.word(kPersondata) = people->routinePointer();
-		obName(people->b4, 5);
+		_personData = people._routinePointer;
+		obName(people.b4, 5);
 		return true;
 	}
 	return false;
@@ -3833,7 +3831,7 @@ void DreamGenContext::talk() {
 	} while (!data.byte(kGetback));
 
 	if (data.byte(kTalkpos) >= 4)
-		data.byte(data.word(kPersondata)+7) |= 128;
+		_personData->b7 |= 128;
 
 	redrawMainScrn();
 	workToScreenM();






More information about the Scummvm-git-logs mailing list