aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorPaul Gilbert2012-10-31 09:34:38 +1100
committerPaul Gilbert2012-10-31 09:34:38 +1100
commit798ddfaab500bb212f620cf095328eee5eb140a4 (patch)
tree55b5d0b90affd88063c04b7ff62fea1616b83e80 /engines/dreamweb
parentef663f95a516d8fe47a245653d418c047361281a (diff)
parentfdc80fd952120ecb8a4941edd4c2e404cdc5fa33 (diff)
downloadscummvm-rg350-798ddfaab500bb212f620cf095328eee5eb140a4.tar.gz
scummvm-rg350-798ddfaab500bb212f620cf095328eee5eb140a4.tar.bz2
scummvm-rg350-798ddfaab500bb212f620cf095328eee5eb140a4.zip
Merge branch 'master' into hopkins
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreamweb.cpp6
-rw-r--r--engines/dreamweb/dreamweb.h2
-rw-r--r--engines/dreamweb/monitor.cpp4
-rw-r--r--engines/dreamweb/object.cpp4
-rw-r--r--engines/dreamweb/people.cpp16
-rw-r--r--engines/dreamweb/print.cpp2
-rw-r--r--engines/dreamweb/sprite.cpp14
-rw-r--r--engines/dreamweb/vgagrafx.cpp72
8 files changed, 42 insertions, 78 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 0ca98d5a7b..5f5d627553 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -516,7 +516,7 @@ uint8 DreamWebEngine::modifyChar(uint8 c) const {
case Common::IT_ITA:
switch(c) {
case 133:
- return 'Z' + 1;
+ return 'Z' + 1;
case 130:
return 'Z' + 2;
case 138:
@@ -548,10 +548,10 @@ uint8 DreamWebEngine::modifyChar(uint8 c) const {
return c;
}
}
-
+
Common::String DreamWebEngine::modifyFileName(const char *name) {
Common::String fileName(name);
-
+
// Sanity check
if (!fileName.hasPrefix("DREAMWEB."))
return fileName;
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 1f6deb8566..a4597b1867 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -196,7 +196,7 @@ protected:
// from monitor.cpp
char _inputLine[64];
- char _operand1[14];
+ char _operand1[64];
char _currentFile[14];
// from newplace.cpp
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index 4e9d8eecc1..1886a80b6a 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -194,7 +194,7 @@ void DreamWebEngine::printLogo() {
}
void DreamWebEngine::input() {
- memset(_inputLine, 0, 64);
+ memset(_inputLine, 0, sizeof(_inputLine));
_curPos = 0;
printChar(_monitorCharset, _monAdX, _monAdY, '>', 0, NULL, NULL);
multiDump(_monAdX, _monAdY, 6, 8);
@@ -665,7 +665,7 @@ void DreamWebEngine::searchForFiles(const char *filesString) {
const char *DreamWebEngine::parser() {
char *output = _operand1;
- memset(output, 0, 14);
+ memset(output, 0, sizeof(_operand1));
*output++ = '=';
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index b42591ef91..1e84aba6bd 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -516,7 +516,7 @@ void DreamWebEngine::inToInv() {
if (_mouseButton == _oldButton || !(_mouseButton & 1))
return; // notletgo2
-
+
delPointer();
DynObject *object = getExAd(_itemFrame);
object->mapad[0] = 4;
@@ -1034,7 +1034,7 @@ void DreamWebEngine::fillOpen() {
size = 4;
findAllOpen();
for (uint8 i = 0; i < size; ++i) {
- uint8 index = _openInvList[i]._index;
+ uint8 index = _openInvList[i]._index;
uint8 type = _openInvList[i]._type;
obToInv(index, type, kInventx + i * kItempicsize, kInventy + 96);
}
diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp
index 36a756a49b..dbb81406cd 100644
--- a/engines/dreamweb/people.cpp
+++ b/engines/dreamweb/people.cpp
@@ -411,7 +411,7 @@ void DreamWebEngine::interviewer(ReelRoutine &routine) {
if (routine.reelPointer() != 250 && routine.reelPointer() != 259 && checkSpeed(routine))
routine.incReelPointer();
-
+
showGameReel(&routine);
}
@@ -745,7 +745,7 @@ void DreamWebEngine::introMonks2(ReelRoutine &routine) {
if (nextReelPointer == 110) {
_introCount++;
monks2text();
-
+
if (_introCount == 35)
nextReelPointer = 111;
else
@@ -895,7 +895,7 @@ void DreamWebEngine::helicopter(ReelRoutine &routine) {
nextReelPointer = 9;
}
}
- }
+ }
routine.setReelPointer(nextReelPointer);
}
@@ -1002,7 +1002,7 @@ void DreamWebEngine::businessMan(ReelRoutine &routine) {
nextReelPointer = 92;
}
}
-
+
routine.setReelPointer(nextReelPointer);
}
@@ -1037,7 +1037,7 @@ void DreamWebEngine::endGameSeq(ReelRoutine &routine) {
showGameReel(&routine);
routine.mapY = _mapY;
-
+
if (routine.reelPointer() == 145) {
routine.setReelPointer(146);
rollEndCreditsGameWon();
@@ -1070,7 +1070,7 @@ void DreamWebEngine::poolGuard(ReelRoutine &routine) {
if (checkSpeed(routine)) {
uint16 nextReelPointer = routine.reelPointer() + 1;
-
+
if (nextReelPointer != 122) {
// Not end guard 1
if (nextReelPointer == 147) {
@@ -1103,12 +1103,12 @@ void DreamWebEngine::poolGuard(ReelRoutine &routine) {
}
}
}
-
+
routine.setReelPointer(nextReelPointer);
}
showGameReel(&routine);
-
+
if (routine.reelPointer() != 121 && routine.reelPointer() != 146) {
_pointerMode = 0;
_vars._watchingTime = 2;
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index 3a2c45e07b..64b9849980 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -212,7 +212,7 @@ const char *DreamWebEngine::monPrint(const char *string) {
while (!done) {
uint16 count = getNumber(_monitorCharset, (const uint8 *)iterator, 166, false, &x);
- do {
+ do {
char c = *iterator++;
if (c == ':')
break;
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 5b6cf6a6ac..01570c907a 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -52,7 +52,7 @@ void DreamWebEngine::printASprite(const Sprite *sprite) {
} else {
x = sprite->x + _mapAdX;
}
-
+
uint8 c;
if (sprite->walkFrame != 0)
c = 8;
@@ -97,7 +97,7 @@ void DreamWebEngine::spriteUpdate() {
else {
backObject(&sprite);
}
-
+
if (_nowInNewRoom == 1)
break;
}
@@ -373,7 +373,7 @@ void DreamWebEngine::lockedDoorway(Sprite *sprite, SetObject *objData) {
if (sprite->animFrame != 0)
--sprite->animFrame;
-
+
_vars._throughDoor = 0;
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
@@ -407,7 +407,7 @@ void DreamWebEngine::liftSprite(Sprite *sprite, SetObject *objData) {
}
sprite->animFrame = 12;
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
- }
+ }
else if (liftFlag == 3) { //openlift
if (sprite->animFrame == 12) {
_vars._liftFlag = 1;
@@ -672,7 +672,7 @@ static const ReelSound g_roomSound6[] = {
{ 255,0 }
};
static const ReelSound g_roomSound8[] = {
-
+
{ 12, 51 },
{ 13, 53 },
{ 14, 14 },
@@ -691,7 +691,7 @@ static const ReelSound g_roomSound10[] = {
{ 13, 16 },
{ 255,0 }
};
-
+
static const ReelSound g_roomSound11[] = {
{ 13, 20 },
{ 255,0 }
@@ -779,7 +779,7 @@ static const ReelSound g_roomSound26[] = {
{ 15, 102 }, // was 90, should be mine cart
{ 255,0 }
};
-
+
static const ReelSound g_roomSound27[] = {
{ 22, 36 },
{ 13, 125 },
diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
index ec306c4924..d2390fb1fd 100644
--- a/engines/dreamweb/vgagrafx.cpp
+++ b/engines/dreamweb/vgagrafx.cpp
@@ -23,6 +23,7 @@
#include "dreamweb/dreamweb.h"
#include "engines/util.h"
#include "graphics/surface.h"
+#include "graphics/decoders/pcx.h"
namespace DreamWeb {
@@ -152,70 +153,33 @@ void DreamWebEngine::setMode() {
void DreamWebEngine::showPCX(const Common::String &suffix) {
Common::String name = getDatafilePrefix() + suffix;
Common::File pcxFile;
-
if (!pcxFile.open(name)) {
warning("showpcx: Could not open '%s'", name.c_str());
return;
}
- uint8 *mainGamePal;
- int i, j;
+ Graphics::PCXDecoder pcx;
+ if (!pcx.loadStream(pcxFile)) {
+ warning("showpcx: Could not process '%s'", name.c_str());
+ return;
+ }
// Read the 16-color palette into the 'maingamepal' buffer. Note that
// the color components have to be adjusted from 8 to 6 bits.
-
- pcxFile.seek(16, SEEK_SET);
- mainGamePal = _mainPal;
- pcxFile.read(mainGamePal, 48);
-
- memset(mainGamePal + 48, 0xff, 720);
- for (i = 0; i < 48; i++) {
- mainGamePal[i] >>= 2;
+ memset(_mainPal, 0xff, 256 * 3);
+ memcpy(_mainPal, pcx.getPalette(), 48);
+ for (int i = 0; i < 48; i++) {
+ _mainPal[i] >>= 2;
}
- // Decode the image data.
-
Graphics::Surface *s = g_system->lockScreen();
- Common::Rect rect(640, 480);
-
- s->fillRect(rect, 0);
- pcxFile.seek(128, SEEK_SET);
-
- for (int y = 0; y < 480; y++) {
- byte *dst = (byte *)s->getBasePtr(0, y);
- int decoded = 0;
-
- while (decoded < 320) {
- byte col = pcxFile.readByte();
- byte len;
-
- if ((col & 0xc0) == 0xc0) {
- len = col & 0x3f;
- col = pcxFile.readByte();
- } else {
- len = 1;
- }
-
- // The image uses 16 colors and is stored as four bit
- // planes, one for each bit of the color, least
- // significant bit plane first.
-
- for (i = 0; i < len; i++) {
- int plane = decoded / 80;
- int pos = decoded % 80;
-
- for (j = 0; j < 8; j++) {
- byte bit = (col >> (7 - j)) & 1;
- dst[8 * pos + j] |= (bit << plane);
- }
-
- decoded++;
- }
- }
- }
-
+ s->fillRect(Common::Rect(640, 480), 0);
+ const Graphics::Surface *pcxSurface = pcx.getSurface();
+ if (pcxSurface->format.bytesPerPixel != 1)
+ error("Invalid bytes per pixel in PCX surface (%d)", pcxSurface->format.bytesPerPixel);
+ for (uint16 y = 0; y < pcxSurface->h; y++)
+ memcpy((byte *)s->getBasePtr(0, y), pcxSurface->getBasePtr(0, y), pcxSurface->w);
g_system->unlockScreen();
- pcxFile.close();
}
void DreamWebEngine::frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y) {
@@ -370,9 +334,9 @@ void DreamWebEngine::zoom() {
for (size_t j = 0; j < 23; ++j) {
uint8 v = src[j];
dst[2*j+0] = v;
- dst[2*j+1] = v;
+ dst[2*j+1] = v;
dst[2*j+320] = v;
- dst[2*j+321] = v;
+ dst[2*j+321] = v;
}
src += 320;
dst += 320*2;