diff options
-rw-r--r-- | scumm/logic_he.cpp | 94 | ||||
-rw-r--r-- | scumm/logic_he.h | 13 | ||||
-rw-r--r-- | scumm/scumm.cpp | 8 | ||||
-rw-r--r-- | scumm/scumm.h | 3 |
4 files changed, 114 insertions, 4 deletions
diff --git a/scumm/logic_he.cpp b/scumm/logic_he.cpp index 1969c674bd..1ab8c42acf 100644 --- a/scumm/logic_he.cpp +++ b/scumm/logic_he.cpp @@ -52,6 +52,7 @@ void LogicHE::putInArray(int arg0, int idx2, int idx1, int val) { } int32 LogicHE::dispatch(int op, int numArgs, int32 *args) { +#if 1 char tmp[32], str[256]; if (numArgs > 0) @@ -68,6 +69,14 @@ int32 LogicHE::dispatch(int op, int numArgs, int32 *args) { strncat(str, "])", 256); debug(0, str); +#else + // Used for parallel trace utility + for (int i = 0; i < numArgs; i++) + debug(0, "args[%d] = %d;", i, args[i]); + + debug(0, "dispatch(%d, %d, args);", op, numArgs); + +#endif return 1; } @@ -415,7 +424,7 @@ void LogicHEfunshop::op_1005(int32 *args) { } putInArray(args[0], 0, i - 1, (int32)temp); - if (floor(data[i - 520 + 1]) + 0.5 > data[i - 520 + 1]) { + if (floor(data[i - 520 + 1]) + 0.5 <= data[i - 520 + 1]) { temp = ceil(data[i - 520 + 1]); } else { temp = floor(data[i - 520 + 1]); @@ -428,4 +437,87 @@ int LogicHEfunshop::checkShape(int arg_0, int arg_4, int arg_8, int arg_C, int a return 1; } +/*********************** + * Backyard Football + * Backyard Football Demo + * + */ + +int LogicHEfootball::versionID() { + return 1; +} + +int32 LogicHEfootball::dispatch(int op, int numArgs, int32 *args) { + int res = 0; + + switch (op) { + case 1006: + res = op_1006(args); + break; + + case 1010: + res = op_1010(args); + break; + + case 1022: + res = op_1022(args); + break; + + default: + LogicHE::dispatch(op, numArgs, args); + break; + + } + + return res; +} + +int LogicHEfootball::op_1006(int32 *args) { + double res; + + res = (1.0 - args[1] * 2.9411764e-4 * 5.3050399e-2) * args[0] * 1.2360656e-1 + + args[1] * 1.1764706e-2 + 46; + writeScummVar(108, (int32)res); + + res = 640.0 - args[2] * 1.2360656e-1 - args[1] * 1.1588235e-1 - 26; + writeScummVar(109, (int32)res); + + return 1; +} + +int LogicHEfootball::op_1010(int32 *args) { + double a1 = (640.0 - (double)args[1] - 26.0) * 8.6294413; + double res; + + res = ((double)args[0] - 46 - a1 * 1.1764706e-2) / + ((1.0 - a1 * 2.9411764e-4 * 5.3050399e-2) * 1.2360656e-1); + writeScummVar(108, (int32)res); + + writeScummVar(109, (int32)a1); + + return 1; +} + +int LogicHEfootball::op_1022(int32 *args) { + double res; + double var10 = args[4] - args[1]; // 25 + double var8 = args[5] - args[2]; // 0 + double var6 = args[3] - args[0]; // -2578 + + res = sqrt(var8 * var8 + var6 * var6 + var10 * var10); // 2.5781212 + + if (res >= (double)args[6]) { + var8 = (double)args[6] * var8 / res; + var10 = (double)args[6] * var10 / res; + res = (double)args[6] * var6 / res; + } + + writeScummVar(108, (int32)res); + writeScummVar(109, (int32)var10); + writeScummVar(110, (int32)var8); + + return 1; +} + + } // End of namespace Scumm diff --git a/scumm/logic_he.h b/scumm/logic_he.h index 46cf20d9a2..957103ba4d 100644 --- a/scumm/logic_he.h +++ b/scumm/logic_he.h @@ -87,4 +87,17 @@ private: int checkShape(int arg_0, int arg_4, int arg_8, int arg_C, int arg_10, int arg_14, int arg_18, int arg_1C, int arg_20, int arg_24); }; +class LogicHEfootball : public LogicHE { +public: + LogicHEfootball(ScummEngine_v90he *vm) : LogicHE(vm) {} + + int versionID(); + int32 dispatch(int op, int numArgs, int32 *args); + +private: + int op_1006(int32 *args); + int op_1010(int32 *args); + int op_1022(int32 *args); +}; + } // End of namespace Scumm diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 4c73057f99..bcf69fbf80 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -351,7 +351,7 @@ static const ScummGameSettings scumm_settings[] = { GF_USE_KEY | GF_NEW_COSTUMES | GF_HE_LOCALIZED, Common::kPlatformWindows, 0, 0}, {"mustard", "Spy Fox in Hold the Mustard", GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_NEW_COSTUMES | GF_HE_LOCALIZED, Common::kPlatformWindows, 0, 0}, - {"football", "Backyard Football", GID_HEGAME, 6, 99, MDT_NONE, + {"football", "Backyard Football", GID_FOOTBALL, 6, 99, MDT_NONE, GF_USE_KEY | GF_NEW_COSTUMES, Common::kPlatformWindows, 0, 0}, // Humongous Entertainment Scumm Version ? @@ -376,7 +376,7 @@ static const ScummGameSettings scumm_settings[] = { {"bb2demo", "Backyard Baseball 2001 (Demo)", GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_NEW_COSTUMES | GF_16BIT_COLOR, Common::kPlatformWindows, 0, 0}, - {"footdemo", "Backyard Football 2002 (Demo)", GID_HEGAME, 6, 99, MDT_NONE, + {"footdemo", "Backyard Football (Demo)", GID_FOOTBALL, 6, 99, MDT_NONE, GF_USE_KEY | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS, Common::kPlatformWindows, 0, 0}, {"SoccerMLS", "Backyard Soccer MLS Edition", GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_NEW_COSTUMES, Common::kPlatformWindows, 0, 0}, @@ -1794,6 +1794,10 @@ void ScummEngine_v90he::scummInit() { _logicHE = new LogicHEfunshop(this); break; + case GID_FOOTBALL: + _logicHE = new LogicHEfootball(this); + break; + default: _logicHE = new LogicHE(this); break; diff --git a/scumm/scumm.h b/scumm/scumm.h index e4a20a3488..ad476a859e 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -250,7 +250,8 @@ enum ScummGameId { GID_FREDDI2, GID_FREDDICOVE, GID_PUTTRACE, - GID_FUNSHOP // Used for all three funshops + GID_FUNSHOP, // Used for all three funshops + GID_FOOTBALL }; struct SentenceTab { |