From 543920a1d672c13d6015bf0cedcf1ebe2f827270 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 10 May 2016 17:12:13 +0200 Subject: SCUMM HE: Started code for loading FOW resources --- engines/scumm/detection.cpp | 5 +++++ engines/scumm/he/intern_he.h | 4 ++-- engines/scumm/he/logic/moonbase_logic.cpp | 3 ++- engines/scumm/he/moonbase/moonbase.cpp | 1 + engines/scumm/he/moonbase/moonbase.h | 5 +++++ engines/scumm/he/moonbase/moonbase_fow.cpp | 12 +++++++++++- engines/scumm/he/wiz_he.cpp | 1 + engines/scumm/scumm.cpp | 1 + 8 files changed, 28 insertions(+), 4 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 0867b20fc3..4c9d1221aa 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -186,6 +186,11 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const { } if (_filenamePattern.genMethod == kGenHEPC || _filenamePattern.genMethod == kGenHEIOS) { + if (id == '3' && _game.id == GID_MOONBASE) { + result = Common::String::format("%s.u32", _filenamePattern.pattern); + break; + } + // For HE >= 98, we already called snprintf above. if (_game.heversion < 98 || room < 0) result = Common::String::format("%s.he%c", _filenamePattern.pattern, id); diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h index 51d9a9045f..df62c59dd8 100644 --- a/engines/scumm/he/intern_he.h +++ b/engines/scumm/he/intern_he.h @@ -27,8 +27,6 @@ #ifdef ENABLE_HE #include "scumm/he/floodfill_he.h" #include "scumm/he/wiz_he.h" - -#include "scumm/he/moonbase/moonbase.h" #endif #include "scumm/actor_he.h" // For AuxBlock & AuxEntry @@ -186,6 +184,8 @@ protected: }; #ifdef ENABLE_HE +class Moonbase; + class ScummEngine_v71he : public ScummEngine_v70he { friend class Wiz; friend class Moonbase; diff --git a/engines/scumm/he/logic/moonbase_logic.cpp b/engines/scumm/he/logic/moonbase_logic.cpp index 604dc6774c..4483f1abca 100644 --- a/engines/scumm/he/logic/moonbase_logic.cpp +++ b/engines/scumm/he/logic/moonbase_logic.cpp @@ -22,6 +22,7 @@ #include "scumm/he/intern_he.h" #include "scumm/he/logic_he.h" +#include "scumm/he/moonbase/moonbase.h" namespace Scumm { @@ -214,7 +215,7 @@ void LogicHEmoonbase::op_set_fow_information(int op, int numArgs, int32 *args) { } int LogicHEmoonbase::op_set_fow_image(int op, int numArgs, int32 *args) { - debug(2, "STUB: op_set_fow_image(%d)", args[0]); + debug(2, "op_set_fow_image(%d)", args[0]); return _vm->_moonbase->setFOWImage(args[0]) ? 1 : 0; } diff --git a/engines/scumm/he/moonbase/moonbase.cpp b/engines/scumm/he/moonbase/moonbase.cpp index a07a874b48..57a2efa117 100644 --- a/engines/scumm/he/moonbase/moonbase.cpp +++ b/engines/scumm/he/moonbase/moonbase.cpp @@ -21,6 +21,7 @@ */ #include "scumm/he/intern_he.h" +#include "scumm/he/moonbase/moonbase.h" namespace Scumm { diff --git a/engines/scumm/he/moonbase/moonbase.h b/engines/scumm/he/moonbase/moonbase.h index e50337ddeb..c312ddd758 100644 --- a/engines/scumm/he/moonbase/moonbase.h +++ b/engines/scumm/he/moonbase/moonbase.h @@ -25,6 +25,8 @@ #ifdef ENABLE_HE +#include "common/winexe_pe.h" + namespace Scumm { class Moonbase { @@ -86,6 +88,9 @@ private: bool _fowBlackMode; int _fowRenderTable[32768]; + + Common::PEResources _exe; + Common::String _fileName; }; #endif diff --git a/engines/scumm/he/moonbase/moonbase_fow.cpp b/engines/scumm/he/moonbase/moonbase_fow.cpp index f76bebf89e..e907449f13 100644 --- a/engines/scumm/he/moonbase/moonbase_fow.cpp +++ b/engines/scumm/he/moonbase/moonbase_fow.cpp @@ -21,7 +21,9 @@ */ #include "common/config-manager.h" + #include "scumm/he/intern_he.h" +#include "scumm/he/moonbase/moonbase.h" namespace Scumm { @@ -108,10 +110,18 @@ bool Moonbase::setFOWImage(int image) { // PIECES BUBBLES CIRCLES SIMPLE* WEDGEY BUBBLE2 // WEDGE2 SPIKEY ANGLES SMOOTHED WUZZY SYS7-BEVELED - if (image >= -1 && image <= 12) + if (image >= -12 && image <= -1) resType = 210 - image; // 211-222 range else resType = 214; // default, SIMPLE + + if (_fileName.empty()) { // We are running for the first time + _fileName = _vm->generateFilename(-3); + + if (!_exe.loadFromEXE(_fileName)) + error("Cannot open file %s", _fileName.c_str()); + } + #if 0 // TODO HRSRC hResource = FindResource(g_hInst, resType, 10); if (hResource) { diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index 2b1e6d1314..4f4bfa1757 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -31,6 +31,7 @@ #include "scumm/scumm.h" #include "scumm/util.h" #include "scumm/he/wiz_he.h" +#include "scumm/he/moonbase/moonbase.h" namespace Scumm { diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index ff25dc9201..40f636c18f 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -66,6 +66,7 @@ #include "scumm/players/player_v5m.h" #include "scumm/resource.h" #include "scumm/he/resource_he.h" +#include "scumm/he/moonbase/moonbase.h" #include "scumm/scumm_v0.h" #include "scumm/scumm_v8.h" #include "scumm/sound.h" -- cgit v1.2.3