aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-12-23 22:49:40 +0100
committerWillem Jan Palenstijn2011-12-23 23:46:38 +0100
commit1749182e98ed410cd62e22185943696b7e30432a (patch)
tree86106ab8e788ffd3605461aabb07df60f7dfaf5c /engines
parent061d24bb829a9b4ee08016fb25781802799fae14 (diff)
downloadscummvm-rg350-1749182e98ed410cd62e22185943696b7e30432a.tar.gz
scummvm-rg350-1749182e98ed410cd62e22185943696b7e30432a.tar.bz2
scummvm-rg350-1749182e98ed410cd62e22185943696b7e30432a.zip
DREAMWEB: Move ObjPos lists out of buffers
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/backdrop.cpp30
-rw-r--r--engines/dreamweb/dreambase.h3
-rw-r--r--engines/dreamweb/stubs.cpp37
3 files changed, 38 insertions, 32 deletions
diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp
index cb72454a41..9fe3c74150 100644
--- a/engines/dreamweb/backdrop.cpp
+++ b/engines/dreamweb/backdrop.cpp
@@ -134,8 +134,7 @@ void DreamBase::makeBackOb(SetObject *objData, uint16 x, uint16 y) {
void DreamBase::showAllObs() {
const unsigned int count = 128;
- ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kSetlist, count * sizeof(ObjPos));
- memset(objPos, 0xff, count * sizeof(ObjPos));
+ _setList.clear();
const Frame *frameBase = (const Frame *)getSegment(data.word(kSetframes)).ptr(0, 0);
SetObject *setEntries = (SetObject *)getSegment(data.word(kSetdat)).ptr(0, count * sizeof(SetObject));
@@ -148,7 +147,8 @@ void DreamBase::showAllObs() {
if (currentFrame == 0xff)
continue;
uint8 width, height;
- calcFrFrame(frameBase, currentFrame, &width, &height, x, y, objPos);
+ ObjPos objPos;
+ calcFrFrame(frameBase, currentFrame, &width, &height, x, y, &objPos);
setEntry->index = setEntry->frames[0];
if ((setEntry->type == 0) && (setEntry->priority != 5) && (setEntry->priority != 6)) {
x += data.word(kMapadx);
@@ -157,8 +157,8 @@ void DreamBase::showAllObs() {
} else
makeBackOb(setEntry, x, y);
- objPos->index = i;
- ++objPos;
+ objPos.index = i;
+ _setList.push_back(objPos);
}
}
@@ -218,8 +218,7 @@ void DreamBase::calcMapAd() {
void DreamBase::showAllFree() {
const unsigned int count = 80;
- ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kFreelist, count * sizeof(ObjPos));
- memset(objPos, 0xff, count * sizeof(ObjPos));
+ _freeList.clear();
const DynObject *freeObjects = (const DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0);
const Frame *frameBase = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0);
@@ -228,15 +227,16 @@ void DreamBase::showAllFree() {
uint8 mapAd = getMapAd(freeObjects[i].mapad, &x, &y);
if (mapAd != 0) {
uint8 width, height;
+ ObjPos objPos;
uint16 currentFrame = 3 * i;
- calcFrFrame(frameBase, currentFrame, &width, &height, x, y, objPos);
+ calcFrFrame(frameBase, currentFrame, &width, &height, x, y, &objPos);
if ((width != 0) || (height != 0)) {
x += data.word(kMapadx);
y += data.word(kMapady);
assert(currentFrame < 256);
showFrame(frameBase, x, y, currentFrame, 0);
- objPos->index = i;
- ++objPos;
+ objPos.index = i;
+ _freeList.push_back(objPos);
}
}
}
@@ -261,8 +261,7 @@ void DreamBase::drawFlags() {
void DreamBase::showAllEx() {
const unsigned int count = 100;
- ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kExlist, count * sizeof(ObjPos));
- memset(objPos, 0xff, count * sizeof(ObjPos));
+ _exList.clear();
DynObject *objects = (DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, sizeof(DynObject));
const Frame *frameBase = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
@@ -276,13 +275,14 @@ void DreamBase::showAllEx() {
if (getMapAd(object->mapad, &x, &y) == 0)
continue;
uint8 width, height;
+ ObjPos objPos;
uint16 currentFrame = 3 * i;
- calcFrFrame(frameBase, currentFrame, &width, &height, x, y, objPos);
+ calcFrFrame(frameBase, currentFrame, &width, &height, x, y, &objPos);
if ((width != 0) || (height != 0)) {
assert(currentFrame < 256);
showFrame(frameBase, x + data.word(kMapadx), y + data.word(kMapady), currentFrame, 0);
- objPos->index = i;
- ++objPos;
+ objPos.index = i;
+ _exList.push_back(objPos);
}
}
}
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index b4265e904a..b739c9cbbe 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -72,6 +72,9 @@ protected:
uint8 _startPal[3*256];
uint8 _endPal[3*256];
uint8 _mainPal[3*256];
+ Common::List<ObjPos> _setList;
+ Common::List<ObjPos> _freeList;
+ Common::List<ObjPos> _exList;
Common::List<People> _peopleList;
public:
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 9969ac775a..3e7a694c91 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1188,12 +1188,13 @@ void DreamGenContext::checkIfFree() {
}
bool DreamGenContext::checkIfFree(uint8 x, uint8 y) {
- const ObjPos *freeList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos));
- for (size_t i = 0; i < 80; ++i) {
- const ObjPos *objPos = freeList + 79 - i;
- if (objPos->index == 0xff || !objPos->contains(x,y))
+ Common::List<ObjPos>::const_iterator i;
+ for (i = _freeList.reverse_begin(); i != _freeList.end(); --i) {
+ const ObjPos &pos = *i;
+ assert(pos.index != 0xff);
+ if (!pos.contains(x,y))
continue;
- obName(objPos->index, 2);
+ obName(pos.index, 2);
return true;
}
return false;
@@ -1204,12 +1205,13 @@ void DreamGenContext::checkIfEx() {
}
bool DreamGenContext::checkIfEx(uint8 x, uint8 y) {
- const ObjPos *exList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kExlist, 100 * sizeof(ObjPos));
- for (size_t i = 0; i < 100; ++i) {
- const ObjPos *objPos = exList + 99 - i;
- if (objPos->index == 0xff || !objPos->contains(x,y))
+ Common::List<ObjPos>::const_iterator i;
+ for (i = _exList.reverse_begin(); i != _exList.end(); --i) {
+ const ObjPos &pos = *i;
+ assert(pos.index != 0xff);
+ if (!pos.contains(x,y))
continue;
- obName(objPos->index, 4);
+ obName(pos.index, 4);
return true;
}
return false;
@@ -1781,16 +1783,17 @@ void DreamBase::showIcon() {
}
bool DreamGenContext::checkIfSet(uint8 x, uint8 y) {
- const ObjPos *setList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kSetlist, sizeof(ObjPos) * 128);
- for (size_t i = 0; i < 128; ++i) {
- const ObjPos *pos = setList + 127 - i;
- if (pos->index == 0xff || !pos->contains(x,y))
+ Common::List<ObjPos>::const_iterator i;
+ for (i = _setList.reverse_begin(); i != _setList.end(); --i) {
+ const ObjPos &pos = *i;
+ assert(pos.index != 0xff);
+ if (!pos.contains(x,y))
continue;
- if (!pixelCheckSet(pos, x, y))
+ if (!pixelCheckSet(&pos, x, y))
continue;
- if (!isItDescribed(pos))
+ if (!isItDescribed(&pos))
continue;
- obName(pos->index, 1);
+ obName(pos.index, 1);
return true;
}
return false;