aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/bitmap.cpp90
-rw-r--r--engines/mohawk/bitmap.h4
-rw-r--r--engines/mohawk/console.cpp86
-rw-r--r--engines/mohawk/console.h8
-rw-r--r--engines/mohawk/detection.cpp82
-rw-r--r--engines/mohawk/dialogs.cpp12
-rw-r--r--engines/mohawk/dialogs.h12
-rw-r--r--engines/mohawk/graphics.cpp130
-rw-r--r--engines/mohawk/graphics.h20
-rw-r--r--engines/mohawk/livingbooks.cpp8
-rw-r--r--engines/mohawk/livingbooks.h4
-rw-r--r--engines/mohawk/mohawk.cpp6
-rw-r--r--engines/mohawk/mohawk.h2
-rw-r--r--engines/mohawk/myst.cpp46
-rw-r--r--engines/mohawk/myst.h4
-rw-r--r--engines/mohawk/myst_jpeg.cpp10
-rw-r--r--engines/mohawk/myst_jpeg.h4
-rw-r--r--engines/mohawk/myst_pict.cpp36
-rw-r--r--engines/mohawk/myst_pict.h2
-rw-r--r--engines/mohawk/myst_scripts.cpp114
-rw-r--r--engines/mohawk/myst_scripts.h8
-rw-r--r--engines/mohawk/myst_vars.cpp24
-rw-r--r--engines/mohawk/resource.cpp60
-rw-r--r--engines/mohawk/resource.h18
-rw-r--r--engines/mohawk/riven.cpp56
-rw-r--r--engines/mohawk/riven.h18
-rw-r--r--engines/mohawk/riven_cursors.h4
-rw-r--r--engines/mohawk/riven_external.cpp166
-rw-r--r--engines/mohawk/riven_external.h36
-rw-r--r--engines/mohawk/riven_saveload.cpp56
-rw-r--r--engines/mohawk/riven_saveload.h2
-rw-r--r--engines/mohawk/riven_scripts.cpp50
-rw-r--r--engines/mohawk/riven_scripts.h14
-rw-r--r--engines/mohawk/riven_vars.cpp22
-rw-r--r--engines/mohawk/sound.cpp76
-rw-r--r--engines/mohawk/sound.h6
-rw-r--r--engines/mohawk/video/cinepak.cpp6
-rw-r--r--engines/mohawk/video/cinepak.h4
-rw-r--r--engines/mohawk/video/qdm2.cpp22
-rw-r--r--engines/mohawk/video/qdm2.h6
-rw-r--r--engines/mohawk/video/qt_player.cpp152
-rw-r--r--engines/mohawk/video/qt_player.h14
-rw-r--r--engines/mohawk/video/qtrle.cpp12
-rw-r--r--engines/mohawk/video/qtrle.h6
-rw-r--r--engines/mohawk/video/rpza.cpp4
-rw-r--r--engines/mohawk/video/rpza.h2
-rw-r--r--engines/mohawk/video/smc.cpp4
-rw-r--r--engines/mohawk/video/smc.h2
-rw-r--r--engines/mohawk/video/video.cpp48
49 files changed, 789 insertions, 789 deletions
diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp
index cdf7c73d4c..b622b3efbf 100644
--- a/engines/mohawk/bitmap.cpp
+++ b/engines/mohawk/bitmap.cpp
@@ -34,17 +34,17 @@ namespace Mohawk {
#define PACK_COMPRESSION (_header.format & kPackMASK)
#define DRAW_COMPRESSION (_header.format & kDrawMASK)
-
+
MohawkBitmap::MohawkBitmap() {
}
-
+
MohawkBitmap::~MohawkBitmap() {
}
ImageData *MohawkBitmap::decodeImage(Common::SeekableReadStream *stream) {
_data = stream;
_header.colorTable.palette = NULL;
-
+
// NOTE: Only the bottom 12 bits of width/height/bytesPerRow are
// considered valid and bytesPerRow has to be an even number.
_header.width = _data->readUint16BE() & 0x3FFF;
@@ -56,7 +56,7 @@ ImageData *MohawkBitmap::decodeImage(Common::SeekableReadStream *stream) {
if (getBitsPerPixel() != 8)
error ("Unhandled bpp %d", getBitsPerPixel());
-
+
// Read in the palette if it's here.
if (_header.format & kBitmapHasCLUT || (PACK_COMPRESSION == kPackRiven && getBitsPerPixel() == 8)) {
_header.colorTable.tableSize = _data->readUint16BE();
@@ -74,7 +74,7 @@ ImageData *MohawkBitmap::decodeImage(Common::SeekableReadStream *stream) {
_surface = new Graphics::Surface();
_surface->create(_header.width, _header.height, getBitsPerPixel() >> 3);
-
+
unpackImage();
drawImage();
delete _data;
@@ -97,7 +97,7 @@ byte MohawkBitmap::getBitsPerPixel() {
default:
error ("Unknown bits per pixel");
}
-
+
return 0;
}
@@ -113,12 +113,12 @@ static const CompressionInfo packTable[] = {
{ kPackLZ1, "LZ1", &MohawkBitmap::unpackLZ1 },
{ kPackRiven, "Riven", &MohawkBitmap::unpackRiven }
};
-
+
const char *MohawkBitmap::getPackName() {
for (uint32 i = 0; i < ARRAYSIZE(packTable); i++)
if (PACK_COMPRESSION == packTable[i].flag)
return packTable[i].name;
-
+
return "Unknown";
}
@@ -128,7 +128,7 @@ void MohawkBitmap::unpackImage() {
(this->*packTable[i].func)();
return;
}
-
+
warning("Unknown Pack Compression");
}
@@ -142,7 +142,7 @@ const char *MohawkBitmap::getDrawName() {
for (uint32 i = 0; i < ARRAYSIZE(drawTable); i++)
if (DRAW_COMPRESSION == drawTable[i].flag)
return drawTable[i].name;
-
+
return "Unknown";
}
@@ -152,7 +152,7 @@ void MohawkBitmap::drawImage() {
(this->*drawTable[i].func)();
return;
}
-
+
warning("Unknown Draw Compression");
}
@@ -254,11 +254,11 @@ void MohawkBitmap::unpackLZ() {
uint32 uncompressedSize = _data->readUint32BE();
/* uint32 compressedSize = */ _data->readUint32BE();
uint16 dictSize = _data->readUint16BE();
-
+
// We only support the buffer size of 0x400
if (dictSize != CBUFFERSIZE)
error("Unsupported dictionary size of %04x", dictSize);
-
+
// Now go and decompress the data
Common::SeekableReadStream *decompressedData = decompressLZ(_data, uncompressedSize);
delete _data;
@@ -278,8 +278,8 @@ void MohawkBitmap::unpackLZ1() {
//////////////////////////////////////////
void MohawkBitmap::unpackRiven() {
- _data->readUint32BE(); // Unknown, the number is close to bytesPerRow * height. Could be bufSize.
-
+ _data->readUint32BE(); // Unknown, the number is close to bytesPerRow * height. Could be bufSize.
+
byte *uncompressedData = (byte *)malloc(_header.bytesPerRow * _header.height);
byte *dst = uncompressedData;
@@ -468,9 +468,9 @@ void MohawkBitmap::handleRivenSubcommandStream(byte count, byte *&dst) {
byte pattern = _data->readByte();
B_LASTDUPLET_MINUS(pattern >> 4);
B_LASTDUPLET_MINUS(getLastFourBits(pattern));
-
+
// Repeat operations
- // Repeat n duplets from relative position -m (given in pixels, not duplets).
+ // Repeat n duplets from relative position -m (given in pixels, not duplets).
// If r is 0, another byte follows and the last pixel is set to that value
} else if (cmd >= 0xa4 && cmd <= 0xa7) {
B_NDUPLETS(3);
@@ -541,24 +541,24 @@ void MohawkBitmap::drawRaw() {
void MohawkBitmap::drawRLE8() {
// A very simple RLE8 scheme is used as a secondary compression on
// most images in non-Riven tBMP's.
-
+
for (uint16 i = 0; i < _header.height; i++) {
uint16 rowByteCount = _data->readUint16BE();
int32 startPos = _data->pos();
byte *dst = (byte *)_surface->pixels + i * _header.width;
int16 remaining = _header.width;
-
+
// HACK: It seems only the bottom 9 bits are valid for images
// TODO: Verify if this is still needed after the buffer clearing fix.
rowByteCount &= 0x1ff;
-
+
while (remaining > 0) {
byte code = _data->readByte();
uint16 runLen = (code & 0x7F) + 1;
-
+
if (runLen > remaining)
runLen = remaining;
-
+
if (code & 0x80) {
byte val = _data->readByte();
for (uint16 j = 0; j < runLen; j++)
@@ -567,10 +567,10 @@ void MohawkBitmap::drawRLE8() {
for (uint16 j = 0; j < runLen; j++)
*dst++ = _data->readByte();
}
-
+
remaining -= runLen;
}
-
+
_data->seek(startPos + rowByteCount);
}
}
@@ -591,7 +591,7 @@ ImageData* MystBitmap::decodeImage(Common::SeekableReadStream* stream) {
uint32 uncompressedSize = stream->readUint32LE();
Common::SeekableReadStream* bmpStream = decompressLZ(stream, uncompressedSize);
delete stream;
-
+
_header.type = bmpStream->readUint16BE();
if (_header.type != 'BM')
@@ -602,7 +602,7 @@ ImageData* MystBitmap::decodeImage(Common::SeekableReadStream* stream) {
_header.res1 = bmpStream->readUint16LE();
_header.res2 = bmpStream->readUint16LE();
_header.imageOffset = bmpStream->readUint32LE();
-
+
_info.size = bmpStream->readUint32LE();
if (_info.size != 40)
@@ -618,34 +618,34 @@ ImageData* MystBitmap::decodeImage(Common::SeekableReadStream* stream) {
_info.pixelsPerMeterY = bmpStream->readUint32LE();
_info.colorsUsed = bmpStream->readUint32LE();
_info.colorsImportant = bmpStream->readUint32LE();
-
+
if (_info.compression != 0)
error("Unhandled BMP compression %d", _info.compression);
-
+
if (_info.colorsUsed == 0)
_info.colorsUsed = 256;
-
+
if (_info.bitsPerPixel != 8 && _info.bitsPerPixel != 24)
error("%dbpp Bitmaps not supported", _info.bitsPerPixel);
-
+
byte *palData = NULL;
-
+
if (_info.bitsPerPixel == 8) {
palData = (byte *)malloc(256 * 4);
- for (uint16 i = 0; i < _info.colorsUsed; i++) {
+ for (uint16 i = 0; i < _info.colorsUsed; i++) {
palData[i * 4 + 2] = bmpStream->readByte();
palData[i * 4 + 1] = bmpStream->readByte();
- palData[i * 4] = bmpStream->readByte();
+ palData[i * 4] = bmpStream->readByte();
palData[i * 4 + 3] = bmpStream->readByte();
}
}
-
+
bmpStream->seek(_header.imageOffset);
-
+
Graphics::Surface *surface = new Graphics::Surface();
int srcPitch = _info.width * (_info.bitsPerPixel >> 3);
const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) : 0;
-
+
if (_info.bitsPerPixel == 8) {
surface->create(_info.width, _info.height, 1);
byte *dst = (byte *)surface->pixels;
@@ -657,30 +657,30 @@ ImageData* MystBitmap::decodeImage(Common::SeekableReadStream* stream) {
} else {
Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
surface->create(_info.width, _info.height, pixelFormat.bytesPerPixel);
-
+
byte *dst = (byte *)surface->pixels + (surface->h - 1) * surface->pitch;
-
+
for (uint32 i = 0; i < _info.height; i++) {
for (uint32 j = 0; j < _info.width; j++) {
byte b = bmpStream->readByte();
byte g = bmpStream->readByte();
byte r = bmpStream->readByte();
-
+
if (pixelFormat.bytesPerPixel == 2)
*((uint16 *)dst) = pixelFormat.RGBToColor(r, g, b);
- else
+ else
*((uint32 *)dst) = pixelFormat.RGBToColor(r, g, b);
-
+
dst += pixelFormat.bytesPerPixel;
}
-
+
bmpStream->skip(extraDataLength);
dst -= surface->pitch * 2;
}
}
-
+
delete bmpStream;
-
+
return new ImageData(surface, palData);
}
@@ -695,7 +695,7 @@ ImageData *OldMohawkBitmap::decodeImage(Common::SeekableReadStream *stream) {
_header.format = endianStream->readUint16();
debug(2, "Decoding Old Mohawk Bitmap (%dx%d, %04x Format)", _header.width, _header.height, _header.format);
-
+
warning("Unhandled old Mohawk Bitmap decoding");
delete stream;
diff --git a/engines/mohawk/bitmap.h b/engines/mohawk/bitmap.h
index 18c51bc478..f1fde92f33 100644
--- a/engines/mohawk/bitmap.h
+++ b/engines/mohawk/bitmap.h
@@ -91,7 +91,7 @@ public:
void drawRaw();
void drawRLE8();
void drawRLE();
-
+
protected:
BitmapHeader _header;
byte getBitsPerPixel();
@@ -122,7 +122,7 @@ public:
ImageData *decodeImage(Common::SeekableReadStream *stream);
-private:
+private:
struct BitmapHeader {
uint16 type;
uint32 size;
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp
index 5a7cc3b18c..80ba710a47 100644
--- a/engines/mohawk/console.cpp
+++ b/engines/mohawk/console.cpp
@@ -71,7 +71,7 @@ bool MystConsole::Cmd_ChangeCard(int argc, const char **argv) {
return false;
}
-
+
bool MystConsole::Cmd_CurCard(int argc, const char **argv) {
DebugPrintf("Current Card: %d\n", _vm->getCurCard());
return true;
@@ -82,12 +82,12 @@ bool MystConsole::Cmd_Var(int argc, const char **argv) {
DebugPrintf("Usage: var <var> (<value>)\n");
return true;
}
-
+
if (argc > 2)
_vm->_varStore->setVar((uint16)atoi(argv[1]), (uint32)atoi(argv[2]));
DebugPrintf("%d = %d\n", (uint16)atoi(argv[1]), _vm->_varStore->getVar((uint16)atoi(argv[1])));
-
+
return true;
}
@@ -135,10 +135,10 @@ bool MystConsole::Cmd_ChangeStack(int argc, const char **argv) {
DebugPrintf(" %s\n", mystStackNames[i]);
DebugPrintf("\n");
-
+
return true;
}
-
+
byte stackNum = 0;
for (byte i = 1; i <= ARRAYSIZE(mystStackNames); i++)
@@ -151,7 +151,7 @@ bool MystConsole::Cmd_ChangeStack(int argc, const char **argv) {
DebugPrintf("\'%s\' is not a stack name!\n", argv[1]);
return true;
}
-
+
// We need to stop any playing sound when we change the stack
// as the next card could continue playing it if it.
_vm->_sound->stopSound();
@@ -178,7 +178,7 @@ bool MystConsole::Cmd_DrawImage(int argc, const char **argv) {
rect = Common::Rect(0, 0, 544, 333);
else
rect = Common::Rect((uint16)atoi(argv[2]), (uint16)atoi(argv[3]), (uint16)atoi(argv[4]), (uint16)atoi(argv[5]));
-
+
_vm->_gfx->copyImageToScreen((uint16)atoi(argv[1]), rect);
return false;
}
@@ -230,7 +230,7 @@ bool MystConsole::Cmd_PlayMovie(int argc, const char **argv) {
DebugPrintf("NOTE: The movie will play *once* in the background.\n");
return true;
}
-
+
int8 stackNum = 0;
if (argc == 3 || argc > 4) {
@@ -312,26 +312,26 @@ bool RivenConsole::Cmd_ChangeCard(int argc, const char **argv) {
return false;
}
-
+
bool RivenConsole::Cmd_CurCard(int argc, const char **argv) {
DebugPrintf("Current Card: %d\n", _vm->getCurCard());
return true;
}
-
+
bool RivenConsole::Cmd_Var(int argc, const char **argv) {
if (argc == 1) {
DebugPrintf("Usage: var <var name> (<value>)\n");
return true;
}
-
+
uint32 *globalVar = _vm->matchVarToString(argv[1]);
-
+
if (!globalVar) {
DebugPrintf("Unknown variable \'%s\'\n", argv[1]);
return true;
}
-
+
if (argc > 2)
*globalVar = (uint32)atoi(argv[2]);
@@ -350,9 +350,9 @@ bool RivenConsole::Cmd_PlaySound(int argc, const char **argv) {
_vm->_sound->stopSound();
_vm->_sound->stopAllSLST();
-
+
bool mainSoundFile = (argc < 3) || (scumm_stricmp(argv[2], "false") != 0);
-
+
_vm->_sound->playSound((uint16)atoi(argv[1]), mainSoundFile);
return false;
@@ -367,12 +367,12 @@ bool RivenConsole::Cmd_PlaySLST(int argc, const char **argv) {
_vm->_sound->stopSound();
_vm->_sound->stopAllSLST();
-
+
uint16 card = _vm->getCurCard();
-
+
if (argc == 3)
card = (uint16)atoi(argv[2]);
-
+
_vm->_sound->playSLST((uint16)atoi(argv[1]), card);
return false;
@@ -404,10 +404,10 @@ bool RivenConsole::Cmd_ChangeStack(int argc, const char **argv) {
DebugPrintf(" %s\n", _vm->getStackName(i).c_str());
DebugPrintf("\n");
-
+
return true;
}
-
+
byte stackNum = 0;
for (i = 1; i <= tspit + 1; i++)
@@ -445,9 +445,9 @@ bool RivenConsole::Cmd_Hotspots(int argc, const char **argv) {
DebugPrintf("enabled)\n");
else
DebugPrintf("disabled)\n");
-
+
DebugPrintf(" Name = %s\n", _vm->getHotspotName(i).c_str());
- }
+ }
return true;
}
@@ -467,9 +467,9 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) {
DebugPrintf("Usage: dumpScript <stack> <CARD or HSPT> <card>\n");
return true;
}
-
+
uint16 oldStack = _vm->getCurStack();
-
+
byte newStack = 0;
for (byte i = 1; i <= tspit + 1; i++)
@@ -482,52 +482,52 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) {
DebugPrintf("\'%s\' is not a stack name!\n", argv[1]);
return true;
}
-
+
newStack--;
_vm->changeToStack(newStack);
-
+
// Load in Variable Names
Common::SeekableReadStream *nameStream = _vm->getRawData(ID_NAME, VariableNames);
Common::StringList varNames;
-
+
uint16 namesCount = nameStream->readUint16BE();
uint16 *stringOffsets = new uint16[namesCount];
for (uint16 i = 0; i < namesCount; i++)
stringOffsets[i] = nameStream->readUint16BE();
nameStream->seek(namesCount * 2, SEEK_CUR);
int32 curNamesPos = nameStream->pos();
-
+
for (uint32 i = 0; i < namesCount; i++) {
nameStream->seek(curNamesPos + stringOffsets[i]);
-
+
Common::String name;
for (char c = nameStream->readByte(); c; c = nameStream->readByte())
name += c;
varNames.push_back(name);
}
delete nameStream;
-
+
// Load in External Command Names
nameStream = _vm->getRawData(ID_NAME, ExternalCommandNames);
Common::StringList xNames;
-
+
namesCount = nameStream->readUint16BE();
stringOffsets = new uint16[namesCount];
for (uint16 i = 0; i < namesCount; i++)
stringOffsets[i] = nameStream->readUint16BE();
nameStream->seek(namesCount * 2, SEEK_CUR);
curNamesPos = nameStream->pos();
-
+
for (uint32 i = 0; i < namesCount; i++) {
nameStream->seek(curNamesPos + stringOffsets[i]);
-
+
Common::String name;
for (char c = nameStream->readByte(); c; c = nameStream->readByte())
name += c;
xNames.push_back(name);
}
delete nameStream;
-
+
// Get CARD/HSPT data and dump their scripts
if (!scumm_stricmp(argv[2], "CARD")) {
printf ("\n\nDumping scripts for %s\'s card %d!\n", argv[1], (uint16)atoi(argv[3]));
@@ -541,11 +541,11 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) {
} else if (!scumm_stricmp(argv[2], "HSPT")) {
printf ("\n\nDumping scripts for %s\'s card %d hotspots!\n", argv[1], (uint16)atoi(argv[3]));
printf ("===========================================\n\n");
-
+
Common::SeekableReadStream *hsptStream = _vm->getRawData(MKID_BE('HSPT'), (uint16)atoi(argv[3]));
-
+
uint16 hotspotCount = hsptStream->readUint16BE();
-
+
for (uint16 i = 0; i < hotspotCount; i++) {
printf ("Hotspot %d:\n", i);
hsptStream->seek(22, SEEK_CUR); // Skip non-script related stuff
@@ -553,18 +553,18 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) {
for (uint32 j = 0; j < scriptList.size(); j++)
scriptList[j]->dumpScript(varNames, xNames, 1);
}
-
+
delete hsptStream;
} else {
DebugPrintf("%s doesn't have any scripts!\n", argv[2]);
}
-
+
printf("\n\n");
-
+
_vm->changeToStack(oldStack);
-
+
DebugPrintf("Script dump complete.\n");
-
+
return true;
}
@@ -576,7 +576,7 @@ bool RivenConsole::Cmd_ListZipCards(int argc, const char **argv) {
for (uint32 i = 0; i < _vm->_zipModeData.size(); i++)
DebugPrintf("ID = %d, Name = %s\n", _vm->_zipModeData[i].id, _vm->_zipModeData[i].name.c_str());
}
-
+
return true;
}
diff --git a/engines/mohawk/console.h b/engines/mohawk/console.h
index bd699bc8b7..e79f151894 100644
--- a/engines/mohawk/console.h
+++ b/engines/mohawk/console.h
@@ -38,14 +38,14 @@ class MystConsole : public GUI::Debugger {
public:
MystConsole(MohawkEngine_Myst *vm);
virtual ~MystConsole(void);
-
+
protected:
virtual void preEnter();
virtual void postEnter();
-
+
private:
MohawkEngine_Myst *_vm;
-
+
bool Cmd_ChangeCard(int argc, const char **argv);
bool Cmd_CurCard(int argc, const char **argv);
bool Cmd_Var(int argc, const char **argv);
@@ -71,7 +71,7 @@ protected:
private:
MohawkEngine_Riven *_vm;
-
+
bool Cmd_ChangeCard(int argc, const char **argv);
bool Cmd_CurCard(int argc, const char **argv);
bool Cmd_Var(int argc, const char **argv);
diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp
index b00b312892..65353b61e7 100644
--- a/engines/mohawk/detection.cpp
+++ b/engines/mohawk/detection.cpp
@@ -81,14 +81,14 @@ bool MohawkEngine::hasFeature(EngineFeature f) const {
}
bool MohawkEngine_Myst::hasFeature(EngineFeature f) const {
- return
+ return
MohawkEngine::hasFeature(f)
|| (f == kSupportsLoadingDuringRuntime)
|| (f == kSupportsSavingDuringRuntime);
}
bool MohawkEngine_Riven::hasFeature(EngineFeature f) const {
- return
+ return
MohawkEngine::hasFeature(f)
|| (f == kSupportsLoadingDuringRuntime)
|| (f == kSupportsSavingDuringRuntime);
@@ -142,7 +142,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0,
},
-
+
// Myst Demo
// English Windows 3.11
// From CD-ROM Today July, 1994
@@ -178,7 +178,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0,
},
-
+
// Myst
// German Windows 3.11
// From LordHoto
@@ -196,7 +196,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0,
},
-
+
// Myst
// Spanish Windows ?
// From jvprat
@@ -214,7 +214,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0,
},
-
+
// Myst
// Japanese Windows 3.11
// From clone2727
@@ -268,7 +268,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0,
},
-
+
// Making of Myst
// Japanese Windows 3.11
// From clone2727
@@ -304,7 +304,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_ME,
0,
},
-
+
// Myst Masterpiece Edition
// English Windows
// From clone2727
@@ -322,7 +322,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_ME,
0,
},
-
+
// Myst Masterpiece Edition
// German Windows
// From DrMcCoy (Included in "Myst: Die Trilogie")
@@ -358,7 +358,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0,
},
-
+
// Riven: The Sequel to Myst
// Version 1.03 (5CD)
// From ST
@@ -397,7 +397,7 @@ static const MohawkGameDescription gameDescriptions[] = {
// Riven: The Sequel to Myst
// Version 1.? (DVD, From "Myst 10th Anniversary Edition")
- // From Clone2727
+ // From Clone2727
{
{
"riven",
@@ -412,7 +412,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DVD,
0,
},
-
+
// Riven: The Sequel to Myst
// Version 1.0 (DVD, From "Myst: Die Trilogie")
// From DrMcCoy
@@ -448,7 +448,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0,
},
-
+
#ifdef DETECT_BRODERBUND_TITLES
{
{
@@ -464,7 +464,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_HASMIDI,
0
},
-
+
{
{
"csworld",
@@ -479,7 +479,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0
},
-
+
{
{
"csworld",
@@ -494,7 +494,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0
},
-
+
{
{
"csamtrak",
@@ -509,7 +509,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0
},
-
+
{
{
"maggiess",
@@ -524,7 +524,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0
},
-
+
{
{
"jamesmath",
@@ -539,7 +539,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_HASMIDI,
0
},
-
+
// This is in the NEWDATA folder, so I assume it's a newer version ;)
{
{
@@ -570,7 +570,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_HASMIDI,
0
},
-
+
{
{
"greeneggs",
@@ -585,7 +585,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0
},
-
+
// 32-bit version of the previous entry
{
{
@@ -601,7 +601,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0
},
-
+
{
{
"1stdegree",
@@ -664,7 +664,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0
},
-
+
{
{
"tortoise",
@@ -679,7 +679,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0
},
-
+
{
{
"arthur",
@@ -694,7 +694,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0
},
-
+
{
{
"arthur",
@@ -709,7 +709,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0
},
-
+
{
{
"arthur",
@@ -724,7 +724,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0
},
-
+
{
{
"grandma",
@@ -739,7 +739,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0
},
-
+
{
{
"grandma",
@@ -754,7 +754,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0
},
-
+
{
{
"grandma",
@@ -769,7 +769,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0
},
-
+
{
{
"ruff",
@@ -784,7 +784,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0
},
-
+
{
{
"ruff",
@@ -799,7 +799,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0
},
-
+
{
{
"newkid",
@@ -814,7 +814,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0
},
-
+
{
{
"newkid",
@@ -829,7 +829,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GF_DEMO,
0
},
-
+
{
{
"arthurrace",
@@ -844,7 +844,7 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
0
},
-
+
// 32-bit version of the previous entry
{
{
@@ -998,7 +998,7 @@ public:
};
bool MohawkMetaEngine::hasFeature(MetaEngineFeature f) const {
- return
+ return
(f == kSupportsListSaves)
|| (f == kSupportsLoadingDuringStartup)
|| (f == kSupportsDeleteSave);
@@ -1011,16 +1011,16 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const {
// Loading games is only supported in Myst/Riven currently.
if (strstr(target, "myst")) {
filenames = g_system->getSavefileManager()->listSavefiles("*.mys");
-
+
for (uint32 i = 0; i < filenames.size(); i++)
saveList.push_back(SaveStateDescriptor(i, filenames[i]));
} else if (strstr(target, "riven")) {
filenames = g_system->getSavefileManager()->listSavefiles("*.rvn");
-
+
for (uint32 i = 0; i < filenames.size(); i++)
saveList.push_back(SaveStateDescriptor(i, filenames[i]));
- }
-
+ }
+
return saveList;
}
@@ -1037,7 +1037,7 @@ void MohawkMetaEngine::removeSaveState(const char *target, int slot) const {
bool MohawkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
const Mohawk::MohawkGameDescription *gd = (const Mohawk::MohawkGameDescription *)desc;
-
+
if (gd) {
switch (gd->gameType) {
case Mohawk::GType_MYST:
diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp
index f63fb44c45..a1264f5f2e 100644
--- a/engines/mohawk/dialogs.cpp
+++ b/engines/mohawk/dialogs.cpp
@@ -36,7 +36,7 @@ namespace Mohawk {
// This used to have GUI::Dialog("MohawkDummyDialog"), but that doesn't work with the gui branch merge :P (Sorry, Tanoku!)
InfoDialog::InfoDialog(MohawkEngine *vm, Common::String message) : _vm(vm), GUI::Dialog(0, 0, 1, 1), _message(message) {
_backgroundType = GUI::ThemeEngine::kDialogBackgroundSpecial;
-
+
_text = new GUI::StaticTextWidget(this, 4, 4, 10, 10, _message, Graphics::kTextAlignCenter);
}
@@ -48,15 +48,15 @@ void InfoDialog::setInfoText(Common::String message) {
void InfoDialog::reflowLayout() {
const int screenW = g_system->getOverlayWidth();
const int screenH = g_system->getOverlayHeight();
-
+
int width = g_gui.getStringWidth(_message) + 16;
int height = g_gui.getFontHeight() + 8;
-
+
_w = width;
_h = height;
_x = (screenW - width) / 2;
_y = (screenH - height) / 2;
-
+
_text->setSize(_w - 8, _h);
}
@@ -77,7 +77,7 @@ enum {
kWaterCmd = 'WATR'
};
-MystOptionsDialog::MystOptionsDialog(MohawkEngine_Myst* vm) : GUI::OptionsDialog("", 120, 120, 360, 200), _vm(vm) {
+MystOptionsDialog::MystOptionsDialog(MohawkEngine_Myst* vm) : GUI::OptionsDialog("", 120, 120, 360, 200), _vm(vm) {
_zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 300, 15, "Zip Mode Activated", kZipCmd, 'Z');
_transistionsCheckbox = new GUI::CheckboxWidget(this, 15, 30, 300, 15, "Transistions Enabled", kTransCmd, 'T');
@@ -111,7 +111,7 @@ void MystOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, ui
}
}
-RivenOptionsDialog::RivenOptionsDialog(MohawkEngine_Riven* vm) : GUI::OptionsDialog("", 120, 120, 360, 200), _vm(vm) {
+RivenOptionsDialog::RivenOptionsDialog(MohawkEngine_Riven* vm) : GUI::OptionsDialog("", 120, 120, 360, 200), _vm(vm) {
_zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 300, 15, "Zip Mode Activated", kZipCmd, 'Z');
_waterEffectCheckbox = new GUI::CheckboxWidget(this, 15, 30, 300, 15, "Water Effect Enabled", kWaterCmd, 'W');
diff --git a/engines/mohawk/dialogs.h b/engines/mohawk/dialogs.h
index 5b46158eac..ab8be647aa 100644
--- a/engines/mohawk/dialogs.h
+++ b/engines/mohawk/dialogs.h
@@ -49,19 +49,19 @@ protected:
public:
InfoDialog(MohawkEngine *vm, Common::String message);
-
+
void setInfoText(Common::String message);
-
+
virtual void handleMouseDown(int x, int y, int button, int clickCount) {
setResult(0);
close();
}
-
+
virtual void handleKeyDown(Common::KeyState state) {
setResult(state.ascii);
close();
}
-
+
virtual void reflowLayout();
};
@@ -76,7 +76,7 @@ public:
MystOptionsDialog(MohawkEngine_Myst *vm);
~MystOptionsDialog();
void open();
-
+
virtual void handleCommand(GUI::CommandSender*, uint32, uint32);
private:
MohawkEngine_Myst *_vm;
@@ -89,7 +89,7 @@ public:
RivenOptionsDialog(MohawkEngine_Riven *vm);
~RivenOptionsDialog();
void open();
-
+
virtual void handleCommand(GUI::CommandSender*, uint32, uint32);
private:
MohawkEngine_Riven *_vm;
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index 21dda00018..fc29c7de83 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -39,7 +39,7 @@ Graphics::Surface *ImageData::getSurface() {
Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
Graphics::Surface *surface = new Graphics::Surface();
surface->create(_surface->w, _surface->h, pixelFormat.bytesPerPixel);
-
+
if (_surface->bytesPerPixel == 1) {
assert(_palette);
@@ -57,32 +57,32 @@ Graphics::Surface *ImageData::getSurface() {
}
} else
memcpy(surface->pixels, _surface->pixels, _surface->w * _surface->h * _surface->bytesPerPixel);
-
+
return surface;
}
MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : _vm(vm) {
_bmpDecoder = new MystBitmap();
-
+
// The original version of Myst could run in 8bpp color too.
// However, it dithered videos to 8bpp and they looked considerably
// worse (than they already did :P). So we're not even going to
// support 8bpp mode in Myst (Myst ME required >8bpp anyway).
initGraphics(544, 333, true, NULL); // What an odd screen size!
-
+
_pixelFormat = _vm->_system->getScreenFormat();
-
+
if (_pixelFormat.bytesPerPixel == 1)
error("Myst requires greater than 256 colors to run");
-
- if (_vm->getFeatures() & GF_ME) {
+
+ if (_vm->getFeatures() & GF_ME) {
_jpegDecoder = new MystJPEG();
_pictDecoder = new MystPICT(_jpegDecoder);
} else {
_jpegDecoder = NULL;
_pictDecoder = NULL;
}
-
+
_pictureFile.entries = NULL;
}
@@ -107,20 +107,20 @@ static const char* picFileNames[] = {
void MystGraphics::loadExternalPictureFile(uint16 stack) {
if (_vm->getPlatform() != Common::kPlatformMacintosh)
return;
-
+
if (_pictureFile.picFile.isOpen())
_pictureFile.picFile.close();
delete[] _pictureFile.entries;
-
+
if (!scumm_stricmp(picFileNames[stack], ""))
return;
-
+
if (!_pictureFile.picFile.open(picFileNames[stack]))
error ("Could not open external picture file \'%s\'", picFileNames[stack]);
-
+
_pictureFile.pictureCount = _pictureFile.picFile.readUint32BE();
_pictureFile.entries = new PictureFile::PictureEntry[_pictureFile.pictureCount];
-
+
for (uint32 i = 0; i < _pictureFile.pictureCount; i++) {
_pictureFile.entries[i].offset = _pictureFile.picFile.readUint32BE();
_pictureFile.entries[i].size = _pictureFile.picFile.readUint32BE();
@@ -138,7 +138,7 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm
dest.right = CLIP<int>(dest.right, 0, _vm->_system->getWidth());
dest.bottom = CLIP<int>(dest.bottom, 0, _vm->_system->getHeight());
-
+
Graphics::Surface *surface = NULL;
@@ -190,15 +190,15 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm
delete imageData;
}
}
-
+
debug(3, "Image Blit:");
- debug(3, "src.x: %d", src.left);
+ debug(3, "src.x: %d", src.left);
debug(3, "src.y: %d", src.top);
debug(3, "dest.x: %d", dest.left);
debug(3, "dest.y: %d", dest.top);
debug(3, "width: %d", src.width());
debug(3, "height: %d", src.height());
-
+
if (surface) {
uint16 width = MIN<int>(surface->w, dest.width());
uint16 height = MIN<int>(surface->h, dest.height());
@@ -206,7 +206,7 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm
surface->free();
delete surface;
}
-
+
// FIXME: Remove this and update only at certain points
_vm->_system->updateScreen();
}
@@ -254,7 +254,7 @@ void MystGraphics::drawRect(Common::Rect rect, bool active) {
screen->frameRect(rect, _pixelFormat.RGBToColor(0, 255, 0));
else
screen->frameRect(rect, _pixelFormat.RGBToColor(255, 0, 0));
-
+
_vm->_system->unlockScreen();
}
@@ -264,15 +264,15 @@ RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) : _vm(vm) {
// Give me the best you've got!
initGraphics(608, 436, true, NULL);
_pixelFormat = _vm->_system->getScreenFormat();
-
+
if (_pixelFormat.bytesPerPixel == 1)
error("Riven requires greater than 256 colors to run");
-
+
// The actual game graphics only take up the first 392 rows. The inventory
// occupies the rest of the screen and we don't use the buffer to hold that.
_mainScreen = new Graphics::Surface();
_mainScreen->create(608, 392, _pixelFormat.bytesPerPixel);
-
+
_updatesEnabled = true;
_scheduledTransition = -1; // no transition
_dirtyScreen = false;
@@ -290,17 +290,17 @@ void RivenGraphics::copyImageToScreen(uint16 image, uint32 left, uint32 top, uin
ImageData *imageData = _bitmapDecoder->decodeImage(_vm->getRawData(ID_TBMP, image));
Graphics::Surface *surface = imageData->getSurface();
delete imageData;
-
+
// Clip the width to fit on the screen. Fixes some images.
if (left + surface->w > 608)
surface->w = 608 - left;
-
+
for (uint16 i = 0; i < surface->h; i++)
memcpy(_mainScreen->getBasePtr(left, i + top), surface->getBasePtr(0, i), surface->w * surface->bytesPerPixel);
-
+
surface->free();
delete surface;
-
+
_dirtyScreen = true;
}
@@ -308,7 +308,7 @@ void RivenGraphics::drawPLST(uint16 x) {
Common::SeekableReadStream* plst = _vm->getRawData(ID_PLST, _vm->getCurCard());
uint16 index, id, left, top, right, bottom;
uint16 recordCount = plst->readUint16BE();
-
+
for (uint16 i = 0; i < recordCount; i++) {
index = plst->readUint16BE();
id = plst->readUint16BE();
@@ -336,16 +336,16 @@ void RivenGraphics::drawPLST(uint16 x) {
void RivenGraphics::updateScreen() {
if (_updatesEnabled) {
_vm->runUpdateScreenScript();
-
+
if (_dirtyScreen) {
_activatedPLSTs.clear();
-
+
// Copy to screen if there's no transition. Otherwise transition. ;)
if (_scheduledTransition < 0)
_vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
else
runScheduledTransition();
-
+
// Finally, update the screen.
_vm->_system->updateScreen();
_dirtyScreen = false;
@@ -358,7 +358,7 @@ void RivenGraphics::scheduleWaterEffect(uint16 sfxeID) {
if (sfxeStream->readUint16BE() != 'SL')
error ("Unknown sfxe tag");
-
+
// Read in header info
SFXERecord sfxeRecord;
sfxeRecord.frameCount = sfxeStream->readUint16BE();
@@ -369,22 +369,22 @@ void RivenGraphics::scheduleWaterEffect(uint16 sfxeID) {
sfxeRecord.rect.bottom = sfxeStream->readUint16BE();
sfxeRecord.speed = sfxeStream->readUint16BE();
// Skip the rest of the fields...
-
+
// Read in offsets
sfxeStream->seek(offsetTablePosition);
uint32 *frameOffsets = new uint32[sfxeRecord.frameCount];
for (uint16 i = 0; i < sfxeRecord.frameCount; i++)
frameOffsets[i] = sfxeStream->readUint32BE();
sfxeStream->seek(frameOffsets[0]);
-
+
// Read in the scripts
- for (uint16 i = 0; i < sfxeRecord.frameCount; i++)
+ for (uint16 i = 0; i < sfxeRecord.frameCount; i++)
sfxeRecord.frameScripts.push_back(sfxeStream->readStream((i == sfxeRecord.frameCount - 1) ? sfxeStream->size() - frameOffsets[i] : frameOffsets[i + 1] - frameOffsets[i]));
-
+
// Set it to the first frame
sfxeRecord.curFrame = 0;
sfxeRecord.lastFrameTime = 0;
-
+
delete[] frameOffsets;
delete sfxeStream;
_waterEffects.push_back(sfxeRecord);
@@ -400,18 +400,18 @@ bool RivenGraphics::runScheduledWaterEffects() {
return false;
Graphics::Surface *screen = NULL;
-
+
for (uint16 i = 0; i < _waterEffects.size(); i++) {
if (_vm->_system->getMillis() > _waterEffects[i].lastFrameTime + 1000 / _waterEffects[i].speed) {
// Lock the screen!
if (!screen)
screen = _vm->_system->lockScreen();
-
+
// Make sure the script is at the starting point
Common::SeekableReadStream *script = _waterEffects[i].frameScripts[_waterEffects[i].curFrame];
if (script->pos() != 0)
script->seek(0);
-
+
// Run script
uint16 curRow = 0;
for (uint16 op = script->readUint16BE(); op != 4; op = script->readUint16BE()) {
@@ -427,23 +427,23 @@ bool RivenGraphics::runScheduledWaterEffects() {
error ("Unknown SFXE opcode %d", op);
}
}
-
+
// Increment frame
_waterEffects[i].curFrame++;
if (_waterEffects[i].curFrame == _waterEffects[i].frameCount)
_waterEffects[i].curFrame = 0;
-
+
// Set the new time
_waterEffects[i].lastFrameTime = _vm->_system->getMillis();
}
}
-
+
// Unlock the screen if it has been locked and return true to update the screen
if (screen) {
_vm->_system->unlockScreen();
return true;
}
-
+
return false;
}
@@ -455,9 +455,9 @@ void RivenGraphics::scheduleTransition(uint16 id, Common::Rect rect) {
void RivenGraphics::runScheduledTransition() {
if (_scheduledTransition < 0) // No transition is scheduled
return;
-
+
// TODO: There's a lot to be done here...
-
+
// Note: Transitions 0-11 are actual transitions, but none are used in-game.
// There's no point in implementing them if they're not used. These extra
// transitions were found by hacking scripts.
@@ -485,7 +485,7 @@ void RivenGraphics::runScheduledTransition() {
else
error ("Found unknown transition %d", _scheduledTransition);
}
-
+
// For now, just copy the image to screen without doing any transition.
_vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
_vm->_system->updateScreen();
@@ -583,34 +583,34 @@ void RivenGraphics::changeCursor(uint16 num) {
default:
error ("Cursor %d does not exist!", num);
}
-
+
if (num != 9000) // Show Cursor
CursorMan.showMouse(true);
-
+
// Should help in cases where we need to hide the cursor immediately.
_vm->_system->updateScreen();
}
-
+
void RivenGraphics::showInventory() {
// Don't redraw the inventory
if (_inventoryDrawn)
return;
-
+
// Clear the inventory area
clearInventoryArea();
-
+
// The demo doesn't have the inventory system and we don't want
// to show the inventory on setup screens or in other journals.
if (_vm->getFeatures() & GF_DEMO || _vm->getCurStack() == aspit)
return;
-
+
// There are three books and three vars. However, there's only
// a possible two combinations. Either you have only Atrus'
// journal or you have all three books.
// bool hasAtrusBook = *_vm->matchVarToString("aatrusbook") != 0;
bool hasCathBook = *_vm->matchVarToString("acathbook") != 0;
// bool hasTrapBook = *_vm->matchVarToString("atrapbook") != 0;
-
+
if (!hasCathBook) {
drawInventoryImage(101, atrusJournalRectSolo);
} else {
@@ -618,19 +618,19 @@ void RivenGraphics::showInventory() {
drawInventoryImage(102, cathJournalRect);
drawInventoryImage(100, trapBookRect);
}
-
+
_vm->_system->updateScreen();
_inventoryDrawn = true;
}
-
+
void RivenGraphics::hideInventory() {
// Don't hide the inventory twice
if (!_inventoryDrawn)
return;
-
+
// Clear the area
clearInventoryArea();
-
+
_inventoryDrawn = false;
}
@@ -643,7 +643,7 @@ void RivenGraphics::clearInventoryArea() {
// Fill the inventory area with black
screen->fillRect(inventoryRect, _pixelFormat.RGBToColor(0, 0, 0));
-
+
_vm->_system->unlockScreen();
}
@@ -661,12 +661,12 @@ void RivenGraphics::drawInventoryImage(uint16 id, Common::Rect rect) {
void RivenGraphics::drawRect(Common::Rect rect, bool active) {
// Useful with debugging. Shows where hotspots are on the screen and whether or not they're active.
Graphics::Surface *screen = _vm->_system->lockScreen();
-
+
if (active)
screen->frameRect(rect, _pixelFormat.RGBToColor(0, 255, 0));
else
screen->frameRect(rect, _pixelFormat.RGBToColor(255, 0, 0));
-
+
_vm->_system->unlockScreen();
}
@@ -692,13 +692,13 @@ void LBGraphics::copyImageToScreen(uint16 image, uint16 left, uint16 right) {
Graphics::Surface *surface = imageData->getSurface();
imageData->_palette = NULL; // Unset the palette so it doesn't get deleted
delete imageData;
-
+
uint16 width = MIN<int>(surface->w, 640);
uint16 height = MIN<int>(surface->h, 480);
_vm->_system->copyRectToScreen((byte *)surface->pixels, surface->pitch, left, right, width, height);
surface->free();
delete surface;
-
+
// FIXME: Remove this and update only at certain points
_vm->_system->updateScreen();
}
@@ -711,14 +711,14 @@ void LBGraphics::setPalette(uint16 id) {
if (_vm->getGameType() == GType_LIVINGBOOKSV1) {
Common::SeekableSubReadStreamEndian *ctblStream = _vm->wrapStreamEndian(ID_CTBL, id);
uint16 colorCount = ctblStream->readUint16();
-
+
for (uint16 i = 0; i < colorCount; i++) {
_palette[i * 4] = ctblStream->readByte();
_palette[i * 4 + 1] = ctblStream->readByte();
_palette[i * 4 + 2] = ctblStream->readByte();
_palette[i * 4 + 3] = ctblStream->readByte();
}
-
+
delete ctblStream;
} else {
Common::SeekableReadStream *tpalStream = _vm->getRawData(ID_TPAL, id);
@@ -731,7 +731,7 @@ void LBGraphics::setPalette(uint16 id) {
_palette[i * 4 + 2] = tpalStream->readByte();
_palette[i * 4 + 3] = tpalStream->readByte();
}
-
+
delete tpalStream;
}
}
diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h
index be3a951148..16d515ac08 100644
--- a/engines/mohawk/graphics.h
+++ b/engines/mohawk/graphics.h
@@ -91,14 +91,14 @@ class MystGraphics {
public:
MystGraphics(MohawkEngine_Myst*);
~MystGraphics();
-
+
void loadExternalPictureFile(uint16 stack);
void copyImageSectionToScreen(uint16 image, Common::Rect src, Common::Rect dest);
void copyImageToScreen(uint16 image, Common::Rect dest);
void showCursor(void);
void hideCursor(void);
void changeCursor(uint16);
-
+
void drawRect(Common::Rect rect, bool active);
private:
MohawkEngine_Myst *_vm;
@@ -106,7 +106,7 @@ private:
MystPICT *_pictDecoder;
MystJPEG *_jpegDecoder;
Graphics::PixelFormat _pixelFormat;
-
+
struct PictureFile {
uint32 pictureCount;
struct PictureEntry {
@@ -128,7 +128,7 @@ struct SFXERecord {
Common::Rect rect;
uint16 speed;
Common::Array<Common::SeekableReadStream*> frameScripts;
-
+
// Cur frame
uint16 curFrame;
uint32 lastFrameTime;
@@ -138,7 +138,7 @@ class RivenGraphics {
public:
RivenGraphics(MohawkEngine_Riven *vm);
~RivenGraphics();
-
+
void copyImageToScreen(uint16, uint32, uint32, uint32, uint32);
void updateScreen();
bool _updatesEnabled;
@@ -151,11 +151,11 @@ public:
void scheduleWaterEffect(uint16);
void clearWaterEffects();
bool runScheduledWaterEffects();
-
+
// Transitions
void scheduleTransition(uint16 id, Common::Rect rect = Common::Rect(0, 0, 608, 392));
void runScheduledTransition();
-
+
// Inventory
void showInventory();
void hideInventory();
@@ -166,16 +166,16 @@ private:
// Water Effects
Common::Array<SFXERecord> _waterEffects;
-
+
// Transitions
int16 _scheduledTransition;
Common::Rect _transitionRect;
-
+
// Inventory
void clearInventoryArea();
void drawInventoryImage(uint16 id, Common::Rect rect);
bool _inventoryDrawn;
-
+
// Screen Related
Graphics::Surface *_mainScreen;
bool _dirtyScreen;
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index ccb9de1fa1..f0648fa114 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -66,7 +66,7 @@ Common::Error MohawkEngine_LivingBooks::run() {
loadIntro();
debug(1, "Stack Version: %d", getResourceVersion());
-
+
_gfx->setPalette(1000);
loadSHP(1000);
loadANI(1000);
@@ -129,7 +129,7 @@ void MohawkEngine_LivingBooks::loadBookInfo(Common::String filename) {
_screenWidth = getIntFromConfig("BookInfo", "xRes");
_screenHeight = getIntFromConfig("BookInfo", "yRes");
// nColors is here too, but it's always 256 anyway...
-
+
// The later Living Books games add some more options:
// - fNeedPalette (always true?)
// - fUse254ColorPalette (always true?)
@@ -154,10 +154,10 @@ void MohawkEngine_LivingBooks::loadIntro() {
}
filename = getFileNameFromConfig("Intro", "Page2");
-
+
if (filename.empty())
filename = getFileNameFromConfig("Intro", "Page2.r");
-
+
if (!filename.empty() && Common::File::exists(filename)) {
MohawkArchive *coverArchive = createMohawkArchive();
coverArchive->open(filename);
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 7cf73d4a02..6bd0729bbf 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -78,12 +78,12 @@ private:
Common::String removeQuotesFromString(Common::String string);
Common::String convertMacFileName(Common::String string);
Common::String convertWinFileName(Common::String string);
-
+
// Configuration File Functions
Common::String getStringFromConfig(Common::String section, Common::String key);
int getIntFromConfig(Common::String section, Common::String key);
Common::String getFileNameFromConfig(Common::String section, Common::String key);
-
+
// Platform/Version functions
bool isBigEndian() const { return getGameType() == GType_LIVINGBOOKSV3 || getPlatform() == Common::kPlatformMacintosh; }
MohawkArchive *createMohawkArchive() const;
diff --git a/engines/mohawk/mohawk.cpp b/engines/mohawk/mohawk.cpp
index 08b7b82e02..a4eba550d9 100644
--- a/engines/mohawk/mohawk.cpp
+++ b/engines/mohawk/mohawk.cpp
@@ -92,12 +92,12 @@ Common::SeekableReadStream *MohawkEngine::getRawData(uint32 tag, uint16 id) {
error ("Could not find a \'%s\' resource with ID %04x", tag2str(tag), id);
return 0;
}
-
+
bool MohawkEngine::hasResource(uint32 tag, uint16 id) {
for (uint32 i = 0; i < _mhk.size(); i++)
if (_mhk[i]->hasResource(tag, id))
return true;
-
+
return false;
}
@@ -105,7 +105,7 @@ uint32 MohawkEngine::getResourceOffset(uint32 tag, uint16 id) {
for (uint32 i = 0; i < _mhk.size(); i++)
if (_mhk[i]->hasResource(tag, id))
return _mhk[i]->getOffset(tag, id);
-
+
error ("Could not find a \'%s\' resource with ID %04x", tag2str(tag), id);
return 0;
}
diff --git a/engines/mohawk/mohawk.h b/engines/mohawk/mohawk.h
index 5d4588f09a..280995d070 100644
--- a/engines/mohawk/mohawk.h
+++ b/engines/mohawk/mohawk.h
@@ -80,7 +80,7 @@ public:
Common::Platform getPlatform() const;
uint8 getGameType() const;
Common::Language getLanguage() const;
-
+
bool hasFeature(EngineFeature f) const;
Sound *_sound;
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 8c610d9574..647e6d4c42 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -59,10 +59,10 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
_curCard = 0;
_needsUpdate = false;
_curResource = -1;
-
+
_cursorHintCount = 0;
_cursorHints = NULL;
-
+
_view.conditionalImageCount = 0;
_view.conditionalImages = NULL;
_view.soundList = NULL;
@@ -123,7 +123,7 @@ Common::String MohawkEngine_Myst::wrapMovieFilename(Common::String movieName, ui
return Common::String("CD Data/m/") + movieName + ".mov";
const char* prefix;
-
+
switch (stack) {
case kIntroStack:
prefix = "intro/";
@@ -267,7 +267,7 @@ Common::Error MohawkEngine_Myst::run() {
debug(2, "Sending mouse up event to resource %d\n", _curResource);
_resources[_curResource]->handleMouseDown();
}
- break;
+ break;
case Common::EVENT_KEYDOWN:
switch (event.kbd.keycode) {
case Common::KEYCODE_d:
@@ -326,7 +326,7 @@ void MohawkEngine_Myst::changeToStack(uint16 stack) {
if (getPlatform() == Common::kPlatformMacintosh)
_gfx->loadExternalPictureFile(_curStack);
-
+
_runExitScript = false;
}
@@ -334,7 +334,7 @@ void MohawkEngine_Myst::changeToCard(uint16 card) {
debug(2, "changeToCard(%d)", card);
_scriptParser->disableInitOpcodes();
-
+
_video->stopVideos();
// Run exit script from last card (if present)
@@ -342,7 +342,7 @@ void MohawkEngine_Myst::changeToCard(uint16 card) {
runExitScript();
_runExitScript = true;
-
+
unloadCard();
_curCard = card;
@@ -379,11 +379,11 @@ void MohawkEngine_Myst::changeToCard(uint16 card) {
soundAction = _view.sound;
soundActionVolume = _view.soundVolume;
}
-
- // NOTE: Mixer only has 8-bit channel volume granularity,
+
+ // NOTE: Mixer only has 8-bit channel volume granularity,
// Myst uses 16-bit? Or is part of this balance?
soundActionVolume = (byte)(soundActionVolume / 255);
-
+
if (soundAction == kMystSoundActionContinue)
debug(2, "Continuing with current sound");
else if (soundAction == kMystSoundActionChangeVolume) {
@@ -409,7 +409,7 @@ void MohawkEngine_Myst::changeToCard(uint16 card) {
// Run the entrance script (if present)
runInitScript();
-
+
// Make sure we have the right cursor showing
_curResource = -1;
checkCurrentResource();
@@ -697,7 +697,7 @@ void MohawkEngine_Myst::runExitScript() {
delete exitStream;
_scriptParser->runScript(scriptCount, scripts);
-
+
for (uint16 i = 0; i < scriptCount; i++)
delete[] scripts[i].values;
delete[] scripts;
@@ -707,7 +707,7 @@ void MohawkEngine_Myst::loadHelp(uint16 id) {
// The original version did not have the help system
if (!(getFeatures() & GF_ME))
return;
-
+
// TODO: Help File contains 5 cards i.e. VIEW, RLST, etc.
// in addition to HELP resources.
// These are Ids 9930 to 9934
@@ -722,14 +722,14 @@ void MohawkEngine_Myst::loadHelp(uint16 id) {
uint16 count = helpStream->readUint16LE();
uint16 *u0 = new uint16[count];
Common::String helpText;
-
+
debugC(kDebugHelp, "\tcount: %d", count);
-
+
for (uint16 i = 0; i < count; i++) {
u0[i] = helpStream->readUint16LE();
debugC(kDebugHelp, "\tu0[%d]: %d", i, u0[i]);
}
-
+
// TODO: Previous values i.e. u0[0] to u0[count - 2]
// appear to be resource ids in the help.dat file..
if (u0[count - 1] != count)
@@ -896,7 +896,7 @@ void MohawkEngine_Myst::loadResources() {
MystResource::MystResource(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) {
_vm = vm;
_parent = parent;
-
+
if (parent == NULL) {
_flags = rlstStream->readUint16LE();
_rect.left = rlstStream->readSint16LE();
@@ -925,7 +925,7 @@ MystResource::MystResource(MohawkEngine_Myst *vm, Common::SeekableReadStream *rl
debugC(kDebugResource, "\tright: %d", _rect.right);
debugC(kDebugResource, "\tbottom: %d", _rect.bottom);
debugC(kDebugResource, "\tdest: %d", _dest);
-
+
// Default Enable based on flags...
if (_vm->_zipMode)
_enabled = (_flags & kMystZipModeEnableFlag) != 0 ||
@@ -992,7 +992,7 @@ Common::String MystResourceType6::convertMystVideoName(Common::String name) {
MystResourceType6::MystResourceType6(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) : MystResourceType5(vm, rlstStream, parent) {
char c = 0;
-
+
do {
c = rlstStream->readByte();
_videoFile += c;
@@ -1265,7 +1265,7 @@ void MystResourceType8::drawDataToScreen() {
if (_subImages[subImageId].rect.left == -1)
_vm->_gfx->copyImageSectionToScreen(imageToDraw, _rect, _rect);
//vm->_gfx->copyImageToScreen(imageToDraw, Common::Rect(0, 0, 544, 333));
- // TODO: Think this is the case when the image is full screen.. need to modify graphics to add functions for returning size of image.
+ // TODO: Think this is the case when the image is full screen.. need to modify graphics to add functions for returning size of image.
// This is not right either...
//else if (_rect.width() != _subImages[draw_subimage_id].rect.width() || _rect.height() != _subImages[draw_subimage_id].rect.height())
// HACK: Hardcode cases of this until general rule can be ascertained
@@ -1518,7 +1518,7 @@ void MystResourceType13::handleMouseLeave() {
void MystResourceType13::handleMouseUp() {
// Type 13 Resources do nothing on Mouse Clicks.
- // This is required to override the inherited default
+ // This is required to override the inherited default
// i.e. MystResource::handleMouseUp
}
@@ -1538,9 +1538,9 @@ Common::Error MohawkEngine_Myst::loadGameState(int slot) {
Common::Error MohawkEngine_Myst::saveGameState(int slot, const char *desc) {
Common::StringList saveList = _saveLoad->generateSaveGameList();
- if ((uint)slot < saveList.size())
+ if ((uint)slot < saveList.size())
_saveLoad->deleteSave(saveList[slot]);
-
+
return _saveLoad->saveGame(Common::String(desc)) ? Common::kNoError : Common::kUnknownError;
}
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 5a90de33ed..60231260dd 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -167,7 +167,7 @@ public:
void setEnabled(bool enabled) { _enabled = enabled; }
uint16 getDest() { return _dest; }
virtual uint16 getType8Var() { return 0xFFFF; }
-
+
// Mouse interface
virtual void handleMouseUp();
virtual void handleMouseDown() {}
@@ -370,7 +370,7 @@ public:
void setResourceEnabled(uint16 resourceId, bool enable);
GUI::Debugger *getDebugger() { return _console; }
-
+
bool canLoadGameStateCurrently() { return !(getFeatures() & GF_DEMO); }
bool canSaveGameStateCurrently() { return !(getFeatures() & GF_DEMO); }
Common::Error loadGameState(int slot);
diff --git a/engines/mohawk/myst_jpeg.cpp b/engines/mohawk/myst_jpeg.cpp
index c6d0a00ea3..e131347a11 100644
--- a/engines/mohawk/myst_jpeg.cpp
+++ b/engines/mohawk/myst_jpeg.cpp
@@ -29,11 +29,11 @@
#include "mohawk/myst_jpeg.h"
namespace Mohawk {
-
+
MystJPEG::MystJPEG() {
_jpeg = new Graphics::JPEG();
_pixelFormat = g_system->getScreenFormat();
-
+
// We're going to have to dither if we're running in 8bpp.
// We'll take RGBA8888 for best color performance in this case.
if (_pixelFormat.bytesPerPixel == 1)
@@ -45,10 +45,10 @@ Graphics::Surface *MystJPEG::decodeImage(Common::SeekableReadStream* stream) {
Graphics::Surface *ySurface = _jpeg->getComponent(1);
Graphics::Surface *uSurface = _jpeg->getComponent(2);
Graphics::Surface *vSurface = _jpeg->getComponent(3);
-
+
Graphics::Surface *finalSurface = new Graphics::Surface();
finalSurface->create(ySurface->w, ySurface->h, _pixelFormat.bytesPerPixel);
-
+
for (uint16 i = 0; i < finalSurface->h; i++) {
for (uint16 j = 0; j < finalSurface->w; j++) {
byte r = 0, g = 0, b = 0;
@@ -59,7 +59,7 @@ Graphics::Surface *MystJPEG::decodeImage(Common::SeekableReadStream* stream) {
*((uint32 *)finalSurface->getBasePtr(j, i)) = _pixelFormat.RGBToColor(r, g, b);
}
}
-
+
return finalSurface;
}
diff --git a/engines/mohawk/myst_jpeg.h b/engines/mohawk/myst_jpeg.h
index 9d1305371d..ae51dccf7a 100644
--- a/engines/mohawk/myst_jpeg.h
+++ b/engines/mohawk/myst_jpeg.h
@@ -41,9 +41,9 @@ class MystJPEG {
public:
MystJPEG();
~MystJPEG() { delete _jpeg; }
-
+
Graphics::Surface *decodeImage(Common::SeekableReadStream *stream);
-
+
private:
Graphics::PixelFormat _pixelFormat;
Graphics::JPEG *_jpeg;
diff --git a/engines/mohawk/myst_pict.cpp b/engines/mohawk/myst_pict.cpp
index 117c5ec9cc..765f5b206a 100644
--- a/engines/mohawk/myst_pict.cpp
+++ b/engines/mohawk/myst_pict.cpp
@@ -28,7 +28,7 @@
#include "mohawk/myst_pict.h"
namespace Mohawk {
-
+
// The PICT code is based off of the QuickDraw specs:
// http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-461.html
@@ -43,16 +43,16 @@ Graphics::Surface *MystPICT::decodeImage(Common::SeekableReadStream *stream) {
// Read in the first part of the header
/* uint16 fileSize = */ stream->readUint16BE();
-
+
_imageRect.top = stream->readUint16BE();
_imageRect.left = stream->readUint16BE();
_imageRect.bottom = stream->readUint16BE();
_imageRect.right = stream->readUint16BE();
_imageRect.debugPrint(0, "PICT Rect:");
-
+
Graphics::Surface *image = new Graphics::Surface();
image->create(_imageRect.width(), _imageRect.height(), _pixelFormat.bytesPerPixel);
-
+
// NOTE: This is only a subset of the full PICT format.
// - Only V2 Images Supported
// - JPEG Chunks are Supported
@@ -60,12 +60,12 @@ Graphics::Surface *MystPICT::decodeImage(Common::SeekableReadStream *stream) {
for (uint32 opNum = 0; !stream->eos() && !stream->err() && stream->pos() < stream->size(); opNum++) {
uint16 opcode = stream->readUint16BE();
debug(2, "Found PICT opcode %04x", opcode);
-
+
if (opNum == 0 && opcode != 0x0011)
error ("Cannot find PICT version opcode");
else if (opNum == 1 && opcode != 0x0C00)
error ("Cannot find PICT header opcode");
-
+
if (opcode == 0x0001) { // Clip
// Ignore
uint16 clipSize = stream->readUint16BE();
@@ -107,7 +107,7 @@ Graphics::Surface *MystPICT::decodeImage(Common::SeekableReadStream *stream) {
error ("Unknown PICT opcode %04x", opcode);
}
}
-
+
return image;
}
@@ -142,7 +142,7 @@ void MystPICT::decodeDirectBitsRect(Common::SeekableReadStream *stream, Graphics
buffer.create(image->w, image->h, 2);
DirectBitsRectData directBitsData;
-
+
directBitsData.pixMap.baseAddr = stream->readUint32BE();
directBitsData.pixMap.rowBytes = stream->readUint16BE();
directBitsData.pixMap.bounds.top = stream->readUint16BE();
@@ -170,10 +170,10 @@ void MystPICT::decodeDirectBitsRect(Common::SeekableReadStream *stream, Graphics
directBitsData.dstRect.bottom = stream->readUint16BE();
directBitsData.dstRect.right = stream->readUint16BE();
directBitsData.mode = stream->readUint16BE();
-
+
if (directBitsData.pixMap.pixelSize != 16)
error("Unhandled directBitsRect bitsPerPixel %d", directBitsData.pixMap.pixelSize);
-
+
// Read in amount of data per row
for (uint16 i = 0; i < directBitsData.pixMap.bounds.height(); i++) {
if (directBitsData.pixMap.packType == 1 || directBitsData.pixMap.rowBytes < 8) { // Unpacked, Pad-Byte
@@ -187,7 +187,7 @@ void MystPICT::decodeDirectBitsRect(Common::SeekableReadStream *stream, Graphics
decodeDirectBitsLine((byte *)buffer.getBasePtr(0, i), directBitsData.pixMap.rowBytes, stream->readStream(byteCount));
}
}
-
+
// Convert from 16-bit to whatever surface we need
for (uint16 y = 0; y < buffer.h; y++) {
for (uint16 x = 0; x < buffer.w; x++) {
@@ -203,7 +203,7 @@ void MystPICT::decodeDirectBitsLine(byte *out, uint32 length, Common::SeekableRe
uint32 dataDecoded = 0;
while (data->pos() < data->size() && dataDecoded < length) {
byte op = data->readByte();
-
+
if (op & 0x80) {
uint32 runSize = (op ^ 255) + 2;
byte value1 = data->readByte();
@@ -220,13 +220,13 @@ void MystPICT::decodeDirectBitsLine(byte *out, uint32 length, Common::SeekableRe
dataDecoded += runSize;
}
}
-
+
if (length != dataDecoded)
warning("Mismatched DirectBits read");
delete data;
}
-
-// Compressed QuickTime details can be found here:
+
+// Compressed QuickTime details can be found here:
// http://developer.apple.com/documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/B-Chapter/2TheImageCompression.html
// http://developer.apple.com/documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/F-Chapter/6WorkingwiththeImage.html
// I'm just ignoring that because Myst ME uses none of that extra stuff. The offset is always the same.
@@ -234,12 +234,12 @@ void MystPICT::decodeDirectBitsLine(byte *out, uint32 length, Common::SeekableRe
void MystPICT::decodeCompressedQuickTime(Common::SeekableReadStream *stream, Graphics::Surface *image) {
uint32 dataSize = stream->readUint32BE();
uint32 startPos = stream->pos();
-
+
Graphics::Surface *jpegImage = _jpegDecoder->decodeImage(new Common::SeekableSubReadStream(stream, stream->pos() + 156, stream->pos() + dataSize));
stream->seek(startPos + dataSize);
-
+
image->copyFrom(*jpegImage);
-
+
jpegImage->free();
delete jpegImage;
}
diff --git a/engines/mohawk/myst_pict.h b/engines/mohawk/myst_pict.h
index 2d763ca616..6b56a521b3 100644
--- a/engines/mohawk/myst_pict.h
+++ b/engines/mohawk/myst_pict.h
@@ -41,7 +41,7 @@ public:
MystPICT(MystJPEG *jpegDecoder);
~MystPICT() {}
Graphics::Surface *decodeImage(Common::SeekableReadStream *stream);
-
+
private:
MystJPEG *_jpegDecoder;
Common::Rect _imageRect;
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index dc49e72d75..4d6e00d76f 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -63,10 +63,10 @@ MystScriptParser::MystScriptParser(MohawkEngine_Myst *vm) : _vm(vm) {
setupOpcodes();
_invokingResource = NULL;
}
-
+
MystScriptParser::~MystScriptParser() {
}
-
+
void MystScriptParser::setupOpcodes() {
// "invalid" opcodes do not exist or have not been observed
// "unknown" opcodes exist, but their meaning is unknown
@@ -172,7 +172,7 @@ void MystScriptParser::setupOpcodes() {
OPCODE(197, opcode_197), // Demo only
OPCODE(198, opcode_198),
OPCODE(199, opcode_199),
-
+
// "Init" Opcodes
OPCODE(200, opcode_200),
OPCODE(201, opcode_201),
@@ -200,7 +200,7 @@ void MystScriptParser::setupOpcodes() {
// TODO: Opcodes 223 to 297 Not Present
OPCODE(298, opcode_298), // Demo only
OPCODE(299, opcode_299), // Demo only
-
+
// "Exit" Opcodes
OPCODE(300, opcode_300),
OPCODE(301, opcode_301),
@@ -218,7 +218,7 @@ void MystScriptParser::setupOpcodes() {
OPCODE(0xFFFF, NOP)
};
-
+
_opcodes = myst_opcodes;
_opcodeCount = ARRAYSIZE(myst_opcodes);
}
@@ -263,14 +263,14 @@ void MystScriptParser::runScript(uint16 scriptCount, MystScriptEntry *scripts, M
void MystScriptParser::runOpcode(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
bool ranOpcode = false;
-
+
for (uint16 i = 0; i < _opcodeCount; i++)
if (_opcodes[i].op == op) {
(this->*(_opcodes[i].proc)) (op, var, argc, argv);
ranOpcode = true;
break;
}
-
+
if (!ranOpcode)
error ("Trying to run invalid opcode %d", op);
}
@@ -284,7 +284,7 @@ const char *MystScriptParser::getOpcodeDesc(uint16 op) {
return "";
}
-// NOTE: Check to be used on Opcodes where var is thought
+// NOTE: Check to be used on Opcodes where var is thought
// not to be used. This emits a warning if var is nonzero.
// It is possible that the opcode does use var 0 in this case,
// but this will catch the majority of missed cases.
@@ -346,7 +346,7 @@ void MystScriptParser::altDest(uint16 op, uint16 var, uint16 argc, uint16 *argv)
_vm->changeToCard(_invokingResource->getDest());
else
warning("Missing invokingResource in altDest call");
- } else
+ } else
unknown(op, var, argc, argv);
}
@@ -406,7 +406,7 @@ void MystScriptParser::opcode_6(uint16 op, uint16 var, uint16 argc, uint16 *argv
_vm->changeToCard(_invokingResource->getDest());
else
warning("Opcode %d: Missing invokingResource", op);
- } else
+ } else
unknown(op, var, argc, argv);
}
@@ -422,7 +422,7 @@ void MystScriptParser::opcode_7(uint16 op, uint16 var, uint16 argc, uint16 *argv
_vm->changeToCard(_invokingResource->getDest());
else
warning("Opcode %d: Missing invokingResource", op);
- } else
+ } else
unknown(op, var, argc, argv);
}
@@ -437,7 +437,7 @@ void MystScriptParser::opcode_8(uint16 op, uint16 var, uint16 argc, uint16 *argv
_vm->changeToCard(_invokingResource->getDest());
else
warning("Opcode %d: Missing invokingResource", op);
- } else
+ } else
unknown(op, var, argc, argv);
}
@@ -457,8 +457,8 @@ void MystScriptParser::opcode_9(uint16 op, uint16 var, uint16 argc, uint16 *argv
// more...
if (!((_vm->getCurStack() == kStoneshipStack && _vm->getCurCard() == 2197) ||
(_vm->getCurStack() == kStoneshipStack && _vm->getCurCard() == 2138)))
- warning("TODO: Opcode 9 on this card - Check function is consistent");
- } else
+ warning("TODO: Opcode 9 on this card - Check function is consistent");
+ } else
unknown(op, var, argc, argv);
}
@@ -471,7 +471,7 @@ void MystScriptParser::opcode_14(uint16 op, uint16 var, uint16 argc, uint16 *arg
// Function looks like it changes the Var8 of the invoking resource to argument value..
// Most calls seem to have var = 0, but used in Myst Card 4500 (Execute Button)
// with Var 105..
- } else
+ } else
unknown(op, var, argc, argv);
}
@@ -499,7 +499,7 @@ void MystScriptParser::opcode_16(uint16 op, uint16 var, uint16 argc, uint16 *arg
debugC(kDebugScript, "\tcardId: %d", cardId);
debugC(kDebugScript, "\tu0: %d", u0);
- // TODO: Finish Implementation...
+ // TODO: Finish Implementation...
_vm->changeToCard(cardId);
} else
unknown(op, var, argc, argv);
@@ -606,12 +606,12 @@ void MystScriptParser::opcode_21(uint16 op, uint16 var, uint16 argc, uint16 *arg
Common::Rect rect1 = Common::Rect(argv[0], argv[1], argv[2], argv[3]);
uint16 u0 = argv[4];
uint16 u1 = argv[5];
-
+
debugC(kDebugScript, "\trect1.left: %d", rect1.left);
debugC(kDebugScript, "\trect1.top: %d", rect1.top);
debugC(kDebugScript, "\trect1.right: %d", rect1.right);
debugC(kDebugScript, "\trect1.bottom: %d", rect1.bottom);
-
+
debugC(kDebugScript, "\tu0: %d", u0);
debugC(kDebugScript, "\tu1: %d", u1);
@@ -828,7 +828,7 @@ void MystScriptParser::opcode_30(uint16 op, uint16 var, uint16 argc, uint16 *arg
debugC(kDebugScript, "\tcondVar: %d = %d", condVar, condVarValue);
debugC(kDebugScript, "\tcondCount: %d", condCount);
-
+
soundList = new int16[condCount];
soundListVolume = new uint16[condCount];
@@ -850,7 +850,7 @@ void MystScriptParser::opcode_30(uint16 op, uint16 var, uint16 argc, uint16 *arg
}
}
- // NOTE: Mixer only has 8-bit channel volume granularity,
+ // NOTE: Mixer only has 8-bit channel volume granularity,
// Myst uses 16-bit? Or is part of this balance?
soundVolume = (byte)(soundVolume / 255);
@@ -958,7 +958,7 @@ void MystScriptParser::opcode_35(uint16 op, uint16 var, uint16 argc, uint16 *arg
_vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333));
_vm->_system->updateScreen();
_vm->_system->delayMillis(delay * 100);
- _vm->changeToCard(cardId);
+ _vm->changeToCard(cardId);
} else
unknown(op, var, argc, argv);
}
@@ -969,7 +969,7 @@ void MystScriptParser::changeCursor(uint16 op, uint16 var, uint16 argc, uint16 *
if (argc == 1) {
debugC(kDebugScript, "Opcode %d: Change Cursor", op);
debugC(kDebugScript, "Cursor: %d", argv[0]);
-
+
// TODO: Not sure if this needs to change mainCursor or similar...
_vm->_gfx->changeCursor(argv[0]);
} else
@@ -1108,7 +1108,7 @@ void MystScriptParser::opcode_41(uint16 op, uint16 var, uint16 argc, uint16 *arg
debugC(kDebugScript, "\tregion.right: %d", region.right);
debugC(kDebugScript, "\tregion.bottom: %d", region.bottom);
debugCN(kDebugScript, "\tupdateDirection: %d = ", updateDirection);
-
+
switch (updateDirection) {
case 0:
debugC(kDebugScript, "Left to Right");
@@ -1126,7 +1126,7 @@ void MystScriptParser::opcode_41(uint16 op, uint16 var, uint16 argc, uint16 *arg
warning("Unknown Update Direction");
break;
}
-
+
debugC(kDebugScript, "\tu2: %d", u2); // TODO: Speed / Delay of Update?
// 10 Argument version Used in:
@@ -1142,7 +1142,7 @@ void MystScriptParser::opcode_41(uint16 op, uint16 var, uint16 argc, uint16 *arg
debugC(kDebugScript, "\tregion2.right: %d", region2.right);
debugC(kDebugScript, "\tregion2.bottom: %d", region2.bottom);
debugCN(kDebugScript, "\tupdateDirection2: %d = ", updateDirection2);
-
+
switch (updateDirection2) {
case 0:
debugC(kDebugScript, "Left to Right");
@@ -1160,7 +1160,7 @@ void MystScriptParser::opcode_41(uint16 op, uint16 var, uint16 argc, uint16 *arg
warning("Unknown Update Direction");
break;
}
-
+
debugC(kDebugScript, "\tu3: %d", u3); // TODO: Speed / Delay of Update?
}
@@ -1205,7 +1205,7 @@ void MystScriptParser::opcode_42(uint16 op, uint16 var, uint16 argc, uint16 *arg
debugC(kDebugScript, "\tregion.right: %d", region.right);
debugC(kDebugScript, "\tregion.bottom: %d", region.bottom);
debugCN(kDebugScript, "\tupdateDirection: %d = ", updateDirection);
-
+
switch (updateDirection) {
case 0:
debugC(kDebugScript, "Left to Right");
@@ -1223,7 +1223,7 @@ void MystScriptParser::opcode_42(uint16 op, uint16 var, uint16 argc, uint16 *arg
warning("Unknown Update Direction");
break;
}
-
+
debugC(kDebugScript, "\tu2: %d", u2); // TODO: Speed / Delay of Update?
// 9 Argument version Used in:
@@ -1239,7 +1239,7 @@ void MystScriptParser::opcode_42(uint16 op, uint16 var, uint16 argc, uint16 *arg
debugC(kDebugScript, "\tregion2.right: %d", region2.right);
debugC(kDebugScript, "\tregion2.bottom: %d", region2.bottom);
debugCN(kDebugScript, "\tupdateDirection2: %d = ", updateDirection2);
-
+
switch (updateDirection2) {
case 0:
debugC(kDebugScript, "Left to Right");
@@ -1257,7 +1257,7 @@ void MystScriptParser::opcode_42(uint16 op, uint16 var, uint16 argc, uint16 *arg
warning("Unknown Update Direction");
break;
}
-
+
debugC(kDebugScript, "\tu3: %d", u3); // TODO: Speed / Delay of Update?
}
@@ -1324,7 +1324,7 @@ void MystScriptParser::opcode_100(uint16 op, uint16 var, uint16 argc, uint16 *ar
debugC(kDebugScript, "Opcode %d: ChangeStack", op);
debugC(kDebugScript, "\tvar: %d", var);
- // TODO: Merge with changeStack (Opcode 40) Implementation?
+ // TODO: Merge with changeStack (Opcode 40) Implementation?
if (_vm->_varStore->getVar(var) == 5 || _vm->_varStore->getVar(var) > 7) {
// TODO: Dead Book i.e. Released Sirrus/Achenar
} else {
@@ -1687,7 +1687,7 @@ void MystScriptParser::opcode_104(uint16 op, uint16 var, uint16 argc, uint16 *ar
Common::Rect rect = _invokingResource->getRect();
// TODO: Need to load the image ids from Script Resources structure of VIEW
- for (uint16 imageId = 3595; imageId <= 3601; imageId++) {
+ for (uint16 imageId = 3595; imageId <= 3601; imageId++) {
_vm->_gfx->copyImageToScreen(imageId, rect);
_vm->_system->delayMillis(50);
}
@@ -1934,7 +1934,7 @@ void MystScriptParser::opcode_111(uint16 op, uint16 var, uint16 argc, uint16 *ar
// Used by Drawers Hotspots...
debugC(kDebugScript, "Opcode %d: Unknown Function", op);
-
+
uint16 u0 = argv[0];
debugC(kDebugScript, "\tu0: %d", u0);
@@ -1955,11 +1955,11 @@ void MystScriptParser::opcode_112(uint16 op, uint16 var, uint16 argc, uint16 *ar
// Used for Card 2013 (Achenar's Rose-Skull Hologram)
if (argc == 3) {
debugC(kDebugScript, "Opcode %d: Rose-Skull Hologram Playback", op);
-
+
uint16 varValue = _vm->_varStore->getVar(var);
debugC(kDebugScript, "\tVar: %d = %d", var, varValue);
-
+
uint16 startPoint = argv[0];
uint16 endPoint = argv[1];
uint16 u0 = argv[2];
@@ -1986,7 +1986,7 @@ void MystScriptParser::opcode_113(uint16 op, uint16 var, uint16 argc, uint16 *ar
// Used on Myst 4143 (Dock near Marker Switch)
if (argc == 9) {
uint16 soundId = argv[0];
-
+
uint16 u0 = argv[1];
uint16 u1 = argv[2];
@@ -1994,7 +1994,7 @@ void MystScriptParser::opcode_113(uint16 op, uint16 var, uint16 argc, uint16 *ar
uint16 updateDirection = argv[7];
uint16 u2 = argv[8];
-
+
debugC(kDebugScript, "Opcode %d: Vault Open Logic", op);
debugC(kDebugScript, "\tsoundId: %d", soundId);
debugC(kDebugScript, "\tu0: %d", u0);
@@ -2039,7 +2039,7 @@ void MystScriptParser::opcode_114(uint16 op, uint16 var, uint16 argc, uint16 *ar
// Used on Myst 4143 (Dock near Marker Switch)
if (argc == 9) {
uint16 soundId = argv[0];
-
+
uint16 u0 = argv[1];
uint16 u1 = argv[2];
@@ -2047,7 +2047,7 @@ void MystScriptParser::opcode_114(uint16 op, uint16 var, uint16 argc, uint16 *ar
uint16 updateDirection = argv[7];
uint16 u2 = argv[8];
-
+
debugC(kDebugScript, "Opcode %d: Vault Close Logic", op);
debugC(kDebugScript, "\tsoundId: %d", soundId);
debugC(kDebugScript, "\tu0: %d", u0);
@@ -2154,7 +2154,7 @@ void MystScriptParser::opcode_115(uint16 op, uint16 var, uint16 argc, uint16 *ar
_vm->changeToCard(cardIdLose);
} else
_vm->changeToCard(cardIdBookCover);
-
+
// TODO: Is this logic here?
// i.e. If was holding page, wait then auto open and play book...
} else
@@ -2211,7 +2211,7 @@ void MystScriptParser::opcode_116(uint16 op, uint16 var, uint16 argc, uint16 *ar
// TODO: Play only 1st half of movie i.e. gears rise up
_vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack), 305, 36);
-
+
bridgeState = 1;
_vm->_varStore->setVar(12, bridgeState);
} else if (bridgeState && currentTime != correctTime) {
@@ -2449,7 +2449,7 @@ void MystScriptParser::opcode_120(uint16 op, uint16 var, uint16 argc, uint16 *ar
// Used for Card 4297 (Generator Puzzle Buttons)
debugC(kDebugScript, "Opcode %d: Toggle Var8 of Invoking Resource", op);
_top = _invokingResource;
-
+
while(_top->_parent != NULL)
_top = _top->_parent;
@@ -2472,7 +2472,7 @@ void MystScriptParser::opcode_121(uint16 op, uint16 var, uint16 argc, uint16 *ar
switch (_vm->getCurStack()) {
case kMystStack:
// Used on Card 4100 (Cabin Safe Buttons)
- // Correct Solution (724) -> Var 67=2, 68=7, 69=5
+ // Correct Solution (724) -> Var 67=2, 68=7, 69=5
// Jump to Card 4103 when solution correct and handle pulled...
if (argc == 0) {
uint16 varValue = _vm->_varStore->getVar(var);
@@ -2779,7 +2779,7 @@ void MystScriptParser::opcode_133(uint16 op, uint16 var, uint16 argc, uint16 *ar
// TODO: Function to change variables controlling telescope view
// etc.
-
+
// TODO: Sound seems to be stuck looping?
_vm->_sound->playSound(soundId);
} else
@@ -3011,7 +3011,7 @@ void MystScriptParser::opcode_199(uint16 op, uint16 var, uint16 argc, uint16 *ar
case kMystStack:
if (argc == 0) {
debugC(kDebugScript, "Opcode %d: Myst Imager Control Execute Button Logic", op);
-
+
uint16 numericSelection = (_vm->_varStore->getVar(36) + 1) % 10;
numericSelection += ((_vm->_varStore->getVar(35) + 1) % 10) * 10;
@@ -3157,7 +3157,7 @@ void MystScriptParser::opcode_200_run() {
break;
case kCreditsStack:
curImageIndex = _vm->_varStore->getVar(g_opcode200Parameters.var);
-
+
if (_vm->_system->getMillis() - g_opcode200Parameters.lastCardTime >= 7 * 1000) {
// After the 6th image has shown, it's time to quit
if (curImageIndex == 7)
@@ -3175,7 +3175,7 @@ void MystScriptParser::opcode_200_run() {
// g_opcode200Parameters.var == 0 for Achenar
// g_opcode200Parameters.var == 1 for Sirrus
- // TODO: Fill in Function...
+ // TODO: Fill in Function...
// Variable indicates that this is related to Secret Panel State
break;
case kDemoStack:
@@ -3201,7 +3201,7 @@ void MystScriptParser::opcode_200_disable() {
g_opcode200Parameters.soundIncrement = 0;
}
-void MystScriptParser::opcode_200(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+void MystScriptParser::opcode_200(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
switch (_vm->getCurStack()) {
case kIntroStack:
varUnusedCheck(op, var);
@@ -3280,7 +3280,7 @@ void MystScriptParser::opcode_200(uint16 op, uint16 var, uint16 argc, uint16 *ar
g_opcode200Parameters.lastCardTime = _vm->_system->getMillis();
g_opcode200Parameters.enabled = true;
- _vm->_varStore->setVar(var, 1);
+ _vm->_varStore->setVar(var, 1);
} else
unknown(op, var, argc, argv);
break;
@@ -3586,7 +3586,7 @@ void MystScriptParser::opcode_202_run(void) {
_vm->_varStore->setVar(7, 1);
} else {
// No water into Valve
- _vm->_varStore->setVar(31, 1); // Background
+ _vm->_varStore->setVar(31, 1); // Background
_vm->_varStore->setVar(7, 0);
}
@@ -3604,7 +3604,7 @@ void MystScriptParser::opcode_202_run(void) {
_vm->_varStore->setVar(4, 1);
} else {
// No water into Valve
- _vm->_varStore->setVar(32, 1); // Background
+ _vm->_varStore->setVar(32, 1); // Background
_vm->_varStore->setVar(4, 0);
}
break;
@@ -3829,10 +3829,10 @@ void MystScriptParser::opcode_204(uint16 op, uint16 var, uint16 argc, uint16 *ar
if (false) {
// Card 4134
_vm->_video->playMovie(_vm->wrapMovieFilename("birds1", kMystStack), 416, 0);
-
+
// Card 4149
_vm->_video->playMovie(_vm->wrapMovieFilename("birds2", kMystStack), 433, 0);
-
+
// Unsure...
_vm->_video->playMovie(_vm->wrapMovieFilename("birds3", kMystStack), 0, 0);
}
@@ -4087,7 +4087,7 @@ static struct {
void MystScriptParser::opcode_209_run(void) {
static bool enabledLast;
-
+
if (g_opcode209Parameters.enabled) {
switch (_vm->getCurStack()) {
case kStoneshipStack:
@@ -4226,7 +4226,7 @@ void MystScriptParser::opcode_210_run(void) {
else {
// Blow Generator Room Breaker...
_vm->_varStore->setVar(93, 1);
- // TODO: I think Logic For Blowing Other Breaker etc.
+ // TODO: I think Logic For Blowing Other Breaker etc.
// is done in process on Breaker Cards.
rocketPowerVoltage = 0;
@@ -4626,7 +4626,7 @@ void MystScriptParser::opcode_298(uint16 op, uint16 var, uint16 argc, uint16 *ar
// TODO: Fill in logic.
// Start Voice Over... which controls book opening
_vm->_sound->playSound(3001);
-
+
// then link to Myst - Trigger of Hotspot? then opcode 199/196/197 for voice over continue?
// TODO: Sync Voice and Actions to Original
// TODO: Flash Library Red
@@ -4670,7 +4670,7 @@ void MystScriptParser::opcode_300(uint16 op, uint16 var, uint16 argc, uint16 *ar
break;
case kDemoPreviewStack:
case kMystStack:
- // Used in Card 4371 (Blue Book) Var = 101
+ // Used in Card 4371 (Blue Book) Var = 101
// and Card 4363 (Red Book) Var = 100
// TODO: Fill in Logic
debugC(kDebugScript, "Opcode %d: Book Exit Function...", op);
diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h
index 16b9a900d3..a996421289 100644
--- a/engines/mohawk/myst_scripts.h
+++ b/engines/mohawk/myst_scripts.h
@@ -40,19 +40,19 @@ class MystScriptParser {
public:
MystScriptParser(MohawkEngine_Myst *vm);
~MystScriptParser();
-
+
void runScript(uint16 scriptCount, MystScriptEntry *scripts, MystResource* invokingResource = NULL);
void runOpcode(uint16 op, uint16 var = 0, uint16 argc = 0, uint16 *argv = NULL);
const char *getOpcodeDesc(uint16 op);
-
+
void disableInitOpcodes();
void runPersistentOpcodes();
private:
MohawkEngine_Myst *_vm;
-
+
typedef void (MystScriptParser::*OpcodeProcMyst)(uint16 op, uint16 var, uint16 argc, uint16* argv);
-
+
struct MystOpcode {
uint16 op;
OpcodeProcMyst proc;
diff --git a/engines/mohawk/myst_vars.cpp b/engines/mohawk/myst_vars.cpp
index f496b52487..edb5295809 100644
--- a/engines/mohawk/myst_vars.cpp
+++ b/engines/mohawk/myst_vars.cpp
@@ -50,12 +50,12 @@ MystVarEntry introVars[] = {
MystVarEntry seleniticVars[] = {
{ 0, 0, "Sound Pickup At Windy Tunnel" }, // 0 to 1 // TODO: Multiple Uses of Var 0?
- { 1, 0, "Sound Pickup At Volcanic Crack" }, // 0 to 1
- { 2, 0, "Sound Pickup At Clock" }, // 0 to 1
- { 3, 0, "Sound Pickup At Water Pool" }, // 0 to 1
- { 4, 0, "Sound Pickup At Crystal Rocks" }, // 0 to 1
- { 5, 0, "Sound Receiver Doors" }, // 0 to 1
- { 6, 0, "Windy Tunnel Lights" }, // 0 to 1
+ { 1, 0, "Sound Pickup At Volcanic Crack" }, // 0 to 1
+ { 2, 0, "Sound Pickup At Clock" }, // 0 to 1
+ { 3, 0, "Sound Pickup At Water Pool" }, // 0 to 1
+ { 4, 0, "Sound Pickup At Crystal Rocks" }, // 0 to 1
+ { 5, 0, "Sound Receiver Doors" }, // 0 to 1
+ { 6, 0, "Windy Tunnel Lights" }, // 0 to 1
{ 7, 0, "Maze Runner Porthole View" }, // 0 to 3
{ 8, 0, "Sound Receiver Screen (Control Variable?)" },
{ 9, 0, "Sound Receiver Water Pool Button Selected" },
@@ -309,8 +309,8 @@ MystVarEntry channelwoodVars[] = {
{ 5, 0, "Lower Walkway to Upper Walkway Spiral Stair Lower Door Open" }, // 0 to 1
{ 6, 0, "Pipe Bridge Extended" }, // 0 to 1
{ 7, 0, "Bridge Pump Running" }, // 0 to 1
- { 8, 0, "Water Tank Valve State" }, // 0 to 1
- { 9, 0, "First Water Valve State" }, // 0 to 1
+ { 8, 0, "Water Tank Valve State" }, // 0 to 1
+ { 9, 0, "First Water Valve State" }, // 0 to 1
{ 10, 0, "Second (L) Water Valve State" }, // 0 to 1
{ 11, 0, "Third (L, R) Water Valve State" }, // 0 to 1
{ 12, 0, "Fourth (L, R, R) Water Valve State" }, // 0 to 1
@@ -365,7 +365,7 @@ uint16 MystVar::saveGetVar(uint16 stack, uint16 v) {
MystVarEntry unknownVar = { v, 0, "Unknown" };
const char *desc = NULL;
uint16 i;
-
+
switch (stack) {
case kIntroStack:
for (i = 0; i < ARRAYSIZE(introVars); i++) {
@@ -443,7 +443,7 @@ uint16 MystVar::saveGetVar(uint16 stack, uint16 v) {
default:
break;
}
-
+
if (desc == NULL) {
for (i = 0; i < _unknown.size(); i++) {
if (_unknown[i].refNum == v) {
@@ -454,7 +454,7 @@ uint16 MystVar::saveGetVar(uint16 stack, uint16 v) {
}
if (desc == NULL) {
- warning("MystVar::getVar(%d): Unknown variable reference", v);
+ warning("MystVar::getVar(%d): Unknown variable reference", v);
_unknown.push_back(unknownVar);
desc = _unknown.back().description;
}
@@ -469,7 +469,7 @@ void MystVar::loadSetVar(uint16 stack, uint16 v, uint16 value) {
const char *desc = NULL;
MystVarEntry unknownVar = { v, value, "Unknown" };
uint16 i;
-
+
switch (stack) {
case kIntroStack:
for (i = 0; i < ARRAYSIZE(introVars); i++) {
diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp
index 8ee8310e9c..63f632de5f 100644
--- a/engines/mohawk/resource.cpp
+++ b/engines/mohawk/resource.cpp
@@ -41,15 +41,15 @@ void MohawkArchive::open(Common::String filename) {
error ("Could not open file \'%s\'", filename.c_str());
_curFile = filename;
-
+
open(file);
}
void MohawkArchive::close() {
- delete _mhk; _mhk = NULL;
+ delete _mhk; _mhk = NULL;
delete[] _types; _types = NULL;
delete[] _fileTable; _fileTable = NULL;
-
+
_curFile.clear();
}
@@ -76,7 +76,7 @@ void MohawkArchive::open(Common::SeekableReadStream *stream) {
/////////////////////////////////
//Resource Dir
- /////////////////////////////////
+ /////////////////////////////////
// Type Table
_mhk->seek(_rsrc.abs_offset);
@@ -110,7 +110,7 @@ void MohawkArchive::open(Common::SeekableReadStream *stream) {
_types[i].resTable.entries[j].id = _mhk->readUint16BE();
_types[i].resTable.entries[j].index = _mhk->readUint16BE();
- debug (4, "Entry[%02x]: ID = %04x (%d) Index = %04x", j, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].index);
+ debug (4, "Entry[%02x]: ID = %04x (%d) Index = %04x", j, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].index);
}
// Name Table
@@ -158,7 +158,7 @@ void MohawkArchive::open(Common::SeekableReadStream *stream) {
_fileTable[i].dataSize += _mhk->readByte() << 16; // Get bits 15-24 of dataSize too
_fileTable[i].flags = _mhk->readByte();
_fileTable[i].unk = _mhk->readUint16BE();
-
+
// Add in another 3 bits for file size from the flags.
// The flags are useless to us except for doing this ;)
_fileTable[i].dataSize += (_fileTable[i].flags & 7) << 24;
@@ -187,7 +187,7 @@ uint32 MohawkArchive::getOffset(uint32 tag, uint16 id) {
int16 idIndex = getIdIndex(typeIndex, id);
assert(idIndex >= 0);
-
+
return _fileTable[_types[typeIndex].resTable.entries[idIndex].index - 1].offset;
}
@@ -207,7 +207,7 @@ Common::SeekableReadStream *MohawkArchive::getRawData(uint32 tag, uint16 id) {
// Note: the fileTableIndex is based off 1, not 0. So, subtract 1
uint16 fileTableIndex = _types[typeIndex].resTable.entries[idIndex].index - 1;
-
+
// WORKAROUND: tMOV resources pretty much ignore the size part of the file table,
// as the original just passed the full Mohawk file to QuickTime and the offset.
// We need to do this because of the way Mohawk is set up (this is much more "proper"
@@ -218,55 +218,55 @@ Common::SeekableReadStream *MohawkArchive::getRawData(uint32 tag, uint16 id) {
else
return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex + 1].offset);
}
-
+
return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex].offset + _fileTable[fileTableIndex].dataSize);
}
void LivingBooksArchive_v1::open(Common::SeekableReadStream *stream) {
close();
_mhk = stream;
-
+
// This is for the "old" Mohawk resource format used in some older
// Living Books. It is very similar, just missing the MHWK tag and
// some other minor differences, especially with the file table
// being merged into the resource table.
-
+
uint32 headerSize = _mhk->readUint32BE();
-
+
// NOTE: There are differences besides endianness! (Subtle changes,
// but different).
-
+
if (headerSize == 6) { // We're in Big Endian mode (Macintosh)
_mhk->readUint16BE(); // Resource Table Size
_typeTable.resource_types = _mhk->readUint16BE();
_types = new OldType[_typeTable.resource_types];
-
+
debug (0, "Old Mohawk File (Macintosh): Number of Resource Types = %04x", _typeTable.resource_types);
-
+
for (uint16 i = 0; i < _typeTable.resource_types; i++) {
_types[i].tag = _mhk->readUint32BE();
_types[i].resource_table_offset = (uint16)_mhk->readUint32BE() + 6;
_mhk->readUint32BE(); // Unknown (always 0?)
-
+
debug (3, "Type[%02d]: Tag = \'%s\' ResTable Offset = %04x", i, tag2str(_types[i].tag), _types[i].resource_table_offset);
uint32 oldPos = _mhk->pos();
-
+
// Resource Table/File Table
_mhk->seek(_types[i].resource_table_offset);
_types[i].resTable.resources = _mhk->readUint16BE();
_types[i].resTable.entries = new OldType::ResourceTable::Entries[_types[i].resTable.resources];
-
+
for (uint16 j = 0; j < _types[i].resTable.resources; j++) {
_types[i].resTable.entries[j].id = _mhk->readUint16BE();
_types[i].resTable.entries[j].offset = _mhk->readUint32BE();
_types[i].resTable.entries[j].size = _mhk->readByte() << 16;
_types[i].resTable.entries[j].size += _mhk->readUint16BE();
_mhk->skip(5); // Unknown (always 0?)
-
+
debug (4, "Entry[%02x]: ID = %04x (%d)\tOffset = %08x, Size = %08x", j, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].offset, _types[i].resTable.entries[j].size);
}
-
+
_mhk->seek(oldPos);
debug (3, "\n");
}
@@ -274,32 +274,32 @@ void LivingBooksArchive_v1::open(Common::SeekableReadStream *stream) {
_mhk->readUint16LE(); // Resource Table Size
_typeTable.resource_types = _mhk->readUint16LE();
_types = new OldType[_typeTable.resource_types];
-
+
debug (0, "Old Mohawk File (Windows): Number of Resource Types = %04x", _typeTable.resource_types);
-
+
for (uint16 i = 0; i < _typeTable.resource_types; i++) {
_types[i].tag = _mhk->readUint32LE();
_types[i].resource_table_offset = _mhk->readUint16LE() + 6;
_mhk->readUint16LE(); // Unknown (always 0?)
-
+
debug (3, "Type[%02d]: Tag = \'%s\' ResTable Offset = %04x", i, tag2str(_types[i].tag), _types[i].resource_table_offset);
-
+
uint32 oldPos = _mhk->pos();
-
+
// Resource Table/File Table
_mhk->seek(_types[i].resource_table_offset);
_types[i].resTable.resources = _mhk->readUint16LE();
_types[i].resTable.entries = new OldType::ResourceTable::Entries[_types[i].resTable.resources];
-
+
for (uint16 j = 0; j < _types[i].resTable.resources; j++) {
_types[i].resTable.entries[j].id = _mhk->readUint16LE();
_types[i].resTable.entries[j].offset = _mhk->readUint32LE();
_types[i].resTable.entries[j].size = _mhk->readUint16LE();
_mhk->readUint32LE(); // Unknown (always 0?)
-
- debug (4, "Entry[%02x]: ID = %04x (%d)\tOffset = %08x, Size = %08x", j, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].offset, _types[i].resTable.entries[j].size);
+
+ debug (4, "Entry[%02x]: ID = %04x (%d)\tOffset = %08x, Size = %08x", j, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].offset, _types[i].resTable.entries[j].size);
}
-
+
_mhk->seek(oldPos);
debug (3, "\n");
}
@@ -316,7 +316,7 @@ uint32 LivingBooksArchive_v1::getOffset(uint32 tag, uint16 id) {
int16 idIndex = getIdIndex(typeIndex, id);
assert(idIndex >= 0);
-
+
return _types[typeIndex].resTable.entries[idIndex].offset;
}
diff --git a/engines/mohawk/resource.h b/engines/mohawk/resource.h
index 1bb47ef1fd..6b32a32b8e 100644
--- a/engines/mohawk/resource.h
+++ b/engines/mohawk/resource.h
@@ -140,7 +140,7 @@ struct Type {
uint32 tag;
uint16 resource_table_offset;
uint16 name_table_offset;
-
+
struct ResourceTable {
uint16 resources;
struct Entries {
@@ -148,7 +148,7 @@ struct Type {
uint16 index;
} *entries;
} resTable;
-
+
struct NameTable {
uint16 num;
struct Entries {
@@ -177,11 +177,11 @@ class MohawkArchive {
public:
MohawkArchive();
virtual ~MohawkArchive() { close(); }
-
+
void open(Common::String filename);
virtual void open(Common::SeekableReadStream *stream);
void close();
-
+
bool hasResource(uint32 tag, uint16 id);
virtual Common::SeekableReadStream *getRawData(uint32 tag, uint16 id);
virtual uint32 getOffset(uint32 tag, uint16 id);
@@ -190,7 +190,7 @@ protected:
Common::SeekableReadStream *_mhk;
TypeTable _typeTable;
Common::String _curFile;
-
+
private:
bool _hasData;
uint32 _fileSize;
@@ -220,11 +220,11 @@ class LivingBooksArchive_v1 : public MohawkArchive {
public:
LivingBooksArchive_v1() : MohawkArchive() {}
~LivingBooksArchive_v1() {}
-
+
void open(Common::SeekableReadStream *stream);
Common::SeekableReadStream *getRawData(uint32 tag, uint16 id);
uint32 getOffset(uint32 tag, uint16 id);
-
+
private:
struct OldType {
uint32 tag;
@@ -238,14 +238,14 @@ private:
} *entries;
} resTable;
} *_types;
-
+
int16 getTypeIndex(uint32 tag) {
for (uint16 i = 0; i < _typeTable.resource_types; i++)
if (_types[i].tag == tag)
return i;
return -1; // not found
}
-
+
int16 getIdIndex(int16 typeIndex, uint16 id) {
for (uint16 i = 0; i < _types[typeIndex].resTable.resources; i++)
if (_types[typeIndex].resTable.entries[i].id == id)
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 7b6565c58e..292d2d740a 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -22,10 +22,10 @@
* $Id$
*
*/
-
+
#include "common/config-manager.h"
#include "common/events.h"
-#include "common/keyboard.h"
+#include "common/keyboard.h"
#include "mohawk/graphics.h"
#include "mohawk/riven.h"
@@ -114,13 +114,13 @@ Common::Error MohawkEngine_Riven::run() {
case Common::EVENT_MOUSEMOVE:
_mousePos = event.mouse;
checkHotspotChange();
-
+
// Check to show the inventory
if (_mousePos.y >= 392)
_gfx->showInventory();
else
_gfx->hideInventory();
-
+
needsUpdate = true;
break;
case Common::EVENT_LBUTTONDOWN:
@@ -189,7 +189,7 @@ Common::Error MohawkEngine_Riven::run() {
changeToCard(12);
_eventMan->resetRTL();
continue;
- }
+ }
return Common::kNoError;
}
@@ -215,7 +215,7 @@ void MohawkEngine_Riven::changeToStack(uint16 n) {
// Don't change stack to the current stack (if the files are loaded)
if (_curStack == n && !_mhk.empty())
return;
-
+
_curStack = n;
// Clear the old stack files out
@@ -225,7 +225,7 @@ void MohawkEngine_Riven::changeToStack(uint16 n) {
// Get the prefix character for the destination stack
char prefix = getStackName(_curStack)[0];
-
+
// Load any file that fits the patterns
for (int i = 0; i < ARRAYSIZE(endings); i++) {
Common::String filename = Common::String(prefix) + endings[i];
@@ -235,11 +235,11 @@ void MohawkEngine_Riven::changeToStack(uint16 n) {
_mhk.push_back(mhk);
}
}
-
+
// Make sure we have loaded files
if (_mhk.empty())
error("Could not load stack %s", getStackName(_curStack).c_str());
-
+
// Stop any currently playing sounds and load the new sound file too
_sound->stopAllSLST();
_sound->loadRivenSounds(_curStack);
@@ -289,30 +289,30 @@ void MohawkEngine_Riven::changeToCard(uint16 n) {
loadCard(_curCard);
}
-
+
// We need to reload hotspots when refreshing, however
loadHotspots(_curCard);
-
+
_gfx->_updatesEnabled = true;
_gfx->clearWaterEffects();
_gfx->_activatedPLSTs.clear();
_video->_mlstRecords.clear();
_gfx->drawPLST(1);
_activatedSLST = false;
-
+
runCardScript(kCardLoadScript);
_gfx->updateScreen();
runCardScript(kCardOpenScript);
-
+
// Activate the first sound list if none have been activated
if (!_activatedSLST)
_sound->playSLST(1, _curCard);
-
+
if (_showHotspots) {
for (uint16 i = 0; i < _hotspotCount; i++)
_gfx->drawRect(_hotspots[i].rect, _hotspots[i].enabled);
}
-
+
// Now we need to redraw the cursor if necessary and handle mouse over scripts
_curHotspot = -1;
checkHotspotChange();
@@ -356,12 +356,12 @@ void MohawkEngine_Riven::loadHotspots(uint16 id) {
_hotspots[i].blstID = inStream->readUint16BE();
_hotspots[i].name_resource = inStream->readSint16BE();
-
+
int16 left = inStream->readSint16BE();
int16 top = inStream->readSint16BE();
int16 right = inStream->readSint16BE();
int16 bottom = inStream->readSint16BE();
-
+
// Riven has some weird hotspots, disable them here
if (left >= right || top >= bottom) {
left = top = right = bottom = 0;
@@ -369,7 +369,7 @@ void MohawkEngine_Riven::loadHotspots(uint16 id) {
}
_hotspots[i].rect = Common::Rect(left, top, right, bottom);
-
+
_hotspots[i].u0 = inStream->readUint16BE();
if (_hotspots[i].u0 != 0)
@@ -383,7 +383,7 @@ void MohawkEngine_Riven::loadHotspots(uint16 id) {
warning("Hotspot %d u1 not -1", i);
_hotspots[i].zipModeHotspot = inStream->readUint16BE();
-
+
// Read in the scripts now
_hotspots[i].scripts = RivenScript::readScripts(this, inStream);
}
@@ -425,7 +425,7 @@ void MohawkEngine_Riven::checkHotspotChange() {
foundHotspot = true;
hotspotIndex = i;
}
-
+
if (foundHotspot) {
if (_curHotspot != hotspotIndex) {
_curHotspot = hotspotIndex;
@@ -439,7 +439,7 @@ void MohawkEngine_Riven::checkHotspotChange() {
Common::String MohawkEngine_Riven::getHotspotName(uint16 hotspot) {
assert(hotspot < _hotspotCount);
-
+
if (_hotspots[hotspot].name_resource < 0)
return Common::String();
@@ -450,19 +450,19 @@ void MohawkEngine_Riven::checkInventoryClick() {
// Don't even bother. We're not in the inventory portion of the screen.
if (_mousePos.y < 392)
return;
-
+
// No inventory in the demo or opening screens.
if (getFeatures() & GF_DEMO || _curStack == aspit)
return;
-
+
// Set the return stack/card id's.
*matchVarToString("returnstackid") = _curStack;
*matchVarToString("returncardid") = _curCard;
-
+
// See RivenGraphics::showInventory() for an explanation
// of why only this variable is used.
bool hasCathBook = *matchVarToString("acathbook") != 0;
-
+
// Go to the book if a hotspot contains the mouse
if (!hasCathBook) {
if (atrusJournalRectSolo.contains(_mousePos)) {
@@ -503,7 +503,7 @@ Common::String MohawkEngine_Riven::getName(uint16 nameResource, uint16 nameID) {
stringOffsets[i] = nameStream->readUint16BE();
for (uint16 i = 0; i < fieldCount; i++)
nameStream->readUint16BE(); // Skip unknown values
-
+
nameStream->seek(stringOffsets[nameID], SEEK_CUR);
c = (char)nameStream->readByte();
@@ -573,9 +573,9 @@ Common::Error MohawkEngine_Riven::loadGameState(int slot) {
Common::Error MohawkEngine_Riven::saveGameState(int slot, const char *desc) {
Common::StringList saveList = _saveLoad->generateSaveGameList();
- if ((uint)slot < saveList.size())
+ if ((uint)slot < saveList.size())
_saveLoad->deleteSave(saveList[slot]);
-
+
return _saveLoad->saveGame(Common::String(desc)) ? Common::kNoError : Common::kUnknownError;
}
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 9a98b05ebc..9cb43ebe9d 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -22,7 +22,7 @@
* $Id$
*
*/
-
+
#ifndef MOHAWK_RIVEN_H
#define MOHAWK_RIVEN_H
@@ -80,7 +80,7 @@ struct RivenHotspot {
int16 u1;
int16 zipModeHotspot;
RivenScriptList scripts;
-
+
bool enabled;
};
@@ -96,7 +96,7 @@ struct ZipMode {
uint16 id;
bool operator== (const ZipMode& z) const;
};
-
+
class MohawkEngine_Riven : public MohawkEngine {
protected:
Common::Error run();
@@ -104,15 +104,15 @@ protected:
public:
MohawkEngine_Riven(OSystem *syst, const MohawkGameDescription *gamedesc);
virtual ~MohawkEngine_Riven();
-
+
RivenGraphics *_gfx;
RivenExternal *_externalScriptHandler;
Card _cardData;
bool _gameOver;
-
+
GUI::Debugger *getDebugger();
-
+
bool canLoadGameStateCurrently() { return true; }
bool canSaveGameStateCurrently() { return true; }
Common::Error loadGameState(int slot);
@@ -138,7 +138,7 @@ private:
void checkInventoryClick();
bool _showHotspots;
void updateZipMode();
-
+
// Variables
uint32 *_vars;
uint32 _varCount;
@@ -147,7 +147,7 @@ public:
Common::SeekableReadStream *getExtrasResource(uint32 tag, uint16 id);
bool _activatedSLST;
void runLoadDialog();
-
+
void changeToCard(uint16 = 0);
void changeToStack(uint16);
Common::String getName(uint16 nameResource, uint16 nameID);
@@ -167,7 +167,7 @@ public:
void runHotspotScript(uint16 hotspot, uint16 scriptType);
int32 getCurHotspot() { return _curHotspot; }
Common::String getHotspotName(uint16 hotspot);
-
+
void initVars();
uint32 getVarCount() { return _varCount; }
uint32 getGlobalVar(uint32 index);
diff --git a/engines/mohawk/riven_cursors.h b/engines/mohawk/riven_cursors.h
index 4120aca41b..7deaf9c33c 100644
--- a/engines/mohawk/riven_cursors.h
+++ b/engines/mohawk/riven_cursors.h
@@ -120,7 +120,7 @@ static const byte grabbingHandCursor[] = {
0, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 1, 0,
0, 0, 1, 2, 2, 2, 2, 2, 4, 3, 1, 0, 0,
0, 0, 0, 1, 2, 2, 2, 2, 4, 3, 1, 0, 0,
- 0, 0, 0, 1, 2, 2, 2, 2, 4, 3, 1, 0, 0
+ 0, 0, 0, 1, 2, 2, 2, 2, 4, 3, 1, 0, 0
};
@@ -177,7 +177,7 @@ static const byte pointingLeftCursor[] = {
0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 4, 2, 4,
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 4, 4, 1,
0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0
+ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0
};
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index da8040dc67..4ee1c19f9a 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -22,7 +22,7 @@
* $Id$
*
*/
-
+
#include "mohawk/graphics.h"
#include "mohawk/riven.h"
#include "mohawk/riven_external.h"
@@ -31,7 +31,7 @@
#include "common/EventRecorder.h"
#include "gui/message.h"
-
+
namespace Mohawk {
RivenExternal::RivenExternal(MohawkEngine_Riven *vm) : _vm(vm) {
@@ -42,10 +42,10 @@ RivenExternal::RivenExternal(MohawkEngine_Riven *vm) : _vm(vm) {
RivenExternal::~RivenExternal() {
delete _rnd;
-
+
for (uint32 i = 0; i < _externalCommands.size(); i++)
delete _externalCommands[i];
-
+
_externalCommands.clear();
}
@@ -150,7 +150,7 @@ void RivenExternal::setupCommands() {
COMMAND(xogehnbookprevpage);
COMMAND(xogehnbooknextpage);
COMMAND(xgwatch);
-
+
// pspit (Prison Island) external commands
COMMAND(xpisland990_elevcombo);
COMMAND(xpscpbtn);
@@ -185,21 +185,21 @@ void RivenExternal::setupCommands() {
COMMAND(xtisland5056_slidermd);
COMMAND(xtisland5056_slidermw);
COMMAND(xtatboundary);
-
+
// Common external commands
COMMAND(xflies);
}
void RivenExternal::runCommand(uint16 argc, uint16 *argv) {
Common::String externalCommandName = _vm->getName(ExternalCommandNames, argv[0]);
-
+
for (uint16 i = 0; i < _externalCommands.size(); i++)
if (externalCommandName == _externalCommands[i]->desc) {
debug(0, "Running Riven External Command \'%s\'", externalCommandName.c_str());
(this->*(_externalCommands[i]->proc)) (argv[1], argv[1] ? argv + 2 : NULL);
return;
}
-
+
error("Unknown external command \'%s\'", externalCommandName.c_str());
}
@@ -212,7 +212,7 @@ void RivenExternal::runDemoBoundaryDialog() {
void RivenExternal::runEndGame(uint16 video) {
_vm->_sound->stopAllSLST();
_vm->_video->playMovieBlocking(video);
-
+
// TODO: Play until the last frame and then run the credits
_vm->_gameOver = true;
}
@@ -234,7 +234,7 @@ void RivenExternal::xasetupcomplete(uint16 argc, uint16 *argv) {
void RivenExternal::xaatrusopenbook(uint16 argc, uint16 *argv) {
// Get the variable
uint32 page = *_vm->matchVarToString("aatruspage");
-
+
// Set hotspots depending on the page
if (page == 1) {
_vm->_hotspots[1].enabled = false;
@@ -245,7 +245,7 @@ void RivenExternal::xaatrusopenbook(uint16 argc, uint16 *argv) {
_vm->_hotspots[2].enabled = true;
_vm->_hotspots[3].enabled = false;
}
-
+
// Draw the image of the page
_vm->_gfx->drawPLST(page);
}
@@ -259,14 +259,14 @@ void RivenExternal::xaatrusbookback(uint16 argc, uint16 *argv) {
void RivenExternal::xaatrusbookprevpage(uint16 argc, uint16 *argv) {
// Get the page variable
uint32 *page = _vm->matchVarToString("aatruspage");
-
+
// Decrement the page if it's not the first page
if (*page == 1)
return;
(*page)--;
-
+
// TODO: Play the page turning sound
-
+
// Now update the screen :)
_vm->_gfx->updateScreen();
}
@@ -274,14 +274,14 @@ void RivenExternal::xaatrusbookprevpage(uint16 argc, uint16 *argv) {
void RivenExternal::xaatrusbooknextpage(uint16 argc, uint16 *argv) {
// Get the page variable
uint32 *page = _vm->matchVarToString("aatruspage");
-
+
// Increment the page if it's not the last page
if (((_vm->getFeatures() & GF_DEMO) && *page == 6) || *page == 10)
return;
(*page)++;
-
+
// TODO: Play the page turning sound
-
+
// Now update the screen :)
_vm->_gfx->updateScreen();
}
@@ -300,16 +300,16 @@ void RivenExternal::xacathopenbook(uint16 argc, uint16 *argv) {
_vm->_hotspots[2].enabled = true;
_vm->_hotspots[3].enabled = false;
}
-
+
// Draw the image of the page
_vm->_gfx->drawPLST(page);
-
+
// Draw the white page edges
if (page > 1 && page < 5)
_vm->_gfx->drawPLST(50);
else if (page > 5)
_vm->_gfx->drawPLST(51);
-
+
if (page == 28) {
// TODO: Draw telescope combination
}
@@ -324,12 +324,12 @@ void RivenExternal::xacathbookback(uint16 argc, uint16 *argv) {
void RivenExternal::xacathbookprevpage(uint16 argc, uint16 *argv) {
// Get the variable
uint32 *page = _vm->matchVarToString("acathpage");
-
+
// Increment the page if it's not the first page
if (*page == 1)
return;
(*page)--;
-
+
// TODO: Play the page turning sound
// Now update the screen :)
@@ -339,14 +339,14 @@ void RivenExternal::xacathbookprevpage(uint16 argc, uint16 *argv) {
void RivenExternal::xacathbooknextpage(uint16 argc, uint16 *argv) {
// Get the variable
uint32 *page = _vm->matchVarToString("acathpage");
-
+
// Increment the page if it's not the last page
if (*page == 49)
return;
(*page)++;
-
+
// TODO: Play the page turning sound
-
+
// Now update the screen :)
_vm->_gfx->updateScreen();
}
@@ -410,7 +410,7 @@ void RivenExternal::xblabopenbook(uint16 argc, uint16 *argv) {
// Draw the image of the page based on the blabbook variable
_vm->_gfx->drawPLST(page);
-
+
// TODO: Draw the dome combo
if (page == 14) {
warning ("Need to draw dome combo");
@@ -420,12 +420,12 @@ void RivenExternal::xblabopenbook(uint16 argc, uint16 *argv) {
void RivenExternal::xblabbookprevpage(uint16 argc, uint16 *argv) {
// Get the page variable
uint32 *page = _vm->matchVarToString("blabbook");
-
+
// Decrement the page if it's not the first page
if (*page == 1)
return;
(*page)--;
-
+
// Now update the screen :)
_vm->_gfx->updateScreen();
}
@@ -433,12 +433,12 @@ void RivenExternal::xblabbookprevpage(uint16 argc, uint16 *argv) {
void RivenExternal::xblabbooknextpage(uint16 argc, uint16 *argv) {
// Get the page variable
uint32 *page = _vm->matchVarToString("blabbook");
-
+
// Increment the page if it's not the last page
if (*page == 22)
return;
(*page)++;
-
+
// Now update the screen :)
_vm->_gfx->updateScreen();
}
@@ -446,7 +446,7 @@ void RivenExternal::xblabbooknextpage(uint16 argc, uint16 *argv) {
void RivenExternal::xsoundplug(uint16 argc, uint16 *argv) {
uint32 heat = *_vm->matchVarToString("bheat");
uint32 boilerInactive = *_vm->matchVarToString("bcratergg");
-
+
if (heat != 0)
_vm->_sound->playSLST(1, _vm->getCurCard());
else if (boilerInactive != 0)
@@ -492,7 +492,7 @@ void RivenExternal::xbchangeboiler(uint16 argc, uint16 *argv) {
} else if (argv[0] == 3) {
if (platform == 0) {
if (water == 0) {
- _vm->_video->activateMLST(11, _vm->getCurCard());
+ _vm->_video->activateMLST(11, _vm->getCurCard());
} else {
if (heat == 0)
_vm->_video->activateMLST(17, _vm->getCurCard());
@@ -501,7 +501,7 @@ void RivenExternal::xbchangeboiler(uint16 argc, uint16 *argv) {
}
} else {
if (water == 0) {
- _vm->_video->activateMLST(9, _vm->getCurCard());
+ _vm->_video->activateMLST(9, _vm->getCurCard());
} else {
if (heat == 0)
_vm->_video->activateMLST(14, _vm->getCurCard());
@@ -510,19 +510,19 @@ void RivenExternal::xbchangeboiler(uint16 argc, uint16 *argv) {
}
}
}
-
+
if (argc > 1)
_vm->_sound->playSLST(argv[1], _vm->getCurCard());
else if (argv[0] == 2)
_vm->_sound->playSLST(1, _vm->getCurCard());
-
+
_vm->_video->playMovie(11);
}
void RivenExternal::xbupdateboiler(uint16 argc, uint16 *argv) {
uint32 heat = *_vm->matchVarToString("bheat");
uint32 platform = *_vm->matchVarToString("bblrgrt");
-
+
if (heat) {
if (platform == 0) {
_vm->_video->activateMLST(7, _vm->getCurCard());
@@ -534,7 +534,7 @@ void RivenExternal::xbupdateboiler(uint16 argc, uint16 *argv) {
} else {
// TODO: Stop MLST's 7 and 8
}
-
+
_vm->changeToCard();
}
@@ -546,10 +546,10 @@ void RivenExternal::xbcheckcatch(uint16 argc, uint16 *argv) {
// TODO: Check if we've caught a Ytram
}
-void RivenExternal::xbait(uint16 argc, uint16 *argv) {
+void RivenExternal::xbait(uint16 argc, uint16 *argv) {
// Set the cursor to the pellet
_vm->_gfx->changeCursor(kRivenPelletCursor);
-
+
// Loop until the player lets go (or quits)
Common::Event event;
bool mouseDown = true;
@@ -562,13 +562,13 @@ void RivenExternal::xbait(uint16 argc, uint16 *argv) {
else if (event.type == Common::EVENT_QUIT || event.type == Common::EVENT_RTL)
return;
}
-
+
_vm->_system->delayMillis(10); // Take it easy on the CPU
}
-
+
// Set back the cursor
_vm->_gfx->changeCursor(kRivenMainCursor);
-
+
// Set the bait if we put it on the plate
if (_vm->_hotspots[9].rect.contains(_vm->_system->getEventManager()->getMousePos())) {
*_vm->matchVarToString("bbait") = 1;
@@ -588,7 +588,7 @@ void RivenExternal::xbaitplate(uint16 argc, uint16 *argv) {
_vm->_gfx->drawPLST(3);
_vm->_gfx->updateScreen();
_vm->_gfx->changeCursor(kRivenPelletCursor);
-
+
// Loop until the player lets go (or quits)
Common::Event event;
bool mouseDown = true;
@@ -601,13 +601,13 @@ void RivenExternal::xbaitplate(uint16 argc, uint16 *argv) {
else if (event.type == Common::EVENT_QUIT || event.type == Common::EVENT_RTL)
return;
}
-
+
_vm->_system->delayMillis(10); // Take it easy on the CPU
}
-
+
// Set back the cursor
_vm->_gfx->changeCursor(kRivenMainCursor);
-
+
// Set the bait if we put it on the plate, remove otherwise
if (_vm->_hotspots[9].rect.contains(_vm->_system->getEventManager()->getMousePos())) {
*_vm->matchVarToString("bbait") = 1;
@@ -649,15 +649,15 @@ void RivenExternal::xbisland_domecheck(uint16 argc, uint16 *argv) {
void RivenExternal::xvalvecontrol(uint16 argc, uint16 *argv) {
// Get the variable for the valve
uint32 *valve = _vm->matchVarToString("bvalve");
-
+
Common::Event event;
int changeX = 0;
int changeY = 0;
-
+
// Set the cursor to the closed position
_vm->_gfx->changeCursor(2004);
_vm->_system->updateScreen();
-
+
for (;;) {
while (_vm->_system->getEventManager()->pollEvent(event)) {
switch (event.type) {
@@ -814,7 +814,7 @@ static byte countDepressedIcons(uint32 iconOrderVar) {
else if (iconOrderVar >= (1 << 1))
return 1;
else
- return 0;
+ return 0;
}
void RivenExternal::xicon(uint16 argc, uint16 *argv) {
@@ -843,7 +843,7 @@ void RivenExternal::xtoggleicon(uint16 argc, uint16 *argv) {
// Get the variables
uint32 *iconsDepressed = _vm->matchVarToString("jicons");
uint32 *iconOrderVar = _vm->matchVarToString("jiconorder");
-
+
if (*iconsDepressed & (1 << (argv[0] - 1))) {
// The icon is depressed, now unpress it
*iconsDepressed &= ~(1 << (argv[0] - 1));
@@ -853,7 +853,7 @@ void RivenExternal::xtoggleicon(uint16 argc, uint16 *argv) {
*iconsDepressed |= 1 << (argv[0] - 1);
*iconOrderVar = (*iconOrderVar << 5) + argv[0];
}
-
+
// Check if the puzzle is complete now and assign 1 to jrbook if the puzzle is complete.
if (*iconOrderVar == *_vm->matchVarToString("jiconcorrectorder"))
*_vm->matchVarToString("jrbook") = 1;
@@ -862,7 +862,7 @@ void RivenExternal::xtoggleicon(uint16 argc, uint16 *argv) {
void RivenExternal::xjtunnel103_pictfix(uint16 argc, uint16 *argv) {
// Get the jicons variable which contains which of the stones are depressed in the rebel tunnel puzzle
uint32 iconsDepressed = *_vm->matchVarToString("jicons");
-
+
// Now, draw which icons are depressed based on the bits of the variable
if (iconsDepressed & (1 << 0))
_vm->_gfx->drawPLST(2);
@@ -883,7 +883,7 @@ void RivenExternal::xjtunnel103_pictfix(uint16 argc, uint16 *argv) {
void RivenExternal::xjtunnel104_pictfix(uint16 argc, uint16 *argv) {
// Get the jicons variable which contains which of the stones are depressed in the rebel tunnel puzzle
uint32 iconsDepressed = *_vm->matchVarToString("jicons");
-
+
// Now, draw which icons are depressed based on the bits of the variable
if (iconsDepressed & (1 << 9))
_vm->_gfx->drawPLST(2);
@@ -906,7 +906,7 @@ void RivenExternal::xjtunnel104_pictfix(uint16 argc, uint16 *argv) {
void RivenExternal::xjtunnel105_pictfix(uint16 argc, uint16 *argv) {
// Get the jicons variable which contains which of the stones are depressed in the rebel tunnel puzzle
uint32 iconsDepressed = *_vm->matchVarToString("jicons");
-
+
// Now, draw which icons are depressed based on the bits of the variable
if (iconsDepressed & (1 << 3))
_vm->_gfx->drawPLST(2);
@@ -927,7 +927,7 @@ void RivenExternal::xjtunnel105_pictfix(uint16 argc, uint16 *argv) {
void RivenExternal::xjtunnel106_pictfix(uint16 argc, uint16 *argv) {
// Get the jicons variable which contains which of the stones are depressed in the rebel tunnel puzzle
uint32 iconsDepressed = *_vm->matchVarToString("jicons");
-
+
// Now, draw which icons are depressed based on the bits of the variable
if (iconsDepressed & (1 << 16))
_vm->_gfx->drawPLST(2);
@@ -949,7 +949,7 @@ void RivenExternal::xjtunnel106_pictfix(uint16 argc, uint16 *argv) {
void RivenExternal::xvga1300_carriage(uint16 argc, uint16 *argv) {
// TODO: This function is supposed to do a lot more, something like this (pseudocode):
-
+
// Show level pull movie
// Set transition up
// Change to up card
@@ -970,8 +970,8 @@ void RivenExternal::xvga1300_carriage(uint16 argc, uint16 *argv) {
// show movie of carriage ascending only
// else
// show movie of carriage ascending only
-
-
+
+
// For now, if the gallows base is closed, assume ascension and move to that card.
if (*_vm->matchVarToString("jgallows") == 0)
_vm->changeToCard(_vm->matchRMAPToCard(0x17167));
@@ -1000,7 +1000,7 @@ void RivenExternal::xjisland3500_domecheck(uint16 argc, uint16 *argv) {
int RivenExternal::jspitElevatorLoop() {
Common::Event event;
int changeLevel = 0;
-
+
_vm->_gfx->changeCursor(2004);
_vm->_system->updateScreen();
for (;;) {
@@ -1025,21 +1025,21 @@ int RivenExternal::jspitElevatorLoop() {
}
}
_vm->_system->delayMillis(10);
- }
+ }
}
-void RivenExternal::xhandlecontrolup(uint16 argc, uint16 *argv) {
+void RivenExternal::xhandlecontrolup(uint16 argc, uint16 *argv) {
int changeLevel = jspitElevatorLoop();
-
+
if (changeLevel == -1) {
// TODO: Run movie
_vm->changeToCard(_vm->matchRMAPToCard(0x1e374));
}
}
-void RivenExternal::xhandlecontroldown(uint16 argc, uint16 *argv) {
+void RivenExternal::xhandlecontroldown(uint16 argc, uint16 *argv) {
int changeLevel = jspitElevatorLoop();
-
+
if (changeLevel == 1) {
// TODO: Run movie
_vm->changeToCard(_vm->matchRMAPToCard(0x1e374));
@@ -1048,7 +1048,7 @@ void RivenExternal::xhandlecontroldown(uint16 argc, uint16 *argv) {
void RivenExternal::xhandlecontrolmid(uint16 argc, uint16 *argv) {
int changeLevel = jspitElevatorLoop();
-
+
if (changeLevel == 1) {
// TODO: Run movie
_vm->changeToCard(_vm->matchRMAPToCard(0x1e597));
@@ -1126,7 +1126,7 @@ void RivenExternal::xorollcredittime(uint16 argc, uint16 *argv) {
// You used the trap book... why? What were you thinking?
uint32 *gehnState = _vm->matchVarToString("agehn");
-
+
if (*gehnState == 0) // Gehn who?
runEndGame(1);
else if (*gehnState == 4) // You freed him? Are you kidding me?
@@ -1178,14 +1178,14 @@ void RivenExternal::xogehnopenbook(uint16 argc, uint16 *argv) {
void RivenExternal::xogehnbookprevpage(uint16 argc, uint16 *argv) {
// Get the page variable
uint32 *page = _vm->matchVarToString("ogehnpage");
-
+
// Decrement the page if it's not the first page
if (*page == 1)
return;
(*page)--;
-
+
// TODO: Play the page turning sound
-
+
// Now update the screen :)
_vm->_gfx->updateScreen();
}
@@ -1193,14 +1193,14 @@ void RivenExternal::xogehnbookprevpage(uint16 argc, uint16 *argv) {
void RivenExternal::xogehnbooknextpage(uint16 argc, uint16 *argv) {
// Get the page variable
uint32 *page = _vm->matchVarToString("ogehnpage");
-
+
// Increment the page if it's not the last page
if (*page == 13)
return;
(*page)++;
-
+
// TODO: Play the page turning sound
-
+
// Now update the screen :)
_vm->_gfx->updateScreen();
}
@@ -1249,7 +1249,7 @@ void RivenExternal::xpisland25_slidermw(uint16 argc, uint16 *argv) {
void RivenExternal::xrcredittime(uint16 argc, uint16 *argv) {
// Nice going, you used the trap book on Tay.
-
+
// The game chooses what ending based on agehn for us,
// so we just have to play the video and credits.
// For the record, when agehn == 4, Gehn will thank you for
@@ -1326,9 +1326,9 @@ void RivenExternal::xtexterior300_telescopedown(uint16 argc, uint16 *argv) {
}
} else {
// We're not at the bottom, and we can move down again
-
+
// TODO: Down movie, it involves playing a chunk of a movie
-
+
// Now move the telescope down a position and refresh
*telescopePos -= 1;
_vm->changeToCard();
@@ -1352,7 +1352,7 @@ void RivenExternal::xtexterior300_telescopeup(uint16 argc, uint16 *argv) {
}
// TODO: Up movie, it involves playing a chunk of a movie
-
+
// Now move the telescope up a position and refresh
*telescopePos += 1;
_vm->changeToCard();
@@ -1361,16 +1361,16 @@ void RivenExternal::xtexterior300_telescopeup(uint16 argc, uint16 *argv) {
void RivenExternal::xtisland390_covercombo(uint16 argc, uint16 *argv) {
// Called when clicking the telescope cover buttons. button is the button number (1...5).
uint32 *pressedButtons = _vm->matchVarToString("tcovercombo");
-
+
// We pressed a button! Yay! Add it to the queue.
*pressedButtons *= 10;
*pressedButtons += argv[0];
-
+
if (*pressedButtons == *_vm->matchVarToString("tcorrectorder")) {
_vm->_hotspots[9].enabled = true;
} else {
_vm->_hotspots[9].enabled = false;
-
+
// Set the buttons to the last one pressed if we've
// pressed more than 5 buttons.
if (*pressedButtons > 55555)
@@ -1383,14 +1383,14 @@ void RivenExternal::xtatrusgivesbooks(uint16 argc, uint16 *argv) {
// Give the player Atrus' Journal and the Trap book
*_vm->matchVarToString("aatrusbook") = 1;
*_vm->matchVarToString("atrapbook") = 1;
-
+
// Randomize the telescope combination
uint32 *teleCombo = _vm->matchVarToString("tcorrectorder");
for (byte i = 0; i < 5; i++) {
*teleCombo *= 10;
*teleCombo += _rnd->getRandomNumberRng(1, 5);
}
-
+
// TODO: Randomize Dome Combination
}
@@ -1410,7 +1410,7 @@ void RivenExternal::xt7500_checkmarbles(uint16 argc, uint16 *argv) {
// TODO: Lots of stuff to do here, eventually we have to check each individual
// marble position and set apower based on that. The game handles the video playing
// so we don't have to. For the purposes of making the game progress further, we'll
- // just turn the power on for now.
+ // just turn the power on for now.
*_vm->matchVarToString("apower") = 1;
}
diff --git a/engines/mohawk/riven_external.h b/engines/mohawk/riven_external.h
index b3b9025d74..2b8a90f8fd 100644
--- a/engines/mohawk/riven_external.h
+++ b/engines/mohawk/riven_external.h
@@ -22,7 +22,7 @@
* $Id$
*
*/
-
+
#ifndef RIVEN_EXTERNAL_H
#define RIVEN_EXTERNAL_H
@@ -36,9 +36,9 @@ class RivenExternal {
public:
RivenExternal(MohawkEngine_Riven *vm);
~RivenExternal();
-
+
void runCommand(uint16 argc, uint16 *argv);
-
+
private:
MohawkEngine_Riven *_vm;
Common::RandomSource *_rnd;
@@ -50,10 +50,10 @@ private:
const char *desc;
ExternalCmd proc;
};
-
+
Common::Array<RivenExternalCmd*> _externalCommands;
void setupCommands();
-
+
// Supplementary Functions
int jspitElevatorLoop();
void runDemoBoundaryDialog();
@@ -77,7 +77,7 @@ private:
// Trap Book
void xtrapbookback(uint16 argc, uint16 *argv);
void xatrapbookclose(uint16 argc, uint16 *argv);
- void xatrapbookopen(uint16 argc, uint16 *argv);
+ void xatrapbookopen(uint16 argc, uint16 *argv);
// aspit DVD-specific commands
void xarestoregame(uint16 argc, uint16 *argv);
// aspit Demo-specific commands
@@ -103,15 +103,15 @@ private:
void xbaitplate(uint16 argc, uint16 *argv);
// Dome
void xbisland190_opencard(uint16 argc, uint16 *argv);
- void xbisland190_resetsliders(uint16 argc, uint16 *argv);
+ void xbisland190_resetsliders(uint16 argc, uint16 *argv);
void xbisland190_slidermd(uint16 argc, uint16 *argv);
- void xbisland190_slidermw(uint16 argc, uint16 *argv);
+ void xbisland190_slidermw(uint16 argc, uint16 *argv);
void xbscpbtn(uint16 argc, uint16 *argv);
- void xbisland_domecheck(uint16 argc, uint16 *argv);
+ void xbisland_domecheck(uint16 argc, uint16 *argv);
// Water Control
void xvalvecontrol(uint16 argc, uint16 *argv);
// Run the Wood Chipper
- void xbchipper(uint16 argc, uint16 *argv);
+ void xbchipper(uint16 argc, uint16 *argv);
// -----------------------------------------------------
// gspit (Garden Island) external commands
@@ -200,12 +200,12 @@ private:
// Prison Elevator
void xpisland990_elevcombo(uint16 argc, uint16 *argv); // Param1: button
// Dome
- void xpscpbtn(uint16 argc, uint16 *argv);
- void xpisland290_domecheck(uint16 argc, uint16 *argv);
- void xpisland25_opencard(uint16 argc, uint16 *argv);
- void xpisland25_resetsliders(uint16 argc, uint16 *argv);
- void xpisland25_slidermd(uint16 argc, uint16 *argv);
- void xpisland25_slidermw(uint16 argc, uint16 *argv);
+ void xpscpbtn(uint16 argc, uint16 *argv);
+ void xpisland290_domecheck(uint16 argc, uint16 *argv);
+ void xpisland25_opencard(uint16 argc, uint16 *argv);
+ void xpisland25_resetsliders(uint16 argc, uint16 *argv);
+ void xpisland25_slidermd(uint16 argc, uint16 *argv);
+ void xpisland25_slidermw(uint16 argc, uint16 *argv);
// -----------------------------------------------------
// rspit (Rebel Age / Tay) external commands
@@ -241,12 +241,12 @@ private:
void xtisland5056_slidermw(uint16 argc, uint16 *argv);
// tspit Demo-specific commands
void xtatboundary(uint16 argc, uint16 *argv);
-
+
// -----------------------------------------------------
// Common external commands
void xflies(uint16 argc, uint16 *argv); // Start the "flies" realtime effect. u0 seems always 0, u1 is a small number (< 10).
};
-
+
} // End of namespace Mohawk
#endif
diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp
index 6c82f63783..74a40a179e 100644
--- a/engines/mohawk/riven_saveload.cpp
+++ b/engines/mohawk/riven_saveload.cpp
@@ -29,7 +29,7 @@
#include "common/util.h"
namespace Mohawk {
-
+
RivenSaveLoad::RivenSaveLoad(MohawkEngine_Riven *vm, Common::SaveFileManager *saveFileMan) : _vm(vm), _saveFileMan(saveFileMan) {
_loadFile = new MohawkArchive();
}
@@ -138,11 +138,11 @@ bool RivenSaveLoad::loadGame(Common::String filename) {
uint16 stackID = 0;
uint16 cardID = 0;
-
+
for (uint32 i = 0; i < rawVariables.size() && i < namesCount && !names->eos(); i++) {
names->seek(curNamesPos);
names->seek(stringOffsets[i], SEEK_CUR);
-
+
Common::String name;
char c = (char)names->readByte();
@@ -150,11 +150,11 @@ bool RivenSaveLoad::loadGame(Common::String filename) {
name += c;
c = (char)names->readByte();
}
-
+
uint32 *var = _vm->matchVarToString(name);
-
+
*var = rawVariables[i];
-
+
if (!scumm_stricmp(name.c_str(), "CurrentStackID"))
stackID = mapOldStackIDToNew(rawVariables[i]);
else if (!scumm_stricmp(name.c_str(), "CurrentCardID"))
@@ -162,16 +162,16 @@ bool RivenSaveLoad::loadGame(Common::String filename) {
else if (!scumm_stricmp(name.c_str(), "ReturnStackID"))
*var = mapOldStackIDToNew(rawVariables[i]);
}
-
+
_vm->changeToStack(stackID);
_vm->changeToCard(cardID);
delete names;
delete[] stringOffsets;
-
+
// Reset zip mode data
_vm->_zipModeData.clear();
-
+
// Finally, we load in zip mode data.
Common::SeekableReadStream *zips = _loadFile->getRawData(ID_ZIPS, 1);
uint16 zipsRecordCount = zips->readUint16BE();
@@ -184,12 +184,12 @@ bool RivenSaveLoad::loadGame(Common::String filename) {
_vm->_zipModeData.push_back(zip);
}
delete zips;
-
+
delete _loadFile;
_loadFile = NULL;
return true;
}
-
+
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() {
Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
if (_vm->getFeatures() & GF_DVD)
@@ -198,10 +198,10 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() {
stream->writeUint32BE(kCDSaveGameVersion);
return stream;
}
-
+
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVARSSection() {
Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
-
+
for (uint32 i = 0; i < _vm->getVarCount(); i++) {
stream->writeUint32BE(0); // Unknown
stream->writeUint32BE(0); // Unknown
@@ -210,55 +210,55 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVARSSection() {
return stream;
}
-
+
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genNAMESection() {
Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
-
+
stream->writeUint16BE((uint16)_vm->getVarCount());
-
+
uint16 curPos = 0;
for (uint16 i = 0; i < _vm->getVarCount(); i++) {
stream->writeUint16BE(curPos);
curPos += _vm->getGlobalVarName(i).size() + 1;
}
-
+
for (uint16 i = 0; i < _vm->getVarCount(); i++)
stream->writeUint16BE(i);
-
+
for (uint16 i = 0; i < _vm->getVarCount(); i++) {
stream->write(_vm->getGlobalVarName(i).c_str(), _vm->getGlobalVarName(i).size());
stream->writeByte(0);
}
-
+
return stream;
}
-
+
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genZIPSSection() {
Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
-
+
stream->writeUint16BE(_vm->_zipModeData.size());
-
+
for (uint16 i = 0; i < _vm->_zipModeData.size(); i++) {
stream->writeUint16BE(_vm->_zipModeData[i].name.size());
stream->write(_vm->_zipModeData[i].name.c_str(), _vm->_zipModeData[i].name.size());
stream->writeUint16BE(_vm->_zipModeData[i].id);
}
-
+
return stream;
}
bool RivenSaveLoad::saveGame(Common::String filename) {
// Note, this code is still WIP. It works quite well for now.
-
+
// Make sure we have the right extension
if (!filename.hasSuffix(".rvn") && !filename.hasSuffix(".RVN"))
filename += ".rvn";
-
+
// Convert class variables to variable numbers
*_vm->matchVarToString("currentstackid") = mapNewStackIDToOld(_vm->getCurStack());
*_vm->matchVarToString("currentcardid") = _vm->getCurCard();
*_vm->matchVarToString("returnstackid") = mapNewStackIDToOld(*_vm->matchVarToString("returnstackid"));
-
+
Common::OutSaveFile *saveFile;
if (!(saveFile = _saveFileMan->openForSaving(filename.c_str())))
return false;
@@ -279,7 +279,7 @@ bool RivenSaveLoad::saveGame(Common::String filename) {
fileSize += 4; // Type Table Header
fileSize += 4 * 8; // Type Table Entries
fileSize += 2; // Pseudo-Name entries
-
+
// IFF Header
saveFile->writeUint32BE(ID_MHWK);
saveFile->writeUint32BE(fileSize);
@@ -291,7 +291,7 @@ bool RivenSaveLoad::saveGame(Common::String filename) {
saveFile->writeUint32BE(28); // IFF + RSRC
saveFile->writeUint16BE(62); // File Table Offset
saveFile->writeUint16BE(44); // 4 + 4 * 10
-
+
//Type Table
saveFile->writeUint16BE(36); // After the Type Table Entries
saveFile->writeUint16BE(4); // 4 Type Table Entries
diff --git a/engines/mohawk/riven_saveload.h b/engines/mohawk/riven_saveload.h
index a699878599..cef2bfb7eb 100644
--- a/engines/mohawk/riven_saveload.h
+++ b/engines/mohawk/riven_saveload.h
@@ -54,7 +54,7 @@ private:
MohawkEngine_Riven *_vm;
Common::SaveFileManager *_saveFileMan;
MohawkArchive *_loadFile;
-
+
Common::MemoryWriteStreamDynamic *genVERSSection();
Common::MemoryWriteStreamDynamic *genNAMESection();
Common::MemoryWriteStreamDynamic *genVARSSection();
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index 512354427a..3761ee5308 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -46,14 +46,14 @@ RivenScript::~RivenScript() {
RivenScriptList RivenScript::readScripts(MohawkEngine_Riven *vm, Common::SeekableReadStream *stream) {
RivenScriptList scriptList;
-
+
uint16 scriptCount = stream->readUint16BE();
for (uint16 i = 0; i < scriptCount; i++) {
uint16 scriptType = stream->readUint16BE();
uint32 scriptSize = calculateScriptSize(stream);
scriptList.push_back(Common::SharedPtr<RivenScript>(new RivenScript(vm, stream->readStream(scriptSize), scriptType)));
}
-
+
return scriptList;
}
@@ -66,7 +66,7 @@ uint32 RivenScript::calculateCommandSize(Common::SeekableReadStream* script) {
script->readUint16BE(); // variable to check against
uint16 logicBlockCount = script->readUint16BE(); // number of logic blocks
commandSize += 6; // 2 + variable + logicBlocks
-
+
for (uint16 i = 0; i < logicBlockCount; i++) {
script->readUint16BE(); // Block variable
uint16 logicBlockLength = script->readUint16BE();
@@ -82,7 +82,7 @@ uint32 RivenScript::calculateCommandSize(Common::SeekableReadStream* script) {
commandSize += 2;
}
}
-
+
return commandSize;
}
@@ -90,10 +90,10 @@ uint32 RivenScript::calculateScriptSize(Common::SeekableReadStream* script) {
uint32 oldPos = script->pos();
uint16 commandCount = script->readUint16BE();
uint16 scriptSize = 2; // 2 for command count
-
+
for (uint16 i = 0; i < commandCount; i++)
scriptSize += calculateCommandSize(script);
-
+
script->seek(oldPos);
return scriptSize;
}
@@ -175,17 +175,17 @@ static void printTabs(byte tabs) {
void RivenScript::dumpScript(Common::StringList varNames, Common::StringList xNames, byte tabs) {
if (_stream->pos() != 0)
_stream->seek(0);
-
+
printTabs(tabs); printf ("Stream Type %d:\n", _scriptType);
dumpCommands(varNames, xNames, tabs + 1);
}
void RivenScript::dumpCommands(Common::StringList varNames, Common::StringList xNames, byte tabs) {
uint16 commandCount = _stream->readUint16BE();
-
+
for (uint16 i = 0; i < commandCount; i++) {
uint16 command = _stream->readUint16BE();
-
+
if (command == 8) { // "Switch" Statement
if (_stream->readUint16BE() != 2)
warning ("if-then-else unknown value is not 2");
@@ -194,7 +194,7 @@ void RivenScript::dumpCommands(Common::StringList varNames, Common::StringList x
uint16 logicBlockCount = _stream->readUint16BE();
for (uint16 j = 0; j < logicBlockCount; j++) {
uint16 varCheck = _stream->readUint16BE();
- printTabs(tabs + 1);
+ printTabs(tabs + 1);
if (varCheck == 0xFFFF)
printf("default:\n");
else
@@ -269,7 +269,7 @@ void RivenScript::processCommands(bool runCommands) {
// And don't run it if another block has already evaluated to true (needed for the default case)
runBlock = (*_vm->getLocalVar(var) == checkValue || checkValue == 0xffff) && runCommands && !anotherBlockEvaluated;
processCommands(runBlock);
-
+
if (runBlock)
anotherBlockEvaluated = true;
}
@@ -305,7 +305,7 @@ void RivenScript::drawBitmap(uint16 op, uint16 argc, uint16 *argv) {
// Copy the image to a certain part of the screen
_vm->_gfx->copyImageToScreen(argv[0], argv[1], argv[2], argv[3], argv[4]);
}
-
+
// Now, update the screen
_vm->_gfx->updateScreen();
}
@@ -330,9 +330,9 @@ void RivenScript::playScriptSLST(uint16 op, uint16 argc, uint16 *argv) {
slstRecord.sound_ids[j] = argv[offset++];
slstRecord.fade_flags = argv[offset++];
slstRecord.loop = argv[offset++];
- slstRecord.global_volume = argv[offset++];
- slstRecord.u0 = argv[offset++];
- slstRecord.u1 = argv[offset++];
+ slstRecord.global_volume = argv[offset++];
+ slstRecord.u0 = argv[offset++];
+ slstRecord.u1 = argv[offset++];
slstRecord.volumes = new uint16[slstRecord.sound_count];
slstRecord.balances = new int16[slstRecord.sound_count];
@@ -454,7 +454,7 @@ void RivenScript::incrementVariable(uint16 op, uint16 argc, uint16 *argv) {
void RivenScript::changeStack(uint16 op, uint16 argc, uint16 *argv) {
Common::String stackName = _vm->getName(StackNames, argv[0]);
int8 index = -1;
-
+
for (byte i = 0; i < 8; i++)
if (!scumm_stricmp(_vm->getStackName(i).c_str(), stackName.c_str())) {
index = i;
@@ -463,7 +463,7 @@ void RivenScript::changeStack(uint16 op, uint16 argc, uint16 *argv) {
if (index == -1)
error ("\'%s\' is not a stack name!", stackName.c_str());
-
+
_vm->changeToStack(index);
uint32 rmapCode = (argv[1] << 16) + argv[2];
uint16 cardID = _vm->matchRMAPToCard(rmapCode);
@@ -512,7 +512,7 @@ void RivenScript::unk_36(uint16 op, uint16 argc, uint16 *argv) {
// Command 37: fade ambient sounds
void RivenScript::fadeAmbientSounds(uint16 op, uint16 argc, uint16 *argv) {
- warning("STUB: fadeAmbientSounds()");
+ warning("STUB: fadeAmbientSounds()");
}
// Command 38: Play a movie with extra parameters (movie id, delay high, delay low, record type, record id)
@@ -532,7 +532,7 @@ void RivenScript::complexPlayMovie(uint16 op, uint16 argc, uint16 *argv) {
// Command 39: activate PLST record (card picture lists)
void RivenScript::activatePLST(uint16 op, uint16 argc, uint16 *argv) {
_vm->_gfx->drawPLST(argv[0]);
-
+
// An update is automatically sent here as long as it's not a load or update script and updates are enabled.
if (_scriptType != kCardLoadScript && _scriptType != kCardUpdateScript)
_vm->_gfx->updateScreen();
@@ -560,18 +560,18 @@ void RivenScript::activateMLSTAndPlay(uint16 op, uint16 argc, uint16 *argv) {
void RivenScript::activateBLST(uint16 op, uint16 argc, uint16 *argv) {
Common::SeekableReadStream* blst = _vm->getRawData(ID_BLST, _vm->getCurCard());
uint16 recordCount = blst->readUint16BE();
-
+
for (uint16 i = 0; i < recordCount; i++) {
uint16 index = blst->readUint16BE(); // record index
uint16 enabled = blst->readUint16BE();
uint16 hotspotID = blst->readUint16BE();
-
+
if (argv[0] == index)
for (uint16 j = 0; j < _vm->getHotspotCount(); j++)
if (_vm->_hotspots[j].blstID == hotspotID)
_vm->_hotspots[j].enabled = (enabled == 1);
}
-
+
delete blst;
}
@@ -579,13 +579,13 @@ void RivenScript::activateBLST(uint16 op, uint16 argc, uint16 *argv) {
void RivenScript::activateFLST(uint16 op, uint16 argc, uint16 *argv) {
Common::SeekableReadStream* flst = _vm->getRawData(ID_FLST, _vm->getCurCard());
uint16 recordCount = flst->readUint16BE();
-
+
for (uint16 i = 0; i < recordCount; i++) {
uint16 index = flst->readUint16BE();
uint16 sfxeID = flst->readUint16BE();
if(flst->readUint16BE() != 0)
warning("FLST u0 non-zero");
-
+
if (index == argv[0]) {
_vm->_gfx->scheduleWaterEffect(sfxeID);
break;
@@ -599,7 +599,7 @@ void RivenScript::activateFLST(uint16 op, uint16 argc, uint16 *argv) {
void RivenScript::zipMode(uint16 op, uint16 argc, uint16 *argv) {
// Check the ZIPS records to see if we have a match to the hotspot name
Common::String hotspotName = _vm->getHotspotName(_vm->getCurHotspot());
-
+
for (uint16 i = 0; i < _vm->_zipModeData.size(); i++)
if (_vm->_zipModeData[i].name == hotspotName) {
_vm->changeToCard(_vm->_zipModeData[i].id);
diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h
index 36fce259f0..2879fa014d 100644
--- a/engines/mohawk/riven_scripts.h
+++ b/engines/mohawk/riven_scripts.h
@@ -53,14 +53,14 @@ class RivenScript {
public:
RivenScript(MohawkEngine_Riven *vm, Common::SeekableReadStream *stream, uint16 scriptType);
~RivenScript();
-
+
void runScript();
void dumpScript(Common::StringList varNames, Common::StringList xNames, byte tabs);
uint16 getScriptType() { return _scriptType; }
-
+
// Read in an array of script objects from a stream
static RivenScriptList readScripts(MohawkEngine_Riven *vm, Common::SeekableReadStream *stream);
-
+
private:
typedef void (RivenScript::*OpcodeProcRiven)(uint16 op, uint16 argc, uint16 *argv);
struct RivenOpcode {
@@ -69,17 +69,17 @@ private:
};
const RivenOpcode* _opcodes;
void setupOpcodes();
-
+
MohawkEngine_Riven *_vm;
Common::SeekableReadStream *_stream;
uint16 _scriptType;
-
+
void dumpCommands(Common::StringList varNames, Common::StringList xNames, byte tabs);
void processCommands(bool runCommands);
-
+
static uint32 calculateCommandSize(Common::SeekableReadStream* script);
static uint32 calculateScriptSize(Common::SeekableReadStream* script);
-
+
DECLARE_OPCODE(empty) { warning ("Unknown Opcode %04x", op); }
//Opcodes
diff --git a/engines/mohawk/riven_vars.cpp b/engines/mohawk/riven_vars.cpp
index 263ace2b78..ed540cd82e 100644
--- a/engines/mohawk/riven_vars.cpp
+++ b/engines/mohawk/riven_vars.cpp
@@ -29,7 +29,7 @@
namespace Mohawk {
-// The Riven variable system is complex. The scripts of each stack give a number, but the number has to be matched
+// The Riven variable system is complex. The scripts of each stack give a number, but the number has to be matched
// to a variable name defined in NAME resource 4.
static const char *variableNames[] = {
@@ -51,7 +51,7 @@ static const char *variableNames[] = {
"atrapbook",
"auservolume",
"azip",
-
+
// bspit
"bbacklock",
"bbait",
@@ -94,7 +94,7 @@ static const char *variableNames[] = {
"bytramtime",
"bytrap",
"bytrapped",
-
+
// gspit
"gbook",
"gcathtime",
@@ -126,7 +126,7 @@ static const char *variableNames[] = {
"gupmoov",
"gwhark",
"gwharktime",
-
+
// jspit
"jwmagcar",
"jbeetle",
@@ -175,7 +175,7 @@ static const char *variableNames[] = {
"jwmouth",
"jwmagcar",
"jymagcar",
-
+
// ospit
"oambient",
"obutton",
@@ -185,7 +185,7 @@ static const char *variableNames[] = {
"omusicplayer",
"ostanddrawer",
"ostove",
-
+
// pspit
"pbook",
"pcage",
@@ -200,13 +200,13 @@ static const char *variableNames[] = {
"prightpos",
"ptemp",
"pwharkpos",
-
+
// rspit
"rrebel",
"rrebelview",
"rrichard",
"rvillagetime",
-
+
// tspit
"tbars",
"tbeetle",
@@ -248,7 +248,7 @@ static const char *variableNames[] = {
"twabrvalve",
"twaffle",
"tyellow",
-
+
// Miscellaneous
"elevbtn1",
"elevbtn2",
@@ -298,11 +298,11 @@ void MohawkEngine_Riven::initVars() {
_varCount = ARRAYSIZE(variableNames);
_vars = new uint32[_varCount];
-
+
// Temporary:
for (uint32 i = 0; i < _varCount; i++)
_vars[i] = 0;
-
+
// Init Variables to their correct starting state.
*matchVarToString("ttelescope") = 5;
*matchVarToString("tgatestate") = 1;
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index 30d084108d..9d7dc3ae49 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -39,12 +39,12 @@ Sound::Sound(MohawkEngine* vm) : _vm(vm) {
_rivenSoundFile = NULL;
_midiDriver = NULL;
_midiParser = NULL;
-
+
for (uint32 i = 0; i < _handles.size(); i++) {
_handles[i].handle = Audio::SoundHandle();
_handles[i].type = kFreeHandle;
}
-
+
initMidi();
}
@@ -52,12 +52,12 @@ Sound::~Sound() {
stopSound();
stopAllSLST();
delete _rivenSoundFile;
-
+
if (_midiDriver) {
_midiDriver->close();
delete _midiDriver;
}
-
+
if (_midiParser) {
_midiParser->unloadMusic();
delete _midiParser;
@@ -69,18 +69,18 @@ void Sound::loadRivenSounds(uint16 stack) {
if (!_rivenSoundFile)
_rivenSoundFile = new MohawkArchive();
-
+
_rivenSoundFile->open(Common::String(prefixes[stack]) + "_Sounds.mhk");
}
void Sound::initMidi() {
if (!(_vm->getFeatures() & GF_HASMIDI))
return;
-
+
// Let's get our MIDI parser/driver
_midiParser = MidiParser::createParser_SMF();
_midiDriver = MidiDriver::createMidi(MidiDriver::detectMusicDriver(MDT_ADLIB|MDT_MIDI));
-
+
// Set up everything!
_midiDriver->open();
_midiParser->setMidiDriver(_midiDriver);
@@ -89,10 +89,10 @@ void Sound::initMidi() {
Audio::SoundHandle *Sound::playSound(uint16 id, bool mainSoundFile, byte volume, bool loop) {
debug (0, "Playing sound %d", id);
-
+
SndHandle *handle = getHandle();
handle->type = kUsedHandle;
-
+
Audio::AudioStream *audStream = NULL;
switch (_vm->getGameType()) {
@@ -108,7 +108,7 @@ Audio::SoundHandle *Sound::playSound(uint16 id, bool mainSoundFile, byte volume,
id = mjmpStream->readUint16LE();
delete mjmpStream;
}
-
+
audStream = Audio::makeWAVStream(_vm->getRawData(ID_MSND, id), DisposeAfterUse::YES);
} else
audStream = makeMohawkWaveStream(_vm->getRawData(ID_MSND, id));
@@ -134,16 +134,16 @@ Audio::SoundHandle *Sound::playSound(uint16 id, bool mainSoundFile, byte volume,
default:
audStream = makeMohawkWaveStream(_vm->getRawData(ID_TWAV, id));
}
-
+
if (audStream) {
// Set the stream to loop here if it's requested
if (loop)
audStream = Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audStream, 0);
-
+
_vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &handle->handle, audStream, -1, volume);
return &handle->handle;
}
-
+
return NULL;
}
@@ -155,36 +155,36 @@ void Sound::playMidi(uint16 id) {
}
assert(_midiDriver && _midiParser);
-
+
_midiParser->unloadMusic();
Common::SeekableReadStream *midi = _vm->getRawData(ID_TMID, id);
-
+
idTag = midi->readUint32BE();
assert(idTag == ID_MHWK);
midi->readUint32BE(); // Skip size
idTag = midi->readUint32BE();
assert(idTag == ID_MIDI);
-
+
byte *midiData = (byte *)malloc(midi->size() - 12); // Enough to cover MThd/Prg#/MTrk
-
+
// Read the MThd Data
midi->read(midiData, 14);
-
+
// TODO: Load patches from the Prg# section... skip it for now.
idTag = midi->readUint32BE();
assert(idTag == ID_PRG);
midi->skip(midi->readUint32BE());
-
+
// Read the MTrk Data
uint32 mtrkSize = midi->size() - midi->pos();
midi->read(midiData + 14, mtrkSize);
-
+
delete midi;
// Now, play it :)
if (!_midiParser->loadMusic(midiData, 14 + mtrkSize))
error ("Could not play MIDI music from tMID %04x\n", id);
-
+
_midiDriver->setTimerCallback(_midiParser, MidiParser::timerCallback);
}
@@ -192,7 +192,7 @@ void Sound::playSLST(uint16 index, uint16 card) {
Common::SeekableReadStream *slstStream = _vm->getRawData(ID_SLST, card);
SLSTRecord slstRecord;
uint16 recordCount = slstStream->readUint16BE();
-
+
for (uint16 i = 0; i < recordCount; i++) {
slstRecord.index = slstStream->readUint16BE();
slstRecord.sound_count = slstStream->readUint16BE();
@@ -236,13 +236,13 @@ void Sound::playSLST(uint16 index, uint16 card) {
delete slstStream;
return;
}
-
+
delete[] slstRecord.sound_ids;
delete[] slstRecord.volumes;
delete[] slstRecord.balances;
delete[] slstRecord.u2;
}
-
+
delete slstStream;
// No matching records, assume we need to stop all SLST's
stopAllSLST();
@@ -258,7 +258,7 @@ void Sound::playSLST(SLSTRecord slstRecord) {
if (noLongerPlay)
stopSLSTSound(i, (slstRecord.fade_flags & 1) != 0);
}
-
+
// Start new sounds
for (uint16 i = 0; i < slstRecord.sound_count; i++) {
bool alreadyPlaying = false;
@@ -295,24 +295,24 @@ void Sound::playSLSTSound(uint16 id, bool fade, bool loop, uint16 volume, int16
sndHandle.handle = new Audio::SoundHandle();
sndHandle.id = id;
_currentSLSTSounds.push_back(sndHandle);
-
+
Audio::AudioStream *audStream = makeMohawkWaveStream(_rivenSoundFile->getRawData(ID_TWAV, id));
-
+
// Loop here if necessary
if (loop)
audStream = Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audStream, 0);
-
+
// The max mixer volume is 255 and the max Riven volume is 256. Just change it to 255.
if (volume == 256)
volume = 255;
-
+
// TODO: Handle fading, possibly just raise the volume of the channel in increments?
-
+
_vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, sndHandle.handle, audStream, -1, volume, convertBalance(balance));
}
void Sound::stopSLSTSound(uint16 index, bool fade) {
- // TODO: Fade out, mixer needs to be extended to get volume on a handle
+ // TODO: Fade out, mixer needs to be extended to get volume on a handle
_vm->_mixer->stopHandle(*_currentSLSTSounds[index].handle);
_currentSLSTSounds.remove_at(index);
}
@@ -371,7 +371,7 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre
adpc.itemCount = stream->readUint16BE();
adpc.channels = stream->readUint16BE();
adpc.statusItems = new ADPC_Chunk::StatusItem[adpc.itemCount];
-
+
assert(adpc.channels <= 2);
for (uint16 i = 0; i < adpc.itemCount; i++) {
@@ -380,7 +380,7 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre
for (uint16 j = 0; j < adpc.channels; j++)
adpc.statusItems[i].channelStatus[j] = stream->readUint32BE();
}
-
+
delete[] adpc.statusItems;
break;
case ID_CUE:
@@ -398,7 +398,7 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre
// chunk are for looping. Since it was only used in Myst, it was
// always 10 0's, Tito just thought it was useless. I'm still not
// sure what purpose this has.
-
+
cue.size = stream->readUint32BE();
cue.point_count = stream->readUint16BE();
@@ -446,7 +446,7 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre
error ("Unknown tag found in 'tWAV' chunk -- \'%s\'", tag2str(tag));
}
}
-
+
// makeMohawkWaveStream always takes control of the original stream
delete stream;
@@ -482,7 +482,7 @@ Audio::AudioStream *Sound::makeOldMohawkWaveStream(Common::SeekableReadStream *s
uint16 header = stream->readUint16BE();
uint16 rate = 0;
uint32 size = 0;
-
+
if (header == 'Wv') { // Big Endian
rate = stream->readUint16BE();
stream->skip(10); // Loop chunk, like the newer format?
@@ -493,12 +493,12 @@ Audio::AudioStream *Sound::makeOldMohawkWaveStream(Common::SeekableReadStream *s
size = stream->readUint32LE();
} else
error("Could not find Old Mohawk Sound header");
-
+
assert(size);
byte *data = (byte *)malloc(size);
stream->read(data, size);
delete stream;
-
+
return Audio::makeRawMemoryStream(data, size, rate, Audio::FLAG_UNSIGNED);
}
diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h
index eb545a4752..9757f15095 100644
--- a/engines/mohawk/sound.h
+++ b/engines/mohawk/sound.h
@@ -76,7 +76,7 @@ struct ADPC_Chunk { // Holds ADPCM status data, but is irrelevant for
uint32 size;
uint16 itemCount;
uint16 channels;
-
+
struct StatusItem {
uint32 sampleFrame;
uint32 channelStatus[MAX_CHANNELS];
@@ -118,7 +118,7 @@ class Sound {
public:
Sound(MohawkEngine*);
~Sound();
-
+
void loadRivenSounds(uint16 stack);
Audio::SoundHandle *playSound(uint16 id, bool mainSoundFile = true, byte volume = Audio::Mixer::kMaxChannelVolume, bool loop = false);
void playMidi(uint16 id);
@@ -144,7 +144,7 @@ private:
Common::Array<SndHandle> _handles;
SndHandle *getHandle();
-
+
// Riven specific
void playSLSTSound(uint16 index, bool fade, bool loop, uint16 volume, int16 balance);
void stopSLSTSound(uint16 id, bool fade);
diff --git a/engines/mohawk/video/cinepak.cpp b/engines/mohawk/video/cinepak.cpp
index c5289806cf..48883ceab9 100644
--- a/engines/mohawk/video/cinepak.cpp
+++ b/engines/mohawk/video/cinepak.cpp
@@ -31,7 +31,7 @@
// Code here partially based off of ffmpeg ;)
namespace Mohawk {
-
+
#define PUT_PIXEL(offset, lum, u, v) \
Graphics::CPYUV2RGB(lum, u, v, r, g, b); \
if (_pixelFormat.bytesPerPixel == 2) \
@@ -68,7 +68,7 @@ Graphics::Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream *strea
_curFrame.strips = new CinepakStrip[_curFrame.stripCount];
debug (4, "Cinepak Frame: Width = %d, Height = %d, Strip Count = %d", _curFrame.width, _curFrame.height, _curFrame.stripCount);
-
+
#if 0
// Borrowed from FFMPEG. This should cut out the extra data Cinepak for Sega has (which is useless).
// The theory behind this is that this is here to confuse standard Cinepak decoders. But, we won't let that happen! ;)
@@ -146,7 +146,7 @@ Graphics::Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream *strea
_y = _curFrame.strips[i].rect.bottom;
}
-
+
return _curFrame.surface;
}
diff --git a/engines/mohawk/video/cinepak.h b/engines/mohawk/video/cinepak.h
index a94d879bdb..43cc22bfc9 100644
--- a/engines/mohawk/video/cinepak.h
+++ b/engines/mohawk/video/cinepak.h
@@ -55,7 +55,7 @@ struct CinepakFrame {
uint16 height;
uint16 stripCount;
CinepakStrip *strips;
-
+
Graphics::Surface *surface;
};
@@ -70,7 +70,7 @@ private:
CinepakFrame _curFrame;
int32 _y;
Graphics::PixelFormat _pixelFormat;
-
+
void loadCodebook(Common::SeekableReadStream *stream, uint16 strip, byte codebookType, byte chunkID, uint32 chunkSize);
void decodeVectors(Common::SeekableReadStream *stream, uint16 strip, byte chunkID, uint32 chunkSize);
};
diff --git a/engines/mohawk/video/qdm2.cpp b/engines/mohawk/video/qdm2.cpp
index f5d4af8aed..b91440f00d 100644
--- a/engines/mohawk/video/qdm2.cpp
+++ b/engines/mohawk/video/qdm2.cpp
@@ -147,9 +147,9 @@ static inline void skipBits(GetBitContext *s, int n) {
static int splitRadixPermutation(int i, int n, int inverse) {
if (n <= 2)
return i & 1;
-
+
int m = n >> 1;
-
+
if(!(i & m))
return splitRadixPermutation(i, m, inverse) * 2;
@@ -547,10 +547,10 @@ int fftInit(FFTContext *s, int nbits, int inverse) {
// compute bit reverse table
for (i = 0; i < n; i++) {
m = 0;
-
+
for (j = 0; j < nbits; j++)
m |= ((i >> j) & 1) << (nbits - j - 1);
-
+
s->revtab[i] = m;
}
}
@@ -616,7 +616,7 @@ void rdftCalc(RDFTContext *s, float *data) {
ev.re = data[0];
data[0] = ev.re + data[1];
data[1] = ev.re - data[1];
-
+
int i;
for (i = 1; i < n >> 2; i++) {
@@ -843,7 +843,7 @@ static void dct32(int32 *out, int32 *tab) {
// pass 1
BF( 7, 24, COS0_7 , 1);
BF( 8, 23, COS0_8 , 1);
- // pass 2
+ // pass 2
BF( 7, 8, COS1_7 , 4);
BF(23, 24,-COS1_7 , 4);
// pass 3
@@ -854,7 +854,7 @@ static void dct32(int32 *out, int32 *tab) {
// pass 1
BF( 3, 28, COS0_3 , 1);
BF(12, 19, COS0_12, 2);
- // pass 2
+ // pass 2
BF( 3, 12, COS1_3 , 1);
BF(19, 28,-COS1_3 , 1);
// pass 1
@@ -1537,12 +1537,12 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *stream, Common::SeekableReadS
warning("QDM2Stream::QDM2Stream() extraSize mismatch - Expected %d", (extraData->size() - extraData->pos()) / 4 + 1);
if (tmp_s < 12)
error("QDM2Stream::QDM2Stream() Insufficient extraData");
-
+
tmp = extraData->readUint32BE();
debug(1, "QDM2Stream::QDM2Stream() extraTag: %d", tmp);
if (tmp != MKID_BE('frma'))
warning("QDM2Stream::QDM2Stream() extraTag mismatch");
-
+
tmp = extraData->readUint32BE();
debug(1, "QDM2Stream::QDM2Stream() extraType: %d", tmp);
if (tmp == MKID_BE('QDMC'))
@@ -2609,7 +2609,7 @@ void QDM2Stream::qdm2_decode_super_block(void) {
// ****************************************************************
}
-void QDM2Stream::qdm2_fft_init_coefficient(int sub_packet, int offset, int duration,
+void QDM2Stream::qdm2_fft_init_coefficient(int sub_packet, int offset, int duration,
int channel, int exp, int phase) {
if (_fftCoefsMinIndex[duration] < 0)
_fftCoefsMinIndex[duration] = _fftCoefsIndex;
@@ -2904,7 +2904,7 @@ void QDM2Stream::qdm2_calculate_fft(int channel) {
//debug(1, "QDM2Stream::qdm2_calculate_fft _fft.complex[channel][0].im: %lf", _fft.complex[channel][0].im);
rdftCalc(&_rdftCtx, (float *)_fft.complex[channel]);
-
+
// add samples to output buffer
for (i = 0; i < ((_fftFrameSize + 15) & ~15); i++)
_outputBuffer[_channels * i + channel] += ((float *) _fft.complex[channel])[i] * gain;
diff --git a/engines/mohawk/video/qdm2.h b/engines/mohawk/video/qdm2.h
index 1a08064b0b..a2f55a10ac 100644
--- a/engines/mohawk/video/qdm2.h
+++ b/engines/mohawk/video/qdm2.h
@@ -224,7 +224,7 @@ private:
uint8 _subPacket; // 0 to 15
int _noiseIdx; // index for dithering noise table
-
+
byte _emptyBuffer[FF_INPUT_BUFFER_PADDING_SIZE];
VLC _vlcTabLevel;
@@ -253,7 +253,7 @@ private:
float _noiseSamples[128];
void initNoiseSamples(void);
-
+
RDFTContext _rdftCtx;
void average_quantized_coeffs(void);
@@ -272,7 +272,7 @@ private:
void process_subpacket_12(QDM2SubPNode *node, int length);
void process_synthesis_subpackets(QDM2SubPNode *list);
void qdm2_decode_super_block(void);
- void qdm2_fft_init_coefficient(int sub_packet, int offset, int duration,
+ void qdm2_fft_init_coefficient(int sub_packet, int offset, int duration,
int channel, int exp, int phase);
void qdm2_fft_decode_tones(int duration, GetBitContext *gb, int b);
void qdm2_decode_fft_packets(void);
diff --git a/engines/mohawk/video/qt_player.cpp b/engines/mohawk/video/qt_player.cpp
index b35f43ca2d..cddecbae9e 100644
--- a/engines/mohawk/video/qt_player.cpp
+++ b/engines/mohawk/video/qt_player.cpp
@@ -52,7 +52,7 @@
namespace Mohawk {
////////////////////////////////////////////
-// QTPlayer
+// QTPlayer
////////////////////////////////////////////
QTPlayer::QTPlayer() {
@@ -73,35 +73,35 @@ QTPlayer::~QTPlayer() {
uint16 QTPlayer::getWidth() {
if (_videoStreamIndex < 0)
return 0;
-
+
return _streams[_videoStreamIndex]->width;
}
uint16 QTPlayer::getHeight() {
if (_videoStreamIndex < 0)
return 0;
-
+
return _streams[_videoStreamIndex]->height;
}
uint32 QTPlayer::getFrameCount() {
if (_videoStreamIndex < 0)
return 0;
-
+
return _streams[_videoStreamIndex]->nb_frames;
}
byte QTPlayer::getBitsPerPixel() {
if (_videoStreamIndex < 0)
return 0;
-
+
return _streams[_videoStreamIndex]->bits_per_sample & 0x1F;
}
uint32 QTPlayer::getCodecTag() {
if (_videoStreamIndex < 0)
return 0;
-
+
return _streams[_videoStreamIndex]->codec_tag;
}
@@ -115,7 +115,7 @@ ScaleMode QTPlayer::getScaleMode() {
uint32 QTPlayer::getFrameDuration() {
if (_videoStreamIndex < 0)
return 0;
-
+
uint32 curFrameIndex = 0;
for (int32 i = 0; i < _streams[_videoStreamIndex]->stts_count; i++) {
curFrameIndex += _streams[_videoStreamIndex]->stts_data[i].count;
@@ -124,7 +124,7 @@ uint32 QTPlayer::getFrameDuration() {
return _streams[_videoStreamIndex]->stts_data[i].duration * 1000 * 100 / _streams[_videoStreamIndex]->time_scale;
}
}
-
+
// This should never occur
error ("Cannot find duration for frame %d", _curFrame);
return 0;
@@ -132,10 +132,10 @@ uint32 QTPlayer::getFrameDuration() {
void QTPlayer::stop() {
stopAudio();
-
+
if (!_noCodecFound)
delete _videoCodec;
-
+
closeFile();
}
@@ -182,14 +182,14 @@ Graphics::Codec *QTPlayer::createCodec(uint32 codecTag, byte bitsPerPixel) {
} else {
warning ("Unsupported codec \'%s\'", tag2str(codecTag));
}
-
+
return NULL;
}
void QTPlayer::startAudio() {
if (!_audStream) // No audio/audio not supported
return;
-
+
g_system->getMixer()->playInputStream(Audio::Mixer::kPlainSoundType, &_audHandle, _audStream);
}
@@ -205,19 +205,19 @@ void QTPlayer::stopAudio() {
g_system->getMixer()->stopHandle(_audHandle);
}
-Graphics::Surface *QTPlayer::getNextFrame() {
+Graphics::Surface *QTPlayer::getNextFrame() {
if (_noCodecFound || _curFrame >= (int32)getFrameCount() - 1)
return NULL;
-
+
if (_nextFrameStart == 0)
_nextFrameStart = g_system->getMillis() * 100;
-
+
_lastFrameStart = _nextFrameStart;
_curFrame++;
_nextFrameStart = getFrameDuration() + _lastFrameStart;
-
+
Common::SeekableReadStream *frameData = getNextFramePacket();
-
+
if (!_videoCodec) {
_videoCodec = createCodec(getCodecTag(), getBitsPerPixel());
// If we don't get it still, the codec is unsupported ;)
@@ -261,7 +261,7 @@ bool QTPlayer::loadFile(Common::SeekableReadStream *stream) {
MOVatom atom = { 0, 0, 0xffffffff };
- if (readDefault(atom) < 0 || (!_foundMOOV && !_foundMDAT))
+ if (readDefault(atom) < 0 || (!_foundMOOV && !_foundMDAT))
return false;
debug(0, "on_parse_exit_offset=%d", _fd->pos());
@@ -297,22 +297,22 @@ bool QTPlayer::loadFile(Common::SeekableReadStream *stream) {
sc->ffindex = i;
sc->is_ff_stream = 1;
-
+
if (sc->codec_type == CODEC_TYPE_VIDEO && _videoStreamIndex < 0)
_videoStreamIndex = i;
else if (sc->codec_type == CODEC_TYPE_AUDIO && _audioStreamIndex < 0)
_audioStreamIndex = i;
}
-
+
if (_audioStreamIndex >= 0 && checkAudioCodecSupport(_streams[_audioStreamIndex]->codec_tag)) {
_audStream = Audio::makeQueuingAudioStream(_streams[_audioStreamIndex]->sample_rate, _streams[_audioStreamIndex]->channels == 2);
_curAudioChunk = 0;
-
+
// Make sure the bits per sample transfers to the sample size
if (_streams[_audioStreamIndex]->codec_tag == MKID_BE('raw ') || _streams[_audioStreamIndex]->codec_tag == MKID_BE('twos'))
_streams[_audioStreamIndex]->sample_size = (_streams[_audioStreamIndex]->bits_per_sample / 8) * _streams[_audioStreamIndex]->channels;
}
-
+
return true;
}
@@ -359,29 +359,29 @@ int QTPlayer::readDefault(MOVatom atom) {
while(((total_size + 8) < atom.size) && !_fd->eos() && !err) {
a.size = atom.size;
a.type = 0;
-
+
if (atom.size >= 8) {
a.size = _fd->readUint32BE();
a.type = _fd->readUint32BE();
}
-
+
total_size += 8;
a.offset += 8;
debug(4, "type: %08x %.4s sz: %x %x %x", a.type, tag2str(a.type), a.size, atom.size, total_size);
-
+
if (a.size == 1) { // 64 bit extended size
warning("64 bit extended size is not supported in QuickTime");
return -1;
}
-
+
if (a.size == 0) {
a.size = atom.size - total_size;
if (a.size <= 8)
break;
}
-
+
uint32 i = 0;
-
+
for (; _parseTable[i].type != 0 && _parseTable[i].type != a.type; i++)
// empty;
@@ -397,9 +397,9 @@ int QTPlayer::readDefault(MOVatom atom) {
} else {
uint32 start_pos = _fd->pos();
err = (this->*_parseTable[i].func)(a);
-
+
uint32 left = a.size - _fd->pos() + start_pos;
-
+
if (left > 0) // skip garbage at atom end
_fd->seek(left, SEEK_CUR);
}
@@ -445,40 +445,40 @@ int QTPlayer::readCMOV(MOVatom atom) {
warning("Unknown cmov compression type");
return -1;
}
-
+
// Read in the cmvd atom
uint32 compressedSize = _fd->readUint32BE() - 12;
if (_fd->readUint32BE() != MKID_BE('cmvd'))
return -1;
uint32 uncompressedSize = _fd->readUint32BE();
-
+
// Read in data
byte *compressedData = (byte *)malloc(compressedSize);
_fd->read(compressedData, compressedSize);
-
+
// Create uncompressed stream
byte *uncompressedData = (byte *)malloc(uncompressedSize);
-
+
// Uncompress the data
unsigned long dstLen = uncompressedSize;
if (!Common::uncompress(uncompressedData, &dstLen, compressedData, compressedSize)) {
warning ("Could not uncompress cmov chunk");
return -1;
}
-
+
// Load data into a new MemoryReadStream and assign _fd to be that
Common::SeekableReadStream *oldStream = _fd;
_fd = new Common::MemoryReadStream(uncompressedData, uncompressedSize, DisposeAfterUse::YES);
-
+
// Read the contents of the uncompressed data
MOVatom a = { MKID_BE('moov'), 0, uncompressedSize };
int err = readDefault(a);
-
+
// Assign the file handle back to the original handle
free(compressedData);
delete _fd;
_fd = oldStream;
-
+
return err;
#else
warning ("zlib not found, cannot read QuickTime cmov atom");
@@ -498,7 +498,7 @@ int QTPlayer::readMVHD(MOVatom atom) {
_fd->readUint32BE(); // creation time
_fd->readUint32BE(); // modification time
}
-
+
_timeScale = _fd->readUint32BE(); // time scale
debug(0, "time scale = %i\n", _timeScale);
@@ -593,7 +593,7 @@ int QTPlayer::readTKHD(MOVatom atom) {
_fd->readUint32BE(); // creation time
_fd->readUint32BE(); // modification time
}
-
+
/* st->id = */_fd->readUint32BE(); // track id (NOT 0 !)
_fd->readUint32BE(); // reserved
//st->start_time = 0; // check
@@ -605,7 +605,7 @@ int QTPlayer::readTKHD(MOVatom atom) {
_fd->readUint16BE(); // alternate group
_fd->readUint16BE(); // volume
_fd->readUint16BE(); // reserved
-
+
// We only need the two values from the displacement matrix for a track.
// See readMVHD() for more information.
uint32 xMod = _fd->readUint32BE();
@@ -643,9 +643,9 @@ int QTPlayer::readELST(MOVatom atom) {
_fd->readUint32BE(); // Media time
_fd->readUint32BE(); // Media rate
}
-
+
debug(0, "track[%i].edit_count = %i", _numStreams - 1, _streams[_numStreams - 1]->edit_count);
-
+
if (editCount != 1)
warning("Multiple edit list entries. Things may go awry");
@@ -743,7 +743,7 @@ int QTPlayer::readSTSD(MOVatom atom) {
if (st->codec_type == CODEC_TYPE_VIDEO) {
debug(0, "Video Codec FourCC: \'%s\'", tag2str(format));
-
+
_fd->readUint16BE(); // version
_fd->readUint16BE(); // revision level
_fd->readUint32BE(); // vendor
@@ -804,7 +804,7 @@ int QTPlayer::readSTSD(MOVatom atom) {
#if 0
byte *color_table;
byte r, g, b;
-
+
if (colorDepth == 2)
color_table = ff_qt_default_palette_4;
else if (colorDepth == 4)
@@ -846,7 +846,7 @@ int QTPlayer::readSTSD(MOVatom atom) {
st->palettized = false;
} else if (st->codec_type == CODEC_TYPE_AUDIO) {
debug(0, "Audio Codec FourCC: \'%s\'", tag2str(format));
-
+
st->stsd_version = _fd->readUint16BE();
_fd->readUint16BE(); // revision level
_fd->readUint32BE(); // vendor
@@ -877,7 +877,7 @@ int QTPlayer::readSTSD(MOVatom atom) {
warning("Unsupported QuickTime STSD audio version %d", st->stsd_version);
return 1;
}
-
+
// Version 0 videos (such as the Riven ones) don't have this set,
// but we need it later on. Add it in here.
if (format == MKID_BE('ima4')) {
@@ -888,7 +888,7 @@ int QTPlayer::readSTSD(MOVatom atom) {
// other codec type, just skip (rtp, mp4s, tmcd ...)
_fd->seek(size - (_fd->pos() - start_pos), SEEK_CUR);
}
-
+
// this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...)
a.size = size - (_fd->pos() - start_pos);
if (a.size > 8)
@@ -924,7 +924,7 @@ int QTPlayer::readSTSC(MOVatom atom) {
st->sample_to_chunk[i].id = _fd->readUint32BE();
//printf ("Sample to Chunk[%d]: First = %d, Count = %d\n", i, st->sample_to_chunk[i].first, st->sample_to_chunk[i].count);
}
-
+
return 0;
}
@@ -974,7 +974,7 @@ int QTPlayer::readSTSZ(MOVatom atom) {
st->sample_sizes[i] = _fd->readUint32BE();
debug(6, "sample_sizes[%d] = %d", i, st->sample_sizes[i]);
}
-
+
return 0;
}
@@ -990,7 +990,7 @@ int QTPlayer::readSTTS(MOVatom atom) {
_fd->readByte(); // version
_fd->readByte(); _fd->readByte(); _fd->readByte(); // flags
-
+
st->stts_count = _fd->readUint32BE();
st->stts_data = new MOVstts[st->stts_count];
@@ -1031,7 +1031,7 @@ int QTPlayer::readSTCO(MOVatom atom) {
st->chunk_count = _fd->readUint32BE();
st->chunk_offsets = new uint32[st->chunk_count];
-
+
if (!st->chunk_offsets)
return -1;
@@ -1053,7 +1053,7 @@ int QTPlayer::readSTCO(MOVatom atom) {
_ni = 1;
}
}
-
+
return 0;
}
@@ -1062,7 +1062,7 @@ int QTPlayer::readWAVE(MOVatom atom) {
return 0;
MOVStreamContext *st = _streams[_numStreams - 1];
-
+
if (atom.size > (1 << 30))
return -1;
@@ -1079,50 +1079,50 @@ int QTPlayer::readWAVE(MOVatom atom) {
void QTPlayer::closeFile() {
for (uint32 i = 0; i < _numStreams; i++)
delete _streams[i];
-
+
delete _fd;
-
+
// The audio stream is deleted automatically
_audStream = NULL;
}
void QTPlayer::resetInternal() {
-
+
}
Common::SeekableReadStream *QTPlayer::getNextFramePacket() {
if (_videoStreamIndex < 0)
return NULL;
-
+
// First, we have to track down which chunk holds the sample and which sample in the chunk contains the frame we are looking for.
int32 totalSampleCount = 0;
int32 sampleInChunk = 0;
int32 actualChunk = -1;
-
+
for (uint32 i = 0; i < _streams[_videoStreamIndex]->chunk_count; i++) {
int32 sampleToChunkIndex = -1;
-
+
for (uint32 j = 0; j < _streams[_videoStreamIndex]->sample_to_chunk_sz; j++)
if (i >= _streams[_videoStreamIndex]->sample_to_chunk[j].first - 1)
sampleToChunkIndex = j;
-
+
if (sampleToChunkIndex < 0)
error("This chunk (%d) is imaginary", sampleToChunkIndex);
-
+
totalSampleCount += _streams[_videoStreamIndex]->sample_to_chunk[sampleToChunkIndex].count;
-
+
if (totalSampleCount > getCurFrame()) {
actualChunk = i;
sampleInChunk = _streams[_videoStreamIndex]->sample_to_chunk[sampleToChunkIndex].count - totalSampleCount + getCurFrame();
break;
}
}
-
+
if (actualChunk < 0) {
warning ("Could not find data for frame %d", getCurFrame());
return NULL;
}
-
+
// Next seek to that frame
_fd->seek(_streams[_videoStreamIndex]->chunk_offsets[actualChunk]);
@@ -1136,10 +1136,10 @@ Common::SeekableReadStream *QTPlayer::getNextFramePacket() {
// Finally, read in the raw data for the frame
//printf ("Frame Data[%d]: Offset = %d, Size = %d\n", getCurFrame(), _fd->pos(), _streams[_videoStreamIndex]->sample_sizes[getCurFrame()]);
-
+
if (_streams[_videoStreamIndex]->sample_size != 0)
return _fd->readStream(_streams[_videoStreamIndex]->sample_size);
-
+
return _fd->readStream(_streams[_videoStreamIndex]->sample_sizes[getCurFrame()]);
}
@@ -1156,7 +1156,7 @@ bool QTPlayer::checkAudioCodecSupport(uint32 tag) {
Audio::AudioStream *QTPlayer::createAudioStream(Common::SeekableReadStream *stream) {
if (!stream || _audioStreamIndex < 0)
return NULL;
-
+
if (_streams[_audioStreamIndex]->codec_tag == MKID_BE('twos') || _streams[_audioStreamIndex]->codec_tag == MKID_BE('raw ')) {
// Fortunately, most of the audio used in Myst videos is raw...
uint16 flags = 0;
@@ -1178,9 +1178,9 @@ Audio::AudioStream *QTPlayer::createAudioStream(Common::SeekableReadStream *stre
// Several Myst ME videos use this codec
return new QDM2Stream(stream, _streams[_audioStreamIndex]->extradata);
}
-
+
error("Unsupported audio codec");
-
+
return NULL;
}
@@ -1191,20 +1191,20 @@ void QTPlayer::updateAudioBuffer() {
// Keep two streams in buffer so that when the first ends, it goes right into the next
for (; _audStream->numQueuedStreams() < 2 && _curAudioChunk < _streams[_audioStreamIndex]->chunk_count; _curAudioChunk++) {
Common::MemoryWriteStreamDynamic *wStream = new Common::MemoryWriteStreamDynamic();
-
+
_fd->seek(_streams[_audioStreamIndex]->chunk_offsets[_curAudioChunk]);
-
+
// First, we have to get the sample count
uint32 sampleCount = 0;
for (uint32 j = 0; j < _streams[_audioStreamIndex]->sample_to_chunk_sz; j++)
if (_curAudioChunk >= (_streams[_audioStreamIndex]->sample_to_chunk[j].first - 1))
sampleCount = _streams[_audioStreamIndex]->sample_to_chunk[j].count;
assert(sampleCount);
-
+
// Then calculate the right sizes
while (sampleCount > 0) {
uint32 samples = 0, size = 0;
-
+
if (_streams[_audioStreamIndex]->samples_per_frame >= 160) {
samples = _streams[_audioStreamIndex]->samples_per_frame;
size = _streams[_audioStreamIndex]->bytes_per_frame;
@@ -1215,7 +1215,7 @@ void QTPlayer::updateAudioBuffer() {
samples = MIN<uint32>(1024, sampleCount);
size = samples * _streams[_audioStreamIndex]->sample_size;
}
-
+
// Now, we read in the data for this data and output it
byte *data = (byte *)malloc(size);
_fd->read(data, size);
@@ -1223,7 +1223,7 @@ void QTPlayer::updateAudioBuffer() {
free(data);
sampleCount -= samples;
}
-
+
// Now queue the buffer
_audStream->queueAudioStream(createAudioStream(new Common::MemoryReadStream(wStream->getData(), wStream->size(), DisposeAfterUse::YES)));
delete wStream;
diff --git a/engines/mohawk/video/qt_player.h b/engines/mohawk/video/qt_player.h
index 2d8f87f479..bad3a542c1 100644
--- a/engines/mohawk/video/qt_player.h
+++ b/engines/mohawk/video/qt_player.h
@@ -74,13 +74,13 @@ public:
* @return the amount of frames in the video
*/
uint32 getFrameCount();
-
+
/**
* Returns the bits per pixel of the video
* @return the bits per pixel of the video
*/
byte getBitsPerPixel();
-
+
/**
* Returns the codec tag of the video
* @return the codec tag of the video
@@ -97,26 +97,26 @@ public:
* Close a QuickTime encoded video file
*/
void closeFile();
-
+
/**
* Returns the downscale mode of the video
* @return the downscale mode of the video
*/
ScaleMode getScaleMode();
-
+
/**
* Returns the palette of the video
* @return the palette of the video
*/
byte *getPalette() { return _palette; }
-
+
/**
* Set the beginning offset of the video so we can modify the offsets in the stco
* atom of videos inside the Mohawk archives
* @param the beginning offset of the video
*/
void setChunkBeginOffset(uint32 offset) { _beginOffset = offset; }
-
+
int32 getCurFrame() { return _curFrame; }
void addPauseTime(uint32 p) { _lastFrameStart += p; _nextFrameStart += p; }
Graphics::Surface *getNextFrame();
@@ -251,7 +251,7 @@ protected:
int8 _audioStreamIndex;
uint _curAudioChunk;
uint32 _beginOffset;
-
+
Graphics::Codec *createCodec(uint32 codecTag, byte bitsPerPixel);
Graphics::Codec *_videoCodec;
bool _noCodecFound;
diff --git a/engines/mohawk/video/qtrle.cpp b/engines/mohawk/video/qtrle.cpp
index 1ad9f99838..c06dbefcb3 100644
--- a/engines/mohawk/video/qtrle.cpp
+++ b/engines/mohawk/video/qtrle.cpp
@@ -25,15 +25,15 @@
// QuickTime RLE Decoder
// Based off ffmpeg's QuickTime RLE decoder (written by Mike Melanson)
-
+
#include "mohawk/video/qtrle.h"
-
+
#include "common/scummsys.h"
#include "common/stream.h"
#include "common/system.h"
#include "graphics/colormasks.h"
#include "graphics/surface.h"
-
+
namespace Mohawk {
QTRLEDecoder::QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) : Graphics::Codec() {
@@ -83,7 +83,7 @@ void QTRLEDecoder::decode1(Common::SeekableReadStream *stream, uint32 rowPtr, ui
pixelPtr += 2 * skip;
if (rleCode < 0) {
- // decode the run length code
+ // decode the run length code
rleCode = -rleCode;
// get the next 2 bytes from the stream, treat them as groups of 8 pixels, and output them rleCode times */
CHECK_STREAM_PTR(2);
@@ -287,7 +287,7 @@ void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, u
CHECK_PIXEL_PTR(rleCode);
- while (rleCode--)
+ while (rleCode--)
rgb[pixelPtr++] = _pixelFormat.RGBToColor(r, g, b);
} else {
CHECK_STREAM_PTR(rleCode * 3);
@@ -333,7 +333,7 @@ void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, u
CHECK_PIXEL_PTR(rleCode);
- while (rleCode--)
+ while (rleCode--)
rgb[pixelPtr++] = _pixelFormat.ARGBToColor(a, r, g, b);
} else {
CHECK_STREAM_PTR(rleCode * 4);
diff --git a/engines/mohawk/video/qtrle.h b/engines/mohawk/video/qtrle.h
index 60796b3803..fdccf626a6 100644
--- a/engines/mohawk/video/qtrle.h
+++ b/engines/mohawk/video/qtrle.h
@@ -22,7 +22,7 @@
* $Id$
*
*/
-
+
#ifndef MOHAWK_QTRLE_H
#define MOHAWK_QTRLE_H
@@ -40,10 +40,10 @@ public:
private:
byte _bitsPerPixel;
-
+
Graphics::Surface *_surface;
Graphics::PixelFormat _pixelFormat;
-
+
void decode1(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange);
void decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange, byte bpp);
void decode8(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange);
diff --git a/engines/mohawk/video/rpza.cpp b/engines/mohawk/video/rpza.cpp
index ae003fa491..f48c055ae2 100644
--- a/engines/mohawk/video/rpza.cpp
+++ b/engines/mohawk/video/rpza.cpp
@@ -22,7 +22,7 @@
* $Id$
*
*/
-
+
// Based off ffmpeg's RPZA decoder
#include "mohawk/video/rpza.h"
@@ -43,7 +43,7 @@ RPZADecoder::RPZADecoder(uint16 width, uint16 height) : Graphics::Codec() {
debug(2, "RPZA corrected width: %d", width);
_surface = new Graphics::Surface();
- _surface->create(width, height, _pixelFormat.bytesPerPixel);
+ _surface->create(width, height, _pixelFormat.bytesPerPixel);
}
#define ADVANCE_BLOCK() \
diff --git a/engines/mohawk/video/rpza.h b/engines/mohawk/video/rpza.h
index 4aa5a5d990..b9522ec2e3 100644
--- a/engines/mohawk/video/rpza.h
+++ b/engines/mohawk/video/rpza.h
@@ -38,7 +38,7 @@ public:
Graphics::Surface *decodeImage(Common::SeekableReadStream *stream);
-private:
+private:
Graphics::Surface *_surface;
Graphics::PixelFormat _pixelFormat;
};
diff --git a/engines/mohawk/video/smc.cpp b/engines/mohawk/video/smc.cpp
index c196d97e1e..4a0d16dfcc 100644
--- a/engines/mohawk/video/smc.cpp
+++ b/engines/mohawk/video/smc.cpp
@@ -22,7 +22,7 @@
* $Id$
*
*/
-
+
// Based off ffmpeg's SMC decoder
#include "mohawk/video/smc.h"
@@ -357,7 +357,7 @@ Graphics::Surface *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) {
}
break;
- // 16-color block encoding (every pixel is a different color)
+ // 16-color block encoding (every pixel is a different color)
case 0xE0:
numBlocks = (opcode & 0x0F) + 1;
diff --git a/engines/mohawk/video/smc.h b/engines/mohawk/video/smc.h
index f5895f7dbd..331fddb9a5 100644
--- a/engines/mohawk/video/smc.h
+++ b/engines/mohawk/video/smc.h
@@ -44,7 +44,7 @@ public:
Graphics::Surface *decodeImage(Common::SeekableReadStream *stream);
-private:
+private:
Graphics::Surface *_surface;
// SMC color tables
diff --git a/engines/mohawk/video/video.cpp b/engines/mohawk/video/video.cpp
index 9e61e2361c..1aa51cf237 100644
--- a/engines/mohawk/video/video.cpp
+++ b/engines/mohawk/video/video.cpp
@@ -30,11 +30,11 @@
#include "common/events.h"
namespace Mohawk {
-
+
VideoManager::VideoManager(MohawkEngine* vm) : _vm(vm) {
_pauseStart = 0;
}
-
+
VideoManager::~VideoManager() {
_mlstRecords.clear();
stopVideos();
@@ -51,7 +51,7 @@ void VideoManager::resumeVideos() {
_videoStreams[i]->addPauseTime(_vm->_system->getMillis() * 100 - _pauseStart);
_videoStreams[i]->resumeAudio();
}
-
+
_pauseStart = 0;
}
@@ -110,18 +110,18 @@ void VideoManager::playMovieCentered(Common::String filename, bool clearScreen)
entry.loop = false;
playMovie(entry);
}
-
+
void VideoManager::playMovie(VideoEntry videoEntry) {
// Add video to the list
_videoStreams.push_back(videoEntry);
-
+
bool continuePlaying = true;
videoEntry->startAudio();
-
+
while (!videoEntry->endOfVideo() && !_vm->shouldQuit() && continuePlaying) {
if (updateBackgroundMovies())
_vm->_system->updateScreen();
-
+
Common::Event event;
while (_vm->_system->getEventManager()->pollEvent(event)) {
switch (event.type) {
@@ -144,11 +144,11 @@ void VideoManager::playMovie(VideoEntry videoEntry) {
break;
}
}
-
+
// Cut down on CPU usage
_vm->_system->delayMillis(10);
}
-
+
videoEntry->stop();
_videoStreams.clear();
@@ -161,24 +161,24 @@ void VideoManager::playBackgroundMovie(Common::String filename, int16 x, int16 y
VideoEntry entry;
entry.video = new QTPlayer();
-
+
if (!entry.video)
return;
-
+
entry->loadFile(file);
-
+
// Center x if requested
if (x < 0)
x = (_vm->_system->getWidth() - entry->getWidth()) / 2;
-
+
// Center y if requested
if (y < 0)
y = (_vm->_system->getHeight() - entry->getHeight()) / 2;
-
+
entry.x = x;
entry.y = y;
entry.loop = loop;
-
+
entry->startAudio();
_videoStreams.push_back(entry);
}
@@ -204,16 +204,16 @@ bool VideoManager::updateBackgroundMovies() {
Graphics::Surface *frame = _videoStreams[i]->getNextFrame();
bool deleteFrame = false;
- if (frame) {
+ if (frame) {
// Convert from 8bpp to the current screen format if necessary
if (frame->bytesPerPixel == 1) {
Graphics::Surface *newFrame = new Graphics::Surface();
Graphics::PixelFormat pixelFormat = _vm->_system->getScreenFormat();
byte *palette = _videoStreams[i]->getPalette();
assert(palette);
-
+
newFrame->create(frame->w, frame->h, pixelFormat.bytesPerPixel);
-
+
for (uint16 j = 0; j < frame->h; j++) {
for (uint16 k = 0; k < frame->w; k++) {
byte palIndex = *((byte *)frame->getBasePtr(k, j));
@@ -226,12 +226,12 @@ bool VideoManager::updateBackgroundMovies() {
*((uint32 *)newFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b);
}
}
-
+
frame = newFrame;
deleteFrame = true;
}
- // Check if we're drawing at a 2x or 4x resolution (because of
+ // Check if we're drawing at a 2x or 4x resolution (because of
// evil QuickTime scaling it first).
if (_videoStreams[i]->getScaleMode() == kScaleHalf || _videoStreams[i]->getScaleMode() == kScaleQuarter) {
byte scaleFactor = (_videoStreams[i]->getScaleMode() == kScaleHalf) ? 2 : 4;
@@ -254,7 +254,7 @@ bool VideoManager::updateBackgroundMovies() {
// We've drawn something to the screen, make sure we update it
updateScreen = true;
-
+
// Delete the frame if we're using the buffer from the 8bpp conversion
if (deleteFrame) {
frame->free();
@@ -289,7 +289,7 @@ void VideoManager::activateMLST(uint16 mlstId, uint16 card) {
if (mlstStream->readUint16BE() != 0xFFFF)
warning("u0[2] in MLST not 0xFFFF");
-
+
mlstRecord.loop = mlstStream->readUint16BE();
mlstRecord.volume = mlstStream->readUint16BE();
mlstRecord.u1 = mlstStream->readUint16BE();
@@ -305,7 +305,7 @@ void VideoManager::activateMLST(uint16 mlstId, uint16 card) {
break;
}
}
-
+
delete mlstStream;
}
@@ -336,7 +336,7 @@ void VideoManager::playMovieBlocking(uint16 id) {
for (uint16 i = 0; i < _mlstRecords.size(); i++)
if (_mlstRecords[i].code == id) {
warning("STUB: Play tMOV %d (blocking) at (%d, %d)", _mlstRecords[i].movieID, _mlstRecords[i].left, _mlstRecords[i].top);
-
+
// TODO: See if a non-blocking movie has been activated with the same id,
// and if so, block input until that movie is finished.
QTPlayer *qtPlayer = new QTPlayer();