diff options
author | Matthew Hoops | 2011-05-11 00:30:02 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-05-11 00:30:28 -0400 |
commit | a1d41da096c0bcf502a85919cb1cb1ee471719c5 (patch) | |
tree | 8c51419daa486f1d4833757db4715dadab6c3497 /engines/scumm | |
parent | accb0c2a5d0c9e7b353cda4b74f511a498ed8073 (diff) | |
parent | 33c3e19cea2a08fbf26ecbe940763e8ee1c37d28 (diff) | |
download | scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.gz scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.bz2 scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.zip |
Merge remote branch 'upstream/master' into t7g-ios
Conflicts:
audio/decoders/qdm2.h
common/util.cpp
engines/groovie/music.cpp
engines/groovie/resource.h
video/qt_decoder.cpp
video/qt_decoder.h
Diffstat (limited to 'engines/scumm')
42 files changed, 661 insertions, 154 deletions
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 861e448221..9fb76d9d63 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -401,7 +401,7 @@ int CharsetRendererClassic::getCharWidth(uint16 chr) { spacing++; } } - + } else if (chr >= 0x80) { return _vm->_2byteWidth / 2; } @@ -618,11 +618,12 @@ int CharsetRendererV3::getCharWidth(uint16 chr) { spacing = 4; } else if (chr & 0x80) { spacing = _vm->_2byteWidth / 2; - } + } } - if (!spacing) + if (!spacing) { spacing = *(_widthTable + chr); + } return spacing; } @@ -777,7 +778,7 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) { (ignoreCharsetMask || !vs->hasTwoBuffers)) { dst = vs->getPixels(_left, drawTop); if (charPtr) - drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->bytesPerPixel); + drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->format.bytesPerPixel); #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE else if (_vm->_cjkFont) _vm->_cjkFont->drawChar(vs, chr, _left, drawTop, _color, _shadowColor); @@ -785,7 +786,7 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) { } else { dst = (byte *)_vm->_textSurface.getBasePtr(_left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier); if (charPtr) - drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.bytesPerPixel, (_vm->_textSurfaceMultiplier == 2 && !is2byte)); + drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.format.bytesPerPixel, (_vm->_textSurfaceMultiplier == 2 && !is2byte)); #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE else if (_vm->_cjkFont) _vm->_cjkFont->drawChar(_vm->_textSurface, chr, _left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier, _color, _shadowColor); @@ -834,7 +835,7 @@ void CharsetRendererV3::drawChar(int chr, Graphics::Surface &s, int x, int y) { height = 8; } dst = (byte *)s.pixels + y * s.pitch + x; - drawBits1(s, dst, charPtr, y, width, height, s.bytesPerPixel); + drawBits1(s, dst, charPtr, y, width, height, s.format.bytesPerPixel); } void CharsetRenderer::translateColor() { @@ -857,17 +858,17 @@ void CharsetRenderer::processTownsCharsetColors(uint8 bytesPerPixel) { if (_vm->_game.platform == Common::kPlatformFMTowns) { for (int i = 0; i < (1 << bytesPerPixel); i++) { uint8 c = _vm->_charsetColorMap[i]; - + if (c > 16) { uint8 t = (_vm->_currentPalette[c * 3] < 32) ? 4 : 12; t |= ((_vm->_currentPalette[c * 3 + 1] < 32) ? 2 : 10); t |= ((_vm->_currentPalette[c * 3 + 1] < 32) ? 1 : 9); c = t; } - + if (c == 0) c = _vm->_townsOverrideShadowColor; - + c = ((c & 0x0f) << 4) | (c & 0x0f); _vm->_townsCharsetColorMap[i] = c; } @@ -920,12 +921,12 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) { noSjis = true; } } - + if (useTownsFontRomCharacter(chr) && !noSjis) { charPtr = 0; _vm->_cjkChar = chr; enableShadow(true); - + width = getCharWidth(chr); // For whatever reason MI1 uses a different font width // for alignment calculation and for drawing when @@ -947,7 +948,7 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) { height++; } } else -#endif +#endif { uint32 charOffs = READ_LE_UINT32(_fontPtr + chr * 4 + 4); assert(charOffs < 0x14000); @@ -1096,7 +1097,7 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr, } else #endif if (is2byte) { - drawBits1(dstSurface, dstPtr, charPtr, drawTop, origWidth, origHeight, dstSurface.bytesPerPixel); + drawBits1(dstSurface, dstPtr, charPtr, drawTop, origWidth, origHeight, dstSurface.format.bytesPerPixel); } else { drawBitsN(dstSurface, dstPtr, charPtr, *_fontPtr, drawTop, origWidth, origHeight, _vm->_textSurfaceMultiplier == 2); } @@ -1173,7 +1174,7 @@ void CharsetRendererClassic::drawChar(int chr, Graphics::Surface &s, int x, int dst = (byte *)s.pixels + y * s.pitch + x; if (is2byte) { - drawBits1(s, dst, charPtr, y, width, height, s.bytesPerPixel); + drawBits1(s, dst, charPtr, y, width, height, s.format.bytesPerPixel); } else { drawBitsN(s, dst, charPtr, *_fontPtr, y, width, height); } @@ -1259,14 +1260,14 @@ void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, con #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE byte *dst3 = dst2; byte *dst4 = dst2; - if (scale2x) { + if (scale2x) { dst3 = dst2 + s.pitch; dst4 = dst3 + s.pitch; pitch <<= 1; } if (_vm->_game.platform == Common::kPlatformFMTowns && _vm->_game.version == 5) col = _vm->_townsCharsetColorMap[1]; -#endif +#endif for (y = 0; y < height && y + drawTop < s.h; y++) { for (x = 0; x < width; x++) { @@ -1287,19 +1288,19 @@ void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, con if (scale2x) { dst[2] = dst[3] = dst2[2] = dst2[3] = _shadowColor; dst3[0] = dst4[0] = dst3[1] = dst4[1] = _shadowColor; - } else + } else #endif { dst[1] = dst2[0] = _shadowColor; if (_shadowMode != kFMTOWNSShadowMode) dst2[1] = _shadowColor; - } + } } dst[0] = col; #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE if (scale2x) - dst[1] = dst2[0] = dst2[1] = col; + dst[1] = dst2[0] = dst2[1] = col; #endif } } @@ -1317,7 +1318,7 @@ void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, con dst += pitch; dst2 += pitch; -#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE +#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE dst3 += pitch; dst4 += pitch; #endif @@ -1519,10 +1520,10 @@ void CharsetRendererNES::printChar(int chr, bool ignoreCharsetMask) { if (ignoreCharsetMask || !vs->hasTwoBuffers) { dst = vs->getPixels(_left, drawTop); - drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->bytesPerPixel); + drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->format.bytesPerPixel); } else { dst = (byte *)_vm->_textSurface.pixels + _top * _vm->_textSurface.pitch + _left; - drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.bytesPerPixel); + drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.format.bytesPerPixel); } if (_str.left > _left) @@ -1552,7 +1553,7 @@ void CharsetRendererNES::drawChar(int chr, Graphics::Surface &s, int x, int y) { height = 8; dst = (byte *)s.pixels + y * s.pitch + x; - drawBits1(s, dst, charPtr, y, width, height, s.bytesPerPixel); + drawBits1(s, dst, charPtr, y, width, height, s.format.bytesPerPixel); } void CharsetRendererNES::drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth, bool scalex) { diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp index cd366fcfd4..d0a3ec6e11 100644 --- a/engines/scumm/costume.cpp +++ b/engines/scumm/costume.cpp @@ -419,6 +419,11 @@ void ClassicCostumeRenderer::procC64(Codec1 &v1, int actor) { #undef MASK_AT #ifdef USE_ARM_COSTUME_ASM + +#ifndef IPHONE +#define ClassicProc3RendererShadowARM _ClassicProc3RendererShadowARM +#endif + extern "C" int ClassicProc3RendererShadowARM(int _scaleY, ClassicCostumeRenderer::Codec1 *v1, Graphics::Surface *_out, diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index bb3c4bcc02..820605924c 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -385,7 +385,7 @@ void ScummEngine_v5::redefineBuiltinCursorFromChar(int index, int chr) { s.pitch = s.w; // s.h = 17 for FM-TOWNS Loom Japanese. Fixes bug #1166917 assert(s.w <= 16 && s.h <= 17); - s.bytesPerPixel = 1; + s.format = Graphics::PixelFormat::createFormatCLUT8(); _charset->drawChar(chr, s, 0, 0); diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index 63188c1d7a..4c1942b865 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -23,7 +23,6 @@ * */ -#include "common/config-manager.h" #include "common/debug-channels.h" #include "common/file.h" #include "common/str.h" diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 87ec7b85a4..51b46b033c 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -23,6 +23,9 @@ * */ +// FIXME: Avoid using printf +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include "base/plugins.h" #include "common/archive.h" @@ -994,7 +997,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co Common::FSList fslist; Common::FSNode dir(ConfMan.get("path")); if (!dir.isDirectory()) - return Common::kInvalidPathError; + return Common::kPathNotDirectory; if (!dir.getChildren(fslist, Common::FSNode::kListFilesOnly)) return Common::kNoGameDataFoundError; @@ -1131,6 +1134,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co break; case 62: case 61: + case 60: *engine = new ScummEngine_v60he(syst, res); break; default: diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index a5542ca868..952abdb39a 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -372,7 +372,7 @@ static const GameSettings gameVariantsTable[] = { {"arttime", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, {"baseball2001", 0, 0, GID_BASEBALL2001, 6, 99, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, {"readtime", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, - {"SoccerMLS", 0, 0, GID_SOCCER, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, + {"SoccerMLS", 0, 0, GID_SOCCERMLS, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, {"spyozon", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, {"freddicove", "", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, @@ -386,7 +386,7 @@ static const GameSettings gameVariantsTable[] = { {"Baseball2003", 0, 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, {"basketball", 0, 0, GID_BASKETBALL, 6, 100, MDT_NONE, GF_USE_KEY| GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, {"football2002", 0, 0, GID_FOOTBALL, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, - {"Soccer2004", 0, 0, GID_SOCCER, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, + {"Soccer2004", 0, 0, GID_SOCCER2004, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, // U32 code required, for testing only {"moonbase", 0, 0, GID_MOONBASE, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI}, @@ -483,6 +483,7 @@ static const GameFilenamePattern gameFilenamesTable[] = { #ifdef ENABLE_SCUMM_7_8 { "dig", "dig.la%d", kGenDiskNum, UNK_LANG, UNK, 0 }, + { "dig", "thedig.la%d", kGenDiskNum, UNK_LANG, UNK, "Demo" }, // Used by an alternate version of the demo { "dig", "The Dig Data", kGenUnchanged, UNK_LANG, Common::kPlatformMacintosh, 0 }, { "dig", "The Dig Demo Data", kGenUnchanged, UNK_LANG, Common::kPlatformMacintosh, "Demo" }, diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index 0e6e18905f..40e549471b 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -33,8 +33,8 @@ #include "scumm/detection.h" namespace GUI { - class ListWidget; - class CommandSender; +class ListWidget; +class CommandSender; } diff --git a/engines/scumm/file_nes.cpp b/engines/scumm/file_nes.cpp index d9d84f04ff..47704d6eaf 100644 --- a/engines/scumm/file_nes.cpp +++ b/engines/scumm/file_nes.cpp @@ -28,6 +28,7 @@ #include "common/endian.h" #include "common/md5.h" #include "common/memstream.h" +#include "common/textconsole.h" namespace Scumm { diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index a6a97ec426..e7abd5610e 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -36,6 +36,12 @@ #include "scumm/util.h" #ifdef USE_ARM_GFX_ASM + +#ifndef IPHONE +#define asmDrawStripToScreen _asmDrawStripToScreen +#define asmCopy8Col _asmCopy8Col +#endif + extern "C" void asmDrawStripToScreen(int height, int width, void const* text, void const* src, byte* dst, int vsPitch, int vmScreenWidth, int textSurfacePitch); extern "C" void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height, uint8 bitDepth); @@ -385,8 +391,11 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int vs->hasTwoBuffers = twobufs; vs->xstart = 0; vs->backBuf = NULL; - vs->bytesPerPixel = (_game.features & GF_16BIT_COLOR) ? 2 : 1; - vs->pitch = width * vs->bytesPerPixel; + if (_game.features & GF_16BIT_COLOR) + vs->format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); + else + vs->format = Graphics::PixelFormat::createFormatCLUT8(); + vs->pitch = width * vs->format.bytesPerPixel; if (_game.version >= 7) { // Increase the pitch by one; needed to accomodate the extra screen @@ -622,7 +631,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i int m = _textSurfaceMultiplier; int vsPitch; int pitch = vs->pitch; - vsPitch = vs->pitch - width * vs->bytesPerPixel; + vsPitch = vs->pitch - width * vs->format.bytesPerPixel; if (_game.version < 7) { @@ -667,7 +676,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i } else { WRITE_UINT16(dstPtr, _16BitPalette[tmp]); dstPtr += 2; } - srcPtr += vs->bytesPerPixel; + srcPtr += vs->format.bytesPerPixel; } srcPtr += vsPitch; textPtr += _textSurface.pitch - width * m; @@ -706,7 +715,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i } #endif src = _compositeBuf; - pitch = width * vs->bytesPerPixel; + pitch = width * vs->format.bytesPerPixel; if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) { ditherHerc(_compositeBuf, _herculesBuf, width, &x, &y, &width, &height); @@ -1036,17 +1045,17 @@ void ScummEngine::restoreBackground(Common::Rect rect, byte backColor) { return; if (vs->hasTwoBuffers && _currentRoom != 0 && isLightOn()) { - blit(screenBuf, vs->pitch, vs->getBackPixels(rect.left, rect.top), vs->pitch, width, height, vs->bytesPerPixel); + blit(screenBuf, vs->pitch, vs->getBackPixels(rect.left, rect.top), vs->pitch, width, height, vs->format.bytesPerPixel); if (vs->number == kMainVirtScreen && _charset->_hasMask) { #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE if (_game.platform == Common::kPlatformFMTowns) { byte *mask = (byte *)_textSurface.getBasePtr(rect.left * _textSurfaceMultiplier, (rect.top + vs->topline) * _textSurfaceMultiplier); - fill(mask, _textSurface.pitch, 0, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.bytesPerPixel); + fill(mask, _textSurface.pitch, 0, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.format.bytesPerPixel); } else #endif { byte *mask = (byte *)_textSurface.getBasePtr(rect.left, rect.top - _screenTop); - fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.bytesPerPixel); + fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.format.bytesPerPixel); } } } else { @@ -1054,14 +1063,14 @@ void ScummEngine::restoreBackground(Common::Rect rect, byte backColor) { if (_game.platform == Common::kPlatformFMTowns) { backColor |= (backColor << 4); byte *mask = (byte *)_textSurface.getBasePtr(rect.left * _textSurfaceMultiplier, (rect.top + vs->topline) * _textSurfaceMultiplier); - fill(mask, _textSurface.pitch, backColor, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.bytesPerPixel); + fill(mask, _textSurface.pitch, backColor, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.format.bytesPerPixel); } #endif if (_game.features & GF_16BIT_COLOR) - fill(screenBuf, vs->pitch, _16BitPalette[backColor], width, height, vs->bytesPerPixel); + fill(screenBuf, vs->pitch, _16BitPalette[backColor], width, height, vs->format.bytesPerPixel); else - fill(screenBuf, vs->pitch, backColor, width, height, vs->bytesPerPixel); + fill(screenBuf, vs->pitch, backColor, width, height, vs->format.bytesPerPixel); } } @@ -1090,7 +1099,7 @@ void ScummEngine::restoreCharsetBg() { if (vs->number != kMainVirtScreen) { // Restore from back buffer const byte *backBuf = vs->getBackPixels(0, 0); - blit(screenBuf, vs->pitch, backBuf, vs->pitch, vs->w, vs->h, vs->bytesPerPixel); + blit(screenBuf, vs->pitch, backBuf, vs->pitch, vs->w, vs->h, vs->format.bytesPerPixel); } } else { // Clear area @@ -1118,7 +1127,7 @@ void ScummEngine::clearTextSurface() { #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE _game.platform == Common::kPlatformFMTowns ? 0 : #endif - CHARSET_MASK_TRANSPARENCY, _textSurface.w, _textSurface.h, _textSurface.bytesPerPixel); + CHARSET_MASK_TRANSPARENCY, _textSurface.w, _textSurface.h, _textSurface.format.bytesPerPixel); } byte *ScummEngine::getMaskBuffer(int x, int y, int z) { @@ -1291,56 +1300,56 @@ void ScummEngine::drawBox(int x, int y, int x2, int y2, int color) { if (vs->number != kMainVirtScreen) error("can only copy bg to main window"); - blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->bytesPerPixel); + blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->format.bytesPerPixel); if (_charset->_hasMask) { byte *mask = (byte *)_textSurface.getBasePtr(x * _textSurfaceMultiplier, (y - _screenTop) * _textSurfaceMultiplier); - fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.bytesPerPixel); + fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.format.bytesPerPixel); } } } else if (_game.heversion >= 72) { // Flags are used for different methods in HE games uint32 flags = color; if ((flags & 0x2000) || (flags & 0x4000000)) { - blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->bytesPerPixel); + blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->format.bytesPerPixel); } else if ((flags & 0x4000) || (flags & 0x2000000)) { - blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height, vs->bytesPerPixel); + blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height, vs->format.bytesPerPixel); } else if ((flags & 0x8000) || (flags & 0x1000000)) { flags &= (flags & 0x1000000) ? 0xFFFFFF : 0x7FFF; - fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel); - fill(bgbuff, vs->pitch, flags, width, height, vs->bytesPerPixel); + fill(backbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel); + fill(bgbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel); } else { - fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel); + fill(backbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel); } } else if (_game.heversion >= 60) { // Flags are used for different methods in HE games uint16 flags = color; if (flags & 0x2000) { - blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->bytesPerPixel); + blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->format.bytesPerPixel); } else if (flags & 0x4000) { - blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height, vs->bytesPerPixel); + blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height, vs->format.bytesPerPixel); } else if (flags & 0x8000) { flags &= 0x7FFF; - fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel); - fill(bgbuff, vs->pitch, flags, width, height, vs->bytesPerPixel); + fill(backbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel); + fill(bgbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel); } else { - fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel); + fill(backbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel); } } else { if (_game.features & GF_16BIT_COLOR) { - fill(backbuff, vs->pitch, _16BitPalette[color], width, height, vs->bytesPerPixel); + fill(backbuff, vs->pitch, _16BitPalette[color], width, height, vs->format.bytesPerPixel); } else { #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE if (_game.platform == Common::kPlatformFMTowns) { color = ((color & 0x0f) << 4) | (color & 0x0f); byte *mask = (byte *)_textSurface.getBasePtr(x * _textSurfaceMultiplier, (y - _screenTop + vs->topline) * _textSurfaceMultiplier); - fill(mask, _textSurface.pitch, color, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.bytesPerPixel); + fill(mask, _textSurface.pitch, color, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.format.bytesPerPixel); if (_game.id == GID_MONKEY2 || _game.id == GID_INDY4 || ((_game.id == GID_INDY3 || _game.id == GID_ZAK) && vs->number != kTextVirtScreen) || (_game.id == GID_LOOM && vs->number == kMainVirtScreen)) return; } #endif - fill(backbuff, vs->pitch, color, width, height, vs->bytesPerPixel); + fill(backbuff, vs->pitch, color, width, height, vs->format.bytesPerPixel); } } } @@ -1379,7 +1388,7 @@ void ScummEngine_v5::drawFlashlight() { _flashlight.y, _flashlight.y + _flashlight.h, USAGE_BIT_DIRTY); if (_flashlight.buffer) { - fill(_flashlight.buffer, vs->pitch, 0, _flashlight.w, _flashlight.h, vs->bytesPerPixel); + fill(_flashlight.buffer, vs->pitch, 0, _flashlight.w, _flashlight.h, vs->format.bytesPerPixel); } _flashlight.isDrawn = false; } @@ -1426,20 +1435,20 @@ void ScummEngine_v5::drawFlashlight() { _flashlight.buffer = vs->getPixels(_flashlight.x, _flashlight.y); bgbak = vs->getBackPixels(_flashlight.x, _flashlight.y); - blit(_flashlight.buffer, vs->pitch, bgbak, vs->pitch, _flashlight.w, _flashlight.h, vs->bytesPerPixel); + blit(_flashlight.buffer, vs->pitch, bgbak, vs->pitch, _flashlight.w, _flashlight.h, vs->format.bytesPerPixel); // Round the corners. To do so, we simply hard-code a set of nicely // rounded corners. static const int corner_data[] = { 8, 6, 4, 3, 2, 2, 1, 1 }; int minrow = 0; - int maxcol = (_flashlight.w - 1) * vs->bytesPerPixel; + int maxcol = (_flashlight.w - 1) * vs->format.bytesPerPixel; int maxrow = (_flashlight.h - 1) * vs->pitch; for (i = 0; i < 8; i++, minrow += vs->pitch, maxrow -= vs->pitch) { int d = corner_data[i]; for (j = 0; j < d; j++) { - if (vs->bytesPerPixel == 2) { + if (vs->format.bytesPerPixel == 2) { WRITE_UINT16(&_flashlight.buffer[minrow + 2 * j], 0); WRITE_UINT16(&_flashlight.buffer[minrow + maxcol - 2 * j], 0); WRITE_UINT16(&_flashlight.buffer[maxrow + 2 * j], 0); @@ -1755,7 +1764,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const } #endif - _vertStripNextInc = height * vs->pitch - 1 * vs->bytesPerPixel; + _vertStripNextInc = height * vs->pitch - 1 * vs->format.bytesPerPixel; _objectMode = (flag & dbObjectMode) == dbObjectMode; prepareDrawBitmap(ptr, vs, x, y, width, height, stripnr, numstrip); @@ -1788,9 +1797,9 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const // In the case of a double buffered virtual screen, we draw to // the backbuffer, otherwise to the primary surface memory. if (vs->hasTwoBuffers) - dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->bytesPerPixel); + dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); else - dstPtr = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->bytesPerPixel); + dstPtr = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); transpStrip = drawStrip(dstPtr, vs, x, y, width, height, stripnr, smap_ptr); @@ -1799,11 +1808,11 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const transpStrip = true; if (vs->hasTwoBuffers) { - byte *frontBuf = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->bytesPerPixel); + byte *frontBuf = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); if (lightsOn) - copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->bytesPerPixel); + copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->format.bytesPerPixel); else - clear8Col(frontBuf, vs->pitch, height, vs->bytesPerPixel); + clear8Col(frontBuf, vs->pitch, height, vs->format.bytesPerPixel); } decodeMask(x, y, width, height, stripnr, numzbuf, zplane_list, transpStrip, flag, tmsk_ptr); @@ -2039,7 +2048,7 @@ void Gdi::drawBMAPBg(const byte *ptr, VirtScreen *vs) { drawStripHE(dst, vs->pitch, bmap_ptr, vs->w, vs->h, true); break; case 150: - fill(dst, vs->pitch, *bmap_ptr, vs->w, vs->h, vs->bytesPerPixel); + fill(dst, vs->pitch, *bmap_ptr, vs->w, vs->h, vs->format.bytesPerPixel); break; default: // Alternative russian freddi3 uses badly formatted bitmaps @@ -2150,7 +2159,7 @@ void ScummEngine_v70he::restoreBackgroundHE(Common::Rect rect, int dirtybit) { assert(rw <= _screenWidth && rw > 0); assert(rh <= _screenHeight && rh > 0); - blit(dst, _virtscr[kMainVirtScreen].pitch, src, _virtscr[kMainVirtScreen].pitch, rw, rh, vs->bytesPerPixel); + blit(dst, _virtscr[kMainVirtScreen].pitch, src, _virtscr[kMainVirtScreen].pitch, rw, rh, vs->format.bytesPerPixel); markRectAsDirty(kMainVirtScreen, rect, dirtybit); } #endif @@ -2180,15 +2189,15 @@ void Gdi::resetBackground(int top, int bottom, int strip) { if (bottom > vs->bdirty[strip]) vs->bdirty[strip] = bottom; - bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->bytesPerPixel; - backbuff_ptr = (byte *)vs->pixels + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->bytesPerPixel; + bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel; + backbuff_ptr = (byte *)vs->pixels + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel; numLinesToProcess = bottom - top; if (numLinesToProcess) { if (_vm->isLightOn()) { - copy8Col(backbuff_ptr, vs->pitch, bgbak_ptr, numLinesToProcess, vs->bytesPerPixel); + copy8Col(backbuff_ptr, vs->pitch, bgbak_ptr, numLinesToProcess, vs->format.bytesPerPixel); } else { - clear8Col(backbuff_ptr, vs->pitch, numLinesToProcess, vs->bytesPerPixel); + clear8Col(backbuff_ptr, vs->pitch, numLinesToProcess, vs->format.bytesPerPixel); } } } diff --git a/engines/scumm/gfx.h b/engines/scumm/gfx.h index c6062ef9be..3f69d75efd 100644 --- a/engines/scumm/gfx.h +++ b/engines/scumm/gfx.h @@ -158,11 +158,11 @@ struct VirtScreen : Graphics::Surface { } byte *getPixels(int x, int y) const { - return (byte *)pixels + y * pitch + (xstart + x) * bytesPerPixel; + return (byte *)pixels + y * pitch + (xstart + x) * format.bytesPerPixel; } byte *getBackPixels(int x, int y) const { - return (byte *)backBuf + y * pitch + (xstart + x) * bytesPerPixel; + return (byte *)backBuf + y * pitch + (xstart + x) * format.bytesPerPixel; } }; diff --git a/engines/scumm/gfxARM.s b/engines/scumm/gfxARM.s index 34de954a17..9f7c2949b3 100644 --- a/engines/scumm/gfxARM.s +++ b/engines/scumm/gfxARM.s @@ -25,8 +25,8 @@ .text - .global asmDrawStripToScreen - .global asmCopy8Col + .global _asmDrawStripToScreen + .global _asmCopy8Col @ ARM implementation of asmDrawStripToScreen. @ @@ -44,7 +44,7 @@ @ In addition, we assume that text, src and dst are all word (4 byte) @ aligned. This is the same assumption that the old 'inline' version @ made. -asmDrawStripToScreen: +_asmDrawStripToScreen: @ r0 = height @ r1 = width @ r2 = text @@ -125,7 +125,7 @@ end: @ In addition, we assume that src and dst are both word (4 byte) @ aligned. This is the same assumption that the old 'inline' version @ made. -asmCopy8Col: +_asmCopy8Col: @ r0 = dst @ r1 = dstPitch @ r2 = src diff --git a/engines/scumm/gfx_towns.cpp b/engines/scumm/gfx_towns.cpp index abf2da63a6..78c7ef23f1 100644 --- a/engines/scumm/gfx_towns.cpp +++ b/engines/scumm/gfx_towns.cpp @@ -48,7 +48,7 @@ void ScummEngine::towns_drawStripToScreen(VirtScreen *vs, int dstX, int dstY, in int dp1 = _townsScreen->getLayerPitch(0) - width * _townsScreen->getLayerBpp(0); int dp2 = _townsScreen->getLayerPitch(1) - width * m * _townsScreen->getLayerBpp(1); - int sp1 = vs->pitch - (width * vs->bytesPerPixel); + int sp1 = vs->pitch - (width * vs->format.bytesPerPixel); int sp2 = _textSurface.pitch - width * m; if (vs->number == kMainVirtScreen || _game.id == GID_INDY3 || _game.id == GID_ZAK) { diff --git a/engines/scumm/he/cup_player_he.cpp b/engines/scumm/he/cup_player_he.cpp index a16af73135..5cd75a5c62 100644 --- a/engines/scumm/he/cup_player_he.cpp +++ b/engines/scumm/he/cup_player_he.cpp @@ -30,6 +30,7 @@ #include "audio/audiostream.h" #include "audio/mixer.h" #include "audio/decoders/raw.h" +#include "graphics/palette.h" #include "scumm/scumm.h" #include "scumm/util.h" #include "scumm/he/intern_he.h" diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp index c088fd6e22..297c2992db 100644 --- a/engines/scumm/he/logic_he.cpp +++ b/engines/scumm/he/logic_he.cpp @@ -823,8 +823,18 @@ int LogicHEsoccer::versionID() { } LogicHEsoccer::LogicHEsoccer(ScummEngine_v90he *vm) : LogicHE(vm) { - // Originally it used 0x1b0d bytes _userDataD = (double *)calloc(1732, sizeof(double)); + _intArray1 = 0; + _intArray2 = 0; + _intArraysAllocated = false; + _array1013 = 0; + _array1013Allocated = false; +} + +LogicHEsoccer::~LogicHEsoccer() { + free(_userDataD); + op_1020(); // clear int arrays + delete[] _array1013; } int32 LogicHEsoccer::dispatch(int op, int numArgs, int32 *args) { @@ -843,6 +853,37 @@ int32 LogicHEsoccer::dispatch(int op, int numArgs, int32 *args) { res = op_1004(args); break; + case 1006: + res = op_1006(args[0], args[1], args[2], args[3]); + break; + + case 1011: + // args[4] is ignored! + // soccer passes the argument, but then ends up not using it + // Makes sense that they removed it for soccermls + res = op_1011(args[0], args[1], args[2], args[3], args[5]); + break; + + case 1012: + res = op_1012(args); + break; + + case 1013: + res = op_1013(args[0], args[1], args[2]); + break; + + case 1019: + res = op_1019(args); + break; + + case 1020: + res = op_1020(); + break; + + case 1021: + res = op_1021(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + break; + case 8221968: // Someone had a fun and used his birthday as opcode number res = getFromArray(args[0], args[1], args[2]); @@ -856,6 +897,32 @@ int32 LogicHEsoccer::dispatch(int op, int numArgs, int32 *args) { return res; } +void LogicHEsoccer::beforeBootScript() { + if (_intArraysAllocated) + op_1020(); + + _userDataD[530] = 0; +} + +void LogicHEsoccer::initOnce() { + // The original sets some paths here that we don't need to worry about + _array1013Allocated = false; + _userDataD[530] = 0; +} + +int LogicHEsoccer::startOfFrame() { + // This variable is some sort of flag that activates this mode + int res = (int)_userDataD[530]; + + // _userDataD[535] is not used! + // soccer passes the argument, but then ends up not using it + // Makes sense that they removed it for soccermls + if (res) + res = op_1011((int)_userDataD[531], (int)_userDataD[532], (int)_userDataD[533], (int)_userDataD[534], (int)_userDataD[536]); + + return res; +} + int LogicHEsoccer::op_1001(int32 *args) { return (int)(args[0] * sin((float)args[1])); } @@ -901,16 +968,16 @@ int LogicHEsoccer::op_1004(int32 *args) { return 1; } -int LogicHEsoccer::op_1006(int32 *args) { - double a1 = args[1] * 0.01; - double a2 = args[2] * 0.01; - double a3 = args[3] * 0.01; +int LogicHEsoccer::op_1006(int32 a1, int32 a2, int32 a3, int32 a4) { + double v1 = a1 * 0.01; + double v2 = a2 * 0.01; + double v3 = a3 * 0.01; double var108, var109; - _userDataD[529] = args[4]; + _userDataD[529] = a4; - var108 = atan2(a1, a3) * _userDataD[523] - args[4]; - var109 = _userDataD[526] - _userDataD[528] + (_userDataD[521] - atan2(_userDataD[524] - a2, a3)) * _userDataD[522]; + var108 = atan2(v1, v3) * _userDataD[523] - a4; + var109 = _userDataD[526] - _userDataD[528] + (_userDataD[521] - atan2(_userDataD[524] - v2, v3)) * _userDataD[522]; writeScummVar(108, (int32)var108); writeScummVar(109, (int32)var109); @@ -919,37 +986,358 @@ int LogicHEsoccer::op_1006(int32 *args) { } int LogicHEsoccer::op_1007(int32 *args) { - // TODO: Used when the HE logo is shown + // Used when the HE logo is shown + // This initializes the _userDataD fields that are used in op_1006/op_1011 + + _intArraysAllocated = false; + double v14 = (double)args[0] * 0.01; + double v13 = (double)args[2] * 0.01; + _userDataD[524] = v14; + double v12 = atan2(v13, v14); + _userDataD[520] = v12; + double v15 = atan2(v13 - (double)args[4] * 0.01, (double)args[3] * 0.01); + double v19 = v15 * 2.0; + double v17 = atan2(v13 - (double)args[4] * 0.01, v14); + _userDataD[519] = v19; + _userDataD[521] = v17; + _userDataD[525] = (v17 - v12) * 2.0; + _userDataD[527] = (double)args[5]; + _userDataD[526] = (double)args[6]; + _userDataD[528] = (double)args[7]; + _userDataD[522] = _userDataD[526] / _userDataD[525]; + _userDataD[523] = _userDataD[527] / _userDataD[519]; + _userDataD[518] = v13; + + // Clear both byte arrays + memset(_byteArray1, 0, 4096); + memset(_byteArray2, 0, 585); + + if (_array1013Allocated == 0 ) + op_1013(4, args[8], args[9]); return 1; } +// Returns the square root of the sum of the squares of the arguments +static inline double sqrtSquare(double a1, double a2, double a3) { + return sqrt(a1 * a1 + a2 * a2 + a3 * a3); +} + int LogicHEsoccer::op_1008(int32 *args) { // TODO: Used during a match (kicking?) return 1; } +int LogicHEsoccer::op_1011(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5) { + // This is called on each frame by startOfFrame() if activated by op_1012. + // This seems to do player placement! + + float v28 = 0.0; + + for (int i = 0; i < 18; i++) { + // These seem to be some sort of percent? of angles? + int v32 = getFromArray(a1, i, 0); + int v6 = getFromArray(a1, i, 1); + int v30 = getFromArray(a1, i, 2); + + float v29 = (double)v32 / 100.0; + v28 = (double)v6 / 100.0; + float v31 = (double)v30 / 100.0; + + if (i < 13) { + int v25 = ((v32 + 2760) / 500 >= 0) ? ((v32 + 2750) / 500) : 0; + int v24 = 10; + + if (v25 <= 10) { + int v23 = 0; + if ((v32 + 2750) / 500 >= 0) + v23 = (v32 + 2750) / 500; + + v24 = v23; + } + + int v22 = 0; + if ((9219 - v30) / 500 >= 0) + v22 = (9219 - v30) / 500; + + int v21 = 6; + if (v22 <= 6) { + int v20 = 0; + if ((9219 - v30) / 500 >= 0) + v20 = (9219 - v30) / 500; + v21 = v20; + } + + if (a5) + putInArray(a5, 0, i, v24 + 11 * v21); + } + + float v7 = atan2(_userDataD[524] - v28, (double)v31); + int v8 = (int)(_userDataD[526] - (_userDataD[521] - v7) * _userDataD[522] + 300.0); + + double v9 = atan2(_userDataD[523], (double)v31); + // x/y position? + putInArray(a2, i, 0, (int32)(v29 * v9 + 640.0)); + putInArray(a2, i, 1, v8); + + double v10 = atan2(_userDataD[524], (double)v31); + int v12 = (int)(_userDataD[526] - (_userDataD[521] - (float)v10) * _userDataD[522] + 300.0); + double v13 = _userDataD[523]; + + v29 = atan2(v29, v31); + // x/y position? + putInArray(a2, i + 22, 0, (int32)(v29 * v13 + 640.0)); + putInArray(a2, i + 22, 1, v12); + } + + // soccer only uses one array here + // soccermls/soccer2004 use four + int start = (_vm->_game.id == GID_SOCCER) ? 19 : 18; + int end = (_vm->_game.id == GID_SOCCER) ? 19 : 21; + + for (int i = start; i <= end; i++) { + int v14 = getFromArray(a2, i, 0); + int v15 = getFromArray(a2, i, 1); + + // This retains v28 from (i == 17)? + float v16 = _userDataD[524] - v28; + float v17 = v16 / tan((_userDataD[528] + v15 - _userDataD[526]) / (_userDataD[522] + _userDataD[521])); + double v18 = tan((double)(v14 - 640) / _userDataD[523]) * v17; + putInArray(a1, i, 0, (int)(v18 * 100.0)); + putInArray(a1, i, 2, (int)(v17 * 100.0)); + } + + op_1011_sub(a1, a3, a4, a4); + + return 1; +} + +static inline int distance(int a1, int a2, int a3, int a4) { + return (int)sqrt((double)((a4 - a3) * (a4 - a3) + (a2 - a1) * (a2 - a1))); +} + +void LogicHEsoccer::op_1011_sub(int32 a1, int32 a2, int32 a3, int32 a4) { + // As you can guess, this is called from op_1011 + // This seems to be checking distances between the players and the ball + // and which distance is the shortest. + + int v6[13]; + int v7[13]; + int v8[13]; + int v18[195]; + + for (int i = 0; i < 13; i++) { + v6[i] = 0; + v7[i] = getFromArray(a1, i, 0); + v8[i] = getFromArray(a1, i, 2); + } + + // 12 here, 13 up there + // Probably 12 for players, 13 for players+ball + for (int i = 0; i < 12; i++) { + int v22 = a4; + for (int j = i + 1; j < 13; j++) { + v18[i * 15 + j] = distance(v7[i], v7[j], v8[i], v8[j]); + putInArray(a2, i, j, v18[i * 15 + j]); + putInArray(a2, j, i, v18[i * 15 + j]); + if (v18[i * 15 + j] < v22) { + v22 = v18[i * 15 + j]; + v6[i] = j + 1; + v6[j] = i + 1; + } + } + } + + int v13 = getFromArray(a1, 18, 0); + int v14 = getFromArray(a1, 18, 2); + int v15 = getFromArray(a1, 19, 0); + int v16 = getFromArray(a1, 19, 2); + int v19[15]; + int v20[15]; + + if (_vm->_game.id == GID_SOCCER) { + // soccer gets to be different + for (int i = 0; i < 13; i++) + v20[i] = distance(v13, v7[i], v14, v8[i]); + + for (int i = 0; i < 13; i++) + v19[i] = distance(v15, v7[i], v16, v8[i]); + } else { + // soccermls and soccer2004 use two other arrays here + int v9 = getFromArray(a1, 20, 0); + int v10 = getFromArray(a1, 20, 2); + int v11 = getFromArray(a1, 21, 0); + int v12 = getFromArray(a1, 21, 2); + + for (int i = 0; i < 6; i++) { + v20[i] = distance(v9, v7[i], v10, v8[i]); + v19[i] = distance(v13, v7[i], v14, v8[i]); + } + + for (int i = 6; i < 13; i++) { + v20[i] = distance(v11, v7[i], v12, v8[i]); + v19[i] = distance(v15, v7[i], v16, v8[i]); + } + } + + for (int i = 0; i < 13; i++) { + putInArray(a2, 14, i, v20[i]); + putInArray(a2, i, 14, v20[i]); + putInArray(a2, 13, i, v19[i]); + putInArray(a2, i, 13, v19[i]); + putInArray(a3, 0, i, v6[i]); + } +} + int LogicHEsoccer::op_1012(int32 *args) { - // TODO: Used after op_1019 + // Used after op_1019 + // This function activates startOfFrame() to call op_1011 + // (Possibly field parameters?) + + _userDataD[530] = (args[0] != 0) ? 1 : 0; + _userDataD[531] = args[1]; + _userDataD[532] = args[2]; + _userDataD[533] = args[3]; + _userDataD[534] = args[4]; + _userDataD[535] = args[5]; // unused!!! + _userDataD[536] = args[6]; + + return 1; +} + +// Some strange power operation, ignores negative exponents +static inline double u32Pow(float a1, int a2) { + if (a2 < 0) + return 0.0; + + float v4 = 1.0; + + for (int i = 1; i <= a2; i++) + v4 *= a1; + + return v4; +} + +int LogicHEsoccer::op_sub5(int a1, int a2, int a3) { + byte *v9 = _array1013 + 44 * a2; + + *((uint32 *)v9 + 4) = a3; + *((uint32 *)v9) = a2; + + if (a1 > 2) { + // Casual observation: 585 is also the size of _byteArray2 + *((uint32 *)v9 + 40) = 8 * a2 - 585; + for (int i = 0; i < 8; i++) + *((uint32 *)v9 + 4 * i + 8) = 0xffffffff; + } else { + for (int i = 0; i < 8; i++) + *((uint32 *)v9 + 4 * i + 8) = op_sub5(a1 + 1, i + 8 * a2 + 1, a2); + } + + return a2; +} + +int LogicHEsoccer::op_1013(int32 a1, int32 a2, int32 a3) { + // Creates _array1013 for *some* purpose + // _array1013Temp is used again op_1014 for some reason... + // Seems to be used in op_1015 + + int v4 = (int)((1.0 - u32Pow(8.0, 4)) / -7.0); + + _array1013 = new byte[v4 * 44]; + memset(_array1013, 0, v4 * 44); + _array1013Allocated = true; + memset(_array1013Temp, 0, 44); + + for (int i = 0; i < 8; i++) + _array1013Temp[i + 2] = op_sub5(1, i + 1, 0); + + // Yes, this is not endian-safe, but should not matter since we're + // not saving/loading the data anywhere + memcpy(_array1013, _array1013Temp, 44); return 1; } -int LogicHEsoccer::op_1014(int32 *args) { +int LogicHEsoccer::op_1014(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5, int32 a6, int32 a7, int32 a8, int32 a9, int32 a10, int32 a11, int32 a12, int32 a13, int32 a14) { // TODO: Used many times during a match + // And called from op_1008! return 1; } int LogicHEsoccer::op_1019(int32 *args) { - // TODO: Used at the beginning of a match + // Used at the beginning of a match + // Initializes some arrays. Player positions? + + // These two arrays are used in op_1014 and op_1015 + for (int i = 0; i < 4096; i++) + _byteArray1[i] = getFromArray(args[1], 0, i); + + for (int i = 0; i < 585; i++) + _byteArray2[i] = getFromArray(args[0], 0, i); + + // Deallocate the two integer arrays + if (_intArraysAllocated) + op_1020(); + + // Reallocate them + _intArray1 = new uint32[1008]; + _intArray2 = new uint32[168]; + _intArraysAllocated = true; + + memset(_intArray1, 0, 4 * 4); + memset(_intArray2, 0, 24 * 4); + + // These two arrays are used in op_1015 + for (int i = 0; i < 42; i++) { + for (int j = 0; j < 24; j++) + _intArray1[j + 24 * i] = getFromArray(args[3], 0, j + 24 * i); + + for (int j = 0; j < 4; j++) + _intArray2[j + 4 * i] = getFromArray(args[2], 0, j + 4 * i); + } + + return 1; +} + +int LogicHEsoccer::op_1020() { + // Deallocate integer arrays + // The arrays can be allocated in op_1015 or op_1019 + + delete[] _intArray1; _intArray1 = 0; + delete[] _intArray2; _intArray2 = 0; + _intArraysAllocated = false; return 1; } -int LogicHEsoccer::op_1021(int32 *args) { - // TODO: Used during a match (ball movement?) +int LogicHEsoccer::op_1021(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5, int32 a6, int32 a7) { + // Used during a match (ball movement?) + // Also called from op_1008 + + int v10; + if (a4 && a5) + v10 = (int)(((double)a2 - (double)a5 * (double)a1 / (double)a4) * -1.0 * (double)a4 / (double)a5); + else + v10 = a1; + + int v9; + if (a6 && a5) + v9 = (int)(((double)a2 - (double)a5 * (double)a3 / (double)a6) * -1.0 * (double)a6 / (double)a5); + else + v9 = a3; + + // The final argument chooses whether to store the results for op_1008 or + // store them in SCUMM variables. + if (a7) { + _var1021[0] = v10; + _var1021[1] = v9; + } else { + writeScummVar(108, v10); + writeScummVar(109, v9); + } return 1; } diff --git a/engines/scumm/he/logic_he.h b/engines/scumm/he/logic_he.h index ab952abd5e..d097d37e75 100644 --- a/engines/scumm/he/logic_he.h +++ b/engines/scumm/he/logic_he.h @@ -41,9 +41,9 @@ public: int getFromArray(int arg0, int idx2, int idx1); void putInArray(int arg0, int idx2, int idx1, int val); - void beforeBootScript() {} - void initOnce() {} - void startOfFrame() {} + virtual void beforeBootScript() {} + virtual void initOnce() {} + virtual int startOfFrame() { return 1; } void endOfFrame() {} void processKeyStroke(int keyPressed) {} @@ -115,22 +115,52 @@ private: public: LogicHEsoccer(ScummEngine_v90he *vm); + ~LogicHEsoccer(); int versionID(); int32 dispatch(int op, int numArgs, int32 *args); + void beforeBootScript(); + void initOnce(); + int startOfFrame(); + private: int op_1001(int32 *args); int op_1002(int32 *args); int op_1003(int32 *args); int op_1004(int32 *args); - int op_1006(int32 *args); + int op_1006(int32 a1, int32 a2, int32 a3, int32 a4); int op_1007(int32 *args); int op_1008(int32 *args); + int op_1011(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5); int op_1012(int32 *args); - int op_1014(int32 *args); + int op_1013(int32 a1, int32 a2, int32 a3); + int op_1014(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5, int32 a6, int32 a7, int32 a8, int32 a9, int32 a10, int32 a11, int32 a12, int32 a13, int32 a14); int op_1019(int32 *args); - int op_1021(int32 *args); + int op_1020(); + int op_1021(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5, int32 a6, int32 a7); + + // Two integer arrays are used between some functions + // Originally, these pointers were in _userData, but we keep them separate + // Also, doing it that would break things on non 32-bit systems... + bool _intArraysAllocated; + uint32 *_intArray1, *_intArray2; + + // op_1007 allocates some arrays + // they're then filled by op_1019 + byte _byteArray1[4096], _byteArray2[585]; + + // op_1011 has a subfunction + void op_1011_sub(int32 a1, int32 a2, int32 a3, int32 a4); + + // op_1013 creates some array, purpose unknown + bool _array1013Allocated; + byte *_array1013; + uint32 _array1013Temp[11]; + int op_sub5(int a1, int a2, int a3); + + // op_1021 can (optionally) set two variables for use in op_1008 + uint32 _var1021[2]; }; class LogicHEbaseball2001 : public LogicHE { diff --git a/engines/scumm/he/palette_he.cpp b/engines/scumm/he/palette_he.cpp index 7f517c56ed..49e43a040b 100644 --- a/engines/scumm/he/palette_he.cpp +++ b/engines/scumm/he/palette_he.cpp @@ -26,6 +26,7 @@ #ifdef ENABLE_HE #include "common/system.h" +#include "graphics/palette.h" #include "scumm/scumm.h" #include "scumm/he/intern_he.h" #include "scumm/resource.h" diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index ecb094f29b..552c420755 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -32,6 +32,7 @@ #include "audio/decoders/wave.h" #include "graphics/cursorman.h" +#include "graphics/maccursor.h" #include "graphics/wincursor.h" #include "common/archive.h" @@ -172,11 +173,49 @@ bool MacResExtractor::extractResource(int id, CachedCursor *cc) { if (!dataStream) return false; - int keyColor; // HACK: key color is ignored - _resMgr->convertCrsrCursor(dataStream, &cc->bitmap, cc->width, cc->height, cc->hotspotX, cc->hotspotY, - keyColor, _vm->_system->hasFeature(OSystem::kFeatureCursorHasPalette), - &cc->palette, cc->palSize); + // If we don't have a cursor palette, force monochrome cursors + bool forceMonochrome = !_vm->_system->hasFeature(OSystem::kFeatureCursorHasPalette); + Graphics::MacCursor *macCursor = new Graphics::MacCursor(); + + if (!macCursor->readFromStream(*dataStream, forceMonochrome)) { + delete dataStream; + delete macCursor; + return false; + } + + cc->bitmap = new byte[macCursor->getWidth() * macCursor->getHeight()]; + cc->width = macCursor->getWidth(); + cc->height = macCursor->getHeight(); + cc->hotspotX = macCursor->getHotspotX(); + cc->hotspotY = macCursor->getHotspotY(); + + if (forceMonochrome) { + // Convert to the SCUMM palette + const byte *srcBitmap = macCursor->getSurface(); + + for (int i = 0; i < macCursor->getWidth() * macCursor->getHeight(); i++) { + if (srcBitmap[i] == macCursor->getKeyColor()) // Transparent + cc->bitmap[i] = 255; + else if (srcBitmap[i] == 0) // Black + cc->bitmap[i] = 253; + else // White + cc->bitmap[i] = 254; + } + } else { + // Copy data and palette + + // Sanity check. This code assumes that the key color is the same + assert(macCursor->getKeyColor() == 255); + + memcpy(cc->bitmap, macCursor->getSurface(), macCursor->getWidth() * macCursor->getHeight()); + + cc->palette = new byte[256 * 3]; + cc->palSize = 256; + memcpy(cc->palette, macCursor->getPalette(), 256 * 3); + } + + delete macCursor; delete dataStream; return true; } diff --git a/engines/scumm/imuse/imuse_part.cpp b/engines/scumm/imuse/imuse_part.cpp index 40889ec24f..487429c294 100644 --- a/engines/scumm/imuse/imuse_part.cpp +++ b/engines/scumm/imuse/imuse_part.cpp @@ -25,6 +25,8 @@ +#include "common/debug.h" +#include "common/textconsole.h" #include "common/util.h" #include "scumm/imuse/imuse_internal.h" #include "scumm/saveload.h" diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp index c96b2f757b..78028c6056 100644 --- a/engines/scumm/imuse/sysex_scumm.cpp +++ b/engines/scumm/imuse/sysex_scumm.cpp @@ -24,6 +24,7 @@ #include "common/endian.h" +#include "common/textconsole.h" #include "common/util.h" /* diff --git a/engines/scumm/imuse_digi/dimuse.h b/engines/scumm/imuse_digi/dimuse.h index 236edb5a89..1e96aa8827 100644 --- a/engines/scumm/imuse_digi/dimuse.h +++ b/engines/scumm/imuse_digi/dimuse.h @@ -26,6 +26,8 @@ #define SCUMM_IMUSE_DIGI_H #include "common/scummsys.h" +#include "common/mutex.h" +#include "common/textconsole.h" #include "common/util.h" #include "scumm/imuse_digi/dimuse.h" diff --git a/engines/scumm/imuse_digi/dimuse_codecs.cpp b/engines/scumm/imuse_digi/dimuse_codecs.cpp index fd9deb7b44..c78e313fc2 100644 --- a/engines/scumm/imuse_digi/dimuse_codecs.cpp +++ b/engines/scumm/imuse_digi/dimuse_codecs.cpp @@ -229,7 +229,7 @@ int32 decompressADPCM(byte *compInput, byte *compOutput, int channels) { // Every block starts with a 2 byte word. If that word is // non-zero, it indicates the size of a block of raw audio // data (not encoded) following it. That data we simply copy - // to the output buffer and the proceed by decoding the + // to the output buffer and then proceed by decoding the // remaining data. // // If on the other hand the word is zero, then what follows diff --git a/engines/scumm/midiparser_ro.cpp b/engines/scumm/midiparser_ro.cpp index e737d747ac..be77e4fd66 100644 --- a/engines/scumm/midiparser_ro.cpp +++ b/engines/scumm/midiparser_ro.cpp @@ -26,6 +26,7 @@ #include "audio/midiparser.h" #include "audio/mididrv.h" +#include "common/textconsole.h" #include "common/util.h" namespace Scumm { diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index e81212fec8..b0786c924d 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -23,8 +23,11 @@ */ #include "common/system.h" +#include "common/textconsole.h" #include "common/util.h" +#include "graphics/palette.h" + #include "scumm/resource.h" #include "scumm/scumm.h" #include "scumm/scumm_v6.h" diff --git a/engines/scumm/player_mod.h b/engines/scumm/player_mod.h index 67d1bb4cbf..3f97c4cab9 100644 --- a/engines/scumm/player_mod.h +++ b/engines/scumm/player_mod.h @@ -31,7 +31,7 @@ #include "audio/mixer.h" namespace Audio { - class RateConverter; +class RateConverter; } namespace Scumm { diff --git a/engines/scumm/player_nes.h b/engines/scumm/player_nes.h index 5f6e8f2d8d..402eea7bf8 100644 --- a/engines/scumm/player_nes.h +++ b/engines/scumm/player_nes.h @@ -35,7 +35,7 @@ namespace Scumm { class ScummEngine; namespace APUe { - class APU; +class APU; } static const int MAXVOLUME = 0x7F; diff --git a/engines/scumm/player_pce.h b/engines/scumm/player_pce.h index 3f5033f724..42153e8abc 100644 --- a/engines/scumm/player_pce.h +++ b/engines/scumm/player_pce.h @@ -27,6 +27,7 @@ #define SCUMM_PLAYER_PCE_H #include "common/scummsys.h" +#include "common/mutex.h" #include "scumm/music.h" #include "audio/audiostream.h" #include "audio/mixer.h" diff --git a/engines/scumm/player_sid.cpp b/engines/scumm/player_sid.cpp index 0d5832a5fb..11468f3097 100644 --- a/engines/scumm/player_sid.cpp +++ b/engines/scumm/player_sid.cpp @@ -1296,7 +1296,7 @@ int Player_SID::readBuffer(int16 *buffer, const int numSamples) { _cpuCyclesLeft = timingProps[_videoSystem].cyclesPerFrame; } // fetch samples - int sampleCount = _sid->clock(_cpuCyclesLeft, (short*)buffer, samplesLeft); + int sampleCount = _sid->updateClock(_cpuCyclesLeft, (short*)buffer, samplesLeft); samplesLeft -= sampleCount; buffer += sampleCount; } diff --git a/engines/scumm/player_v4a.h b/engines/scumm/player_v4a.h index 108dbcf317..458a39b5fe 100644 --- a/engines/scumm/player_v4a.h +++ b/engines/scumm/player_v4a.h @@ -27,6 +27,7 @@ #define SCUMM_PLAYER_V4A_H #include "common/scummsys.h" +#include "common/util.h" #include "scumm/music.h" #include "audio/mixer.h" #include "audio/mods/tfmx.h" diff --git a/engines/scumm/proc3ARM.s b/engines/scumm/proc3ARM.s index 8b3e31f5f8..5acfa86c29 100644 --- a/engines/scumm/proc3ARM.s +++ b/engines/scumm/proc3ARM.s @@ -25,40 +25,40 @@ .text - .global ClassicProc3RendererShadowARM + .global _ClassicProc3RendererShadowARM -.equ _scaleIndexY , 112 -.equ _numStrips , 108 -.equ _palette , 104 -.equ _shadow_table , 100 -.equ _scaleIndexX , 96 -.equ _scaleX , 92 -.equ _height , 88 -.equ store_r14 , 84 -.equ store_r11 , 80 -.equ store_r10 , 76 -.equ store_r9 , 72 -.equ store_r8 , 68 -.equ store_r7 , 64 -.equ store_r6 , 60 -.equ store_r5 , 56 -.equ store_r4 , 52 -.equ src , 48 -.equ height , 44 -.equ len , 40 -.equ v1_shr , 36 -.equ v1_skip_width , 32 -.equ v1_destptr , 28 -.equ v1_scaleXstep , 24 -.equ v1_mask_ptr , 20 -.equ v1_y , 16 -.equ v1_scaletable , 12 -.equ pitch , 8 -.equ scaleIdxXPtr , 4 -.equ scaleIdxYPtr , 0 +.set _scaleIndexY , 112 +.set _numStrips , 108 +.set _palette , 104 +.set _shadow_table , 100 +.set _scaleIndexX , 96 +.set _scaleX , 92 +.set _height , 88 +.set store_r14 , 84 +.set store_r11 , 80 +.set store_r10 , 76 +.set store_r9 , 72 +.set store_r8 , 68 +.set store_r7 , 64 +.set store_r6 , 60 +.set store_r5 , 56 +.set store_r4 , 52 +.set src , 48 +.set height , 44 +.set len , 40 +.set v1_shr , 36 +.set v1_skip_width , 32 +.set v1_destptr , 28 +.set v1_scaleXstep , 24 +.set v1_mask_ptr , 20 +.set v1_y , 16 +.set v1_scaletable , 12 +.set pitch , 8 +.set scaleIdxXPtr , 4 +.set scaleIdxYPtr , 0 -.equ space , 48 +.set space , 48 @ r0 = _scaleY @ r1 = v1 @@ -71,7 +71,7 @@ @ <> = _palette @ <> = _numstrips @ <> = _scaleIndexY -ClassicProc3RendererShadowARM: +_ClassicProc3RendererShadowARM: @ shadow20 = false @ shadowed = true @ unscaled = false diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h index 91e780bcd1..eead241b90 100644 --- a/engines/scumm/saveload.h +++ b/engines/scumm/saveload.h @@ -30,8 +30,8 @@ #include <stddef.h> // for ptrdiff_t namespace Common { - class SeekableReadStream; - class WriteStream; +class SeekableReadStream; +class WriteStream; } namespace Scumm { diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index 40eeba3663..8f555818f4 100644 --- a/engines/scumm/scumm-md5.h +++ b/engines/scumm/scumm-md5.h @@ -1,5 +1,5 @@ /* - This file was generated by the md5table tool on Mon Oct 18 00:42:16 2010 + This file was generated by the md5table tool on Sun Apr 17 10:46:26 2011 DO NOT EDIT MANUALLY! */ @@ -206,6 +206,7 @@ static const MD5Table md5table[] = { { "4c4820518e16e1a0e3616a3b021a04f3", "catalog", "HE CUP", "Preview", 10927456, Common::DE_DEU, Common::kPlatformUnknown }, { "4cb9c3618f71668f8e4346c8f323fa82", "monkey2", "", "", 10700, Common::EN_ANY, Common::kPlatformMacintosh }, { "4ce2d5b355964bbcb5e5ce73236ef868", "freddicove", "HE 100", "", -1, Common::RU_RUS, Common::kPlatformWindows }, + { "4cfd3fda4a4e6e64a1fc488eba973b7a", "fbpack", "", "", -1, Common::EN_ANY, Common::kPlatformPC }, { "4d34042713958b971cb139fba4658586", "atlantis", "FM-TOWNS", "", -1, Common::JA_JPN, Common::kPlatformFMTowns }, { "4dbff3787aedcd96b0b325f2d92d7ad9", "maze", "HE 100", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown }, { "4dc780f1bc587a193ce8a97652791438", "loom", "EGA", "EGA", -1, Common::EN_ANY, Common::kPlatformAmiga }, diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 5aea36ef66..f43aed53f7 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1162,7 +1162,7 @@ Common::Error ScummEngine::init() { warning("Starting game without the required 16bit color support.\nYou may experience color glitches"); initGraphics(screenWidth, screenHeight, (screenWidth > 320)); } else { - error("16bit color support is required for this game"); + return Common::Error(Common::kUnsupportedColorMode, "16bit color support is required for this game"); } #endif } else { @@ -1222,7 +1222,7 @@ void ScummEngine::setupScumm() { setupCharsetRenderer(); // Create and clear the text surface - _textSurface.create(_screenWidth * _textSurfaceMultiplier, _screenHeight * _textSurfaceMultiplier, 1); + _textSurface.create(_screenWidth * _textSurfaceMultiplier, _screenHeight * _textSurfaceMultiplier, Graphics::PixelFormat::createFormatCLUT8()); clearTextSurface(); // Create the costume renderer @@ -1648,6 +1648,8 @@ void ScummEngine_v90he::resetScumm() { break; case GID_SOCCER: + case GID_SOCCERMLS: + case GID_SOCCER2004: _logicHE = new LogicHEsoccer(this); break; @@ -2494,7 +2496,7 @@ void ScummEngine_v90he::runBootscript() { void ScummEngine::startManiac() { debug(0, "stub startManiac()"); - displayMessage(0, "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' directory inside the Tentacle game directory."); + displayMessage(0, "%s", _("Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' directory inside the Tentacle game directory.")); } #pragma mark - diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index f3af84bb04..62c6c70e5a 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -35,6 +35,7 @@ #include "common/random.h" #include "common/rect.h" #include "common/str.h" +#include "common/textconsole.h" #include "graphics/surface.h" #include "graphics/sjis.h" @@ -56,12 +57,12 @@ #endif namespace GUI { - class Dialog; +class Dialog; } using GUI::Dialog; namespace Common { - class SeekableReadStream; - class WriteStream; +class SeekableReadStream; +class WriteStream; } /** @@ -253,6 +254,8 @@ enum ScummGameId { GID_FUNSHOP, // Used for all three funshops GID_FOOTBALL, GID_SOCCER, + GID_SOCCERMLS, + GID_SOCCER2004, GID_BASEBALL2001, GID_BASKETBALL, GID_MOONBASE, @@ -463,7 +466,7 @@ public: virtual Common::Error run() { Common::Error err; err = init(); - if (err != Common::kNoError) + if (err.getCode() != Common::kNoError) return err; return go(); } diff --git a/engines/scumm/smush/channel.cpp b/engines/scumm/smush/channel.cpp index 4389890994..95b7653262 100644 --- a/engines/scumm/smush/channel.cpp +++ b/engines/scumm/smush/channel.cpp @@ -24,6 +24,8 @@ */ +#include "common/textconsole.h" + #include "scumm/smush/channel.h" namespace Scumm { diff --git a/engines/scumm/smush/channel.h b/engines/scumm/smush/channel.h index c35ac0ac00..717a294d96 100644 --- a/engines/scumm/smush/channel.h +++ b/engines/scumm/smush/channel.h @@ -29,7 +29,7 @@ #include "common/util.h" namespace Common { - class SeekableReadStream; +class SeekableReadStream; } namespace Scumm { diff --git a/engines/scumm/smush/codec37.cpp b/engines/scumm/smush/codec37.cpp index 658d67c1b4..9dbbc6816f 100644 --- a/engines/scumm/smush/codec37.cpp +++ b/engines/scumm/smush/codec37.cpp @@ -25,6 +25,7 @@ #include "common/endian.h" +#include "common/textconsole.h" #include "common/util.h" #include "scumm/bomp.h" #include "scumm/smush/codec37.h" diff --git a/engines/scumm/smush/codec47.cpp b/engines/scumm/smush/codec47.cpp index 333fdabccf..47286ba4fc 100644 --- a/engines/scumm/smush/codec47.cpp +++ b/engines/scumm/smush/codec47.cpp @@ -25,6 +25,7 @@ #include "common/endian.h" +#include "common/textconsole.h" #include "common/util.h" #include "scumm/bomp.h" #include "scumm/smush/codec47.h" @@ -342,11 +343,9 @@ void Codec47Decoder::makeTables47(int width) { #ifdef USE_ARM_SMUSH_ASM -extern "C" { #ifndef IPHONE #define ARM_Smush_decode2 _ARM_Smush_decode2 #endif -} extern "C" void ARM_Smush_decode2( byte *dst, const byte *src, diff --git a/engines/scumm/smush/saud_channel.cpp b/engines/scumm/smush/saud_channel.cpp index 04ed955224..f730acf804 100644 --- a/engines/scumm/smush/saud_channel.cpp +++ b/engines/scumm/smush/saud_channel.cpp @@ -26,6 +26,7 @@ #include "common/endian.h" #include "common/stream.h" +#include "common/textconsole.h" #include "scumm/util.h" #include "scumm/smush/channel.h" diff --git a/engines/scumm/smush/smush_mixer.h b/engines/scumm/smush/smush_mixer.h index c7a7354511..3d62fdc722 100644 --- a/engines/scumm/smush/smush_mixer.h +++ b/engines/scumm/smush/smush_mixer.h @@ -27,6 +27,8 @@ #define SCUMM_SMUSH_MIXER_H +#include "audio/mixer.h" +#include "common/mutex.h" #include "scumm/sound.h" namespace Scumm { diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index 0e4f588593..2e39558372 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -31,6 +31,7 @@ #include "common/util.h" #include "graphics/cursorman.h" +#include "graphics/palette.h" #include "scumm/bomp.h" #include "scumm/file.h" diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 54f35c1969..a38119584f 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -527,6 +527,10 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle sprintf(filename, "audio/%s.%d/%d.voc", roomname, offset, b); _vm->openFile(*_sfxFile, filename); if (!_sfxFile->isOpen()) { + sprintf(filename, "audio/%s_%d/%d.voc", roomname, offset, b); + _vm->openFile(*_sfxFile, filename); + } + if (!_sfxFile->isOpen()) { sprintf(filename, "%d.%d.voc", offset, b); _vm->openFile(*_sfxFile, filename); } diff --git a/engines/scumm/util.cpp b/engines/scumm/util.cpp index ccd0230efa..5c3e4c9d0c 100644 --- a/engines/scumm/util.cpp +++ b/engines/scumm/util.cpp @@ -25,6 +25,7 @@ #include "scumm/util.h" #include "common/util.h" +#include "common/textconsole.h" namespace Scumm { |