From d0225f753274d9a04045a14dfe9a1b1b8aeae371 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Dec 2014 15:49:35 +1100 Subject: XEEN: Initial commit --- engines/xeen/xeen.cpp | 209 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 engines/xeen/xeen.cpp (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp new file mode 100644 index 0000000000..3fe75e10a0 --- /dev/null +++ b/engines/xeen/xeen.cpp @@ -0,0 +1,209 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/scummsys.h" +#include "common/config-manager.h" +#include "common/debug-channels.h" +#include "common/events.h" +#include "engines/util.h" +#include "graphics/scaler.h" +#include "graphics/thumbnail.h" +#include "xeen/xeen.h" + +namespace Xeen { + +XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) + : _gameDescription(gameDesc), Engine(syst), _randomSource("Xeen") { + _debugger = nullptr; +} + +XeenEngine::~XeenEngine() { + delete _debugger; +} + +void XeenEngine::initialize() { + // Set up debug channels + DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); + DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts"); + DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling"); + DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); + + // Create sub-objects of the engine + _debugger = new Debugger(this); + + // Set graphics mode + initGraphics(320, 200, false); + + // If requested, load a savegame instead of showing the intro + if (ConfMan.hasKey("save_slot")) { + int saveSlot = ConfMan.getInt("save_slot"); + if (saveSlot >= 0 && saveSlot <= 999) + _loadSaveSlot = saveSlot; + } +} + +Common::Error XeenEngine::run() { + initialize(); + + playGame(); + + return Common::kNoError; +} + +int XeenEngine::getRandomNumber(int maxNumber) { + return _randomSource.getRandomNumber(maxNumber); +} + +Common::Error XeenEngine::saveGameState(int slot, const Common::String &desc) { + Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving( + generateSaveName(slot)); + if (!out) + return Common::kCreatingFileFailed; + + XeenSavegameHeader header; + header._saveName = desc; + writeSavegameHeader(out, header); + + Common::Serializer s(nullptr, out); + synchronize(s); + + out->finalize(); + delete out; + + return Common::kNoError; +} + +Common::Error XeenEngine::loadGameState(int slot) { + Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( + generateSaveName(slot)); + if (!saveFile) + return Common::kReadingFailed; + + Common::Serializer s(saveFile, nullptr); + + // Load the savaegame header + XeenSavegameHeader header; + if (!readSavegameHeader(saveFile, header)) + error("Invalid savegame"); + + if (header._thumbnail) { + header._thumbnail->free(); + delete header._thumbnail; + } + + // Load most of the savegame data + synchronize(s); + delete saveFile; + + return Common::kNoError; +} + +Common::String XeenEngine::generateSaveName(int slot) { + return Common::String::format("%s.%03d", _targetName.c_str(), slot); +} + +bool XeenEngine::canLoadGameStateCurrently() { + return true; +} + +bool XeenEngine::canSaveGameStateCurrently() { + return true; +} + +void XeenEngine::synchronize(Common::Serializer &s) { + // TODO +} + +const char *const SAVEGAME_STR = "XEEN"; +#define SAVEGAME_STR_SIZE 6 + +bool XeenEngine::readSavegameHeader(Common::InSaveFile *in, XeenSavegameHeader &header) { + char saveIdentBuffer[SAVEGAME_STR_SIZE + 1]; + header._thumbnail = nullptr; + + // Validate the header Id + in->read(saveIdentBuffer, SAVEGAME_STR_SIZE + 1); + if (strncmp(saveIdentBuffer, SAVEGAME_STR, SAVEGAME_STR_SIZE)) + return false; + + header._version = in->readByte(); + if (header._version > XEEN_SAVEGAME_VERSION) + return false; + + // Read in the string + header._saveName.clear(); + char ch; + while ((ch = (char)in->readByte()) != '\0') + header._saveName += ch; + + // Get the thumbnail + header._thumbnail = Graphics::loadThumbnail(*in); + if (!header._thumbnail) + return false; + + // Read in save date/time + header._year = in->readSint16LE(); + header._month = in->readSint16LE(); + header._day = in->readSint16LE(); + header._hour = in->readSint16LE(); + header._minute = in->readSint16LE(); + header._totalFrames = in->readUint32LE(); + + return true; +} + +void XeenEngine::writeSavegameHeader(Common::OutSaveFile *out, XeenSavegameHeader &header) { + // Write out a savegame header + out->write(SAVEGAME_STR, SAVEGAME_STR_SIZE + 1); + + out->writeByte(XEEN_SAVEGAME_VERSION); + + // Write savegame name + out->writeString(header._saveName); + out->writeByte('\0'); + + // Write a thumbnail of the screen +/* + uint8 thumbPalette[768]; + _screen->getPalette(thumbPalette); + Graphics::Surface saveThumb; + ::createThumbnail(&saveThumb, (const byte *)_screen->getPixels(), + _screen->w, _screen->h, thumbPalette); + Graphics::saveThumbnail(*out, saveThumb); + saveThumb.free(); +*/ + // Write out the save date/time + TimeDate td; + g_system->getTimeAndDate(td); + out->writeSint16LE(td.tm_year + 1900); + out->writeSint16LE(td.tm_mon + 1); + out->writeSint16LE(td.tm_mday); + out->writeSint16LE(td.tm_hour); + out->writeSint16LE(td.tm_min); +// out->writeUint32LE(_events->getFrameCounter()); +} + +void XeenEngine::playGame() { + // TODO +} + +} // End of namespace Xeen -- cgit v1.2.3 From 977a25ec35d63fab0db315b35a69a4a508f587e9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Dec 2014 09:58:47 +1100 Subject: XEEN: Implemented resource manager --- engines/xeen/xeen.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 3fe75e10a0..12871fda91 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -28,6 +28,7 @@ #include "graphics/scaler.h" #include "graphics/thumbnail.h" #include "xeen/xeen.h" +#include "xeen/resources.h" namespace Xeen { @@ -49,6 +50,7 @@ void XeenEngine::initialize() { // Create sub-objects of the engine _debugger = new Debugger(this); + Resources::init(this); // Set graphics mode initGraphics(320, 200, false); @@ -204,6 +206,8 @@ void XeenEngine::writeSavegameHeader(Common::OutSaveFile *out, XeenSavegameHeade void XeenEngine::playGame() { // TODO + // Test resource manager + File f("FNT"); } } // End of namespace Xeen -- cgit v1.2.3 From a8da12bbe4684183cbe4d5c6ac480af2515d07cf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Dec 2014 17:02:51 +1100 Subject: XEEN: Added skeletons for Clouds, Dark Side, and World of Xeen engines --- engines/xeen/xeen.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 12871fda91..73f0c24d9f 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -205,9 +205,6 @@ void XeenEngine::writeSavegameHeader(Common::OutSaveFile *out, XeenSavegameHeade } void XeenEngine::playGame() { - // TODO - // Test resource manager - File f("FNT"); } } // End of namespace Xeen -- cgit v1.2.3 From a933e661a93a0bf3466ba2dabc2f8d36e3587c5d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Dec 2014 19:29:38 +1100 Subject: XEEN: Added skeleton events manager and screen class --- engines/xeen/xeen.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 73f0c24d9f..cf60aa4555 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -35,10 +35,14 @@ namespace Xeen { XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) : _gameDescription(gameDesc), Engine(syst), _randomSource("Xeen") { _debugger = nullptr; + _events = nullptr; + _screen = nullptr; } XeenEngine::~XeenEngine() { delete _debugger; + delete _events; + delete _screen; } void XeenEngine::initialize() { @@ -50,6 +54,8 @@ void XeenEngine::initialize() { // Create sub-objects of the engine _debugger = new Debugger(this); + _events = new EventsManager(this); + _screen = new Screen(this); Resources::init(this); // Set graphics mode -- cgit v1.2.3 From 4f423c74b701b4dceff680259d174acb6a450b76 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Dec 2014 14:37:20 +1100 Subject: XEEN: Implement beginnings of Dark Side intro and supporting methods --- engines/xeen/xeen.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index cf60aa4555..f1330f5b0e 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -37,12 +37,14 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _debugger = nullptr; _events = nullptr; _screen = nullptr; + _sound = nullptr; } XeenEngine::~XeenEngine() { delete _debugger; delete _events; delete _screen; + delete _sound; } void XeenEngine::initialize() { @@ -56,6 +58,7 @@ void XeenEngine::initialize() { _debugger = new Debugger(this); _events = new EventsManager(this); _screen = new Screen(this); + _sound = new SoundManager(this); Resources::init(this); // Set graphics mode -- cgit v1.2.3 From 9d6de4da652b2494d37756e9d12f944cddcf18c8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Dec 2014 10:22:05 -1000 Subject: XEEN: Implemented cursor display --- engines/xeen/xeen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index f1330f5b0e..5a293636a9 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -55,11 +55,11 @@ void XeenEngine::initialize() { DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); // Create sub-objects of the engine + Resources::init(this); _debugger = new Debugger(this); _events = new EventsManager(this); _screen = new Screen(this); _sound = new SoundManager(this); - Resources::init(this); // Set graphics mode initGraphics(320, 200, false); -- cgit v1.2.3 From fb47ec9627937fe5031f20d16c175e5a12b5dfe2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Dec 2014 17:28:53 -1000 Subject: XEEN: In progress implementing options/main menu --- engines/xeen/xeen.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 5a293636a9..311e139b21 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -214,6 +214,8 @@ void XeenEngine::writeSavegameHeader(Common::OutSaveFile *out, XeenSavegameHeade } void XeenEngine::playGame() { + //showIntro(); + } } // End of namespace Xeen -- cgit v1.2.3 From 9506635bad402d58886cc9a47512871b321a10a2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Dec 2014 22:50:24 -1000 Subject: XEEN: Implemented Window functionality --- engines/xeen/xeen.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 311e139b21..505d9bd2db 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -38,6 +38,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _events = nullptr; _screen = nullptr; _sound = nullptr; + _eventData = nullptr; } XeenEngine::~XeenEngine() { @@ -45,6 +46,7 @@ XeenEngine::~XeenEngine() { delete _events; delete _screen; delete _sound; + delete _eventData; } void XeenEngine::initialize() { @@ -61,6 +63,9 @@ void XeenEngine::initialize() { _screen = new Screen(this); _sound = new SoundManager(this); + File f("029.obj"); + _eventData = f.readStream(f.size()); + // Set graphics mode initGraphics(320, 200, false); -- cgit v1.2.3 From 9eb229273668b96f63162cabfd769035f95e8a8b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 31 Dec 2014 16:54:14 -1000 Subject: XEEN: Compilation fixes --- engines/xeen/xeen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 505d9bd2db..372bbb1b46 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -28,6 +28,7 @@ #include "graphics/scaler.h" #include "graphics/thumbnail.h" #include "xeen/xeen.h" +#include "xeen/menus.h" #include "xeen/resources.h" namespace Xeen { @@ -219,8 +220,7 @@ void XeenEngine::writeSavegameHeader(Common::OutSaveFile *out, XeenSavegameHeade } void XeenEngine::playGame() { - //showIntro(); - + OptionsMenu::show(this); } } // End of namespace Xeen -- cgit v1.2.3 From 4a953b06619aae4eded66f868c0f48fb2330d8fa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 31 Dec 2014 21:09:13 -1000 Subject: XEEN: Startup fixes; options menu buttons now showing --- engines/xeen/xeen.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 372bbb1b46..1027572c67 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -62,6 +62,7 @@ void XeenEngine::initialize() { _debugger = new Debugger(this); _events = new EventsManager(this); _screen = new Screen(this); + _screen->setupWindows(); _sound = new SoundManager(this); File f("029.obj"); -- cgit v1.2.3 From fe48af7de5207cdc8a3e2ad769f6722b345b2877 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 1 Jan 2015 11:10:26 -1000 Subject: XEEN: Split up menus file into dialogs and dialogs_options --- engines/xeen/xeen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 1027572c67..cbdb6f3104 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -28,7 +28,7 @@ #include "graphics/scaler.h" #include "graphics/thumbnail.h" #include "xeen/xeen.h" -#include "xeen/menus.h" +#include "xeen/dialogs_options.h" #include "xeen/resources.h" namespace Xeen { -- cgit v1.2.3 From 5135439bbd64289e4c6c780f4b4da03ce40e75be Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 1 Jan 2015 14:57:56 -1000 Subject: XEEN: Reorganisation of resource, sprite, and cc file class files --- engines/xeen/xeen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index cbdb6f3104..b61d6a6cc2 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -29,7 +29,7 @@ #include "graphics/thumbnail.h" #include "xeen/xeen.h" #include "xeen/dialogs_options.h" -#include "xeen/resources.h" +#include "xeen/files.h" namespace Xeen { @@ -58,7 +58,7 @@ void XeenEngine::initialize() { DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); // Create sub-objects of the engine - Resources::init(this); + FileManager::init(this); _debugger = new Debugger(this); _events = new EventsManager(this); _screen = new Screen(this); -- cgit v1.2.3 From 971a70a2b3cea2ab6d0d77b130c8300ad5f05ca7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 1 Jan 2015 19:15:08 -1000 Subject: XEEN: Implemented party and condition classes --- engines/xeen/xeen.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index b61d6a6cc2..35b4188c06 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -82,6 +82,14 @@ void XeenEngine::initialize() { Common::Error XeenEngine::run() { initialize(); + showIntro(); + if (shouldQuit()) + return Common::kNoError; + + showMainMenu(); + if (shouldQuit()) + return Common::kNoError; + playGame(); return Common::kNoError; @@ -220,8 +228,21 @@ void XeenEngine::writeSavegameHeader(Common::OutSaveFile *out, XeenSavegameHeade // out->writeUint32LE(_events->getFrameCounter()); } +void XeenEngine::showIntro() { + +} + +void XeenEngine::showMainMenu() { + //OptionsMenu::show(this); +} + void XeenEngine::playGame() { - OptionsMenu::show(this); + +} + +void XeenEngine::drawUI() { + SpriteResource sprites1("global.icn"), borderSprites("border.icn"); + } } // End of namespace Xeen -- cgit v1.2.3 From feacce66b92f17c655d70ec2cc233fc63feb517c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Jan 2015 11:01:41 -1000 Subject: XEEN: Implemented dynamic data loading for new games --- engines/xeen/xeen.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 35b4188c06..96a4f5f3cf 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -37,6 +37,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) : _gameDescription(gameDesc), Engine(syst), _randomSource("Xeen") { _debugger = nullptr; _events = nullptr; + _saves = nullptr; _screen = nullptr; _sound = nullptr; _eventData = nullptr; @@ -45,6 +46,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) XeenEngine::~XeenEngine() { delete _debugger; delete _events; + delete _saves; delete _screen; delete _sound; delete _eventData; @@ -61,6 +63,7 @@ void XeenEngine::initialize() { FileManager::init(this); _debugger = new Debugger(this); _events = new EventsManager(this); + _saves = new SavesManager(this); _screen = new Screen(this); _screen->setupWindows(); _sound = new SoundManager(this); @@ -237,7 +240,8 @@ void XeenEngine::showMainMenu() { } void XeenEngine::playGame() { - + _saves->reset(); +// drawUI(); } void XeenEngine::drawUI() { -- cgit v1.2.3 From 27e020cbf98d88373111bff0f1d6ed0e846b2311 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Jan 2015 12:14:57 -1000 Subject: XEEN: Split char/party logic into it's own file --- engines/xeen/xeen.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 96a4f5f3cf..45d9c22413 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -41,6 +41,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _screen = nullptr; _sound = nullptr; _eventData = nullptr; + Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); } XeenEngine::~XeenEngine() { @@ -241,12 +242,21 @@ void XeenEngine::showMainMenu() { void XeenEngine::playGame() { _saves->reset(); -// drawUI(); + drawUI(); } +/* + * Lots of stuff in this method. + * TODO: Consider renaming method when better understood + */ void XeenEngine::drawUI() { SpriteResource sprites1("global.icn"), borderSprites("border.icn"); + // Get mappings to the active characters in the party + Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); + for (int i = 0; i < _saves->_party._partyCount; ++i) { + _activeRoster[i] = &_saves->_roster[_saves->_party._partyMembers[i]]; + } } } // End of namespace Xeen -- cgit v1.2.3 From 9a8cb48a9edcc67b17c192ff13b3d9d1e40f73a9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Jan 2015 12:27:59 -1000 Subject: XEEN: Cleanup of party code split, moved roster and party to engine --- engines/xeen/xeen.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 45d9c22413..dfa05b0aa1 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -42,6 +42,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _sound = nullptr; _eventData = nullptr; Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); + _isEarlyGame = false; } XeenEngine::~XeenEngine() { @@ -64,7 +65,7 @@ void XeenEngine::initialize() { FileManager::init(this); _debugger = new Debugger(this); _events = new EventsManager(this); - _saves = new SavesManager(this); + _saves = new SavesManager(this, _party, _roster); _screen = new Screen(this); _screen->setupWindows(); _sound = new SoundManager(this); @@ -254,9 +255,11 @@ void XeenEngine::drawUI() { // Get mappings to the active characters in the party Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); - for (int i = 0; i < _saves->_party._partyCount; ++i) { - _activeRoster[i] = &_saves->_roster[_saves->_party._partyMembers[i]]; + for (int i = 0; i < _party._partyCount; ++i) { + _activeRoster[i] = &_roster[_party._partyMembers[i]]; } + + _isEarlyGame = _party._minutes >= 300; } } // End of namespace Xeen -- cgit v1.2.3 From e1404f127d376225d0c15c43b12f59749689c731 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Jan 2015 13:30:00 -1000 Subject: XEEN: Simplified SpriteResource class, char faces loading in main engine --- engines/xeen/xeen.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index dfa05b0aa1..f2bbbe0517 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -42,7 +42,10 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _sound = nullptr; _eventData = nullptr; Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); + Common::fill(&_partyFaces[0], &_partyFaces[MAX_ACTIVE_PARTY], nullptr); + _isEarlyGame = false; + } XeenEngine::~XeenEngine() { @@ -243,14 +246,14 @@ void XeenEngine::showMainMenu() { void XeenEngine::playGame() { _saves->reset(); - drawUI(); + drawUI(true); } /* * Lots of stuff in this method. * TODO: Consider renaming method when better understood */ -void XeenEngine::drawUI() { +void XeenEngine::drawUI(bool soundPlayed) { SpriteResource sprites1("global.icn"), borderSprites("border.icn"); // Get mappings to the active characters in the party @@ -260,6 +263,30 @@ void XeenEngine::drawUI() { } _isEarlyGame = _party._minutes >= 300; + + if (_party._mazeId == 0) { + if (!soundPlayed) { + warning("TODO: loadSound?"); + } + + if (!_partyFaces[0]) { + // Xeen only uses 24 of possible 30 character slots + loadCharIcons(24); + + for (int i = 0; i < _party._partyCount; ++i) + _partyFaces[i] = &_charFaces[_party._partyMembers[i]]; + } + } +} + +void XeenEngine::loadCharIcons(int numChars) { + for (int i = 0; i < numChars; ++i) { + // Load new character resource + Common::String name = Common::String::format("char%02d.fac", i); + _charFaces[i].load(name); + } + + _dseFace.load("dse.fac"); } } // End of namespace Xeen -- cgit v1.2.3 From 9b40bd5c6aa8110e7b3a13eec2550a4c6f201668 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Jan 2015 15:25:14 -1000 Subject: XEEN: More UI loading code, refactored Dialog base to ButtonContainer --- engines/xeen/xeen.cpp | 47 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index f2bbbe0517..d7f6138342 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -34,7 +34,7 @@ namespace Xeen { XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) - : _gameDescription(gameDesc), Engine(syst), _randomSource("Xeen") { + : Engine(syst), ButtonContainer(), _gameDescription(gameDesc), _randomSource("Xeen") { _debugger = nullptr; _events = nullptr; _saves = nullptr; @@ -43,9 +43,9 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _eventData = nullptr; Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); Common::fill(&_partyFaces[0], &_partyFaces[MAX_ACTIVE_PARTY], nullptr); - _isEarlyGame = false; - + _loadDarkSide = 1; + _buttonsLoaded = false; } XeenEngine::~XeenEngine() { @@ -246,15 +246,16 @@ void XeenEngine::showMainMenu() { void XeenEngine::playGame() { _saves->reset(); - drawUI(true); + setupUI(true); } /* * Lots of stuff in this method. * TODO: Consider renaming method when better understood */ -void XeenEngine::drawUI(bool soundPlayed) { - SpriteResource sprites1("global.icn"), borderSprites("border.icn"); +void XeenEngine::setupUI(bool soundPlayed) { + SpriteResource sprites1("global.icn"), borderSprites("border.icn"), + uiSprites("inn.icn"); // Get mappings to the active characters in the party Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); @@ -271,11 +272,39 @@ void XeenEngine::drawUI(bool soundPlayed) { if (!_partyFaces[0]) { // Xeen only uses 24 of possible 30 character slots - loadCharIcons(24); + loadCharIcons(XEEN_TOTAL_CHARACTERS); for (int i = 0; i < _party._partyCount; ++i) _partyFaces[i] = &_charFaces[_party._partyMembers[i]]; } + + _mode = MODE_1; + Common::Array xeenSideChars; + + // Build up a list of characters on the same Xeen side being loaded + for (int i = 0; i < XEEN_TOTAL_CHARACTERS; ++i) { + PlayerStruct &player = _roster[i]; + if (player._name.empty() || player._xeenSide != _loadDarkSide) + continue; + + xeenSideChars.push_back(i); + } + + // Add in buttons for the UI + _buttonsLoaded = true; + addButton(Common::Rect(16, 100, 40, 120), 242, &uiSprites, true); + addButton(Common::Rect(52, 100, 76, 120), 243, &uiSprites, true); + addButton(Common::Rect(87, 100, 111, 120), 68, &uiSprites, true); + addButton(Common::Rect(122, 100, 146, 120), 82, &uiSprites, true); + addButton(Common::Rect(157, 100, 181, 120), 67, &uiSprites, true); + addButton(Common::Rect(192, 100, 216, 120), 88, &uiSprites, true); + addButton(Common::Rect(), 27, &uiSprites, false); + addButton(Common::Rect(16, 16, 48, 48), 49, &uiSprites, false); + addButton(Common::Rect(117, 16, 139, 48), 50, &uiSprites, false); + addButton(Common::Rect(16, 59, 48, 81), 51, &uiSprites, false); + addButton(Common::Rect(117, 59, 149, 81), 52, &uiSprites, false); + + setupGameBackground(); } } @@ -289,4 +318,8 @@ void XeenEngine::loadCharIcons(int numChars) { _dseFace.load("dse.fac"); } +void XeenEngine::setupGameBackground() { + +} + } // End of namespace Xeen -- cgit v1.2.3 From 7d4fcfd5afb272c62ad7f1628cc1adfe17c8ee6f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Jan 2015 16:02:24 -1000 Subject: XEEN: Added checkSkill and animating indicators to assembleBorder --- engines/xeen/xeen.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index d7f6138342..a46526e6ec 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -46,6 +46,11 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _isEarlyGame = false; _loadDarkSide = 1; _buttonsLoaded = false; + _batUIFrame = 0; + _spotDoorsUIFrame = 0; + _spotDoorsAllowed = false; + _dangerSenseUIFrame = 0; + _dangerSenseAllowed = false; } XeenEngine::~XeenEngine() { @@ -254,8 +259,10 @@ void XeenEngine::playGame() { * TODO: Consider renaming method when better understood */ void XeenEngine::setupUI(bool soundPlayed) { - SpriteResource sprites1("global.icn"), borderSprites("border.icn"), - uiSprites("inn.icn"); + SpriteResource uiSprites("inn.icn"); + _globalSprites.load("global.icn"); + _borderSprites.load("border.icn"); + _spellFxSprites.load("spellfx.icn"); // Get mappings to the active characters in the party Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); @@ -319,7 +326,61 @@ void XeenEngine::loadCharIcons(int numChars) { } void XeenEngine::setupGameBackground() { + _screen->loadBackground("back.raw"); + assembleBorder(); +} + +void XeenEngine::assembleBorder() { + Window &gameWindow = _screen->_windows[28]; + + // Draw the outer frame + _globalSprites.draw(gameWindow, 0); + // Draw the animating bat character used to show when levitate is active + _borderSprites.draw(*_screen, _party._levitateActive ? _batUIFrame + 16 : 16); + _batUIFrame = (_batUIFrame + 1) % 12; + + // Draw UI element to indicate whether can spot hidden doors + _borderSprites.draw(*_screen, + (_spotDoorsAllowed && checkSkill(SPOT_DOORS)) ? _spotDoorsUIFrame + 28 : 28, + Common::Point(194, 91)); + _spotDoorsUIFrame = (_spotDoorsUIFrame + 1) % 12; + + // Draw UI element to indicate whether can sense danger + _borderSprites.draw(*_screen, + (_dangerSenseAllowed && checkSkill(DANGER_SENSE)) ? _spotDoorsUIFrame + 40 : 40, + Common::Point(107, 9)); + _dangerSenseUIFrame = (_dangerSenseUIFrame + 1) % 12; + + + // TODO +} + +bool XeenEngine::checkSkill(Skill skillId) { + int total = 0; + for (int i = 0; i < _party._partyCount; ++i) { + if (_activeRoster[i]->_skills[skillId]) { + ++total; + + switch (skillId) { + case MOUNTAINEER: + case PATHFINDER: + // At least two characters need skill for check to return true + if (total == 2) + return true; + break; + case CRUSADER: + case SWIMMING: + // Entire party must have skill for check to return true + if (total == _party._partyCount) + return true; + break; + default: + // All other skills only need to have a single player having it + return true; + } + } + } } } // End of namespace Xeen -- cgit v1.2.3 From 1a999e3ceb39603bca213f81342a055e1eee7ebe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Jan 2015 16:08:38 -1000 Subject: XEEN: Refactored checkSkill into Party class --- engines/xeen/xeen.cpp | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index a46526e6ec..315e5172b7 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -41,7 +41,6 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _screen = nullptr; _sound = nullptr; _eventData = nullptr; - Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); Common::fill(&_partyFaces[0], &_partyFaces[MAX_ACTIVE_PARTY], nullptr); _isEarlyGame = false; _loadDarkSide = 1; @@ -265,9 +264,9 @@ void XeenEngine::setupUI(bool soundPlayed) { _spellFxSprites.load("spellfx.icn"); // Get mappings to the active characters in the party - Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); + _party._activeParty.resize(_party._partyCount); for (int i = 0; i < _party._partyCount; ++i) { - _activeRoster[i] = &_roster[_party._partyMembers[i]]; + _party._activeParty[i] = &_roster[_party._partyMembers[i]]; } _isEarlyGame = _party._minutes >= 300; @@ -342,13 +341,13 @@ void XeenEngine::assembleBorder() { // Draw UI element to indicate whether can spot hidden doors _borderSprites.draw(*_screen, - (_spotDoorsAllowed && checkSkill(SPOT_DOORS)) ? _spotDoorsUIFrame + 28 : 28, + (_spotDoorsAllowed && _party.checkSkill(SPOT_DOORS)) ? _spotDoorsUIFrame + 28 : 28, Common::Point(194, 91)); _spotDoorsUIFrame = (_spotDoorsUIFrame + 1) % 12; // Draw UI element to indicate whether can sense danger _borderSprites.draw(*_screen, - (_dangerSenseAllowed && checkSkill(DANGER_SENSE)) ? _spotDoorsUIFrame + 40 : 40, + (_dangerSenseAllowed && _party.checkSkill(DANGER_SENSE)) ? _spotDoorsUIFrame + 40 : 40, Common::Point(107, 9)); _dangerSenseUIFrame = (_dangerSenseUIFrame + 1) % 12; @@ -356,31 +355,4 @@ void XeenEngine::assembleBorder() { // TODO } -bool XeenEngine::checkSkill(Skill skillId) { - int total = 0; - for (int i = 0; i < _party._partyCount; ++i) { - if (_activeRoster[i]->_skills[skillId]) { - ++total; - - switch (skillId) { - case MOUNTAINEER: - case PATHFINDER: - // At least two characters need skill for check to return true - if (total == 2) - return true; - break; - case CRUSADER: - case SWIMMING: - // Entire party must have skill for check to return true - if (total == _party._partyCount) - return true; - break; - default: - // All other skills only need to have a single player having it - return true; - } - } - } -} - } // End of namespace Xeen -- cgit v1.2.3 From 166676462ae3ed6ddbe186504cf7ecb5f2e55703 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Jan 2015 16:54:59 -1000 Subject: XEEN: Completed assembleGameBorder method --- engines/xeen/xeen.cpp | 99 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 3 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 315e5172b7..ec98a5ffe8 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -30,6 +30,7 @@ #include "xeen/xeen.h" #include "xeen/dialogs_options.h" #include "xeen/files.h" +#include "xeen/resources.h" namespace Xeen { @@ -50,6 +51,15 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _spotDoorsAllowed = false; _dangerSenseUIFrame = 0; _dangerSenseAllowed = false; + _face1UIFrame = 0; + _face1State = 0; + _face2UIFrame = 0; + _face2State = 0; + _blessedUIFrame = 0; + _powerShieldUIFrame = 0; + _holyBonusUIFrame = 0; + _heroismUIFrame = 0; + _noDirectionSense = false; } XeenEngine::~XeenEngine() { @@ -262,6 +272,8 @@ void XeenEngine::setupUI(bool soundPlayed) { _globalSprites.load("global.icn"); _borderSprites.load("border.icn"); _spellFxSprites.load("spellfx.icn"); + _fecpSprites.load("fecp.brd"); + _blessSprites.load("bless.icn"); // Get mappings to the active characters in the party _party._activeParty.resize(_party._partyCount); @@ -326,10 +338,10 @@ void XeenEngine::loadCharIcons(int numChars) { void XeenEngine::setupGameBackground() { _screen->loadBackground("back.raw"); - assembleBorder(); + assembleGameBorder(); } -void XeenEngine::assembleBorder() { +void XeenEngine::assembleGameBorder() { Window &gameWindow = _screen->_windows[28]; // Draw the outer frame @@ -351,8 +363,89 @@ void XeenEngine::assembleBorder() { Common::Point(107, 9)); _dangerSenseUIFrame = (_dangerSenseUIFrame + 1) % 12; + // Handle the face UI elements for indicating clairvoyance status + _face1UIFrame = (_face1UIFrame + 1) % 4; + if (_face1State == 0) + _face1UIFrame += 4; + else if (_face1State == 2) + _face1UIFrame = 0; + + _face2UIFrame = (_face2UIFrame + 1) % 4 + 12; + if (_face2State == 0) + _face2UIFrame += 252; + else if (_face2State == 2) + _face2UIFrame = 0; + + if (!_party._clairvoyanceActive) { + _face1UIFrame = 0; + _face2UIFrame = 8; + } - // TODO + _borderSprites.draw(*_screen, _face1UIFrame, Common::Point(0, 32)); + _borderSprites.draw(*_screen, + _screen->_windows[10]._enabled || _screen->_windows[2]._enabled ? + 52 : _face2UIFrame, + Common::Point(215, 32)); + + // Draw resistence indicators + if (!_screen->_windows[10]._enabled && !_screen->_windows[2]._enabled + && _screen->_windows[38]._enabled) { + _fecpSprites.draw(*_screen, _party._fireResistence ? 1 : 0, + Common::Point(2, 2)); + _fecpSprites.draw(*_screen, _party._electricityResistence ? 3 : 2, + Common::Point(219, 2)); + _fecpSprites.draw(*_screen, _party._coldResistence ? 5 : 4, + Common::Point(2, 134)); + _fecpSprites.draw(*_screen, _party._poisonResistence ? 7 : 6, + Common::Point(219, 134)); + } else { + _fecpSprites.draw(*_screen, _party._fireResistence ? 9 : 8, + Common::Point(8, 8)); + _fecpSprites.draw(*_screen, _party._electricityResistence ? 10 : 11, + Common::Point(219, 8)); + _fecpSprites.draw(*_screen, _party._coldResistence ? 12 : 13, + Common::Point(8, 134)); + _fecpSprites.draw(*_screen, _party._poisonResistence ? 14 : 15, + Common::Point(219, 134)); + } + + // Draw UI element for blessed + _blessSprites.draw(*_screen, 16, Common::Point(33, 137)); + if (_party._blessedActive) { + _blessedUIFrame = (_blessedUIFrame + 1) % 4; + _blessSprites.draw(*_screen, _blessedUIFrame, Common::Point(33, 137)); + } + + // Draw UI element for power shield + if (_party._powerShieldActive) { + _powerShieldUIFrame = (_powerShieldUIFrame + 1) % 4; + _blessSprites.draw(*_screen, _powerShieldUIFrame + 4, + Common::Point(55, 137)); + } + + // Draw UI element for holy bonus + if (_party._holyBonusActive) { + _holyBonusUIFrame = (_holyBonusUIFrame + 1) % 4; + _blessSprites.draw(*_screen, _holyBonusUIFrame + 8, Common::Point(160, 137)); + } + + // Draw UI element for heroism + if (_party._heroismActive) { + _heroismUIFrame = (_heroismUIFrame + 1) % 4; + _blessSprites.draw(*_screen, _heroismUIFrame + 12, Common::Point(182, 137)); + } + + // Draw direction character if direction sense is active + if (_party.checkSkill(DIRECTION_SENSE) && !_noDirectionSense) { + const char *dirText = DIRECTION_TEXT[_party._mazeDirection]; + Common::String msg = Common::String::format( + "\002""08\003""c\013""139\011""116%c\014""d\001", *dirText); + _screen->_windows[0].writeString(msg); + } + + // Draw view frame + if (_screen->_windows[12]._enabled) + _screen->_windows[12].frame(); } } // End of namespace Xeen -- cgit v1.2.3 From 97cd5a7e6961be52d545e3c131a85cd90c582441 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 3 Jan 2015 03:19:14 -1000 Subject: XEEN: Split game interface code into it's own class --- engines/xeen/xeen.cpp | 204 ++------------------------------------------------ 1 file changed, 5 insertions(+), 199 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index ec98a5ffe8..1574871c25 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -35,36 +35,26 @@ namespace Xeen { XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) - : Engine(syst), ButtonContainer(), _gameDescription(gameDesc), _randomSource("Xeen") { + : Engine(syst), _gameDescription(gameDesc), _randomSource("Xeen") { _debugger = nullptr; _events = nullptr; + _interface = nullptr; _saves = nullptr; _screen = nullptr; _sound = nullptr; _eventData = nullptr; - Common::fill(&_partyFaces[0], &_partyFaces[MAX_ACTIVE_PARTY], nullptr); - _isEarlyGame = false; _loadDarkSide = 1; - _buttonsLoaded = false; - _batUIFrame = 0; - _spotDoorsUIFrame = 0; _spotDoorsAllowed = false; - _dangerSenseUIFrame = 0; _dangerSenseAllowed = false; - _face1UIFrame = 0; _face1State = 0; - _face2UIFrame = 0; _face2State = 0; - _blessedUIFrame = 0; - _powerShieldUIFrame = 0; - _holyBonusUIFrame = 0; - _heroismUIFrame = 0; _noDirectionSense = false; } XeenEngine::~XeenEngine() { delete _debugger; delete _events; + delete _interface; delete _saves; delete _screen; delete _sound; @@ -82,6 +72,7 @@ void XeenEngine::initialize() { FileManager::init(this); _debugger = new Debugger(this); _events = new EventsManager(this); + _interface = new Interface(this); _saves = new SavesManager(this, _party, _roster); _screen = new Screen(this); _screen->setupWindows(); @@ -260,192 +251,7 @@ void XeenEngine::showMainMenu() { void XeenEngine::playGame() { _saves->reset(); - setupUI(true); -} - -/* - * Lots of stuff in this method. - * TODO: Consider renaming method when better understood - */ -void XeenEngine::setupUI(bool soundPlayed) { - SpriteResource uiSprites("inn.icn"); - _globalSprites.load("global.icn"); - _borderSprites.load("border.icn"); - _spellFxSprites.load("spellfx.icn"); - _fecpSprites.load("fecp.brd"); - _blessSprites.load("bless.icn"); - - // Get mappings to the active characters in the party - _party._activeParty.resize(_party._partyCount); - for (int i = 0; i < _party._partyCount; ++i) { - _party._activeParty[i] = &_roster[_party._partyMembers[i]]; - } - - _isEarlyGame = _party._minutes >= 300; - - if (_party._mazeId == 0) { - if (!soundPlayed) { - warning("TODO: loadSound?"); - } - - if (!_partyFaces[0]) { - // Xeen only uses 24 of possible 30 character slots - loadCharIcons(XEEN_TOTAL_CHARACTERS); - - for (int i = 0; i < _party._partyCount; ++i) - _partyFaces[i] = &_charFaces[_party._partyMembers[i]]; - } - - _mode = MODE_1; - Common::Array xeenSideChars; - - // Build up a list of characters on the same Xeen side being loaded - for (int i = 0; i < XEEN_TOTAL_CHARACTERS; ++i) { - PlayerStruct &player = _roster[i]; - if (player._name.empty() || player._xeenSide != _loadDarkSide) - continue; - - xeenSideChars.push_back(i); - } - - // Add in buttons for the UI - _buttonsLoaded = true; - addButton(Common::Rect(16, 100, 40, 120), 242, &uiSprites, true); - addButton(Common::Rect(52, 100, 76, 120), 243, &uiSprites, true); - addButton(Common::Rect(87, 100, 111, 120), 68, &uiSprites, true); - addButton(Common::Rect(122, 100, 146, 120), 82, &uiSprites, true); - addButton(Common::Rect(157, 100, 181, 120), 67, &uiSprites, true); - addButton(Common::Rect(192, 100, 216, 120), 88, &uiSprites, true); - addButton(Common::Rect(), 27, &uiSprites, false); - addButton(Common::Rect(16, 16, 48, 48), 49, &uiSprites, false); - addButton(Common::Rect(117, 16, 139, 48), 50, &uiSprites, false); - addButton(Common::Rect(16, 59, 48, 81), 51, &uiSprites, false); - addButton(Common::Rect(117, 59, 149, 81), 52, &uiSprites, false); - - setupGameBackground(); - } -} - -void XeenEngine::loadCharIcons(int numChars) { - for (int i = 0; i < numChars; ++i) { - // Load new character resource - Common::String name = Common::String::format("char%02d.fac", i); - _charFaces[i].load(name); - } - - _dseFace.load("dse.fac"); -} - -void XeenEngine::setupGameBackground() { - _screen->loadBackground("back.raw"); - assembleGameBorder(); -} - -void XeenEngine::assembleGameBorder() { - Window &gameWindow = _screen->_windows[28]; - - // Draw the outer frame - _globalSprites.draw(gameWindow, 0); - - // Draw the animating bat character used to show when levitate is active - _borderSprites.draw(*_screen, _party._levitateActive ? _batUIFrame + 16 : 16); - _batUIFrame = (_batUIFrame + 1) % 12; - - // Draw UI element to indicate whether can spot hidden doors - _borderSprites.draw(*_screen, - (_spotDoorsAllowed && _party.checkSkill(SPOT_DOORS)) ? _spotDoorsUIFrame + 28 : 28, - Common::Point(194, 91)); - _spotDoorsUIFrame = (_spotDoorsUIFrame + 1) % 12; - - // Draw UI element to indicate whether can sense danger - _borderSprites.draw(*_screen, - (_dangerSenseAllowed && _party.checkSkill(DANGER_SENSE)) ? _spotDoorsUIFrame + 40 : 40, - Common::Point(107, 9)); - _dangerSenseUIFrame = (_dangerSenseUIFrame + 1) % 12; - - // Handle the face UI elements for indicating clairvoyance status - _face1UIFrame = (_face1UIFrame + 1) % 4; - if (_face1State == 0) - _face1UIFrame += 4; - else if (_face1State == 2) - _face1UIFrame = 0; - - _face2UIFrame = (_face2UIFrame + 1) % 4 + 12; - if (_face2State == 0) - _face2UIFrame += 252; - else if (_face2State == 2) - _face2UIFrame = 0; - - if (!_party._clairvoyanceActive) { - _face1UIFrame = 0; - _face2UIFrame = 8; - } - - _borderSprites.draw(*_screen, _face1UIFrame, Common::Point(0, 32)); - _borderSprites.draw(*_screen, - _screen->_windows[10]._enabled || _screen->_windows[2]._enabled ? - 52 : _face2UIFrame, - Common::Point(215, 32)); - - // Draw resistence indicators - if (!_screen->_windows[10]._enabled && !_screen->_windows[2]._enabled - && _screen->_windows[38]._enabled) { - _fecpSprites.draw(*_screen, _party._fireResistence ? 1 : 0, - Common::Point(2, 2)); - _fecpSprites.draw(*_screen, _party._electricityResistence ? 3 : 2, - Common::Point(219, 2)); - _fecpSprites.draw(*_screen, _party._coldResistence ? 5 : 4, - Common::Point(2, 134)); - _fecpSprites.draw(*_screen, _party._poisonResistence ? 7 : 6, - Common::Point(219, 134)); - } else { - _fecpSprites.draw(*_screen, _party._fireResistence ? 9 : 8, - Common::Point(8, 8)); - _fecpSprites.draw(*_screen, _party._electricityResistence ? 10 : 11, - Common::Point(219, 8)); - _fecpSprites.draw(*_screen, _party._coldResistence ? 12 : 13, - Common::Point(8, 134)); - _fecpSprites.draw(*_screen, _party._poisonResistence ? 14 : 15, - Common::Point(219, 134)); - } - - // Draw UI element for blessed - _blessSprites.draw(*_screen, 16, Common::Point(33, 137)); - if (_party._blessedActive) { - _blessedUIFrame = (_blessedUIFrame + 1) % 4; - _blessSprites.draw(*_screen, _blessedUIFrame, Common::Point(33, 137)); - } - - // Draw UI element for power shield - if (_party._powerShieldActive) { - _powerShieldUIFrame = (_powerShieldUIFrame + 1) % 4; - _blessSprites.draw(*_screen, _powerShieldUIFrame + 4, - Common::Point(55, 137)); - } - - // Draw UI element for holy bonus - if (_party._holyBonusActive) { - _holyBonusUIFrame = (_holyBonusUIFrame + 1) % 4; - _blessSprites.draw(*_screen, _holyBonusUIFrame + 8, Common::Point(160, 137)); - } - - // Draw UI element for heroism - if (_party._heroismActive) { - _heroismUIFrame = (_heroismUIFrame + 1) % 4; - _blessSprites.draw(*_screen, _heroismUIFrame + 12, Common::Point(182, 137)); - } - - // Draw direction character if direction sense is active - if (_party.checkSkill(DIRECTION_SENSE) && !_noDirectionSense) { - const char *dirText = DIRECTION_TEXT[_party._mazeDirection]; - Common::String msg = Common::String::format( - "\002""08\003""c\013""139\011""116%c\014""d\001", *dirText); - _screen->_windows[0].writeString(msg); - } - - // Draw view frame - if (_screen->_windows[12]._enabled) - _screen->_windows[12].frame(); + _interface->setup(true); } } // End of namespace Xeen -- cgit v1.2.3 From ce96094c9bc54266c9742364e656c97446a6ecaf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 5 Jan 2015 08:11:16 -0500 Subject: XEEN: In progress implementing map loading --- engines/xeen/xeen.cpp | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 1574871c25..b3ac7433a3 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -38,7 +38,9 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _randomSource("Xeen") { _debugger = nullptr; _events = nullptr; + _files = nullptr; _interface = nullptr; + _map = nullptr; _saves = nullptr; _screen = nullptr; _sound = nullptr; @@ -49,16 +51,19 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _face1State = 0; _face2State = 0; _noDirectionSense = false; + _falling = false; } XeenEngine::~XeenEngine() { delete _debugger; delete _events; delete _interface; + delete _map; delete _saves; delete _screen; delete _sound; delete _eventData; + delete _files; } void XeenEngine::initialize() { @@ -69,10 +74,11 @@ void XeenEngine::initialize() { DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); // Create sub-objects of the engine - FileManager::init(this); + _files = new FileManager(this); _debugger = new Debugger(this); _events = new EventsManager(this); _interface = new Interface(this); + _map = new Map(this); _saves = new SavesManager(this, _party, _roster); _screen = new Screen(this); _screen->setupWindows(); @@ -249,9 +255,34 @@ void XeenEngine::showMainMenu() { //OptionsMenu::show(this); } +/** + * Main method for playing the game + */ void XeenEngine::playGame() { _saves->reset(); - _interface->setup(true); + play(); +} + +/* + * Secondary method for handling the actual gameplay + */ +void XeenEngine::play() { + // TODO: Init variables + + _screen->loadBackground("back.raw"); + _screen->loadPalette("mm4.pal"); + _interface->loadCharIcons(_party._partyCount); + _iconsSprites.load("main.icn"); + + if (getGameID() != GType_WorldOfXeen && !_loadDarkSide) { + _loadDarkSide = true; + _party._mazeId = 29; + _party._mazeDirection = DIR_NORTH; + _party._mazePosition.x = 25; + _party._mazePosition.y = 21; + } + + _map->load(_party._mazeId); } } // End of namespace Xeen -- cgit v1.2.3 From 42165d21bb626e325d79d755bbf65b8b5044020f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 5 Jan 2015 15:10:42 -0500 Subject: XEEN: Implement more map loading --- engines/xeen/xeen.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index b3ac7433a3..7321befb08 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -52,6 +52,8 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _face2State = 0; _noDirectionSense = false; _falling = false; + _tillMove = false; + _moveMonsters = false; } XeenEngine::~XeenEngine() { @@ -271,8 +273,7 @@ void XeenEngine::play() { _screen->loadBackground("back.raw"); _screen->loadPalette("mm4.pal"); - _interface->loadCharIcons(_party._partyCount); - _iconsSprites.load("main.icn"); + _interface->loadPartyIcons(); if (getGameID() != GType_WorldOfXeen && !_loadDarkSide) { _loadDarkSide = true; @@ -283,6 +284,28 @@ void XeenEngine::play() { } _map->load(_party._mazeId); + + _interface->startup(); + if (_mode == MODE_0) { + _screen->fadeOut(4); + } + + _screen->_windows[0].update(); + _interface->mainIconsPrint(); + _screen->_windows[0].update(); + _events->setCursor(0); + + _moveMonsters = true; + _tillMove = false; + if (_mode == MODE_0) { + _mode = MODE_1; + _screen->fadeIn(4); + } + + // Main game loop + while (!shouldQuit()) { + _events->pollEventsAndWait(); + } } } // End of namespace Xeen -- cgit v1.2.3 From eb0c292aafc9b1b819ab1f43d4ec3a059842e96a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 5 Jan 2015 21:17:44 -0500 Subject: XEEN: Start of in-game display implementation --- engines/xeen/xeen.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 7321befb08..948b4154fe 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -54,6 +54,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _falling = false; _tillMove = false; _moveMonsters = false; + _mode = MODE_0; } XeenEngine::~XeenEngine() { @@ -271,6 +272,7 @@ void XeenEngine::playGame() { void XeenEngine::play() { // TODO: Init variables + _interface->setup(); _screen->loadBackground("back.raw"); _screen->loadPalette("mm4.pal"); _interface->loadPartyIcons(); -- cgit v1.2.3 From 31f4f5b843400531d3e091ae0eb673d6dacc227d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 6 Jan 2015 19:09:07 -0500 Subject: XEEN: More interface setup and UI button definitions --- engines/xeen/xeen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 948b4154fe..c2abdd9e9f 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -52,7 +52,6 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _face2State = 0; _noDirectionSense = false; _falling = false; - _tillMove = false; _moveMonsters = false; _mode = MODE_0; } @@ -298,12 +297,13 @@ void XeenEngine::play() { _events->setCursor(0); _moveMonsters = true; - _tillMove = false; if (_mode == MODE_0) { _mode = MODE_1; _screen->fadeIn(4); } + _moveMonsters = true; + // Main game loop while (!shouldQuit()) { _events->pollEventsAndWait(); -- cgit v1.2.3 From 49787629ffb86569faebd3155fd65c0cedea0bad Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Jan 2015 08:54:42 -0500 Subject: XEEN: Various renamings --- engines/xeen/xeen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index c2abdd9e9f..9cc51e1765 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -46,7 +46,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _sound = nullptr; _eventData = nullptr; _loadDarkSide = 1; - _spotDoorsAllowed = false; + _thinWall = false; _dangerSenseAllowed = false; _face1State = 0; _face2State = 0; -- cgit v1.2.3 From 488847006c5ddd29a6ab8de0145d80e26daab48c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 12 Jan 2015 20:25:12 -0500 Subject: XEEN: Implemented setMazeBits --- engines/xeen/xeen.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 9cc51e1765..583a1dd262 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -46,7 +46,6 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _sound = nullptr; _eventData = nullptr; _loadDarkSide = 1; - _thinWall = false; _dangerSenseAllowed = false; _face1State = 0; _face2State = 0; -- cgit v1.2.3 From 747ca9eb2ff87b1205d41fcd0cf65a016ade8e0d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 13 Jan 2015 00:16:26 -0500 Subject: XEEN: Implemented indoor drawing code in draw3d --- engines/xeen/xeen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 583a1dd262..c749129678 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -36,6 +36,7 @@ namespace Xeen { XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _randomSource("Xeen") { + _combat = nullptr; _debugger = nullptr; _events = nullptr; _files = nullptr; @@ -50,12 +51,13 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _face1State = 0; _face2State = 0; _noDirectionSense = false; - _falling = false; + _falling = 0; _moveMonsters = false; _mode = MODE_0; } XeenEngine::~XeenEngine() { + delete _combat; delete _debugger; delete _events; delete _interface; @@ -76,6 +78,7 @@ void XeenEngine::initialize() { // Create sub-objects of the engine _files = new FileManager(this); + _combat = new Combat(this); _debugger = new Debugger(this); _events = new EventsManager(this); _interface = new Interface(this); -- cgit v1.2.3 From 5f2e145580ae4c10fd384933ae65b66215779fd9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 14 Jan 2015 08:48:16 -0500 Subject: XEEN: Remainder of drawIndoors implemented --- engines/xeen/xeen.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index c749129678..b3758b57ed 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -54,6 +54,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _falling = 0; _moveMonsters = false; _mode = MODE_0; + _openDoor = 0; } XeenEngine::~XeenEngine() { -- cgit v1.2.3 From b12e26836aacfd414abb5967f7475435a4fd55a5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Jan 2015 20:56:35 -0500 Subject: XEEN: Disable initial fade out for now --- engines/xeen/xeen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index b3758b57ed..6b73de6939 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -291,7 +291,7 @@ void XeenEngine::play() { _interface->startup(); if (_mode == MODE_0) { - _screen->fadeOut(4); +// _screen->fadeOut(4); } _screen->_windows[0].update(); -- cgit v1.2.3 From 687423b3612d61a18a9854010af56f7a98e5563d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 19 Jan 2015 11:32:57 -0500 Subject: XEEN: Beginnings of main game loop and waiting --- engines/xeen/xeen.cpp | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 6b73de6939..b8f9030c85 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -42,8 +42,10 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _files = nullptr; _interface = nullptr; _map = nullptr; + _party = nullptr; _saves = nullptr; _screen = nullptr; + _scripts = nullptr; _sound = nullptr; _eventData = nullptr; _loadDarkSide = 1; @@ -63,8 +65,10 @@ XeenEngine::~XeenEngine() { delete _events; delete _interface; delete _map; + delete _party; delete _saves; delete _screen; + delete _scripts; delete _sound; delete _eventData; delete _files; @@ -84,8 +88,10 @@ void XeenEngine::initialize() { _events = new EventsManager(this); _interface = new Interface(this); _map = new Map(this); - _saves = new SavesManager(this, _party, _roster); + _party = new Party(this); + _saves = new SavesManager(this, *_party, _roster); _screen = new Screen(this); + _scripts = new Scripts(this); _screen->setupWindows(); _sound = new SoundManager(this); @@ -281,13 +287,13 @@ void XeenEngine::play() { if (getGameID() != GType_WorldOfXeen && !_loadDarkSide) { _loadDarkSide = true; - _party._mazeId = 29; - _party._mazeDirection = DIR_NORTH; - _party._mazePosition.x = 25; - _party._mazePosition.y = 21; + _party->_mazeId = 29; + _party->_mazeDirection = DIR_NORTH; + _party->_mazePosition.x = 25; + _party->_mazePosition.y = 21; } - _map->load(_party._mazeId); + _map->load(_party->_mazeId); _interface->startup(); if (_mode == MODE_0) { @@ -307,9 +313,22 @@ void XeenEngine::play() { _moveMonsters = true; + gameLoop(); +} + +void XeenEngine::gameLoop() { // Main game loop while (!shouldQuit()) { - _events->pollEventsAndWait(); + _map->cellFlagLookup(_party->_mazePosition); + if (_map->_currentIsEvent) { + _scripts->checkEvents(); + if (shouldQuit()) + return; + } + _scripts->giveTreasure(); + + // Wait loop + _interface->wait(); } } -- cgit v1.2.3 From ec294d662e7d54a9927c2b85ec430e1519be5de7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 19 Jan 2015 12:13:03 -0500 Subject: XEEN: Add extra ending code for pausing turns --- engines/xeen/xeen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index b8f9030c85..e9b4d93de8 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -327,8 +327,8 @@ void XeenEngine::gameLoop() { } _scripts->giveTreasure(); - // Wait loop - _interface->wait(); + // Main user interface handler for waiting for and processing user input + _interface->perform(); } } -- cgit v1.2.3 From 8b4d25d415bff87cfcc00fdf827139dda2fa4014 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 20 Jan 2015 08:46:27 -0500 Subject: XEEN: Implemented doStepCode --- engines/xeen/xeen.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index e9b4d93de8..38026d0117 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -53,7 +53,6 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _face1State = 0; _face2State = 0; _noDirectionSense = false; - _falling = 0; _moveMonsters = false; _mode = MODE_0; _openDoor = 0; -- cgit v1.2.3 From 2b51d324f3cc2a58f2a703c23030ee19ba85836b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 22 Jan 2015 22:05:36 -0500 Subject: XEEN: Implemented dialogs for Who Will and YesNo --- engines/xeen/xeen.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 38026d0117..2d824e53bc 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -50,8 +50,6 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _eventData = nullptr; _loadDarkSide = 1; _dangerSenseAllowed = false; - _face1State = 0; - _face2State = 0; _noDirectionSense = false; _moveMonsters = false; _mode = MODE_0; @@ -128,6 +126,10 @@ int XeenEngine::getRandomNumber(int maxNumber) { return _randomSource.getRandomNumber(maxNumber); } +int XeenEngine::getRandomNumber(int minNumber, int maxNumber) { + return getRandomNumber(maxNumber - minNumber) + minNumber; +} + Common::Error XeenEngine::saveGameState(int slot, const Common::String &desc) { Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving( generateSaveName(slot)); -- cgit v1.2.3 From 749372e456ed8f1a4aee31ce23c4f4f7fd5644cc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 23 Jan 2015 20:44:02 -0500 Subject: XEEN: More script code and string input dialog --- engines/xeen/xeen.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 2d824e53bc..99adbb3a41 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -54,6 +54,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _moveMonsters = false; _mode = MODE_0; _openDoor = 0; + _startupWindowActive = false; } XeenEngine::~XeenEngine() { -- cgit v1.2.3 From c08e54fde105637082ee7eb79eeacd1cb4137d57 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 23 Jan 2015 21:12:35 -0500 Subject: XEEN: Implement further script opcodes --- engines/xeen/xeen.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 99adbb3a41..8489f86ed5 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -48,7 +48,6 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _scripts = nullptr; _sound = nullptr; _eventData = nullptr; - _loadDarkSide = 1; _dangerSenseAllowed = false; _noDirectionSense = false; _moveMonsters = false; @@ -287,8 +286,8 @@ void XeenEngine::play() { _screen->loadPalette("mm4.pal"); _interface->loadPartyIcons(); - if (getGameID() != GType_WorldOfXeen && !_loadDarkSide) { - _loadDarkSide = true; + if (getGameID() != GType_WorldOfXeen && !_map->_loadDarkSide) { + _map->_loadDarkSide = true; _party->_mazeId = 29; _party->_mazeDirection = DIR_NORTH; _party->_mazePosition.x = 25; -- cgit v1.2.3 From 2abce62b8fd1b29d2c351ca7502f21010882674f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 Jan 2015 21:19:59 -0500 Subject: XEEN: Add skeleton for spells class --- engines/xeen/xeen.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 8489f86ed5..8879b15a0d 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -47,6 +47,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _screen = nullptr; _scripts = nullptr; _sound = nullptr; + _spells = nullptr; _eventData = nullptr; _dangerSenseAllowed = false; _noDirectionSense = false; @@ -67,6 +68,7 @@ XeenEngine::~XeenEngine() { delete _screen; delete _scripts; delete _sound; + delete _spells; delete _eventData; delete _files; } @@ -91,6 +93,7 @@ void XeenEngine::initialize() { _scripts = new Scripts(this); _screen->setupWindows(); _sound = new SoundManager(this); + _spells = new Spells(this); File f("029.obj"); _eventData = f.readStream(f.size()); -- cgit v1.2.3 From f11e11006b5cbe7d9bcd547f98ab2b4dba358764 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 Jan 2015 23:59:16 -0500 Subject: XEEN: Beginnings of Town class, implemented handleAction --- engines/xeen/xeen.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 8879b15a0d..8d646fbcf5 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -48,6 +48,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _scripts = nullptr; _sound = nullptr; _spells = nullptr; + _town = nullptr; _eventData = nullptr; _dangerSenseAllowed = false; _noDirectionSense = false; @@ -69,6 +70,7 @@ XeenEngine::~XeenEngine() { delete _scripts; delete _sound; delete _spells; + delete _town; delete _eventData; delete _files; } @@ -94,6 +96,7 @@ void XeenEngine::initialize() { _screen->setupWindows(); _sound = new SoundManager(this); _spells = new Spells(this); + _town = new Town(this); File f("029.obj"); _eventData = f.readStream(f.size()); -- cgit v1.2.3 From 81e1bd2930bf4192fa8bfdbb805c65795e68c6e1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 26 Jan 2015 21:35:50 -0500 Subject: XEEN: Implemented createTownText --- engines/xeen/xeen.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 8d646fbcf5..d7a85fbbf8 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -339,4 +339,14 @@ void XeenEngine::gameLoop() { } } +Common::String XeenEngine::printMil(uint value) { + return (value >= 1000000) ? Common::String::format("%lu mil", value / 1000000) : + Common::String::format("%lu", value); +} + +Common::String XeenEngine::printK(uint value) { + return (value > 9999) ? Common::String::format("%uk", value / 1000) : + Common::String::format("%u", value); +} + } // End of namespace Xeen -- cgit v1.2.3 From 6595abcf144850cc23208db71ce0098d9921112e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 5 Feb 2015 20:17:16 -0500 Subject: XEEN: Moved _maeNames to a new Resources class --- engines/xeen/xeen.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index d7a85fbbf8..d34e8edb21 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -43,6 +43,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _interface = nullptr; _map = nullptr; _party = nullptr; + _resources = nullptr; _saves = nullptr; _screen = nullptr; _scripts = nullptr; @@ -72,6 +73,7 @@ XeenEngine::~XeenEngine() { delete _spells; delete _town; delete _eventData; + delete _resources; delete _files; } @@ -84,6 +86,7 @@ void XeenEngine::initialize() { // Create sub-objects of the engine _files = new FileManager(this); + _resources = new Resources(); _combat = new Combat(this); _debugger = new Debugger(this); _events = new EventsManager(this); -- cgit v1.2.3 From 62eb39515b0f19a52861e9dd0fb4ac6af8c1c2ba Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 9 Feb 2015 20:57:19 -0500 Subject: XEEN: Some refactoring needed for resources the party dialog will need --- engines/xeen/xeen.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index d34e8edb21..ed944262e1 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -51,6 +51,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _spells = nullptr; _town = nullptr; _eventData = nullptr; + _quitMode = 0; _dangerSenseAllowed = false; _noDirectionSense = false; _moveMonsters = false; @@ -289,6 +290,7 @@ void XeenEngine::playGame() { */ void XeenEngine::play() { // TODO: Init variables + _quitMode = 0; _interface->setup(); _screen->loadBackground("back.raw"); @@ -331,8 +333,8 @@ void XeenEngine::gameLoop() { while (!shouldQuit()) { _map->cellFlagLookup(_party->_mazePosition); if (_map->_currentIsEvent) { - _scripts->checkEvents(); - if (shouldQuit()) + _quitMode = _scripts->checkEvents(); + if (shouldQuit() || _quitMode) return; } _scripts->giveTreasure(); -- cgit v1.2.3 From c798a555105c58f82d373b92b479a577d4215cb9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 9 Feb 2015 21:34:03 -0500 Subject: XEEN: More refactoring needed for party dialog setup --- engines/xeen/xeen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index ed944262e1..3c2b7a2c77 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -94,7 +94,7 @@ void XeenEngine::initialize() { _interface = new Interface(this); _map = new Map(this); _party = new Party(this); - _saves = new SavesManager(this, *_party, _roster); + _saves = new SavesManager(this, *_party); _screen = new Screen(this); _scripts = new Scripts(this); _screen->setupWindows(); -- cgit v1.2.3 From 8256f7c8dfcdefe7da352fd36b42dc0931a111f8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 10 Feb 2015 08:42:59 -0500 Subject: XEEN: Refacored face sprites loading into Roster and Character classes --- engines/xeen/xeen.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 3c2b7a2c77..e0a2bebacd 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -295,7 +295,6 @@ void XeenEngine::play() { _interface->setup(); _screen->loadBackground("back.raw"); _screen->loadPalette("mm4.pal"); - _interface->loadPartyIcons(); if (getGameID() != GType_WorldOfXeen && !_map->_loadDarkSide) { _map->_loadDarkSide = true; -- cgit v1.2.3 From ef2a4595c2c17260f61ad93d6c4374af7fa8a606 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 15 Feb 2015 15:01:22 -0500 Subject: XEEN: Moved _openDoor into InterfaceMap --- engines/xeen/xeen.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index e0a2bebacd..a3240bf8b5 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -56,7 +56,6 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _noDirectionSense = false; _moveMonsters = false; _mode = MODE_0; - _openDoor = 0; _startupWindowActive = false; } -- cgit v1.2.3 From 9725fc57252b6dd4529e5f8e45519ac6fc480a12 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 Feb 2015 23:45:11 -0500 Subject: XEEN: Renaming and move flags used for UI indicators --- engines/xeen/xeen.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index a3240bf8b5..1410d65627 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -52,9 +52,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _town = nullptr; _eventData = nullptr; _quitMode = 0; - _dangerSenseAllowed = false; _noDirectionSense = false; - _moveMonsters = false; _mode = MODE_0; _startupWindowActive = false; } @@ -315,13 +313,13 @@ void XeenEngine::play() { _screen->_windows[0].update(); _events->setCursor(0); - _moveMonsters = true; + _combat->_moveMonsters = true; if (_mode == MODE_0) { _mode = MODE_1; _screen->fadeIn(4); } - _moveMonsters = true; + _combat->_moveMonsters = true; gameLoop(); } -- cgit v1.2.3 From b46561ef293da3299ff4e7fb85ffd49222faab67 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 27 Feb 2015 07:50:32 -0500 Subject: XEEN: Implemented openGrate --- engines/xeen/xeen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 1410d65627..a1604a5eab 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -333,7 +333,7 @@ void XeenEngine::gameLoop() { if (shouldQuit() || _quitMode) return; } - _scripts->giveTreasure(); + _party->giveTreasure(); // Main user interface handler for waiting for and processing user input _interface->perform(); -- cgit v1.2.3 From ee5b8ed59f1aaa00767ac3805d7ab63dd5a5f5d4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Mar 2015 10:41:11 -0500 Subject: XEEN: Implement remaining spells --- engines/xeen/xeen.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index a1604a5eab..fb7edead00 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -350,4 +350,9 @@ Common::String XeenEngine::printK(uint value) { Common::String::format("%u", value); } +Common::String XeenEngine::printK2(uint value) { + return (value > 999) ? Common::String::format("%uk", value / 1000) : + Common::String::format("%u", value); +} + } // End of namespace Xeen -- cgit v1.2.3 From b6e39dbf79801b5d96ca9292a47825d39f1e3fb4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Nov 2015 20:11:23 -0500 Subject: XEEN: Some initial work on better sound manager --- engines/xeen/xeen.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index fb7edead00..90349858ee 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -266,10 +266,6 @@ void XeenEngine::writeSavegameHeader(Common::OutSaveFile *out, XeenSavegameHeade // out->writeUint32LE(_events->getFrameCounter()); } -void XeenEngine::showIntro() { - -} - void XeenEngine::showMainMenu() { //OptionsMenu::show(this); } -- cgit v1.2.3 From 0c199f079bc1ed62e6c13f292d569fc52eac546c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 27 Aug 2016 16:33:32 -0400 Subject: XEEN: Beginnings of sound effects support --- engines/xeen/xeen.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 90349858ee..3b317f52d6 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -95,9 +95,10 @@ void XeenEngine::initialize() { _screen = new Screen(this); _scripts = new Scripts(this); _screen->setupWindows(); - _sound = new SoundManager(this); + _sound = new SoundManager(this, _mixer); _spells = new Spells(this); _town = new Town(this); + VOC::init(this); File f("029.obj"); _eventData = f.readStream(f.size()); -- cgit v1.2.3 From fd2d4622966d36299129b3f1654484b49ee0c996 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Aug 2016 17:52:56 -0400 Subject: XEEN: Moved method comments from CPP to header files --- engines/xeen/xeen.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 3b317f52d6..da7810c4cb 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -271,9 +271,6 @@ void XeenEngine::showMainMenu() { //OptionsMenu::show(this); } -/** - * Main method for playing the game - */ void XeenEngine::playGame() { _saves->reset(); play(); -- cgit v1.2.3 From 0c948b6bd0fc87cb57ee8939228435921a504803 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 Sep 2016 14:19:05 -0400 Subject: XEEN: Fix Travis identified warnings --- engines/xeen/xeen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index da7810c4cb..066f238fed 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -335,8 +335,8 @@ void XeenEngine::gameLoop() { } Common::String XeenEngine::printMil(uint value) { - return (value >= 1000000) ? Common::String::format("%lu mil", value / 1000000) : - Common::String::format("%lu", value); + return (value >= 1000000) ? Common::String::format("%u mil", value / 1000000) : + Common::String::format("%u", value); } Common::String XeenEngine::printK(uint value) { -- cgit v1.2.3 From 12d57ad5fe48568a8d67665ed285c9d591590d1a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 Sep 2016 16:52:35 -0400 Subject: XEEN: Beginnings of Darkside endgame and music --- engines/xeen/xeen.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/xeen/xeen.cpp') diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 066f238fed..e549c8e845 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -98,7 +98,8 @@ void XeenEngine::initialize() { _sound = new SoundManager(this, _mixer); _spells = new Spells(this); _town = new Town(this); - VOC::init(this); + Voc::init(this); + Music::init(this); File f("029.obj"); _eventData = f.readStream(f.size()); -- cgit v1.2.3