aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-12-23 19:13:42 +0100
committerWillem Jan Palenstijn2011-12-23 19:15:25 +0100
commit0f36350e03c69ce605fde1277118c43487f724af (patch)
tree15431ddc2de6a52ef66ef6686c95886db7875150 /engines
parentc4af50ae63fc93e221306440fee0337a77059295 (diff)
downloadscummvm-rg350-0f36350e03c69ce605fde1277118c43487f724af.tar.gz
scummvm-rg350-0f36350e03c69ce605fde1277118c43487f724af.tar.bz2
scummvm-rg350-0f36350e03c69ce605fde1277118c43487f724af.zip
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.
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/dreambase.h3
-rw-r--r--engines/dreamweb/people.cpp14
-rw-r--r--engines/dreamweb/structs.h10
-rw-r--r--engines/dreamweb/stubs.cpp16
4 files changed, 18 insertions, 25 deletions
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index 18eff56a77..d624f8285c 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 1e79471a65..32fbbc04e5 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 320ed7e1a8..61400455d1 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 dde9613f52..f3c908aad2 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();