aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorStrangerke2013-06-26 23:11:34 +0200
committerStrangerke2013-06-26 23:11:34 +0200
commit6e2d567bca53b6ffee771b4105e2e73dbd73f5b4 (patch)
tree9880f0c496263ffb6928248d495ce4172dabed18 /engines/dreamweb
parentac387835e4527c1814919093b4e4bc9798d5742d (diff)
parent6716fa39a6fb2a3925576288c256688c5aadd7e9 (diff)
downloadscummvm-rg350-6e2d567bca53b6ffee771b4105e2e73dbd73f5b4.tar.gz
scummvm-rg350-6e2d567bca53b6ffee771b4105e2e73dbd73f5b4.tar.bz2
scummvm-rg350-6e2d567bca53b6ffee771b4105e2e73dbd73f5b4.zip
Merge branch 'master' of https://github.com/scummvm/scummvm into mortevielle
Conflicts: engines/engines.mk
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/backdrop.cpp40
-rw-r--r--engines/dreamweb/console.cpp1
-rw-r--r--engines/dreamweb/detection_tables.h24
-rw-r--r--engines/dreamweb/dreamweb.cpp50
-rw-r--r--engines/dreamweb/dreamweb.h20
-rw-r--r--engines/dreamweb/keypad.cpp17
-rw-r--r--engines/dreamweb/monitor.cpp126
-rw-r--r--engines/dreamweb/newplace.cpp2
-rw-r--r--engines/dreamweb/object.cpp168
-rw-r--r--engines/dreamweb/pathfind.cpp2
-rw-r--r--engines/dreamweb/people.cpp2
-rw-r--r--engines/dreamweb/print.cpp16
-rw-r--r--engines/dreamweb/rain.cpp4
-rw-r--r--engines/dreamweb/saveload.cpp63
-rw-r--r--engines/dreamweb/sprite.cpp2
-rw-r--r--engines/dreamweb/stubs.cpp166
-rw-r--r--engines/dreamweb/titles.cpp116
-rw-r--r--engines/dreamweb/use.cpp2
-rw-r--r--engines/dreamweb/vgafades.cpp10
-rw-r--r--engines/dreamweb/vgagrafx.cpp80
20 files changed, 531 insertions, 380 deletions
diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp
index 1db2663624..5ccc68704a 100644
--- a/engines/dreamweb/backdrop.cpp
+++ b/engines/dreamweb/backdrop.cpp
@@ -25,35 +25,35 @@
namespace DreamWeb {
void DreamWebEngine::doBlocks() {
- uint16 dstOffset = _mapAdY * 320 + _mapAdX;
+ uint16 dstOffset = _mapAdY * kScreenwidth + _mapAdX;
uint16 mapOffset = _mapY * kMapWidth + _mapX;
const uint8 *mapData = _mapData + mapOffset;
uint8 *dstBuffer = workspace() + dstOffset;
- for (size_t i = 0; i < 10; ++i) {
- for (size_t j = 0; j < 11; ++j) {
+ for (uint i = 0; i < 10; ++i) {
+ for (uint j = 0; j < 11; ++j) {
uint16 blockType = mapData[j];
if (blockType != 0) {
- uint8 *dst = dstBuffer + i * 320 * 16 + j * 16;
+ uint8 *dst = dstBuffer + i * kScreenwidth * 16 + j * 16;
const uint8 *block = _backdropBlocks + blockType * 256;
- for (size_t k = 0; k < 4; ++k) {
+ for (uint k = 0; k < 4; ++k) {
memcpy(dst, block, 16);
block += 16;
- dst += 320;
+ dst += kScreenwidth;
}
- for (size_t k = 0; k < 12; ++k) {
+ for (uint k = 0; k < 12; ++k) {
memcpy(dst, block, 16);
memset(dst + 16, 0xdf, 4);
block += 16;
- dst += 320;
+ dst += kScreenwidth;
}
dst += 4;
memset(dst, 0xdf, 16);
- dst += 320;
+ dst += kScreenwidth;
memset(dst, 0xdf, 16);
- dst += 320;
+ dst += kScreenwidth;
memset(dst, 0xdf, 16);
- dst += 320;
+ dst += kScreenwidth;
memset(dst, 0xdf, 16);
}
}
@@ -129,7 +129,7 @@ void DreamWebEngine::showAllObs() {
_setList.clear();
const GraphicsFile &frameBase = _setFrames;
- for (size_t i = 0; i < 128; ++i) {
+ for (uint i = 0; i < 128; ++i) {
SetObject *setEntry = &_setDat[i];
uint16 x, y;
if (getMapAd(setEntry->mapad, &x, &y) == 0)
@@ -154,7 +154,7 @@ void DreamWebEngine::showAllObs() {
}
static bool addAlong(const MapFlag *mapFlags) {
- for (size_t i = 0; i < 11; ++i) {
+ for (uint i = 0; i < 11; ++i) {
if (mapFlags[i]._flag != 0)
return true;
}
@@ -162,7 +162,7 @@ static bool addAlong(const MapFlag *mapFlags) {
}
static bool addLength(const MapFlag *mapFlags) {
- for (size_t i = 0; i < 10; ++i) {
+ for (uint i = 0; i < 10; ++i) {
if (mapFlags[11 * i]._flag != 0)
return true;
}
@@ -205,13 +205,13 @@ void DreamWebEngine::calcMapAd() {
}
void DreamWebEngine::showAllFree() {
- const unsigned int count = 80;
+ const uint count = 80;
_freeList.clear();
const DynObject *freeObjects = _freeDat;
const GraphicsFile &frameBase = _freeFrames;
- for (size_t i = 0; i < count; ++i) {
+ for (uint i = 0; i < count; ++i) {
uint16 x, y;
uint8 mapAd = getMapAd(freeObjects[i].mapad, &x, &y);
if (mapAd != 0) {
@@ -236,8 +236,8 @@ void DreamWebEngine::drawFlags() {
uint16 mapOffset = _mapY * kMapWidth + _mapX;
const uint8 *mapData = _mapData + mapOffset;
- for (size_t i = 0; i < 10; ++i) {
- for (size_t j = 0; j < 11; ++j) {
+ for (uint i = 0; i < 10; ++i) {
+ for (uint j = 0; j < 11; ++j) {
uint8 tile = mapData[i * kMapWidth + j];
mapFlag->_flag = _backdropFlags[tile]._flag;
mapFlag->_flagEx = _backdropFlags[tile]._flagEx;
@@ -248,13 +248,13 @@ void DreamWebEngine::drawFlags() {
}
void DreamWebEngine::showAllEx() {
- const unsigned int count = 100;
+ const uint count = 100;
_exList.clear();
DynObject *objects = _exData;
const GraphicsFile &frameBase = _exFrames;
- for (size_t i = 0; i < count; ++i) {
+ for (uint i = 0; i < count; ++i) {
DynObject *object = objects + i;
if (object->mapad[0] == 0xff)
continue;
diff --git a/engines/dreamweb/console.cpp b/engines/dreamweb/console.cpp
index d415089a48..532bf815ef 100644
--- a/engines/dreamweb/console.cpp
+++ b/engines/dreamweb/console.cpp
@@ -25,6 +25,7 @@
namespace DreamWeb {
DreamWebConsole::DreamWebConsole(DreamWebEngine *vm) : GUI::Debugger(), _vm(vm) {
+ assert(_vm);
}
DreamWebConsole::~DreamWebConsole() {
diff --git a/engines/dreamweb/detection_tables.h b/engines/dreamweb/detection_tables.h
index 8a2f94f99b..ec54484d28 100644
--- a/engines/dreamweb/detection_tables.h
+++ b/engines/dreamweb/detection_tables.h
@@ -45,7 +45,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::EN_ANY,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
0,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
@@ -62,7 +62,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::EN_ANY,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
ADGF_CD,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
@@ -83,7 +83,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::EN_GRB,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
ADGF_CD,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
@@ -100,7 +100,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::EN_USA,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
ADGF_CD,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
@@ -117,7 +117,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::FR_FRA,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
ADGF_CD,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
@@ -135,7 +135,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::FR_FRA,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
ADGF_CD,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
@@ -152,7 +152,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::DE_DEU,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
0,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
@@ -169,7 +169,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::DE_DEU,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
ADGF_CD,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
@@ -186,7 +186,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::ES_ESP,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
0,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
@@ -203,7 +203,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::ES_ESP,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
ADGF_CD,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
@@ -221,7 +221,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::ES_ESP,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
ADGF_CD,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
@@ -238,7 +238,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
AD_LISTEND
},
Common::IT_ITA,
- Common::kPlatformPC,
+ Common::kPlatformDOS,
0,
GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE)
},
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 5f5d627553..c3ede46df2 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -208,7 +208,7 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
_addToRed = 0;
_addToBlue = 0;
_lastSoundReel = 0;
- _lastHardKey = 0;
+ _lastHardKey = Common::KEYCODE_INVALID;
_bufferIn = 0;
_bufferOut = 0;
_blinkFrame = 23;
@@ -263,7 +263,7 @@ void DreamWebEngine::waitForVSync() {
void DreamWebEngine::quit() {
_quitRequested = true;
- _lastHardKey = 1;
+ _lastHardKey = Common::KEYCODE_ESCAPE;
}
void DreamWebEngine::processEvents() {
@@ -274,7 +274,7 @@ void DreamWebEngine::processEvents() {
_sound->soundHandler();
Common::Event event;
- int softKey, hardKey;
+ int softKey;
while (_eventMan->pollEvent(event)) {
switch(event.type) {
case Common::EVENT_RTL:
@@ -309,28 +309,21 @@ void DreamWebEngine::processEvents() {
return; //do not pass ctrl + key to the engine
}
- // Some parts of the ASM code uses the hardware key
- // code directly. We don't have that code, so we fake
- // it for the keys where it's needed and assume it's
- // 0 (which is actually an invalid value, as far as I
- // know) otherwise.
-
- hardKey = 0;
+ // Some parts of the code uses the hardware key
+ // code directly.
switch (event.kbd.keycode) {
case Common::KEYCODE_ESCAPE:
- hardKey = 1;
+ _lastHardKey = Common::KEYCODE_ESCAPE;
break;
case Common::KEYCODE_SPACE:
- hardKey = 57;
+ _lastHardKey = Common::KEYCODE_SPACE;
break;
default:
- hardKey = 0;
+ _lastHardKey = Common::KEYCODE_INVALID;
break;
}
- _lastHardKey = hardKey;
-
// The rest of the keys are converted to ASCII. This
// is fairly restrictive, and eventually we may want
// to let through more keys. I think this is mostly to
@@ -338,11 +331,13 @@ void DreamWebEngine::processEvents() {
softKey = 0;
- if (event.kbd.keycode >= Common::KEYCODE_a && event.kbd.keycode <= Common::KEYCODE_z) {
- softKey = event.kbd.ascii & ~0x20;
- } else if (event.kbd.keycode == Common::KEYCODE_MINUS ||
- event.kbd.keycode == Common::KEYCODE_SPACE ||
- (event.kbd.keycode >= Common::KEYCODE_0 && event.kbd.keycode <= Common::KEYCODE_9)) {
+ debug(1, "DreamWebEngine::processEvents() KeyDown keycode:%d ascii:0x%02x", event.kbd.keycode, event.kbd.ascii);
+ if ((event.kbd.ascii >= 'a' && event.kbd.ascii <= 'z') ||
+ (event.kbd.ascii >= 'A' && event.kbd.ascii <= 'Z')) {
+ softKey = event.kbd.ascii & ~0x20; // (& ~0x20) forces ascii codes for a-z to map to A-Z
+ } else if (event.kbd.ascii == '-' ||
+ event.kbd.ascii == ' ' ||
+ (event.kbd.ascii >= '0' && event.kbd.ascii <= '9')) {
softKey = event.kbd.ascii;
} else if (event.kbd.keycode >= Common::KEYCODE_KP0 && event.kbd.keycode <= Common::KEYCODE_KP9) {
softKey = event.kbd.keycode - Common::KEYCODE_KP0 + '0';
@@ -374,6 +369,7 @@ Common::Error DreamWebEngine::run() {
ConfMan.registerDefault("bright_palette", true);
_hasSpeech = Common::File::exists(_speechDirName + "/r01c0000.raw") && !ConfMan.getBool("speech_mute");
_brightPalette = ConfMan.getBool("bright_palette");
+ _copyProtection = ConfMan.getBool("copy_protection");
_timer->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync");
dreamweb();
@@ -403,14 +399,14 @@ Common::String DreamWebEngine::getSavegameFilename(int slot) const {
void DreamWebEngine::keyPressed(uint16 ascii) {
debug(2, "key pressed = %04x", ascii);
- uint16 in = (_bufferIn + 1) & 0x0f;
+ uint16 in = (_bufferIn + 1) % ARRAYSIZE(_keyBuffer);
uint16 out = _bufferOut;
if (in == out) {
warning("keyboard buffer is full");
return;
}
_bufferIn = in;
- DreamWeb::g_keyBuffer[in] = ascii;
+ _keyBuffer[in] = ascii;
}
void DreamWebEngine::getPalette(uint8 *data, uint start, uint count) {
@@ -421,7 +417,7 @@ void DreamWebEngine::getPalette(uint8 *data, uint start, uint count) {
void DreamWebEngine::setPalette(const uint8 *data, uint start, uint count) {
assert(start + count <= 256);
- uint8 fixed[768];
+ uint8 fixed[3*256];
for (uint i = 0; i < count * 3; ++i) {
fixed[i] = data[i] << 2;
}
@@ -429,10 +425,10 @@ void DreamWebEngine::setPalette(const uint8 *data, uint start, uint count) {
}
void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int h) {
- if (y + h > 200)
- h = 200 - y;
- if (x + w > 320)
- w = 320 - x;
+ if (y + h > (int)kScreenheight)
+ h = kScreenheight - y;
+ if (x + w > (int)kScreenwidth)
+ w = kScreenwidth - x;
if (h <= 0 || w <= 0)
return;
_system->copyRectToScreen(src, pitch, x, y, w, h);
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index a4597b1867..5746568e4e 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -25,6 +25,7 @@
#include "common/error.h"
#include "common/file.h"
+#include "common/keyboard.h"
#include "common/random.h"
#include "common/rect.h"
#include "common/savefile.h"
@@ -63,6 +64,7 @@ const unsigned int kMapHeight = 60;
const unsigned int kLengthOfMap = kMapWidth * kMapHeight;
const unsigned int kNumExObjects = 114;
const unsigned int kScreenwidth = 320;
+const unsigned int kScreenheight = 200;
const unsigned int kDiaryx = (68+24);
const unsigned int kDiaryy = (48+12);
const unsigned int kInventx = 80;
@@ -88,10 +90,6 @@ const unsigned int kNumRoomTexts = 38;
const unsigned int kNumFreeTexts = 82;
const unsigned int kNumPersonTexts = 1026;
-// Keyboard buffer. data.word(kBufferin) and data.word(kBufferout) are indexes
-// into this, making it a ring buffer
-extern uint8 g_keyBuffer[16];
-
// Engine Debug Flags
enum {
kDebugAnimation = (1 << 0),
@@ -156,6 +154,12 @@ public:
const Common::String& getSpeechDirName() { return _speechDirName; }
private:
+ // Keyboard buffer. _bufferIn and _bufferOut are indexes
+ // into this, making it a ring buffer
+ uint8 _keyBuffer[16];
+ uint16 _bufferIn;
+ uint16 _bufferOut;
+
void keyPressed(uint16 ascii);
void setSpeed(uint speed);
@@ -316,6 +320,7 @@ public:
uint16 _charShift;
uint8 _kerning;
bool _brightPalette;
+ bool _copyProtection;
uint8 _roomLoaded;
uint8 _didZoom;
uint16 _lineSpacing;
@@ -419,9 +424,7 @@ public:
uint8 _addToRed;
uint8 _addToBlue;
uint16 _lastSoundReel;
- uint8 _lastHardKey;
- uint16 _bufferIn;
- uint16 _bufferOut;
+ Common::KeyCode _lastHardKey;
uint8 _blinkFrame;
uint8 _blinkCount;
uint8 _reAssesChanges;
@@ -510,6 +513,7 @@ public:
void dirCom();
void useMon();
bool execCommand();
+ int findCommand(const char *const cmdList[]);
// from newplace.cpp
void getUnderCentre();
@@ -750,7 +754,6 @@ public:
void showRyanPage();
void switchRyanOn();
void switchRyanOff();
- void middlePanel();
void showDiary();
void readMouse();
uint16 readMouseState();
@@ -882,7 +885,6 @@ public:
void obsThatDoThings();
void describeOb();
void putBackObStuff();
- void reExFromOpen();
void showDiaryPage();
void showDiaryKeys();
void dumpDiaryKeys();
diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp
index 3580f8ad52..7bbca2b979 100644
--- a/engines/dreamweb/keypad.cpp
+++ b/engines/dreamweb/keypad.cpp
@@ -103,7 +103,6 @@ void DreamWebEngine::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 d
// Note: isItRight comes from use.asm, but is only used by enterCode(),
// so we place it here.
bool DreamWebEngine::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) {
-
return digit0 == _pressList[0] && digit1 == _pressList[1]
&& digit2 == _pressList[2] && digit3 == _pressList[3];
}
@@ -434,7 +433,7 @@ void DreamWebEngine::folderExit() {
void DreamWebEngine::showLeftPage() {
showFrame(_folderGraphics2, 0, 12, 3, 0);
uint16 y = 12+5;
- for (size_t i = 0; i < 9; ++i) {
+ for (uint i = 0; i < 9; ++i) {
showFrame(_folderGraphics2, 0, y, 4, 0);
y += 16;
}
@@ -445,7 +444,7 @@ void DreamWebEngine::showLeftPage() {
uint8 pageIndex = _folderPage - 2;
const uint8 *string = getTextInFile1(pageIndex * 2);
y = 48;
- for (size_t i = 0; i < 2; ++i) {
+ for (uint i = 0; i < 2; ++i) {
uint8 lastChar;
do {
lastChar = printDirect(&string, 2, &y, 140, false);
@@ -455,19 +454,19 @@ void DreamWebEngine::showLeftPage() {
_kerning = 0;
_charShift = 0;
_lineSpacing = 10;
- uint8 *bufferToSwap = workspace() + (48*320)+2;
- for (size_t i = 0; i < 120; ++i) {
- for (size_t j = 0; j < 65; ++j) {
+ uint8 *bufferToSwap = workspace() + (48*kScreenwidth)+2;
+ for (uint i = 0; i < 120; ++i) {
+ for (uint j = 0; j < 65; ++j) {
SWAP(bufferToSwap[j], bufferToSwap[130 - j]);
}
- bufferToSwap += 320;
+ bufferToSwap += kScreenwidth;
}
}
void DreamWebEngine::showRightPage() {
showFrame(_folderGraphics2, 143, 12, 0, 0);
uint16 y = 12+37;
- for (size_t i = 0; i < 7; ++i) {
+ for (uint i = 0; i < 7; ++i) {
showFrame(_folderGraphics2, 143, y, 1, 0);
y += 16;
}
@@ -478,7 +477,7 @@ void DreamWebEngine::showRightPage() {
uint8 pageIndex = _folderPage - 1;
const uint8 *string = getTextInFile1(pageIndex * 2);
y = 48;
- for (size_t i = 0; i < 2; ++i) {
+ for (uint i = 0; i < 2; ++i) {
uint8 lastChar;
do {
lastChar = printDirect(&string, 152, &y, 140, false);
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index 1886a80b6a..1f9fa8d24f 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -104,15 +104,76 @@ void DreamWebEngine::useMon() {
redrawMainScrn();
workToScreenM();
}
+
+int DreamWebEngine::findCommand(const char *const cmdList[]) {
+ // Loop over all commands in the list and see if we get a match
+ int cmd = 0;
+ while (cmdList[cmd] != NULL) {
+ const char *cmdStr = cmdList[cmd];
+ const char *inputStr = _inputLine;
+ // Compare the command, char by char, to see if we get a match.
+ // We only care about the prefix matching, though.
+ char inputChar, cmdChar;
+ do {
+ inputChar = *inputStr; inputStr += 2;
+ cmdChar = *cmdStr++;
+ if (cmdChar == 0)
+ return cmd;
+ } while (inputChar == cmdChar);
+ ++cmd;
+ }
+ return -1;
+}
bool DreamWebEngine::execCommand() {
- static const char *comlist[] = {
+ static const char *const comlist[] = {
"EXIT",
"HELP",
"LIST",
"READ",
"LOGON",
- "KEYS"
+ "KEYS",
+ NULL
+ };
+
+ static const char *const comlistFR[] = {
+ "SORTIR",
+ "AIDE",
+ "LISTE",
+ "LIRE",
+ "CONNEXION",
+ "TOUCHES", // should be CLES but it is translated as TOUCHES in the game...
+ NULL
+ };
+
+ static const char *const comlistDE[] = {
+ "ENDE",
+ "HILF",
+ "LISTE",
+ "LIES",
+ "ZUGRIFF",
+ "DATEN",
+ NULL
+ };
+
+ static const char *const comlistIT[] = {
+ "ESCI",
+ "AIUTO",
+ "ELENCA",
+ "LEGGI",
+ "ACCEDI",
+ "CHIAVI",
+ NULL
+ };
+
+ static const char *const comlistES[] = {
+ "SALIR",
+ "AYUDA",
+ "LISTA",
+ "LEER",
+ "ACCESO",
+ "CLAVES",
+ NULL
};
if (_inputLine[0] == 0) {
@@ -121,26 +182,25 @@ bool DreamWebEngine::execCommand() {
return false;
}
- int cmd;
- bool done = false;
- // Loop over all commands in the list and see if we get a match
- for (cmd = 0; cmd < ARRAYSIZE(comlist); ++cmd) {
- const char *cmdStr = comlist[cmd];
- const char *inputStr = _inputLine;
- // Compare the command, char by char, to see if we get a match.
- // We only care about the prefix matching, though.
- char inputChar, cmdChar;
- do {
- inputChar = *inputStr; inputStr += 2;
- cmdChar = *cmdStr++;
- if (cmdChar == 0) {
- done = true;
- break;
- }
- } while (inputChar == cmdChar);
-
- if (done)
+ int cmd = findCommand(comlist);
+ if (cmd == -1) {
+ // This did not match an english command. Try to find a localized one.
+ switch (getLanguage()) {
+ case Common::FR_FRA:
+ cmd = findCommand(comlistFR);
+ break;
+ case Common::DE_DEU:
+ cmd = findCommand(comlistDE);
+ break;
+ case Common::IT_ITA:
+ cmd = findCommand(comlistIT);
+ break;
+ case Common::ES_ESP:
+ cmd = findCommand(comlistES);
break;
+ default:
+ break;
+ }
}
// Execute the selected command
@@ -149,6 +209,27 @@ bool DreamWebEngine::execCommand() {
return true;
case 1:
monMessage(6);
+ // An extra addition in ScummVM: available commands.
+ // Since the reference to the game manual is a form of copy protection,
+ // this extra text is wrapped around the common copy protection check,
+ // to keep it faithful to the original, if requested.
+ if (!_copyProtection) {
+ switch (getLanguage()) {
+ case Common::FR_FRA:
+ monPrint("LES COMMANDES VALIDES SONT SORTIR, AIDE, LISTE, LIRE, CONNEXION, TOUCHES");
+ break;
+ case Common::DE_DEU:
+ monPrint("G\232LTIGE BEFEHLE SIND ENDE, HILFE, LISTE, LIES, ZUGRIFF, DATEN");
+ break;
+ case Common::IT_ITA:
+ monPrint("I COMANDI VALIDI SONO ESCI, AIUTO, ELENCA, LEGGI, ACCEDI, CHIAVI");
+ break;
+ case Common::ES_ESP:
+ default:
+ monPrint("VALID COMMANDS ARE EXIT, HELP, LIST, READ, LOGON, KEYS");
+ break;
+ }
+ }
break;
case 2:
dirCom();
@@ -170,7 +251,6 @@ bool DreamWebEngine::execCommand() {
}
-
void DreamWebEngine::monitorLogo() {
if (_logoNum != _oldLogoNum) {
_oldLogoNum = _logoNum;
@@ -366,7 +446,7 @@ void DreamWebEngine::lockLightOff() {
}
void DreamWebEngine::turnOnPower() {
- for (size_t i = 0; i < 3; ++i) {
+ for (uint i = 0; i < 3; ++i) {
powerLightOn();
hangOn(30);
powerLightOff();
diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp
index 5b4b0260f5..6b1f9d097b 100644
--- a/engines/dreamweb/newplace.cpp
+++ b/engines/dreamweb/newplace.cpp
@@ -140,7 +140,7 @@ void DreamWebEngine::putUnderCentre() {
}
void DreamWebEngine::locationPic() {
- const int roomPics[] = { 5, 0, 3, 2, 4, 1, 10, 9, 8, 6, 11, 4, 7, 7, 0 };
+ const int roomPics[] = { 5, 0, 3, 2, 4, 1, 10, 9, 8, 6, 11, 4, 7, 7, 0, 0 };
byte picture = roomPics[_destPos];
if (picture >= 6)
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 1e84aba6bd..bee3a6d511 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -31,7 +31,7 @@ void DreamWebEngine::showRyanPage() {
void DreamWebEngine::findAllRyan() {
memset(_ryanInvList, 0xff, sizeof(_ryanInvList));
- for (size_t i = 0; i < kNumexobjects; ++i) {
+ for (uint i = 0; i < kNumexobjects; ++i) {
const DynObject *extra = getExAd(i);
if (extra->mapad[0] != kExObjectType)
continue;
@@ -47,8 +47,8 @@ void DreamWebEngine::findAllRyan() {
void DreamWebEngine::fillRyan() {
ObjectRef *inv = &_ryanInvList[_vars._ryanPage * 10];
findAllRyan();
- for (size_t i = 0; i < 2; ++i) {
- for (size_t j = 0; j < 5; ++j) {
+ for (uint i = 0; i < 2; ++i) {
+ for (uint j = 0; j < 5; ++j) {
obToInv(inv->_index, inv->_type, kInventx + j * kItempicsize, kInventy + i * kItempicsize);
++inv;
}
@@ -435,10 +435,23 @@ void DreamWebEngine::deleteExFrame(uint8 frameNum) {
_vars._exFramePos -= frameSize;
// Adjust all frame pointers pointing into the shifted data
- for (unsigned int i = 0; i < 3*kNumexobjects; ++i) {
- frame = &_exFrames._frames[i];
- if (frame->ptr() >= startOff)
- frame->setPtr(frame->ptr() - frameSize);
+ for (unsigned int i = 0; i < kNumexobjects; ++i) {
+ if (_exData[i].mapad[0] != 0xff) {
+ frame = &_exFrames._frames[3*i+0];
+ if (frame->ptr() >= startOff) {
+ frame->setPtr(frame->ptr() - frameSize);
+ assert(frame->ptr() + frame->width*frame->height <= _vars._exFramePos);
+ } else {
+ assert(frame->ptr() + frame->width*frame->height <= startOff);
+ }
+ frame = &_exFrames._frames[3*i+1];
+ if (frame->ptr() >= startOff) {
+ frame->setPtr(frame->ptr() - frameSize);
+ assert(frame->ptr() + frame->width*frame->height <= _vars._exFramePos);
+ } else {
+ assert(frame->ptr() + frame->width*frame->height <= startOff);
+ }
+ }
}
}
@@ -875,7 +888,7 @@ void DreamWebEngine::useOpened() {
void DreamWebEngine::outOfOpen() {
if (_openedOb == 255)
- return; // cannot use opened object
+ return; // cannot use opened object
ObjectRef objectId = findOpenPos();
@@ -892,13 +905,10 @@ void DreamWebEngine::outOfOpen() {
}
if (_mouseButton == _oldButton)
- return; // notletgo4
+ return; // notletgo4
- if (_mouseButton != 1) {
- if (_mouseButton == 2)
- reExFromOpen();
+ if (_mouseButton != 1)
return;
- }
delPointer();
_pickUp = 1;
@@ -1102,4 +1112,136 @@ void DreamWebEngine::pickupConts(uint8 from, uint8 containerEx) {
}
}
+void DreamWebEngine::incRyanPage() {
+ commandOnlyCond(31, 222);
+
+ if (_mouseButton == _oldButton || !(_mouseButton & 1))
+ return;
+
+ _vars._ryanPage = (_mouseX - (kInventx + 167)) / 18;
+
+ delPointer();
+ fillRyan();
+ readMouse();
+ showPointer();
+ workToScreen();
+ delPointer();
+}
+
+void DreamWebEngine::emergencyPurge() {
+ debug(2, "Ex memory: frames %d/%d, text %d/%d", _vars._exFramePos, kExframeslen, _vars._exTextPos, kExtextlen);
+
+ while (_vars._exFramePos + 4000 >= kExframeslen ||
+ _vars._exTextPos + 400 >= kExtextlen)
+ {
+ purgeAnItem();
+ debug(2, "Ex memory after purging: frames %d/%d, text %d/%d", _vars._exFramePos, kExframeslen, _vars._exTextPos, kExtextlen);
+ }
+}
+
+void DreamWebEngine::purgeAnItem() {
+ const DynObject *extraObjects = _exData;
+
+
+ for (uint i = 0; i < kNumexobjects; ++i) {
+ if (extraObjects[i].mapad[0] == 0 &&
+ (extraObjects[i].objId[0] == 255 || extraObjects[i].objId[0] == 2) &&
+ extraObjects[i].initialLocation != _realLocation) {
+ debug(1, "Purging ex object %d", i);
+ deleteExObject(i);
+ return;
+ }
+ }
+
+ for (uint i = 0; i < kNumexobjects; ++i) {
+ if (extraObjects[i].mapad[0] == 0 && extraObjects[i].objId[0] == 255) {
+ debug(1, "Purging ex object %d", i);
+ deleteExObject(i);
+ return;
+ }
+ }
+
+ error("Out of Ex object memory");
+}
+
+void DreamWebEngine::dropError() {
+ _commandType = 255;
+ delPointer();
+ printMessage(76, 21, 56, 240, 240 & 1);
+ workToScreenM();
+ hangOnP(50);
+ showPanel();
+ showMan();
+ examIcon();
+ _commandType = 255;
+ workToScreenM();
+}
+
+void DreamWebEngine::cantDrop() {
+ _commandType = 255;
+ delPointer();
+ printMessage(76, 21, 24, 240, 240 & 1);
+ workToScreenM();
+ hangOnP(50);
+ showPanel();
+ showMan();
+ examIcon();
+ _commandType = 255;
+ workToScreenM();
+}
+
+void DreamWebEngine::examineInventory() {
+ commandOnlyCond(32, 249);
+
+ if (!(_mouseButton & 1))
+ return;
+
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ examIcon();
+ _pickUp = 0;
+ _invOpen = 2;
+ openInv();
+ workToScreenM();
+}
+
+void DreamWebEngine::openInv() {
+ _invOpen = 1;
+ printMessage(80, 58 - 10, 61, 240, (240 & 1));
+ fillRyan();
+ _commandType = 255;
+}
+
+void DreamWebEngine::pickupOb(uint8 command, uint8 pos) {
+ _lastInvPos = pos;
+ _objectType = kFreeObjectType;
+ _itemFrame = command;
+ _command = command;
+ //uint8 dummy;
+ //getAnyAd(&dummy, &dummy); // was in the original source, seems useless here
+ transferToEx(command);
+}
+
+void DreamWebEngine::initialInv() {
+ if (_realLocation != 24)
+ return;
+
+ pickupOb(11, 5);
+ pickupOb(12, 6);
+ pickupOb(13, 7);
+ pickupOb(14, 8);
+ pickupOb(18, 0);
+ pickupOb(19, 1);
+ pickupOb(20, 9);
+ pickupOb(16, 2);
+ _vars._watchMode = 1;
+ _vars._reelToHold = 0;
+ _vars._endOfHoldReel = 6;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ switchRyanOff();
+}
+
} // End of namespace DreamWeb
diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp
index c39070532c..64cffde4de 100644
--- a/engines/dreamweb/pathfind.cpp
+++ b/engines/dreamweb/pathfind.cpp
@@ -110,7 +110,7 @@ void DreamWebEngine::checkDest(const RoomPaths *roomsPaths) {
const PathSegment *segments = roomsPaths->segments;
const uint8 tmp = _mansPath << 4;
uint8 destination = _destination;
- for (size_t i = 0; i < 24; ++i) {
+ for (uint i = 0; i < 24; ++i) {
if ((segments[i].b0 & 0xf0) == tmp &&
(segments[i].b0 & 0x0f) == _destination) {
_destination = segments[i].b1 & 0x0f;
diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp
index dbb81406cd..53f04d482b 100644
--- a/engines/dreamweb/people.cpp
+++ b/engines/dreamweb/people.cpp
@@ -194,7 +194,7 @@ void DreamWebEngine::madman(ReelRoutine &routine) {
if (newReelPointer == 66) {
++_vars._combatCount;
- if (_lastHardKey == 1) // ESC pressed, skip the mad man's speech
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) // ESC pressed, skip the mad man's speech
_vars._combatCount = _speechCount = (hasSpeech() ? 65 : 63);
madmanText();
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index 64b9849980..bc75b97e71 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -49,7 +49,9 @@ uint8 DreamWebEngine::getNextWord(const GraphicsFile &charSet, const uint8 *stri
return 0;
}
firstChar = modifyChar(firstChar);
- if (firstChar != 255) {
+ // WORKAROUND: Also filter out invalid characters here (refer to the
+ // workaround in printChar() below for more info).
+ if (firstChar >= 32 && firstChar != 255) {
uint8 secondChar = *string;
uint8 width = charSet._frames[firstChar - 32 + _charShift].width;
width = kernChars(firstChar, secondChar, width);
@@ -59,9 +61,13 @@ uint8 DreamWebEngine::getNextWord(const GraphicsFile &charSet, const uint8 *stri
}
void DreamWebEngine::printChar(const GraphicsFile &charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
- if (c == 255)
+ // WORKAROUND: Some texts contain leftover tab characters, which will cause
+ // OOB memory access when showing a character, as all the printable ones are
+ // from 32 onwards. We compensate for that here by ignoring all the invalid
+ // characters (0 - 31).
+ if (c < 32 || c == 255)
return;
-
+
uint8 dummyWidth, dummyHeight;
if (width == NULL)
width = &dummyWidth;
@@ -315,7 +321,7 @@ void DreamWebEngine::rollEndCreditsGameLost() {
waitForVSync();
multiDump(25, 20, 160, 160);
- if (_lastHardKey == 1)
+ if (_lastHardKey == Common::KEYCODE_ESCAPE)
return;
}
@@ -325,7 +331,7 @@ void DreamWebEngine::rollEndCreditsGameLost() {
c = *string++;
} while (c != ':' && c != 0);
- if (_lastHardKey == 1)
+ if (_lastHardKey == Common::KEYCODE_ESCAPE)
return;
}
diff --git a/engines/dreamweb/rain.cpp b/engines/dreamweb/rain.cpp
index 8e42e0c161..b636b7def7 100644
--- a/engines/dreamweb/rain.cpp
+++ b/engines/dreamweb/rain.cpp
@@ -42,12 +42,12 @@ void DreamWebEngine::showRain() {
uint16 offset = (rain.w3 - rain.b5) & 511;
rain.w3 = offset;
const uint8 *src = frameData + offset;
- uint8 *dst = workspace() + y * 320 + x;
+ uint8 *dst = workspace() + y * kScreenwidth + x;
for (uint16 j = 0; j < size; ++j) {
uint8 v = src[j];
if (v != 0)
*dst = v;
- dst += 320-1; // advance diagonally
+ dst += kScreenwidth-1; // advance diagonally
}
}
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index ea9cdc0249..8a0791d19b 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -156,8 +156,16 @@ void DreamWebEngine::doLoad(int savegameId) {
} else {
if (savegameId == -1) {
- // Open dialog to get savegameId
+ // Wait till both mouse buttons are up. We should wait till the user
+ // releases the mouse button, otherwise the follow-up mouseup event
+ // will trigger a load of the save slot under the mouse cursor. Fixes
+ // bug #3582582.
+ while (_oldMouseState > 0) {
+ readMouse();
+ g_system->delayMillis(10);
+ }
+ // Open dialog to get savegameId
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
savegameId = dialog->runModalWithCurrentTarget();
delete dialog;
@@ -241,6 +249,15 @@ void DreamWebEngine::saveGame() {
}
return;
} else {
+ // Wait till both mouse buttons are up. We should wait till the user
+ // releases the mouse button, otherwise the follow-up mouseup event
+ // will trigger a save into the save slot under the mouse cursor. Fixes
+ // bug #3582582.
+ while (_oldMouseState > 0) {
+ readMouse();
+ g_system->delayMillis(10);
+ }
+
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
int savegameId = dialog->runModalWithCurrentTarget();
Common::String game_description = dialog->getResultString();
@@ -557,6 +574,14 @@ void DreamWebEngine::savePosition(unsigned int slot, const char *descbuf) {
delete outSaveFile;
}
+
+// Utility struct for a savegame sanity check in loadPosition
+struct FrameExtent {
+ uint16 start;
+ uint16 length;
+ bool operator<(const struct FrameExtent& other) const { return start<other.start; }
+};
+
void DreamWebEngine::loadPosition(unsigned int slot) {
_timeCount = 0;
clearChanges();
@@ -636,6 +661,42 @@ void DreamWebEngine::loadPosition(unsigned int slot) {
}
delete inSaveFile;
+
+
+ // Do a sanity check on exFrames data to detect exFrames corruption
+ // caused by a (now fixed) bug in emergencyPurge. See bug #3591088.
+ // Gather the location of frame data of all used ex object frames.
+ Common::List<FrameExtent> flist;
+ for (unsigned int i = 0; i < kNumexobjects; ++i) {
+ if (_exData[i].mapad[0] != 0xff) {
+ FrameExtent fe;
+ Frame *frame = &_exFrames._frames[3*i+0];
+ fe.start = frame->ptr();
+ fe.length = frame->width * frame->height;
+ flist.push_back(fe);
+
+ frame = &_exFrames._frames[3*i+1];
+ fe.start = frame->ptr();
+ fe.length = frame->width * frame->height;
+ flist.push_back(fe);
+ }
+ }
+ // ...and check if the frames overlap.
+ Common::sort(flist.begin(), flist.end(), Common::Less<FrameExtent>());
+ Common::List<FrameExtent>::const_iterator iter;
+ uint16 curEnd = 0;
+ for (iter = flist.begin(); iter != flist.end(); ++iter) {
+ if (iter->start < curEnd)
+ error("exFrames data corruption in savegame");
+ curEnd = iter->start + iter->length;
+ }
+ if (curEnd > _vars._exFramePos) {
+ if (curEnd > kExframeslen)
+ error("exFrames data corruption in savegame");
+ warning("Fixing up exFramePos");
+ _vars._exFramePos = curEnd;
+ }
+ // (end of sanity check)
}
// Count number of save files, and load their descriptions into _saveNames
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 01570c907a..1fa2e7d6a4 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -26,7 +26,7 @@
namespace DreamWeb {
void DreamWebEngine::printSprites() {
- for (size_t priority = 0; priority < 7; ++priority) {
+ for (uint priority = 0; priority < 7; ++priority) {
Common::List<Sprite>::const_iterator i;
for (i = _spriteTable.begin(); i != _spriteTable.end(); ++i) {
const Sprite &sprite = *i;
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index f235f7c2fd..057a0c847a 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -26,10 +26,6 @@
namespace DreamWeb {
-// Keyboard buffer. _bufferIn and _bufferOut are indexes
-// into this, making it a ring buffer
-uint8 g_keyBuffer[16];
-
const Room g_roomData[] = {
// location 0
{ "DREAMWEB.R00", // Ryan's apartment
@@ -723,7 +719,6 @@ void DreamWebEngine::dreamweb() {
showGun();
fadeScreenDown();
hangOn(100);
-
}
}
@@ -965,7 +960,6 @@ void DreamWebEngine::useTimedText() {
}
void DreamWebEngine::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) {
-
if (hasSpeech() && voiceIndex != 0) {
_speechLoaded = _sound->loadSpeech('T', voiceIndex, 'T', textIndex);
if (_speechLoaded)
@@ -1056,7 +1050,7 @@ void DreamWebEngine::lockMon() {
// key because calling readkey() drains characters from the input
// buffer, we we want the user to be able to type ahead while the text
// is being printed.
- if (_lastHardKey == 57) {
+ if (_lastHardKey == Common::KEYCODE_SPACE) {
// Clear the keyboard buffer. Otherwise the space that caused
// the pause will be read immediately unpause the game.
do {
@@ -1072,7 +1066,7 @@ void DreamWebEngine::lockMon() {
}
// Forget the last "hard" key, otherwise the space that caused
// the unpausing will immediately re-pause the game.
- _lastHardKey = 0;
+ _lastHardKey = Common::KEYCODE_INVALID;
lockLightOff();
}
}
@@ -1148,7 +1142,7 @@ void DreamWebEngine::plotReel(uint16 &reelPointer) {
reel += 8;
}
- for (size_t i = 0; i < 8; ++i) {
+ for (uint i = 0; i < 8; ++i) {
if (reel->frame() != 0xffff)
showReelFrame(reel);
++reel;
@@ -1247,7 +1241,7 @@ const uint8 *DreamWebEngine::findObName(uint8 type, uint8 index) {
void DreamWebEngine::copyName(uint8 type, uint8 index, uint8 *dst) {
const uint8 *src = findObName(type, index);
- size_t i;
+ uint i;
for (i = 0; i < 28; ++i) {
char c = src[i];
if (c == ':')
@@ -1265,6 +1259,10 @@ void DreamWebEngine::commandWithOb(uint8 command, uint8 type, uint8 index) {
uint8 textLen = _textLen;
const uint8 *string = (const uint8 *)_commandText.getString(command);
+ // Fix spelling in command 3 FR: "Aller ver" => "Aller vers"
+ const char *command3Fr = "Aller vers";
+ if (command == 3 && getLanguage() == Common::FR_FRA)
+ string = (const uint8 *)command3Fr;
printDirect(string, _textAddressX, _textAddressY, textLen, (bool)(textLen & 1));
copyName(type, index, commandLine);
@@ -1377,7 +1375,7 @@ void DreamWebEngine::doChange(uint8 index, uint8 value, uint8 type) {
}
void DreamWebEngine::deleteTaken() {
- for (size_t i = 0; i < kNumexobjects; ++i) {
+ for (uint i = 0; i < kNumexobjects; ++i) {
uint8 location = _exData[i].initialLocation;
if (location == _realLocation) {
uint8 index = _exData[i].index;
@@ -1388,7 +1386,7 @@ void DreamWebEngine::deleteTaken() {
uint8 DreamWebEngine::getExPos() {
DynObject *objects = _exData;
- for (size_t i = 0; i < kNumexobjects; ++i) {
+ for (uint i = 0; i < kNumexobjects; ++i) {
if (objects[i].mapad[0] == 0xff)
return i;
}
@@ -1543,7 +1541,7 @@ void DreamWebEngine::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWid
bool DreamWebEngine::objectMatches(void *object, const char *id) {
const char *objId = (const char *)object + 12; // whether it is a DynObject or a SetObject
- for (size_t i = 0; i < 4; ++i) {
+ for (uint i = 0; i < 4; ++i) {
if (id[i] != objId[i] + 'A')
return false;
}
@@ -2138,7 +2136,6 @@ void DreamWebEngine::workToScreenM() {
}
void DreamWebEngine::atmospheres() {
-
const Atmosphere *a = &g_atmosphereList[0];
for (; a->_location != 255; ++a) {
@@ -2208,8 +2205,8 @@ void DreamWebEngine::readKey() {
return;
}
- bufOut = (bufOut + 1) & 15; // The buffer has size 16
- _currentKey = g_keyBuffer[bufOut];
+ bufOut = (bufOut + 1) % ARRAYSIZE(_keyBuffer);
+ _currentKey = _keyBuffer[bufOut];
_bufferOut = bufOut;
}
@@ -2220,36 +2217,6 @@ void DreamWebEngine::newGame() {
_getBack = 3;
}
-void DreamWebEngine::pickupOb(uint8 command, uint8 pos) {
- _lastInvPos = pos;
- _objectType = kFreeObjectType;
- _itemFrame = command;
- _command = command;
- //uint8 dummy;
- //getAnyAd(&dummy, &dummy); // was in the original source, seems useless here
- transferToEx(command);
-}
-
-void DreamWebEngine::initialInv() {
- if (_realLocation != 24)
- return;
-
- pickupOb(11, 5);
- pickupOb(12, 6);
- pickupOb(13, 7);
- pickupOb(14, 8);
- pickupOb(18, 0);
- pickupOb(19, 1);
- pickupOb(20, 9);
- pickupOb(16, 2);
- _vars._watchMode = 1;
- _vars._reelToHold = 0;
- _vars._endOfHoldReel = 6;
- _vars._watchSpeed = 1;
- _vars._speedCount = 1;
- switchRyanOff();
-}
-
void DreamWebEngine::walkIntoRoom() {
if (_vars._location == 14 && _mapX == 22) {
_destination = 1;
@@ -2314,13 +2281,6 @@ void DreamWebEngine::makeMainScreen() {
_manIsOffScreen = 0;
}
-void DreamWebEngine::openInv() {
- _invOpen = 1;
- printMessage(80, 58 - 10, 61, 240, (240 & 1));
- fillRyan();
- _commandType = 255;
-}
-
void DreamWebEngine::obsThatDoThings() {
if (!compare(_command, _objectType, "MEMB"))
return; // notlouiscard
@@ -2420,10 +2380,6 @@ void DreamWebEngine::errorMessage3() {
delPointer();
}
-void DreamWebEngine::reExFromOpen() {
-
-}
-
void DreamWebEngine::putBackObStuff() {
createPanel();
showPanel();
@@ -2444,26 +2400,6 @@ bool DreamWebEngine::isSetObOnMap(uint8 index) {
return (getSetAd(index)->mapad[0] == 0);
}
-void DreamWebEngine::examineInventory() {
- commandOnlyCond(32, 249);
-
- if (!(_mouseButton & 1))
- return;
-
- createPanel();
- showPanel();
- showMan();
- showExit();
- examIcon();
- _pickUp = 0;
- _invOpen = 2;
- openInv();
- workToScreenM();
-}
-
-void DreamWebEngine::middlePanel() {
-}
-
void DreamWebEngine::underTextLine() {
if (_foreignRelease)
multiGet(_textUnder, _textAddressX, _textAddressY - 3, kUnderTextSizeX_f, kUnderTextSizeY_f);
@@ -2575,7 +2511,6 @@ void DreamWebEngine::madmanRun() {
_vars._lastWeapon = 8;
}
-
void DreamWebEngine::decide() {
setMode();
loadPalFromIFF();
@@ -2659,39 +2594,12 @@ void DreamWebEngine::showGun() {
getRidOfTempText();
}
-void DreamWebEngine::dropError() {
- _commandType = 255;
- delPointer();
- printMessage(76, 21, 56, 240, 240 & 1);
- workToScreenM();
- hangOnP(50);
- showPanel();
- showMan();
- examIcon();
- _commandType = 255;
- workToScreenM();
-}
-
-void DreamWebEngine::cantDrop() {
- _commandType = 255;
- delPointer();
- printMessage(76, 21, 24, 240, 240 & 1);
- workToScreenM();
- hangOnP(50);
- showPanel();
- showMan();
- examIcon();
- _commandType = 255;
- workToScreenM();
-}
-
void DreamWebEngine::getBack1() {
if (_pickUp != 0) {
blank();
return;
}
-
commandOnlyCond(26, 202);
if (_mouseButton == _oldButton)
@@ -3003,52 +2911,4 @@ void DreamWebEngine::edensFlatReminders() {
_vars._progressPoints++; // got card
}
-void DreamWebEngine::incRyanPage() {
- commandOnlyCond(31, 222);
-
- if (_mouseButton == _oldButton || !(_mouseButton & 1))
- return;
-
- _vars._ryanPage = (_mouseX - (kInventx + 167)) / 18;
-
- delPointer();
- fillRyan();
- readMouse();
- showPointer();
- workToScreen();
- delPointer();
-
-}
-
-void DreamWebEngine::emergencyPurge() {
- while (true) {
- if (_vars._exFramePos + 4000 < kExframeslen) {
- // Not near frame end
- if (_vars._exTextPos + 400 < kExtextlen)
- return; // notneartextend
- }
-
- purgeAnItem();
- }
-}
-
-void DreamWebEngine::purgeAnItem() {
- const DynObject *extraObjects = _exData;
-
- for (size_t i = 0; i < kNumexobjects; ++i) {
- if (extraObjects[i].mapad[0] && extraObjects[i].objId[0] == 255 &&
- extraObjects[i].initialLocation != _realLocation) {
- deleteExObject(i);
- return;
- }
- }
-
- for (size_t i = 0; i < kNumexobjects; ++i) {
- if (extraObjects[i].mapad[0] && extraObjects[i].objId[0] == 255) {
- deleteExObject(i);
- return;
- }
- }
-}
-
} // End of namespace DreamWeb
diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp
index f005279ba0..4e4faa75a0 100644
--- a/engines/dreamweb/titles.cpp
+++ b/engines/dreamweb/titles.cpp
@@ -105,34 +105,34 @@ void DreamWebEngine::bibleQuote() {
fadeScreenUps();
hangOne(80);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "biblequotearly"
}
hangOne(560);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "biblequotearly"
}
fadeScreenDowns();
hangOne(200);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "biblequotearly"
}
_sound->cancelCh0();
- _lastHardKey = 0;
+ _lastHardKey = Common::KEYCODE_INVALID;
}
void DreamWebEngine::hangOne(uint16 delay) {
do {
waitForVSync();
- if (_lastHardKey == 1)
+ if (_lastHardKey == Common::KEYCODE_ESCAPE)
return; // "hangonearly"
} while (--delay);
}
@@ -150,8 +150,8 @@ void DreamWebEngine::intro() {
fadeScreenUps();
runIntroSeq();
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "introearly"
}
@@ -160,8 +160,8 @@ void DreamWebEngine::intro() {
loadIntroRoom();
runIntroSeq();
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "introearly"
}
@@ -170,8 +170,8 @@ void DreamWebEngine::intro() {
loadIntroRoom();
runIntroSeq();
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "introearly"
}
@@ -181,15 +181,15 @@ void DreamWebEngine::intro() {
loadIntroRoom();
runIntroSeq();
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "introearly"
}
getRidOfTempText();
clearBeforeLoad();
- _lastHardKey = 0;
+ _lastHardKey = Common::KEYCODE_INVALID;
}
void DreamWebEngine::runIntroSeq() {
@@ -198,13 +198,13 @@ void DreamWebEngine::runIntroSeq() {
do {
waitForVSync();
- if (_lastHardKey == 1)
+ if (_lastHardKey == Common::KEYCODE_ESCAPE)
break;
spriteUpdate();
waitForVSync();
- if (_lastHardKey == 1)
+ if (_lastHardKey == Common::KEYCODE_ESCAPE)
break;
delEverything();
@@ -214,20 +214,20 @@ void DreamWebEngine::runIntroSeq() {
useTimedText();
waitForVSync();
- if (_lastHardKey == 1)
+ if (_lastHardKey == Common::KEYCODE_ESCAPE)
break;
dumpMap();
dumpTimedText();
waitForVSync();
- if (_lastHardKey == 1)
+ if (_lastHardKey == Common::KEYCODE_ESCAPE)
break;
} while (_getBack != 1);
- if (_lastHardKey == 1) {
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
getRidOfTempText();
clearBeforeLoad();
}
@@ -266,7 +266,7 @@ void DreamWebEngine::loadIntroRoom() {
_mapOffsetY = 16;
clearSprites();
_vars._throughDoor = 0;
- _currentKey = '0';
+ _currentKey = 0;
_mainMode = 0;
clearWork();
_vars._newObs = 1;
@@ -293,24 +293,24 @@ void DreamWebEngine::realCredits() {
hangOne(2);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
allPalette();
hangOne(80);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
fadeScreenDowns();
hangOne(256);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
@@ -318,24 +318,24 @@ void DreamWebEngine::realCredits() {
_sound->playChannel0(12, 0);
hangOne(2);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
allPalette();
hangOne(80);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
fadeScreenDowns();
hangOne(256);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
@@ -343,24 +343,24 @@ void DreamWebEngine::realCredits() {
_sound->playChannel0(12, 0);
hangOne(2);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
allPalette();
hangOne(80);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
fadeScreenDowns();
hangOne(256);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
@@ -368,24 +368,24 @@ void DreamWebEngine::realCredits() {
_sound->playChannel0(12, 0);
hangOne(2);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
allPalette();
hangOne(80);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
fadeScreenDowns();
hangOne(256);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
@@ -393,24 +393,24 @@ void DreamWebEngine::realCredits() {
_sound->playChannel0(12, 0);
hangOne(2);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
allPalette();
hangOne(80);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
fadeScreenDowns();
hangOne(256);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
@@ -418,23 +418,23 @@ void DreamWebEngine::realCredits() {
fadeScreenUps();
hangOne(60);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
_sound->playChannel0(13, 0);
hangOne(350);
- if (_lastHardKey == 1) {
- _lastHardKey = 0;
+ if (_lastHardKey == Common::KEYCODE_ESCAPE) {
+ _lastHardKey = Common::KEYCODE_INVALID;
return; // "realcreditsearly"
}
fadeScreenDowns();
hangOne(256);
- _lastHardKey = 0;
+ _lastHardKey = Common::KEYCODE_INVALID;
}
} // End of namespace DreamWeb
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index 995eef04cd..476f847c40 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -131,7 +131,7 @@ void DreamWebEngine::useRoutine() {
uint8 dummy;
void *obj = getAnyAd(&dummy, &dummy);
- for (size_t i = 0; i < sizeof(kUseList)/sizeof(UseListEntry); ++i) {
+ for (uint i = 0; i < ARRAYSIZE(kUseList); ++i) {
const UseListEntry &entry = kUseList[i];
if (objectMatches(obj, entry.id)) {
(this->*entry.callback)();
diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp
index c8f05641b5..d1e2480f70 100644
--- a/engines/dreamweb/vgafades.cpp
+++ b/engines/dreamweb/vgafades.cpp
@@ -56,8 +56,8 @@ void DreamWebEngine::fadeDOS() {
//processEvents will be called from waitForVSync
uint8 *dst = _startPal;
getPalette(dst, 0, 64);
- for (int fade = 0; fade < 64; ++fade) {
- for (int c = 0; c < 768; ++c) { //original sources decrement 768 values -> 256 colors
+ for (uint fade = 0; fade < 64; ++fade) {
+ for (uint c = 0; c < 768; ++c) { //original sources decrement 768 values -> 256 colors
if (dst[c]) {
--dst[c];
}
@@ -88,7 +88,7 @@ void DreamWebEngine::fadeCalculation() {
uint8 *startPal = _startPal;
const uint8 *endPal = _endPal;
- for (size_t i = 0; i < 256 * 3; ++i) {
+ for (uint i = 0; i < 256 * 3; ++i) {
uint8 s = startPal[i];
uint8 e = endPal[i];
if (s == e)
@@ -212,7 +212,7 @@ void DreamWebEngine::fadeScreenDownHalf() {
const uint8 *startPal = _startPal;
uint8 *endPal = _endPal;
- for (int i = 0; i < 256 * 3; ++i) {
+ for (uint i = 0; i < 256 * 3; ++i) {
*endPal >>= 1;
endPal++;
}
@@ -239,7 +239,7 @@ void DreamWebEngine::greyscaleSum() {
byte *src = _mainPal;
byte *dst = _endPal;
- for (int i = 0; i < 256; ++i) {
+ for (uint i = 0; i < 256; ++i) {
const unsigned int r = 20 * *src++;
const unsigned int g = 59 * *src++;
const unsigned int b = 11 * *src++;
diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
index d2390fb1fd..d8984d312b 100644
--- a/engines/dreamweb/vgagrafx.cpp
+++ b/engines/dreamweb/vgagrafx.cpp
@@ -31,14 +31,16 @@ const uint16 kZoomx = 8;
const uint16 kZoomy = 132;
void DreamWebEngine::multiGet(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) {
- assert(x < 320);
- assert(y < 200);
+ assert(x < kScreenwidth);
+ assert(y < kScreenheight);
+
const uint8 *src = workspace() + x + y * kScreenwidth;
- if (y + h > 200)
- h = 200 - y;
- if (x + w > 320)
- w = 320 - x;
- //debug(1, "multiGet %u,%u %ux%u -> segment: %04x->%04x", x, y, w, h, (uint16)ds, (uint16)es);
+
+ if (y + h > kScreenheight)
+ h = kScreenheight - y;
+ if (x + w > kScreenwidth)
+ w = kScreenwidth - x;
+
for (unsigned l = 0; l < h; ++l) {
const uint8 *src_p = src + kScreenwidth * l;
uint8 *dst_p = dst + w * l;
@@ -47,14 +49,16 @@ void DreamWebEngine::multiGet(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h)
}
void DreamWebEngine::multiPut(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) {
- assert(x < 320);
- assert(y < 200);
+ assert(x < kScreenwidth);
+ assert(y < kScreenheight);
+
uint8 *dst = workspace() + x + y * kScreenwidth;
- if (y + h > 200)
- h = 200 - y;
- if (x + w > 320)
- w = 320 - x;
- //debug(1, "multiPut %ux%u -> segment: %04x->%04x", w, h, (uint16)ds, (uint16)es);
+
+ if (y + h > kScreenheight)
+ h = kScreenheight - y;
+ if (x + w > kScreenwidth)
+ w = kScreenwidth - x;
+
for (unsigned l = 0; l < h; ++l) {
const uint8 *src_p = src + w * l;
uint8 *dst_p = dst + kScreenwidth * l;
@@ -64,12 +68,11 @@ void DreamWebEngine::multiPut(const uint8 *src, uint16 x, uint16 y, uint8 w, uin
void DreamWebEngine::multiDump(uint16 x, uint16 y, uint8 width, uint8 height) {
unsigned offset = x + y * kScreenwidth;
- //debug(1, "multiDump %ux%u(segment: %04x) -> %d,%d(address: %d)", w, h, (uint16)ds, x, y, offset);
blit(workspace() + offset, kScreenwidth, x, y, width, height);
}
void DreamWebEngine::workToScreen() {
- blit(workspace(), 320, 0, 0, 320, 200);
+ blit(workspace(), kScreenwidth, 0, 0, kScreenwidth, kScreenheight);
}
void DreamWebEngine::frameOutNm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
@@ -147,7 +150,7 @@ void DreamWebEngine::doShake() {
void DreamWebEngine::setMode() {
waitForVSync();
- initGraphics(320, 200, false);
+ initGraphics(kScreenwidth, kScreenheight, false);
}
void DreamWebEngine::showPCX(const Common::String &suffix) {
@@ -185,7 +188,7 @@ void DreamWebEngine::showPCX(const Common::String &suffix) {
void DreamWebEngine::frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y) {
// NB : These resilience checks were not in the original engine, but did they result in undefined behaviour
// or was something broken during porting to C++?
- assert(pitch == 320);
+ assert(pitch == kScreenwidth);
if (x < 0) {
assert(width >= -x);
@@ -199,15 +202,16 @@ void DreamWebEngine::frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint1
src += (-y) * width;
y = 0;
}
- if (x >= 320)
+
+ if ((uint16)x >= kScreenwidth)
return;
- if (y >= 200)
+ if ((uint16)y >= kScreenheight)
return;
- if (x + width > 320) {
- width = 320 - x;
+ if ((uint16)x + width > kScreenwidth) {
+ width = kScreenwidth - x;
}
- if (y + height > 200) {
- height = 200 - y;
+ if ((uint16)y + height > kScreenheight) {
+ height = kScreenheight - y;
}
uint16 stride = pitch - width;
@@ -246,20 +250,20 @@ void DreamWebEngine::showFrameInternal(const uint8 *pSrc, uint16 x, uint16 y, ui
//addToPrintList(x - _mapAdX, y - _mapAdY); // NB: Commented in the original asm
}
if (effectsFlag & 4) { // flippedX
- frameOutFx(workspace(), pSrc, 320, width, height, x, y);
+ frameOutFx(workspace(), pSrc, kScreenwidth, width, height, x, y);
return;
}
if (effectsFlag & 2) { // noMask
- frameOutNm(workspace(), pSrc, 320, width, height, x, y);
+ frameOutNm(workspace(), pSrc, kScreenwidth, width, height, x, y);
return;
}
if (effectsFlag & 32) {
- frameOutBh(workspace(), pSrc, 320, width, height, x, y);
+ frameOutBh(workspace(), pSrc, kScreenwidth, width, height, x, y);
return;
}
}
// "noEffects"
- frameOutV(workspace(), pSrc, 320, width, height, x, y);
+ frameOutV(workspace(), pSrc, kScreenwidth, width, height, x, y);
}
void DreamWebEngine::showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) {
@@ -285,7 +289,7 @@ void DreamWebEngine::showFrame(const GraphicsFile &frameData, uint16 x, uint16 y
}
void DreamWebEngine::clearWork() {
- memset(workspace(), 0, 320*200);
+ memset(workspace(), 0, kScreenwidth*kScreenheight);
}
void DreamWebEngine::dumpZoom() {
@@ -326,20 +330,20 @@ void DreamWebEngine::zoom() {
putUnderZoom();
return;
}
- uint16 srcOffset = (_oldPointerY - 9) * 320 + (_oldPointerX - 11);
- uint16 dstOffset = (kZoomy + 4) * 320 + (kZoomx + 5);
+ uint16 srcOffset = (_oldPointerY - 9) * kScreenwidth + (_oldPointerX - 11);
+ uint16 dstOffset = (kZoomy + 4) * kScreenwidth + (kZoomx + 5);
const uint8 *src = workspace() + srcOffset;
uint8 *dst = workspace() + dstOffset;
- for (size_t i = 0; i < 20; ++i) {
- for (size_t j = 0; j < 23; ++j) {
+ for (uint i = 0; i < 20; ++i) {
+ for (uint j = 0; j < 23; ++j) {
uint8 v = src[j];
dst[2*j+0] = v;
dst[2*j+1] = v;
- dst[2*j+320] = v;
- dst[2*j+321] = v;
+ dst[2*j+kScreenwidth] = v;
+ dst[2*j+kScreenwidth+1] = v;
}
- src += 320;
- dst += 320*2;
+ src += kScreenwidth;
+ dst += kScreenwidth*2;
}
crosshair();
_didZoom = 1;
@@ -375,7 +379,7 @@ void DreamWebEngine::loadPalFromIFF() {
const uint8 *src = buf + 0x30;
uint8 *dst = _mainPal;
- for (size_t i = 0; i < 256*3; ++i) {
+ for (uint i = 0; i < 256*3; ++i) {
uint8 c = src[i] / 4;
if (_brightPalette) {
if (c) {