diff options
Diffstat (limited to 'engines/scumm')
33 files changed, 529 insertions, 75 deletions
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/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..6db3ea740a 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -994,7 +994,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; diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index a5542ca868..d66798cbf1 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}, 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 b509bb9676..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); 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/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/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/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_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.cpp b/engines/scumm/scumm.cpp index 33343aef81..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 { @@ -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/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 { |